diff options
Diffstat (limited to 'drivers/staging/unisys/common-spar/include')
9 files changed, 723 insertions, 1103 deletions
diff --git a/drivers/staging/unisys/common-spar/include/channels/channel.h b/drivers/staging/unisys/common-spar/include/channels/channel.h index c25dfbf7f6bc..6fb6e5b3ddaf 100644 --- a/drivers/staging/unisys/common-spar/include/channels/channel.h +++ b/drivers/staging/unisys/common-spar/include/channels/channel.h @@ -50,43 +50,12 @@ #define ULTRA_CHANNEL_PROTOCOL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L') -#define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \ - lin, logCtx) \ - do { \ - pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=%pUL actual=%pUL @%s:%d\n", \ - chName, &chType, field, \ - &expected, &actual, \ - fil, lin); \ - } while (0) -#define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \ - lin, logCtx) \ - do { \ - pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d\n", \ - chName, &chType, field, \ - (unsigned long)expected, (unsigned long)actual, \ - fil, lin); \ - } while (0) - -#define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \ - lin, logCtx) \ - do { \ - pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d\n", \ - chName, &chType, field, \ - (unsigned long long)expected, \ - (unsigned long long)actual, \ - fil, lin); \ - } while (0) - -#define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \ - LineNumber, Str, args...) \ - pr_info(Str, ## args) - -typedef enum { +enum channel_serverstate { CHANNELSRV_UNINITIALIZED = 0, /* channel is in an undefined state */ CHANNELSRV_READY = 1 /* channel has been initialized by server */ -} CHANNEL_SERVERSTATE; +}; -typedef enum { +enum channel_clientstate { CHANNELCLI_DETACHED = 0, CHANNELCLI_DISABLED = 1, /* client can see channel but is NOT * allowed to use it unless given TBD @@ -100,32 +69,32 @@ typedef enum { * using channel */ CHANNELCLI_OWNED = 5 /* "no worries" state - client can * access channel anytime */ -} CHANNEL_CLIENTSTATE; +}; + static inline const u8 * ULTRA_CHANNELCLI_STRING(u32 v) { switch (v) { case CHANNELCLI_DETACHED: - return (const u8 *) ("DETACHED"); + return (const u8 *)("DETACHED"); case CHANNELCLI_DISABLED: - return (const u8 *) ("DISABLED"); + return (const u8 *)("DISABLED"); case CHANNELCLI_ATTACHING: - return (const u8 *) ("ATTACHING"); + return (const u8 *)("ATTACHING"); case CHANNELCLI_ATTACHED: - return (const u8 *) ("ATTACHED"); + return (const u8 *)("ATTACHED"); case CHANNELCLI_BUSY: - return (const u8 *) ("BUSY"); + return (const u8 *)("BUSY"); case CHANNELCLI_OWNED: - return (const u8 *) ("OWNED"); + return (const u8 *)("OWNED"); default: break; } - return (const u8 *) ("?"); + return (const u8 *)("?"); } -#define ULTRA_CHANNELSRV_IS_READY(x) ((x) == CHANNELSRV_READY) -#define ULTRA_CHANNEL_SERVER_READY(pChannel) \ - (ULTRA_CHANNELSRV_IS_READY(readl(&(pChannel)->SrvState))) +#define SPAR_CHANNEL_SERVER_READY(ch) \ + (readl(&(ch)->srv_state) == CHANNELSRV_READY) #define ULTRA_VALID_CHANNELCLI_TRANSITION(o, n) \ (((((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_DISABLED)) || \ @@ -145,60 +114,41 @@ ULTRA_CHANNELCLI_STRING(u32 v) (((o) == CHANNELCLI_BUSY) && ((n) == CHANNELCLI_OWNED)) || (0)) \ ? (1) : (0)) -#define ULTRA_CHANNEL_CLIENT_CHK_TRANSITION(old, new, chanId, logCtx, \ +#define SPAR_CHANNEL_CLIENT_CHK_TRANSITION(old, new, id, log, \ file, line) \ do { \ if (!ULTRA_VALID_CHANNELCLI_TRANSITION(old, new)) \ - UltraLogEvent(logCtx, \ - CHANNELSTATE_DIAG_EVENTID_TRANSITERR, \ - CHANNELSTATE_DIAG_SEVERITY, \ - CHANNELSTATE_DIAG_SUBSYS, \ - __func__, __LINE__, \ - "%s Channel StateTransition INVALID! (%s) %s(%d)-->%s(%d) @%s:%d\n", \ - chanId, "CliState<x>", \ - ULTRA_CHANNELCLI_STRING(old), \ - old, \ - ULTRA_CHANNELCLI_STRING(new), \ - new, \ - PathName_Last_N_Nodes((u8 *)file, 4), \ - line); \ + pr_info("%s Channel StateTransition INVALID! (%s) %s(%d)-->%s(%d) @%s:%d\n", \ + id, "CliState<x>", \ + ULTRA_CHANNELCLI_STRING(old), \ + old, \ + ULTRA_CHANNELCLI_STRING(new), \ + new, \ + pathname_last_n_nodes((u8 *)file, 4), \ + line); \ } while (0) -#define ULTRA_CHANNEL_CLIENT_TRANSITION(pChan, chanId, \ - newstate, logCtx) \ +#define SPAR_CHANNEL_CLIENT_TRANSITION(ch, id, newstate, log) \ do { \ - ULTRA_CHANNEL_CLIENT_CHK_TRANSITION( \ - readl(&(((CHANNEL_HEADER __iomem *) \ - (pChan))->CliStateOS)), \ - newstate, \ - chanId, logCtx, __FILE__, __LINE__); \ - UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK, \ - CHANNELSTATE_DIAG_SEVERITY, \ - CHANNELSTATE_DIAG_SUBSYS, \ - __func__, __LINE__, \ - "%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \ - chanId, "CliStateOS", \ - ULTRA_CHANNELCLI_STRING( \ - readl(&((CHANNEL_HEADER __iomem *) \ - (pChan))->CliStateOS)), \ - readl(&((CHANNEL_HEADER __iomem *) \ - (pChan))->CliStateOS), \ - ULTRA_CHANNELCLI_STRING(newstate), \ - newstate, \ - PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \ - writel(newstate, &((CHANNEL_HEADER __iomem *) \ - (pChan))->CliStateOS); \ + SPAR_CHANNEL_CLIENT_CHK_TRANSITION( \ + readl(&(((struct channel_header __iomem *)\ + (ch))->cli_state_os)), \ + newstate, id, log, __FILE__, __LINE__); \ + pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \ + id, "CliStateOS", \ + ULTRA_CHANNELCLI_STRING( \ + readl(&((struct channel_header __iomem *)\ + (ch))->cli_state_os)), \ + readl(&((struct channel_header __iomem *)\ + (ch))->cli_state_os), \ + ULTRA_CHANNELCLI_STRING(newstate), \ + newstate, \ + pathname_last_n_nodes(__FILE__, 4), __LINE__); \ + writel(newstate, &((struct channel_header __iomem *)\ + (ch))->cli_state_os); \ mb(); /* required for channel synch */ \ } while (0) -#define ULTRA_CHANNEL_CLIENT_ACQUIRE_OS(pChan, chanId, logCtx) \ - ULTRA_channel_client_acquire_os(pChan, chanId, logCtx, \ - (char *)__FILE__, __LINE__, \ - (char *)__func__) -#define ULTRA_CHANNEL_CLIENT_RELEASE_OS(pChan, chanId, logCtx) \ - ULTRA_channel_client_release_os(pChan, chanId, logCtx, \ - (char *)__FILE__, __LINE__, (char *)__func__) - /* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorBoot: */ /* throttling invalid boot channel statetransition error due to client * disabled */ @@ -239,98 +189,98 @@ ULTRA_CHANNELCLI_STRING(u32 v) #pragma pack(push, 1) /* both GCC and VC now allow this pragma */ /* Common Channel Header */ -typedef struct _CHANNEL_HEADER { - u64 Signature; /* Signature */ - u32 LegacyState; /* DEPRECATED - being replaced by */ +struct channel_header { + u64 signature; /* Signature */ + u32 legacy_state; /* DEPRECATED - being replaced by */ /* / SrvState, CliStateBoot, and CliStateOS below */ - u32 HeaderSize; /* sizeof(CHANNEL_HEADER) */ - u64 Size; /* Total size of this channel in bytes */ - u64 Features; /* Flags to modify behavior */ - uuid_le Type; /* Channel type: data, bus, control, etc. */ - u64 PartitionHandle; /* ID of guest partition */ - u64 Handle; /* Device number of this channel in client */ - u64 oChannelSpace; /* Offset in bytes to channel specific area */ - u32 VersionId; /* CHANNEL_HEADER Version ID */ - u32 PartitionIndex; /* Index of guest partition */ - uuid_le ZoneGuid; /* Guid of Channel's zone */ - u32 oClientString; /* offset from channel header to + u32 header_size; /* sizeof(struct channel_header) */ + u64 size; /* Total size of this channel in bytes */ + u64 features; /* Flags to modify behavior */ + uuid_le chtype; /* Channel type: data, bus, control, etc. */ + u64 partition_handle; /* ID of guest partition */ + u64 handle; /* Device number of this channel in client */ + u64 ch_space_offset; /* Offset in bytes to channel specific area */ + u32 version_id; /* struct channel_header Version ID */ + u32 partition_index; /* Index of guest partition */ + uuid_le zone_uuid; /* Guid of Channel's zone */ + u32 cli_str_offset; /* offset from channel header to * nul-terminated ClientString (0 if * ClientString not present) */ - u32 CliStateBoot; /* CHANNEL_CLIENTSTATE of pre-boot + u32 cli_state_boot; /* CHANNEL_CLIENTSTATE of pre-boot * EFI client of this channel */ - u32 CmdStateCli; /* CHANNEL_COMMANDSTATE (overloaded in + u32 cmd_state_cli; /* CHANNEL_COMMANDSTATE (overloaded in * Windows drivers, see ServerStateUp, * ServerStateDown, etc) */ - u32 CliStateOS; /* CHANNEL_CLIENTSTATE of Guest OS + u32 cli_state_os; /* CHANNEL_CLIENTSTATE of Guest OS * client of this channel */ - u32 ChannelCharacteristics; /* CHANNEL_CHARACTERISTIC_<xxx> */ - u32 CmdStateSrv; /* CHANNEL_COMMANDSTATE (overloaded in + u32 ch_characteristic; /* CHANNEL_CHARACTERISTIC_<xxx> */ + u32 cmd_state_srv; /* CHANNEL_COMMANDSTATE (overloaded in * Windows drivers, see ServerStateUp, * ServerStateDown, etc) */ - u32 SrvState; /* CHANNEL_SERVERSTATE */ - u8 CliErrorBoot; /* bits to indicate err states for + u32 srv_state; /* CHANNEL_SERVERSTATE */ + u8 cli_error_boot; /* bits to indicate err states for * boot clients, so err messages can * be throttled */ - u8 CliErrorOS; /* bits to indicate err states for OS + u8 cli_error_os; /* bits to indicate err states for OS * clients, so err messages can be * throttled */ - u8 Filler[1]; /* Pad out to 128 byte cacheline */ + u8 filler[1]; /* Pad out to 128 byte cacheline */ /* Please add all new single-byte values below here */ - u8 RecoverChannel; -} CHANNEL_HEADER, *pCHANNEL_HEADER, ULTRA_CHANNEL_PROTOCOL; + u8 recover_channel; +}; #define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0) /* Subheader for the Signal Type variation of the Common Channel */ -typedef struct _SIGNAL_QUEUE_HEADER { +struct signal_queue_header { /* 1st cache line */ - u32 VersionId; /* SIGNAL_QUEUE_HEADER Version ID */ - u32 Type; /* Queue type: storage, network */ - u64 Size; /* Total size of this queue in bytes */ - u64 oSignalBase; /* Offset to signal queue area */ - u64 FeatureFlags; /* Flags to modify behavior */ - u64 NumSignalsSent; /* Total # of signals placed in this queue */ - u64 NumOverflows; /* Total # of inserts failed due to + u32 version; /* SIGNAL_QUEUE_HEADER Version ID */ + u32 chtype; /* Queue type: storage, network */ + u64 size; /* Total size of this queue in bytes */ + u64 sig_base_offset; /* Offset to signal queue area */ + u64 features; /* Flags to modify behavior */ + u64 num_sent; /* Total # of signals placed in this queue */ + u64 num_overflows; /* Total # of inserts failed due to * full queue */ - u32 SignalSize; /* Total size of a signal for this queue */ - u32 MaxSignalSlots; /* Max # of slots in queue, 1 slot is + u32 signal_size; /* Total size of a signal for this queue */ + u32 max_slots; /* Max # of slots in queue, 1 slot is * always empty */ - u32 MaxSignals; /* Max # of signals in queue + u32 max_signals; /* Max # of signals in queue * (MaxSignalSlots-1) */ - u32 Head; /* Queue head signal # */ + u32 head; /* Queue head signal # */ /* 2nd cache line */ - u64 NumSignalsReceived; /* Total # of signals removed from this queue */ - u32 Tail; /* Queue tail signal # (on separate + u64 num_received; /* Total # of signals removed from this queue */ + u32 tail; /* Queue tail signal # (on separate * cache line) */ - u32 Reserved1; /* Reserved field */ - u64 Reserved2; /* Resrved field */ - u64 ClientQueue; - u64 NumInterruptsReceived; /* Total # of Interrupts received. This + u32 reserved1; /* Reserved field */ + u64 reserved2; /* Reserved field */ + u64 client_queue; + u64 num_irq_received; /* Total # of Interrupts received. This * is incremented by the ISR in the * guest windows driver */ - u64 NumEmptyCnt; /* Number of times that visor_signal_remove + u64 num_empty; /* Number of times that visor_signal_remove * is called and returned Empty * Status. */ - u32 ErrorFlags; /* Error bits set during SignalReinit + u32 errorflags; /* Error bits set during SignalReinit * to denote trouble with client's * fields */ - u8 Filler[12]; /* Pad out to 64 byte cacheline */ -} SIGNAL_QUEUE_HEADER, *pSIGNAL_QUEUE_HEADER; + u8 filler[12]; /* Pad out to 64 byte cacheline */ +}; #pragma pack(pop) -#define SignalInit(chan, QHDRFLD, QDATAFLD, QDATATYPE, ver, typ) \ +#define spar_signal_init(chan, QHDRFLD, QDATAFLD, QDATATYPE, ver, typ) \ do { \ memset(&chan->QHDRFLD, 0, sizeof(chan->QHDRFLD)); \ - chan->QHDRFLD.VersionId = ver; \ - chan->QHDRFLD.Type = typ; \ - chan->QHDRFLD.Size = sizeof(chan->QDATAFLD); \ - chan->QHDRFLD.SignalSize = sizeof(QDATATYPE); \ - chan->QHDRFLD.oSignalBase = (u64)(chan->QDATAFLD)- \ + chan->QHDRFLD.version = ver; \ + chan->QHDRFLD.chtype = typ; \ + chan->QHDRFLD.size = sizeof(chan->QDATAFLD); \ + chan->QHDRFLD.signal_size = sizeof(QDATATYPE); \ + chan->QHDRFLD.sig_base_offset = (u64)(chan->QDATAFLD)- \ (u64)(&chan->QHDRFLD); \ - chan->QHDRFLD.MaxSignalSlots = \ + chan->QHDRFLD.max_slots = \ sizeof(chan->QDATAFLD)/sizeof(QDATATYPE); \ - chan->QHDRFLD.MaxSignals = chan->QHDRFLD.MaxSignalSlots-1; \ + chan->QHDRFLD.max_signals = chan->QHDRFLD.max_slots-1; \ } while (0) /* Generic function useful for validating any type of channel when it is @@ -339,64 +289,62 @@ typedef struct _SIGNAL_QUEUE_HEADER { * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. */ static inline int -ULTRA_check_channel_client(void __iomem *pChannel, - uuid_le expectedTypeGuid, - char *channelName, - u64 expectedMinBytes, - u32 expectedVersionId, - u64 expectedSignature, - char *fileName, int lineNumber, void *logCtx) +spar_check_channel_client(void __iomem *ch, + uuid_le expected_uuid, + char *chname, + u64 expected_min_bytes, + u32 expected_version, + u64 expected_signature) { - if (uuid_le_cmp(expectedTypeGuid, NULL_UUID_LE) != 0) { + if (uuid_le_cmp(expected_uuid, NULL_UUID_LE) != 0) { uuid_le guid; memcpy_fromio(&guid, - &((CHANNEL_HEADER __iomem *)(pChannel))->Type, + &((struct channel_header __iomem *)(ch))->chtype, sizeof(guid)); /* caller wants us to verify type GUID */ - if (uuid_le_cmp(guid, expectedTypeGuid) != 0) { - CHANNEL_GUID_MISMATCH(expectedTypeGuid, channelName, - "type", expectedTypeGuid, - guid, fileName, - lineNumber, logCtx); + if (uuid_le_cmp(guid, expected_uuid) != 0) { + pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n", + chname, &expected_uuid, + &expected_uuid, &guid); return 0; } } - if (expectedMinBytes > 0) /* caller wants us to verify + if (expected_min_bytes > 0) { /* caller wants us to verify * channel size */ - if (readq(&((CHANNEL_HEADER __iomem *) - (pChannel))->Size) < expectedMinBytes) { - CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName, - "size", expectedMinBytes, - readq(&((CHANNEL_HEADER __iomem *) - (pChannel))->Size), - fileName, - lineNumber, logCtx); + unsigned long long bytes = + readq(&((struct channel_header __iomem *) + (ch))->size); + if (bytes < expected_min_bytes) { + pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", + chname, &expected_uuid, + (unsigned long long)expected_min_bytes, bytes); return 0; } - if (expectedVersionId > 0) /* caller wants us to verify + } + if (expected_version > 0) { /* caller wants us to verify * channel version */ - if (readl(&((CHANNEL_HEADER __iomem *) (pChannel))->VersionId) - != expectedVersionId) { - CHANNEL_U32_MISMATCH(expectedTypeGuid, channelName, - "version", expectedVersionId, - readl(&((CHANNEL_HEADER __iomem *) - (pChannel))->VersionId), - fileName, lineNumber, logCtx); + unsigned long ver = readl(&((struct channel_header __iomem *) + (ch))->version_id); + if (ver != expected_version) { + pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n", + chname, &expected_uuid, + (unsigned long)expected_version, ver); return 0; } - if (expectedSignature > 0) /* caller wants us to verify + } + if (expected_signature > 0) { /* caller wants us to verify * channel signature */ - if (readq(&((CHANNEL_HEADER __iomem *) (pChannel))->Signature) - != expectedSignature) { - CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName, - "signature", expectedSignature, - readq(&((CHANNEL_HEADER __iomem *) - (pChannel))->Signature), - fileName, - lineNumber, logCtx); + unsigned long long sig = + readq(&((struct channel_header __iomem *) + (ch))->signature); + if (sig != expected_signature) { + pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n", + chname, &expected_uuid, + expected_signature, sig); return 0; } + } return 1; } @@ -405,19 +353,16 @@ ULTRA_check_channel_client(void __iomem *pChannel, * Note that <logCtx> is only needed for callers in the EFI environment, and * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. */ -static inline int -ULTRA_check_channel_server(uuid_le typeGuid, - char *channelName, - u64 expectedMinBytes, - u64 actualBytes, - char *fileName, int lineNumber, void *logCtx) +static inline int spar_check_channel_server(uuid_le typeuuid, char *name, + u64 expected_min_bytes, + u64 actual_bytes) { - if (expectedMinBytes > 0) /* caller wants us to verify + if (expected_min_bytes > 0) /* caller wants us to verify * channel size */ - if (actualBytes < expectedMinBytes) { - CHANNEL_U64_MISMATCH(typeGuid, channelName, "size", - expectedMinBytes, actualBytes, - fileName, lineNumber, logCtx); + if (actual_bytes < expected_min_bytes) { + pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8llx actual=0x%-8.8llx\n", + name, &typeuuid, expected_min_bytes, + actual_bytes); return 0; } return 1; @@ -430,7 +375,7 @@ ULTRA_check_channel_server(uuid_le typeGuid, * in it, the return pointer will be to the beginning of the string. */ static inline u8 * -PathName_Last_N_Nodes(u8 *s, unsigned int n) +pathname_last_n_nodes(u8 *s, unsigned int n) { u8 *p = s; unsigned int node_count = 0; @@ -455,59 +400,43 @@ PathName_Last_N_Nodes(u8 *s, unsigned int n) } static inline int -ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId, - void *logCtx, char *file, int line, char *func) +spar_channel_client_acquire_os(void __iomem *ch, u8 *id) { - CHANNEL_HEADER __iomem *pChan = pChannel; + struct channel_header __iomem *hdr = ch; - if (readl(&pChan->CliStateOS) == CHANNELCLI_DISABLED) { - if ((readb(&pChan->CliErrorOS) + if (readl(&hdr->cli_state_os) == CHANNELCLI_DISABLED) { + if ((readb(&hdr->cli_error_os) & ULTRA_CLIERROROS_THROTTLEMSG_DISABLED) == 0) { /* we are NOT throttling this message */ - writeb(readb(&pChan->CliErrorOS) | + writeb(readb(&hdr->cli_error_os) | ULTRA_CLIERROROS_THROTTLEMSG_DISABLED, - &pChan->CliErrorOS); + &hdr->cli_error_os); /* throttle until acquire successful */ - UltraLogEvent(logCtx, - CHANNELSTATE_DIAG_EVENTID_TRANSITERR, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel StateTransition INVALID! - acquire failed because OS client DISABLED @%s:%d\n", - chanId, PathName_Last_N_Nodes( - (u8 *) file, 4), line); + pr_info("%s Channel StateTransition INVALID! - acquire failed because OS client DISABLED\n", + id); } return 0; } - if ((readl(&pChan->CliStateOS) != CHANNELCLI_OWNED) - && (readl(&pChan->CliStateBoot) == CHANNELCLI_DISABLED)) { + if ((readl(&hdr->cli_state_os) != CHANNELCLI_OWNED) && + (readl(&hdr->cli_state_boot) == CHANNELCLI_DISABLED)) { /* Our competitor is DISABLED, so we can transition to OWNED */ - UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", - chanId, "CliStateOS", - ULTRA_CHANNELCLI_STRING( - readl(&pChan->CliStateOS)), - readl(&pChan->CliStateOS), - ULTRA_CHANNELCLI_STRING(CHANNELCLI_OWNED), - CHANNELCLI_OWNED, - PathName_Last_N_Nodes((u8 *) file, 4), line); - writel(CHANNELCLI_OWNED, &pChan->CliStateOS); + pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d)\n", + id, "cli_state_os", + ULTRA_CHANNELCLI_STRING(readl(&hdr->cli_state_os)), + readl(&hdr->cli_state_os), + ULTRA_CHANNELCLI_STRING(CHANNELCLI_OWNED), + CHANNELCLI_OWNED); + writel(CHANNELCLI_OWNED, &hdr->cli_state_os); mb(); /* required for channel synch */ } - if (readl(&pChan->CliStateOS) == CHANNELCLI_OWNED) { - if (readb(&pChan->CliErrorOS) != 0) { + if (readl(&hdr->cli_state_os) == CHANNELCLI_OWNED) { + if (readb(&hdr->cli_error_os) != 0) { /* we are in an error msg throttling state; * come out of it */ - UltraLogEvent(logCtx, - CHANNELSTATE_DIAG_EVENTID_TRANSITOK, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel OS client acquire now successful @%s:%d\n", - chanId, PathName_Last_N_Nodes((u8 *) file, - 4), line); - writeb(0, &pChan->CliErrorOS); + pr_info("%s Channel OS client acquire now successful\n", + id); + writeb(0, &hdr->cli_error_os); } return 1; } @@ -515,95 +444,67 @@ ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId, /* We have to do it the "hard way". We transition to BUSY, * and can use the channel iff our competitor has not also * transitioned to BUSY. */ - if (readl(&pChan->CliStateOS) != CHANNELCLI_ATTACHED) { - if ((readb(&pChan->CliErrorOS) + if (readl(&hdr->cli_state_os) != CHANNELCLI_ATTACHED) { + if ((readb(&hdr->cli_error_os) & ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED) == 0) { /* we are NOT throttling this message */ - writeb(readb(&pChan->CliErrorOS) | + writeb(readb(&hdr->cli_error_os) | ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED, - &pChan->CliErrorOS); + &hdr->cli_error_os); /* throttle until acquire successful */ - UltraLogEvent(logCtx, - CHANNELSTATE_DIAG_EVENTID_TRANSITERR, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel StateTransition INVALID! - acquire failed because OS client NOT ATTACHED (state=%s(%d)) @%s:%d\n", - chanId, - ULTRA_CHANNELCLI_STRING( - readl(&pChan->CliStateOS)), - readl(&pChan->CliStateOS), - PathName_Last_N_Nodes((u8 *) file, 4), - line); + pr_info("%s Channel StateTransition INVALID! - acquire failed because OS client NOT ATTACHED (state=%s(%d))\n", + id, ULTRA_CHANNELCLI_STRING( + readl(&hdr->cli_state_os)), + readl(&hdr->cli_state_os)); } return 0; } - writel(CHANNELCLI_BUSY, &pChan->CliStateOS); + writel(CHANNELCLI_BUSY, &hdr->cli_state_os); mb(); /* required for channel synch */ - if (readl(&pChan->CliStateBoot) == CHANNELCLI_BUSY) { - if ((readb(&pChan->CliErrorOS) + if (readl(&hdr->cli_state_boot) == CHANNELCLI_BUSY) { + if ((readb(&hdr->cli_error_os) & ULTRA_CLIERROROS_THROTTLEMSG_BUSY) == 0) { /* we are NOT throttling this message */ - writeb(readb(&pChan->CliErrorOS) | + writeb(readb(&hdr->cli_error_os) | ULTRA_CLIERROROS_THROTTLEMSG_BUSY, - &pChan->CliErrorOS); + &hdr->cli_error_os); /* throttle until acquire successful */ - UltraLogEvent(logCtx, - CHANNELSTATE_DIAG_EVENTID_TRANSITBUSY, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel StateTransition failed - host OS acquire failed because boot BUSY @%s:%d\n", - chanId, PathName_Last_N_Nodes((u8 *) file, - 4), line); + pr_info("%s Channel StateTransition failed - host OS acquire failed because boot BUSY\n", + id); } /* reset busy */ - writel(CHANNELCLI_ATTACHED, &pChan->CliStateOS); + writel(CHANNELCLI_ATTACHED, &hdr->cli_state_os); mb(); /* required for channel synch */ return 0; } - if (readb(&pChan->CliErrorOS) != 0) { + if (readb(&hdr->cli_error_os) != 0) { /* we are in an error msg throttling state; come out of it */ - UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel OS client acquire now successful @%s:%d\n", - chanId, PathName_Last_N_Nodes((u8 *) file, 4), - line); - writeb(0, &pChan->CliErrorOS); + pr_info("%s Channel OS client acquire now successful\n", id); + writeb(0, &hdr->cli_error_os); } return 1; } static inline void -ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId, - void *logCtx, char *file, int line, char *func) +spar_channel_client_release_os(void __iomem *ch, u8 *id) { - CHANNEL_HEADER __iomem *pChan = pChannel; + struct channel_header __iomem *hdr = ch; - if (readb(&pChan->CliErrorOS) != 0) { + if (readb(&hdr->cli_error_os) != 0) { /* we are in an error msg throttling state; come out of it */ - UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel OS client error state cleared @%s:%d\n", - chanId, PathName_Last_N_Nodes((u8 *) file, 4), - line); - writeb(0, &pChan->CliErrorOS); + pr_info("%s Channel OS client error state cleared\n", id); + writeb(0, &hdr->cli_error_os); } - if (readl(&pChan->CliStateOS) == CHANNELCLI_OWNED) + if (readl(&hdr->cli_state_os) == CHANNELCLI_OWNED) return; - if (readl(&pChan->CliStateOS) != CHANNELCLI_BUSY) { - UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITERR, - CHANNELSTATE_DIAG_SEVERITY, - CHANNELSTATE_DIAG_SUBSYS, func, line, - "%s Channel StateTransition INVALID! - release failed because OS client NOT BUSY (state=%s(%d)) @%s:%d\n", - chanId, - ULTRA_CHANNELCLI_STRING( - readl(&pChan->CliStateOS)), - readl(&pChan->CliStateOS), - PathName_Last_N_Nodes((u8 *) file, 4), line); + if (readl(&hdr->cli_state_os) != CHANNELCLI_BUSY) { + pr_info("%s Channel StateTransition INVALID! - release failed because OS client NOT BUSY (state=%s(%d))\n", + id, ULTRA_CHANNELCLI_STRING( + readl(&hdr->cli_state_os)), + readl(&hdr->cli_state_os)); /* return; */ } - writel(CHANNELCLI_ATTACHED, &pChan->CliStateOS); /* release busy */ + writel(CHANNELCLI_ATTACHED, &hdr->cli_state_os); /* release busy */ } /* @@ -625,8 +526,8 @@ ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId, * full. */ -unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal); +unsigned char spar_signal_insert(struct channel_header __iomem *ch, u32 queue, + void *sig); /* * Routine Description: @@ -647,8 +548,8 @@ unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, * empty. */ -unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal); +unsigned char spar_signal_remove(struct channel_header __iomem *ch, u32 queue, + void *sig); /* * Routine Description: @@ -669,8 +570,8 @@ unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, * Return value: * # of signals copied. */ -unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, - void *pSignal); +unsigned int spar_signal_remove_all(struct channel_header *ch, u32 queue, + void *sig); /* * Routine Description: @@ -683,7 +584,7 @@ unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, * Return value: * 1 if the signal queue is empty, 0 otherwise. */ -unsigned char visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel, - u32 Queue); +unsigned char spar_signalqueue_empty(struct channel_header __iomem *ch, + u32 queue); #endif diff --git a/drivers/staging/unisys/common-spar/include/channels/channel_guid.h b/drivers/staging/unisys/common-spar/include/channels/channel_guid.h index 63c67ca4c9ec..706363fc3e9a 100644 --- a/drivers/staging/unisys/common-spar/include/channels/channel_guid.h +++ b/drivers/staging/unisys/common-spar/include/channels/channel_guid.h @@ -20,45 +20,42 @@ /* Used in IOChannel * {414815ed-c58c-11da-95a9-00e08161165f} */ -#define ULTRA_VHBA_CHANNEL_PROTOCOL_GUID \ +#define SPAR_VHBA_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x414815ed, 0xc58c, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) -static const uuid_le UltraVhbaChannelProtocolGuid = - ULTRA_VHBA_CHANNEL_PROTOCOL_GUID; +static const uuid_le spar_vhba_channel_protocol_uuid = + SPAR_VHBA_CHANNEL_PROTOCOL_UUID; /* Used in IOChannel * {8cd5994d-c58e-11da-95a9-00e08161165f} */ -#define ULTRA_VNIC_CHANNEL_PROTOCOL_GUID \ +#define SPAR_VNIC_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x8cd5994d, 0xc58e, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) -static const uuid_le UltraVnicChannelProtocolGuid = - ULTRA_VNIC_CHANNEL_PROTOCOL_GUID; +static const uuid_le spar_vnic_channel_protocol_uuid = + SPAR_VNIC_CHANNEL_PROTOCOL_UUID; /* Used in IOChannel * {72120008-4AAB-11DC-8530-444553544200} */ -#define ULTRA_SIOVM_GUID \ +#define SPAR_SIOVM_UUID \ UUID_LE(0x72120008, 0x4AAB, 0x11DC, \ 0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00) -static const uuid_le UltraSIOVMGuid = ULTRA_SIOVM_GUID; - +static const uuid_le spar_siovm_uuid = SPAR_SIOVM_UUID; /* Used in visornoop/visornoop_main.c * {5b52c5ac-e5f5-4d42-8dff-429eaecd221f} */ -#define ULTRA_CONTROLDIRECTOR_CHANNEL_PROTOCOL_GUID \ +#define SPAR_CONTROLDIRECTOR_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x5b52c5ac, 0xe5f5, 0x4d42, \ 0x8d, 0xff, 0x42, 0x9e, 0xae, 0xcd, 0x22, 0x1f) -static const uuid_le UltraControlDirectorChannelProtocolGuid = - ULTRA_CONTROLDIRECTOR_CHANNEL_PROTOCOL_GUID; +static const uuid_le spar_controldirector_channel_protocol_uuid = + SPAR_CONTROLDIRECTOR_CHANNEL_PROTOCOL_UUID; /* Used in visorchipset/visorchipset_main.c * {B4E79625-AEDE-4EAA-9E11-D3EDDCD4504C} */ -#define ULTRA_DIAG_POOL_CHANNEL_PROTOCOL_GUID \ +#define SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID \ UUID_LE(0xb4e79625, 0xaede, 0x4eaa, \ 0x9e, 0x11, 0xd3, 0xed, 0xdc, 0xd4, 0x50, 0x4c) - - diff --git a/drivers/staging/unisys/common-spar/include/channels/controlframework.h b/drivers/staging/unisys/common-spar/include/channels/controlframework.h index fd4726e754ea..33d9caf337c8 100644 --- a/drivers/staging/unisys/common-spar/include/channels/controlframework.h +++ b/drivers/staging/unisys/common-spar/include/channels/controlframework.h @@ -28,50 +28,35 @@ #include <linux/types.h> #include "channel.h" -#define ULTRA_MEMORY_COUNT_Ki 1024 - -/* Scale order 0 is one 32-bit (4-byte) word (in 64 or 128-bit - * architecture potentially 64 or 128-bit word) */ -#define ULTRA_MEMORY_PAGE_WORD 4 - -/* Define Ki scale page to be traditional 4KB page */ -#define ULTRA_MEMORY_PAGE_Ki (ULTRA_MEMORY_PAGE_WORD * ULTRA_MEMORY_COUNT_Ki) -typedef struct _ULTRA_SEGMENT_STATE { - u16 Enabled:1; /* Bit 0: May enter other states */ - u16 Active:1; /* Bit 1: Assigned to active partition */ - u16 Alive:1; /* Bit 2: Configure message sent to +struct spar_segment_state { + u16 enabled:1; /* Bit 0: May enter other states */ + u16 active:1; /* Bit 1: Assigned to active partition */ + u16 alive:1; /* Bit 2: Configure message sent to * service/server */ - u16 Revoked:1; /* Bit 3: similar to partition state + u16 revoked:1; /* Bit 3: similar to partition state * ShuttingDown */ - u16 Allocated:1; /* Bit 4: memory (device/port number) + u16 allocated:1; /* Bit 4: memory (device/port number) * has been selected by Command */ - u16 Known:1; /* Bit 5: has been introduced to the + u16 known:1; /* Bit 5: has been introduced to the * service/guest partition */ - u16 Ready:1; /* Bit 6: service/Guest partition has + u16 ready:1; /* Bit 6: service/Guest partition has * responded to introduction */ - u16 Operating:1; /* Bit 7: resource is configured and + u16 operating:1; /* Bit 7: resource is configured and * operating */ /* Note: don't use high bit unless we need to switch to ushort * which is non-compliant */ -} ULTRA_SEGMENT_STATE; -static const ULTRA_SEGMENT_STATE SegmentStateRunning = { +}; + +static const struct spar_segment_state segment_state_running = { 1, 1, 1, 0, 1, 1, 1, 1 }; -static const ULTRA_SEGMENT_STATE SegmentStatePaused = { + +static const struct spar_segment_state segment_state_paused = { 1, 1, 1, 0, 1, 1, 1, 0 }; -static const ULTRA_SEGMENT_STATE SegmentStateStandby = { + +static const struct spar_segment_state segment_state_standby = { 1, 1, 0, 0, 1, 1, 1, 0 }; -typedef union { - u64 Full; - struct { - u8 Major; /* will be 1 for the first release and - * increment thereafter */ - u8 Minor; - u16 Maintenance; - u32 Revision; /* Subversion revision */ - } Part; -} ULTRA_COMPONENT_VERSION; #endif /* _CONTROL_FRAMEWORK_H_ not defined */ diff --git a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h index d08c198e0de3..a66db7968d6c 100644 --- a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h @@ -27,12 +27,12 @@ enum { INVALID_GUEST_FIRMWARE, SAMPLE_GUEST_FIRMWARE, }; /* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */ -#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_GUID \ +#define SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x2b3c2d10, 0x7ef5, 0x4ad8, \ 0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d) -static const uuid_le UltraControlvmChannelProtocolGuid = - ULTRA_CONTROLVM_CHANNEL_PROTOCOL_GUID; +static const uuid_le spar_controlvm_channel_protocol_uuid = + SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID; #define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE \ ULTRA_CHANNEL_PROTOCOL_SIGNATURE @@ -45,19 +45,13 @@ static const uuid_le UltraControlvmChannelProtocolGuid = * channel struct withOUT needing to increment this. */ #define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID 1 -#define ULTRA_CONTROLVM_CHANNEL_OK_CLIENT(pChannel, logCtx) \ - (ULTRA_check_channel_client(pChannel, \ - UltraControlvmChannelProtocolGuid, \ +#define SPAR_CONTROLVM_CHANNEL_OK_CLIENT(ch) \ + spar_check_channel_client(ch, \ + spar_controlvm_channel_protocol_uuid, \ "controlvm", \ - sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \ + sizeof(struct spar_controlvm_channel_protocol), \ ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE, \ - __FILE__, __LINE__, logCtx)) -#define ULTRA_CONTROLVM_CHANNEL_OK_SERVER(actualBytes, logCtx) \ - (ULTRA_check_channel_server(UltraControlvmChannelProtocolGuid, \ - "controlvm", \ - sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \ - actualBytes, __FILE__, __LINE__, logCtx)) + ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE) #define MY_DEVICE_INDEX 0 #define MAX_MACDATA_LEN 8 /* number of bytes for MAC address in config packet */ @@ -88,7 +82,7 @@ static const uuid_le UltraControlvmChannelProtocolGuid = * - issued on the EventQueue queue (q #2) in the ControlVm channel * - responded to on the EventAckQueue queue (q #3) in the ControlVm channel */ -typedef enum { +enum controlvm_id { CONTROLVM_INVALID = 0, /* SWITCH commands required Parameter: SwitchNumber */ /* BUS commands required Parameter: BusNumber */ @@ -117,9 +111,9 @@ typedef enum { CONTROLVM_CHIPSET_READY = 0x304, /* CP --> SP */ CONTROLVM_CHIPSET_SELFTEST = 0x305, /* CP --> SP */ -} CONTROLVM_ID; +}; -struct InterruptInfo { +struct irq_info { /**< specifies interrupt info. It is used to send interrupts * for this channel. The peer at the end of this channel * who has registered an interrupt (using recv fields @@ -128,495 +122,390 @@ struct InterruptInfo { * interrupt. Currently this is used by IOPart-SP to wake * up GP when Data Channel transitions from empty to * non-empty.*/ - u64 sendInterruptHandle; + u64 send_irq_handle; /**< specifies interrupt handle. It is used to retrieve the * corresponding interrupt pin from Monitor; and the * interrupt pin is used to connect to the corresponding - * intrrupt. Used by IOPart-GP only. */ - u64 recvInterruptHandle; + * interrupt. Used by IOPart-GP only. */ + u64 recv_irq_handle; /**< specifies interrupt vector. It, interrupt pin, and shared are * used to connect to the corresponding interrupt. Used by * IOPart-GP only. */ - u32 recvInterruptVector; + u32 recv_irq_vector; /**< specifies if the recvInterrupt is shared. It, interrupt pin * and vector are used to connect to 0 = not shared; 1 = shared. * the corresponding interrupt. Used by IOPart-GP only. */ - u8 recvInterruptShared; + u8 recv_irq_shared; u8 reserved[3]; /* Natural alignment purposes */ }; -struct PciId { - u16 Domain; - u8 Bus; - u8 Slot; - u8 Func; - u8 Reserved[3]; /* Natural alignment purposes */ -}; - -struct PciConfigHdr { - u16 VendorId; - u16 SubSysVendor; - u16 DeviceId; - u16 SubSysDevice; - u32 ClassCode; - u32 Reserved; /* Natural alignment purposes */ -}; - -struct ScsiId { - u32 Bus; - u32 Target; - u32 Lun; - u32 Host; /* Command should ignore this for * - * DiskArrival/RemovalEvents */ -}; - -struct WWID { - u32 wwid1; - u32 wwid2; -}; - -struct virtDiskInfo { - u32 switchNo; /* defined by SWITCH_CREATE */ - u32 externalPortNo; /* 0 for SAS RAID provided (external) - * virtual disks, 1 for virtual disk - * images, 2 for gold disk images */ - u16 VirtualDiskIndex; /* Index of disk descriptor in the - * VirtualDisk segment associated with - * externalPortNo */ - u16 Reserved1; - u32 Reserved2; +struct pci_id { + u16 domain; + u8 bus; + u8 slot; + u8 func; + u8 reserved[3]; /* Natural alignment purposes */ }; -typedef enum { - CONTROLVM_ACTION_NONE = 0, - CONTROLVM_ACTION_SET_RESTORE = 0x05E7, - CONTROLVM_ACTION_CLEAR_RESTORE = 0x0C18, - CONTROLVM_ACTION_RESTORING = 0x08E5, - CONTROLVM_ACTION_RESTORE_BUSY = 0x0999, - CONTROLVM_ACTION_CLEAR_NVRAM = 0xB01 -} CONTROLVM_ACTION; - -typedef enum _ULTRA_TOOL_ACTIONS { - /* enumeration that defines intended action */ - ULTRA_TOOL_ACTION_NONE = 0, /* normal boot of boot disk */ - ULTRA_TOOL_ACTION_INSTALL = 1, /* install source disk(s) to boot - * disk */ - ULTRA_TOOL_ACTION_CAPTURE = 2, /* capture boot disk to target disk(s) - * as 'gold image' */ - ULTRA_TOOL_ACTION_REPAIR = 3, /* use source disk(s) to repair - * installation on boot disk */ - ULTRA_TOOL_ACTION_CLEAN = 4, /* 'scrub' virtual disk before - * releasing back to storage pool */ - ULTRA_TOOL_ACTION_UPGRADE = 5, /* upgrade to use content of images - * referenced from newer blueprint */ - ULTRA_TOOL_ACTION_DIAG = 6, /* use tool to invoke diagnostic script - * provided by blueprint */ - ULTRA_TOOL_ACTION_FAILED = 7, /* used when tool fails installation - and cannot continue */ - ULTRA_TOOL_ACTION_COUNT = 8 -} ULTRA_TOOL_ACTIONS; - -typedef struct _ULTRA_EFI_SPAR_INDICATION { - u64 BootToFirmwareUI:1; /* Bit 0: Stop in uefi ui */ - u64 ClearNvram:1; /* Bit 1: Clear NVRAM */ - u64 ClearCmos:1; /* Bit 2: Clear CMOS */ - u64 BootToTool:1; /* Bit 3: Run install tool */ +struct efi_spar_indication { + u64 boot_to_fw_ui:1; /* Bit 0: Stop in uefi ui */ + u64 clear_nvram:1; /* Bit 1: Clear NVRAM */ + u64 clear_cmos:1; /* Bit 2: Clear CMOS */ + u64 boot_to_tool:1; /* Bit 3: Run install tool */ /* remaining bits are available */ -} ULTRA_EFI_SPAR_INDICATION; +}; -typedef enum { +enum ultra_chipset_feature { ULTRA_CHIPSET_FEATURE_REPLY = 0x00000001, ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002, ULTRA_CHIPSET_FEATURE_PCIVBUS = 0x00000004 -} ULTRA_CHIPSET_FEATURE; +}; /** This is the common structure that is at the beginning of every * ControlVm message (both commands and responses) in any ControlVm * queue. Commands are easily distinguished from responses by * looking at the flags.response field. */ -typedef struct _CONTROLVM_MESSAGE_HEADER { - u32 Id; /* See CONTROLVM_ID. */ +struct controlvm_message_header { + u32 id; /* See CONTROLVM_ID. */ /* For requests, indicates the message type. */ /* For responses, indicates the type of message we are responding to. */ - u32 MessageSize; /* Includes size of this struct + size + u32 message_size; /* Includes size of this struct + size * of message */ - u32 SegmentIndex; /* Index of segment containing Vm + u32 segment_index; /* Index of segment containing Vm * message/information */ - u32 CompletionStatus; /* Error status code or result of + u32 completion_status; /* Error status code or result of * message completion */ struct { u32 failed:1; /**< =1 in a response to * signify * failure */ - u32 responseExpected:1; /**< =1 in all messages that expect a + u32 response_expected:1; /**< =1 in all messages that expect a * response (Control ignores this * bit) */ u32 server:1; /**< =1 in all bus & device-related * messages where the message * receiver is to act as the bus or * device server */ - u32 testMessage:1; /**< =1 for testing use only + u32 test_message:1; /**< =1 for testing use only * (Control and Command ignore this * bit) */ - u32 partialCompletion:1; /**< =1 if there are forthcoming + u32 partial_completion:1; /**< =1 if there are forthcoming * responses/acks associated * with this message */ u32 preserve:1; /**< =1 this is to let us know to * preserve channel contents * (for running guests)*/ - u32 writerInDiag:1; /**< =1 the DiagWriter is active in the + u32 writer_in_diag:1; /**< =1 the DiagWriter is active in the * Diagnostic Partition*/ - - /* remaining bits in this 32-bit word are available */ - } Flags; - u32 Reserved; /* Natural alignment */ - u64 MessageHandle; /* Identifies the particular message instance, + } flags; + u32 reserved; /* Natural alignment */ + u64 message_handle; /* Identifies the particular message instance, * and is used to match particular */ /* request instances with the corresponding response instance. */ - u64 PayloadVmOffset; /* Offset of payload area from start of this + u64 payload_vm_offset; /* Offset of payload area from start of this * instance of ControlVm segment */ - u32 PayloadMaxBytes; /* Maximum bytes allocated in payload + u32 payload_max_bytes; /* Maximum bytes allocated in payload * area of ControlVm segment */ - u32 PayloadBytes; /* Actual number of bytes of payload + u32 payload_bytes; /* Actual number of bytes of payload * area to copy between IO/Command; */ /* if non-zero, there is a payload to copy. */ -} CONTROLVM_MESSAGE_HEADER; - -typedef struct _CONTROLVM_PACKET_DEVICE_CREATE { - u32 busNo; /**< bus # (0..n-1) from the msg receiver's - * perspective */ +}; - /* Control uses header SegmentIndex field to access bus number... */ - u32 devNo; /**< bus-relative (0..n-1) device number */ - u64 channelAddr; /**< Guest physical address of the channel, which - * can be dereferenced by the receiver - * of this ControlVm command */ - u64 channelBytes; /**< specifies size of the channel in bytes */ - uuid_le dataTypeGuid;/**< specifies format of data in channel */ - uuid_le devInstGuid; /**< instance guid for the device */ - struct InterruptInfo intr; /**< specifies interrupt information */ -} CONTROLVM_PACKET_DEVICE_CREATE; /* for CONTROLVM_DEVICE_CREATE */ - -typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE { - u32 busNo; /**< bus # (0..n-1) from the msg +struct controlvm_packet_device_create { + u32 bus_no; /* bus # (0..n-1) from the msg receiver's end */ + u32 dev_no; /* bus-relative (0..n-1) device number */ + u64 channel_addr; /* Guest physical address of the channel, which + * can be dereferenced by the receiver of this + * ControlVm command */ + u64 channel_bytes; /* specifies size of the channel in bytes */ + uuid_le data_type_uuid; /* specifies format of data in channel */ + uuid_le dev_inst_uuid; /* instance guid for the device */ + struct irq_info intr; /* specifies interrupt information */ +}; /* for CONTROLVM_DEVICE_CREATE */ + +struct controlvm_packet_device_configure { + u32 bus_no; /**< bus # (0..n-1) from the msg * receiver's perspective */ /* Control uses header SegmentIndex field to access bus number... */ - u32 devNo; /**< bus-relative (0..n-1) device number */ -} CONTROLVM_PACKET_DEVICE_CONFIGURE; /* for CONTROLVM_DEVICE_CONFIGURE */ + u32 dev_no; /**< bus-relative (0..n-1) device number */ +} ; /* for CONTROLVM_DEVICE_CONFIGURE */ -typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE { - CONTROLVM_MESSAGE_HEADER Header; - CONTROLVM_PACKET_DEVICE_CREATE Packet; -} CONTROLVM_MESSAGE_DEVICE_CREATE; /* total 128 bytes */ +struct controlvm_message_device_create { + struct controlvm_message_header header; + struct controlvm_packet_device_create packet; +}; /* total 128 bytes */ -typedef struct _CONTROLVM_MESSAGE_DEVICE_CONFIGURE { - CONTROLVM_MESSAGE_HEADER Header; - CONTROLVM_PACKET_DEVICE_CONFIGURE Packet; -} CONTROLVM_MESSAGE_DEVICE_CONFIGURE; /* total 56 bytes */ +struct controlvm_message_device_configure { + struct controlvm_message_header header; + struct controlvm_packet_device_configure packet; +}; /* total 56 bytes */ /* This is the format for a message in any ControlVm queue. */ -typedef struct _CONTROLVM_MESSAGE_PACKET { +struct controlvm_message_packet { union { - - /* BEGIN Request messages */ struct { - u32 busNo; /*< bus # (0..n-1) from the msg - * receiver's perspective */ - - /* Control uses header SegmentIndex field to access bus number... */ - u32 deviceCount; /*< indicates the max number of - * devices on this bus */ - u64 channelAddr; /*< Guest physical address of the - * channel, which can be - * dereferenced by the receiver - * of this ControlVm command */ - u64 channelBytes; /*< size of the channel in bytes */ - uuid_le busDataTypeGuid;/*< indicates format of data in - bus channel */ - uuid_le busInstGuid; /*< instance guid for the bus */ - } createBus; /* for CONTROLVM_BUS_CREATE */ + u32 bus_no; /* bus # (0..n-1) from the msg + * receiver's perspective */ + u32 dev_count; /* indicates the max number of + * devices on this bus */ + u64 channel_addr; /* Guest physical address of + * the channel, which can be + * dereferenced by the receiver + * of this ControlVm command */ + u64 channel_bytes; /* size of the channel */ + uuid_le bus_data_type_uuid; /* indicates format of + * data in bus channel*/ + uuid_le bus_inst_uuid; /* instance uuid for the bus */ + } create_bus; /* for CONTROLVM_BUS_CREATE */ struct { - u32 busNo; /*< bus # (0..n-1) from the msg - * receiver's perspective */ - - /* Control uses header SegmentIndex field to access bus number... */ + u32 bus_no; /* bus # (0..n-1) from the msg + * receiver's perspective */ u32 reserved; /* Natural alignment purposes */ - } destroyBus; /* for CONTROLVM_BUS_DESTROY */ + } destroy_bus; /* for CONTROLVM_BUS_DESTROY */ struct { - u32 busNo; /*< bus # (0..n-1) from the - * msg receiver's - * perspective */ - - /* Control uses header SegmentIndex field to access bus number... */ - u32 reserved1; /* for alignment purposes */ - u64 guestHandle; /* This is used to convert - * guest physical address to real - * physical address for DMA, for ex. */ - u64 recvBusInterruptHandle;/*< specifies interrupt - * info. It is used by SP to register - * to receive interrupts from the CP. - * This interrupt is used for bus - * level notifications. The - * corresponding - * sendBusInterruptHandle is kept in - * CP. */ - } configureBus; /* for CONTROLVM_BUS_CONFIGURE */ - + u32 bus_no; /* bus # (0..n-1) from the receiver's + * perspective */ + u32 reserved1; /* for alignment purposes */ + u64 guest_handle; /* This is used to convert + * guest physical address to + * physical address */ + u64 recv_bus_irq_handle; + /* specifies interrupt info. It is used by SP + * to register to receive interrupts from the + * CP. This interrupt is used for bus level + * notifications. The corresponding + * sendBusInterruptHandle is kept in CP. */ + } configure_bus; /* for CONTROLVM_BUS_CONFIGURE */ /* for CONTROLVM_DEVICE_CREATE */ - CONTROLVM_PACKET_DEVICE_CREATE createDevice; + struct controlvm_packet_device_create create_device; struct { - u32 busNo; /*< bus # (0..n-1) from the msg - * receiver's perspective */ - - /* Control uses header SegmentIndex field to access bus number... */ - u32 devNo; /*< bus-relative (0..n-1) device - * number */ - } destroyDevice; /* for CONTROLVM_DEVICE_DESTROY */ - + u32 bus_no; /* bus # (0..n-1) from the msg + * receiver's perspective */ + u32 dev_no; /* bus-relative (0..n-1) device # */ + } destroy_device; /* for CONTROLVM_DEVICE_DESTROY */ /* for CONTROLVM_DEVICE_CONFIGURE */ - CONTROLVM_PACKET_DEVICE_CONFIGURE configureDevice; + struct controlvm_packet_device_configure configure_device; struct { - u32 busNo; /*< bus # (0..n-1) from the msg - * receiver's perspective */ - - /* Control uses header SegmentIndex field to access bus number... */ - u32 devNo; /*< bus-relative (0..n-1) device - * number */ - } reconfigureDevice; /* for CONTROLVM_DEVICE_RECONFIGURE */ + u32 bus_no; /* bus # (0..n-1) from the msg + * receiver's perspective */ + u32 dev_no; /* bus-relative (0..n-1) device # */ + } reconfigure_device; /* for CONTROLVM_DEVICE_RECONFIGURE */ struct { - u32 busNo; - ULTRA_SEGMENT_STATE state; + u32 bus_no; + struct spar_segment_state state; u8 reserved[2]; /* Natural alignment purposes */ - } busChangeState; /* for CONTROLVM_BUS_CHANGESTATE */ + } bus_change_state; /* for CONTROLVM_BUS_CHANGESTATE */ struct { - u32 busNo; - u32 devNo; - ULTRA_SEGMENT_STATE state; + u32 bus_no; + u32 dev_no; + struct spar_segment_state state; struct { - u32 physicalDevice:1; /* =1 if message is for + u32 phys_device:1; /* =1 if message is for * a physical device */ - /* remaining bits in this 32-bit word are available */ } flags; u8 reserved[2]; /* Natural alignment purposes */ - } deviceChangeState; /* for CONTROLVM_DEVICE_CHANGESTATE */ + } device_change_state; /* for CONTROLVM_DEVICE_CHANGESTATE */ struct { - u32 busNo; - u32 devNo; - ULTRA_SEGMENT_STATE state; + u32 bus_no; + u32 dev_no; + struct spar_segment_state state; u8 reserved[6]; /* Natural alignment purposes */ - } deviceChangeStateEvent; /* for CONTROLVM_DEVICE_CHANGESTATE_EVENT */ + } device_change_state_event; + /* for CONTROLVM_DEVICE_CHANGESTATE_EVENT */ struct { - u32 busCount; /*< indicates the max number of busses */ - u32 switchCount; /*< indicates the max number of - * switches (applicable for service - * partition only) */ - ULTRA_CHIPSET_FEATURE features; - u32 platformNumber; /* Platform Number */ - } initChipset; /* for CONTROLVM_CHIPSET_INIT */ + u32 bus_count; /* indicates the max number of busses */ + u32 switch_count; /* indicates the max number of + * switches if a service partition */ + enum ultra_chipset_feature features; + u32 platform_number; /* Platform Number */ + } init_chipset; /* for CONTROLVM_CHIPSET_INIT */ struct { - u32 Options; /*< reserved */ - u32 Test; /*< bit 0 set to run embedded selftest */ - } chipsetSelftest; /* for CONTROLVM_CHIPSET_SELFTEST */ - - /* END Request messages */ - - /* BEGIN Response messages */ - - /* END Response messages */ - - /* BEGIN Event messages */ + u32 options; /* reserved */ + u32 test; /* bit 0 set to run embedded selftest */ + } chipset_selftest; /* for CONTROLVM_CHIPSET_SELFTEST */ + u64 addr; /* a physical address of something, that can be + * dereferenced by the receiver of this + * ControlVm command (depends on command id) */ + u64 handle; /* a handle of something (depends on command + * id) */ + }; +}; - /* END Event messages */ +/* All messages in any ControlVm queue have this layout. */ +struct controlvm_message { + struct controlvm_message_header hdr; + struct controlvm_message_packet cmd; +}; - /* BEGIN Ack messages */ +struct device_map { + GUEST_PHYSICAL_ADDRESS device_channel_address; + u64 device_channel_size; + u32 ca_index; + u32 reserved; /* natural alignment */ + u64 reserved2; /* Align structure on 32-byte boundary */ +}; - /* END Ack messages */ - u64 addr; /*< a physical address of something, that - * can be dereferenced by the receiver of - * this ControlVm command (depends on - * command id) */ - u64 handle; /*< a handle of something (depends on - * command id) */ - }; -} CONTROLVM_MESSAGE_PACKET; +struct guest_devices { + struct device_map video_channel; + struct device_map keyboard_channel; + struct device_map network_channel; + struct device_map storage_channel; + struct device_map console_channel; + u32 partition_index; + u32 pad; +}; -/* All messages in any ControlVm queue have this layout. */ -typedef struct _CONTROLVM_MESSAGE { - CONTROLVM_MESSAGE_HEADER hdr; - CONTROLVM_MESSAGE_PACKET cmd; -} CONTROLVM_MESSAGE; - -typedef struct _DEVICE_MAP { - GUEST_PHYSICAL_ADDRESS DeviceChannelAddress; - u64 DeviceChannelSize; - u32 CA_Index; - u32 Reserved; /* natural alignment */ - u64 Reserved2; /* Align structure on 32-byte boundary */ -} DEVICE_MAP; - -typedef struct _GUEST_DEVICES { - DEVICE_MAP VideoChannel; - DEVICE_MAP KeyboardChannel; - DEVICE_MAP NetworkChannel; - DEVICE_MAP StorageChannel; - DEVICE_MAP ConsoleChannel; - u32 PartitionIndex; - u32 Pad; -} GUEST_DEVICES; - -typedef struct _ULTRA_CONTROLVM_CHANNEL_PROTOCOL { - CHANNEL_HEADER Header; - GUEST_PHYSICAL_ADDRESS gpControlVm; /* guest physical address of +struct spar_controlvm_channel_protocol { + struct channel_header header; + GUEST_PHYSICAL_ADDRESS gp_controlvm; /* guest physical address of * this channel */ - GUEST_PHYSICAL_ADDRESS gpPartitionTables; /* guest physical address of - * partition tables */ - GUEST_PHYSICAL_ADDRESS gpDiagGuest; /* guest physical address of + GUEST_PHYSICAL_ADDRESS gp_partition_tables;/* guest physical address of + * partition tables */ + GUEST_PHYSICAL_ADDRESS gp_diag_guest; /* guest physical address of * diagnostic channel */ - GUEST_PHYSICAL_ADDRESS gpBootRomDisk; /* guest phys addr of (read + GUEST_PHYSICAL_ADDRESS gp_boot_romdisk;/* guest phys addr of (read * only) Boot ROM disk */ - GUEST_PHYSICAL_ADDRESS gpBootRamDisk; /* guest phys addr of writable + GUEST_PHYSICAL_ADDRESS gp_boot_ramdisk;/* guest phys addr of writable * Boot RAM disk */ - GUEST_PHYSICAL_ADDRESS gpAcpiTable; /* guest phys addr of acpi + GUEST_PHYSICAL_ADDRESS gp_acpi_table; /* guest phys addr of acpi * table */ - GUEST_PHYSICAL_ADDRESS gpControlChannel; /* guest phys addr of control - * channel */ - GUEST_PHYSICAL_ADDRESS gpDiagRomDisk; /* guest phys addr of diagnostic + GUEST_PHYSICAL_ADDRESS gp_control_channel;/* guest phys addr of control + * channel */ + GUEST_PHYSICAL_ADDRESS gp_diag_romdisk;/* guest phys addr of diagnostic * ROM disk */ - GUEST_PHYSICAL_ADDRESS gpNvram; /* guest phys addr of NVRAM + GUEST_PHYSICAL_ADDRESS gp_nvram; /* guest phys addr of NVRAM * channel */ - u64 RequestPayloadOffset; /* Offset to request payload area */ - u64 EventPayloadOffset; /* Offset to event payload area */ - u32 RequestPayloadBytes; /* Bytes available in request payload + u64 request_payload_offset; /* Offset to request payload area */ + u64 event_payload_offset; /* Offset to event payload area */ + u32 request_payload_bytes; /* Bytes available in request payload * area */ - u32 EventPayloadBytes; /* Bytes available in event payload area */ - u32 ControlChannelBytes; - u32 NvramChannelBytes; /* Bytes in PartitionNvram segment */ - u32 MessageBytes; /* sizeof(CONTROLVM_MESSAGE) */ - u32 MessageCount; /* CONTROLVM_MESSAGE_MAX */ - GUEST_PHYSICAL_ADDRESS gpSmbiosTable; /* guest phys addr of SMBIOS + u32 event_payload_bytes;/* Bytes available in event payload area */ + u32 control_channel_bytes; + u32 nvram_channel_bytes; /* Bytes in PartitionNvram segment */ + u32 message_bytes; /* sizeof(CONTROLVM_MESSAGE) */ + u32 message_count; /* CONTROLVM_MESSAGE_MAX */ + GUEST_PHYSICAL_ADDRESS gp_smbios_table;/* guest phys addr of SMBIOS * tables */ - GUEST_PHYSICAL_ADDRESS gpPhysicalSmbiosTable; /* guest phys addr of - * SMBIOS table */ + GUEST_PHYSICAL_ADDRESS gp_physical_smbios_table;/* guest phys addr of + * SMBIOS table */ /* ULTRA_MAX_GUESTS_PER_SERVICE */ - GUEST_DEVICES gpObsoleteGuestDevices[16]; + struct guest_devices gp_obsolete_guest_devices[16]; /* guest physical address of EFI firmware image base */ - GUEST_PHYSICAL_ADDRESS VirtualGuestFirmwareImageBase; + GUEST_PHYSICAL_ADDRESS virtual_guest_firmware_image_base; /* guest physical address of EFI firmware entry point */ - GUEST_PHYSICAL_ADDRESS VirtualGuestFirmwareEntryPoint; + GUEST_PHYSICAL_ADDRESS virtual_guest_firmware_entry_point; /* guest EFI firmware image size */ - u64 VirtualGuestFirmwareImageSize; + u64 virtual_guest_firmware_image_size; /* GPA = 1MB where EFI firmware image is copied to */ - GUEST_PHYSICAL_ADDRESS VirtualGuestFirmwareBootBase; - GUEST_PHYSICAL_ADDRESS VirtualGuestImageBase; - GUEST_PHYSICAL_ADDRESS VirtualGuestImageSize; - u64 PrototypeControlChannelOffset; - GUEST_PHYSICAL_ADDRESS VirtualGuestPartitionHandle; + GUEST_PHYSICAL_ADDRESS virtual_guest_firmware_boot_base; + GUEST_PHYSICAL_ADDRESS virtual_guest_image_base; + GUEST_PHYSICAL_ADDRESS virtual_guest_image_size; + u64 prototype_control_channel_offset; + GUEST_PHYSICAL_ADDRESS virtual_guest_partition_handle; - u16 RestoreAction; /* Restore Action field to restore the guest + u16 restore_action; /* Restore Action field to restore the guest * partition */ - u16 DumpAction; /* For Windows guests it shows if the visordisk + u16 dump_action; /* For Windows guests it shows if the visordisk * is running in dump mode */ - u16 NvramFailCount; - u16 SavedCrashMsgCount; /* = CONTROLVM_CRASHMSG_MAX */ - u32 SavedCrashMsgOffset; /* Offset to request payload area needed + u16 nvram_fail_count; + u16 saved_crash_message_count; /* = CONTROLVM_CRASHMSG_MAX */ + u32 saved_crash_message_offset; /* Offset to request payload area needed * for crash dump */ - u32 InstallationError; /* Type of error encountered during + u32 installation_error; /* Type of error encountered during * installation */ - u32 InstallationTextId; /* Id of string to display */ - u16 InstallationRemainingSteps; /* Number of remaining installation - * steps (for progress bars) */ - u8 ToolAction; /* ULTRA_TOOL_ACTIONS Installation Action + u32 installation_text_id; /* Id of string to display */ + u16 installation_remaining_steps;/* Number of remaining installation + * steps (for progress bars) */ + u8 tool_action; /* ULTRA_TOOL_ACTIONS Installation Action * field */ - u8 Reserved; /* alignment */ - ULTRA_EFI_SPAR_INDICATION EfiSparIndication; - ULTRA_EFI_SPAR_INDICATION EfiSparIndicationSupported; - u32 SPReserved; - u8 Reserved2[28]; /* Force signals to begin on 128-byte cache + u8 reserved; /* alignment */ + struct efi_spar_indication efi_spar_ind; + struct efi_spar_indication efi_spar_ind_supported; + u32 sp_reserved; + u8 reserved2[28]; /* Force signals to begin on 128-byte cache * line */ - SIGNAL_QUEUE_HEADER RequestQueue; /* Service or guest partition - * uses this queue to send - * requests to Control */ - SIGNAL_QUEUE_HEADER ResponseQueue; /* Control uses this queue to - * respond to service or guest - * partition requests */ - SIGNAL_QUEUE_HEADER EventQueue; /* Control uses this queue to + struct signal_queue_header request_queue;/* Service or guest partition + * uses this queue to send + * requests to Control */ + struct signal_queue_header response_queue;/* Control uses this queue to + * respond to service or guest + * partition requests */ + struct signal_queue_header event_queue; /* Control uses this queue to * send events to service or * guest partition */ - SIGNAL_QUEUE_HEADER EventAckQueue; /* Service or guest partition - * uses this queue to ack - * Control events */ + struct signal_queue_header event_ack_queue;/* Service or guest partition + * uses this queue to ack + * Control events */ /* Request fixed-size message pool - does not include payload */ - CONTROLVM_MESSAGE RequestMsg[CONTROLVM_MESSAGE_MAX]; + struct controlvm_message request_msg[CONTROLVM_MESSAGE_MAX]; /* Response fixed-size message pool - does not include payload */ - CONTROLVM_MESSAGE ResponseMsg[CONTROLVM_MESSAGE_MAX]; + struct controlvm_message response_msg[CONTROLVM_MESSAGE_MAX]; /* Event fixed-size message pool - does not include payload */ - CONTROLVM_MESSAGE EventMsg[CONTROLVM_MESSAGE_MAX]; + struct controlvm_message event_msg[CONTROLVM_MESSAGE_MAX]; /* Ack fixed-size message pool - does not include payload */ - CONTROLVM_MESSAGE EventAckMsg[CONTROLVM_MESSAGE_MAX]; + struct controlvm_message event_ack_msg[CONTROLVM_MESSAGE_MAX]; /* Message stored during IOVM creation to be reused after crash */ - CONTROLVM_MESSAGE SavedCrashMsg[CONTROLVM_CRASHMSG_MAX]; -} ULTRA_CONTROLVM_CHANNEL_PROTOCOL; + struct controlvm_message saved_crash_msg[CONTROLVM_CRASHMSG_MAX]; +}; /* Offsets for VM channel attributes... */ #define VM_CH_REQ_QUEUE_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, RequestQueue) + offsetof(struct spar_controlvm_channel_protocol, request_queue) #define VM_CH_RESP_QUEUE_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, ResponseQueue) + offsetof(struct spar_controlvm_channel_protocol, response_queue) #define VM_CH_EVENT_QUEUE_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventQueue) + offsetof(struct spar_controlvm_channel_protocol, event_queue) #define VM_CH_ACK_QUEUE_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventAckQueue) + offsetof(struct spar_controlvm_channel_protocol, event_ack_queue) #define VM_CH_REQ_MSG_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, RequestMsg) + offsetof(struct spar_controlvm_channel_protocol, request_msg) #define VM_CH_RESP_MSG_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, ResponseMsg) + offsetof(struct spar_controlvm_channel_protocol, response_msg) #define VM_CH_EVENT_MSG_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventMsg) + offsetof(struct spar_controlvm_channel_protocol, event_msg) #define VM_CH_ACK_MSG_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventAckMsg) + offsetof(struct spar_controlvm_channel_protocol, event_ack_msg) #define VM_CH_CRASH_MSG_OFFSET \ - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, SavedCrashMsg) + offsetof(struct spar_controlvm_channel_protocol, saved_crash_msg) /* The following header will be located at the beginning of PayloadVmOffset for - * various ControlVm commands. The receiver of a ControlVm command with a - * PayloadVmOffset will dereference this address and then use ConnectionOffset, - * InitiatorOffset, and TargetOffset to get the location of UTF-8 formatted - * strings that can be parsed to obtain command-specific information. The value - * of TotalLength should equal PayloadBytes. The format of the strings at - * PayloadVmOffset will take different forms depending on the message. See the - * following Wiki page for more information: - * https://ustr-linux-1.na.uis.unisys.com/spar/index.php/ControlVm_Parameters_Area + * various ControlVm commands. The receiver of a ControlVm command with a + * PayloadVmOffset will dereference this address and then use connection_offset, + * initiator_offset, and target_offset to get the location of UTF-8 formatted + * strings that can be parsed to obtain command-specific information. The value + * of total_length should equal PayloadBytes. The format of the strings at + * PayloadVmOffset will take different forms depending on the message. */ -typedef struct _ULTRA_CONTROLVM_PARAMETERS_HEADER { - u32 TotalLength; - u32 HeaderLength; - u32 ConnectionOffset; - u32 ConnectionLength; - u32 InitiatorOffset; - u32 InitiatorLength; - u32 TargetOffset; - u32 TargetLength; - u32 ClientOffset; - u32 ClientLength; - u32 NameOffset; - u32 NameLength; - uuid_le Id; - u32 Revision; - u32 Reserved; /* Natural alignment */ -} ULTRA_CONTROLVM_PARAMETERS_HEADER; +struct spar_controlvm_parameters_header { + u32 total_length; + u32 header_length; + u32 connection_offset; + u32 connection_length; + u32 initiator_offset; + u32 initiator_length; + u32 target_offset; + u32 target_length; + u32 client_offset; + u32 client_length; + u32 name_offset; + u32 name_length; + uuid_le id; + u32 revision; + u32 reserved; /* Natural alignment */ +}; #endif /* __CONTROLVMCHANNEL_H__ */ diff --git a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h index 9912e51b89b5..e8fb8678a8e2 100644 --- a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h @@ -37,12 +37,12 @@ #include "channel.h" /* {EEA7A573-DB82-447c-8716-EFBEAAAE4858} */ -#define ULTRA_DIAG_CHANNEL_PROTOCOL_GUID \ +#define SPAR_DIAG_CHANNEL_PROTOCOL_UUID \ UUID_LE(0xeea7a573, 0xdb82, 0x447c, \ 0x87, 0x16, 0xef, 0xbe, 0xaa, 0xae, 0x48, 0x58) -static const uuid_le UltraDiagChannelProtocolGuid = - ULTRA_DIAG_CHANNEL_PROTOCOL_GUID; +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 \ @@ -58,19 +58,20 @@ static const uuid_le UltraDiagChannelProtocolGuid = * increment this. */ #define ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID 2 -#define ULTRA_DIAG_CHANNEL_OK_CLIENT(pChannel, logCtx) \ - (ULTRA_check_channel_client(pChannel, \ - UltraDiagChannelProtocolGuid, \ - "diag", \ - sizeof(ULTRA_DIAG_CHANNEL_PROTOCOL), \ - ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE, \ - __FILE__, __LINE__, logCtx)) -#define ULTRA_DIAG_CHANNEL_OK_SERVER(actualBytes, logCtx) \ - (ULTRA_check_channel_server(UltraDiagChannelProtocolGuid, \ - "diag", \ - sizeof(ULTRA_DIAG_CHANNEL_PROTOCOL), \ - actualBytes, __FILE__, __LINE__, logCtx)) +#define SPAR_DIAG_CHANNEL_OK_CLIENT(ch)\ + (spar_check_channel_client(ch,\ + spar_diag_channel_protocol_uuid,\ + "diag",\ + sizeof(struct spar_diag_channel_protocol),\ + ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID,\ + ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE)) + +#define SPAR_DIAG_CHANNEL_OK_SERVER(bytes)\ + (spar_check_channel_server(spar_diag_channel_protocol_uuid,\ + "diag",\ + sizeof(struct spar_diag_channel_protocol),\ + bytes)) + #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... */ @@ -105,21 +106,21 @@ static const uuid_le UltraDiagChannelProtocolGuid = /* 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... */ -typedef 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; -} DIAG_EFI_TIME; - -typedef enum { +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 */ @@ -144,9 +145,9 @@ typedef enum { ULTRA_COMPONENT_PSERVICES = 0x17, ULTRA_COMPONENT_PDIAG = 0x18 /* RESERVED 0x18 - 0x1F */ -} ULTRA_COMPONENT_TYPES; +}; -/* Structure: DIAG_CHANNEL_EVENT Purpose: Contains attributes that make up an +/* 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. @@ -155,40 +156,40 @@ typedef enum { * Reserved: Padding to align structure on a 64-byte cache line boundary. * AdditionalInfo: Array of characters for additional event info (may be * empty). */ -typedef struct _DIAG_CHANNEL_EVENT { - u32 EventId; - u32 Severity; - u8 ModuleName[MAX_MODULE_NAME_SIZE]; - u32 LineNumber; - DIAG_EFI_TIME Timestamp; /* Size = 16 bytes */ - u32 PartitionNumber; /* Filled in by Diag Switch as pool blocks are +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 VirtualProcessorNumber; - u16 LogicalProcessorNumber; - u8 ComponentType; /* ULTRA_COMPONENT_TYPES */ - u8 Subsystem; - u16 Reserved0; /* pad to u64 alignment */ - u32 BlockNumber; /* filled in by DiagSwitch as pool blocks are + 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 BlockNumberHigh; - u32 EventNumber; /* filled in by DiagSwitch as pool blocks are + u32 block_no_high; + u32 event_no; /* filled in by DiagSwitch as pool blocks are * filled */ - u32 EventNumberHigh; + u32 event_no_high; - /* The BlockNumber and EventNumber fields are set only by DiagSwitch + /* 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 AdditionalInfo[MAX_ADDITIONAL_INFO_SIZE]; + u8 reserved[8]; + u8 additional_info[MAX_ADDITIONAL_INFO_SIZE]; - /* NOTE: Changesto DIAG_CHANNEL_EVENT generally need to be reflected in + /* 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 */ -} DIAG_CHANNEL_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, @@ -201,7 +202,8 @@ typedef struct _DIAG_CHANNEL_EVENT { * they are valid for controlling the amount of event data. 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. */ -typedef enum { DIAG_SEVERITY_ENUM_BEGIN = 0, +enum diag_severity { + DIAG_SEVERITY_ENUM_BEGIN = 0, DIAG_SEVERITY_OVERRIDE = DIAG_SEVERITY_ENUM_BEGIN, DIAG_SEVERITY_VERBOSE = DIAG_SEVERITY_OVERRIDE, /* 0 */ DIAG_SEVERITY_INFO = DIAG_SEVERITY_VERBOSE + 1, /* 1 */ @@ -212,7 +214,7 @@ typedef enum { DIAG_SEVERITY_ENUM_BEGIN = 0, DIAG_SEVERITY_ENUM_END = DIAG_SEVERITY_SHUTOFF, /* 5 */ DIAG_SEVERITY_NONFATAL_ERR = DIAG_SEVERITY_ERR, DIAG_SEVERITY_FATAL_ERR = DIAG_SEVERITY_PRINT -} DIAG_SEVERITY; +}; /* Event Cause enums * @@ -233,26 +235,24 @@ typedef enum { DIAG_SEVERITY_ENUM_BEGIN = 0, * 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 +* 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 + * 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. */ -typedef enum { +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 */ @@ -264,7 +264,7 @@ typedef enum { 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 */ -} DIAG_CAUSE; +}; /* Event Cause category defined into the byte 2 of Severity */ #define CAUSE_DEBUG (DIAG_CAUSE_DEBUG << CAUSE_SHIFT_AMT) @@ -344,7 +344,7 @@ typedef enum { #define CAUSE_FILE_XFER_SEVERITY_PRINT \ (CAUSE_FILE_XFER | DIAG_SEVERITY_PRINT) -/* Structure: DIAG_CHANNEL_PROTOCOL_HEADER +/* Structure: diag_channel_protocol_header * * Purpose: Contains attributes that make up the header specific to the * DIAG_CHANNEL area. @@ -362,12 +362,12 @@ typedef enum { * whether events are logged. Any event's severity for a * particular subsystem below this level will be discarded. */ -typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER { - volatile u32 DiagLock; - u8 IsChannelInitialized; - u8 Reserved[3]; - u8 SubsystemSeverityFilter[64]; -} DIAG_CHANNEL_PROTOCOL_HEADER; +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: */ /* ----------------------- */ @@ -375,19 +375,20 @@ typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER { /* ----------------------- */ /* | Signal Queue Header | Defined by SIGNAL_QUEUE_HEADER */ /* ----------------------- */ -/* | DiagChannel Header | Defined by DIAG_CHANNEL_PROTOCOL_HEADER */ +/* | DiagChannel Header | Defined by diag_channel_protocol_header */ /* ----------------------- */ -/* | Channel Event Info | Defined by (DIAG_CHANNEL_EVENT * MAX_EVENTS) */ +/* | 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(ULTRA_CHANNEL_PROTOCOL)) -#define DIAG_CH_QUEUE_HEADER_SIZE (sizeof(SIGNAL_QUEUE_HEADER)) +#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(DIAG_CHANNEL_PROTOCOL_HEADER)) +#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) @@ -397,7 +398,7 @@ typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER { #define DIAG_CH_LRG_SIZE (2 * DIAG_CH_SIZE) /* 8 MB */ /* - * Structure: ULTRA_DIAG_CHANNEL_PROTOCOL + * Structure: spar_diag_channel_protocol * * Purpose: Contains attributes that make up the DIAG_CHANNEL memory. * @@ -409,19 +410,18 @@ typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER { * store event. * * DiagChannelHeader: Diagnostic channel header info (see - * DIAG_CHANNEL_PROTOCOL_HEADER comments). + * 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. */ -typedef struct _ULTRA_DIAG_CHANNEL_PROTOCOL { - ULTRA_CHANNEL_PROTOCOL CommonChannelHeader; - SIGNAL_QUEUE_HEADER QueueHeader; - DIAG_CHANNEL_PROTOCOL_HEADER DiagChannelHeader; - DIAG_CHANNEL_EVENT Events[(DIAG_CH_SIZE - DIAG_CH_EVENT_OFFSET) / - sizeof(DIAG_CHANNEL_EVENT)]; -} -ULTRA_DIAG_CHANNEL_PROTOCOL; +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/common-spar/include/channels/iochannel.h b/drivers/staging/unisys/common-spar/include/channels/iochannel.h index b1dd73d1f42c..eb7efe484f6f 100644 --- a/drivers/staging/unisys/common-spar/include/channels/iochannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/iochannel.h @@ -8,7 +8,6 @@ * this file. Note: Everything is OS-independent because this file is * used by Windows, Linux and possible EFI drivers. */ - /* * Communication flow between the IOPart and GuestPart uses the channel headers * channel state. The following states are currently being used: @@ -60,42 +59,22 @@ #define ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID 2 #define ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID 1 -#define ULTRA_VHBA_CHANNEL_OK_CLIENT(pChannel, logCtx) \ - (ULTRA_check_channel_client(pChannel, UltraVhbaChannelProtocolGuid, \ - "vhba", MIN_IO_CHANNEL_SIZE, \ - ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE, \ - __FILE__, __LINE__, logCtx)) -#define ULTRA_VHBA_CHANNEL_OK_SERVER(actualBytes, logCtx) \ - (ULTRA_check_channel_server(UltraVhbaChannelProtocolGuid, \ - "vhba", MIN_IO_CHANNEL_SIZE, actualBytes, \ - __FILE__, __LINE__, logCtx)) -#define ULTRA_VNIC_CHANNEL_OK_CLIENT(pChannel, logCtx) \ - (ULTRA_check_channel_client(pChannel, UltraVnicChannelProtocolGuid, \ - "vnic", MIN_IO_CHANNEL_SIZE, \ - ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE, \ - __FILE__, __LINE__, logCtx)) -#define ULTRA_VNIC_CHANNEL_OK_SERVER(actualBytes, logCtx) \ - (ULTRA_check_channel_server(UltraVnicChannelProtocolGuid, \ - "vnic", MIN_IO_CHANNEL_SIZE, actualBytes, \ - __FILE__, __LINE__, logCtx)) -#define ULTRA_VSWITCH_CHANNEL_OK_CLIENT(pChannel, logCtx) \ - (ULTRA_check_channel_client(pChannel, UltraVswitchChannelProtocolGuid, \ - "vswitch", MIN_IO_CHANNEL_SIZE, \ - ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE, \ - __FILE__, __LINE__, logCtx)) -#define ULTRA_VSWITCH_CHANNEL_OK_SERVER(actualBytes, logCtx) \ - (ULTRA_check_channel_server(UltraVswitchChannelProtocolGuid, \ - "vswitch", MIN_IO_CHANNEL_SIZE, \ - actualBytes, \ - __FILE__, __LINE__, logCtx)) +#define SPAR_VHBA_CHANNEL_OK_CLIENT(ch) \ + (spar_check_channel_client(ch, spar_vhba_channel_protocol_uuid, \ + "vhba", MIN_IO_CHANNEL_SIZE, \ + ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \ + ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE)) + +#define SPAR_VNIC_CHANNEL_OK_CLIENT(ch) \ + (spar_check_channel_client(ch, spar_vnic_channel_protocol_uuid, \ + "vnic", MIN_IO_CHANNEL_SIZE, \ + ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \ + ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE)) + /* * Everything necessary to handle SCSI & NIC traffic between Guest Partition and * IO Partition is defined below. */ - /* * Defines and enums. */ @@ -172,8 +151,9 @@ * SCSI Host value */ /* various types of network packets that can be sent in cmdrsp */ -typedef enum { NET_RCV_POST = 0, /* submit buffer to hold receiving - * incoming packet */ +enum net_types { + NET_RCV_POST = 0, /* submit buffer to hold receiving + * incoming packet */ /* virtnic -> uisnic */ NET_RCV, /* incoming packet received */ /* uisnic -> virtpci */ @@ -195,7 +175,7 @@ typedef enum { NET_RCV_POST = 0, /* submit buffer to hold receiving * its MAC addr */ NET_MACADDR_ACK, /* MAC address */ -} NET_TYPES; +}; #define ETH_HEADER_SIZE 14 /* size of ethernet header */ @@ -211,19 +191,23 @@ typedef enum { NET_RCV_POST = 0, /* submit buffer to hold receiving #define MAX_MACADDR_LEN 6 /* number of bytes in MAC address */ #endif /* MAX_MACADDR_LEN */ -#define ETH_IS_LOCALLY_ADMINISTERED(Address) \ - (((u8 *) (Address))[0] & ((u8) 0x02)) +#define ETH_IS_LOCALLY_ADMINISTERED(address) \ + (((u8 *)(address))[0] & ((u8)0x02)) #define NIC_VENDOR_ID 0x0008000B /* various types of scsi task mgmt commands */ -typedef enum { TASK_MGMT_ABORT_TASK = - 1, TASK_MGMT_BUS_RESET, TASK_MGMT_LUN_RESET, - TASK_MGMT_TARGET_RESET, -} TASK_MGMT_TYPES; +enum task_mgmt_types { + TASK_MGMT_ABORT_TASK = 1, + TASK_MGMT_BUS_RESET, + TASK_MGMT_LUN_RESET, + TASK_MGMT_TARGET_RESET, +}; /* various types of vdisk mgmt commands */ -typedef enum { VDISK_MGMT_ACQUIRE = 1, VDISK_MGMT_RELEASE, -} VDISK_MGMT_TYPES; +enum vdisk_mgmt_types { + VDISK_MGMT_ACQUIRE = 1, + VDISK_MGMT_RELEASE, +}; /* this is used in the vdest field */ #define VDEST_ALL 0xFFFF @@ -242,7 +226,6 @@ typedef enum { VDISK_MGMT_ACQUIRE = 1, VDISK_MGMT_RELEASE, /* * structs with pragma pack */ - /* ///////////// BEGIN PRAGMA PACK PUSH 1 ///////////////////////// */ /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */ @@ -377,16 +360,16 @@ struct uiscmdrsp_scsi { do { \ memset(buf, 0, \ MINNUM(len, \ - (unsigned int) NO_DISK_INQUIRY_RESULT_LEN)); \ - buf[2] = (u8) SCSI_SPC2_VER; \ + (unsigned int)NO_DISK_INQUIRY_RESULT_LEN)); \ + buf[2] = (u8)SCSI_SPC2_VER; \ if (lun == 0) { \ - buf[0] = (u8) lun0notpresent; \ - buf[3] = (u8) DEV_HISUPPORT; \ + buf[0] = (u8)lun0notpresent; \ + buf[3] = (u8)DEV_HISUPPORT; \ } else \ - buf[0] = (u8) notpresent; \ - buf[4] = (u8) ( \ + buf[0] = (u8)notpresent; \ + buf[4] = (u8)( \ MINNUM(len, \ - (unsigned int) NO_DISK_INQUIRY_RESULT_LEN) - 5); \ + (unsigned int)NO_DISK_INQUIRY_RESULT_LEN) - 5);\ if (len >= NO_DISK_INQUIRY_RESULT_LEN) { \ buf[8] = 'D'; \ buf[9] = 'E'; \ @@ -410,12 +393,10 @@ struct uiscmdrsp_scsi { } \ } while (0) - /* * Struct & Defines to support sense information. */ - /* The following struct is returned in sensebuf field in uiscmdrsp_scsi. It is * initialized in exactly the manner that is recommended in Windows (hence the * odd values). @@ -429,21 +410,21 @@ struct uiscmdrsp_scsi { * AdditionalSenseLength contains will be sizeof(sense_data)-8=10. */ struct sense_data { - u8 ErrorCode:7; - u8 Valid:1; - u8 SegmentNumber; - u8 SenseKey:4; - u8 Reserved:1; - u8 IncorrectLength:1; - u8 EndOfMedia:1; - u8 FileMark:1; - u8 Information[4]; - u8 AdditionalSenseLength; - u8 CommandSpecificInformation[4]; - u8 AdditionalSenseCode; - u8 AdditionalSenseCodeQualifier; - u8 FieldReplaceableUnitCode; - u8 SenseKeySpecific[3]; + u8 errorcode:7; + u8 valid:1; + u8 segment_number; + u8 sense_key:4; + u8 reserved:1; + u8 incorrect_length:1; + u8 end_of_media:1; + u8 file_mark:1; + u8 information[4]; + u8 additional_sense_length; + u8 command_specific_information[4]; + u8 additional_sense_code; + u8 additional_sense_code_qualifier; + u8 fru_code; + u8 sense_key_specific[3]; }; /* some SCSI ADSENSE codes */ @@ -484,7 +465,6 @@ struct net_pkt_xmt { * each fragment */ char ethhdr[ETH_HEADER_SIZE]; /* the ethernet header */ struct { - /* these are needed for csum at uisnic end */ u8 valid; /* 1 = rest of this struct is valid - else * ignore */ @@ -528,13 +508,12 @@ struct net_pkt_rcvpost { * to be describable */ struct phys_info frag; /* physical page information for the * single fragment 2K rcv buf */ - u64 UniqueNum; /* This is used to make sure that + u64 unique_num; /* This is used to make sure that * receive posts are returned to */ /* the Adapter which sent them origonally. */ }; struct net_pkt_rcv { - /* the number of receive buffers that can be chained */ /* is based on max mtu and size of each rcv buf */ u32 rcv_done_len; /* length of received data */ @@ -544,8 +523,8 @@ struct net_pkt_rcv { * that must be chained; */ /* each entry is a receive buffer provided by NET_RCV_POST. */ /* NOTE: first rcvbuf in the chain will also be provided in net.buf. */ - u64 UniqueNum; - u32 RcvsDroppedDelta; + u64 unique_num; + u32 rcvs_dropped_delta; }; struct net_pkt_enbdis { @@ -560,7 +539,7 @@ struct net_pkt_macaddr { /* cmd rsp packet used for VNIC network traffic */ struct uiscmdrsp_net { - NET_TYPES type; + enum net_types type; void *buf; union { struct net_pkt_xmt xmt; /* used for NET_XMIT */ @@ -576,7 +555,7 @@ struct uiscmdrsp_net { }; struct uiscmdrsp_scsitaskmgmt { - TASK_MGMT_TYPES tasktype; + enum task_mgmt_types tasktype; /* the type of task */ struct uisscsi_dest vdest; @@ -594,7 +573,7 @@ struct uiscmdrsp_scsitaskmgmt { * For windows guests, this is a pointer to a location that a waiting * thread is testing to see if the taskmgmt command has completed. * When the rsp is received by guest, the thread receiving the - * response uses this to notify the the thread waiting for taskmgmt + * response uses this to notify the thread waiting for taskmgmt * command completion. Its value is preserved by iopart & returned * as is in the task mgmt rsp. */ void *notifyresult; @@ -615,7 +594,7 @@ struct uiscmdrsp_scsitaskmgmt { /* Note that the vHba pointer is not used by the Client/Guest side. */ struct uiscmdrsp_disknotify { u8 add; /* 0-remove, 1-add */ - void *vHba; /* Pointer to vhba_info for channel info to + void *v_hba; /* Pointer to vhba_info for channel info to * route msg */ u32 channel, id, lun; /* SCSI Path of Disk to added or removed */ }; @@ -623,7 +602,7 @@ struct uiscmdrsp_disknotify { /* The following is used by virthba/vSCSI to send the Acquire/Release commands * to the IOVM. */ struct uiscmdrsp_vdiskmgmt { - VDISK_MGMT_TYPES vdisktype; + enum vdisk_mgmt_types vdisktype; /* the type of task */ struct uisscsi_dest vdest; @@ -641,7 +620,7 @@ struct uiscmdrsp_vdiskmgmt { * For windows guests, this is a pointer to a location that a waiting * thread is testing to see if the taskmgmt command has completed. * When the rsp is received by guest, the thread receiving the - * response uses this to notify the the thread waiting for taskmgmt + * response uses this to notify the thread waiting for taskmgmt * command completion. Its value is preserved by iopart & returned * as is in the task mgmt rsp. */ void *notifyresult; @@ -683,11 +662,11 @@ struct uiscmdrsp { /* This is just the header of the IO channel. It is assumed that directly after * this header there is a large region of memory which contains the command and -* response queues as specified in cmdQ and rspQ SIGNAL_QUEUE_HEADERS. */ -typedef struct _ULTRA_IO_CHANNEL_PROTOCOL { - CHANNEL_HEADER ChannelHeader; - SIGNAL_QUEUE_HEADER cmdQ; - SIGNAL_QUEUE_HEADER rspQ; +* response queues as specified in cmd_q and rsp_q SIGNAL_QUEUE_HEADERS. */ +struct spar_io_channel_protocol { + struct channel_header channel_header; + struct signal_queue_header cmd_q; + struct signal_queue_header rsp_q; union { struct { struct vhba_wwnn wwnn; /* 8 bytes */ @@ -697,14 +676,14 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL { u8 macaddr[MAX_MACADDR_LEN]; /* 6 bytes */ u32 num_rcv_bufs; /* 4 */ u32 mtu; /* 4 */ - uuid_le zoneGuid; /* 16 */ + uuid_le zone_uuid; /* 16 */ } vnic; /* total 30 */ }; #define MAX_CLIENTSTRING_LEN 1024 - u8 clientString[MAX_CLIENTSTRING_LEN]; /* NULL terminated - so holds + u8 client_string[MAX_CLIENTSTRING_LEN];/* NULL terminated - so holds * max - 1 bytes */ -} ULTRA_IO_CHANNEL_PROTOCOL; +}; #pragma pack(pop) /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */ @@ -733,144 +712,17 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL { * INLINE functions for initializing and accessing I/O data channels */ - -#define NUMSIGNALS(x, q) (((ULTRA_IO_CHANNEL_PROTOCOL *)(x))->q.MaxSignalSlots) -#define SIZEOF_PROTOCOL (COVER(sizeof(ULTRA_IO_CHANNEL_PROTOCOL), 64)) +#define SIZEOF_PROTOCOL (COVER(sizeof(struct spar_io_channel_protocol), 64)) #define SIZEOF_CMDRSP (COVER(sizeof(struct uiscmdrsp), 64)) -#define IO_CHANNEL_SIZE(x) COVER(SIZEOF_PROTOCOL + \ - (NUMSIGNALS(x, cmdQ) + \ - NUMSIGNALS(x, rspQ)) * SIZEOF_CMDRSP, 4096) #define MIN_IO_CHANNEL_SIZE COVER(SIZEOF_PROTOCOL + \ 2 * MIN_NUMSIGNALS * SIZEOF_CMDRSP, 4096) -#ifdef __GNUC__ -/* These defines should only ever be used in service partitons */ -/* because they rely on the size of uiscmdrsp */ -#define QSLOTSFROMBYTES(bytes) (((bytes-SIZEOF_PROTOCOL)/2)/SIZEOF_CMDRSP) -#define QSIZEFROMBYTES(bytes) (QSLOTSFROMBYTES(bytes)*SIZEOF_CMDRSP) -#define SignalQInit(x) \ - do { \ - x->cmdQ.Size = QSIZEFROMBYTES(x->ChannelHeader.Size); \ - x->cmdQ.oSignalBase = SIZEOF_PROTOCOL - \ - offsetof(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ); \ - x->cmdQ.SignalSize = SIZEOF_CMDRSP; \ - x->cmdQ.MaxSignalSlots = \ - QSLOTSFROMBYTES(x->ChannelHeader.Size); \ - x->cmdQ.MaxSignals = x->cmdQ.MaxSignalSlots - 1; \ - x->rspQ.Size = QSIZEFROMBYTES(x->ChannelHeader.Size); \ - x->rspQ.oSignalBase = \ - (SIZEOF_PROTOCOL + x->cmdQ.Size) - \ - offsetof(ULTRA_IO_CHANNEL_PROTOCOL, rspQ); \ - x->rspQ.SignalSize = SIZEOF_CMDRSP; \ - x->rspQ.MaxSignalSlots = \ - QSLOTSFROMBYTES(x->ChannelHeader.Size); \ - x->rspQ.MaxSignals = x->rspQ.MaxSignalSlots - 1; \ - x->ChannelHeader.oChannelSpace = \ - offsetof(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ); \ - } while (0) - -#define INIT_CLIENTSTRING(chan, type, clientStr, clientStrLen) \ - do { \ - if (clientStr) { \ - chan->ChannelHeader.oClientString = \ - offsetof(type, clientString); \ - memcpy(chan->clientString, clientStr, \ - MINNUM(clientStrLen, \ - (u32) (MAX_CLIENTSTRING_LEN - 1))); \ - chan->clientString[MINNUM(clientStrLen, \ - (u32) (MAX_CLIENTSTRING_LEN \ - - 1))] \ - = '\0'; \ - } \ - else \ - if (clientStrLen > 0) \ - return 0; \ - } while (0) - - -#define ULTRA_IO_CHANNEL_SERVER_READY(x, chanId, logCtx) \ - ULTRA_CHANNEL_SERVER_TRANSITION(x, chanId, SrvState, CHANNELSRV_READY, \ - logCtx) - -#define ULTRA_IO_CHANNEL_SERVER_NOTREADY(x, chanId, logCtx) \ - ULTRA_CHANNEL_SERVER_TRANSITION(x, chanId, SrvState, \ - CHANNELSRV_UNINITIALIZED, logCtx) - -static inline int ULTRA_VHBA_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x, - struct vhba_wwnn *wwnn, - struct vhba_config_max *max, - unsigned char *clientStr, - u32 clientStrLen, u64 bytes) { - memset(x, 0, sizeof(ULTRA_IO_CHANNEL_PROTOCOL)); - x->ChannelHeader.VersionId = ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID; - x->ChannelHeader.Signature = ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE; - x->ChannelHeader.SrvState = CHANNELSRV_UNINITIALIZED; - x->ChannelHeader.HeaderSize = sizeof(x->ChannelHeader); - x->ChannelHeader.Size = COVER(bytes, 4096); - x->ChannelHeader.Type = UltraVhbaChannelProtocolGuid; - x->ChannelHeader.ZoneGuid = NULL_UUID_LE; - x->vhba.wwnn = *wwnn; - x->vhba.max = *max; - INIT_CLIENTSTRING(x, ULTRA_IO_CHANNEL_PROTOCOL, clientStr, - clientStrLen); - SignalQInit(x); - if ((x->cmdQ.MaxSignalSlots > MAX_NUMSIGNALS) || - (x->rspQ.MaxSignalSlots > MAX_NUMSIGNALS)) { - return 0; - } - if ((x->cmdQ.MaxSignalSlots < MIN_NUMSIGNALS) || - (x->rspQ.MaxSignalSlots < MIN_NUMSIGNALS)) { - return 0; - } - return 1; -} - -static inline void ULTRA_VHBA_set_max(ULTRA_IO_CHANNEL_PROTOCOL *x, - struct vhba_config_max *max) { - x->vhba.max = *max; -} - -static inline int ULTRA_VNIC_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x, - unsigned char *macaddr, - u32 num_rcv_bufs, u32 mtu, - uuid_le zoneGuid, - unsigned char *clientStr, - u32 clientStrLen, - u64 bytes) { - memset(x, 0, sizeof(ULTRA_IO_CHANNEL_PROTOCOL)); - x->ChannelHeader.VersionId = ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID; - x->ChannelHeader.Signature = ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE; - x->ChannelHeader.SrvState = CHANNELSRV_UNINITIALIZED; - x->ChannelHeader.HeaderSize = sizeof(x->ChannelHeader); - x->ChannelHeader.Size = COVER(bytes, 4096); - x->ChannelHeader.Type = UltraVnicChannelProtocolGuid; - x->ChannelHeader.ZoneGuid = NULL_UUID_LE; - memcpy(x->vnic.macaddr, macaddr, MAX_MACADDR_LEN); - x->vnic.num_rcv_bufs = num_rcv_bufs; - x->vnic.mtu = mtu; - x->vnic.zoneGuid = zoneGuid; - INIT_CLIENTSTRING(x, ULTRA_IO_CHANNEL_PROTOCOL, clientStr, - clientStrLen); - SignalQInit(x); - if ((x->cmdQ.MaxSignalSlots > MAX_NUMSIGNALS) || - (x->rspQ.MaxSignalSlots > MAX_NUMSIGNALS)) { - return 0; - } - if ((x->cmdQ.MaxSignalSlots < MIN_NUMSIGNALS) || - (x->rspQ.MaxSignalSlots < MIN_NUMSIGNALS)) { - return 0; - } - return 1; -} - -#endif /* __GNUC__ */ /* * INLINE function for expanding a guest's pfn-off-size into multiple 4K page * pfn-off-size entires. */ - /* we deal with 4K page sizes when we it comes to passing page information * between */ /* Guest and IOPartition. */ @@ -900,13 +752,12 @@ add_physinfo_entries(u32 inp_pfn, /* input - specifies the pfn to be used firstlen = PI_PAGE_SIZE - inp_off; if (inp_len <= firstlen) { - /* the input entry spans only one page - add as is */ if (index >= max_pi_arr_entries) return 0; pi_arr[index].pi_pfn = inp_pfn; - pi_arr[index].pi_off = (u16) inp_off; - pi_arr[index].pi_len = (u16) inp_len; + pi_arr[index].pi_off = (u16)inp_off; + pi_arr[index].pi_len = (u16)inp_len; return index + 1; } @@ -924,9 +775,8 @@ add_physinfo_entries(u32 inp_pfn, /* input - specifies the pfn to be used else { pi_arr[index + i].pi_off = 0; pi_arr[index + i].pi_len = - (u16) MINNUM(len, (u32) PI_PAGE_SIZE); + (u16)MINNUM(len, (u32)PI_PAGE_SIZE); } - } return index + i; } diff --git a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h index 1231c454176f..2c42ce16e0cf 100644 --- a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h @@ -28,65 +28,61 @@ #include "channel.h" /* {193b331b-c58f-11da-95a9-00e08161165f} */ -#define ULTRA_VBUS_CHANNEL_PROTOCOL_GUID \ +#define SPAR_VBUS_CHANNEL_PROTOCOL_UUID \ UUID_LE(0x193b331b, 0xc58f, 0x11da, \ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) -static const uuid_le UltraVbusChannelProtocolGuid = - ULTRA_VBUS_CHANNEL_PROTOCOL_GUID; +static const uuid_le spar_vbus_channel_protocol_uuid = + SPAR_VBUS_CHANNEL_PROTOCOL_UUID; -#define ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE +#define SPAR_VBUS_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_VBUS_CHANNEL_PROTOCOL_VERSIONID 1 +#define SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1 -#define ULTRA_VBUS_CHANNEL_OK_CLIENT(pChannel, logCtx) \ - (ULTRA_check_channel_client(pChannel, \ - UltraVbusChannelProtocolGuid, \ - "vbus", \ - sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \ - ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID, \ - ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE, \ - __FILE__, __LINE__, logCtx)) - -#define ULTRA_VBUS_CHANNEL_OK_SERVER(actualBytes, logCtx) \ - (ULTRA_check_channel_server(UltraVbusChannelProtocolGuid, \ - "vbus", \ - sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \ - actualBytes, \ - __FILE__, __LINE__, logCtx)) +#define SPAR_VBUS_CHANNEL_OK_CLIENT(ch) \ + spar_check_channel_client(ch, \ + spar_vbus_channel_protocol_uuid, \ + "vbus", \ + sizeof(struct spar_vbus_channel_protocol),\ + SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID, \ + SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE) +#define SPAR_VBUS_CHANNEL_OK_SERVER(actual_bytes) \ + (spar_check_channel_server(spar_vbus_channel_protocol_uuid, \ + "vbus", \ + sizeof(struct ultra_vbus_channel_protocol),\ + actual_bytes)) #pragma pack(push, 1) /* both GCC and VC now allow this pragma */ -typedef struct _ULTRA_VBUS_HEADERINFO { - u32 structBytes; /* size of this struct in bytes */ - u32 deviceInfoStructBytes; /* sizeof(ULTRA_VBUS_DEVICEINFO) */ - u32 devInfoCount; /* num of items in DevInfo member */ +struct spar_vbus_headerinfo { + u32 struct_bytes; /* size of this struct in bytes */ + u32 device_info_struct_bytes; /* sizeof(ULTRA_VBUS_DEVICEINFO) */ + u32 dev_info_count; /* num of items in DevInfo member */ /* (this is the allocated size) */ - u32 chpInfoByteOffset; /* byte offset from beginning of this struct */ - /* to the the ChpInfo struct (below) */ - u32 busInfoByteOffset; /* byte offset from beginning of this struct */ - /* to the the BusInfo struct (below) */ - u32 devInfoByteOffset; /* byte offset from beginning of this struct */ - /* to the the DevInfo array (below) */ + u32 chp_info_offset; /* byte offset from beginning of this struct */ + /* to the ChpInfo struct (below) */ + u32 bus_info_offset; /* byte offset from beginning of this struct */ + /* to the BusInfo struct (below) */ + u32 dev_info_offset; /* byte offset from beginning of this struct */ + /* to the DevInfo array (below) */ u8 reserved[104]; -} ULTRA_VBUS_HEADERINFO; +}; -typedef struct _ULTRA_VBUS_CHANNEL_PROTOCOL { - ULTRA_CHANNEL_PROTOCOL ChannelHeader; /* initialized by server */ - ULTRA_VBUS_HEADERINFO HdrInfo; /* initialized by server */ +struct spar_vbus_channel_protocol { + struct channel_header channel_header; /* initialized by server */ + struct spar_vbus_headerinfo hdr_info; /* initialized by server */ /* the remainder of this channel is filled in by the client */ - ULTRA_VBUS_DEVICEINFO ChpInfo; /* describes client chipset device and - * driver */ - ULTRA_VBUS_DEVICEINFO BusInfo; /* describes client bus device and - * driver */ - ULTRA_VBUS_DEVICEINFO DevInfo[0]; /* describes client device and - * driver for */ - /* each device on the bus */ -} ULTRA_VBUS_CHANNEL_PROTOCOL; + struct ultra_vbus_deviceinfo chp_info; + /* describes client chipset device and driver */ + struct ultra_vbus_deviceinfo bus_info; + /* describes client bus device and driver */ + struct ultra_vbus_deviceinfo dev_info[0]; + /* describes client device and driver for each device on the bus */ +}; #define VBUS_CH_SIZE_EXACT(MAXDEVICES) \ (sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL) + ((MAXDEVICES) * \ diff --git a/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h b/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h index 3bbdc2bb7ebf..9b6d3e69355c 100644 --- a/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h +++ b/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h @@ -25,13 +25,13 @@ * It is filled in by the client side to provide info about the device * and driver from the client's perspective. */ -typedef struct _ULTRA_VBUS_DEVICEINFO { - u8 devType[16]; /* short string identifying the device type */ - u8 drvName[16]; /* driver .sys file name */ - u8 infoStrings[96]; /* sequence of tab-delimited id strings: */ +struct ultra_vbus_deviceinfo { + u8 devtype[16]; /* short string identifying the device type */ + u8 drvname[16]; /* driver .sys file name */ + u8 infostrs[96]; /* sequence of tab-delimited id strings: */ /* <DRIVER_REV> <DRIVER_VERTAG> <DRIVER_COMPILETIME> */ u8 reserved[128]; /* pad size to 256 bytes */ -} ULTRA_VBUS_DEVICEINFO; +}; #pragma pack(pop) @@ -63,8 +63,9 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, int srcmax) p++; remain--; chars++; - } else if (p == NULL) + } else if (p == NULL) { chars++; + } nonprintable_streak = 0; } if (remain > 0) { @@ -72,10 +73,12 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, int srcmax) p++; remain--; chars++; - } else if (p == NULL) + } else if (p == NULL) { chars++; - } else + } + } else { nonprintable_streak = 1; + } src++; srcmax--; } @@ -115,7 +118,7 @@ vbuschannel_itoa(char *p, int remain, int num) } /* form a backwards decimal ascii string in <s> */ while (num > 0) { - if (digits >= (int) sizeof(s)) + if (digits >= (int)sizeof(s)) return 0; s[digits++] = (num % 10) + '0'; num = num / 10; @@ -147,15 +150,15 @@ vbuschannel_itoa(char *p, int remain, int num) * Returns the number of bytes written to <p>. */ static inline int -vbuschannel_devinfo_to_string(ULTRA_VBUS_DEVICEINFO *devinfo, - char *p, int remain, int devix) +vbuschannel_devinfo_to_string(struct ultra_vbus_deviceinfo *devinfo, + char *p, int remain, int devix) { char *psrc; int nsrc, x, i, pad; int chars = 0; - psrc = &(devinfo->devType[0]); - nsrc = sizeof(devinfo->devType); + psrc = &devinfo->devtype[0]; + nsrc = sizeof(devinfo->devtype); if (vbuschannel_sanitize_buffer(NULL, 0, psrc, nsrc) <= 0) return 0; @@ -184,8 +187,8 @@ vbuschannel_devinfo_to_string(ULTRA_VBUS_DEVICEINFO *devinfo, VBUSCHANNEL_ADDACHAR(' ', p, remain, chars); /* emit driver name */ - psrc = &(devinfo->drvName[0]); - nsrc = sizeof(devinfo->drvName); + psrc = &devinfo->drvname[0]; + nsrc = sizeof(devinfo->drvname); x = vbuschannel_sanitize_buffer(p, remain, psrc, nsrc); p += x; remain -= x; @@ -196,8 +199,8 @@ vbuschannel_devinfo_to_string(ULTRA_VBUS_DEVICEINFO *devinfo, VBUSCHANNEL_ADDACHAR(' ', p, remain, chars); /* emit strings */ - psrc = &(devinfo->infoStrings[0]); - nsrc = sizeof(devinfo->infoStrings); + psrc = &devinfo->infostrs[0]; + nsrc = sizeof(devinfo->infostrs); x = vbuschannel_sanitize_buffer(p, remain, psrc, nsrc); p += x; remain -= x; diff --git a/drivers/staging/unisys/common-spar/include/vmcallinterface.h b/drivers/staging/unisys/common-spar/include/vmcallinterface.h index 0b5b5626af5a..78333719c496 100644 --- a/drivers/staging/unisys/common-spar/include/vmcallinterface.h +++ b/drivers/staging/unisys/common-spar/include/vmcallinterface.h @@ -33,7 +33,7 @@ /* define subsystem number for AppOS, used in uislib driver */ #define MDS_APPOS 0x4000000000000000L /* subsystem = 62 - AppOS */ -typedef enum { /* VMCALL identification tuples */ +enum vmcall_monitor_interface_method_tuple { /* VMCALL identification tuples */ /* Note: when a new VMCALL is added: * - the 1st 2 hex digits correspond to one of the * VMCALL_MONITOR_INTERFACE types and @@ -66,7 +66,7 @@ typedef enum { /* VMCALL identification tuples */ * ULTRA_SERVICE_CAPABILITY_TIME * capable guest to make * VMCALL */ -} VMCALL_MONITOR_INTERFACE_METHOD_TUPLE; +}; #define VMCALL_SUCCESS 0 #define VMCALL_SUCCESSFUL(result) (result == 0) @@ -76,12 +76,12 @@ typedef enum { /* VMCALL identification tuples */ __unisys_vmcall_gnuc(tuple, reg_ebx, reg_ecx) #define unisys_extended_vmcall(tuple, reg_ebx, reg_ecx, reg_edx) \ __unisys_extended_vmcall_gnuc(tuple, reg_ebx, reg_ecx, reg_edx) -#define ISSUE_IO_VMCALL(InterfaceMethod, param, result) \ - (result = unisys_vmcall(InterfaceMethod, (param) & 0xFFFFFFFF, \ +#define ISSUE_IO_VMCALL(method, param, result) \ + (result = unisys_vmcall(method, (param) & 0xFFFFFFFF, \ (param) >> 32)) -#define ISSUE_IO_EXTENDED_VMCALL(InterfaceMethod, param1, param2, \ +#define ISSUE_IO_EXTENDED_VMCALL(method, param1, param2, \ param3, result) \ - (result = unisys_extended_vmcall(InterfaceMethod, param1, \ + (result = unisys_extended_vmcall(method, param1, \ param2, param3)) /* The following uses VMCALL_POST_CODE_LOGEVENT interface but is currently @@ -107,21 +107,20 @@ struct phys_info { #pragma pack(pop) /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */ -typedef struct phys_info IO_DATA_STRUCTURE; /* ///////////// BEGIN PRAGMA PACK PUSH 1 ///////////////////////// */ /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */ #pragma pack(push, 1) /* Parameters to VMCALL_IO_CONTROLVM_ADDR interface */ -typedef struct _VMCALL_IO_CONTROLVM_ADDR_PARAMS { +struct vmcall_io_controlvm_addr_params { /* The Guest-relative physical address of the ControlVm channel. * This VMCall fills this in with the appropriate address. */ - u64 ChannelAddress; /* contents provided by this VMCALL (OUT) */ + u64 address; /* contents provided by this VMCALL (OUT) */ /* the size of the ControlVm channel in bytes This VMCall fills this * in with the appropriate address. */ - u32 ChannelBytes; /* contents provided by this VMCALL (OUT) */ - u8 Unused[4]; /* Unused Bytes in the 64-Bit Aligned Struct */ -} VMCALL_IO_CONTROLVM_ADDR_PARAMS; + u32 channel_bytes; /* contents provided by this VMCALL (OUT) */ + u8 unused[4]; /* Unused Bytes in the 64-Bit Aligned Struct */ +}; #pragma pack(pop) /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */ @@ -130,11 +129,11 @@ typedef struct _VMCALL_IO_CONTROLVM_ADDR_PARAMS { /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */ #pragma pack(push, 1) /* Parameters to VMCALL_IO_DIAG_ADDR interface */ -typedef struct _VMCALL_IO_DIAG_ADDR_PARAMS { +struct vmcall_io_diag_addr_params { /* The Guest-relative physical address of the diagnostic channel. * This VMCall fills this in with the appropriate address. */ - u64 ChannelAddress; /* contents provided by this VMCALL (OUT) */ -} VMCALL_IO_DIAG_ADDR_PARAMS; + u64 address; /* contents provided by this VMCALL (OUT) */ +}; #pragma pack(pop) /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */ @@ -143,25 +142,25 @@ typedef struct _VMCALL_IO_DIAG_ADDR_PARAMS { /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */ #pragma pack(push, 1) /* Parameters to VMCALL_IO_VISORSERIAL_ADDR interface */ -typedef struct _VMCALL_IO_VISORSERIAL_ADDR_PARAMS { +struct vmcall_io_visorserial_addr_params { /* The Guest-relative physical address of the serial console * channel. This VMCall fills this in with the appropriate * address. */ - u64 ChannelAddress; /* contents provided by this VMCALL (OUT) */ -} VMCALL_IO_VISORSERIAL_ADDR_PARAMS; + u64 address; /* contents provided by this VMCALL (OUT) */ +}; #pragma pack(pop) /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */ /* Parameters to VMCALL_CHANNEL_MISMATCH interface */ -typedef struct _VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS { - u8 ChannelName[32]; /* Null terminated string giving name of channel +struct vmcall_channel_version_mismatch_params { + u8 chname[32]; /* Null terminated string giving name of channel * (IN) */ - u8 ItemName[32]; /* Null terminated string giving name of + u8 item_name[32]; /* Null terminated string giving name of * mismatched item (IN) */ - u32 SourceLineNumber; /* line# where invoked. (IN) */ - u8 SourceFileName[36]; /* source code where invoked - Null terminated + u32 line_no; /* line# where invoked. (IN) */ + u8 file_name[36]; /* source code where invoked - Null terminated * string (IN) */ -} VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS; +}; #endif /* __IOMONINTF_H__ */ |