diff options
Diffstat (limited to 'drivers/staging/unisys')
39 files changed, 2175 insertions, 2708 deletions
diff --git a/drivers/staging/unisys/channels/channel.c b/drivers/staging/unisys/channels/channel.c index b4bdee4b575b..74cc4d6b515f 100644 --- a/drivers/staging/unisys/channels/channel.c +++ b/drivers/staging/unisys/channels/channel.c @@ -43,45 +43,45 @@ * Return value: * 1 if the insertion succeeds, 0 if the queue was 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) { void __iomem *psignal; unsigned int head, tail, nof; - SIGNAL_QUEUE_HEADER __iomem *pqhdr = - (SIGNAL_QUEUE_HEADER __iomem *) - ((char __iomem *) pChannel + readq(&pChannel->oChannelSpace)) - + Queue; + struct signal_queue_header __iomem *pqhdr = + (struct signal_queue_header __iomem *) + ((char __iomem *)ch + readq(&ch->ch_space_offset)) + + queue; /* capture current head and tail */ - head = readl(&pqhdr->Head); - tail = readl(&pqhdr->Tail); + head = readl(&pqhdr->head); + tail = readl(&pqhdr->tail); /* queue is full if (head + 1) % n equals tail */ - if (((head + 1) % readl(&pqhdr->MaxSignalSlots)) == tail) { - nof = readq(&pqhdr->NumOverflows) + 1; - writeq(nof, &pqhdr->NumOverflows); + if (((head + 1) % readl(&pqhdr->max_slots)) == tail) { + nof = readq(&pqhdr->num_overflows) + 1; + writeq(nof, &pqhdr->num_overflows); return 0; } /* increment the head index */ - head = (head + 1) % readl(&pqhdr->MaxSignalSlots); + head = (head + 1) % readl(&pqhdr->max_slots); /* copy signal to the head location from the area pointed to * by pSignal */ - psignal = (char __iomem *)pqhdr + readq(&pqhdr->oSignalBase) + - (head * readl(&pqhdr->SignalSize)); - memcpy_toio(psignal, pSignal, readl(&pqhdr->SignalSize)); + psignal = (char __iomem *)pqhdr + readq(&pqhdr->sig_base_offset) + + (head * readl(&pqhdr->signal_size)); + memcpy_toio(psignal, sig, readl(&pqhdr->signal_size)); mb(); /* channel synch */ - writel(head, &pqhdr->Head); + writel(head, &pqhdr->head); - writeq(readq(&pqhdr->NumSignalsSent) + 1, &pqhdr->NumSignalsSent); + writeq(readq(&pqhdr->num_sent) + 1, &pqhdr->num_sent); return 1; } -EXPORT_SYMBOL_GPL(visor_signal_insert); +EXPORT_SYMBOL_GPL(spar_signal_insert); /* * Routine Description: @@ -102,40 +102,40 @@ EXPORT_SYMBOL_GPL(visor_signal_insert); * 1 if the removal succeeds, 0 if the queue was empty. */ unsigned char -visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal) +spar_signal_remove(struct channel_header __iomem *ch, u32 queue, void *sig) { void __iomem *psource; unsigned int head, tail; - SIGNAL_QUEUE_HEADER __iomem *pqhdr = - (SIGNAL_QUEUE_HEADER __iomem *) ((char __iomem *) pChannel + - readq(&pChannel->oChannelSpace)) + Queue; + struct signal_queue_header __iomem *pqhdr = + (struct signal_queue_header __iomem *)((char __iomem *)ch + + readq(&ch->ch_space_offset)) + queue; /* capture current head and tail */ - head = readl(&pqhdr->Head); - tail = readl(&pqhdr->Tail); + head = readl(&pqhdr->head); + tail = readl(&pqhdr->tail); /* queue is empty if the head index equals the tail index */ if (head == tail) { - writeq(readq(&pqhdr->NumEmptyCnt) + 1, &pqhdr->NumEmptyCnt); + writeq(readq(&pqhdr->num_empty) + 1, &pqhdr->num_empty); return 0; } /* advance past the 'empty' front slot */ - tail = (tail + 1) % readl(&pqhdr->MaxSignalSlots); + tail = (tail + 1) % readl(&pqhdr->max_slots); /* copy signal from tail location to the area pointed to by pSignal */ - psource = (char __iomem *) pqhdr + readq(&pqhdr->oSignalBase) + - (tail * readl(&pqhdr->SignalSize)); - memcpy_fromio(pSignal, psource, readl(&pqhdr->SignalSize)); + psource = (char __iomem *)pqhdr + readq(&pqhdr->sig_base_offset) + + (tail * readl(&pqhdr->signal_size)); + memcpy_fromio(sig, psource, readl(&pqhdr->signal_size)); mb(); /* channel synch */ - writel(tail, &pqhdr->Tail); + writel(tail, &pqhdr->tail); - writeq(readq(&pqhdr->NumSignalsReceived) + 1, - &pqhdr->NumSignalsReceived); + writeq(readq(&pqhdr->num_received) + 1, + &pqhdr->num_received); return 1; } -EXPORT_SYMBOL_GPL(visor_signal_remove); +EXPORT_SYMBOL_GPL(spar_signal_remove); /* * Routine Description: @@ -156,18 +156,18 @@ EXPORT_SYMBOL_GPL(visor_signal_remove); * 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) { void *psource; - unsigned int head, tail, signalCount = 0; - pSIGNAL_QUEUE_HEADER pqhdr = - (pSIGNAL_QUEUE_HEADER) ((char *) pChannel + - pChannel->oChannelSpace) + Queue; + unsigned int head, tail, count = 0; + struct signal_queue_header *pqhdr = + (struct signal_queue_header *)((char *)ch + + ch->ch_space_offset) + queue; /* capture current head and tail */ - head = pqhdr->Head; - tail = pqhdr->Tail; + head = pqhdr->head; + tail = pqhdr->tail; /* queue is empty if the head index equals the tail index */ if (head == tail) @@ -175,25 +175,25 @@ SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal) while (head != tail) { /* advance past the 'empty' front slot */ - tail = (tail + 1) % pqhdr->MaxSignalSlots; + tail = (tail + 1) % pqhdr->max_slots; /* copy signal from tail location to the area pointed * to by pSignal */ psource = - (char *) pqhdr + pqhdr->oSignalBase + - (tail * pqhdr->SignalSize); - memcpy((char *) pSignal + (pqhdr->SignalSize * signalCount), - psource, pqhdr->SignalSize); + (char *)pqhdr + pqhdr->sig_base_offset + + (tail * pqhdr->signal_size); + memcpy((char *)sig + (pqhdr->signal_size * count), + psource, pqhdr->signal_size); mb(); /* channel synch */ - pqhdr->Tail = tail; + pqhdr->tail = tail; - signalCount++; - pqhdr->NumSignalsReceived++; + count++; + pqhdr->num_received++; } - return signalCount; + return count; } /* @@ -207,13 +207,13 @@ SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal) * 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) { - SIGNAL_QUEUE_HEADER __iomem *pqhdr = - (SIGNAL_QUEUE_HEADER __iomem *) ((char __iomem *) pChannel + - readq(&pChannel->oChannelSpace)) + Queue; - return readl(&pqhdr->Head) == readl(&pqhdr->Tail); + struct signal_queue_header __iomem *pqhdr = + (struct signal_queue_header __iomem *)((char __iomem *)ch + + readq(&ch->ch_space_offset)) + queue; + return readl(&pqhdr->head) == readl(&pqhdr->tail); } -EXPORT_SYMBOL_GPL(visor_signalqueue_empty); +EXPORT_SYMBOL_GPL(spar_signalqueue_empty); diff --git a/drivers/staging/unisys/channels/chanstub.c b/drivers/staging/unisys/channels/chanstub.c index d54c5d635a94..b6fd126f16f1 100644 --- a/drivers/staging/unisys/channels/chanstub.c +++ b/drivers/staging/unisys/channels/chanstub.c @@ -42,26 +42,26 @@ channel_mod_exit(void) } unsigned char -SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, +SignalInsert_withLock(struct channel_header __iomem *pChannel, u32 Queue, void *pSignal, spinlock_t *lock) { unsigned char result; unsigned long flags; spin_lock_irqsave(lock, flags); - result = visor_signal_insert(pChannel, Queue, pSignal); + result = spar_signal_insert(pChannel, Queue, pSignal); spin_unlock_irqrestore(lock, flags); return result; } unsigned char -SignalRemove_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, +SignalRemove_withLock(struct channel_header __iomem *pChannel, u32 Queue, void *pSignal, spinlock_t *lock) { unsigned char result; spin_lock(lock); - result = visor_signal_remove(pChannel, Queue, pSignal); + result = spar_signal_remove(pChannel, Queue, pSignal); spin_unlock(lock); return result; } diff --git a/drivers/staging/unisys/channels/chanstub.h b/drivers/staging/unisys/channels/chanstub.h index d08e2c69d2ad..1531759a1b31 100644 --- a/drivers/staging/unisys/channels/chanstub.h +++ b/drivers/staging/unisys/channels/chanstub.h @@ -15,9 +15,9 @@ #ifndef __CHANSTUB_H__ #define __CHANSTUB_H__ -unsigned char SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal, spinlock_t *lock); -unsigned char SignalRemove_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal, spinlock_t *lock); +unsigned char SignalInsert_withLock(struct channel_header __iomem *pChannel, + u32 Queue, void *pSignal, spinlock_t *lock); +unsigned char SignalRemove_withLock(struct channel_header __iomem *pChannel, + u32 Queue, void *pSignal, spinlock_t *lock); #endif 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__ */ diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index b14494ff6c1b..cff7983dab85 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -31,7 +31,6 @@ #include <linux/slab.h> #include <linux/errno.h> #include <linux/interrupt.h> -#include <linux/sched.h> #include <linux/wait.h> #include <linux/vmalloc.h> #include <linux/proc_fs.h> @@ -71,7 +70,6 @@ /** Try to evaulate the provided expression, and do a RETINT(x) iff * the expression evaluates to < 0. - * @param x the expression to try */ #define ASSERT(cond) \ do { if (!(cond)) \ @@ -89,11 +87,6 @@ (void *)(p2) = SWAPPOINTERS_TEMP; \ } while (0) -/** - * @addtogroup driverlogging - * @{ - */ - #define PRINTKDRV(fmt, args...) LOGINF(fmt, ## args) #define TBDDRV(fmt, args...) LOGERR(fmt, ## args) #define HUHDRV(fmt, args...) LOGERR(fmt, ## args) @@ -114,8 +107,6 @@ #define INFODEVX(devno, fmt, args...) LOGINFDEVX(devno, fmt, ## args) #define DEBUGDEV(devname, fmt, args...) DBGINFDEV(devname, fmt, ## args) -/* @} */ - /** Verifies the consistency of your PRIVATEDEVICEDATA structure using * conventional "signature" fields: * <p> @@ -139,7 +130,7 @@ ((fd)->sig2 == fd)) /** Sleep for an indicated number of seconds (for use in kernel mode). - * @param x the number of seconds to sleep. + * x - the number of seconds to sleep. */ #define SLEEP(x) \ do { current->state = TASK_INTERRUPTIBLE; \ @@ -147,17 +138,13 @@ } while (0) /** Sleep for an indicated number of jiffies (for use in kernel mode). - * @param x the number of jiffies to sleep. + * x - the number of jiffies to sleep. */ #define SLEEPJIFFIES(x) \ do { current->state = TASK_INTERRUPTIBLE; \ schedule_timeout(x); \ } while (0) -#ifndef max -#define max(a, b) (((a) > (b)) ? (a) : (b)) -#endif - static inline struct cdev *cdev_alloc_init(struct module *owner, const struct file_operations *fops) { diff --git a/drivers/staging/unisys/include/uisqueue.h b/drivers/staging/unisys/include/uisqueue.h index 5178270b98d1..25b6181d78af 100644 --- a/drivers/staging/unisys/include/uisqueue.h +++ b/drivers/staging/unisys/include/uisqueue.h @@ -34,8 +34,7 @@ #include "controlvmcompletionstatus.h" struct uisqueue_info { - - CHANNEL_HEADER __iomem *chan; + struct channel_header __iomem *chan; /* channel containing queues in which scsi commands & * responses are queued */ @@ -48,8 +47,8 @@ struct uisqueue_info { u64 non_empty_wakeup_cnt; struct { - SIGNAL_QUEUE_HEADER reserved1; /* */ - SIGNAL_QUEUE_HEADER reserved2; /* */ + struct signal_queue_header reserved1; /* */ + struct signal_queue_header reserved2; /* */ } safe_uis_queue; unsigned int (*send_int_if_needed)(struct uisqueue_info *info, unsigned int whichcqueue, @@ -119,7 +118,7 @@ struct extport_info { */ struct switch_info *swtch; - struct PciId pci_id; + struct pci_id pci_id; char name[MAX_NAME_SIZE_UISQUEUE]; union { struct vhba_wwnn wwnn; @@ -133,7 +132,7 @@ struct device_info { u64 channel_bytes; uuid_le channel_uuid; uuid_le instance_uuid; - struct InterruptInfo intr; + struct irq_info intr; struct switch_info *swtch; char devid[30]; /* "vbus<busno>:dev<devno>" */ u16 polling; @@ -149,30 +148,27 @@ struct device_info { unsigned long long last_on_list_cnt; }; -typedef enum { +enum switch_type { RECOVERY_LAN = 1, IB_LAN = 2 -} SWITCH_TYPE; +}; struct bus_info { - u32 busNo, deviceCount; + u32 bus_no, device_count; struct device_info **device; - u64 guestHandle, recvBusInterruptHandle; - uuid_le busInstGuid; - ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *pBusChannel; - int busChannelBytes; + u64 guest_handle, recv_bus_irq_handle; + uuid_le bus_inst_uuid; + struct ultra_vbus_channel_protocol __iomem *bus_channel; + int bus_channel_bytes; struct proc_dir_entry *proc_dir; /* proc/uislib/vbus/<x> */ struct proc_dir_entry *proc_info; /* proc/uislib/vbus/<x>/info */ char name[25]; - char partitionName[99]; + char partition_name[99]; struct bus_info *next; - u8 localVnic; /* 1 if local vnic created internally + u8 local_vnic; /* 1 if local vnic created internally * by IOVM; 0 otherwise... */ }; -#define DEDICATED_SWITCH(s) ((s->extPortCount == 1) && \ - (s->intPortCount == 1)) - struct sn_list_entry { struct uisscsi_dest pdest; /* scsi bus, target, lun for * phys disk */ @@ -183,23 +179,12 @@ struct sn_list_entry { struct sn_list_entry *next; }; -struct network_policy { - u32 promiscuous:1; - u32 macassign:1; - u32 peerforwarding:1; - u32 nonotify:1; - u32 standby:1; - u32 callhome:2; - char ip_addr[30]; -}; - /* * IO messages sent to UisnicControlChanFunc & UissdControlChanFunc by * code that processes the ControlVm channel messages. */ - -typedef enum { +enum iopart_msg_type { IOPART_ADD_VNIC, IOPART_DEL_VNIC, IOPART_DEL_ALL_VNICS, @@ -219,7 +204,7 @@ typedef enum { IOPART_RESUME_VDISK, IOPART_ADD_DEVICE, /* add generic device */ IOPART_DEL_DEVICE, /* del generic device */ -} IOPART_MSG_TYPE; +}; struct add_virt_iopart { void *chanptr; /* pointer to data channel */ @@ -228,7 +213,7 @@ struct add_virt_iopart { * for DMA, for ex. */ u64 recv_bus_irq_handle; /* used to register to receive * bus level interrupts. */ - struct InterruptInfo intr; /* contains recv & send + struct irq_info intr; /* contains recv & send * interrupt info */ /* recvInterruptHandle is used to register to receive * interrupts on the data channel. Used by GuestLinux/Windows @@ -259,21 +244,15 @@ struct add_vdisk_iopart { struct uisscsi_dest pdest; /* scsi bus, target, lun for phys disk */ u8 sernum[MAX_SERIAL_NUM]; /* serial num of physical disk */ u32 serlen; /* length of serial num */ - u32 bus_no; - u32 dev_no; }; struct del_vdisk_iopart { void *chanptr; /* pointer to data channel */ struct uisscsi_dest vdest; /* scsi bus, target, lun for virt disk */ - u32 bus_no; - u32 dev_no; }; struct del_virt_iopart { void *chanptr; /* pointer to data channel */ - u32 bus_no; - u32 dev_no; }; struct det_virt_iopart { /* detach internal port */ @@ -297,8 +276,7 @@ struct del_switch_iopart { /* destroy switch */ }; struct io_msgs { - - IOPART_MSG_TYPE msgtype; + enum iopart_msg_type msgtype; /* additional params needed by some messages */ union { @@ -329,7 +307,7 @@ struct io_msgs { * the ControlVm channel messages. */ -typedef enum { +enum guestpart_msg_type { GUEST_ADD_VBUS, GUEST_ADD_VHBA, GUEST_ADD_VNIC, @@ -344,15 +322,15 @@ typedef enum { GUEST_PAUSE_VNIC, GUEST_RESUME_VHBA, GUEST_RESUME_VNIC -} GUESTPART_MSG_TYPE; +}; struct add_vbus_guestpart { void __iomem *chanptr; /* pointer to data channel for bus - * NOT YET USED */ - u32 busNo; /* bus number to be created/deleted */ - u32 deviceCount; /* max num of devices on bus */ - uuid_le busTypeGuid; /* indicates type of bus */ - uuid_le busInstGuid; /* instance guid for device */ + u32 bus_no; /* bus number to be created/deleted */ + u32 dev_count; /* max num of devices on bus */ + uuid_le bus_uuid; /* indicates type of bus */ + uuid_le instance_uuid; /* instance guid for device */ }; struct del_vbus_guestpart { @@ -367,7 +345,7 @@ struct add_virt_guestpart { u32 bus_no; /* bus number for the operation */ u32 device_no; /* number of device on the bus */ uuid_le instance_uuid; /* instance guid for device */ - struct InterruptInfo intr; /* recv/send interrupt info */ + struct irq_info intr; /* recv/send interrupt info */ /* recvInterruptHandle contains info needed in order to * register to receive interrupts on the data channel. * sendInterruptHandle contains handle which is provided to @@ -394,8 +372,7 @@ struct init_chipset_guestpart { }; struct guest_msgs { - - GUESTPART_MSG_TYPE msgtype; + enum guestpart_msg_type msgtype; /* additional params needed by messages */ union { diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h index 74e7cf65502c..7414220676d3 100644 --- a/drivers/staging/unisys/include/uisutils.h +++ b/drivers/staging/unisys/include/uisutils.h @@ -26,6 +26,7 @@ #include <linux/sched.h> #include <linux/gfp.h> #include <linux/uuid.h> +#include <linux/if_ether.h> #include "vmcallinterface.h" #include "channel.h" @@ -43,39 +44,38 @@ /* global function pointers that act as callback functions into * uisnicmod, uissdmod, and virtpcimod */ -extern int (*UisnicControlChanFunc)(struct io_msgs *); -extern int (*UissdControlChanFunc)(struct io_msgs *); -extern int (*VirtControlChanFunc)(struct guest_msgs *); +extern int (*uisnic_control_chan_func)(struct io_msgs *); +extern int (*uissd_control_chan_func)(struct io_msgs *); +extern int (*virt_control_chan_func)(struct guest_msgs *); /* Return values of above callback functions: */ #define CCF_ERROR 0 /* completed and failed */ #define CCF_OK 1 /* completed successfully */ #define CCF_PENDING 2 /* operation still pending */ -extern atomic_t UisUtils_Registered_Services; +extern atomic_t uisutils_registered_services; -typedef unsigned int MACARRAY[MAX_MACADDR_LEN]; -typedef struct ReqHandlerInfo_struct { - uuid_le switchTypeGuid; +struct req_handler_info { + uuid_le switch_uuid; int (*controlfunc)(struct io_msgs *); unsigned long min_channel_bytes; - int (*Server_Channel_Ok)(unsigned long channelBytes); - int (*Server_Channel_Init) - (void *x, unsigned char *clientStr, u32 clientStrLen, u64 bytes); + int (*server_channel_ok)(unsigned long channel_bytes); + int (*server_channel_init)(void *x, unsigned char *client_str, + u32 client_str_len, u64 bytes); char switch_type_name[99]; struct list_head list_link; /* links into ReqHandlerInfo_list */ -} ReqHandlerInfo_t; +}; -ReqHandlerInfo_t *ReqHandlerAdd(uuid_le switchTypeGuid, +struct req_handler_info *req_handler_add(uuid_le switch_uuid, const char *switch_type_name, int (*controlfunc)(struct io_msgs *), unsigned long min_channel_bytes, - int (*Server_Channel_Ok)(unsigned long - channelBytes), - int (*Server_Channel_Init) - (void *x, unsigned char *clientStr, - u32 clientStrLen, u64 bytes)); -ReqHandlerInfo_t *ReqHandlerFind(uuid_le switchTypeGuid); -int ReqHandlerDel(uuid_le switchTypeGuid); + int (*svr_channel_ok)(unsigned long + channel_bytes), + int (*svr_channel_init)(void *x, + unsigned char *client_str, + u32 client_str_len, u64 bytes)); +struct req_handler_info *req_handler_find(uuid_le switch_uuid); +int req_handler_del(uuid_le switch_uuid); #define uislib_ioremap_cache(addr, size) \ dbg_ioremap_cache(addr, size, __FILE__, __LINE__) @@ -114,52 +114,49 @@ int uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining, char *format, ...); int uisctrl_register_req_handler(int type, void *fptr, - ULTRA_VBUS_DEVICEINFO *chipset_driver_info); -int uisctrl_register_req_handler_ex(uuid_le switchTypeGuid, - const char *switch_type_name, - int (*fptr)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*Server_Channel_Ok)(unsigned long - channelBytes), - int (*Server_Channel_Init) - (void *x, unsigned char *clientStr, - u32 clientStrLen, u64 bytes), - ULTRA_VBUS_DEVICEINFO *chipset_DriverInfo); - -int uisctrl_unregister_req_handler_ex(uuid_le switchTypeGuid); + struct ultra_vbus_deviceinfo *chipset_driver_info); +int uisctrl_register_req_handler_ex(uuid_le switch_guid, + const char *switch_type_name, + int (*fptr)(struct io_msgs *), + unsigned long min_channel_bytes, + int (*svr_channel_ok)(unsigned long + channel_bytes), + int (*svr_channel_init)(void *x, + unsigned char *client_str, + u32 client_str_len, + u64 bytes), + struct ultra_vbus_deviceinfo *chipset_driver_info); + +int uisctrl_unregister_req_handler_ex(uuid_le switch_uuid); unsigned char *util_map_virt(struct phys_info *sg); void util_unmap_virt(struct phys_info *sg); unsigned char *util_map_virt_atomic(struct phys_info *sg); void util_unmap_virt_atomic(void *buf); -int uislib_server_inject_add_vnic(u32 switchNo, u32 BusNo, u32 numIntPorts, - u32 numExtPorts, MACARRAY pmac[], - pCHANNEL_HEADER **chan); -void uislib_server_inject_del_vnic(u32 switchNo, u32 busNo, u32 numIntPorts, - u32 numExtPorts); -int uislib_client_inject_add_bus(u32 busNo, uuid_le instGuid, - u64 channelAddr, ulong nChannelBytes); -int uislib_client_inject_del_bus(u32 busNo); - -int uislib_client_inject_add_vhba(u32 busNo, u32 devNo, +int uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, + u64 channel_addr, ulong n_channel_bytes); +int uislib_client_inject_del_bus(u32 bus_no); + +int uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, u64 phys_chan_addr, u32 chan_bytes, - int is_test_addr, uuid_le instGuid, - struct InterruptInfo *intr); -int uislib_client_inject_pause_vhba(u32 busNo, u32 devNo); -int uislib_client_inject_resume_vhba(u32 busNo, u32 devNo); -int uislib_client_inject_del_vhba(u32 busNo, u32 devNo); -int uislib_client_inject_add_vnic(u32 busNo, u32 devNo, + int is_test_addr, uuid_le inst_uuid, + struct irq_info *intr); +int uislib_client_inject_pause_vhba(u32 bus_no, u32 dev_no); +int uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no); +int uislib_client_inject_del_vhba(u32 bus_no, u32 dev_no); +int uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, u64 phys_chan_addr, u32 chan_bytes, - int is_test_addr, uuid_le instGuid, - struct InterruptInfo *intr); -int uislib_client_inject_pause_vnic(u32 busNo, u32 devNo); -int uislib_client_inject_resume_vnic(u32 busNo, u32 devNo); -int uislib_client_inject_del_vnic(u32 busNo, u32 devNo); + int is_test_addr, uuid_le inst_uuid, + struct irq_info *intr); +int uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no); +int uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no); +int uislib_client_inject_del_vnic(u32 bus_no, u32 dev_no); #ifdef STORAGE_CHANNEL u64 uislib_storage_channel(int client_id); #endif int uislib_get_owned_pdest(struct uisscsi_dest *pdest); -int uislib_send_event(CONTROLVM_ID id, CONTROLVM_MESSAGE_PACKET *event); +int uislib_send_event(enum controlvm_id id, + struct controlvm_message_packet *event); /* structure used by vhba & vnic to keep track of queue & thread info */ struct chaninfo { @@ -182,11 +179,14 @@ struct chaninfo { set_current_state(TASK_INTERRUPTIBLE); \ schedule_timeout(msecs_to_jiffies(x)); \ } + #define UIS_THREAD_WAIT_USEC(x) { \ set_current_state(TASK_INTERRUPTIBLE); \ schedule_timeout(usecs_to_jiffies(x)); \ } + #define UIS_THREAD_WAIT UIS_THREAD_WAIT_MSEC(5) + #define UIS_THREAD_WAIT_SEC(x) { \ set_current_state(TASK_INTERRUPTIBLE); \ schedule_timeout((x)*HZ); \ @@ -224,42 +224,42 @@ unsigned int uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx, static inline unsigned int issue_vmcall_io_controlvm_addr(u64 *control_addr, u32 *control_bytes) { - VMCALL_IO_CONTROLVM_ADDR_PARAMS params; + struct vmcall_io_controlvm_addr_params params; int result = VMCALL_SUCCESS; u64 physaddr; physaddr = virt_to_phys(¶ms); ISSUE_IO_VMCALL(VMCALL_IO_CONTROLVM_ADDR, physaddr, result); if (VMCALL_SUCCESSFUL(result)) { - *control_addr = params.ChannelAddress; - *control_bytes = params.ChannelBytes; + *control_addr = params.address; + *control_bytes = params.channel_bytes; } return result; } static inline unsigned int issue_vmcall_io_diag_addr(u64 *diag_channel_addr) { - VMCALL_IO_DIAG_ADDR_PARAMS params; + struct vmcall_io_diag_addr_params params; int result = VMCALL_SUCCESS; u64 physaddr; physaddr = virt_to_phys(¶ms); ISSUE_IO_VMCALL(VMCALL_IO_DIAG_ADDR, physaddr, result); if (VMCALL_SUCCESSFUL(result)) - *diag_channel_addr = params.ChannelAddress; + *diag_channel_addr = params.address; return result; } static inline unsigned int issue_vmcall_io_visorserial_addr(u64 *channel_addr) { - VMCALL_IO_VISORSERIAL_ADDR_PARAMS params; + struct vmcall_io_visorserial_addr_params params; int result = VMCALL_SUCCESS; u64 physaddr; physaddr = virt_to_phys(¶ms); ISSUE_IO_VMCALL(VMCALL_IO_VISORSERIAL_ADDR, physaddr, result); if (VMCALL_SUCCESSFUL(result)) - *channel_addr = params.ChannelAddress; + *channel_addr = params.address; return result; } @@ -273,17 +273,8 @@ static inline s64 issue_vmcall_query_guest_virtual_time_offset(void) return result; } -static inline s64 issue_vmcall_measurement_do_nothing(void) -{ - u64 result = VMCALL_SUCCESS; - u64 physaddr = 0; - - ISSUE_IO_VMCALL(VMCALL_MEASUREMENT_DO_NOTHING, physaddr, result); - return result; -} - struct log_info_t { - volatile unsigned long long last_cycles; + unsigned long long last_cycles; unsigned long long delta_sum[64]; unsigned long long delta_cnt[64]; unsigned long long max_delta[64]; @@ -302,44 +293,29 @@ static inline unsigned int issue_vmcall_channel_mismatch(const char *chname, const char *item_name, u32 line_no, const char *path_n_fn) { - VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS params; + struct vmcall_channel_version_mismatch_params params; int result = VMCALL_SUCCESS; u64 physaddr; char *last_slash = NULL; - strlcpy(params.ChannelName, chname, - lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS, ChannelName)); - strlcpy(params.ItemName, item_name, - lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS, ItemName)); - params.SourceLineNumber = line_no; + strlcpy(params.chname, chname, sizeof(params.chname)); + strlcpy(params.item_name, item_name, sizeof(params.item_name)); + params.line_no = line_no; last_slash = strrchr(path_n_fn, '/'); if (last_slash != NULL) { last_slash++; - strlcpy(params.SourceFileName, last_slash, - lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS, - SourceFileName)); + strlcpy(params.file_name, last_slash, sizeof(params.file_name)); } else - strlcpy(params.SourceFileName, + strlcpy(params.file_name, "Cannot determine source filename", - lengthof(VMCALL_CHANNEL_VERSION_MISMATCH_PARAMS, - SourceFileName)); + sizeof(params.file_name)); physaddr = virt_to_phys(¶ms); ISSUE_IO_VMCALL(VMCALL_CHANNEL_VERSION_MISMATCH, physaddr, result); return result; } -static inline unsigned int issue_vmcall_fatal(void) -{ - int result = VMCALL_SUCCESS; - u64 physaddr = 0; - - ISSUE_IO_VMCALL(VMCALL_GENERIC_SURRENDER_QUANTUM_FOREVER, physaddr, - result); - return result; -} - #define UIS_DAEMONIZE(nam) void *uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln); #define UISCACHEALLOC(cur_pool) uislib_cache_alloc(cur_pool, __FILE__, __LINE__) diff --git a/drivers/staging/unisys/include/vbushelper.h b/drivers/staging/unisys/include/vbushelper.h index 1bde549ec0df..84abe5f99f54 100644 --- a/drivers/staging/unisys/include/vbushelper.h +++ b/drivers/staging/unisys/include/vbushelper.h @@ -26,19 +26,19 @@ #define TARGET_HOSTNAME "linuxguest" static inline void bus_device_info_init( - ULTRA_VBUS_DEVICEINFO * bus_device_info_ptr, + struct ultra_vbus_deviceinfo *bus_device_info_ptr, const char *dev_type, const char *drv_name, const char *ver, const char *ver_tag) { - memset(bus_device_info_ptr, 0, sizeof(ULTRA_VBUS_DEVICEINFO)); - snprintf(bus_device_info_ptr->devType, - sizeof(bus_device_info_ptr->devType), + memset(bus_device_info_ptr, 0, sizeof(struct ultra_vbus_deviceinfo)); + snprintf(bus_device_info_ptr->devtype, + sizeof(bus_device_info_ptr->devtype), "%s", (dev_type) ? dev_type : "unknownType"); - snprintf(bus_device_info_ptr->drvName, - sizeof(bus_device_info_ptr->drvName), + snprintf(bus_device_info_ptr->drvname, + sizeof(bus_device_info_ptr->drvname), "%s", (drv_name) ? drv_name : "unknownDriver"); - snprintf(bus_device_info_ptr->infoStrings, - sizeof(bus_device_info_ptr->infoStrings), "%s\t%s\t%s", + snprintf(bus_device_info_ptr->infostrs, + sizeof(bus_device_info_ptr->infostrs), "%s\t%s\t%s", (ver) ? ver : "unknownVer", (ver_tag) ? ver_tag : "unknownVerTag", TARGET_HOSTNAME); diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 706f1c0c2c6e..7c87452a9f14 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -57,7 +57,7 @@ #define __MYFILE__ "uislib.c" /* global function pointers that act as callback functions into virtpcimod */ -int (*VirtControlChanFunc)(struct guest_msgs *); +int (*virt_control_chan_func)(struct guest_msgs *); static int ProcReadBufferValid; static char *ProcReadBuffer; /* Note this MUST be global, @@ -121,12 +121,12 @@ static const struct file_operations debugfs_info_fops = { }; static void -init_msg_header(CONTROLVM_MESSAGE *msg, u32 id, uint rsp, uint svr) +init_msg_header(struct controlvm_message *msg, u32 id, uint rsp, uint svr) { - memset(msg, 0, sizeof(CONTROLVM_MESSAGE)); - msg->hdr.Id = id; - msg->hdr.Flags.responseExpected = rsp; - msg->hdr.Flags.server = svr; + memset(msg, 0, sizeof(struct controlvm_message)); + msg->hdr.id = id; + msg->hdr.flags.response_expected = rsp; + msg->hdr.flags.server = svr; } static __iomem void * @@ -142,7 +142,7 @@ init_vbus_channel(u64 channelAddr, u32 channelBytes) rc = NULL; goto Away; } - if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) { + if (!SPAR_VBUS_CHANNEL_OK_CLIENT(pChan)) { ERRDRV("%s channel cannot be used", __func__); uislib_iounmap(pChan); rc = NULL; @@ -154,7 +154,7 @@ Away: } static int -create_bus(CONTROLVM_MESSAGE *msg, char *buf) +create_bus(struct controlvm_message *msg, char *buf) { u32 busNo, deviceCount; struct bus_info *tmp, *bus; @@ -168,8 +168,8 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf) return CONTROLVM_RESP_ERROR_MAX_BUSES; } - busNo = msg->cmd.createBus.busNo; - deviceCount = msg->cmd.createBus.deviceCount; + busNo = msg->cmd.create_bus.bus_no; + deviceCount = msg->cmd.create_bus.dev_count; POSTCODE_LINUX_4(BUS_CREATE_ENTRY_PC, busNo, deviceCount, POSTCODE_SEVERITY_INFO); @@ -188,25 +188,25 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf) /* Currently by default, the bus Number is the GuestHandle. * Configure Bus message can override this. */ - if (msg->hdr.Flags.testMessage) { + if (msg->hdr.flags.test_message) { /* This implies we're the IOVM so set guest handle to 0... */ - bus->guestHandle = 0; - bus->busNo = busNo; - bus->localVnic = 1; + bus->guest_handle = 0; + bus->bus_no = busNo; + bus->local_vnic = 1; } else - bus->busNo = bus->guestHandle = busNo; - sprintf(bus->name, "%d", (int) bus->busNo); - bus->deviceCount = deviceCount; + bus->bus_no = bus->guest_handle = busNo; + sprintf(bus->name, "%d", (int) bus->bus_no); + bus->device_count = deviceCount; bus->device = (struct device_info **) ((char *) bus + sizeof(struct bus_info)); - bus->busInstGuid = msg->cmd.createBus.busInstGuid; - bus->busChannelBytes = 0; - bus->pBusChannel = NULL; + bus->bus_inst_uuid = msg->cmd.create_bus.bus_inst_uuid; + bus->bus_channel_bytes = 0; + bus->bus_channel = NULL; /* add bus to our bus list - but check for duplicates first */ read_lock(&BusListLock); for (tmp = BusListHead; tmp; tmp = tmp->next) { - if (tmp->busNo == bus->busNo) + if (tmp->bus_no == bus->bus_no) break; } read_unlock(&BusListLock); @@ -215,39 +215,39 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf) * reject add */ LOGERR("CONTROLVM_BUS_CREATE Failed: bus %d already exists.\n", - bus->busNo); - POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->busNo, + bus->bus_no); + POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); return CONTROLVM_RESP_ERROR_ALREADY_DONE; } - if ((msg->cmd.createBus.channelAddr != 0) - && (msg->cmd.createBus.channelBytes != 0)) { - bus->busChannelBytes = msg->cmd.createBus.channelBytes; - bus->pBusChannel = - init_vbus_channel(msg->cmd.createBus.channelAddr, - msg->cmd.createBus.channelBytes); + if ((msg->cmd.create_bus.channel_addr != 0) + && (msg->cmd.create_bus.channel_bytes != 0)) { + bus->bus_channel_bytes = msg->cmd.create_bus.channel_bytes; + bus->bus_channel = + init_vbus_channel(msg->cmd.create_bus.channel_addr, + msg->cmd.create_bus.channel_bytes); } /* the msg is bound for virtpci; send guest_msgs struct to callback */ - if (!msg->hdr.Flags.server) { + if (!msg->hdr.flags.server) { struct guest_msgs cmd; cmd.msgtype = GUEST_ADD_VBUS; - cmd.add_vbus.busNo = busNo; - cmd.add_vbus.chanptr = bus->pBusChannel; - cmd.add_vbus.deviceCount = deviceCount; - cmd.add_vbus.busTypeGuid = msg->cmd.createBus.busDataTypeGuid; - cmd.add_vbus.busInstGuid = msg->cmd.createBus.busInstGuid; - if (!VirtControlChanFunc) { + cmd.add_vbus.bus_no = busNo; + cmd.add_vbus.chanptr = bus->bus_channel; + cmd.add_vbus.dev_count = deviceCount; + cmd.add_vbus.bus_uuid = msg->cmd.create_bus.bus_data_type_uuid; + cmd.add_vbus.instance_uuid = msg->cmd.create_bus.bus_inst_uuid; + if (!virt_control_chan_func) { LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci callback not registered."); - POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->busNo, + POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } - if (!VirtControlChanFunc(&cmd)) { + if (!virt_control_chan_func(&cmd)) { LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci GUEST_ADD_VBUS returned error."); - POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->busNo, + POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); return @@ -266,26 +266,26 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf) BusListCount++; write_unlock(&BusListLock); - POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus->busNo, + POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus->bus_no, POSTCODE_SEVERITY_INFO); return CONTROLVM_RESP_SUCCESS; } static int -destroy_bus(CONTROLVM_MESSAGE *msg, char *buf) +destroy_bus(struct controlvm_message *msg, char *buf) { int i; struct bus_info *bus, *prev = NULL; struct guest_msgs cmd; u32 busNo; - busNo = msg->cmd.destroyBus.busNo; + busNo = msg->cmd.destroy_bus.bus_no; read_lock(&BusListLock); bus = BusListHead; while (bus) { - if (bus->busNo == busNo) + if (bus->bus_no == busNo) break; prev = bus; bus = bus->next; @@ -299,7 +299,7 @@ destroy_bus(CONTROLVM_MESSAGE *msg, char *buf) } /* verify that this bus has no devices. */ - for (i = 0; i < bus->deviceCount; i++) { + for (i = 0; i < bus->device_count; i++) { if (bus->device[i] != NULL) { LOGERR("CONTROLVM_BUS_DESTROY Failed: device %i attached to bus %d.", i, busNo); @@ -309,18 +309,18 @@ destroy_bus(CONTROLVM_MESSAGE *msg, char *buf) } read_unlock(&BusListLock); - if (msg->hdr.Flags.server) + if (msg->hdr.flags.server) goto remove; /* client messages require us to call the virtpci callback associated with this bus. */ cmd.msgtype = GUEST_DEL_VBUS; cmd.del_vbus.bus_no = busNo; - if (!VirtControlChanFunc) { + if (!virt_control_chan_func) { LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } - if (!VirtControlChanFunc(&cmd)) { + if (!virt_control_chan_func(&cmd)) { LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci GUEST_DEL_VBUS returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -335,9 +335,9 @@ remove: BusListCount--; write_unlock(&BusListLock); - if (bus->pBusChannel) { - uislib_iounmap(bus->pBusChannel); - bus->pBusChannel = NULL; + if (bus->bus_channel) { + uislib_iounmap(bus->bus_channel); + bus->bus_channel = NULL; } kfree(bus); @@ -345,17 +345,17 @@ remove: } static int -create_device(CONTROLVM_MESSAGE *msg, char *buf) +create_device(struct controlvm_message *msg, char *buf) { struct device_info *dev; struct bus_info *bus; u32 busNo, devNo; int result = CONTROLVM_RESP_SUCCESS; u64 minSize = MIN_IO_CHANNEL_SIZE; - ReqHandlerInfo_t *pReqHandler; + struct req_handler_info *pReqHandler; - busNo = msg->cmd.createDevice.busNo; - devNo = msg->cmd.createDevice.devNo; + busNo = msg->cmd.create_device.bus_no; + devNo = msg->cmd.create_device.dev_no; POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); @@ -368,26 +368,26 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; } - dev->channel_uuid = msg->cmd.createDevice.dataTypeGuid; - dev->intr = msg->cmd.createDevice.intr; - dev->channel_addr = msg->cmd.createDevice.channelAddr; + dev->channel_uuid = msg->cmd.create_device.data_type_uuid; + dev->intr = msg->cmd.create_device.intr; + dev->channel_addr = msg->cmd.create_device.channel_addr; dev->bus_no = busNo; dev->dev_no = devNo; sema_init(&dev->interrupt_callback_lock, 1); /* unlocked */ sprintf(dev->devid, "vbus%u:dev%u", (unsigned) busNo, (unsigned) devNo); /* map the channel memory for the device. */ - if (msg->hdr.Flags.testMessage) + if (msg->hdr.flags.test_message) dev->chanptr = (void __iomem *)__va(dev->channel_addr); else { - pReqHandler = ReqHandlerFind(dev->channel_uuid); + pReqHandler = req_handler_find(dev->channel_uuid); if (pReqHandler) /* generic service handler registered for this * channel */ minSize = pReqHandler->min_channel_bytes; - if (minSize > msg->cmd.createDevice.channelBytes) { + if (minSize > msg->cmd.create_device.channel_bytes) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: channel size is too small, channel size:0x%lx, required size:0x%lx", - (ulong) msg->cmd.createDevice.channelBytes, + (ulong) msg->cmd.create_device.channel_bytes, (ulong) minSize); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); @@ -396,27 +396,27 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) } dev->chanptr = uislib_ioremap_cache(dev->channel_addr, - msg->cmd.createDevice.channelBytes); + msg->cmd.create_device.channel_bytes); if (!dev->chanptr) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", dev->channel_addr, - msg->cmd.createDevice.channelBytes); + msg->cmd.create_device.channel_bytes); result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); goto Away; } } - dev->instance_uuid = msg->cmd.createDevice.devInstGuid; - dev->channel_bytes = msg->cmd.createDevice.channelBytes; + dev->instance_uuid = msg->cmd.create_device.dev_inst_uuid; + dev->channel_bytes = msg->cmd.create_device.channel_bytes; read_lock(&BusListLock); for (bus = BusListHead; bus; bus = bus->next) { - if (bus->busNo == busNo) { + if (bus->bus_no == busNo) { /* make sure the device number is valid */ - if (devNo >= bus->deviceCount) { + if (devNo >= bus->device_count) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: device (%d) >= deviceCount (%d).", - devNo, bus->deviceCount); + devNo, bus->device_count); result = CONTROLVM_RESP_ERROR_MAX_DEVICES; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, @@ -439,17 +439,18 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) /* the msg is bound for virtpci; send * guest_msgs struct to callback */ - if (!msg->hdr.Flags.server) { + if (!msg->hdr.flags.server) { struct guest_msgs cmd; if (!uuid_le_cmp(dev->channel_uuid, - UltraVhbaChannelProtocolGuid)) { - wait_for_valid_guid(&((CHANNEL_HEADER - __iomem *) (dev-> + spar_vhba_channel_protocol_uuid)) { + wait_for_valid_guid(&(( + struct channel_header + __iomem *) (dev-> chanptr))-> - Type); - if (!ULTRA_VHBA_CHANNEL_OK_CLIENT - (dev->chanptr, NULL)) { + chtype); + if (!SPAR_VHBA_CHANNEL_OK_CLIENT + (dev->chanptr)) { LOGERR("CONTROLVM_DEVICE_CREATE Failed:[CLIENT]VHBA dev %d chan invalid.", devNo); POSTCODE_LINUX_4 @@ -468,13 +469,14 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) cmd.add_vhba.intr = dev->intr; } else if (!uuid_le_cmp(dev->channel_uuid, - UltraVnicChannelProtocolGuid)) { - wait_for_valid_guid(&((CHANNEL_HEADER - __iomem *) (dev-> + spar_vnic_channel_protocol_uuid)) { + wait_for_valid_guid(&(( + struct channel_header + __iomem *) (dev-> chanptr))-> - Type); - if (!ULTRA_VNIC_CHANNEL_OK_CLIENT - (dev->chanptr, NULL)) { + chtype); + if (!SPAR_VNIC_CHANNEL_OK_CLIENT + (dev->chanptr)) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: VNIC[CLIENT] dev %d chan invalid.", devNo); POSTCODE_LINUX_4 @@ -500,7 +502,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) goto Away; } - if (!VirtControlChanFunc) { + if (!virt_control_chan_func) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci callback not registered."); POSTCODE_LINUX_4 (DEVICE_CREATE_FAILURE_PC, devNo, @@ -509,7 +511,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) goto Away; } - if (!VirtControlChanFunc(&cmd)) { + if (!virt_control_chan_func(&cmd)) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci GUEST_ADD_[VHBA||VNIC] returned error."); POSTCODE_LINUX_4 (DEVICE_CREATE_FAILURE_PC, devNo, @@ -532,7 +534,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) result = CONTROLVM_RESP_ERROR_BUS_INVALID; Away: - if (!msg->hdr.Flags.testMessage) { + if (!msg->hdr.flags.test_message) { uislib_iounmap(dev->chanptr); dev->chanptr = NULL; } @@ -542,7 +544,7 @@ Away: } static int -pause_device(CONTROLVM_MESSAGE *msg) +pause_device(struct controlvm_message *msg) { u32 busNo, devNo; struct bus_info *bus; @@ -550,16 +552,16 @@ pause_device(CONTROLVM_MESSAGE *msg) struct guest_msgs cmd; int retval = CONTROLVM_RESP_SUCCESS; - busNo = msg->cmd.deviceChangeState.busNo; - devNo = msg->cmd.deviceChangeState.devNo; + busNo = msg->cmd.device_change_state.bus_no; + devNo = msg->cmd.device_change_state.dev_no; read_lock(&BusListLock); for (bus = BusListHead; bus; bus = bus->next) { - if (bus->busNo == busNo) { + if (bus->bus_no == busNo) { /* make sure the device number is valid */ - if (devNo >= bus->deviceCount) { + if (devNo >= bus->device_count) { LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).", - devNo, bus->deviceCount); + devNo, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ @@ -585,22 +587,22 @@ pause_device(CONTROLVM_MESSAGE *msg) * guest_msgs struct to callback */ if (!uuid_le_cmp(dev->channel_uuid, - UltraVhbaChannelProtocolGuid)) { + spar_vhba_channel_protocol_uuid)) { cmd.msgtype = GUEST_PAUSE_VHBA; cmd.pause_vhba.chanptr = dev->chanptr; } else if (!uuid_le_cmp(dev->channel_uuid, - UltraVnicChannelProtocolGuid)) { + spar_vnic_channel_protocol_uuid)) { cmd.msgtype = GUEST_PAUSE_VNIC; cmd.pause_vnic.chanptr = dev->chanptr; } else { LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!VirtControlChanFunc) { + if (!virt_control_chan_func) { LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } - if (!VirtControlChanFunc(&cmd)) { + if (!virt_control_chan_func(&cmd)) { LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: virtpci GUEST_PAUSE_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; @@ -610,7 +612,7 @@ pause_device(CONTROLVM_MESSAGE *msg) } static int -resume_device(CONTROLVM_MESSAGE *msg) +resume_device(struct controlvm_message *msg) { u32 busNo, devNo; struct bus_info *bus; @@ -618,16 +620,16 @@ resume_device(CONTROLVM_MESSAGE *msg) struct guest_msgs cmd; int retval = CONTROLVM_RESP_SUCCESS; - busNo = msg->cmd.deviceChangeState.busNo; - devNo = msg->cmd.deviceChangeState.devNo; + busNo = msg->cmd.device_change_state.bus_no; + devNo = msg->cmd.device_change_state.dev_no; read_lock(&BusListLock); for (bus = BusListHead; bus; bus = bus->next) { - if (bus->busNo == busNo) { + if (bus->bus_no == busNo) { /* make sure the device number is valid */ - if (devNo >= bus->deviceCount) { + if (devNo >= bus->device_count) { LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device(%d) >= deviceCount(%d).", - devNo, bus->deviceCount); + devNo, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ @@ -654,22 +656,22 @@ resume_device(CONTROLVM_MESSAGE *msg) */ if (retval == CONTROLVM_RESP_SUCCESS) { if (!uuid_le_cmp(dev->channel_uuid, - UltraVhbaChannelProtocolGuid)) { + spar_vhba_channel_protocol_uuid)) { cmd.msgtype = GUEST_RESUME_VHBA; cmd.resume_vhba.chanptr = dev->chanptr; } else if (!uuid_le_cmp(dev->channel_uuid, - UltraVnicChannelProtocolGuid)) { + spar_vnic_channel_protocol_uuid)) { cmd.msgtype = GUEST_RESUME_VNIC; cmd.resume_vnic.chanptr = dev->chanptr; } else { LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!VirtControlChanFunc) { + if (!virt_control_chan_func) { LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } - if (!VirtControlChanFunc(&cmd)) { + if (!virt_control_chan_func(&cmd)) { LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: virtpci GUEST_RESUME_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; @@ -679,7 +681,7 @@ resume_device(CONTROLVM_MESSAGE *msg) } static int -destroy_device(CONTROLVM_MESSAGE *msg, char *buf) +destroy_device(struct controlvm_message *msg, char *buf) { u32 busNo, devNo; struct bus_info *bus; @@ -687,17 +689,17 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf) struct guest_msgs cmd; int retval = CONTROLVM_RESP_SUCCESS; - busNo = msg->cmd.destroyDevice.busNo; - devNo = msg->cmd.destroyDevice.devNo; + busNo = msg->cmd.destroy_device.bus_no; + devNo = msg->cmd.destroy_device.bus_no; read_lock(&BusListLock); LOGINF("destroy_device called for busNo=%u, devNo=%u", busNo, devNo); for (bus = BusListHead; bus; bus = bus->next) { - if (bus->busNo == busNo) { + if (bus->bus_no == busNo) { /* make sure the device number is valid */ - if (devNo >= bus->deviceCount) { + if (devNo >= bus->device_count) { LOGERR("CONTROLVM_DEVICE_DESTORY Failed: device(%d) >= deviceCount(%d).", - devNo, bus->deviceCount); + devNo, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ @@ -724,11 +726,11 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf) * guest_msgs struct to callback */ if (!uuid_le_cmp(dev->channel_uuid, - UltraVhbaChannelProtocolGuid)) { + spar_vhba_channel_protocol_uuid)) { cmd.msgtype = GUEST_DEL_VHBA; cmd.del_vhba.chanptr = dev->chanptr; } else if (!uuid_le_cmp(dev->channel_uuid, - UltraVnicChannelProtocolGuid)) { + spar_vnic_channel_protocol_uuid)) { cmd.msgtype = GUEST_DEL_VNIC; cmd.del_vnic.chanptr = dev->chanptr; } else { @@ -736,12 +738,12 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf) return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!VirtControlChanFunc) { + if (!virt_control_chan_func) { LOGERR("CONTROLVM_DEVICE_DESTORY Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } - if (!VirtControlChanFunc(&cmd)) { + if (!virt_control_chan_func(&cmd)) { LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci GUEST_DEL_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; @@ -756,7 +758,7 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf) uislib_disable_channel_interrupts(busNo, devNo); } /* unmap the channel memory for the device. */ - if (!msg->hdr.Flags.testMessage) { + if (!msg->hdr.flags.test_message) { LOGINF("destroy_device, doing iounmap"); uislib_iounmap(dev->chanptr); } @@ -767,23 +769,23 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf) } static int -init_chipset(CONTROLVM_MESSAGE *msg, char *buf) +init_chipset(struct controlvm_message *msg, char *buf) { POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO); - MaxBusCount = msg->cmd.initChipset.busCount; - PlatformNumber = msg->cmd.initChipset.platformNumber; + MaxBusCount = msg->cmd.init_chipset.bus_count; + PlatformNumber = msg->cmd.init_chipset.platform_number; PhysicalDataChan = 0; /* We need to make sure we have our functions registered * before processing messages. If we are a test vehicle the - * testMessage for init_chipset will be set. We can ignore the + * test_message for init_chipset will be set. We can ignore the * waits for the callbacks, since this will be manually entered - * from a user. If no testMessage is set, we will wait for the + * from a user. If no test_message is set, we will wait for the * functions. */ - if (!msg->hdr.Flags.testMessage) - WAIT_ON_CALLBACK(VirtControlChanFunc); + if (!msg->hdr.flags.test_message) + WAIT_ON_CALLBACK(virt_control_chan_func); chipset_inited = 1; POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO); @@ -794,10 +796,10 @@ init_chipset(CONTROLVM_MESSAGE *msg, char *buf) static int delete_bus_glue(u32 busNo) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); - msg.cmd.destroyBus.busNo = busNo; + msg.cmd.destroy_bus.bus_no = busNo; if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("destroy_bus failed. busNo=0x%x\n", busNo); return 0; @@ -808,11 +810,11 @@ delete_bus_glue(u32 busNo) static int delete_device_glue(u32 busNo, u32 devNo) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0); - msg.cmd.destroyDevice.busNo = busNo; - msg.cmd.destroyDevice.devNo = devNo; + msg.cmd.destroy_device.bus_no = busNo; + msg.cmd.destroy_device.dev_no = devNo; if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("destroy_device failed. busNo=0x%x devNo=0x%x\n", busNo, devNo); @@ -822,14 +824,14 @@ delete_device_glue(u32 busNo, u32 devNo) } int -uislib_client_inject_add_bus(u32 busNo, uuid_le instGuid, - u64 channelAddr, ulong nChannelBytes) +uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, + u64 channel_addr, ulong n_channel_bytes) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; - LOGINF("enter busNo=0x%x\n", busNo); + LOGINF("enter busNo=0x%x\n", bus_no); /* step 0: init the chipset */ - POSTCODE_LINUX_3(CHIPSET_INIT_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); + POSTCODE_LINUX_3(CHIPSET_INIT_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO); if (!chipset_inited) { /* step: initialize the chipset */ @@ -841,31 +843,32 @@ uislib_client_inject_add_bus(u32 busNo, uuid_le instGuid, * after number 4, then the add_vnic will fail, and the * ultraboot will fail. */ - msg.cmd.initChipset.busCount = 23; - msg.cmd.initChipset.switchCount = 0; + msg.cmd.init_chipset.bus_count = 23; + msg.cmd.init_chipset.switch_count = 0; if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("init_chipset failed.\n"); return 0; } LOGINF("chipset initialized\n"); - POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, busNo, + POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO); } /* step 1: create a bus */ - POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, busNo, POSTCODE_SEVERITY_WARNING); + POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no, + POSTCODE_SEVERITY_WARNING); init_msg_header(&msg, CONTROLVM_BUS_CREATE, 0, 0); - msg.cmd.createBus.busNo = busNo; - msg.cmd.createBus.deviceCount = 23; /* devNo+1; */ - msg.cmd.createBus.channelAddr = channelAddr; - msg.cmd.createBus.channelBytes = nChannelBytes; + msg.cmd.create_bus.bus_no = bus_no; + msg.cmd.create_bus.dev_count = 23; /* devNo+1; */ + msg.cmd.create_bus.channel_addr = channel_addr; + msg.cmd.create_bus.channel_bytes = n_channel_bytes; if (create_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("create_bus failed.\n"); - POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, + POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); return 0; } - POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); + POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO); return 1; } @@ -873,26 +876,26 @@ EXPORT_SYMBOL_GPL(uislib_client_inject_add_bus); int -uislib_client_inject_del_bus(u32 busNo) +uislib_client_inject_del_bus(u32 bus_no) { - return delete_bus_glue(busNo); + return delete_bus_glue(bus_no); } EXPORT_SYMBOL_GPL(uislib_client_inject_del_bus); int -uislib_client_inject_pause_vhba(u32 busNo, u32 devNo) +uislib_client_inject_pause_vhba(u32 bus_no, u32 dev_no) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; int rc; init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0); - msg.cmd.deviceChangeState.busNo = busNo; - msg.cmd.deviceChangeState.devNo = devNo; - msg.cmd.deviceChangeState.state = SegmentStateStandby; + msg.cmd.device_change_state.bus_no = bus_no; + msg.cmd.device_change_state.dev_no = dev_no; + msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); if (rc != CONTROLVM_RESP_SUCCESS) { LOGERR("VHBA pause_device failed. busNo=0x%x devNo=0x%x\n", - busNo, devNo); + bus_no, dev_no); return rc; } return 0; @@ -900,19 +903,19 @@ uislib_client_inject_pause_vhba(u32 busNo, u32 devNo) EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vhba); int -uislib_client_inject_resume_vhba(u32 busNo, u32 devNo) +uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; int rc; init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0); - msg.cmd.deviceChangeState.busNo = busNo; - msg.cmd.deviceChangeState.devNo = devNo; - msg.cmd.deviceChangeState.state = SegmentStateRunning; + msg.cmd.device_change_state.bus_no = bus_no; + msg.cmd.device_change_state.dev_no = dev_no; + msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); if (rc != CONTROLVM_RESP_SUCCESS) { LOGERR("VHBA resume_device failed. busNo=0x%x devNo=0x%x\n", - busNo, devNo); + bus_no, dev_no); return rc; } return 0; @@ -921,19 +924,19 @@ uislib_client_inject_resume_vhba(u32 busNo, u32 devNo) EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba); int -uislib_client_inject_add_vhba(u32 busNo, u32 devNo, +uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, u64 phys_chan_addr, u32 chan_bytes, - int is_test_addr, uuid_le instGuid, - struct InterruptInfo *intr) + int is_test_addr, uuid_le inst_uuid, + struct irq_info *intr) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", busNo, devNo); + LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VHBA device on the * bus */ - POSTCODE_LINUX_4(VHBA_CREATE_ENTRY_PC, devNo, busNo, + POSTCODE_LINUX_4(VHBA_CREATE_ENTRY_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0); @@ -941,16 +944,16 @@ uislib_client_inject_add_vhba(u32 busNo, u32 devNo, /* signify that the physical channel address does NOT * need to be ioremap()ed */ - msg.hdr.Flags.testMessage = 1; - msg.cmd.createDevice.busNo = busNo; - msg.cmd.createDevice.devNo = devNo; - msg.cmd.createDevice.devInstGuid = instGuid; + msg.hdr.flags.test_message = 1; + msg.cmd.create_device.bus_no = bus_no; + msg.cmd.create_device.dev_no = dev_no; + msg.cmd.create_device.dev_inst_uuid = inst_uuid; if (intr) - msg.cmd.createDevice.intr = *intr; + msg.cmd.create_device.intr = *intr; else - memset(&msg.cmd.createDevice.intr, 0, - sizeof(struct InterruptInfo)); - msg.cmd.createDevice.channelAddr = phys_chan_addr; + memset(&msg.cmd.create_device.intr, 0, + sizeof(struct irq_info)); + msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE); @@ -958,41 +961,41 @@ uislib_client_inject_add_vhba(u32 busNo, u32 devNo, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; } - msg.cmd.createDevice.channelBytes = chan_bytes; - msg.cmd.createDevice.dataTypeGuid = UltraVhbaChannelProtocolGuid; + msg.cmd.create_device.channel_bytes = chan_bytes; + msg.cmd.create_device.data_type_uuid = spar_vhba_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("VHBA create_device failed.\n"); - POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, devNo, busNo, + POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return 0; } - POSTCODE_LINUX_4(VHBA_CREATE_SUCCESS_PC, devNo, busNo, + POSTCODE_LINUX_4(VHBA_CREATE_SUCCESS_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); return 1; } EXPORT_SYMBOL_GPL(uislib_client_inject_add_vhba); int -uislib_client_inject_del_vhba(u32 busNo, u32 devNo) +uislib_client_inject_del_vhba(u32 bus_no, u32 dev_no) { - return delete_device_glue(busNo, devNo); + return delete_device_glue(bus_no, dev_no); } EXPORT_SYMBOL_GPL(uislib_client_inject_del_vhba); int -uislib_client_inject_add_vnic(u32 busNo, u32 devNo, +uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, u64 phys_chan_addr, u32 chan_bytes, - int is_test_addr, uuid_le instGuid, - struct InterruptInfo *intr) + int is_test_addr, uuid_le inst_uuid, + struct irq_info *intr) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", busNo, devNo); + LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VNIC device on the * bus */ - POSTCODE_LINUX_4(VNIC_CREATE_ENTRY_PC, devNo, busNo, + POSTCODE_LINUX_4(VNIC_CREATE_ENTRY_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0); @@ -1000,16 +1003,16 @@ uislib_client_inject_add_vnic(u32 busNo, u32 devNo, /* signify that the physical channel address does NOT * need to be ioremap()ed */ - msg.hdr.Flags.testMessage = 1; - msg.cmd.createDevice.busNo = busNo; - msg.cmd.createDevice.devNo = devNo; - msg.cmd.createDevice.devInstGuid = instGuid; + msg.hdr.flags.test_message = 1; + msg.cmd.create_device.bus_no = bus_no; + msg.cmd.create_device.dev_no = dev_no; + msg.cmd.create_device.dev_inst_uuid = inst_uuid; if (intr) - msg.cmd.createDevice.intr = *intr; + msg.cmd.create_device.intr = *intr; else - memset(&msg.cmd.createDevice.intr, 0, - sizeof(struct InterruptInfo)); - msg.cmd.createDevice.channelAddr = phys_chan_addr; + memset(&msg.cmd.create_device.intr, 0, + sizeof(struct irq_info)); + msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE); @@ -1017,35 +1020,35 @@ uislib_client_inject_add_vnic(u32 busNo, u32 devNo, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; } - msg.cmd.createDevice.channelBytes = chan_bytes; - msg.cmd.createDevice.dataTypeGuid = UltraVnicChannelProtocolGuid; + msg.cmd.create_device.channel_bytes = chan_bytes; + msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("VNIC create_device failed.\n"); - POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, devNo, busNo, + POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return 0; } - POSTCODE_LINUX_4(VNIC_CREATE_SUCCESS_PC, devNo, busNo, + POSTCODE_LINUX_4(VNIC_CREATE_SUCCESS_PC, dev_no, bus_no, POSTCODE_SEVERITY_INFO); return 1; } EXPORT_SYMBOL_GPL(uislib_client_inject_add_vnic); int -uislib_client_inject_pause_vnic(u32 busNo, u32 devNo) +uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; int rc; init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0); - msg.cmd.deviceChangeState.busNo = busNo; - msg.cmd.deviceChangeState.devNo = devNo; - msg.cmd.deviceChangeState.state = SegmentStateStandby; + msg.cmd.device_change_state.bus_no = bus_no; + msg.cmd.device_change_state.dev_no = dev_no; + msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); if (rc != CONTROLVM_RESP_SUCCESS) { LOGERR("VNIC pause_device failed. busNo=0x%x devNo=0x%x\n", - busNo, devNo); + bus_no, dev_no); return -1; } return 0; @@ -1053,19 +1056,19 @@ uislib_client_inject_pause_vnic(u32 busNo, u32 devNo) EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vnic); int -uislib_client_inject_resume_vnic(u32 busNo, u32 devNo) +uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no) { - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; int rc; init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0); - msg.cmd.deviceChangeState.busNo = busNo; - msg.cmd.deviceChangeState.devNo = devNo; - msg.cmd.deviceChangeState.state = SegmentStateRunning; + msg.cmd.device_change_state.bus_no = bus_no; + msg.cmd.device_change_state.dev_no = dev_no; + msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); if (rc != CONTROLVM_RESP_SUCCESS) { LOGERR("VNIC resume_device failed. busNo=0x%x devNo=0x%x\n", - busNo, devNo); + bus_no, dev_no); return -1; } return 0; @@ -1074,88 +1077,12 @@ uislib_client_inject_resume_vnic(u32 busNo, u32 devNo) EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vnic); int -uislib_client_inject_del_vnic(u32 busNo, u32 devNo) +uislib_client_inject_del_vnic(u32 bus_no, u32 dev_no) { - return delete_device_glue(busNo, devNo); + return delete_device_glue(bus_no, dev_no); } EXPORT_SYMBOL_GPL(uislib_client_inject_del_vnic); -static int -uislib_client_add_vnic(u32 busNo) -{ - BOOL busCreated = FALSE; - int devNo = 0; /* Default to 0, since only one device - * will be created for this bus... */ - CONTROLVM_MESSAGE msg; - - init_msg_header(&msg, CONTROLVM_BUS_CREATE, 0, 0); - msg.hdr.Flags.testMessage = 1; - msg.cmd.createBus.busNo = busNo; - msg.cmd.createBus.deviceCount = 4; - msg.cmd.createBus.channelAddr = 0; - msg.cmd.createBus.channelBytes = 0; - if (create_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("client create_bus failed"); - return 0; - } - busCreated = TRUE; - - init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0); - msg.hdr.Flags.testMessage = 1; - msg.cmd.createDevice.busNo = busNo; - msg.cmd.createDevice.devNo = devNo; - msg.cmd.createDevice.devInstGuid = NULL_UUID_LE; - memset(&msg.cmd.createDevice.intr, 0, sizeof(struct InterruptInfo)); - msg.cmd.createDevice.channelAddr = PhysicalDataChan; - msg.cmd.createDevice.channelBytes = MIN_IO_CHANNEL_SIZE; - msg.cmd.createDevice.dataTypeGuid = UltraVnicChannelProtocolGuid; - if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("client create_device failed"); - goto AwayCleanup; - } - - return 1; - -AwayCleanup: - if (busCreated) { - init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); - msg.hdr.Flags.testMessage = 1; - msg.cmd.destroyBus.busNo = busNo; - if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) - LOGERR("client destroy_bus failed.\n"); - } - - return 0; -} /* end uislib_client_add_vnic */ -EXPORT_SYMBOL_GPL(uislib_client_add_vnic); - -static int -uislib_client_delete_vnic(u32 busNo) -{ - int devNo = 0; /* Default to 0, since only one device - * will be created for this bus... */ - CONTROLVM_MESSAGE msg; - - init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0); - msg.hdr.Flags.testMessage = 1; - msg.cmd.destroyDevice.busNo = busNo; - msg.cmd.destroyDevice.devNo = devNo; - if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - /* Don't error exit - try to see if bus can be destroyed... */ - LOGERR("client destroy_device failed.\n"); - } - - init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); - msg.hdr.Flags.testMessage = 1; - msg.cmd.destroyBus.busNo = busNo; - if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) - LOGERR("client destroy_bus failed.\n"); - - return 1; -} -EXPORT_SYMBOL_GPL(uislib_client_delete_vnic); -/* end client_delete_vnic */ - void * uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln) { @@ -1206,17 +1133,17 @@ info_debugfs_read_helper(char **buff, int *buff_len) for (bus = BusListHead; bus; bus = bus->next) { if (PLINE(" bus=0x%p, busNo=%d, deviceCount=%d\n", - bus, bus->busNo, bus->deviceCount) < 0) + bus, bus->bus_no, bus->device_count) < 0) goto err_done_unlock; if (PLINE(" Devices:\n") < 0) goto err_done_unlock; - for (i = 0; i < bus->deviceCount; i++) { + for (i = 0; i < bus->device_count; i++) { if (bus->device[i]) { if (PLINE(" busNo %d, device[%i]: 0x%p, chanptr=0x%p, swtch=0x%p\n", - bus->busNo, i, bus->device[i], + bus->bus_no, i, bus->device[i], bus->device[i]->chanptr, bus->device[i]->swtch) < 0) goto err_done_unlock; @@ -1232,7 +1159,7 @@ info_debugfs_read_helper(char **buff, int *buff_len) read_unlock(&BusListLock); if (PLINE("UisUtils_Registered_Services: %d\n", - atomic_read(&UisUtils_Registered_Services)) < 0) + atomic_read(&uisutils_registered_services)) < 0) goto err_done; if (PLINE("cycles_before_wait %llu wait_cycles:%llu\n", cycles_before_wait, wait_cycles) < 0) @@ -1294,9 +1221,9 @@ find_dev(u32 busNo, u32 devNo) read_lock(&BusListLock); for (bus = BusListHead; bus; bus = bus->next) { - if (bus->busNo == busNo) { + if (bus->bus_no == busNo) { /* make sure the device number is valid */ - if (devNo >= bus->deviceCount) { + if (devNo >= bus->device_count) { LOGERR("%s bad busNo, devNo=%d,%d", __func__, (int) (busNo), (int) (devNo)); @@ -1560,13 +1487,13 @@ uislib_mod_init(void) LOGINF("sizeof(uiscmdrsp_net):%lu\n", (ulong) sizeof(struct uiscmdrsp_net)); LOGINF("sizeof(CONTROLVM_MESSAGE):%lu bytes\n", - (ulong) sizeof(CONTROLVM_MESSAGE)); - LOGINF("sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL):%lu bytes\n", - (ulong) sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL)); + (ulong) sizeof(struct controlvm_message)); + LOGINF("sizeof(struct spar_controlvm_channel_protocol):%lu bytes\n", + (ulong) sizeof(struct spar_controlvm_channel_protocol)); LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n", - (ulong) sizeof(CHANNEL_HEADER)); - LOGINF("sizeof(ULTRA_IO_CHANNEL_PROTOCOL):%lu bytes\n", - (ulong) sizeof(ULTRA_IO_CHANNEL_PROTOCOL)); + (ulong) sizeof(struct channel_header)); + LOGINF("sizeof(struct spar_io_channel_protocol):%lu bytes\n", + (ulong) sizeof(struct spar_io_channel_protocol)); LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP); LOGINF("SIZEOF_PROTOCOL:%lu bytes\n", SIZEOF_PROTOCOL); @@ -1574,7 +1501,7 @@ uislib_mod_init(void) BusListHead = NULL; BusListCount = MaxBusCount = 0; rwlock_init(&BusListLock); - VirtControlChanFunc = NULL; + virt_control_chan_func = NULL; /* Issue VMCALL_GET_CONTROLVM_ADDR to get CtrlChanPhysAddr and * then map this physical address to a virtual address. */ diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c index 44208841bd5a..f9f8442d58c5 100644 --- a/drivers/staging/unisys/uislib/uisqueue.c +++ b/drivers/staging/unisys/uislib/uisqueue.c @@ -81,13 +81,13 @@ do_locked_client_insert(struct uisqueue_info *queueinfo, u8 rc = 0; spin_lock_irqsave(lock, flags); - if (!ULTRA_CHANNEL_CLIENT_ACQUIRE_OS(queueinfo->chan, channelId, NULL)) + if (!spar_channel_client_acquire_os(queueinfo->chan, channelId)) goto unlock; - if (visor_signal_insert(queueinfo->chan, whichqueue, pSignal)) { + if (spar_signal_insert(queueinfo->chan, whichqueue, pSignal)) { queueinfo->packets_sent++; rc = 1; } - ULTRA_CHANNEL_CLIENT_RELEASE_OS(queueinfo->chan, channelId, NULL); + spar_channel_client_release_os(queueinfo->chan, channelId); unlock: spin_unlock_irqrestore((spinlock_t *)lock, flags); return rc; @@ -125,7 +125,7 @@ int uisqueue_get_cmdrsp(struct uisqueue_info *queueinfo, void *cmdrsp, unsigned int whichqueue) { - if (!visor_signal_remove(queueinfo->chan, whichqueue, cmdrsp)) + if (!spar_signal_remove(queueinfo->chan, whichqueue, cmdrsp)) return 0; queueinfo->packets_received++; diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 8ff6d26ff00b..4a5b86773927 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -25,9 +25,7 @@ #include "uisutils.h" #include "version.h" #include "vbushelper.h" -#include <linux/uuid.h> #include <linux/skbuff.h> -#include <linux/uuid.h> #ifdef CONFIG_HIGHMEM #include <linux/highmem.h> #endif @@ -39,7 +37,7 @@ #define __MYFILE__ "uisutils.c" /* exports */ -atomic_t UisUtils_Registered_Services = ATOMIC_INIT(0); +atomic_t uisutils_registered_services = ATOMIC_INIT(0); /* num registrations via * uisctrl_register_req_handler() or * uisctrl_register_req_handler_ex() */ @@ -75,20 +73,20 @@ EXPORT_SYMBOL_GPL(uisutil_add_proc_line_ex); int uisctrl_register_req_handler(int type, void *fptr, - ULTRA_VBUS_DEVICEINFO *chipset_driver_info) + struct ultra_vbus_deviceinfo *chipset_driver_info) { LOGINF("type = %d, fptr = 0x%p.\n", type, fptr); switch (type) { case 2: if (fptr) { - if (!VirtControlChanFunc) - atomic_inc(&UisUtils_Registered_Services); - VirtControlChanFunc = fptr; + if (!virt_control_chan_func) + atomic_inc(&uisutils_registered_services); + virt_control_chan_func = fptr; } else { - if (VirtControlChanFunc) - atomic_dec(&UisUtils_Registered_Services); - VirtControlChanFunc = NULL; + if (virt_control_chan_func) + atomic_dec(&uisutils_registered_services); + virt_control_chan_func = NULL; } break; @@ -105,76 +103,75 @@ uisctrl_register_req_handler(int type, void *fptr, EXPORT_SYMBOL_GPL(uisctrl_register_req_handler); int -uisctrl_register_req_handler_ex(uuid_le switchTypeGuid, - const char *switch_type_name, - int (*controlfunc)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*Server_Channel_Ok)(unsigned long - channelBytes), - int (*Server_Channel_Init) - (void *x, unsigned char *clientStr, - u32 clientStrLen, u64 bytes), - ULTRA_VBUS_DEVICEINFO *chipset_DriverInfo) +uisctrl_register_req_handler_ex(uuid_le switch_uuid, + const char *switch_type_name, + int (*controlfunc)(struct io_msgs *), + unsigned long min_channel_bytes, + int (*server_channel_ok)(unsigned long channel_bytes), + int (*server_channel_init)(void *x, + unsigned char *client_str, + u32 client_str_len, u64 bytes), + struct ultra_vbus_deviceinfo *chipset_driver_info) { - ReqHandlerInfo_t *pReqHandlerInfo; + struct req_handler_info *pReqHandlerInfo; int rc = 0; /* assume failure */ LOGINF("type=%pUL, controlfunc=0x%p.\n", - &switchTypeGuid, controlfunc); + &switch_uuid, controlfunc); if (!controlfunc) { - LOGERR("%pUL: controlfunc must be supplied\n", &switchTypeGuid); + LOGERR("%pUL: controlfunc must be supplied\n", &switch_uuid); goto Away; } - if (!Server_Channel_Ok) { + if (!server_channel_ok) { LOGERR("%pUL: Server_Channel_Ok must be supplied\n", - &switchTypeGuid); + &switch_uuid); goto Away; } - if (!Server_Channel_Init) { + if (!server_channel_init) { LOGERR("%pUL: Server_Channel_Init must be supplied\n", - &switchTypeGuid); + &switch_uuid); goto Away; } - pReqHandlerInfo = ReqHandlerAdd(switchTypeGuid, + pReqHandlerInfo = req_handler_add(switch_uuid, switch_type_name, controlfunc, min_channel_bytes, - Server_Channel_Ok, Server_Channel_Init); + server_channel_ok, server_channel_init); if (!pReqHandlerInfo) { - LOGERR("failed to add %pUL to server list\n", &switchTypeGuid); + LOGERR("failed to add %pUL to server list\n", &switch_uuid); goto Away; } - atomic_inc(&UisUtils_Registered_Services); + atomic_inc(&uisutils_registered_services); rc = 1; /* success */ Away: if (rc) { - if (chipset_DriverInfo) - bus_device_info_init(chipset_DriverInfo, "chipset", + if (chipset_driver_info) + bus_device_info_init(chipset_driver_info, "chipset", "uislib", VERSION, NULL); } else - LOGERR("failed to register type %pUL.\n", &switchTypeGuid); + LOGERR("failed to register type %pUL.\n", &switch_uuid); return rc; } EXPORT_SYMBOL_GPL(uisctrl_register_req_handler_ex); int -uisctrl_unregister_req_handler_ex(uuid_le switchTypeGuid) +uisctrl_unregister_req_handler_ex(uuid_le switch_uuid) { int rc = 0; /* assume failure */ - LOGINF("type=%pUL.\n", &switchTypeGuid); - if (ReqHandlerDel(switchTypeGuid) < 0) { + LOGINF("type=%pUL.\n", &switch_uuid); + if (req_handler_del(switch_uuid) < 0) { LOGERR("failed to remove %pUL from server list\n", - &switchTypeGuid); + &switch_uuid); goto Away; } - atomic_dec(&UisUtils_Registered_Services); + atomic_dec(&uisutils_registered_services); rc = 1; /* success */ Away: if (!rc) - LOGERR("failed to unregister type %pUL.\n", &switchTypeGuid); + LOGERR("failed to unregister type %pUL.\n", &switch_uuid); return rc; } EXPORT_SYMBOL_GPL(uisctrl_unregister_req_handler_ex); @@ -275,11 +272,11 @@ dolist: if (skb_shinfo(skb)->frag_list) { } EXPORT_SYMBOL_GPL(uisutil_copy_fragsinfo_from_skb); -static LIST_HEAD(ReqHandlerInfo_list); /* list of ReqHandlerInfo_t */ +static LIST_HEAD(ReqHandlerInfo_list); /* list of struct req_handler_info */ static DEFINE_SPINLOCK(ReqHandlerInfo_list_lock); -ReqHandlerInfo_t * -ReqHandlerAdd(uuid_le switchTypeGuid, +struct req_handler_info * +req_handler_add(uuid_le switch_uuid, const char *switch_type_name, int (*controlfunc)(struct io_msgs *), unsigned long min_channel_bytes, @@ -287,16 +284,16 @@ ReqHandlerAdd(uuid_le switchTypeGuid, int (*Server_Channel_Init) (void *x, unsigned char *clientStr, u32 clientStrLen, u64 bytes)) { - ReqHandlerInfo_t *rc = NULL; + struct req_handler_info *rc = NULL; rc = kzalloc(sizeof(*rc), GFP_ATOMIC); if (!rc) return NULL; - rc->switchTypeGuid = switchTypeGuid; + rc->switch_uuid = switch_uuid; rc->controlfunc = controlfunc; rc->min_channel_bytes = min_channel_bytes; - rc->Server_Channel_Ok = Server_Channel_Ok; - rc->Server_Channel_Init = Server_Channel_Init; + rc->server_channel_ok = Server_Channel_Ok; + rc->server_channel_init = Server_Channel_Init; if (switch_type_name) strncpy(rc->switch_type_name, switch_type_name, sizeof(rc->switch_type_name) - 1); @@ -307,16 +304,16 @@ ReqHandlerAdd(uuid_le switchTypeGuid, return rc; } -ReqHandlerInfo_t * -ReqHandlerFind(uuid_le switchTypeGuid) +struct req_handler_info * +req_handler_find(uuid_le switch_uuid) { struct list_head *lelt, *tmp; - ReqHandlerInfo_t *entry = NULL; + struct req_handler_info *entry = NULL; spin_lock(&ReqHandlerInfo_list_lock); list_for_each_safe(lelt, tmp, &ReqHandlerInfo_list) { - entry = list_entry(lelt, ReqHandlerInfo_t, list_link); - if (uuid_le_cmp(entry->switchTypeGuid, switchTypeGuid) == 0) { + entry = list_entry(lelt, struct req_handler_info, list_link); + if (uuid_le_cmp(entry->switch_uuid, switch_uuid) == 0) { spin_unlock(&ReqHandlerInfo_list_lock); return entry; } @@ -326,16 +323,16 @@ ReqHandlerFind(uuid_le switchTypeGuid) } int -ReqHandlerDel(uuid_le switchTypeGuid) +req_handler_del(uuid_le switch_uuid) { struct list_head *lelt, *tmp; - ReqHandlerInfo_t *entry = NULL; + struct req_handler_info *entry = NULL; int rc = -1; spin_lock(&ReqHandlerInfo_list_lock); list_for_each_safe(lelt, tmp, &ReqHandlerInfo_list) { - entry = list_entry(lelt, ReqHandlerInfo_t, list_link); - if (uuid_le_cmp(entry->switchTypeGuid, switchTypeGuid) == 0) { + entry = list_entry(lelt, struct req_handler_info, list_link); + if (uuid_le_cmp(entry->switch_uuid, switch_uuid) == 0) { list_del(lelt); kfree(entry); rc++; diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index 938e2c82c1ab..d7a629b5f111 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -101,7 +101,6 @@ static DEF_SCSI_QCMD(virthba_queue_command) #define virthba_queue_command virthba_queue_command_lck #endif - static int virthba_slave_alloc(struct scsi_device *scsidev); static int virthba_slave_configure(struct scsi_device *scsidev); static void virthba_slave_destroy(struct scsi_device *scsidev); @@ -172,7 +171,7 @@ struct virthba_info { struct virtpci_dev *virtpcidev; struct list_head dev_info_list; struct chaninfo chinfo; - struct InterruptInfo intr; /* use recvInterrupt info to receive + struct irq_info intr; /* use recvInterrupt info to receive interrupts when IOs complete */ int interrupt_vector; struct scsipending pending[MAX_PENDING_REQUESTS]; /* Tracks the requests @@ -420,8 +419,8 @@ static irqreturn_t virthba_ISR(int irq, void *dev_id) { struct virthba_info *virthbainfo = (struct virthba_info *) dev_id; - CHANNEL_HEADER __iomem *pChannelHeader; - SIGNAL_QUEUE_HEADER __iomem *pqhdr; + struct channel_header __iomem *pChannelHeader; + struct signal_queue_header __iomem *pqhdr; u64 mask; unsigned long long rc1; @@ -429,24 +428,24 @@ virthba_ISR(int irq, void *dev_id) return IRQ_NONE; virthbainfo->interrupts_rcvd++; pChannelHeader = virthbainfo->chinfo.queueinfo->chan; - if (((readq(&pChannelHeader->Features) + if (((readq(&pChannelHeader->features) & ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0) - && ((readq(&pChannelHeader->Features) & + && ((readq(&pChannelHeader->features) & ULTRA_IO_DRIVER_DISABLES_INTS) != 0)) { virthbainfo->interrupts_disabled++; mask = ~ULTRA_CHANNEL_ENABLE_INTS; rc1 = uisqueue_interlocked_and(virthbainfo->flags_addr, mask); } - if (visor_signalqueue_empty(pChannelHeader, IOCHAN_FROM_IOPART)) { + if (spar_signalqueue_empty(pChannelHeader, IOCHAN_FROM_IOPART)) { virthbainfo->interrupts_notme++; return IRQ_NONE; } - pqhdr = (SIGNAL_QUEUE_HEADER __iomem *) + pqhdr = (struct signal_queue_header __iomem *) ((char __iomem *) pChannelHeader + - readq(&pChannelHeader->oChannelSpace)) + IOCHAN_FROM_IOPART; - writeq(readq(&pqhdr->NumInterruptsReceived) + 1, - &pqhdr->NumInterruptsReceived); + readq(&pChannelHeader->ch_space_offset)) + IOCHAN_FROM_IOPART; + writeq(readq(&pqhdr->num_irq_received) + 1, + &pqhdr->num_irq_received); atomic_set(&virthbainfo->interrupt_rcvd, 1); wake_up_interruptible(&virthbainfo->rsp_queue); return IRQ_HANDLED; @@ -461,17 +460,17 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) int rsp; int i; irq_handler_t handler = virthba_ISR; - CHANNEL_HEADER __iomem *pChannelHeader; - SIGNAL_QUEUE_HEADER __iomem *pqhdr; + struct channel_header __iomem *pChannelHeader; + struct signal_queue_header __iomem *pqhdr; u64 mask; LOGVER("entering virthba_probe...\n"); - LOGVER("virtpcidev busNo<<%d>>devNo<<%d>>", virtpcidev->busNo, - virtpcidev->deviceNo); + LOGVER("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, + virtpcidev->device_no); LOGINF("entering virthba_probe...\n"); - LOGINF("virtpcidev busNo<<%d>>devNo<<%d>>", virtpcidev->busNo, - virtpcidev->deviceNo); + LOGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, + virtpcidev->device_no); POSTCODE_LINUX_2(VHBA_PROBE_ENTRY_PC, POSTCODE_SEVERITY_INFO); /* call scsi_host_alloc to register a scsi host adapter * instance - this virthba that has just been created is an @@ -578,18 +577,18 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) INIT_WORK(&virthbainfo->serverdown_completion, virthba_serverdown_complete); - writeq(readq(&virthbainfo->chinfo.queueinfo->chan->Features) | + writeq(readq(&virthbainfo->chinfo.queueinfo->chan->features) | ULTRA_IO_CHANNEL_IS_POLLING, - &virthbainfo->chinfo.queueinfo->chan->Features); + &virthbainfo->chinfo.queueinfo->chan->features); /* start thread that will receive scsicmnd responses */ DBGINF("starting rsp thread -- queueinfo: 0x%p, threadinfo: 0x%p.\n", virthbainfo->chinfo.queueinfo, &virthbainfo->chinfo.threadinfo); pChannelHeader = virthbainfo->chinfo.queueinfo->chan; - pqhdr = (SIGNAL_QUEUE_HEADER __iomem *) + pqhdr = (struct signal_queue_header __iomem *) ((char __iomem *)pChannelHeader + - readq(&pChannelHeader->oChannelSpace)) + IOCHAN_FROM_IOPART; - virthbainfo->flags_addr = &pqhdr->FeatureFlags; + readq(&pChannelHeader->ch_space_offset)) + IOCHAN_FROM_IOPART; + virthbainfo->flags_addr = &pqhdr->features; if (!uisthread_start(&virthbainfo->chinfo.threadinfo, process_incoming_rsps, @@ -603,16 +602,16 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) return -ENODEV; } LOGINF("sendInterruptHandle=0x%16llX", - virthbainfo->intr.sendInterruptHandle); + virthbainfo->intr.send_irq_handle); LOGINF("recvInterruptHandle=0x%16llX", - virthbainfo->intr.recvInterruptHandle); + virthbainfo->intr.recv_irq_handle); LOGINF("recvInterruptVector=0x%8X", - virthbainfo->intr.recvInterruptVector); + virthbainfo->intr.recv_irq_vector); LOGINF("recvInterruptShared=0x%2X", - virthbainfo->intr.recvInterruptShared); + virthbainfo->intr.recv_irq_shared); LOGINF("scsihost.hostt->name=%s", scsihost->hostt->name); virthbainfo->interrupt_vector = - virthbainfo->intr.recvInterruptHandle & INTERRUPT_VECTOR_MASK; + virthbainfo->intr.recv_irq_handle & INTERRUPT_VECTOR_MASK; rsp = request_irq(virthbainfo->interrupt_vector, handler, IRQF_SHARED, scsihost->hostt->name, virthbainfo); if (rsp != 0) { @@ -622,7 +621,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR); } else { u64 __iomem *Features_addr = - &virthbainfo->chinfo.queueinfo->chan->Features; + &virthbainfo->chinfo.queueinfo->chan->features; LOGERR("request_irq(%d) uislib_virthba_ISR request succeeded\n", virthbainfo->interrupt_vector); mask = ~(ULTRA_IO_CHANNEL_IS_POLLING | @@ -649,8 +648,8 @@ virthba_remove(struct virtpci_dev *virtpcidev) struct Scsi_Host *scsihost = (struct Scsi_Host *) virtpcidev->scsi.scsihost; - LOGINF("virtpcidev busNo<<%d>>devNo<<%d>>", virtpcidev->busNo, - virtpcidev->deviceNo); + LOGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, + virtpcidev->device_no); virthbainfo = (struct virthba_info *) scsihost->hostdata; if (virthbainfo->interrupt_vector != -1) free_irq(virthbainfo->interrupt_vector, virthbainfo); @@ -674,7 +673,7 @@ virthba_remove(struct virtpci_dev *virtpcidev) } static int -forward_vdiskmgmt_command(VDISK_MGMT_TYPES vdiskcmdtype, +forward_vdiskmgmt_command(enum vdisk_mgmt_types vdiskcmdtype, struct Scsi_Host *scsihost, struct uisscsi_dest *vdest) { @@ -738,7 +737,8 @@ forward_vdiskmgmt_command(VDISK_MGMT_TYPES vdiskcmdtype, /*****************************************************/ static int -forward_taskmgmt_command(TASK_MGMT_TYPES tasktype, struct scsi_device *scsidev) +forward_taskmgmt_command(enum task_mgmt_types tasktype, + struct scsi_device *scsidev) { struct uiscmdrsp *cmdrsp; struct virthba_info *virthbainfo = @@ -1142,9 +1142,9 @@ do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) scsicmd, cmdrsp->scsi.cmnd[0], scsidev->host->host_no, scsidev->id, scsidev->channel, scsidev->lun, - cmdrsp->scsi.linuxstat, sd->Valid, sd->SenseKey, - sd->AdditionalSenseCode, - sd->AdditionalSenseCodeQualifier); + cmdrsp->scsi.linuxstat, sd->valid, sd->sense_key, + sd->additional_sense_code, + sd->additional_sense_code_qualifier); if (atomic_read(&vdisk->error_count) == VIRTHBA_ERROR_COUNT) { LOGERR("Throtling SCSICMD errors disk <%d:%d:%d:%llu>\n", @@ -1276,8 +1276,8 @@ drain_queue(struct virthba_info *virthbainfo, struct chaninfo *dc, while (1) { spin_lock_irqsave(&virthbainfo->chinfo.insertlock, flags); - if (!ULTRA_CHANNEL_CLIENT_ACQUIRE_OS(dc->queueinfo->chan, - "vhba", NULL)) { + if (!spar_channel_client_acquire_os(dc->queueinfo->chan, + "vhba")) { spin_unlock_irqrestore(&virthbainfo->chinfo.insertlock, flags); virthbainfo->acquire_failed_cnt++; @@ -1285,8 +1285,7 @@ drain_queue(struct virthba_info *virthbainfo, struct chaninfo *dc, } qrslt = uisqueue_get_cmdrsp(dc->queueinfo, cmdrsp, IOCHAN_FROM_IOPART); - ULTRA_CHANNEL_CLIENT_RELEASE_OS(dc->queueinfo->chan, - "vhba", NULL); + spar_channel_client_release_os(dc->queueinfo->chan, "vhba"); spin_unlock_irqrestore(&virthbainfo->chinfo.insertlock, flags); if (qrslt == 0) break; @@ -1310,7 +1309,7 @@ drain_queue(struct virthba_info *virthbainfo, struct chaninfo *dc, * a Client/Guest Partition. Let's be * safe and set it to NULL now. Do * not use it here! */ - cmdrsp->disknotify.vHba = NULL; + cmdrsp->disknotify.v_hba = NULL; process_disk_notify(shost, cmdrsp); } else if (cmdrsp->cmdtype == CMD_VDISKMGMT_TYPE) { if (!del_scsipending_entry(virthbainfo, @@ -1323,7 +1322,6 @@ drain_queue(struct virthba_info *virthbainfo, struct chaninfo *dc, } } - /* main function for the thread that waits for scsi commands to arrive * in a specified queue */ @@ -1453,7 +1451,7 @@ static ssize_t enable_ints_write(struct file *file, if (VirtHbasOpen[i].virthbainfo != NULL) { virthbainfo = VirtHbasOpen[i].virthbainfo; Features_addr = - &virthbainfo->chinfo.queueinfo->chan->Features; + &virthbainfo->chinfo.queueinfo->chan->features; if (new_value == 1) { mask = ~(ULTRA_IO_CHANNEL_IS_POLLING | ULTRA_IO_DRIVER_DISABLES_INTS); @@ -1482,8 +1480,8 @@ virthba_serverup(struct virtpci_dev *virtpcidev) (struct virthba_info *) ((struct Scsi_Host *) virtpcidev->scsi. scsihost)->hostdata; - DBGINF("virtpcidev busNo<<%d>>devNo<<%d>>", virtpcidev->busNo, - virtpcidev->deviceNo); + DBGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, + virtpcidev->device_no); if (!virthbainfo->serverdown) { DBGINF("Server up message received while server is already up.\n"); @@ -1498,9 +1496,9 @@ virthba_serverup(struct virtpci_dev *virtpcidev) /* Must transition channel to ATTACHED state BEFORE we * can start using the device again */ - ULTRA_CHANNEL_CLIENT_TRANSITION(virthbainfo->chinfo.queueinfo->chan, - dev_name(&virtpcidev->generic_dev), - CHANNELCLI_ATTACHED, NULL); + SPAR_CHANNEL_CLIENT_TRANSITION(virthbainfo->chinfo.queueinfo->chan, + dev_name(&virtpcidev->generic_dev), + CHANNELCLI_ATTACHED, NULL); /* Start Processing the IOVM Response Queue Again */ if (!uisthread_start(&virthbainfo->chinfo.threadinfo, @@ -1573,13 +1571,13 @@ virthba_serverdown_complete(struct work_struct *work) virtpcidev = virthbainfo->virtpcidev; - DBGINF("virtpcidev busNo<<%d>>devNo<<%d>>", virtpcidev->busNo, - virtpcidev->deviceNo); + DBGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, + virtpcidev->device_no); virthbainfo->serverdown = true; virthbainfo->serverchangingstate = false; /* Return the ServerDown response to Command */ - visorchipset_device_pause_response(virtpcidev->busNo, - virtpcidev->deviceNo, 0); + visorchipset_device_pause_response(virtpcidev->bus_no, + virtpcidev->device_no, 0); } /* As per VirtpciFunc returns 1 for success and 0 for failure */ @@ -1591,8 +1589,8 @@ virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state) scsihost)->hostdata; DBGINF("virthba_serverdown"); - DBGINF("virtpcidev busNo<<%d>>devNo<<%d>>", virtpcidev->busNo, - virtpcidev->deviceNo); + DBGINF("virtpcidev bus_no<<%d>>devNo<<%d>>", virtpcidev->bus_no, + virtpcidev->device_no); if (!virthbainfo->serverdown && !virthbainfo->serverchangingstate) { virthbainfo->serverchangingstate = true; diff --git a/drivers/staging/unisys/virthba/virthba.h b/drivers/staging/unisys/virthba/virthba.h index d4b809b0c7bc..59901668d4f4 100644 --- a/drivers/staging/unisys/virthba/virthba.h +++ b/drivers/staging/unisys/virthba/virthba.h @@ -19,13 +19,9 @@ * Unisys Virtual HBA driver header */ - - #ifndef __VIRTHBA_H__ #define __VIRTHBA_H__ - #define VIRTHBA_VERSION "01.00" - #endif /* __VIRTHBA_H__ */ diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index ee9f8260cd15..39b828dce503 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -50,6 +50,7 @@ struct driver_private { struct module_kobject *mkobj; struct device_driver *driver; }; + #define to_driver(obj) container_of(obj, struct driver_private, kobj) /* bus_id went away in 2.6.30 - the size was 20 bytes, so we'll define @@ -109,7 +110,7 @@ static int virtpci_device_probe(struct device *dev); static int virtpci_device_remove(struct device *dev); static ssize_t info_debugfs_read(struct file *file, char __user *buf, - size_t len, loff_t *offset); + size_t len, loff_t *offset); static const struct file_operations debugfs_info_fops = { .read = info_debugfs_read, @@ -137,7 +138,7 @@ static struct device virtpci_rootbus_device = { }; /* filled in with info about parent chipset driver when we register with it */ -static ULTRA_VBUS_DEVICEINFO Chipset_DriverInfo; +static struct ultra_vbus_deviceinfo chipset_driver_info; static const struct sysfs_ops virtpci_driver_sysfs_ops = { .show = virtpci_driver_attr_show, @@ -148,11 +149,11 @@ static struct kobj_type virtpci_driver_kobj_type = { .sysfs_ops = &virtpci_driver_sysfs_ops, }; -static struct virtpci_dev *VpcidevListHead; -static DEFINE_RWLOCK(VpcidevListLock); +static struct virtpci_dev *vpcidev_list_head; +static DEFINE_RWLOCK(vpcidev_list_lock); /* filled in with info about this driver, wrt it servicing client busses */ -static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo; +static struct ultra_vbus_deviceinfo bus_driver_info; /*****************************************************/ /* debugfs entries */ @@ -171,13 +172,12 @@ struct virtpci_busdev { /*****************************************************/ static inline -int WAIT_FOR_IO_CHANNEL(ULTRA_IO_CHANNEL_PROTOCOL __iomem *chanptr) +int WAIT_FOR_IO_CHANNEL(struct spar_io_channel_protocol __iomem *chanptr) { int count = 120; while (count > 0) { - - if (ULTRA_CHANNEL_SERVER_READY(&chanptr->ChannelHeader)) + if (SPAR_CHANNEL_SERVER_READY(&chanptr->channel_header)) return 1; UIS_THREAD_WAIT_SEC(1); count--; @@ -186,8 +186,8 @@ int WAIT_FOR_IO_CHANNEL(ULTRA_IO_CHANNEL_PROTOCOL __iomem *chanptr) } /* Write the contents of <info> to the ULTRA_VBUS_CHANNEL_PROTOCOL.ChpInfo. */ -static int write_vbus_chpInfo(ULTRA_VBUS_CHANNEL_PROTOCOL *chan, - ULTRA_VBUS_DEVICEINFO *info) +static int write_vbus_chp_info(struct spar_vbus_channel_protocol *chan, + struct ultra_vbus_deviceinfo *info) { int off; @@ -195,18 +195,18 @@ static int write_vbus_chpInfo(ULTRA_VBUS_CHANNEL_PROTOCOL *chan, LOGERR("vbus channel not present"); return -1; } - off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.chpInfoByteOffset; - if (chan->HdrInfo.chpInfoByteOffset == 0) { - LOGERR("vbus channel not used, because chpInfoByteOffset == 0"); + off = sizeof(struct channel_header) + chan->hdr_info.chp_info_offset; + if (chan->hdr_info.chp_info_offset == 0) { + LOGERR("vbus channel not used, because chp_info_offset == 0"); return -1; } - memcpy(((u8 *) (chan)) + off, info, sizeof(*info)); + memcpy(((u8 *)(chan)) + off, info, sizeof(*info)); return 0; } /* Write the contents of <info> to the ULTRA_VBUS_CHANNEL_PROTOCOL.BusInfo. */ -static int write_vbus_busInfo(ULTRA_VBUS_CHANNEL_PROTOCOL *chan, - ULTRA_VBUS_DEVICEINFO *info) +static int write_vbus_bus_info(struct spar_vbus_channel_protocol *chan, + struct ultra_vbus_deviceinfo *info) { int off; @@ -214,12 +214,12 @@ static int write_vbus_busInfo(ULTRA_VBUS_CHANNEL_PROTOCOL *chan, LOGERR("vbus channel not present"); return -1; } - off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.busInfoByteOffset; - if (chan->HdrInfo.busInfoByteOffset == 0) { - LOGERR("vbus channel not used, because busInfoByteOffset == 0"); + off = sizeof(struct channel_header) + chan->hdr_info.bus_info_offset; + if (chan->hdr_info.bus_info_offset == 0) { + LOGERR("vbus channel not used, because bus_info_offset == 0"); return -1; } - memcpy(((u8 *) (chan)) + off, info, sizeof(*info)); + memcpy(((u8 *)(chan)) + off, info, sizeof(*info)); return 0; } @@ -227,8 +227,8 @@ static int write_vbus_busInfo(ULTRA_VBUS_CHANNEL_PROTOCOL *chan, * ULTRA_VBUS_CHANNEL_PROTOCOL.DevInfo[<devix>]. */ static int -write_vbus_devInfo(ULTRA_VBUS_CHANNEL_PROTOCOL *chan, - ULTRA_VBUS_DEVICEINFO *info, int devix) +write_vbus_dev_info(struct spar_vbus_channel_protocol *chan, + struct ultra_vbus_deviceinfo *info, int devix) { int off; @@ -237,14 +237,14 @@ write_vbus_devInfo(ULTRA_VBUS_CHANNEL_PROTOCOL *chan, return -1; } off = - (sizeof(ULTRA_CHANNEL_PROTOCOL) + - chan->HdrInfo.devInfoByteOffset) + - (chan->HdrInfo.deviceInfoStructBytes * devix); - if (chan->HdrInfo.devInfoByteOffset == 0) { - LOGERR("vbus channel not used, because devInfoByteOffset == 0"); + (sizeof(struct channel_header) + + chan->hdr_info.dev_info_offset) + + (chan->hdr_info.device_info_struct_bytes * devix); + if (chan->hdr_info.dev_info_offset == 0) { + LOGERR("vbus channel not used, because dev_info_offset == 0"); return -1; } - memcpy(((u8 *) (chan)) + off, info, sizeof(*info)); + memcpy(((u8 *)(chan)) + off, info, sizeof(*info)); return 0; } @@ -256,13 +256,13 @@ static int add_vbus(struct add_vbus_guestpart *addparams) int ret; struct device *vbus; - vbus = kzalloc(sizeof(struct device), GFP_ATOMIC); + vbus = kzalloc(sizeof(*vbus), GFP_ATOMIC); POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); if (!vbus) return 0; - dev_set_name(vbus, "vbus%d", addparams->busNo); + dev_set_name(vbus, "vbus%d", addparams->bus_no); vbus->release = virtpci_bus_release; vbus->parent = &virtpci_rootbus_device; /* root bus is parent */ vbus->bus = &virtpci_bus_type; /* bus type */ @@ -279,11 +279,12 @@ static int add_vbus(struct add_vbus_guestpart *addparams) POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; } - write_vbus_chpInfo(vbus->platform_data /* chanptr */ , - &Chipset_DriverInfo); - write_vbus_busInfo(vbus->platform_data /* chanptr */ , &Bus_DriverInfo); + write_vbus_chp_info(vbus->platform_data /* chanptr */ , + &chipset_driver_info); + write_vbus_bus_info(vbus->platform_data /* chanptr */ , + &bus_driver_info); LOGINF("Added vbus %d; device %s created successfully\n", - addparams->busNo, BUS_ID(vbus)); + addparams->bus_no, BUS_ID(vbus)); POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); return 1; } @@ -293,26 +294,15 @@ static int add_vbus(struct add_vbus_guestpart *addparams) */ #define GET_SCSIADAPINFO_FROM_CHANPTR(chanptr) { \ memcpy_fromio(&scsi.wwnn, \ - &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \ + &((struct spar_io_channel_protocol __iomem *) \ chanptr)->vhba.wwnn, \ sizeof(struct vhba_wwnn)); \ memcpy_fromio(&scsi.max, \ - &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \ + &((struct spar_io_channel_protocol __iomem *) \ chanptr)->vhba.max, \ sizeof(struct vhba_config_max)); \ } -/* find bus device with the busid that matches - match_busid matches bus_id */ -#define GET_BUS_DEV(busno) { \ - sprintf(busid, "vbus%d", busno); \ - vbus = bus_find_device(&virtpci_bus_type, NULL, \ - (void *)busid, match_busid); \ - if (!vbus) { \ - LOGERR("**** FAILED to find vbus %s\n", busid); \ - return 0; \ - } \ -} - /* adds a vhba * returns 0 failure, 1 success, */ @@ -325,7 +315,7 @@ static int add_vhba(struct add_virt_guestpart *addparams) POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); if (!WAIT_FOR_IO_CHANNEL - ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) addparams->chanptr)) { + ((struct spar_io_channel_protocol __iomem *)addparams->chanptr)) { LOGERR("Timed out. Channel not ready\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; @@ -333,7 +323,14 @@ static int add_vhba(struct add_virt_guestpart *addparams) GET_SCSIADAPINFO_FROM_CHANPTR(addparams->chanptr); - GET_BUS_DEV(addparams->bus_no); + /* find bus device with the busid that matches match_busid */ + sprintf(busid, "vbus%d", addparams->bus_no); + vbus = bus_find_device(&virtpci_bus_type, NULL, + (void *)busid, match_busid); + if (!vbus) { + LOGERR("**** FAILED to find vbus %s\n", busid); + return 0; + } LOGINF("Adding vhba wwnn:%x:%x config:%d-%d-%d-%d chanptr:%p\n", scsi.wwnn.wwnn1, scsi.wwnn.wwnn2, @@ -347,7 +344,6 @@ static int add_vhba(struct add_virt_guestpart *addparams) POSTCODE_SEVERITY_INFO); } return i; - } /* for CHANSOCK macaddr is AUTO-GENERATED; for normal channels, @@ -355,17 +351,17 @@ static int add_vhba(struct add_virt_guestpart *addparams) */ #define GET_NETADAPINFO_FROM_CHANPTR(chanptr) { \ memcpy_fromio(net.mac_addr, \ - ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \ - chanptr)->vnic.macaddr, \ + ((struct spar_io_channel_protocol __iomem *) \ + chanptr)->vnic.macaddr, \ MAX_MACADDR_LEN); \ net.num_rcv_bufs = \ - readl(&((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \ - chanptr)->vnic.num_rcv_bufs); \ - net.mtu = readl(&((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \ - chanptr)->vnic.mtu); \ - memcpy_fromio(&net.zoneGuid, \ - &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \ - chanptr)->vnic.zoneGuid, \ + readl(&((struct spar_io_channel_protocol __iomem *)\ + chanptr)->vnic.num_rcv_bufs); \ + net.mtu = readl(&((struct spar_io_channel_protocol __iomem *) \ + chanptr)->vnic.mtu); \ + memcpy_fromio(&net.zone_uuid, \ + &((struct spar_io_channel_protocol __iomem *)\ + chanptr)->vnic.zone_uuid, \ sizeof(uuid_le)); \ } @@ -382,7 +378,7 @@ add_vnic(struct add_virt_guestpart *addparams) POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); if (!WAIT_FOR_IO_CHANNEL - ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) addparams->chanptr)) { + ((struct spar_io_channel_protocol __iomem *)addparams->chanptr)) { LOGERR("Timed out, channel not ready\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return 0; @@ -390,12 +386,19 @@ add_vnic(struct add_virt_guestpart *addparams) GET_NETADAPINFO_FROM_CHANPTR(addparams->chanptr); - GET_BUS_DEV(addparams->bus_no); + /* find bus device with the busid that matches match_busid */ + sprintf(busid, "vbus%d", addparams->bus_no); + vbus = bus_find_device(&virtpci_bus_type, NULL, + (void *)busid, match_busid); + if (!vbus) { + LOGERR("**** FAILED to find vbus %s\n", busid); + return 0; + } LOGINF("Adding vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x rcvbufs:%d mtu:%d chanptr:%p%pUL\n", - net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], net.mac_addr[3], - net.mac_addr[4], net.mac_addr[5], net.num_rcv_bufs, net.mtu, - addparams->chanptr, &net.zoneGuid); + net.mac_addr[0], net.mac_addr[1], net.mac_addr[2], + net.mac_addr[3], net.mac_addr[4], net.mac_addr[5], + net.num_rcv_bufs, net.mtu, addparams->chanptr, &net.zone_uuid); i = virtpci_device_add(vbus, VIRTNIC_TYPE, addparams, NULL, &net); if (i) { LOGINF("Added vnic macaddr:%02x:%02x:%02x:%02x:%02x:%02x\n", @@ -417,7 +420,15 @@ delete_vbus(struct del_vbus_guestpart *delparams) struct device *vbus; unsigned char busid[BUS_ID_SIZE]; - GET_BUS_DEV(delparams->bus_no); + /* find bus device with the busid that matches match_busid */ + sprintf(busid, "vbus%d", delparams->bus_no); + vbus = bus_find_device(&virtpci_bus_type, NULL, + (void *)busid, match_busid); + if (!vbus) { + LOGERR("**** FAILED to find vbus %s\n", busid); + return 0; + } + /* ensure that bus has no devices? -- TBD */ LOGINF("Deleting %s\n", BUS_ID(vbus)); if (delete_vbus_device(vbus, NULL)) @@ -430,9 +441,9 @@ static int delete_vbus_device(struct device *vbus, void *data) { int checkforroot = (data != NULL); - struct device *pDev = &virtpci_rootbus_device; + struct device *dev = &virtpci_rootbus_device; - if ((checkforroot) && match_busid(vbus, (void *) BUS_ID(pDev))) { + if ((checkforroot) && match_busid(vbus, (void *)BUS_ID(dev))) { /* skip it - don't delete root bus */ LOGINF("skipping root bus\n"); return 0; /* pretend no error */ @@ -590,10 +601,10 @@ static void delete_all(void) struct virtpci_dev *tmpvpcidev, *nextvpcidev; /* delete the entire vhba/vnic list in one shot */ - write_lock_irqsave(&VpcidevListLock, flags); - tmpvpcidev = VpcidevListHead; - VpcidevListHead = NULL; - write_unlock_irqrestore(&VpcidevListLock, flags); + write_lock_irqsave(&vpcidev_list_lock, flags); + tmpvpcidev = vpcidev_list_head; + vpcidev_list_head = NULL; + write_unlock_irqrestore(&vpcidev_list_lock, flags); /* delete one vhba/vnic at a time */ while (tmpvpcidev) { @@ -607,24 +618,32 @@ static void delete_all(void) /* now delete each vbus */ if (bus_for_each_dev - (&virtpci_bus_type, NULL, (void *) 1, delete_vbus_device)) + (&virtpci_bus_type, NULL, (void *)1, delete_vbus_device)) LOGERR("delete of all vbus failed\n"); } /* deletes all vnics or vhbas * returns 0 failure, 1 success, */ -static int delete_all_virt(VIRTPCI_DEV_TYPE devtype, struct del_vbus_guestpart *delparams) +static int delete_all_virt(enum virtpci_dev_type devtype, + struct del_vbus_guestpart *delparams) { int i; unsigned char busid[BUS_ID_SIZE]; struct device *vbus; - GET_BUS_DEV(delparams->bus_no); + /* find bus device with the busid that matches match_busid */ + sprintf(busid, "vbus%d", delparams->bus_no); + vbus = bus_find_device(&virtpci_bus_type, NULL, + (void *)busid, match_busid); + if (!vbus) { + LOGERR("**** FAILED to find vbus %s\n", busid); + return 0; + } if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { LOGERR("**** FAILED to delete all devices; devtype:%d not vhba:%d or vnic:%d\n", - devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); + devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); return 0; } @@ -694,10 +713,10 @@ virtpci_match_device(const struct pci_device_id *ids, { while (ids->vendor || ids->subvendor || ids->class_mask) { DBGINF("ids->vendor:%x dev->vendor:%x ids->device:%x dev->device:%x\n", - ids->vendor, dev->vendor, ids->device, dev->device); + ids->vendor, dev->vendor, ids->device, dev->device); - if ((ids->vendor == dev->vendor) - && (ids->device == dev->device)) + if ((ids->vendor == dev->vendor) && + (ids->device == dev->device)) return ids; ids++; @@ -752,15 +771,15 @@ static int virtpci_device_resume(struct device *dev) /* For a child device just created on a client bus, fill in * information about the driver that is controlling this device into - * the the appropriate slot within the vbus channel of the bus + * the appropriate slot within the vbus channel of the bus * instance. */ -static void fix_vbus_devInfo(struct device *dev, int devNo, int devType, - struct virtpci_driver *virtpcidrv) +static void fix_vbus_dev_info(struct device *dev, int dev_no, int dev_type, + struct virtpci_driver *virtpcidrv) { struct device *vbus; - void *pChan; - ULTRA_VBUS_DEVICEINFO devInfo; + void *chan; + struct ultra_vbus_deviceinfo dev_info; const char *stype; if (!dev) { @@ -776,12 +795,12 @@ static void fix_vbus_devInfo(struct device *dev, int devNo, int devType, LOGERR("%s dev has no parent bus", __func__); return; } - pChan = vbus->platform_data; - if (!pChan) { + chan = vbus->platform_data; + if (!chan) { LOGERR("%s dev bus has no channel", __func__); return; } - switch (devType) { + switch (dev_type) { case PCI_DEVICE_ID_VIRTHBA: stype = "vHBA"; break; @@ -792,17 +811,17 @@ static void fix_vbus_devInfo(struct device *dev, int devNo, int devType, stype = "unknown"; break; } - bus_device_info_init(&devInfo, stype, - virtpcidrv->name, - virtpcidrv->version, - virtpcidrv->vertag); - write_vbus_devInfo(pChan, &devInfo, devNo); + bus_device_info_init(&dev_info, stype, + virtpcidrv->name, + virtpcidrv->version, + virtpcidrv->vertag); + write_vbus_dev_info(chan, &dev_info, dev_no); /* Re-write bus+chipset info, because it is possible that this * was previously written by our good counterpart, visorbus. */ - write_vbus_chpInfo(pChan, &Chipset_DriverInfo); - write_vbus_busInfo(pChan, &Bus_DriverInfo); + write_vbus_chp_info(chan, &chipset_driver_info); + write_vbus_bus_info(chan, &bus_driver_info); } /* This function is called to query the existence of a specific device @@ -842,13 +861,14 @@ static int virtpci_device_probe(struct device *dev) */ error = virtpcidrv->probe(virtpcidev, id); if (!error) { - fix_vbus_devInfo(dev, virtpcidev->deviceNo, - virtpcidev->device, virtpcidrv); + fix_vbus_dev_info(dev, virtpcidev->device_no, + virtpcidev->device, virtpcidrv); virtpcidev->mydriver = virtpcidrv; POSTCODE_LINUX_2(VPCI_PROBE_EXIT_PC, POSTCODE_SEVERITY_INFO); - } else + } else { put_device(dev); + } } POSTCODE_LINUX_2(VPCI_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR); return error; /* -ENODEV for probe failure */ @@ -896,17 +916,20 @@ static void virtpci_bus_release(struct device *dev) /* Adapter functions */ /*****************************************************/ +/* scsi is expected to be NULL for VNIC add + * net is expected to be NULL for VHBA add + */ static int virtpci_device_add(struct device *parentbus, int devtype, struct add_virt_guestpart *addparams, - struct scsi_adap_info *scsi, /* NULL for VNIC add */ - struct net_adap_info *net /* NULL for VHBA add */) + struct scsi_adap_info *scsi, + struct net_adap_info *net) { struct virtpci_dev *virtpcidev = NULL; struct virtpci_dev *tmpvpcidev = NULL, *prev; unsigned long flags; int ret; - ULTRA_IO_CHANNEL_PROTOCOL __iomem *pIoChan = NULL; - struct device *pDev; + struct spar_io_channel_protocol __iomem *io_chan = NULL; + struct device *dev; LOGINF("virtpci_device_add parentbus:%p chanptr:%p\n", parentbus, addparams->chanptr); @@ -915,14 +938,14 @@ static int virtpci_device_add(struct device *parentbus, int devtype, if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) { LOGERR("**** FAILED to add device; devtype:%d not vhba:%d or vnic:%d\n", - devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); + devtype, VIRTHBA_TYPE, VIRTNIC_TYPE); POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, devtype, POSTCODE_SEVERITY_ERR); return 0; } /* add a Virtual Device */ - virtpcidev = kzalloc(sizeof(struct virtpci_dev), GFP_ATOMIC); + virtpcidev = kzalloc(sizeof(*virtpcidev), GFP_ATOMIC); if (virtpcidev == NULL) { LOGERR("can't add device - malloc FALLED\n"); POSTCODE_LINUX_2(MALLOC_FAILURE_PC, POSTCODE_SEVERITY_ERR); @@ -939,14 +962,14 @@ static int virtpci_device_add(struct device *parentbus, int devtype, virtpcidev->net = *net; } virtpcidev->vendor = PCI_VENDOR_ID_UNISYS; - virtpcidev->busNo = addparams->bus_no; - virtpcidev->deviceNo = addparams->device_no; + virtpcidev->bus_no = addparams->bus_no; + virtpcidev->device_no = addparams->device_no; virtpcidev->queueinfo.chan = addparams->chanptr; virtpcidev->queueinfo.send_int_if_needed = NULL; /* Set up safe queue... */ - pIoChan = (ULTRA_IO_CHANNEL_PROTOCOL __iomem *) + io_chan = (struct spar_io_channel_protocol __iomem *) virtpcidev->queueinfo.chan; virtpcidev->intr = addparams->intr; @@ -962,8 +985,8 @@ static int virtpci_device_add(struct device *parentbus, int devtype, /* add the vhba/vnic to virtpci device list - but check for * duplicate wwnn/macaddr first */ - write_lock_irqsave(&VpcidevListLock, flags); - for (tmpvpcidev = VpcidevListHead; tmpvpcidev; + write_lock_irqsave(&vpcidev_list_lock, flags); + for (tmpvpcidev = vpcidev_list_head; tmpvpcidev; tmpvpcidev = tmpvpcidev->next) { if (devtype == VIRTHBA_TYPE) { if ((tmpvpcidev->scsi.wwnn.wwnn1 == scsi->wwnn.wwnn1) && @@ -984,7 +1007,7 @@ static int virtpci_device_add(struct device *parentbus, int devtype, /* found a vhba/vnic already in the list with same * wwnn or macaddr - reject add */ - write_unlock_irqrestore(&VpcidevListLock, flags); + write_unlock_irqrestore(&vpcidev_list_lock, flags); kfree(virtpcidev); LOGERR("**** FAILED vhba/vnic already exists in the list\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); @@ -992,26 +1015,26 @@ static int virtpci_device_add(struct device *parentbus, int devtype, } /* add it at the head */ - if (!VpcidevListHead) - VpcidevListHead = virtpcidev; - else { + if (!vpcidev_list_head) { + vpcidev_list_head = virtpcidev; + } else { /* insert virtpcidev at the head of our linked list of * vpcidevs */ - virtpcidev->next = VpcidevListHead; - VpcidevListHead = virtpcidev; + virtpcidev->next = vpcidev_list_head; + vpcidev_list_head = virtpcidev; } - write_unlock_irqrestore(&VpcidevListLock, flags); + write_unlock_irqrestore(&vpcidev_list_lock, flags); /* Must transition channel to ATTACHED state BEFORE * registering the device, because polling of the channel * queues can begin at any time after device_register(). */ - pDev = &virtpcidev->generic_dev; - ULTRA_CHANNEL_CLIENT_TRANSITION(addparams->chanptr, - BUS_ID(pDev), - CHANNELCLI_ATTACHED, NULL); + dev = &virtpcidev->generic_dev; + SPAR_CHANNEL_CLIENT_TRANSITION(addparams->chanptr, + BUS_ID(dev), + CHANNELCLI_ATTACHED, NULL); /* don't register until device has been added to * list. Otherwise, a device_unregister from this function can @@ -1031,24 +1054,24 @@ static int virtpci_device_add(struct device *parentbus, int devtype, */ if (ret) { LOGERR("device_register returned %d\n", ret); - pDev = &virtpcidev->generic_dev; - ULTRA_CHANNEL_CLIENT_TRANSITION(addparams->chanptr, - BUS_ID(pDev), - CHANNELCLI_DETACHED, NULL); + dev = &virtpcidev->generic_dev; + SPAR_CHANNEL_CLIENT_TRANSITION(addparams->chanptr, + BUS_ID(dev), + CHANNELCLI_DETACHED, NULL); /* remove virtpcidev, the one we just added, from the list */ - write_lock_irqsave(&VpcidevListLock, flags); - for (tmpvpcidev = VpcidevListHead, prev = NULL; + write_lock_irqsave(&vpcidev_list_lock, flags); + for (tmpvpcidev = vpcidev_list_head, prev = NULL; tmpvpcidev; prev = tmpvpcidev, tmpvpcidev = tmpvpcidev->next) { if (tmpvpcidev == virtpcidev) { if (prev) prev->next = tmpvpcidev->next; else - VpcidevListHead = tmpvpcidev->next; + vpcidev_list_head = tmpvpcidev->next; break; } } - write_unlock_irqrestore(&VpcidevListLock, flags); + write_unlock_irqrestore(&vpcidev_list_lock, flags); kfree(virtpcidev); return 0; } @@ -1080,9 +1103,9 @@ static int virtpci_device_serverdown(struct device *parentbus, } /* find the vhba or vnic in virtpci device list */ - write_lock_irqsave(&VpcidevListLock, flags); + write_lock_irqsave(&vpcidev_list_lock, flags); - for (tmpvpcidev = VpcidevListHead, prevvpcidev = NULL; + for (tmpvpcidev = vpcidev_list_head, prevvpcidev = NULL; (tmpvpcidev && !found); prevvpcidev = tmpvpcidev, tmpvpcidev = tmpvpcidev->next) { if (tmpvpcidev->devtype != devtype) @@ -1110,7 +1133,7 @@ static int virtpci_device_serverdown(struct device *parentbus, vpcidriver = tmpvpcidev->mydriver; rc = vpcidriver->suspend(tmpvpcidev, 0); } - write_unlock_irqrestore(&VpcidevListLock, flags); + write_unlock_irqrestore(&vpcidev_list_lock, flags); if (!found) { LOGERR("**** FAILED to find vhba/vnic in the list\n"); @@ -1139,9 +1162,9 @@ static int virtpci_device_serverup(struct device *parentbus, } /* find the vhba or vnic in virtpci device list */ - write_lock_irqsave(&VpcidevListLock, flags); + write_lock_irqsave(&vpcidev_list_lock, flags); - for (tmpvpcidev = VpcidevListHead, prevvpcidev = NULL; + for (tmpvpcidev = vpcidev_list_head, prevvpcidev = NULL; (tmpvpcidev && !found); prevvpcidev = tmpvpcidev, tmpvpcidev = tmpvpcidev->next) { if (tmpvpcidev->devtype != devtype) @@ -1172,12 +1195,13 @@ static int virtpci_device_serverup(struct device *parentbus, * ever have a bus that contains NO devices, since we * would never even get here in that case. */ - fix_vbus_devInfo(&tmpvpcidev->generic_dev, tmpvpcidev->deviceNo, - tmpvpcidev->device, vpcidriver); + fix_vbus_dev_info(&tmpvpcidev->generic_dev, + tmpvpcidev->device_no, + tmpvpcidev->device, vpcidriver); rc = vpcidriver->resume(tmpvpcidev); } - write_unlock_irqrestore(&VpcidevListLock, flags); + write_unlock_irqrestore(&vpcidev_list_lock, flags); if (!found) { LOGERR("**** FAILED to find vhba/vnic in the list\n"); @@ -1218,8 +1242,8 @@ static int virtpci_device_del(struct device *parentbus, * device_unregister after we release the lock; otherwise we * encounter "schedule while atomic" */ - write_lock_irqsave(&VpcidevListLock, flags); - for (tmpvpcidev = VpcidevListHead, prevvpcidev = NULL; tmpvpcidev;) { + write_lock_irqsave(&vpcidev_list_lock, flags); + for (tmpvpcidev = vpcidev_list_head, prevvpcidev = NULL; tmpvpcidev;) { if (tmpvpcidev->devtype != devtype) DEL_CONTINUE; @@ -1253,7 +1277,7 @@ static int virtpci_device_del(struct device *parentbus, /* not at head */ prevvpcidev->next = tmpvpcidev->next; else - VpcidevListHead = tmpvpcidev->next; + vpcidev_list_head = tmpvpcidev->next; /* add it to our deletelist */ tmpvpcidev->next = dellist; @@ -1268,9 +1292,9 @@ static int virtpci_device_del(struct device *parentbus, if (prevvpcidev) tmpvpcidev = prevvpcidev->next; else - tmpvpcidev = VpcidevListHead; + tmpvpcidev = vpcidev_list_head; } - write_unlock_irqrestore(&VpcidevListLock, flags); + write_unlock_irqrestore(&vpcidev_list_lock, flags); if (!all && (count == 0)) { LOGERR("**** FAILED to find vhba/vnic in the list\n"); @@ -1425,7 +1449,7 @@ static int print_vbus(struct device *vbus, void *data) } static ssize_t info_debugfs_read(struct file *file, char __user *buf, - size_t len, loff_t *offset) + size_t len, loff_t *offset) { ssize_t bytes_read = 0; int str_pos = 0; @@ -1446,18 +1470,19 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, printparam.buf = vbuf; printparam.len = &len; if (bus_for_each_dev(&virtpci_bus_type, NULL, - (void *) &printparam, print_vbus)) + (void *)&printparam, print_vbus)) LOGERR("Failed to find bus\n"); str_pos += scnprintf(vbuf + str_pos, len - str_pos, "\n Virtual PCI devices\n"); - read_lock_irqsave(&VpcidevListLock, flags); - tmpvpcidev = VpcidevListHead; + read_lock_irqsave(&vpcidev_list_lock, flags); + tmpvpcidev = vpcidev_list_head; while (tmpvpcidev) { if (tmpvpcidev->devtype == VIRTHBA_TYPE) { str_pos += scnprintf(vbuf + str_pos, len - str_pos, "[%d:%d] VHba:%08x:%08x max-config:%d-%d-%d-%d", - tmpvpcidev->busNo, tmpvpcidev->deviceNo, + tmpvpcidev->bus_no, + tmpvpcidev->device_no, tmpvpcidev->scsi.wwnn.wwnn1, tmpvpcidev->scsi.wwnn.wwnn2, tmpvpcidev->scsi.max.max_channel, @@ -1467,7 +1492,8 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, } else { str_pos += scnprintf(vbuf + str_pos, len - str_pos, "[%d:%d] VNic:%02x:%02x:%02x:%02x:%02x:%02x num_rcv_bufs:%d mtu:%d", - tmpvpcidev->busNo, tmpvpcidev->deviceNo, + tmpvpcidev->bus_no, + tmpvpcidev->device_no, tmpvpcidev->net.mac_addr[0], tmpvpcidev->net.mac_addr[1], tmpvpcidev->net.mac_addr[2], @@ -1482,7 +1508,7 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, tmpvpcidev->queueinfo.chan); tmpvpcidev = tmpvpcidev->next; } - read_unlock_irqrestore(&VpcidevListLock, flags); + read_unlock_irqrestore(&vpcidev_list_lock, flags); str_pos += scnprintf(vbuf + str_pos, len - str_pos, "\n"); bytes_read = simple_read_from_buffer(buf, len, offset, vbuf, str_pos); @@ -1498,7 +1524,6 @@ static int __init virtpci_mod_init(void) { int ret; - if (!unisys_spar_platform) return -ENODEV; @@ -1515,8 +1540,8 @@ static int __init virtpci_mod_init(void) return ret; } DBGINF("bus_register successful\n"); - bus_device_info_init(&Bus_DriverInfo, "clientbus", "virtpci", - VERSION, NULL); + bus_device_info_init(&bus_driver_info, "clientbus", "virtpci", + VERSION, NULL); /* create a root bus used to parent all the virtpci buses. */ ret = device_register(&virtpci_rootbus_device); @@ -1529,8 +1554,8 @@ static int __init virtpci_mod_init(void) } DBGINF("device_register successful ret:%x\n", ret); - if (!uisctrl_register_req_handler(2, (void *) &virtpci_ctrlchan_func, - &Chipset_DriverInfo)) { + if (!uisctrl_register_req_handler(2, (void *)&virtpci_ctrlchan_func, + &chipset_driver_info)) { LOGERR("uisctrl_register_req_handler ****FAILED.\n"); POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR); device_unregister(&virtpci_rootbus_device); @@ -1539,11 +1564,11 @@ static int __init virtpci_mod_init(void) } LOGINF("successfully registered virtpci_ctrlchan_func (0x%p) as callback.\n", - (void *) &virtpci_ctrlchan_func); + (void *)&virtpci_ctrlchan_func); /* create debugfs directory and info file inside. */ virtpci_debugfs_dir = debugfs_create_dir("virtpci", NULL); debugfs_create_file("info", S_IRUSR, virtpci_debugfs_dir, - NULL, &debugfs_info_fops); + NULL, &debugfs_info_fops); LOGINF("Leaving\n"); POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); return 0; @@ -1561,7 +1586,6 @@ static void __exit virtpci_mod_exit(void) bus_unregister(&virtpci_bus_type); debugfs_remove_recursive(virtpci_debugfs_dir); LOGINF("Leaving\n"); - } module_init(virtpci_mod_init); diff --git a/drivers/staging/unisys/virtpci/virtpci.h b/drivers/staging/unisys/virtpci/virtpci.h index 6e26956c79f4..9d85f55e8169 100644 --- a/drivers/staging/unisys/virtpci/virtpci.h +++ b/drivers/staging/unisys/virtpci/virtpci.h @@ -42,25 +42,25 @@ struct net_adap_info { u8 mac_addr[MAX_MACADDR_LEN]; int num_rcv_bufs; unsigned mtu; - uuid_le zoneGuid; + uuid_le zone_uuid; }; -typedef enum { +enum virtpci_dev_type { VIRTHBA_TYPE = 0, VIRTNIC_TYPE = 1, VIRTBUS_TYPE = 6, -} VIRTPCI_DEV_TYPE; +}; struct virtpci_dev { - VIRTPCI_DEV_TYPE devtype; /* indicates type of the + enum virtpci_dev_type devtype; /* indicates type of the * virtual pci device */ struct virtpci_driver *mydriver; /* which driver has allocated * this device */ unsigned short vendor; /* vendor id for device */ unsigned short device; /* device id for device */ - u32 busNo; /* number of bus on which device exists */ - u32 deviceNo; /* device's number on the bus */ - struct InterruptInfo intr; /* interrupt info */ + u32 bus_no; /* number of bus on which device exists */ + u32 device_no; /* device's number on the bus */ + struct irq_info intr; /* interrupt info */ struct device generic_dev; /* generic device */ union { struct scsi_adap_info scsi; @@ -80,15 +80,15 @@ struct virtpci_driver { const struct pci_device_id *id_table; /* must be non-NULL for probe * to be called */ int (*probe)(struct virtpci_dev *dev, - const struct pci_device_id *id); /* device inserted */ + const struct pci_device_id *id); /* device inserted */ void (*remove)(struct virtpci_dev *dev); /* Device removed (NULL if * not a hot-plug capable * driver) */ int (*suspend)(struct virtpci_dev *dev, - u32 state); /* Device suspended */ + u32 state); /* Device suspended */ int (*resume)(struct virtpci_dev *dev); /* Device woken up */ int (*enable_wake)(struct virtpci_dev *dev, - u32 state, int enable); /* Enable wake event */ + u32 state, int enable); /* Enable wake event */ struct device_driver core_driver; /* VIRTPCI core fills this in */ }; diff --git a/drivers/staging/unisys/visorchannel/globals.h b/drivers/staging/unisys/visorchannel/globals.h index 07653b8dea7b..581ed83fe6d0 100644 --- a/drivers/staging/unisys/visorchannel/globals.h +++ b/drivers/staging/unisys/visorchannel/globals.h @@ -25,5 +25,4 @@ #define MYDRVNAME "visorchannel" - #endif diff --git a/drivers/staging/unisys/visorchannel/visorchannel.h b/drivers/staging/unisys/visorchannel/visorchannel.h index 9a4d7b6755d1..5061edff959a 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel.h +++ b/drivers/staging/unisys/visorchannel/visorchannel.h @@ -66,7 +66,7 @@ char *visorchannel_id(VISORCHANNEL *channel, char *s); char *visorchannel_zoneid(VISORCHANNEL *channel, char *s); u64 visorchannel_get_clientpartition(VISORCHANNEL *channel); uuid_le visorchannel_get_uuid(VISORCHANNEL *channel); -MEMREGION *visorchannel_get_memregion(VISORCHANNEL *channel); +struct memregion *visorchannel_get_memregion(VISORCHANNEL *channel); char *visorchannel_uuid_id(uuid_le *guid, char *s); void visorchannel_debug(VISORCHANNEL *channel, int nQueues, struct seq_file *seq, u32 off); diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 01a44c553500..36559d5fa673 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -29,8 +29,8 @@ #define MYDRVNAME "visorchannel" struct VISORCHANNEL_Tag { - MEMREGION *memregion; /* from visor_memregion_create() */ - CHANNEL_HEADER chan_hdr; + struct memregion *memregion; /* from visor_memregion_create() */ + struct channel_header chan_hdr; uuid_le guid; ulong size; BOOL needs_lock; @@ -38,10 +38,10 @@ struct VISORCHANNEL_Tag { spinlock_t remove_lock; struct { - SIGNAL_QUEUE_HEADER req_queue; - SIGNAL_QUEUE_HEADER rsp_queue; - SIGNAL_QUEUE_HEADER event_queue; - SIGNAL_QUEUE_HEADER ack_queue; + struct signal_queue_header req_queue; + struct signal_queue_header rsp_queue; + struct signal_queue_header event_queue; + struct signal_queue_header ack_queue; } safe_uis_queue; }; @@ -60,7 +60,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, if (p == NULL) { ERRDRV("allocation failed: (status=0)\n"); rc = NULL; - goto Away; + goto cleanup; } p->memregion = NULL; p->needs_lock = needs_lock; @@ -70,39 +70,39 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, /* prepare chan_hdr (abstraction to read/write channel memory) */ if (parent == NULL) p->memregion = - visor_memregion_create(physaddr, sizeof(CHANNEL_HEADER)); + visor_memregion_create(physaddr, + sizeof(struct channel_header)); else p->memregion = visor_memregion_create_overlapped(parent->memregion, - off, - sizeof(CHANNEL_HEADER)); + off, sizeof(struct channel_header)); if (p->memregion == NULL) { ERRDRV("visor_memregion_create failed failed: (status=0)\n"); rc = NULL; - goto Away; + goto cleanup; } if (visor_memregion_read(p->memregion, 0, &p->chan_hdr, - sizeof(CHANNEL_HEADER)) < 0) { + sizeof(struct channel_header)) < 0) { ERRDRV("visor_memregion_read failed: (status=0)\n"); rc = NULL; - goto Away; + goto cleanup; } if (channelBytes == 0) /* we had better be a CLIENT of this channel */ - channelBytes = (ulong) p->chan_hdr.Size; + channelBytes = (ulong)p->chan_hdr.size; if (uuid_le_cmp(guid, NULL_UUID_LE) == 0) /* we had better be a CLIENT of this channel */ - guid = p->chan_hdr.Type; + guid = p->chan_hdr.chtype; if (visor_memregion_resize(p->memregion, channelBytes) < 0) { ERRDRV("visor_memregion_resize failed: (status=0)\n"); rc = NULL; - goto Away; + goto cleanup; } p->size = channelBytes; p->guid = guid; rc = p; -Away: +cleanup: if (rc == NULL) { if (p != NULL) { @@ -194,14 +194,14 @@ EXPORT_SYMBOL_GPL(visorchannel_id); char * visorchannel_zoneid(VISORCHANNEL *channel, char *s) { - return visorchannel_uuid_id(&channel->chan_hdr.ZoneGuid, s); + return visorchannel_uuid_id(&channel->chan_hdr.zone_uuid, s); } EXPORT_SYMBOL_GPL(visorchannel_zoneid); HOSTADDRESS visorchannel_get_clientpartition(VISORCHANNEL *channel) { - return channel->chan_hdr.PartitionHandle; + return channel->chan_hdr.partition_handle; } EXPORT_SYMBOL_GPL(visorchannel_get_clientpartition); @@ -212,7 +212,7 @@ visorchannel_get_uuid(VISORCHANNEL *channel) } EXPORT_SYMBOL_GPL(visorchannel_get_uuid); -MEMREGION * +struct memregion * visorchannel_get_memregion(VISORCHANNEL *channel) { return channel->memregion; @@ -225,8 +225,11 @@ visorchannel_read(VISORCHANNEL *channel, ulong offset, { int rc = visor_memregion_read(channel->memregion, offset, local, nbytes); - if ((rc >= 0) && (offset == 0) && (nbytes >= sizeof(CHANNEL_HEADER))) - memcpy(&channel->chan_hdr, local, sizeof(CHANNEL_HEADER)); + if ((rc >= 0) && (offset == 0) && + (nbytes >= sizeof(struct channel_header))) { + memcpy(&channel->chan_hdr, local, + sizeof(struct channel_header)); + } return rc; } EXPORT_SYMBOL_GPL(visorchannel_read); @@ -235,8 +238,9 @@ int visorchannel_write(VISORCHANNEL *channel, ulong offset, void *local, ulong nbytes) { - if (offset == 0 && nbytes >= sizeof(CHANNEL_HEADER)) - memcpy(&channel->chan_hdr, local, sizeof(CHANNEL_HEADER)); + if (offset == 0 && nbytes >= sizeof(struct channel_header)) + memcpy(&channel->chan_hdr, local, + sizeof(struct channel_header)); return visor_memregion_write(channel->memregion, offset, local, nbytes); } EXPORT_SYMBOL_GPL(visorchannel_write); @@ -251,7 +255,7 @@ visorchannel_clear(VISORCHANNEL *channel, ulong offset, u8 ch, ulong nbytes) if (buf == NULL) { ERRDRV("%s failed memory allocation", __func__); - goto Away; + goto cleanup; } memset(buf, ch, bufsize); while (nbytes > 0) { @@ -264,14 +268,14 @@ visorchannel_clear(VISORCHANNEL *channel, ulong offset, u8 ch, ulong nbytes) buf, thisbytes); if (x < 0) { rc = x; - goto Away; + goto cleanup; } written += thisbytes; nbytes -= thisbytes; } rc = 0; -Away: +cleanup: if (buf != NULL) { vfree(buf); buf = NULL; @@ -283,7 +287,7 @@ EXPORT_SYMBOL_GPL(visorchannel_clear); void __iomem * visorchannel_get_header(VISORCHANNEL *channel) { - return (void __iomem *) &(channel->chan_hdr); + return (void __iomem *)&channel->chan_hdr; } EXPORT_SYMBOL_GPL(visorchannel_get_header); @@ -291,14 +295,15 @@ EXPORT_SYMBOL_GPL(visorchannel_get_header); * channel header */ #define SIG_QUEUE_OFFSET(chan_hdr, q) \ - ((chan_hdr)->oChannelSpace + ((q) * sizeof(SIGNAL_QUEUE_HEADER))) + ((chan_hdr)->ch_space_offset + \ + ((q) * sizeof(struct signal_queue_header))) /** Return offset of a specific queue entry (data) from the beginning of a * channel header */ #define SIG_DATA_OFFSET(chan_hdr, q, sig_hdr, slot) \ - (SIG_QUEUE_OFFSET(chan_hdr, q) + (sig_hdr)->oSignalBase + \ - ((slot) * (sig_hdr)->SignalSize)) + (SIG_QUEUE_OFFSET(chan_hdr, q) + (sig_hdr)->sig_base_offset + \ + ((slot) * (sig_hdr)->signal_size)) /** Write the contents of a specific field within a SIGNAL_QUEUE_HEADER back * into host memory @@ -306,39 +311,42 @@ EXPORT_SYMBOL_GPL(visorchannel_get_header); #define SIG_WRITE_FIELD(channel, queue, sig_hdr, FIELD) \ (visor_memregion_write(channel->memregion, \ SIG_QUEUE_OFFSET(&channel->chan_hdr, queue)+ \ - offsetof(SIGNAL_QUEUE_HEADER, FIELD), \ + offsetof(struct signal_queue_header, FIELD),\ &((sig_hdr)->FIELD), \ sizeof((sig_hdr)->FIELD)) >= 0) static BOOL sig_read_header(VISORCHANNEL *channel, u32 queue, - SIGNAL_QUEUE_HEADER *sig_hdr) + struct signal_queue_header *sig_hdr) { BOOL rc = FALSE; - if (channel->chan_hdr.oChannelSpace < sizeof(CHANNEL_HEADER)) { + if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header)) { ERRDRV("oChannelSpace too small: (status=%d)\n", rc); - goto Away; + goto cleanup; } /* Read the appropriate SIGNAL_QUEUE_HEADER into local memory. */ if (visor_memregion_read(channel->memregion, SIG_QUEUE_OFFSET(&channel->chan_hdr, queue), - sig_hdr, sizeof(SIGNAL_QUEUE_HEADER)) < 0) { + sig_hdr, + sizeof(struct signal_queue_header)) < 0) { ERRDRV("queue=%d SIG_QUEUE_OFFSET=%d", queue, (int)SIG_QUEUE_OFFSET(&channel->chan_hdr, queue)); - ERRDRV("visor_memregion_read of signal queue failed: (status=%d)\n", rc); - goto Away; + ERRDRV("visor_memregion_read of signal queue failed: (status=%d)\n", + rc); + goto cleanup; } rc = TRUE; -Away: +cleanup: return rc; } static BOOL sig_do_data(VISORCHANNEL *channel, u32 queue, - SIGNAL_QUEUE_HEADER *sig_hdr, u32 slot, void *data, BOOL is_write) + struct signal_queue_header *sig_hdr, u32 slot, void *data, + BOOL is_write) { BOOL rc = FALSE; int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue, @@ -346,53 +354,55 @@ sig_do_data(VISORCHANNEL *channel, u32 queue, if (is_write) { if (visor_memregion_write(channel->memregion, signal_data_offset, - data, sig_hdr->SignalSize) < 0) { - ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n", rc); - goto Away; + data, sig_hdr->signal_size) < 0) { + ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n", + rc); + goto cleanup; } } else { if (visor_memregion_read(channel->memregion, signal_data_offset, - data, sig_hdr->SignalSize) < 0) { - ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n", rc); - goto Away; + data, sig_hdr->signal_size) < 0) { + ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n", + rc); + goto cleanup; } } rc = TRUE; -Away: +cleanup: return rc; } static inline BOOL sig_read_data(VISORCHANNEL *channel, u32 queue, - SIGNAL_QUEUE_HEADER *sig_hdr, u32 slot, void *data) + struct signal_queue_header *sig_hdr, u32 slot, void *data) { return sig_do_data(channel, queue, sig_hdr, slot, data, FALSE); } static inline BOOL sig_write_data(VISORCHANNEL *channel, u32 queue, - SIGNAL_QUEUE_HEADER *sig_hdr, u32 slot, void *data) + struct signal_queue_header *sig_hdr, u32 slot, void *data) { return sig_do_data(channel, queue, sig_hdr, slot, data, TRUE); } static inline unsigned char -safe_sig_queue_validate(pSIGNAL_QUEUE_HEADER psafe_sqh, - pSIGNAL_QUEUE_HEADER punsafe_sqh, +safe_sig_queue_validate(struct signal_queue_header *psafe_sqh, + struct signal_queue_header *punsafe_sqh, u32 *phead, u32 *ptail) { - if ((*phead >= psafe_sqh->MaxSignalSlots) - || (*ptail >= psafe_sqh->MaxSignalSlots)) { + if ((*phead >= psafe_sqh->max_slots) || + (*ptail >= psafe_sqh->max_slots)) { /* Choose 0 or max, maybe based on current tail value */ *phead = 0; *ptail = 0; /* Sync with client as necessary */ - punsafe_sqh->Head = *phead; - punsafe_sqh->Tail = *ptail; + punsafe_sqh->head = *phead; + punsafe_sqh->tail = *ptail; ERRDRV("safe_sig_queue_validate: head = 0x%x, tail = 0x%x, MaxSlots = 0x%x", - *phead, *ptail, psafe_sqh->MaxSignalSlots); + *phead, *ptail, psafe_sqh->max_slots); return 0; } return 1; @@ -402,41 +412,42 @@ BOOL visorchannel_signalremove(VISORCHANNEL *channel, u32 queue, void *msg) { BOOL rc = FALSE; - SIGNAL_QUEUE_HEADER sig_hdr; + struct signal_queue_header sig_hdr; if (channel->needs_lock) spin_lock(&channel->remove_lock); if (!sig_read_header(channel, queue, &sig_hdr)) { rc = FALSE; - goto Away; + goto cleanup; } - if (sig_hdr.Head == sig_hdr.Tail) { + if (sig_hdr.head == sig_hdr.tail) { rc = FALSE; /* no signals to remove */ - goto Away; + goto cleanup; } - sig_hdr.Tail = (sig_hdr.Tail + 1) % sig_hdr.MaxSignalSlots; - if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.Tail, msg)) { + sig_hdr.tail = (sig_hdr.tail + 1) % sig_hdr.max_slots; + if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.tail, msg)) { ERRDRV("sig_read_data failed: (status=%d)\n", rc); - goto Away; + goto cleanup; } - sig_hdr.NumSignalsReceived++; + sig_hdr.num_received++; /* For each data field in SIGNAL_QUEUE_HEADER that was modified, * update host memory. */ mb(); /* required for channel synch */ - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Tail)) { + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail)) { ERRDRV("visor_memregion_write of Tail failed: (status=%d)\n", rc); - goto Away; + goto cleanup; } - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsReceived)) { - ERRDRV("visor_memregion_write of NumSignalsReceived failed: (status=%d)\n", rc); - goto Away; + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received)) { + ERRDRV("visor_memregion_write of NumSignalsReceived failed: (status=%d)\n", + rc); + goto cleanup; } rc = TRUE; -Away: +cleanup: if (channel->needs_lock) spin_unlock(&channel->remove_lock); @@ -448,48 +459,50 @@ BOOL visorchannel_signalinsert(VISORCHANNEL *channel, u32 queue, void *msg) { BOOL rc = FALSE; - SIGNAL_QUEUE_HEADER sig_hdr; + struct signal_queue_header sig_hdr; if (channel->needs_lock) spin_lock(&channel->insert_lock); if (!sig_read_header(channel, queue, &sig_hdr)) { rc = FALSE; - goto Away; + goto cleanup; } - sig_hdr.Head = ((sig_hdr.Head + 1) % sig_hdr.MaxSignalSlots); - if (sig_hdr.Head == sig_hdr.Tail) { - sig_hdr.NumOverflows++; - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumOverflows)) { - ERRDRV("visor_memregion_write of NumOverflows failed: (status=%d)\n", rc); - goto Away; + sig_hdr.head = ((sig_hdr.head + 1) % sig_hdr.max_slots); + if (sig_hdr.head == sig_hdr.tail) { + sig_hdr.num_overflows++; + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_overflows)) { + ERRDRV("visor_memregion_write of NumOverflows failed: (status=%d)\n", + rc); + goto cleanup; } rc = FALSE; - goto Away; + goto cleanup; } - if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.Head, msg)) { + if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg)) { ERRDRV("sig_write_data failed: (status=%d)\n", rc); - goto Away; + goto cleanup; } - sig_hdr.NumSignalsSent++; + sig_hdr.num_sent++; /* For each data field in SIGNAL_QUEUE_HEADER that was modified, * update host memory. */ mb(); /* required for channel synch */ - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Head)) { + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, head)) { ERRDRV("visor_memregion_write of Head failed: (status=%d)\n", rc); - goto Away; + goto cleanup; } - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsSent)) { - ERRDRV("visor_memregion_write of NumSignalsSent failed: (status=%d)\n", rc); - goto Away; + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_sent)) { + ERRDRV("visor_memregion_write of NumSignalsSent failed: (status=%d)\n", + rc); + goto cleanup; } rc = TRUE; -Away: +cleanup: if (channel->needs_lock) spin_unlock(&channel->insert_lock); @@ -497,59 +510,58 @@ Away: } EXPORT_SYMBOL_GPL(visorchannel_signalinsert); - int visorchannel_signalqueue_slots_avail(VISORCHANNEL *channel, u32 queue) { - SIGNAL_QUEUE_HEADER sig_hdr; + struct signal_queue_header sig_hdr; u32 slots_avail, slots_used; u32 head, tail; if (!sig_read_header(channel, queue, &sig_hdr)) return 0; - head = sig_hdr.Head; - tail = sig_hdr.Tail; + head = sig_hdr.head; + tail = sig_hdr.tail; if (head < tail) - head = head + sig_hdr.MaxSignalSlots; + head = head + sig_hdr.max_slots; slots_used = (head - tail); - slots_avail = sig_hdr.MaxSignals - slots_used; - return (int) slots_avail; + slots_avail = sig_hdr.max_signals - slots_used; + return (int)slots_avail; } EXPORT_SYMBOL_GPL(visorchannel_signalqueue_slots_avail); int visorchannel_signalqueue_max_slots(VISORCHANNEL *channel, u32 queue) { - SIGNAL_QUEUE_HEADER sig_hdr; + struct signal_queue_header sig_hdr; if (!sig_read_header(channel, queue, &sig_hdr)) return 0; - return (int) sig_hdr.MaxSignals; + return (int)sig_hdr.max_signals; } EXPORT_SYMBOL_GPL(visorchannel_signalqueue_max_slots); static void -sigqueue_debug(SIGNAL_QUEUE_HEADER *q, int which, struct seq_file *seq) +sigqueue_debug(struct signal_queue_header *q, int which, struct seq_file *seq) { seq_printf(seq, "Signal Queue #%d\n", which); - seq_printf(seq, " VersionId = %lu\n", (ulong) q->VersionId); - seq_printf(seq, " Type = %lu\n", (ulong) q->Type); + seq_printf(seq, " VersionId = %lu\n", (ulong)q->version); + seq_printf(seq, " Type = %lu\n", (ulong)q->chtype); seq_printf(seq, " oSignalBase = %llu\n", - (long long) q->oSignalBase); - seq_printf(seq, " SignalSize = %lu\n", (ulong) q->SignalSize); + (long long)q->sig_base_offset); + seq_printf(seq, " SignalSize = %lu\n", (ulong)q->signal_size); seq_printf(seq, " MaxSignalSlots = %lu\n", - (ulong) q->MaxSignalSlots); - seq_printf(seq, " MaxSignals = %lu\n", (ulong) q->MaxSignals); + (ulong)q->max_slots); + seq_printf(seq, " MaxSignals = %lu\n", (ulong)q->max_signals); seq_printf(seq, " FeatureFlags = %-16.16Lx\n", - (long long) q->FeatureFlags); + (long long)q->features); seq_printf(seq, " NumSignalsSent = %llu\n", - (long long) q->NumSignalsSent); + (long long)q->num_sent); seq_printf(seq, " NumSignalsReceived = %llu\n", - (long long) q->NumSignalsReceived); + (long long)q->num_received); seq_printf(seq, " NumOverflows = %llu\n", - (long long) q->NumOverflows); - seq_printf(seq, " Head = %lu\n", (ulong) q->Head); - seq_printf(seq, " Tail = %lu\n", (ulong) q->Tail); + (long long)q->num_overflows); + seq_printf(seq, " Head = %lu\n", (ulong)q->head); + seq_printf(seq, " Tail = %lu\n", (ulong)q->tail); } void @@ -558,9 +570,9 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, { HOSTADDRESS addr = 0; ulong nbytes = 0, nbytes_region = 0; - MEMREGION *memregion = NULL; - CHANNEL_HEADER hdr; - CHANNEL_HEADER *phdr = &hdr; + struct memregion *memregion = NULL; + struct channel_header hdr; + struct channel_header *phdr = &hdr; int i = 0; int errcode = 0; @@ -576,7 +588,7 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, addr = visor_memregion_get_physaddr(memregion); nbytes_region = visor_memregion_get_nbytes(memregion); errcode = visorchannel_read(channel, off, - phdr, sizeof(CHANNEL_HEADER)); + phdr, sizeof(struct channel_header)); if (errcode < 0) { seq_printf(seq, "Read of channel header failed with errcode=%d)\n", @@ -584,39 +596,41 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, if (off == 0) { phdr = &channel->chan_hdr; seq_puts(seq, "(following data may be stale)\n"); - } else + } else { return; + } } - nbytes = (ulong) (phdr->Size); + nbytes = (ulong)(phdr->size); seq_printf(seq, "--- Begin channel @0x%-16.16Lx for 0x%lx bytes (region=0x%lx bytes) ---\n", addr + off, nbytes, nbytes_region); - seq_printf(seq, "Type = %pUL\n", &phdr->Type); - seq_printf(seq, "ZoneGuid = %pUL\n", &phdr->ZoneGuid); + seq_printf(seq, "Type = %pUL\n", &phdr->chtype); + seq_printf(seq, "ZoneGuid = %pUL\n", &phdr->zone_uuid); seq_printf(seq, "Signature = 0x%-16.16Lx\n", - (long long) phdr->Signature); - seq_printf(seq, "LegacyState = %lu\n", (ulong) phdr->LegacyState); - seq_printf(seq, "SrvState = %lu\n", (ulong) phdr->SrvState); - seq_printf(seq, "CliStateBoot = %lu\n", (ulong) phdr->CliStateBoot); - seq_printf(seq, "CliStateOS = %lu\n", (ulong) phdr->CliStateOS); - seq_printf(seq, "HeaderSize = %lu\n", (ulong) phdr->HeaderSize); - seq_printf(seq, "Size = %llu\n", (long long) phdr->Size); + (long long)phdr->signature); + seq_printf(seq, "LegacyState = %lu\n", (ulong)phdr->legacy_state); + seq_printf(seq, "SrvState = %lu\n", (ulong)phdr->srv_state); + seq_printf(seq, "CliStateBoot = %lu\n", (ulong)phdr->cli_state_boot); + seq_printf(seq, "CliStateOS = %lu\n", (ulong)phdr->cli_state_os); + seq_printf(seq, "HeaderSize = %lu\n", (ulong)phdr->header_size); + seq_printf(seq, "Size = %llu\n", (long long)phdr->size); seq_printf(seq, "Features = 0x%-16.16llx\n", - (long long) phdr->Features); + (long long)phdr->features); seq_printf(seq, "PartitionHandle = 0x%-16.16llx\n", - (long long) phdr->PartitionHandle); + (long long)phdr->partition_handle); seq_printf(seq, "Handle = 0x%-16.16llx\n", - (long long) phdr->Handle); - seq_printf(seq, "VersionId = %lu\n", (ulong) phdr->VersionId); + (long long)phdr->handle); + seq_printf(seq, "VersionId = %lu\n", (ulong)phdr->version_id); seq_printf(seq, "oChannelSpace = %llu\n", - (long long) phdr->oChannelSpace); - if ((phdr->oChannelSpace == 0) || (errcode < 0)) + (long long)phdr->ch_space_offset); + if ((phdr->ch_space_offset == 0) || (errcode < 0)) ; else for (i = 0; i < nQueues; i++) { - SIGNAL_QUEUE_HEADER q; + struct signal_queue_header q; errcode = visorchannel_read(channel, - off + phdr->oChannelSpace + + off + + phdr->ch_space_offset + (i * sizeof(q)), &q, sizeof(q)); if (errcode < 0) { @@ -643,15 +657,17 @@ visorchannel_dump_section(VISORCHANNEL *chan, char *s, fmtbufsize = 100 * COVQ(len, 16); buf = kmalloc(len, GFP_KERNEL|__GFP_NORETRY); + if (!buf) + return; fmtbuf = kmalloc(fmtbufsize, GFP_KERNEL|__GFP_NORETRY); - if (buf == NULL || fmtbuf == NULL) - goto Away; + if (!fmtbuf) + goto fmt_failed; errcode = visorchannel_read(chan, off, buf, len); if (errcode < 0) { ERRDRV("%s failed to read %s from channel errcode=%d", s, __func__, errcode); - goto Away; + goto read_failed; } seq_printf(seq, "channel %s:\n", s); tbuf = buf; @@ -663,14 +679,9 @@ visorchannel_dump_section(VISORCHANNEL *chan, char *s, len -= 16; } -Away: - if (buf != NULL) { - kfree(buf); - buf = NULL; - } - if (fmtbuf != NULL) { - kfree(fmtbuf); - fmtbuf = NULL; - } +read_failed: + kfree(fmtbuf); +fmt_failed: + kfree(buf); } EXPORT_SYMBOL_GPL(visorchannel_dump_section); diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 3321764069de..373fa36b7119 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -155,9 +155,9 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma) return -ENXIO; } visorchannel_read(*PControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - gpControlChannel), &addr, - sizeof(addr)); + offsetof(struct spar_controlvm_channel_protocol, + gp_control_channel), + &addr, sizeof(addr)); if (addr == 0) { ERRDRV("%s control channel address is 0", __func__); return -ENXIO; diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 661aaae9b154..9edbd3bbd186 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -47,8 +47,8 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, int allocbytes = sizeof(PARSER_CONTEXT) + bytes; PARSER_CONTEXT *rc = NULL; PARSER_CONTEXT *ctx = NULL; - MEMREGION *rgn = NULL; - ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL; + struct memregion *rgn = NULL; + struct spar_controlvm_parameters_header *phdr = NULL; if (tryAgain) *tryAgain = FALSE; @@ -110,27 +110,29 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, rc = ctx; goto Away; } - phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data); - if (phdr->TotalLength != bytes) { + phdr = (struct spar_controlvm_parameters_header *)(ctx->data); + if (phdr->total_length != bytes) { ERRDRV("%s - bad total length %lu (should be %lu)", __func__, - (ulong) (phdr->TotalLength), (ulong) (bytes)); + (ulong) (phdr->total_length), (ulong) (bytes)); rc = NULL; goto Away; } - if (phdr->TotalLength < phdr->HeaderLength) { + if (phdr->total_length < phdr->header_length) { ERRDRV("%s - total length < header length (%lu < %lu)", __func__, - (ulong) (phdr->TotalLength), - (ulong) (phdr->HeaderLength)); + (ulong) (phdr->total_length), + (ulong) (phdr->header_length)); rc = NULL; goto Away; } - if (phdr->HeaderLength < sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)) { + if (phdr->header_length < + sizeof(struct spar_controlvm_parameters_header)) { ERRDRV("%s - header is too small (%lu < %lu)", __func__, - (ulong) (phdr->HeaderLength), - (ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER))); + (ulong) (phdr->header_length), + (ulong)(sizeof( + struct spar_controlvm_parameters_header))); rc = NULL; goto Away; } @@ -159,7 +161,7 @@ parser_init(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain) } /* Call this instead of parser_init() if the payload area consists of just - * a sequence of bytes, rather than a ULTRA_CONTROLVM_PARAMETERS_HEADER + * a sequence of bytes, rather than a struct spar_controlvm_parameters_header * structures. Afterwards, you can call parser_simpleString_get() or * parser_byteStream_get() to obtain the data. */ @@ -196,44 +198,44 @@ parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes) uuid_le parser_id_get(PARSER_CONTEXT *ctx) { - ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL; + struct spar_controlvm_parameters_header *phdr = NULL; if (ctx == NULL) { ERRDRV("%s (%s:%d) - no context", __func__, __FILE__, __LINE__); return NULL_UUID_LE; } - phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data); - return phdr->Id; + phdr = (struct spar_controlvm_parameters_header *)(ctx->data); + return phdr->id; } void parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string) { - ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL; + struct spar_controlvm_parameters_header *phdr = NULL; if (ctx == NULL) { ERRDRV("%s (%s:%d) - no context", __func__, __FILE__, __LINE__); goto Away; } - phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data); + phdr = (struct spar_controlvm_parameters_header *)(ctx->data); switch (which_string) { case PARSERSTRING_INITIATOR: - ctx->curr = ctx->data + phdr->InitiatorOffset; - ctx->bytes_remaining = phdr->InitiatorLength; + ctx->curr = ctx->data + phdr->initiator_offset; + ctx->bytes_remaining = phdr->initiator_length; break; case PARSERSTRING_TARGET: - ctx->curr = ctx->data + phdr->TargetOffset; - ctx->bytes_remaining = phdr->TargetLength; + ctx->curr = ctx->data + phdr->target_offset; + ctx->bytes_remaining = phdr->target_length; break; case PARSERSTRING_CONNECTION: - ctx->curr = ctx->data + phdr->ConnectionOffset; - ctx->bytes_remaining = phdr->ConnectionLength; + ctx->curr = ctx->data + phdr->connection_offset; + ctx->bytes_remaining = phdr->connection_length; break; case PARSERSTRING_NAME: - ctx->curr = ctx->data + phdr->NameOffset; - ctx->bytes_remaining = phdr->NameLength; + ctx->curr = ctx->data + phdr->name_offset; + ctx->bytes_remaining = phdr->name_length; break; default: ERRDRV("%s - bad which_string %d", __func__, which_string); diff --git a/drivers/staging/unisys/visorchipset/testing.h b/drivers/staging/unisys/visorchipset/testing.h index 015d502cbb16..573aa8b5ba6a 100644 --- a/drivers/staging/unisys/visorchipset/testing.h +++ b/drivers/staging/unisys/visorchipset/testing.h @@ -23,8 +23,9 @@ #include "globals.h" #include "controlvmchannel.h" -void test_produce_test_message(CONTROLVM_MESSAGE *msg, int isLocalTestAddr); -BOOL test_consume_test_message(CONTROLVM_MESSAGE *msg); +void test_produce_test_message(struct controlvm_message *msg, + int isLocalTestAddr); +BOOL test_consume_test_message(struct controlvm_message *msg); void test_manufacture_vnic_client_add(void *p); void test_manufacture_vnic_client_add_phys(HOSTADDRESS addr); void test_manufacture_preamble_messages(void); diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h index 2bf2e2f368ef..46dad63fa2c8 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset.h +++ b/drivers/staging/unisys/visorchipset/visorchipset.h @@ -31,85 +31,85 @@ /** Describes the state from the perspective of which controlvm messages have * been received for a bus or device. */ -typedef struct { +struct visorchipset_state { u32 created:1; u32 attached:1; u32 configured:1; u32 running:1; /* Add new fields above. */ /* Remaining bits in this 32-bit word are unused. */ -} VISORCHIPSET_STATE; +}; -typedef enum { +enum visorchipset_addresstype { /** address is guest physical, but outside of the physical memory * region that is controlled by the running OS (this is the normal * address type for Supervisor channels) */ - ADDRTYPE_localPhysical, + ADDRTYPE_LOCALPHYSICAL, /** address is guest physical, and withIN the confines of the * physical memory controlled by the running OS. */ - ADDRTYPE_localTest, -} VISORCHIPSET_ADDRESSTYPE; + ADDRTYPE_LOCALTEST, +}; -typedef enum { - CRASH_dev, - CRASH_bus, -} CRASH_OBJ_TYPE; +enum crash_obj_type { + CRASH_DEV, + CRASH_BUS, +}; /** Attributes for a particular Supervisor channel. */ -typedef struct { - VISORCHIPSET_ADDRESSTYPE addrType; - HOSTADDRESS channelAddr; - struct InterruptInfo intr; - u64 nChannelBytes; - uuid_le channelTypeGuid; - uuid_le channelInstGuid; +struct visorchipset_channel_info { + enum visorchipset_addresstype addr_type; + HOSTADDRESS channel_addr; + struct irq_info intr; + u64 n_channel_bytes; + uuid_le channel_type_uuid; + uuid_le channel_inst_uuid; -} VISORCHIPSET_CHANNEL_INFO; +}; /** Attributes for a particular Supervisor device. * Any visorchipset client can query these attributes using * visorchipset_get_client_device_info() or * visorchipset_get_server_device_info(). */ -typedef struct { +struct visorchipset_device_info { struct list_head entry; - u32 busNo; - u32 devNo; - uuid_le devInstGuid; - VISORCHIPSET_STATE state; - VISORCHIPSET_CHANNEL_INFO chanInfo; - u32 Reserved1; /* CONTROLVM_ID */ - u64 Reserved2; - u32 switchNo; /* when devState.attached==1 */ - u32 internalPortNo; /* when devState.attached==1 */ - CONTROLVM_MESSAGE_HEADER pendingMsgHdr; /* CONTROLVM_MESSAGE */ + u32 bus_no; + u32 dev_no; + uuid_le dev_inst_uuid; + struct visorchipset_state state; + struct visorchipset_channel_info chan_info; + u32 reserved1; /* control_vm_id */ + u64 reserved2; + u32 switch_no; /* when devState.attached==1 */ + u32 internal_port_no; /* when devState.attached==1 */ + struct controlvm_message_header pending_msg_hdr;/* CONTROLVM_MESSAGE */ /** For private use by the bus driver */ void *bus_driver_context; -} VISORCHIPSET_DEVICE_INFO; +}; -static inline VISORCHIPSET_DEVICE_INFO * -finddevice(struct list_head *list, u32 busNo, u32 devNo) +static inline struct visorchipset_device_info *finddevice( + struct list_head *list, u32 bus_no, u32 dev_no) { - VISORCHIPSET_DEVICE_INFO *p; + struct visorchipset_device_info *p; list_for_each_entry(p, list, entry) { - if (p->busNo == busNo && p->devNo == devNo) + if (p->bus_no == bus_no && p->dev_no == dev_no) return p; } return NULL; } -static inline void delbusdevices(struct list_head *list, u32 busNo) +static inline void delbusdevices(struct list_head *list, u32 bus_no) { - VISORCHIPSET_DEVICE_INFO *p, *tmp; + struct visorchipset_device_info *p, *tmp; list_for_each_entry_safe(p, tmp, list, entry) { - if (p->busNo == busNo) { + if (p->bus_no == bus_no) { list_del(&p->entry); kfree(p); } @@ -122,37 +122,37 @@ static inline void delbusdevices(struct list_head *list, u32 busNo) * Any visorchipset client can query these attributes using * visorchipset_get_client_bus_info() or visorchipset_get_bus_info(). */ -typedef struct { +struct visorchipset_bus_info { struct list_head entry; - u32 busNo; - VISORCHIPSET_STATE state; - VISORCHIPSET_CHANNEL_INFO chanInfo; - uuid_le partitionGuid; - u64 partitionHandle; + u32 bus_no; + struct visorchipset_state state; + struct visorchipset_channel_info chan_info; + uuid_le partition_uuid; + u64 partition_handle; u8 *name; /* UTF8 */ u8 *description; /* UTF8 */ - u64 Reserved1; - u32 Reserved2; - MYPROCOBJECT *procObject; + u64 reserved1; + u32 reserved2; + MYPROCOBJECT *proc_object; struct { u32 server:1; /* Add new fields above. */ /* Remaining bits in this 32-bit word are unused. */ } flags; - CONTROLVM_MESSAGE_HEADER pendingMsgHdr; /* CONTROLVM MsgHdr */ + struct controlvm_message_header pending_msg_hdr;/* CONTROLVM MsgHdr */ /** For private use by the bus driver */ void *bus_driver_context; - u64 devNo; + u64 dev_no; -} VISORCHIPSET_BUS_INFO; +}; -static inline VISORCHIPSET_BUS_INFO * -findbus(struct list_head *list, u32 busNo) +static inline struct visorchipset_bus_info * +findbus(struct list_head *list, u32 bus_no) { - VISORCHIPSET_BUS_INFO *p; + struct visorchipset_bus_info *p; list_for_each_entry(p, list, entry) { - if (p->busNo == busNo) + if (p->bus_no == bus_no) return p; } return NULL; @@ -160,75 +160,73 @@ findbus(struct list_head *list, u32 busNo) /** Attributes for a particular Supervisor switch. */ -typedef struct { - u32 switchNo; - VISORCHIPSET_STATE state; - uuid_le switchTypeGuid; - u8 *authService1; - u8 *authService2; - u8 *authService3; - u8 *securityContext; - u64 Reserved; - u32 Reserved2; /* CONTROLVM_ID */ +struct visorchipset_switch_info { + u32 switch_no; + struct visorchipset_state state; + uuid_le switch_type_uuid; + u8 *authservice1; + u8 *authservice2; + u8 *authservice3; + u8 *security_context; + u64 reserved; + u32 reserved2; /* control_vm_id */ struct device dev; BOOL dev_exists; - CONTROLVM_MESSAGE_HEADER pendingMsgHdr; - -} VISORCHIPSET_SWITCH_INFO; + struct controlvm_message_header pending_msg_hdr; +}; /** Attributes for a particular Supervisor external port, which is connected * to a specific switch. */ -typedef struct { - u32 switchNo; - u32 externalPortNo; - VISORCHIPSET_STATE state; - uuid_le networkZoneGuid; - int pdPort; +struct visorchipset_externalport_info { + u32 switch_no; + u32 external_port_no; + struct visorchipset_state state; + uuid_le network_zone_uuid; + int pd_port; u8 *ip; - u8 *ipNetmask; - u8 *ipBroadcast; - u8 *ipNetwork; - u8 *ipGateway; - u8 *ipDNS; - u64 Reserved1; - u32 Reserved2; /* CONTROLVM_ID */ + u8 *ip_netmask; + u8 *ip_broadcast; + u8 *ip_network; + u8 *ip_gateway; + u8 *ip_dns; + u64 reserved1; + u32 reserved2; /* control_vm_id */ struct device dev; BOOL dev_exists; - CONTROLVM_MESSAGE_HEADER pendingMsgHdr; - -} VISORCHIPSET_EXTERNALPORT_INFO; + struct controlvm_message_header pending_msg_hdr; +}; /** Attributes for a particular Supervisor internal port, which is how a * device connects to a particular switch. */ -typedef struct { - u32 switchNo; - u32 internalPortNo; - VISORCHIPSET_STATE state; - u32 busNo; /* valid only when state.attached == 1 */ - u32 devNo; /* valid only when state.attached == 1 */ - u64 Reserved1; - u32 Reserved2; /* CONTROLVM_ID */ - CONTROLVM_MESSAGE_HEADER pendingMsgHdr; - MYPROCOBJECT *procObject; - -} VISORCHIPSET_INTERNALPORT_INFO; +struct visorchipset_internalport_info { + u32 switch_no; + u32 internal_port_no; + struct visorchipset_state state; + u32 bus_no; /* valid only when state.attached == 1 */ + u32 dev_no; /* valid only when state.attached == 1 */ + u64 reserved1; + u32 reserved2; /* CONTROLVM_ID */ + struct controlvm_message_header pending_msg_hdr; + MYPROCOBJECT *proc_object; + +}; /* These functions will be called from within visorchipset when certain * events happen. (The implementation of these functions is outside of * visorchipset.) */ -typedef struct { - void (*bus_create)(ulong busNo); - void (*bus_destroy)(ulong busNo); - void (*device_create)(ulong busNo, ulong devNo); - void (*device_destroy)(ulong busNo, ulong devNo); - void (*device_pause)(ulong busNo, ulong devNo); - void (*device_resume)(ulong busNo, ulong devNo); - int (*get_channel_info)(uuid_le typeGuid, ulong *minSize, - ulong *maxSize); -} VISORCHIPSET_BUSDEV_NOTIFIERS; +struct visorchipset_busdev_notifiers { + void (*bus_create)(ulong bus_no); + void (*bus_destroy)(ulong bus_no); + void (*device_create)(ulong bus_no, ulong dev_no); + void (*device_destroy)(ulong bus_no, ulong dev_no); + void (*device_pause)(ulong bus_no, ulong dev_no); + void (*device_resume)(ulong bus_no, ulong dev_no); + int (*get_channel_info)(uuid_le type_uuid, ulong *min_size, + ulong *max_size); +}; /* These functions live inside visorchipset, and will be called to indicate * responses to specific events (by code outside of visorchipset). @@ -236,14 +234,14 @@ typedef struct { * 0 = it worked * -1 = it failed */ -typedef struct { - void (*bus_create)(ulong busNo, int response); - void (*bus_destroy)(ulong busNo, int response); - void (*device_create)(ulong busNo, ulong devNo, int response); - void (*device_destroy)(ulong busNo, ulong devNo, int response); - void (*device_pause)(ulong busNo, ulong devNo, int response); - void (*device_resume)(ulong busNo, ulong devNo, int response); -} VISORCHIPSET_BUSDEV_RESPONDERS; +struct visorchipset_busdev_responders { + void (*bus_create)(ulong bus_no, int response); + void (*bus_destroy)(ulong bus_no, int response); + void (*device_create)(ulong bus_no, ulong dev_no, int response); + void (*device_destroy)(ulong bus_no, ulong dev_no, int response); + void (*device_pause)(ulong bus_no, ulong dev_no, int response); + void (*device_resume)(ulong bus_no, ulong dev_no, int response); +}; /** Register functions (in the bus driver) to get called by visorchipset * whenever a bus or device appears for which this service partition is @@ -252,9 +250,10 @@ typedef struct { * responses. */ void -visorchipset_register_busdev_client(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, - VISORCHIPSET_BUSDEV_RESPONDERS *responders, - ULTRA_VBUS_DEVICEINFO *driverInfo); +visorchipset_register_busdev_client( + struct visorchipset_busdev_notifiers *notifiers, + struct visorchipset_busdev_responders *responders, + struct ultra_vbus_deviceinfo *driver_info); /** Register functions (in the bus driver) to get called by visorchipset * whenever a bus or device appears for which this service partition is @@ -263,47 +262,31 @@ visorchipset_register_busdev_client(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, * responses. */ void -visorchipset_register_busdev_server(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, - VISORCHIPSET_BUSDEV_RESPONDERS *responders, - ULTRA_VBUS_DEVICEINFO *driverInfo); +visorchipset_register_busdev_server( + struct visorchipset_busdev_notifiers *notifiers, + struct visorchipset_busdev_responders *responders, + struct ultra_vbus_deviceinfo *driver_info); -typedef void (*SPARREPORTEVENT_COMPLETE_FUNC) (CONTROLVM_MESSAGE *msg, +typedef void (*SPARREPORTEVENT_COMPLETE_FUNC) (struct controlvm_message *msg, int status); -void visorchipset_device_pause_response(ulong busNo, ulong devNo, int response); +void visorchipset_device_pause_response(ulong bus_no, ulong dev_no, + int response); -BOOL visorchipset_get_bus_info(ulong busNo, VISORCHIPSET_BUS_INFO *busInfo); -BOOL visorchipset_get_device_info(ulong busNo, ulong devNo, - VISORCHIPSET_DEVICE_INFO *devInfo); -BOOL visorchipset_get_switch_info(ulong switchNo, - VISORCHIPSET_SWITCH_INFO *switchInfo); -BOOL visorchipset_get_externalport_info(ulong switchNo, ulong externalPortNo, - VISORCHIPSET_EXTERNALPORT_INFO - *externalPortInfo); -BOOL visorchipset_set_bus_context(ulong busNo, void *context); -BOOL visorchipset_set_device_context(ulong busNo, ulong devNo, void *context); +BOOL visorchipset_get_bus_info(ulong bus_no, + struct visorchipset_bus_info *bus_info); +BOOL visorchipset_get_device_info(ulong bus_no, ulong dev_no, + struct visorchipset_device_info *dev_info); +BOOL visorchipset_set_bus_context(ulong bus_no, void *context); +BOOL visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context); int visorchipset_chipset_ready(void); int visorchipset_chipset_selftest(void); int visorchipset_chipset_notready(void); -void visorchipset_controlvm_respond_reportEvent(CONTROLVM_MESSAGE *msg, - void *payload); -void visorchipset_save_message(CONTROLVM_MESSAGE *msg, CRASH_OBJ_TYPE type); +void visorchipset_save_message(struct controlvm_message *msg, + enum crash_obj_type type); void *visorchipset_cache_alloc(struct kmem_cache *pool, BOOL ok_to_block, char *fn, int ln); void visorchipset_cache_free(struct kmem_cache *pool, void *p, char *fn, int ln); -#if defined(TRANSMITFILE_DEBUG) || defined(DEBUG) -#define DBG_GETFILE_PAYLOAD(msg, controlvm_header) \ - LOGINF(msg, \ - (ulong)controlvm_header.PayloadVmOffset, \ - (ulong)controlvm_header.PayloadMaxBytes) -#define DBG_GETFILE(fmt, ...) LOGINF(fmt, ##__VA_ARGS__) -#define DBG_PUTFILE(fmt, ...) LOGINF(fmt, ##__VA_ARGS__) -#else -#define DBG_GETFILE_PAYLOAD(msg, controlvm_header) -#define DBG_GETFILE(fmt, ...) -#define DBG_PUTFILE(fmt, ...) -#endif - #endif diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index e5df39554a1a..7e6be32cf7bb 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -72,26 +72,28 @@ static struct workqueue_struct *Periodic_controlvm_workqueue; static DEFINE_SEMAPHORE(NotifierLock); typedef struct { - CONTROLVM_MESSAGE message; + struct controlvm_message message; unsigned int crc; } MESSAGE_ENVELOPE; -static CONTROLVM_MESSAGE_HEADER g_DiagMsgHdr; -static CONTROLVM_MESSAGE_HEADER g_ChipSetMsgHdr; -static CONTROLVM_MESSAGE_HEADER g_DelDumpMsgHdr; +static struct controlvm_message_header g_DiagMsgHdr; +static struct controlvm_message_header g_ChipSetMsgHdr; +static struct controlvm_message_header g_DelDumpMsgHdr; static const uuid_le UltraDiagPoolChannelProtocolGuid = - ULTRA_DIAG_POOL_CHANNEL_PROTOCOL_GUID; + SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID; /* 0xffffff is an invalid Bus/Device number */ static ulong g_diagpoolBusNo = 0xffffff; static ulong g_diagpoolDevNo = 0xffffff; -static CONTROLVM_MESSAGE_PACKET g_DeviceChangeStatePacket; +static struct controlvm_message_packet g_DeviceChangeStatePacket; /* Only VNIC and VHBA channels are sent to visorclientbus (aka * "visorhackbus") */ #define FOR_VISORHACKBUS(channel_type_guid) \ - (((uuid_le_cmp(channel_type_guid, UltraVnicChannelProtocolGuid) == 0)\ - || (uuid_le_cmp(channel_type_guid, UltraVhbaChannelProtocolGuid) == 0))) + (((uuid_le_cmp(channel_type_guid,\ + spar_vnic_channel_protocol_uuid) == 0)\ + || (uuid_le_cmp(channel_type_guid,\ + spar_vhba_channel_protocol_uuid) == 0))) #define FOR_VISORBUS(channel_type_guid) (!(FOR_VISORHACKBUS(channel_type_guid))) #define is_diagpool_channel(channel_type_guid) \ @@ -112,12 +114,12 @@ typedef struct { /* Manages the request payload in the controlvm channel */ static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info; -static pCHANNEL_HEADER Test_Vnic_channel; +static struct channel_header *Test_Vnic_channel; typedef struct { - CONTROLVM_MESSAGE_HEADER Dumpcapture_header; - CONTROLVM_MESSAGE_HEADER Gettextdump_header; - CONTROLVM_MESSAGE_HEADER Dumpcomplete_header; + struct controlvm_message_header Dumpcapture_header; + struct controlvm_message_header Gettextdump_header; + struct controlvm_message_header Dumpcomplete_header; BOOL Gettextdump_outstanding; u32 crc32; ulong length; @@ -134,7 +136,7 @@ static LIVEDUMP_INFO LiveDump_info; * this scenario, we simply stash the controlvm message, then attempt to * process it again the next time controlvm_periodic_work() runs. */ -static CONTROLVM_MESSAGE ControlVm_Pending_Msg; +static struct controlvm_message ControlVm_Pending_Msg; static BOOL ControlVm_Pending_Msg_Valid = FALSE; /* Pool of struct putfile_buffer_entry, for keeping track of pending (incoming) @@ -180,7 +182,7 @@ struct putfile_request { u64 sig; /* PUTFILE_REQUEST_SIG */ /* header from original TransmitFile request */ - CONTROLVM_MESSAGE_HEADER controlvm_header; + struct controlvm_message_header controlvm_header; u64 file_request_number; /* from original TransmitFile request */ /* link to next struct putfile_request */ @@ -218,7 +220,7 @@ struct parahotplug_request { struct list_head list; int id; unsigned long expiration; - CONTROLVM_MESSAGE msg; + struct controlvm_message msg; }; static LIST_HEAD(Parahotplug_request_list); @@ -228,8 +230,8 @@ static void parahotplug_process_list(void); /* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE / * CONTROLVM_REPORTEVENT. */ -static VISORCHIPSET_BUSDEV_NOTIFIERS BusDev_Server_Notifiers; -static VISORCHIPSET_BUSDEV_NOTIFIERS BusDev_Client_Notifiers; +static struct visorchipset_busdev_notifiers BusDev_Server_Notifiers; +static struct visorchipset_busdev_notifiers BusDev_Client_Notifiers; static void bus_create_response(ulong busNo, int response); static void bus_destroy_response(ulong busNo, int response); @@ -237,7 +239,7 @@ static void device_create_response(ulong busNo, ulong devNo, int response); static void device_destroy_response(ulong busNo, ulong devNo, int response); static void device_resume_response(ulong busNo, ulong devNo, int response); -static VISORCHIPSET_BUSDEV_RESPONDERS BusDev_Responders = { +static struct visorchipset_busdev_responders BusDev_Responders = { .bus_create = bus_create_response, .bus_destroy = bus_destroy_response, .device_create = device_create_response, @@ -342,13 +344,14 @@ static struct platform_device Visorchipset_platform_device = { }; /* Function prototypes */ -static void controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response); -static void controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, - int response, - ULTRA_CHIPSET_FEATURE features); -static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER * - msgHdr, int response, - ULTRA_SEGMENT_STATE state); +static void controlvm_respond(struct controlvm_message_header *msgHdr, + int response); +static void controlvm_respond_chipset_init( + struct controlvm_message_header *msgHdr, int response, + enum ultra_chipset_feature features); +static void controlvm_respond_physdev_changestate( + struct controlvm_message_header *msgHdr, int response, + struct spar_segment_state state); static ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, @@ -357,8 +360,8 @@ static ssize_t toolaction_show(struct device *dev, u8 toolAction; visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - ToolAction), &toolAction, sizeof(u8)); + offsetof(struct spar_controlvm_channel_protocol, + tool_action), &toolAction, sizeof(u8)); return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction); } @@ -373,7 +376,7 @@ static ssize_t toolaction_store(struct device *dev, return -EINVAL; ret = visorchannel_write(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, ToolAction), + offsetof(struct spar_controlvm_channel_protocol, tool_action), &toolAction, sizeof(u8)); if (ret) @@ -385,14 +388,14 @@ static ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, char *buf) { - ULTRA_EFI_SPAR_INDICATION efiSparIndication; + struct efi_spar_indication efiSparIndication; visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - EfiSparIndication), &efiSparIndication, - sizeof(ULTRA_EFI_SPAR_INDICATION)); + offsetof(struct spar_controlvm_channel_protocol, + efi_spar_ind), &efiSparIndication, + sizeof(struct efi_spar_indication)); return scnprintf(buf, PAGE_SIZE, "%u\n", - efiSparIndication.BootToTool); + efiSparIndication.boot_to_tool); } static ssize_t boottotool_store(struct device *dev, @@ -400,17 +403,17 @@ static ssize_t boottotool_store(struct device *dev, const char *buf, size_t count) { int val, ret; - ULTRA_EFI_SPAR_INDICATION efiSparIndication; + struct efi_spar_indication efiSparIndication; if (kstrtoint(buf, 10, &val) != 0) return -EINVAL; - efiSparIndication.BootToTool = val; + efiSparIndication.boot_to_tool = val; ret = visorchannel_write(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - EfiSparIndication), + offsetof(struct spar_controlvm_channel_protocol, + efi_spar_ind), &(efiSparIndication), - sizeof(ULTRA_EFI_SPAR_INDICATION)); + sizeof(struct efi_spar_indication)); if (ret) return ret; @@ -423,7 +426,7 @@ static ssize_t error_show(struct device *dev, struct device_attribute *attr, u32 error; visorchannel_read(ControlVm_channel, offsetof( - ULTRA_CONTROLVM_CHANNEL_PROTOCOL, InstallationError), + struct spar_controlvm_channel_protocol, installation_error), &error, sizeof(u32)); return scnprintf(buf, PAGE_SIZE, "%i\n", error); } @@ -438,8 +441,8 @@ static ssize_t error_store(struct device *dev, struct device_attribute *attr, return -EINVAL; ret = visorchannel_write(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - InstallationError), + offsetof(struct spar_controlvm_channel_protocol, + installation_error), &error, sizeof(u32)); if (ret) return ret; @@ -452,7 +455,7 @@ static ssize_t textid_show(struct device *dev, struct device_attribute *attr, u32 textId; visorchannel_read(ControlVm_channel, offsetof( - ULTRA_CONTROLVM_CHANNEL_PROTOCOL, InstallationTextId), + struct spar_controlvm_channel_protocol, installation_text_id), &textId, sizeof(u32)); return scnprintf(buf, PAGE_SIZE, "%i\n", textId); } @@ -467,8 +470,8 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, return -EINVAL; ret = visorchannel_write(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - InstallationTextId), + offsetof(struct spar_controlvm_channel_protocol, + installation_text_id), &textId, sizeof(u32)); if (ret) return ret; @@ -482,8 +485,8 @@ static ssize_t remaining_steps_show(struct device *dev, u16 remainingSteps; visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - InstallationRemainingSteps), + offsetof(struct spar_controlvm_channel_protocol, + installation_remaining_steps), &remainingSteps, sizeof(u16)); return scnprintf(buf, PAGE_SIZE, "%hu\n", remainingSteps); @@ -499,8 +502,8 @@ static ssize_t remaining_steps_store(struct device *dev, return -EINVAL; ret = visorchannel_write(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - InstallationRemainingSteps), + offsetof(struct spar_controlvm_channel_protocol, + installation_remaining_steps), &remainingSteps, sizeof(u16)); if (ret) return ret; @@ -539,11 +542,11 @@ testUnicode(void) static void busInfo_clear(void *v) { - VISORCHIPSET_BUS_INFO *p = (VISORCHIPSET_BUS_INFO *) (v); + struct visorchipset_bus_info *p = (struct visorchipset_bus_info *) (v); - if (p->procObject) { - visor_proc_DestroyObject(p->procObject); - p->procObject = NULL; + if (p->proc_object) { + visor_proc_DestroyObject(p->proc_object); + p->proc_object = NULL; } kfree(p->name); p->name = NULL; @@ -552,16 +555,17 @@ busInfo_clear(void *v) p->description = NULL; p->state.created = 0; - memset(p, 0, sizeof(VISORCHIPSET_BUS_INFO)); + memset(p, 0, sizeof(struct visorchipset_bus_info)); } static void devInfo_clear(void *v) { - VISORCHIPSET_DEVICE_INFO *p = (VISORCHIPSET_DEVICE_INFO *) (v); + struct visorchipset_device_info *p = + (struct visorchipset_device_info *)(v); p->state.created = 0; - memset(p, 0, sizeof(VISORCHIPSET_DEVICE_INFO)); + memset(p, 0, sizeof(struct visorchipset_device_info)); } static u8 @@ -585,9 +589,10 @@ clear_chipset_events(void) } void -visorchipset_register_busdev_server(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, - VISORCHIPSET_BUSDEV_RESPONDERS *responders, - ULTRA_VBUS_DEVICEINFO *driverInfo) +visorchipset_register_busdev_server( + struct visorchipset_busdev_notifiers *notifiers, + struct visorchipset_busdev_responders *responders, + struct ultra_vbus_deviceinfo *driver_info) { down(&NotifierLock); if (notifiers == NULL) { @@ -600,8 +605,8 @@ visorchipset_register_busdev_server(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, } if (responders) *responders = BusDev_Responders; - if (driverInfo) - bus_device_info_init(driverInfo, "chipset", "visorchipset", + if (driver_info) + bus_device_info_init(driver_info, "chipset", "visorchipset", VERSION, NULL); up(&NotifierLock); @@ -609,9 +614,10 @@ visorchipset_register_busdev_server(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, EXPORT_SYMBOL_GPL(visorchipset_register_busdev_server); void -visorchipset_register_busdev_client(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, - VISORCHIPSET_BUSDEV_RESPONDERS *responders, - ULTRA_VBUS_DEVICEINFO *driverInfo) +visorchipset_register_busdev_client( + struct visorchipset_busdev_notifiers *notifiers, + struct visorchipset_busdev_responders *responders, + struct ultra_vbus_deviceinfo *driver_info) { down(&NotifierLock); if (notifiers == NULL) { @@ -624,9 +630,9 @@ visorchipset_register_busdev_client(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers, } if (responders) *responders = BusDev_Responders; - if (driverInfo) - bus_device_info_init(driverInfo, "chipset(bolts)", "visorchipset", - VERSION, NULL); + if (driver_info) + bus_device_info_init(driver_info, "chipset(bolts)", + "visorchipset", VERSION, NULL); up(&NotifierLock); } EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client); @@ -634,8 +640,8 @@ EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client); static void cleanup_controlvm_structures(void) { - VISORCHIPSET_BUS_INFO *bi, *tmp_bi; - VISORCHIPSET_DEVICE_INFO *di, *tmp_di; + struct visorchipset_bus_info *bi, *tmp_bi; + struct visorchipset_device_info *di, *tmp_di; list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) { busInfo_clear(bi); @@ -651,10 +657,10 @@ cleanup_controlvm_structures(void) } static void -chipset_init(CONTROLVM_MESSAGE *inmsg) +chipset_init(struct controlvm_message *inmsg) { static int chipset_inited; - ULTRA_CHIPSET_FEATURE features = 0; + enum ultra_chipset_feature features = 0; int rc = CONTROLVM_RESP_SUCCESS; POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO); @@ -669,7 +675,7 @@ chipset_init(CONTROLVM_MESSAGE *inmsg) /* Set features to indicate we support parahotplug (if Command * also supports it). */ features = - inmsg->cmd.initChipset. + inmsg->cmd.init_chipset. features & ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG; /* Set the "reply" bit so Command knows this is a @@ -679,42 +685,42 @@ chipset_init(CONTROLVM_MESSAGE *inmsg) Away: if (rc < 0) cleanup_controlvm_structures(); - if (inmsg->hdr.Flags.responseExpected) + if (inmsg->hdr.flags.response_expected) controlvm_respond_chipset_init(&inmsg->hdr, rc, features); } static void -controlvm_init_response(CONTROLVM_MESSAGE *msg, - CONTROLVM_MESSAGE_HEADER *msgHdr, int response) -{ - memset(msg, 0, sizeof(CONTROLVM_MESSAGE)); - memcpy(&msg->hdr, msgHdr, sizeof(CONTROLVM_MESSAGE_HEADER)); - msg->hdr.PayloadBytes = 0; - msg->hdr.PayloadVmOffset = 0; - msg->hdr.PayloadMaxBytes = 0; +controlvm_init_response(struct controlvm_message *msg, + struct controlvm_message_header *msgHdr, int response) +{ + memset(msg, 0, sizeof(struct controlvm_message)); + memcpy(&msg->hdr, msgHdr, sizeof(struct controlvm_message_header)); + msg->hdr.payload_bytes = 0; + msg->hdr.payload_vm_offset = 0; + msg->hdr.payload_max_bytes = 0; if (response < 0) { - msg->hdr.Flags.failed = 1; - msg->hdr.CompletionStatus = (u32) (-response); + msg->hdr.flags.failed = 1; + msg->hdr.completion_status = (u32) (-response); } } static void -controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response) +controlvm_respond(struct controlvm_message_header *msgHdr, int response) { - CONTROLVM_MESSAGE outmsg; + struct controlvm_message outmsg; controlvm_init_response(&outmsg, msgHdr, response); /* For DiagPool channel DEVICE_CHANGESTATE, we need to send * back the deviceChangeState structure in the packet. */ - if (msgHdr->Id == CONTROLVM_DEVICE_CHANGESTATE - && g_DeviceChangeStatePacket.deviceChangeState.busNo == + if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE + && g_DeviceChangeStatePacket.device_change_state.bus_no == g_diagpoolBusNo - && g_DeviceChangeStatePacket.deviceChangeState.devNo == + && g_DeviceChangeStatePacket.device_change_state.dev_no == g_diagpoolDevNo) outmsg.cmd = g_DeviceChangeStatePacket; - if (outmsg.hdr.Flags.testMessage == 1) { + if (outmsg.hdr.flags.test_message == 1) { LOGINF("%s controlvm_msg=0x%x response=%d for test message", - __func__, outmsg.hdr.Id, response); + __func__, outmsg.hdr.id, response); return; } if (!visorchannel_signalinsert(ControlVm_channel, @@ -725,13 +731,14 @@ controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response) } static void -controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response, - ULTRA_CHIPSET_FEATURE features) +controlvm_respond_chipset_init(struct controlvm_message_header *msgHdr, + int response, + enum ultra_chipset_feature features) { - CONTROLVM_MESSAGE outmsg; + struct controlvm_message outmsg; controlvm_init_response(&outmsg, msgHdr, response); - outmsg.cmd.initChipset.features = features; + outmsg.cmd.init_chipset.features = features; if (!visorchannel_signalinsert(ControlVm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { LOGERR("signalinsert failed!"); @@ -739,15 +746,15 @@ controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response, } } -static void -controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER *msgHdr, - int response, ULTRA_SEGMENT_STATE state) +static void controlvm_respond_physdev_changestate( + struct controlvm_message_header *msgHdr, int response, + struct spar_segment_state state) { - CONTROLVM_MESSAGE outmsg; + struct controlvm_message outmsg; controlvm_init_response(&outmsg, msgHdr, response); - outmsg.cmd.deviceChangeState.state = state; - outmsg.cmd.deviceChangeState.flags.physicalDevice = 1; + outmsg.cmd.device_change_state.state = state; + outmsg.cmd.device_change_state.flags.phys_device = 1; if (!visorchannel_signalinsert(ControlVm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { LOGERR("signalinsert failed!"); @@ -756,15 +763,16 @@ controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER *msgHdr, } void -visorchipset_save_message(CONTROLVM_MESSAGE *msg, CRASH_OBJ_TYPE type) +visorchipset_save_message(struct controlvm_message *msg, + enum crash_obj_type type) { u32 localSavedCrashMsgOffset; u16 localSavedCrashMsgCount; /* get saved message count */ if (visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - SavedCrashMsgCount), + offsetof(struct spar_controlvm_channel_protocol, + saved_crash_message_count), &localSavedCrashMsgCount, sizeof(u16)) < 0) { LOGERR("failed to get Saved Message Count"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, @@ -783,8 +791,8 @@ visorchipset_save_message(CONTROLVM_MESSAGE *msg, CRASH_OBJ_TYPE type) /* get saved crash message offset */ if (visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - SavedCrashMsgOffset), + offsetof(struct spar_controlvm_channel_protocol, + saved_crash_message_offset), &localSavedCrashMsgOffset, sizeof(u32)) < 0) { LOGERR("failed to get Saved Message Offset"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, @@ -792,10 +800,11 @@ visorchipset_save_message(CONTROLVM_MESSAGE *msg, CRASH_OBJ_TYPE type) return; } - if (type == CRASH_bus) { + if (type == CRASH_BUS) { if (visorchannel_write(ControlVm_channel, localSavedCrashMsgOffset, - msg, sizeof(CONTROLVM_MESSAGE)) < 0) { + msg, + sizeof(struct controlvm_message)) < 0) { LOGERR("SAVE_MSG_BUS_FAILURE: Failed to write CrashCreateBusMsg!"); POSTCODE_LINUX_2(SAVE_MSG_BUS_FAILURE_PC, POSTCODE_SEVERITY_ERR); @@ -804,8 +813,8 @@ visorchipset_save_message(CONTROLVM_MESSAGE *msg, CRASH_OBJ_TYPE type) } else { if (visorchannel_write(ControlVm_channel, localSavedCrashMsgOffset + - sizeof(CONTROLVM_MESSAGE), msg, - sizeof(CONTROLVM_MESSAGE)) < 0) { + sizeof(struct controlvm_message), msg, + sizeof(struct controlvm_message)) < 0) { LOGERR("SAVE_MSG_DEV_FAILURE: Failed to write CrashCreateDevMsg!"); POSTCODE_LINUX_2(SAVE_MSG_DEV_FAILURE_PC, POSTCODE_SEVERITY_ERR); @@ -816,9 +825,9 @@ visorchipset_save_message(CONTROLVM_MESSAGE *msg, CRASH_OBJ_TYPE type) EXPORT_SYMBOL_GPL(visorchipset_save_message); static void -bus_responder(CONTROLVM_ID cmdId, ulong busNo, int response) +bus_responder(enum controlvm_id cmdId, ulong busNo, int response) { - VISORCHIPSET_BUS_INFO *p = NULL; + struct visorchipset_bus_info *p = NULL; BOOL need_clear = FALSE; p = findbus(&BusInfoList, busNo); @@ -838,16 +847,16 @@ bus_responder(CONTROLVM_ID cmdId, ulong busNo, int response) need_clear = TRUE; } - if (p->pendingMsgHdr.Id == CONTROLVM_INVALID) { + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { LOGERR("bus_responder no pending msg"); return; /* no controlvm response needed */ } - if (p->pendingMsgHdr.Id != (u32) cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.Id); + if (p->pending_msg_hdr.id != (u32) cmdId) { + LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); return; } - controlvm_respond(&p->pendingMsgHdr, response); - p->pendingMsgHdr.Id = CONTROLVM_INVALID; + controlvm_respond(&p->pending_msg_hdr, response); + p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) { busInfo_clear(p); delbusdevices(&DevInfoList, busNo); @@ -855,32 +864,32 @@ bus_responder(CONTROLVM_ID cmdId, ulong busNo, int response) } static void -device_changestate_responder(CONTROLVM_ID cmdId, +device_changestate_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, int response, - ULTRA_SEGMENT_STATE responseState) + struct spar_segment_state responseState) { - VISORCHIPSET_DEVICE_INFO *p = NULL; - CONTROLVM_MESSAGE outmsg; + struct visorchipset_device_info *p = NULL; + struct controlvm_message outmsg; p = finddevice(&DevInfoList, busNo, devNo); if (!p) { LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo); return; } - if (p->pendingMsgHdr.Id == CONTROLVM_INVALID) { + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { LOGERR("device_responder no pending msg"); return; /* no controlvm response needed */ } - if (p->pendingMsgHdr.Id != cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.Id); + if (p->pending_msg_hdr.id != cmdId) { + LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); return; } - controlvm_init_response(&outmsg, &p->pendingMsgHdr, response); + controlvm_init_response(&outmsg, &p->pending_msg_hdr, response); - outmsg.cmd.deviceChangeState.busNo = busNo; - outmsg.cmd.deviceChangeState.devNo = devNo; - outmsg.cmd.deviceChangeState.state = responseState; + outmsg.cmd.device_change_state.bus_no = busNo; + outmsg.cmd.device_change_state.dev_no = devNo; + outmsg.cmd.device_change_state.state = responseState; if (!visorchannel_signalinsert(ControlVm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg)) { @@ -888,13 +897,14 @@ device_changestate_responder(CONTROLVM_ID cmdId, return; } - p->pendingMsgHdr.Id = CONTROLVM_INVALID; + p->pending_msg_hdr.id = CONTROLVM_INVALID; } static void -device_responder(CONTROLVM_ID cmdId, ulong busNo, ulong devNo, int response) +device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, + int response) { - VISORCHIPSET_DEVICE_INFO *p = NULL; + struct visorchipset_device_info *p = NULL; BOOL need_clear = FALSE; p = finddevice(&DevInfoList, busNo, devNo); @@ -909,38 +919,38 @@ device_responder(CONTROLVM_ID cmdId, ulong busNo, ulong devNo, int response) need_clear = TRUE; } - if (p->pendingMsgHdr.Id == CONTROLVM_INVALID) { + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { LOGERR("device_responder no pending msg"); return; /* no controlvm response needed */ } - if (p->pendingMsgHdr.Id != (u32) cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.Id); + if (p->pending_msg_hdr.id != (u32) cmdId) { + LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); return; } - controlvm_respond(&p->pendingMsgHdr, response); - p->pendingMsgHdr.Id = CONTROLVM_INVALID; + controlvm_respond(&p->pending_msg_hdr, response); + p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) devInfo_clear(p); } static void bus_epilog(u32 busNo, - u32 cmd, CONTROLVM_MESSAGE_HEADER *msgHdr, + u32 cmd, struct controlvm_message_header *msgHdr, int response, BOOL needResponse) { BOOL notified = FALSE; - VISORCHIPSET_BUS_INFO *pBusInfo = findbus(&BusInfoList, busNo); + struct visorchipset_bus_info *pBusInfo = findbus(&BusInfoList, busNo); if (!pBusInfo) { LOGERR("HUH? bad busNo=%d", busNo); return; } if (needResponse) { - memcpy(&pBusInfo->pendingMsgHdr, msgHdr, - sizeof(CONTROLVM_MESSAGE_HEADER)); + memcpy(&pBusInfo->pending_msg_hdr, msgHdr, + sizeof(struct controlvm_message_header)); } else - pBusInfo->pendingMsgHdr.Id = CONTROLVM_INVALID; + pBusInfo->pending_msg_hdr.id = CONTROLVM_INVALID; down(&NotifierLock); if (response == CONTROLVM_RESP_SUCCESS) { @@ -981,7 +991,7 @@ bus_epilog(u32 busNo, } if (notified) /* The callback function just called above is responsible - * for calling the appropriate VISORCHIPSET_BUSDEV_RESPONDERS + * for calling the appropriate visorchipset_busdev_responders * function, which will call bus_responder() */ ; @@ -991,14 +1001,14 @@ bus_epilog(u32 busNo, } static void -device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd, - CONTROLVM_MESSAGE_HEADER *msgHdr, int response, +device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, + struct controlvm_message_header *msgHdr, int response, BOOL needResponse, BOOL for_visorbus) { - VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers = NULL; + struct visorchipset_busdev_notifiers *notifiers = NULL; BOOL notified = FALSE; - VISORCHIPSET_DEVICE_INFO *pDevInfo = + struct visorchipset_device_info *pDevInfo = finddevice(&DevInfoList, busNo, devNo); char *envp[] = { "SPARSP_DIAGPOOL_PAUSED_STATE = 1", @@ -1014,10 +1024,10 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd, else notifiers = &BusDev_Client_Notifiers; if (needResponse) { - memcpy(&pDevInfo->pendingMsgHdr, msgHdr, - sizeof(CONTROLVM_MESSAGE_HEADER)); + memcpy(&pDevInfo->pending_msg_hdr, msgHdr, + sizeof(struct controlvm_message_header)); } else - pDevInfo->pendingMsgHdr.Id = CONTROLVM_INVALID; + pDevInfo->pending_msg_hdr.id = CONTROLVM_INVALID; down(&NotifierLock); if (response >= 0) { @@ -1030,8 +1040,9 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd, break; case CONTROLVM_DEVICE_CHANGESTATE: /* ServerReady / ServerRunning / SegmentStateRunning */ - if (state.Alive == SegmentStateRunning.Alive && - state.Operating == SegmentStateRunning.Operating) { + if (state.alive == segment_state_running.alive && + state.operating == + segment_state_running.operating) { if (notifiers->device_resume) { (*notifiers->device_resume) (busNo, devNo); @@ -1039,9 +1050,9 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd, } } /* ServerNotReady / ServerLost / SegmentStateStandby */ - else if (state.Alive == SegmentStateStandby.Alive && - state.Operating == - SegmentStateStandby.Operating) { + else if (state.alive == segment_state_standby.alive && + state.operating == + segment_state_standby.operating) { /* technically this is standby case * where server is lost */ @@ -1050,9 +1061,9 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd, devNo); notified = TRUE; } - } else if (state.Alive == SegmentStatePaused.Alive && - state.Operating == - SegmentStatePaused.Operating) { + } else if (state.alive == segment_state_paused.alive && + state.operating == + segment_state_paused.operating) { /* this is lite pause where channel is * still valid just 'pause' of it */ @@ -1079,7 +1090,7 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd, } if (notified) /* The callback function just called above is responsible - * for calling the appropriate VISORCHIPSET_BUSDEV_RESPONDERS + * for calling the appropriate visorchipset_busdev_responders * function, which will call device_responder() */ ; @@ -1089,12 +1100,12 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd, } static void -bus_create(CONTROLVM_MESSAGE *inmsg) +bus_create(struct controlvm_message *inmsg) { - CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd; - ulong busNo = cmd->createBus.busNo; + struct controlvm_message_packet *cmd = &inmsg->cmd; + ulong busNo = cmd->create_bus.bus_no; int rc = CONTROLVM_RESP_SUCCESS; - VISORCHIPSET_BUS_INFO *pBusInfo = NULL; + struct visorchipset_bus_info *pBusInfo = NULL; pBusInfo = findbus(&BusInfoList, busNo); @@ -1106,7 +1117,7 @@ bus_create(CONTROLVM_MESSAGE *inmsg) rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; goto Away; } - pBusInfo = kzalloc(sizeof(VISORCHIPSET_BUS_INFO), GFP_KERNEL); + pBusInfo = kzalloc(sizeof(struct visorchipset_bus_info), GFP_KERNEL); if (pBusInfo == NULL) { LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu kzalloc failed", busNo); @@ -1117,21 +1128,22 @@ bus_create(CONTROLVM_MESSAGE *inmsg) } INIT_LIST_HEAD(&pBusInfo->entry); - pBusInfo->busNo = busNo; - pBusInfo->devNo = cmd->createBus.deviceCount; + pBusInfo->bus_no = busNo; + pBusInfo->dev_no = cmd->create_bus.dev_count; POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); - if (inmsg->hdr.Flags.testMessage == 1) - pBusInfo->chanInfo.addrType = ADDRTYPE_localTest; + if (inmsg->hdr.flags.test_message == 1) + pBusInfo->chan_info.addr_type = ADDRTYPE_LOCALTEST; else - pBusInfo->chanInfo.addrType = ADDRTYPE_localPhysical; + pBusInfo->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL; - pBusInfo->flags.server = inmsg->hdr.Flags.server; - pBusInfo->chanInfo.channelAddr = cmd->createBus.channelAddr; - pBusInfo->chanInfo.nChannelBytes = cmd->createBus.channelBytes; - pBusInfo->chanInfo.channelTypeGuid = cmd->createBus.busDataTypeGuid; - pBusInfo->chanInfo.channelInstGuid = cmd->createBus.busInstGuid; + pBusInfo->flags.server = inmsg->hdr.flags.server; + pBusInfo->chan_info.channel_addr = cmd->create_bus.channel_addr; + pBusInfo->chan_info.n_channel_bytes = cmd->create_bus.channel_bytes; + pBusInfo->chan_info.channel_type_uuid = + cmd->create_bus.bus_data_type_uuid; + pBusInfo->chan_info.channel_inst_uuid = cmd->create_bus.bus_inst_uuid; list_add(&pBusInfo->entry, &BusInfoList); @@ -1139,15 +1151,15 @@ bus_create(CONTROLVM_MESSAGE *inmsg) Away: bus_epilog(busNo, CONTROLVM_BUS_CREATE, &inmsg->hdr, - rc, inmsg->hdr.Flags.responseExpected == 1); + rc, inmsg->hdr.flags.response_expected == 1); } static void -bus_destroy(CONTROLVM_MESSAGE *inmsg) +bus_destroy(struct controlvm_message *inmsg) { - CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd; - ulong busNo = cmd->destroyBus.busNo; - VISORCHIPSET_BUS_INFO *pBusInfo; + struct controlvm_message_packet *cmd = &inmsg->cmd; + ulong busNo = cmd->destroy_bus.bus_no; + struct visorchipset_bus_info *pBusInfo; int rc = CONTROLVM_RESP_SUCCESS; pBusInfo = findbus(&BusInfoList, busNo); @@ -1165,19 +1177,19 @@ bus_destroy(CONTROLVM_MESSAGE *inmsg) Away: bus_epilog(busNo, CONTROLVM_BUS_DESTROY, &inmsg->hdr, - rc, inmsg->hdr.Flags.responseExpected == 1); + rc, inmsg->hdr.flags.response_expected == 1); } static void -bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx) +bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx) { - CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd; - ulong busNo = cmd->configureBus.busNo; - VISORCHIPSET_BUS_INFO *pBusInfo = NULL; + struct controlvm_message_packet *cmd = &inmsg->cmd; + ulong busNo = cmd->configure_bus.bus_no; + struct visorchipset_bus_info *pBusInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; char s[99]; - busNo = cmd->configureBus.busNo; + busNo = cmd->configure_bus.bus_no; POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); pBusInfo = findbus(&BusInfoList, busNo); @@ -1198,35 +1210,35 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx) goto Away; } /* TBD - add this check to other commands also... */ - if (pBusInfo->pendingMsgHdr.Id != CONTROLVM_INVALID) { + if (pBusInfo->pending_msg_hdr.id != CONTROLVM_INVALID) { LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding", - busNo, (uint) pBusInfo->pendingMsgHdr.Id); + busNo, (uint) pBusInfo->pending_msg_hdr.id); POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT; goto Away; } - pBusInfo->partitionHandle = cmd->configureBus.guestHandle; - pBusInfo->partitionGuid = parser_id_get(parser_ctx); + pBusInfo->partition_handle = cmd->configure_bus.guest_handle; + pBusInfo->partition_uuid = parser_id_get(parser_ctx); parser_param_start(parser_ctx, PARSERSTRING_NAME); pBusInfo->name = parser_string_get(parser_ctx); - visorchannel_uuid_id(&pBusInfo->partitionGuid, s); + visorchannel_uuid_id(&pBusInfo->partition_uuid, s); POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); Away: bus_epilog(busNo, CONTROLVM_BUS_CONFIGURE, &inmsg->hdr, - rc, inmsg->hdr.Flags.responseExpected == 1); + rc, inmsg->hdr.flags.response_expected == 1); } static void -my_device_create(CONTROLVM_MESSAGE *inmsg) +my_device_create(struct controlvm_message *inmsg) { - CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd; - ulong busNo = cmd->createDevice.busNo; - ulong devNo = cmd->createDevice.devNo; - VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; - VISORCHIPSET_BUS_INFO *pBusInfo = NULL; + struct controlvm_message_packet *cmd = &inmsg->cmd; + ulong busNo = cmd->create_device.bus_no; + ulong devNo = cmd->create_device.dev_no; + struct visorchipset_device_info *pDevInfo = NULL; + struct visorchipset_bus_info *pBusInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; pDevInfo = finddevice(&DevInfoList, busNo, devNo); @@ -1255,7 +1267,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto Away; } - pDevInfo = kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL); + pDevInfo = kzalloc(sizeof(struct visorchipset_device_info), GFP_KERNEL); if (pDevInfo == NULL) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu kmaloc failed", busNo, devNo); @@ -1266,45 +1278,47 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) } INIT_LIST_HEAD(&pDevInfo->entry); - pDevInfo->busNo = busNo; - pDevInfo->devNo = devNo; - pDevInfo->devInstGuid = cmd->createDevice.devInstGuid; + pDevInfo->bus_no = busNo; + pDevInfo->dev_no = devNo; + pDevInfo->dev_inst_uuid = cmd->create_device.dev_inst_uuid; POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); - if (inmsg->hdr.Flags.testMessage == 1) - pDevInfo->chanInfo.addrType = ADDRTYPE_localTest; + if (inmsg->hdr.flags.test_message == 1) + pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALTEST; else - pDevInfo->chanInfo.addrType = ADDRTYPE_localPhysical; - pDevInfo->chanInfo.channelAddr = cmd->createDevice.channelAddr; - pDevInfo->chanInfo.nChannelBytes = cmd->createDevice.channelBytes; - pDevInfo->chanInfo.channelTypeGuid = cmd->createDevice.dataTypeGuid; - pDevInfo->chanInfo.intr = cmd->createDevice.intr; + pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL; + pDevInfo->chan_info.channel_addr = cmd->create_device.channel_addr; + pDevInfo->chan_info.n_channel_bytes = cmd->create_device.channel_bytes; + pDevInfo->chan_info.channel_type_uuid = + cmd->create_device.data_type_uuid; + pDevInfo->chan_info.intr = cmd->create_device.intr; list_add(&pDevInfo->entry, &DevInfoList); POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); Away: /* get the bus and devNo for DiagPool channel */ - if (is_diagpool_channel(pDevInfo->chanInfo.channelTypeGuid)) { + if (pDevInfo && + is_diagpool_channel(pDevInfo->chan_info.channel_type_uuid)) { g_diagpoolBusNo = busNo; g_diagpoolDevNo = devNo; LOGINF("CONTROLVM_DEVICE_CREATE for DiagPool channel: busNo=%lu, devNo=%lu", g_diagpoolBusNo, g_diagpoolDevNo); } - device_epilog(busNo, devNo, SegmentStateRunning, + device_epilog(busNo, devNo, segment_state_running, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, - inmsg->hdr.Flags.responseExpected == 1, - FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid)); + inmsg->hdr.flags.response_expected == 1, + FOR_VISORBUS(pDevInfo->chan_info.channel_type_uuid)); } static void -my_device_changestate(CONTROLVM_MESSAGE *inmsg) +my_device_changestate(struct controlvm_message *inmsg) { - CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd; - ulong busNo = cmd->deviceChangeState.busNo; - ulong devNo = cmd->deviceChangeState.devNo; - ULTRA_SEGMENT_STATE state = cmd->deviceChangeState.state; - VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; + struct controlvm_message_packet *cmd = &inmsg->cmd; + ulong busNo = cmd->device_change_state.bus_no; + ulong devNo = cmd->device_change_state.dev_no; + struct spar_segment_state state = cmd->device_change_state.state; + struct visorchipset_device_info *pDevInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; pDevInfo = finddevice(&DevInfoList, busNo, devNo); @@ -1327,17 +1341,18 @@ Away: if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) device_epilog(busNo, devNo, state, CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc, - inmsg->hdr.Flags.responseExpected == 1, - FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid)); + inmsg->hdr.flags.response_expected == 1, + FOR_VISORBUS( + pDevInfo->chan_info.channel_type_uuid)); } static void -my_device_destroy(CONTROLVM_MESSAGE *inmsg) +my_device_destroy(struct controlvm_message *inmsg) { - CONTROLVM_MESSAGE_PACKET *cmd = &inmsg->cmd; - ulong busNo = cmd->destroyDevice.busNo; - ulong devNo = cmd->destroyDevice.devNo; - VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; + struct controlvm_message_packet *cmd = &inmsg->cmd; + ulong busNo = cmd->destroy_device.bus_no; + ulong devNo = cmd->destroy_device.dev_no; + struct visorchipset_device_info *pDevInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; pDevInfo = finddevice(&DevInfoList, busNo, devNo); @@ -1355,10 +1370,11 @@ my_device_destroy(CONTROLVM_MESSAGE *inmsg) Away: if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) - device_epilog(busNo, devNo, SegmentStateRunning, + device_epilog(busNo, devNo, segment_state_running, CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc, - inmsg->hdr.Flags.responseExpected == 1, - FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid)); + inmsg->hdr.flags.response_expected == 1, + FOR_VISORBUS( + pDevInfo->chan_info.channel_type_uuid)); } /* When provided with the physical address of the controlvm channel @@ -1382,7 +1398,7 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes, } memset(info, 0, sizeof(CONTROLVM_PAYLOAD_INFO)); if ((offset == 0) || (bytes == 0)) { - LOGERR("CONTROLVM_PAYLOAD_INIT Failed: RequestPayloadOffset=%llu RequestPayloadBytes=%llu!", + LOGERR("CONTROLVM_PAYLOAD_INIT Failed: request_payload_offset=%llu request_payload_bytes=%llu!", (u64) offset, (u64) bytes); rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; goto Away; @@ -1429,8 +1445,8 @@ initialize_controlvm_payload(void) u32 payloadBytes = 0; if (visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - RequestPayloadOffset), + offsetof(struct spar_controlvm_channel_protocol, + request_payload_offset), &payloadOffset, sizeof(payloadOffset)) < 0) { LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!"); POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC, @@ -1438,8 +1454,8 @@ initialize_controlvm_payload(void) return; } if (visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - RequestPayloadBytes), + offsetof(struct spar_controlvm_channel_protocol, + request_payload_bytes), &payloadBytes, sizeof(payloadBytes)) < 0) { LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!"); POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC, @@ -1487,15 +1503,15 @@ visorchipset_chipset_notready(void) EXPORT_SYMBOL_GPL(visorchipset_chipset_notready); static void -chipset_ready(CONTROLVM_MESSAGE_HEADER *msgHdr) +chipset_ready(struct controlvm_message_header *msgHdr) { int rc = visorchipset_chipset_ready(); if (rc != CONTROLVM_RESP_SUCCESS) rc = -rc; - if (msgHdr->Flags.responseExpected && !visorchipset_holdchipsetready) + if (msgHdr->flags.response_expected && !visorchipset_holdchipsetready) controlvm_respond(msgHdr, rc); - if (msgHdr->Flags.responseExpected && visorchipset_holdchipsetready) { + if (msgHdr->flags.response_expected && visorchipset_holdchipsetready) { /* Send CHIPSET_READY response when all modules have been loaded * and disks mounted for the partition */ @@ -1505,24 +1521,24 @@ chipset_ready(CONTROLVM_MESSAGE_HEADER *msgHdr) } static void -chipset_selftest(CONTROLVM_MESSAGE_HEADER *msgHdr) +chipset_selftest(struct controlvm_message_header *msgHdr) { int rc = visorchipset_chipset_selftest(); if (rc != CONTROLVM_RESP_SUCCESS) rc = -rc; - if (msgHdr->Flags.responseExpected) + if (msgHdr->flags.response_expected) controlvm_respond(msgHdr, rc); } static void -chipset_notready(CONTROLVM_MESSAGE_HEADER *msgHdr) +chipset_notready(struct controlvm_message_header *msgHdr) { int rc = visorchipset_chipset_notready(); if (rc != CONTROLVM_RESP_SUCCESS) rc = -rc; - if (msgHdr->Flags.responseExpected) + if (msgHdr->flags.response_expected) controlvm_respond(msgHdr, rc); } @@ -1530,13 +1546,14 @@ chipset_notready(CONTROLVM_MESSAGE_HEADER *msgHdr) * CONTROLVM_QUEUE_EVENT queue in the controlvm channel. */ static BOOL -read_controlvm_event(CONTROLVM_MESSAGE *msg) +read_controlvm_event(struct controlvm_message *msg) { if (visorchannel_signalremove(ControlVm_channel, CONTROLVM_QUEUE_EVENT, msg)) { /* got a message */ - if (msg->hdr.Flags.testMessage == 1) { - LOGERR("ignoring bad CONTROLVM_QUEUE_EVENT msg with controlvm_msg_id=0x%x because Flags.testMessage is nonsensical (=1)", msg->hdr.Id); + if (msg->hdr.flags.test_message == 1) { + LOGERR("ignoring bad CONTROLVM_QUEUE_EVENT msg with controlvm_msg_id=0x%x because Flags.testMessage is nonsensical (=1)", + msg->hdr.id); return FALSE; } return TRUE; @@ -1586,7 +1603,7 @@ parahotplug_next_expiration(void) * CONTROLVM_MESSAGE that we can stick on a list */ static struct parahotplug_request * -parahotplug_request_create(CONTROLVM_MESSAGE *msg) +parahotplug_request_create(struct controlvm_message *msg) { struct parahotplug_request *req = kmalloc(sizeof(struct parahotplug_request), @@ -1618,7 +1635,7 @@ parahotplug_request_destroy(struct parahotplug_request *req) static void parahotplug_request_kickoff(struct parahotplug_request *req) { - CONTROLVM_MESSAGE_PACKET *cmd = &req->msg.cmd; + struct controlvm_message_packet *cmd = &req->msg.cmd; char env_cmd[40], env_id[40], env_state[40], env_bus[40], env_dev[40], env_func[40]; char *envp[] = { @@ -1628,18 +1645,19 @@ parahotplug_request_kickoff(struct parahotplug_request *req) sprintf(env_cmd, "SPAR_PARAHOTPLUG=1"); sprintf(env_id, "SPAR_PARAHOTPLUG_ID=%d", req->id); sprintf(env_state, "SPAR_PARAHOTPLUG_STATE=%d", - cmd->deviceChangeState.state.Active); + cmd->device_change_state.state.active); sprintf(env_bus, "SPAR_PARAHOTPLUG_BUS=%d", - cmd->deviceChangeState.busNo); + cmd->device_change_state.bus_no); sprintf(env_dev, "SPAR_PARAHOTPLUG_DEVICE=%d", - cmd->deviceChangeState.devNo >> 3); + cmd->device_change_state.dev_no >> 3); sprintf(env_func, "SPAR_PARAHOTPLUG_FUNCTION=%d", - cmd->deviceChangeState.devNo & 0x7); + cmd->device_change_state.dev_no & 0x7); LOGINF("parahotplug_request_kickoff: state=%d, bdf=%d/%d/%d, id=%u\n", - cmd->deviceChangeState.state.Active, - cmd->deviceChangeState.busNo, cmd->deviceChangeState.devNo >> 3, - cmd->deviceChangeState.devNo & 7, req->id); + cmd->device_change_state.state.active, + cmd->device_change_state.bus_no, + cmd->device_change_state.dev_no >> 3, + cmd->device_change_state.dev_no & 7, req->id); kobject_uevent_env(&Visorchipset_platform_device.dev.kobj, KOBJ_CHANGE, envp); @@ -1662,11 +1680,11 @@ parahotplug_process_list(void) list_entry(pos, struct parahotplug_request, list); if (time_after_eq(jiffies, req->expiration)) { list_del(pos); - if (req->msg.hdr.Flags.responseExpected) + if (req->msg.hdr.flags.response_expected) controlvm_respond_physdev_changestate( &req->msg.hdr, CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT, - req->msg.cmd.deviceChangeState.state); + req->msg.cmd.device_change_state.state); parahotplug_request_destroy(req); } } @@ -1697,11 +1715,11 @@ parahotplug_request_complete(int id, u16 active) */ list_del(pos); spin_unlock(&Parahotplug_request_list_lock); - req->msg.cmd.deviceChangeState.state.Active = active; - if (req->msg.hdr.Flags.responseExpected) + req->msg.cmd.device_change_state.state.active = active; + if (req->msg.hdr.flags.response_expected) controlvm_respond_physdev_changestate( &req->msg.hdr, CONTROLVM_RESP_SUCCESS, - req->msg.cmd.deviceChangeState.state); + req->msg.cmd.device_change_state.state); parahotplug_request_destroy(req); return 0; } @@ -1715,7 +1733,7 @@ parahotplug_request_complete(int id, u16 active) * Enables or disables a PCI device by kicking off a udev script */ static void -parahotplug_process_message(CONTROLVM_MESSAGE *inmsg) +parahotplug_process_message(struct controlvm_message *inmsg) { struct parahotplug_request *req; @@ -1726,7 +1744,7 @@ parahotplug_process_message(CONTROLVM_MESSAGE *inmsg) return; } - if (inmsg->cmd.deviceChangeState.state.Active) { + if (inmsg->cmd.device_change_state.state.active) { /* For enable messages, just respond with success * right away. This is a bit of a hack, but there are * issues with the early enable messages we get (with @@ -1738,9 +1756,8 @@ parahotplug_process_message(CONTROLVM_MESSAGE *inmsg) */ parahotplug_request_kickoff(req); controlvm_respond_physdev_changestate(&inmsg->hdr, - CONTROLVM_RESP_SUCCESS, - inmsg->cmd. - deviceChangeState.state); + CONTROLVM_RESP_SUCCESS, inmsg->cmd. + device_change_state.state); parahotplug_request_destroy(req); } else { /* For disable messages, add the request to the @@ -1768,23 +1785,23 @@ parahotplug_process_message(CONTROLVM_MESSAGE *inmsg) * either successfully or with an error. */ static BOOL -handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) +handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr) { - CONTROLVM_MESSAGE_PACKET *cmd = &inmsg.cmd; + struct controlvm_message_packet *cmd = &inmsg.cmd; u64 parametersAddr = 0; u32 parametersBytes = 0; PARSER_CONTEXT *parser_ctx = NULL; BOOL isLocalAddr = FALSE; - CONTROLVM_MESSAGE ackmsg; + struct controlvm_message ackmsg; /* create parsing context if necessary */ - isLocalAddr = (inmsg.hdr.Flags.testMessage == 1); + isLocalAddr = (inmsg.hdr.flags.test_message == 1); if (channel_addr == 0) { LOGERR("HUH? channel_addr is 0!"); return TRUE; } - parametersAddr = channel_addr + inmsg.hdr.PayloadVmOffset; - parametersBytes = inmsg.hdr.PayloadBytes; + parametersAddr = channel_addr + inmsg.hdr.payload_vm_offset; + parametersBytes = inmsg.hdr.payload_bytes; /* Parameter and channel addresses within test messages actually lie * within our OS-controlled memory. We need to know that, because it @@ -1802,7 +1819,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) return FALSE; } LOGWRN("parsing failed"); - LOGWRN("inmsg.hdr.Id=0x%lx", (ulong) inmsg.hdr.Id); + LOGWRN("inmsg.hdr.Id=0x%lx", (ulong) inmsg.hdr.id); LOGWRN("parametersAddr=0x%llx", (u64) parametersAddr); LOGWRN("parametersBytes=%lu", (ulong) parametersBytes); LOGWRN("isLocalAddr=%d", isLocalAddr); @@ -1818,45 +1835,45 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) (ControlVm_channel, CONTROLVM_QUEUE_ACK, &ackmsg))) LOGWRN("failed to send ACK failed"); } - switch (inmsg.hdr.Id) { + switch (inmsg.hdr.id) { case CONTROLVM_CHIPSET_INIT: LOGINF("CHIPSET_INIT(#busses=%lu,#switches=%lu)", - (ulong) inmsg.cmd.initChipset.busCount, - (ulong) inmsg.cmd.initChipset.switchCount); + (ulong) inmsg.cmd.init_chipset.bus_count, + (ulong) inmsg.cmd.init_chipset.switch_count); chipset_init(&inmsg); break; case CONTROLVM_BUS_CREATE: LOGINF("BUS_CREATE(%lu,#devs=%lu)", - (ulong) cmd->createBus.busNo, - (ulong) cmd->createBus.deviceCount); + (ulong) cmd->create_bus.bus_no, + (ulong) cmd->create_bus.dev_count); bus_create(&inmsg); break; case CONTROLVM_BUS_DESTROY: - LOGINF("BUS_DESTROY(%lu)", (ulong) cmd->destroyBus.busNo); + LOGINF("BUS_DESTROY(%lu)", (ulong) cmd->destroy_bus.bus_no); bus_destroy(&inmsg); break; case CONTROLVM_BUS_CONFIGURE: - LOGINF("BUS_CONFIGURE(%lu)", (ulong) cmd->configureBus.busNo); + LOGINF("BUS_CONFIGURE(%lu)", (ulong) cmd->configure_bus.bus_no); bus_configure(&inmsg, parser_ctx); break; case CONTROLVM_DEVICE_CREATE: LOGINF("DEVICE_CREATE(%lu,%lu)", - (ulong) cmd->createDevice.busNo, - (ulong) cmd->createDevice.devNo); + (ulong) cmd->create_device.bus_no, + (ulong) cmd->create_device.dev_no); my_device_create(&inmsg); break; case CONTROLVM_DEVICE_CHANGESTATE: - if (cmd->deviceChangeState.flags.physicalDevice) { + if (cmd->device_change_state.flags.phys_device) { LOGINF("DEVICE_CHANGESTATE for physical device (%lu,%lu, active=%lu)", - (ulong) cmd->deviceChangeState.busNo, - (ulong) cmd->deviceChangeState.devNo, - (ulong) cmd->deviceChangeState.state.Active); + (ulong) cmd->device_change_state.bus_no, + (ulong) cmd->device_change_state.dev_no, + (ulong) cmd->device_change_state.state.active); parahotplug_process_message(&inmsg); } else { LOGINF("DEVICE_CHANGESTATE for virtual device (%lu,%lu, state.Alive=0x%lx)", - (ulong) cmd->deviceChangeState.busNo, - (ulong) cmd->deviceChangeState.devNo, - (ulong) cmd->deviceChangeState.state.Alive); + (ulong) cmd->device_change_state.bus_no, + (ulong) cmd->device_change_state.dev_no, + (ulong) cmd->device_change_state.state.alive); /* save the hdr and cmd structures for later use */ /* when sending back the response to Command */ my_device_changestate(&inmsg); @@ -1867,16 +1884,16 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) break; case CONTROLVM_DEVICE_DESTROY: LOGINF("DEVICE_DESTROY(%lu,%lu)", - (ulong) cmd->destroyDevice.busNo, - (ulong) cmd->destroyDevice.devNo); + (ulong) cmd->destroy_device.bus_no, + (ulong) cmd->destroy_device.dev_no); my_device_destroy(&inmsg); break; case CONTROLVM_DEVICE_CONFIGURE: LOGINF("DEVICE_CONFIGURE(%lu,%lu)", - (ulong) cmd->configureDevice.busNo, - (ulong) cmd->configureDevice.devNo); + (ulong) cmd->configure_device.bus_no, + (ulong) cmd->configure_device.dev_no); /* no op for now, just send a respond that we passed */ - if (inmsg.hdr.Flags.responseExpected) + if (inmsg.hdr.flags.response_expected) controlvm_respond(&inmsg.hdr, CONTROLVM_RESP_SUCCESS); break; case CONTROLVM_CHIPSET_READY: @@ -1892,8 +1909,8 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) chipset_notready(&inmsg.hdr); break; default: - LOGERR("unrecognized controlvm cmd=%d", (int) inmsg.hdr.Id); - if (inmsg.hdr.Flags.responseExpected) + LOGERR("unrecognized controlvm cmd=%d", (int) inmsg.hdr.id); + if (inmsg.hdr.flags.response_expected) controlvm_respond(&inmsg.hdr, -CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN); break; @@ -1923,8 +1940,7 @@ static HOSTADDRESS controlvm_get_channel_address(void) static void controlvm_periodic_work(struct work_struct *work) { - VISORCHIPSET_CHANNEL_INFO chanInfo; - CONTROLVM_MESSAGE inmsg; + struct controlvm_message inmsg; BOOL gotACommand = FALSE; BOOL handle_command_failed = FALSE; static u64 Poll_Count; @@ -1938,8 +1954,6 @@ controlvm_periodic_work(struct work_struct *work) if (visorchipset_clientregwait && !clientregistered) goto Away; - memset(&chanInfo, 0, sizeof(VISORCHIPSET_CHANNEL_INFO)); - Poll_Count++; if (Poll_Count >= 250) ; /* keep going */ @@ -1950,24 +1964,24 @@ controlvm_periodic_work(struct work_struct *work) * should be sent */ if (visorchipset_holdchipsetready - && (g_ChipSetMsgHdr.Id != CONTROLVM_INVALID)) { + && (g_ChipSetMsgHdr.id != CONTROLVM_INVALID)) { if (check_chipset_events() == 1) { LOGINF("Sending CHIPSET_READY response"); controlvm_respond(&g_ChipSetMsgHdr, 0); clear_chipset_events(); memset(&g_ChipSetMsgHdr, 0, - sizeof(CONTROLVM_MESSAGE_HEADER)); + sizeof(struct controlvm_message_header)); } } while (visorchannel_signalremove(ControlVm_channel, CONTROLVM_QUEUE_RESPONSE, &inmsg)) { - if (inmsg.hdr.PayloadMaxBytes != 0) { + if (inmsg.hdr.payload_max_bytes != 0) { LOGERR("Payload of size %lu returned @%lu with unexpected message id %d.", - (ulong) inmsg.hdr.PayloadMaxBytes, - (ulong) inmsg.hdr.PayloadVmOffset, - inmsg.hdr.Id); + (ulong) inmsg.hdr.payload_max_bytes, + (ulong) inmsg.hdr.payload_vm_offset, + inmsg.hdr.id); } } if (!gotACommand) { @@ -2033,9 +2047,9 @@ static void setup_crash_devices_work_queue(struct work_struct *work) { - CONTROLVM_MESSAGE localCrashCreateBusMsg; - CONTROLVM_MESSAGE localCrashCreateDevMsg; - CONTROLVM_MESSAGE msg; + struct controlvm_message localCrashCreateBusMsg; + struct controlvm_message localCrashCreateDevMsg; + struct controlvm_message msg; u32 localSavedCrashMsgOffset; u16 localSavedCrashMsgCount; @@ -2052,16 +2066,16 @@ setup_crash_devices_work_queue(struct work_struct *work) POSTCODE_LINUX_2(CRASH_DEV_ENTRY_PC, POSTCODE_SEVERITY_INFO); /* send init chipset msg */ - msg.hdr.Id = CONTROLVM_CHIPSET_INIT; - msg.cmd.initChipset.busCount = 23; - msg.cmd.initChipset.switchCount = 0; + msg.hdr.id = CONTROLVM_CHIPSET_INIT; + msg.cmd.init_chipset.bus_count = 23; + msg.cmd.init_chipset.switch_count = 0; chipset_init(&msg); /* get saved message count */ if (visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - SavedCrashMsgCount), + offsetof(struct spar_controlvm_channel_protocol, + saved_crash_message_count), &localSavedCrashMsgCount, sizeof(u16)) < 0) { LOGERR("failed to get Saved Message Count"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, @@ -2080,8 +2094,8 @@ setup_crash_devices_work_queue(struct work_struct *work) /* get saved crash message offset */ if (visorchannel_read(ControlVm_channel, - offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, - SavedCrashMsgOffset), + offsetof(struct spar_controlvm_channel_protocol, + saved_crash_message_offset), &localSavedCrashMsgOffset, sizeof(u32)) < 0) { LOGERR("failed to get Saved Message Offset"); POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, @@ -2093,7 +2107,7 @@ setup_crash_devices_work_queue(struct work_struct *work) if (visorchannel_read(ControlVm_channel, localSavedCrashMsgOffset, &localCrashCreateBusMsg, - sizeof(CONTROLVM_MESSAGE)) < 0) { + sizeof(struct controlvm_message)) < 0) { LOGERR("CRASH_DEV_RD_BUS_FAIULRE: Failed to read CrashCreateBusMsg!"); POSTCODE_LINUX_2(CRASH_DEV_RD_BUS_FAIULRE_PC, POSTCODE_SEVERITY_ERR); @@ -2103,9 +2117,9 @@ setup_crash_devices_work_queue(struct work_struct *work) /* read create device message for storage device */ if (visorchannel_read(ControlVm_channel, localSavedCrashMsgOffset + - sizeof(CONTROLVM_MESSAGE), + sizeof(struct controlvm_message), &localCrashCreateDevMsg, - sizeof(CONTROLVM_MESSAGE)) < 0) { + sizeof(struct controlvm_message)) < 0) { LOGERR("CRASH_DEV_RD_DEV_FAIULRE: Failed to read CrashCreateDevMsg!"); POSTCODE_LINUX_2(CRASH_DEV_RD_DEV_FAIULRE_PC, POSTCODE_SEVERITY_ERR); @@ -2113,7 +2127,7 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* reuse IOVM create bus message */ - if (localCrashCreateBusMsg.cmd.createBus.channelAddr != 0) + if (localCrashCreateBusMsg.cmd.create_bus.channel_addr != 0) bus_create(&localCrashCreateBusMsg); else { LOGERR("CrashCreateBusMsg is null, no dump will be taken"); @@ -2123,7 +2137,7 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* reuse create device message for storage device */ - if (localCrashCreateDevMsg.cmd.createDevice.channelAddr != 0) + if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0) my_device_create(&localCrashCreateDevMsg); else { LOGERR("CrashCreateDevMsg is null, no dump will be taken"); @@ -2168,12 +2182,12 @@ device_destroy_response(ulong busNo, ulong devNo, int response) } void -visorchipset_device_pause_response(ulong busNo, ulong devNo, int response) +visorchipset_device_pause_response(ulong bus_no, ulong dev_no, int response) { device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, - busNo, devNo, response, - SegmentStateStandby); + bus_no, dev_no, response, + segment_state_standby); } EXPORT_SYMBOL_GPL(visorchipset_device_pause_response); @@ -2182,30 +2196,30 @@ device_resume_response(ulong busNo, ulong devNo, int response) { device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, busNo, devNo, response, - SegmentStateRunning); + segment_state_running); } BOOL -visorchipset_get_bus_info(ulong busNo, VISORCHIPSET_BUS_INFO *busInfo) +visorchipset_get_bus_info(ulong bus_no, struct visorchipset_bus_info *bus_info) { - void *p = findbus(&BusInfoList, busNo); + void *p = findbus(&BusInfoList, bus_no); if (!p) { - LOGERR("(%lu) failed", busNo); + LOGERR("(%lu) failed", bus_no); return FALSE; } - memcpy(busInfo, p, sizeof(VISORCHIPSET_BUS_INFO)); + memcpy(bus_info, p, sizeof(struct visorchipset_bus_info)); return TRUE; } EXPORT_SYMBOL_GPL(visorchipset_get_bus_info); BOOL -visorchipset_set_bus_context(ulong busNo, void *context) +visorchipset_set_bus_context(ulong bus_no, void *context) { - VISORCHIPSET_BUS_INFO *p = findbus(&BusInfoList, busNo); + struct visorchipset_bus_info *p = findbus(&BusInfoList, bus_no); if (!p) { - LOGERR("(%lu) failed", busNo); + LOGERR("(%lu) failed", bus_no); return FALSE; } p->bus_driver_context = context; @@ -2214,27 +2228,28 @@ visorchipset_set_bus_context(ulong busNo, void *context) EXPORT_SYMBOL_GPL(visorchipset_set_bus_context); BOOL -visorchipset_get_device_info(ulong busNo, ulong devNo, - VISORCHIPSET_DEVICE_INFO *devInfo) +visorchipset_get_device_info(ulong bus_no, ulong dev_no, + struct visorchipset_device_info *dev_info) { - void *p = finddevice(&DevInfoList, busNo, devNo); + void *p = finddevice(&DevInfoList, bus_no, dev_no); if (!p) { - LOGERR("(%lu,%lu) failed", busNo, devNo); + LOGERR("(%lu,%lu) failed", bus_no, dev_no); return FALSE; } - memcpy(devInfo, p, sizeof(VISORCHIPSET_DEVICE_INFO)); + memcpy(dev_info, p, sizeof(struct visorchipset_device_info)); return TRUE; } EXPORT_SYMBOL_GPL(visorchipset_get_device_info); BOOL -visorchipset_set_device_context(ulong busNo, ulong devNo, void *context) +visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context) { - VISORCHIPSET_DEVICE_INFO *p = finddevice(&DevInfoList, busNo, devNo); + struct visorchipset_device_info *p = + finddevice(&DevInfoList, bus_no, dev_no); if (!p) { - LOGERR("(%lu,%lu) failed", busNo, devNo); + LOGERR("(%lu,%lu) failed", bus_no, dev_no); return FALSE; } p->bus_driver_context = context; @@ -2377,11 +2392,10 @@ visorchipset_init(void) ControlVm_channel = visorchannel_create_with_lock (addr, - sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), - UltraControlvmChannelProtocolGuid); - if (ULTRA_CONTROLVM_CHANNEL_OK_CLIENT - (visorchannel_get_header(ControlVm_channel), - NULL)) { + sizeof(struct spar_controlvm_channel_protocol), + spar_controlvm_channel_protocol_uuid); + if (SPAR_CONTROLVM_CHANNEL_OK_CLIENT( + visorchannel_get_header(ControlVm_channel))) { LOGINF("Channel %s (ControlVm) discovered", visorchannel_id(ControlVm_channel, s)); initialize_controlvm_payload(); @@ -2404,11 +2418,11 @@ visorchipset_init(void) goto Away; } - memset(&g_DiagMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER)); + memset(&g_DiagMsgHdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_ChipSetMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER)); + memset(&g_ChipSetMsgHdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_DelDumpMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER)); + memset(&g_DelDumpMsgHdr, 0, sizeof(struct controlvm_message_header)); Putfile_buffer_list_pool = kmem_cache_create(Putfile_buffer_list_pool_name, @@ -2497,11 +2511,11 @@ visorchipset_exit(void) cleanup_controlvm_structures(); - memset(&g_DiagMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER)); + memset(&g_DiagMsgHdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_ChipSetMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER)); + memset(&g_ChipSetMsgHdr, 0, sizeof(struct controlvm_message_header)); - memset(&g_DelDumpMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER)); + memset(&g_DelDumpMsgHdr, 0, sizeof(struct controlvm_message_header)); LOGINF("Channel %s (ControlVm) disconnected", visorchannel_id(ControlVm_channel, s)); diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index 22241c7b4f7f..1ce7003c3a90 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -25,9 +25,7 @@ #define IS_EMPTY(charqueue) (charqueue->head == charqueue->tail) - - -struct CHARQUEUE_Tag { +struct charqueue { int alloc_size; int nslots; spinlock_t lock; @@ -35,12 +33,10 @@ struct CHARQUEUE_Tag { unsigned char buf[0]; }; - - -CHARQUEUE *visor_charqueue_create(ulong nslots) +struct charqueue *visor_charqueue_create(ulong nslots) { - int alloc_size = sizeof(CHARQUEUE) + nslots + 1; - CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); + int alloc_size = sizeof(struct charqueue) + nslots + 1; + struct charqueue *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); if (cq == NULL) { ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)", @@ -49,15 +45,14 @@ CHARQUEUE *visor_charqueue_create(ulong nslots) } cq->alloc_size = alloc_size; cq->nslots = nslots; - cq->head = cq->tail = 0; + cq->head = 0; + cq->tail = 0; spin_lock_init(&cq->lock); return cq; } EXPORT_SYMBOL_GPL(visor_charqueue_create); - - -void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) +void visor_charqueue_enqueue(struct charqueue *charqueue, unsigned char c) { int alloc_slots = charqueue->nslots+1; /* 1 slot is always empty */ @@ -71,9 +66,7 @@ void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) } EXPORT_SYMBOL_GPL(visor_charqueue_enqueue); - - -BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) +BOOL visor_charqueue_is_empty(struct charqueue *charqueue) { BOOL b; @@ -84,9 +77,7 @@ BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) } EXPORT_SYMBOL_GPL(visor_charqueue_is_empty); - - -static int charqueue_dequeue_1(CHARQUEUE *charqueue) +static int charqueue_dequeue_1(struct charqueue *charqueue) { int alloc_slots = charqueue->nslots + 1; /* 1 slot is always empty */ @@ -96,9 +87,7 @@ static int charqueue_dequeue_1(CHARQUEUE *charqueue) return charqueue->buf[charqueue->tail]; } - - -int charqueue_dequeue(CHARQUEUE *charqueue) +int charqueue_dequeue(struct charqueue *charqueue) { int rc; @@ -108,9 +97,8 @@ int charqueue_dequeue(CHARQUEUE *charqueue) return rc; } - - -int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) +int visor_charqueue_dequeue_n(struct charqueue *charqueue, unsigned char *buf, + int n) { int rc, counter = 0, c; @@ -132,9 +120,7 @@ int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) } EXPORT_SYMBOL_GPL(visor_charqueue_dequeue_n); - - -void visor_charqueue_destroy(CHARQUEUE *charqueue) +void visor_charqueue_destroy(struct charqueue *charqueue) { if (charqueue == NULL) return; diff --git a/drivers/staging/unisys/visorutil/charqueue.h b/drivers/staging/unisys/visorutil/charqueue.h index d6f16587a364..56c1f79a54b0 100644 --- a/drivers/staging/unisys/visorutil/charqueue.h +++ b/drivers/staging/unisys/visorutil/charqueue.h @@ -21,17 +21,18 @@ #include "uniklog.h" #include "timskmod.h" -/* CHARQUEUE is an opaque structure to users. +/* struct charqueue is an opaque structure to users. * Fields are declared only in the implementation .c files. */ -typedef struct CHARQUEUE_Tag CHARQUEUE; +struct charqueue; -CHARQUEUE *visor_charqueue_create(ulong nslots); -void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c); -int charqueue_dequeue(CHARQUEUE *charqueue); -int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n); -BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue); -void visor_charqueue_destroy(CHARQUEUE *charqueue); +struct charqueue *visor_charqueue_create(ulong nslots); +void visor_charqueue_enqueue(struct charqueue *charqueue, unsigned char c); +int charqueue_dequeue(struct charqueue *charqueue); +int visor_charqueue_dequeue_n(struct charqueue *charqueue, unsigned char *buf, + int n); +BOOL visor_charqueue_is_empty(struct charqueue *charqueue); +void visor_charqueue_destroy(struct charqueue *charqueue); #endif diff --git a/drivers/staging/unisys/visorutil/easyproc.c b/drivers/staging/unisys/visorutil/easyproc.c index 3b388494e2af..40f1ae9a155c 100644 --- a/drivers/staging/unisys/visorutil/easyproc.c +++ b/drivers/staging/unisys/visorutil/easyproc.c @@ -254,9 +254,9 @@ void visor_easyproc_CreateDeviceProperty(struct easyproc_device_info *p, } strcpy(px->property_name, property_name); if (px->procEntry == NULL) { - ERRDEVX(p->devno, "failed to register /proc/%s/device/%d/%s entry", - p->pdriver->ProcId, p->devno, property_name - ); + ERRDEVX(p->devno, + "failed to register /proc/%s/device/%d/%s entry", + p->pdriver->ProcId, p->devno, property_name); return; } px->show_device_property_info = show_property_info; diff --git a/drivers/staging/unisys/visorutil/memregion.h b/drivers/staging/unisys/visorutil/memregion.h index f4a65d2fcf02..0c3eebcf6d50 100644 --- a/drivers/staging/unisys/visorutil/memregion.h +++ b/drivers/staging/unisys/visorutil/memregion.h @@ -20,24 +20,24 @@ #include "timskmod.h" -/* MEMREGION is an opaque structure to users. +/* struct memregion is an opaque structure to users. * Fields are declared only in the implementation .c files. */ -typedef struct MEMREGION_Tag MEMREGION; +struct memregion; -MEMREGION *visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes); -MEMREGION *visor_memregion_create_overlapped(MEMREGION *parent, - ulong offset, ulong nbytes); -int visor_memregion_resize(MEMREGION *memregion, ulong newsize); -int visor_memregion_read(MEMREGION *memregion, - ulong offset, void *dest, ulong nbytes); -int visor_memregion_write(MEMREGION *memregion, +struct memregion *visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes); +struct memregion *visor_memregion_create_overlapped(struct memregion *parent, + ulong offset, ulong nbytes); +int visor_memregion_resize(struct memregion *memregion, ulong newsize); +int visor_memregion_read(struct memregion *memregion, + ulong offset, void *dest, ulong nbytes); +int visor_memregion_write(struct memregion *memregion, ulong offset, void *src, ulong nbytes); -void visor_memregion_destroy(MEMREGION *memregion); -HOSTADDRESS visor_memregion_get_physaddr(MEMREGION *memregion); -ulong visor_memregion_get_nbytes(MEMREGION *memregion); -void memregion_dump(MEMREGION *memregion, char *s, +void visor_memregion_destroy(struct memregion *memregion); +HOSTADDRESS visor_memregion_get_physaddr(struct memregion *memregion); +ulong visor_memregion_get_nbytes(struct memregion *memregion); +void memregion_dump(struct memregion *memregion, char *s, ulong off, ulong len, struct seq_file *seq); -void __iomem *visor_memregion_get_pointer(MEMREGION *memregion); +void __iomem *visor_memregion_get_pointer(struct memregion *memregion); #endif diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 65bc07b947db..33522cc8c22c 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -26,7 +26,7 @@ #define MYDRVNAME "memregion" -struct MEMREGION_Tag { +struct memregion { HOSTADDRESS physaddr; ulong nbytes; void __iomem *mapped; @@ -34,15 +34,15 @@ struct MEMREGION_Tag { BOOL overlapped; }; -static BOOL mapit(MEMREGION *memregion); -static void unmapit(MEMREGION *memregion); +static BOOL mapit(struct memregion *memregion); +static void unmapit(struct memregion *memregion); -MEMREGION * +struct memregion * visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) { - MEMREGION *rc = NULL; - MEMREGION *memregion = kzalloc(sizeof(MEMREGION), - GFP_KERNEL | __GFP_NORETRY); + struct memregion *rc = NULL; + struct memregion *memregion = kzalloc(sizeof(*memregion), + GFP_KERNEL | __GFP_NORETRY); if (memregion == NULL) { ERRDRV("visor_memregion_create allocation failed"); return NULL; @@ -52,24 +52,23 @@ visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) memregion->overlapped = FALSE; if (!mapit(memregion)) { rc = NULL; - goto Away; + goto cleanup; } rc = memregion; -Away: +cleanup: if (rc == NULL) { - if (memregion != NULL) { - visor_memregion_destroy(memregion); - memregion = NULL; - } + visor_memregion_destroy(memregion); + memregion = NULL; } return rc; } EXPORT_SYMBOL_GPL(visor_memregion_create); -MEMREGION * -visor_memregion_create_overlapped(MEMREGION *parent, ulong offset, ulong nbytes) +struct memregion * +visor_memregion_create_overlapped(struct memregion *parent, ulong offset, + ulong nbytes) { - MEMREGION *memregion = NULL; + struct memregion *memregion = NULL; if (parent == NULL) { ERRDRV("%s parent is NULL", __func__); @@ -85,7 +84,7 @@ visor_memregion_create_overlapped(MEMREGION *parent, ulong offset, ulong nbytes) __func__, offset, nbytes); return NULL; } - memregion = kzalloc(sizeof(MEMREGION), GFP_KERNEL|__GFP_NORETRY); + memregion = kzalloc(sizeof(*memregion), GFP_KERNEL|__GFP_NORETRY); if (memregion == NULL) { ERRDRV("%s allocation failed", __func__); return NULL; @@ -93,23 +92,23 @@ visor_memregion_create_overlapped(MEMREGION *parent, ulong offset, ulong nbytes) memregion->physaddr = parent->physaddr + offset; memregion->nbytes = nbytes; - memregion->mapped = ((u8 __iomem *) (parent->mapped)) + offset; + memregion->mapped = ((u8 __iomem *)(parent->mapped)) + offset; memregion->requested = FALSE; memregion->overlapped = TRUE; return memregion; } EXPORT_SYMBOL_GPL(visor_memregion_create_overlapped); - static BOOL -mapit(MEMREGION *memregion) +mapit(struct memregion *memregion) { - ulong physaddr = (ulong) (memregion->physaddr); + ulong physaddr = (ulong)(memregion->physaddr); ulong nbytes = memregion->nbytes; memregion->requested = FALSE; if (!request_mem_region(physaddr, nbytes, MYDRVNAME)) - ERRDRV("cannot reserve channel memory @0x%lx for 0x%lx-- no big deal", physaddr, nbytes); + ERRDRV("cannot reserve channel memory @0x%lx for 0x%lx-- no big deal", + physaddr, nbytes); else memregion->requested = TRUE; memregion->mapped = ioremap_cache(physaddr, nbytes); @@ -122,42 +121,42 @@ mapit(MEMREGION *memregion) } static void -unmapit(MEMREGION *memregion) +unmapit(struct memregion *memregion) { if (memregion->mapped != NULL) { iounmap(memregion->mapped); memregion->mapped = NULL; } if (memregion->requested) { - release_mem_region((ulong) (memregion->physaddr), + release_mem_region((ulong)(memregion->physaddr), memregion->nbytes); memregion->requested = FALSE; } } HOSTADDRESS -visor_memregion_get_physaddr(MEMREGION *memregion) +visor_memregion_get_physaddr(struct memregion *memregion) { return memregion->physaddr; } EXPORT_SYMBOL_GPL(visor_memregion_get_physaddr); ulong -visor_memregion_get_nbytes(MEMREGION *memregion) +visor_memregion_get_nbytes(struct memregion *memregion) { return memregion->nbytes; } EXPORT_SYMBOL_GPL(visor_memregion_get_nbytes); void __iomem * -visor_memregion_get_pointer(MEMREGION *memregion) +visor_memregion_get_pointer(struct memregion *memregion) { return memregion->mapped; } EXPORT_SYMBOL_GPL(visor_memregion_get_pointer); int -visor_memregion_resize(MEMREGION *memregion, ulong newsize) +visor_memregion_resize(struct memregion *memregion, ulong newsize) { if (newsize == memregion->nbytes) return 0; @@ -176,10 +175,9 @@ visor_memregion_resize(MEMREGION *memregion, ulong newsize) } EXPORT_SYMBOL_GPL(visor_memregion_resize); - static int memregion_readwrite(BOOL is_write, - MEMREGION *memregion, ulong offset, + struct memregion *memregion, ulong offset, void *local, ulong nbytes) { if (offset + nbytes > memregion->nbytes) { @@ -195,7 +193,7 @@ memregion_readwrite(BOOL is_write, } int -visor_memregion_read(MEMREGION *memregion, ulong offset, void *dest, +visor_memregion_read(struct memregion *memregion, ulong offset, void *dest, ulong nbytes) { return memregion_readwrite(FALSE, memregion, offset, dest, nbytes); @@ -203,7 +201,7 @@ visor_memregion_read(MEMREGION *memregion, ulong offset, void *dest, EXPORT_SYMBOL_GPL(visor_memregion_read); int -visor_memregion_write(MEMREGION *memregion, ulong offset, void *src, +visor_memregion_write(struct memregion *memregion, ulong offset, void *src, ulong nbytes) { return memregion_readwrite(TRUE, memregion, offset, src, nbytes); @@ -211,7 +209,7 @@ visor_memregion_write(MEMREGION *memregion, ulong offset, void *src, EXPORT_SYMBOL_GPL(visor_memregion_write); void -visor_memregion_destroy(MEMREGION *memregion) +visor_memregion_destroy(struct memregion *memregion) { if (memregion == NULL) return; diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index 3dd1c04d0e14..0908bf929401 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -25,8 +25,6 @@ #define MYDRVNAME "periodic_work" - - struct periodic_work { rwlock_t lock; struct delayed_work work; @@ -39,8 +37,6 @@ struct periodic_work { const char *devnam; }; - - static void periodic_work_func(struct work_struct *work) { struct periodic_work *pw; @@ -49,8 +45,6 @@ static void periodic_work_func(struct work_struct *work) (*pw->workfunc)(pw->workfuncarg); } - - struct periodic_work *visor_periodic_work_create(ulong jiffy_interval, struct workqueue_struct *workqueue, void (*workfunc)(void *), @@ -73,16 +67,12 @@ struct periodic_work *visor_periodic_work_create(ulong jiffy_interval, } EXPORT_SYMBOL_GPL(visor_periodic_work_create); - - void visor_periodic_work_destroy(struct periodic_work *pw) { kfree(pw); } EXPORT_SYMBOL_GPL(visor_periodic_work_destroy); - - /** Call this from your periodic work worker function to schedule the next * call. * If this function returns FALSE, there was a failure and the @@ -112,8 +102,6 @@ unlock: } EXPORT_SYMBOL_GPL(visor_periodic_work_nextperiod); - - /** This function returns TRUE iff new periodic work was actually started. * If this function returns FALSE, then no work was started * (either because it was already started, or because of a failure). @@ -145,13 +133,9 @@ BOOL visor_periodic_work_start(struct periodic_work *pw) unlock: write_unlock(&pw->lock); return rc; - } EXPORT_SYMBOL_GPL(visor_periodic_work_start); - - - /** This function returns TRUE iff your call actually stopped the periodic * work. * @@ -223,8 +207,9 @@ BOOL visor_periodic_work_stop(struct periodic_work *pw) */ SLEEPJIFFIES(10); write_lock(&pw->lock); - } else + } else { pw->want_to_stop = FALSE; + } } write_unlock(&pw->lock); return stopped_something; diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index c476036f7382..195772d22c9e 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -320,19 +320,18 @@ void visor_proc_DestroyObject(MYPROCOBJECT *obj) kfree(obj->procDirProperties); obj->procDirProperties = NULL; } - if (obj->procDirPropertyContexts != NULL) { - kfree(obj->procDirPropertyContexts); - obj->procDirPropertyContexts = NULL; - } + + kfree(obj->procDirPropertyContexts); + obj->procDirPropertyContexts = NULL; + if (obj->procDir != NULL) { if (obj->name != NULL) remove_proc_entry(obj->name, type->procDir); obj->procDir = NULL; } - if (obj->name != NULL) { - kfree(obj->name); - obj->name = NULL; - } + + kfree(obj->name); + obj->name = NULL; kfree(obj); } EXPORT_SYMBOL_GPL(visor_proc_DestroyObject); diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c index d6815f9e1337..556e2642d2d9 100644 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ b/drivers/staging/unisys/visorutil/visorkmodutils.c @@ -36,18 +36,7 @@ int unisys_spar_platform; EXPORT_SYMBOL_GPL(unisys_spar_platform); -/** Callers to interfaces that set __GFP_NORETRY flag below - * must check for a NULL (error) result as we are telling the - * kernel interface that it is okay to fail. - */ - -void *kmalloc_kernel(size_t siz) -{ - return kmalloc(siz, GFP_KERNEL | __GFP_NORETRY); -} - -static __init uint32_t -visorutil_spar_detect(void) +static __init uint32_t visorutil_spar_detect(void) { unsigned int eax, ebx, ecx, edx; @@ -57,22 +46,19 @@ visorutil_spar_detect(void) return (ebx == UNISYS_SPAR_ID_EBX) && (ecx == UNISYS_SPAR_ID_ECX) && (edx == UNISYS_SPAR_ID_EDX); - } else + } else { return 0; - + } } - - - -static __init int -visorutil_mod_init(void) +static __init int visorutil_mod_init(void) { if (visorutil_spar_detect()) { unisys_spar_platform = TRUE; return 0; - } else + } else { return -ENODEV; + } } static __exit void |