diff --git a/drivers/staging/unisys/include/diagchannel.h b/drivers/staging/unisys/include/diagchannel.h index c1e74e85ecc8..82932c53f5c6 100644 --- a/drivers/staging/unisys/include/diagchannel.h +++ b/drivers/staging/unisys/include/diagchannel.h @@ -13,169 +13,15 @@ * details. */ -/*++ - * - * Module Name: - * - * diagchannel.h - * - * Abstract: - * - * This file defines the DiagChannel protocol. This protocol is used to aid in - * preserving event data sent by external applications. This protocol provides - * a region for event data to reside in. This data will eventually be sent to - * the Boot Partition where it will be committed to memory and/or disk. This - * file contains platform-independent data that can be built using any - * Supervisor build environment (Windows, Linux, EFI). - * -*/ - #ifndef _DIAG_CHANNEL_H_ #define _DIAG_CHANNEL_H_ #include -#include "channel.h" - -/* {EEA7A573-DB82-447c-8716-EFBEAAAE4858} */ -#define SPAR_DIAG_CHANNEL_PROTOCOL_UUID \ - UUID_LE(0xeea7a573, 0xdb82, 0x447c, \ - 0x87, 0x16, 0xef, 0xbe, 0xaa, 0xae, 0x48, 0x58) - -static const uuid_le spar_diag_channel_protocol_uuid = - SPAR_DIAG_CHANNEL_PROTOCOL_UUID; - -/* {E850F968-3263-4484-8CA5-2A35D087A5A8} */ -#define ULTRA_DIAG_ROOT_CHANNEL_PROTOCOL_GUID \ - UUID_LE(0xe850f968, 0x3263, 0x4484, \ - 0x8c, 0xa5, 0x2a, 0x35, 0xd0, 0x87, 0xa5, 0xa8) - -#define ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE - -/* Must increment this whenever you insert or delete fields within this channel -* struct. Also increment whenever you change the meaning of fields within this -* channel struct so as to break pre-existing software. Note that you can -* usually add fields to the END of the channel struct withOUT needing to -* increment this. */ -#define ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID 2 #define MAX_MODULE_NAME_SIZE 128 /* Maximum length of module name... */ #define MAX_ADDITIONAL_INFO_SIZE 256 /* Maximum length of any additional info - * accompanying event... */ -#define MAX_SUBSYSTEMS 64 /* Maximum number of subsystems allowed in - * DiagChannel... */ -#define LOW_SUBSYSTEMS 32 /* Half of MAX_SUBSYSTEMS to allow 64-bit - * math */ -#define SUBSYSTEM_DEBUG 0 /* Standard subsystem for debug events */ -#define SUBSYSTEM_DEFAULT 1 /* Default subsystem for legacy calls to - * ReportEvent */ - -/* few useful subsystem mask values */ -#define SUBSYSTEM_MASK_DEBUG 0x01 /* Standard subsystem for debug - * events */ -#define SUBSYSTEM_MASK_DEFAULT 0x02 /* Default subsystem for legacy calls to - * ReportEvents */ - -/* Event parameter "Severity" is overloaded with Cause in byte 2 and Severity in - * byte 0, bytes 1 and 3 are reserved */ -#define SEVERITY_MASK 0x0FF /* mask out all but the Severity in byte 0 */ -#define CAUSE_MASK 0x0FF0000 /* mask out all but the cause in byte 2 */ -#define CAUSE_SHIFT_AMT 16 /* shift 2 bytes to place it in byte 2 */ - -/* SubsystemSeverityFilter */ -#define SEVERITY_FILTER_MASK 0x0F /* mask out the Cause half, SeverityFilter is - * in the lower nibble */ -#define CAUSE_FILTER_MASK 0xF0 /* mask out the Severity half, CauseFilter is in - * the upper nibble */ -#define CAUSE_FILTER_SHIFT_AMT 4 /* shift amount to place it in lower or upper - * nibble */ - -/* Copied from EFI's EFI_TIME struct in efidef.h. EFI headers are not allowed -* in some of the Supervisor areas, such as Monitor, so it has been "ported" here -* for use in diagnostic event timestamps... */ -struct diag_efi_time { - u16 year; /* 1998 - 20XX */ - u8 month; /* 1 - 12 */ - u8 day; /* 1 - 31 */ - u8 hour; /* 0 - 23 */ - u8 minute; /* 0 - 59 */ - u8 second; /* 0 - 59 */ - u8 pad1; - u32 nanosecond; /* 0 - 999, 999, 999 */ - s16 timezone; /* -1440 to 1440 or 2047 */ - u8 daylight; - u8 pad2; -}; - -enum spar_component_types { - ULTRA_COMPONENT_GUEST = 0, - ULTRA_COMPONENT_MONITOR = 0x01, - ULTRA_COMPONENT_CCM = 0x02, /* Common Control module */ - /* RESERVED 0x03 - 0x7 */ - - /* Ultravisor Components */ - ULTRA_COMPONENT_BOOT = 0x08, - ULTRA_COMPONENT_IDLE = 0x09, - ULTRA_COMPONENT_CONTROL = 0x0A, - ULTRA_COMPONENT_LOGGER = 0x0B, - ULTRA_COMPONENT_ACPI = 0X0C, - /* RESERVED 0x0D - 0x0F */ - - /* sPAR Components */ - ULTRA_COMPONENT_COMMAND = 0x10, - ULTRA_COMPONENT_IODRIVER = 0x11, - ULTRA_COMPONENT_CONSOLE = 0x12, - ULTRA_COMPONENT_OPERATIONS = 0x13, - ULTRA_COMPONENT_MANAGEMENT = 0x14, - ULTRA_COMPONENT_DIAG = 0x15, - ULTRA_COMPONENT_HWDIAG = 0x16, - ULTRA_COMPONENT_PSERVICES = 0x17, - ULTRA_COMPONENT_PDIAG = 0x18 - /* RESERVED 0x18 - 0x1F */ -}; - -/* Structure: diag_channel_event Purpose: Contains attributes that make up an - * event to be written to the DIAG_CHANNEL memory. Attributes: EventId: Id of - * the diagnostic event to write to memory. Severity: Severity of the event - * (Error, Info, etc). ModuleName: Module/file name where event originated. - * LineNumber: Line number in module name where event originated. Timestamp: - * Date/time when event was received by ReportEvent, and written to DiagChannel. - * Reserved: Padding to align structure on a 64-byte cache line boundary. - * AdditionalInfo: Array of characters for additional event info (may be - * empty). */ -struct diag_channel_event { - u32 event_id; - u32 severity; - u8 module_name[MAX_MODULE_NAME_SIZE]; - u32 line_number; - struct diag_efi_time timestamp; /* Size = 16 bytes */ - u32 partition_number; /* Filled in by Diag Switch as pool blocks are - * filled */ - u16 vcpu_number; - u16 lcpu_number; - u8 component_type; /* ULTRA_COMPONENT_TYPES */ - u8 subsystem; - u16 reserved0; /* pad to u64 alignment */ - u32 block_no; /* filled in by DiagSwitch as pool blocks are - * filled */ - u32 block_no_high; - u32 event_no; /* filled in by DiagSwitch as pool blocks are - * filled */ - u32 event_no_high; - - /* The block_no and event_no fields are set only by DiagSwitch - * and referenced only by WinDiagDisplay formatting tool as - * additional diagnostic information. Other tools including - * WinDiagDisplay currently ignore these 'Reserved' bytes. */ - u8 reserved[8]; - u8 additional_info[MAX_ADDITIONAL_INFO_SIZE]; - - /* NOTE: Changes to diag_channel_event generally need to be reflected in - * existing copies * - * - for AppOS at - * GuestLinux/visordiag_early/supervisor_diagchannel.h * - * - for WinDiagDisplay at - * EFI/Ultra/Tools/WinDiagDisplay/WinDiagDisplay/diagstruct.h */ -}; + * accompanying event... + */ /* Levels of severity for diagnostic events, in order from lowest severity to * highest (i.e. fatal errors are the most severe, and should always be logged, @@ -202,212 +48,4 @@ enum diag_severity { DIAG_SEVERITY_ENUM_END = 5 }; -/* Event Cause enums -* -* Levels of cause for diagnostic events, in order from least to greatest cause -* Internal errors are most urgent since ideally they should never exist -* Invalid requests are preventable by avoiding invalid inputs -* Operations errors depend on environmental factors which may impact which -* requests are possible -* Manifest provides intermediate value to capture firmware and configuration -* version information -* Trace provides suplimental debug information in release firmware -* Unknown Log captures unclasified LogEvent calls. -* Debug is the least urgent since it provides suplimental debug information only -* in debug firmware -* Unknown Debug captures unclassified DebugEvent calls. -* This enum is also defined in -* DotNet\sParFramework\ControlFramework\ControlFramework.cs. -* If a change is made to this enum, they should also be reflected in that -* file. */ - -/* A cause value "DIAG_CAUSE_FILE_XFER" together with a severity value of -* "DIAG_SEVERITY_PRINT" (=4), is used for transferring text or binary file to -* the Diag partition. This cause-severity combination will be used by Logger -* DiagSwitch to segregate events into block types. The files are transferred in -* 256 byte chunks maximum, in the AdditionalInfo field of the diag_channel_event -* structure. In the file transfer mode, some event fields will have different -* meaning: EventId specifies the file offset, severity specifies the block type, -* ModuleName specifies the filename, LineNumber specifies the number of valid -* data bytes in an event and AdditionalInfo contains up to 256 bytes of data. */ - -/* The Diag DiagWriter appends event blocks to events.raw as today, and for data - * blocks uses diag_channel_event - * PartitionNumber to extract and append 'AdditionalInfo' to filename (specified - * by ModuleName). */ - -/* The Dell PDiag uses this new mechanism to stash DSET .zip onto the - * 'diagnostic' virtual disk. */ -enum diag_cause { - DIAG_CAUSE_UNKNOWN = 0, - DIAG_CAUSE_UNKNOWN_DEBUG = DIAG_CAUSE_UNKNOWN + 1, /* 1 */ - DIAG_CAUSE_DEBUG = DIAG_CAUSE_UNKNOWN_DEBUG + 1, /* 2 */ - DIAG_CAUSE_UNKNOWN_LOG = DIAG_CAUSE_DEBUG + 1, /* 3 */ - DIAG_CAUSE_TRACE = DIAG_CAUSE_UNKNOWN_LOG + 1, /* 4 */ - DIAG_CAUSE_MANIFEST = DIAG_CAUSE_TRACE + 1, /* 5 */ - DIAG_CAUSE_OPERATIONS_ERROR = DIAG_CAUSE_MANIFEST + 1, /* 6 */ - DIAG_CAUSE_INVALID_REQUEST = DIAG_CAUSE_OPERATIONS_ERROR + 1, /* 7 */ - DIAG_CAUSE_INTERNAL_ERROR = DIAG_CAUSE_INVALID_REQUEST + 1, /* 8 */ - DIAG_CAUSE_FILE_XFER = DIAG_CAUSE_INTERNAL_ERROR + 1, /* 9 */ - DIAG_CAUSE_ENUM_END = DIAG_CAUSE_FILE_XFER /* 9 */ -}; - -/* Event Cause category defined into the byte 2 of Severity */ -#define CAUSE_DEBUG (DIAG_CAUSE_DEBUG << CAUSE_SHIFT_AMT) -#define CAUSE_TRACE (DIAG_CAUSE_TRACE << CAUSE_SHIFT_AMT) -#define CAUSE_MANIFEST (DIAG_CAUSE_MANIFEST << CAUSE_SHIFT_AMT) -#define CAUSE_OPERATIONS_ERROR (DIAG_CAUSE_OPERATIONS_ERROR << CAUSE_SHIFT_AMT) -#define CAUSE_INVALID_REQUEST (DIAG_CAUSE_INVALID_REQUEST << CAUSE_SHIFT_AMT) -#define CAUSE_INTERNAL_ERROR (DIAG_CAUSE_INTERNAL_ERROR << CAUSE_SHIFT_AMT) -#define CAUSE_FILE_XFER (DIAG_CAUSE_FILE_XFER << CAUSE_SHIFT_AMT) -#define CAUSE_ENUM_END CAUSE_FILE_XFER - -/* Combine Cause and Severity categories into one */ -#define CAUSE_DEBUG_SEVERITY_VERBOSE \ - (CAUSE_DEBUG | DIAG_SEVERITY_VERBOSE) -#define CAUSE_TRACE_SEVERITY_VERBOSE \ - (CAUSE_TRACE | DIAG_SEVERITY_VERBOSE) -#define CAUSE_MANIFEST_SEVERITY_VERBOSE\ - (CAUSE_MANIFEST | DIAG_SEVERITY_VERBOSE) -#define CAUSE_OPERATIONS_SEVERITY_VERBOSE \ - (CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_VERBOSE) -#define CAUSE_INVALID_SEVERITY_VERBOSE \ - (CAUSE_INVALID_REQUEST | DIAG_SEVERITY_VERBOSE) -#define CAUSE_INTERNAL_SEVERITY_VERBOSE \ - (CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_VERBOSE) - -#define CAUSE_DEBUG_SEVERITY_INFO \ - (CAUSE_DEBUG | DIAG_SEVERITY_INFO) -#define CAUSE_TRACE_SEVERITY_INFO \ - (CAUSE_TRACE | DIAG_SEVERITY_INFO) -#define CAUSE_MANIFEST_SEVERITY_INFO \ - (CAUSE_MANIFEST | DIAG_SEVERITY_INFO) -#define CAUSE_OPERATIONS_SEVERITY_INFO \ - (CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_INFO) -#define CAUSE_INVALID_SEVERITY_INFO \ - (CAUSE_INVALID_REQUEST | DIAG_SEVERITY_INFO) -#define CAUSE_INTERNAL_SEVERITY_INFO \ - (CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_INFO) - -#define CAUSE_DEBUG_SEVERITY_WARN \ - (CAUSE_DEBUG | DIAG_SEVERITY_WARNING) -#define CAUSE_TRACE_SEVERITY_WARN \ - (CAUSE_TRACE | DIAG_SEVERITY_WARNING) -#define CAUSE_MANIFEST_SEVERITY_WARN \ - (CAUSE_MANIFEST | DIAG_SEVERITY_WARNING) -#define CAUSE_OPERATIONS_SEVERITY_WARN \ - (CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_WARNING) -#define CAUSE_INVALID_SEVERITY_WARN \ - (CAUSE_INVALID_REQUEST | DIAG_SEVERITY_WARNING) -#define CAUSE_INTERNAL_SEVERITY_WARN \ - (CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_WARNING) - -#define CAUSE_DEBUG_SEVERITY_ERR \ - (CAUSE_DEBUG | DIAG_SEVERITY_ERR) -#define CAUSE_TRACE_SEVERITY_ERR \ - (CAUSE_TRACE | DIAG_SEVERITY_ERR) -#define CAUSE_MANIFEST_SEVERITY_ERR \ - (CAUSE_MANIFEST | DIAG_SEVERITY_ERR) -#define CAUSE_OPERATIONS_SEVERITY_ERR \ - (CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_ERR) -#define CAUSE_INVALID_SEVERITY_ERR \ - (CAUSE_INVALID_REQUEST | DIAG_SEVERITY_ERR) -#define CAUSE_INTERNAL_SEVERITY_ERR \ - (CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_ERR) - -#define CAUSE_DEBUG_SEVERITY_PRINT \ - (CAUSE_DEBUG | DIAG_SEVERITY_PRINT) -#define CAUSE_TRACE_SEVERITY_PRINT \ - (CAUSE_TRACE | DIAG_SEVERITY_PRINT) -#define CAUSE_MANIFEST_SEVERITY_PRINT \ - (CAUSE_MANIFEST | DIAG_SEVERITY_PRINT) -#define CAUSE_OPERATIONS_SEVERITY_PRINT \ - (CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_PRINT) -#define CAUSE_INVALID_SEVERITY_PRINT \ - (CAUSE_INVALID_REQUEST | DIAG_SEVERITY_PRINT) -#define CAUSE_INTERNAL_SEVERITY_PRINT \ - (CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_PRINT) -#define CAUSE_FILE_XFER_SEVERITY_PRINT \ - (CAUSE_FILE_XFER | DIAG_SEVERITY_PRINT) - -/* Structure: diag_channel_protocol_header - * - * Purpose: Contains attributes that make up the header specific to the - * DIAG_CHANNEL area. - * - * Attributes: - * - * DiagLock: Diag Channel spinlock. - * - *IsChannelInitialized: 1 iff SignalInit was called for this channel; otherwise - * 0, and assume the channel is not ready for use yet. - * - * Reserved: Padding to align the fields in this structure. - * - *SubsystemSeverityFilter: Level of severity on a subsystem basis that controls - * whether events are logged. Any event's severity for a - * particular subsystem below this level will be discarded. - */ -struct diag_channel_protocol_header { - u32 diag_lock; - u8 channel_initialized; - u8 reserved[3]; - u8 subsystem_severity_filter[64]; -}; - -/* The Diagram for the Diagnostic Channel: */ -/* ----------------------- */ -/* | Channel Header | Defined by ULTRA_CHANNEL_PROTOCOL */ -/* ----------------------- */ -/* | Signal Queue Header | Defined by SIGNAL_QUEUE_HEADER */ -/* ----------------------- */ -/* | DiagChannel Header | Defined by diag_channel_protocol_header */ -/* ----------------------- */ -/* | Channel Event Info | Defined by diag_channel_event*MAX_EVENTS */ -/* ----------------------- */ -/* | Reserved | Reserved (pad out to 4MB) */ -/* ----------------------- */ - -/* Offsets/sizes for diagnostic channel attributes... */ -#define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(struct channel_header)) -#define DIAG_CH_QUEUE_HEADER_SIZE (sizeof(struct signal_queue_header)) -#define DIAG_CH_PROTOCOL_HEADER_OFFSET \ - (DIAG_CH_QUEUE_HEADER_OFFSET + DIAG_CH_QUEUE_HEADER_SIZE) -#define DIAG_CH_PROTOCOL_HEADER_SIZE \ - (sizeof(struct diag_channel_protocol_header)) -#define DIAG_CH_EVENT_OFFSET \ - (DIAG_CH_PROTOCOL_HEADER_OFFSET + DIAG_CH_PROTOCOL_HEADER_SIZE) -#define DIAG_CH_SIZE (4096 * 1024) - -/* For Control and Idle Partitions with larger (8 MB) diagnostic(root) - * channels */ -#define DIAG_CH_LRG_SIZE (2 * DIAG_CH_SIZE) /* 8 MB */ - -/* - * Structure: spar_diag_channel_protocol - * - * Purpose: Contains attributes that make up the DIAG_CHANNEL memory. - * - * Attributes: - * - * CommonChannelHeader: Header info common to all channels. - * - * QueueHeader: Queue header common to all channels - used to determine where to - * store event. - * - * DiagChannelHeader: Diagnostic channel header info (see - * diag_channel_protocol_header comments). - * - * Events: Area where diagnostic events (up to MAX_EVENTS) are written. - * - *Reserved: Reserved area to allow for correct channel size padding. -*/ -struct spar_diag_channel_protocol { - struct channel_header common_channel_header; - struct signal_queue_header queue_header; - struct diag_channel_protocol_header diag_channel_header; - struct diag_channel_event events[(DIAG_CH_SIZE - DIAG_CH_EVENT_OFFSET) / - sizeof(struct diag_channel_event)]; -}; - #endif diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 4385b155ad60..90a3c30c9701 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -110,17 +110,8 @@ static DEFINE_SEMAPHORE(notifier_lock); static struct cdev file_cdev; static struct visorchannel **file_controlvm_channel; static struct controlvm_message_header g_chipset_msg_hdr; -static const uuid_le spar_diag_pool_channel_protocol_uuid = - SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID; -/* 0xffffff is an invalid Bus/Device number */ -static u32 g_diagpool_bus_no = 0xffffff; -static u32 g_diagpool_dev_no = 0xffffff; static struct controlvm_message_packet g_devicechangestate_packet; -#define is_diagpool_channel(channel_type_guid) \ - (uuid_le_cmp(channel_type_guid,\ - spar_diag_pool_channel_protocol_uuid) == 0) - static LIST_HEAD(bus_info_list); static LIST_HEAD(dev_info_list); @@ -827,14 +818,6 @@ controlvm_respond(struct controlvm_message_header *msg_hdr, int response) struct controlvm_message outmsg; controlvm_init_response(&outmsg, msg_hdr, response); - /* For DiagPool channel DEVICE_CHANGESTATE, we need to send - * back the deviceChangeState structure in the packet. */ - if (msg_hdr->id == CONTROLVM_DEVICE_CHANGESTATE && - g_devicechangestate_packet.device_change_state.bus_no == - g_diagpool_bus_no && - g_devicechangestate_packet.device_change_state.dev_no == - g_diagpool_dev_no) - outmsg.cmd = g_devicechangestate_packet; if (outmsg.hdr.flags.test_message == 1) return; @@ -1008,15 +991,8 @@ device_epilog(struct visor_device *dev_info, { struct visorchipset_busdev_notifiers *notifiers; bool notified = false; - u32 bus_no = dev_info->chipset_bus_no; - u32 dev_no = dev_info->chipset_dev_no; struct controlvm_message_header *pmsg_hdr = NULL; - char *envp[] = { - "SPARSP_DIAGPOOL_PAUSED_STATE = 1", - NULL - }; - notifiers = &busdev_notifiers; if (!dev_info) { @@ -1075,21 +1051,6 @@ device_epilog(struct visor_device *dev_info, (*notifiers->device_pause) (dev_info); notified = true; } - } else if (state.alive == segment_state_paused.alive && - state.operating == - segment_state_paused.operating) { - /* this is lite pause where channel is - * still valid just 'pause' of it - */ - if (bus_no == g_diagpool_bus_no && - dev_no == g_diagpool_dev_no) { - /* this will trigger the - * diag_shutdown.sh script in - * the visorchipset hotplug */ - kobject_uevent_env - (&visorchipset_platform_device.dev. - kobj, KOBJ_ONLINE, envp); - } } break; case CONTROLVM_DEVICE_DESTROY: @@ -1298,12 +1259,6 @@ my_device_create(struct controlvm_message *inmsg) POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); cleanup: - /* get the bus and devNo for DiagPool channel */ - if (dev_info && - is_diagpool_channel(cmd->create_device.data_type_uuid)) { - g_diagpool_bus_no = bus_no; - g_diagpool_dev_no = dev_no; - } device_epilog(dev_info, segment_state_running, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1, 1);