#define ULTRA_CHANNELSRV_IS_READY(x) ((x) == CHANNELSRV_READY)
#define ULTRA_CHANNEL_SERVER_READY(pChannel) \
- (ULTRA_CHANNELSRV_IS_READY(readl(&(pChannel)->SrvState)))
+ (ULTRA_CHANNELSRV_IS_READY(readl(&(pChannel)->srv_state)))
#define ULTRA_VALID_CHANNELCLI_TRANSITION(o, n) \
(((((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_DISABLED)) || \
do { \
ULTRA_CHANNEL_CLIENT_CHK_TRANSITION( \
readl(&(((struct channel_header __iomem *) \
- (pChan))->CliStateOS)), \
+ (pChan))->cli_state_os)), \
newstate, \
chanId, logCtx, __FILE__, __LINE__); \
pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \
chanId, "CliStateOS", \
ULTRA_CHANNELCLI_STRING( \
readl(&((struct channel_header __iomem *)\
- (pChan))->CliStateOS)), \
+ (pChan))->cli_state_os)), \
readl(&((struct channel_header __iomem *) \
- (pChan))->CliStateOS), \
+ (pChan))->cli_state_os), \
ULTRA_CHANNELCLI_STRING(newstate), \
newstate, \
PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \
writel(newstate, &((struct channel_header __iomem *) \
- (pChan))->CliStateOS); \
+ (pChan))->cli_state_os); \
mb(); /* required for channel synch */ \
} while (0)
#pragma pack(push, 1) /* both GCC and VC now allow this pragma */
/* Common Channel Header */
struct channel_header {
- u64 Signature; /* Signature */
- u32 LegacyState; /* DEPRECATED - being replaced by */
+ u64 signature; /* Signature */
+ u32 legacy_state; /* DEPRECATED - being replaced by */
/* / SrvState, CliStateBoot, and CliStateOS below */
- u32 HeaderSize; /* sizeof(struct 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; /* struct 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;
+ u8 recover_channel;
};
#define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0)
uuid_le guid;
memcpy_fromio(&guid,
- &((struct channel_header __iomem *)
- (pChannel))->Type,
- sizeof(guid));
+ &((struct channel_header __iomem *)(pChannel))->chtype,
+ sizeof(guid));
/* caller wants us to verify type GUID */
if (uuid_le_cmp(guid, expectedTypeGuid) != 0) {
pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n",
* channel size */
unsigned long long bytes =
readq(&((struct channel_header __iomem *)
- (pChannel))->Size);
+ (pChannel))->size);
if (bytes < expectedMinBytes) {
pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
channelName, &expectedTypeGuid,
if (expectedVersionId > 0) { /* caller wants us to verify
* channel version */
unsigned long ver = readl(&((struct channel_header __iomem *)
- (pChannel))->VersionId);
+ (pChannel))->version_id);
if (ver != expectedVersionId) {
pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n",
channelName, &expectedTypeGuid,
* channel signature */
unsigned long long sig =
readq(&((struct channel_header __iomem *)
- (pChannel))->Signature);
+ (pChannel))->signature);
if (sig != expectedSignature) {
pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n",
channelName, &expectedTypeGuid,
{
struct channel_header __iomem *pChan = pChannel;
- if (readl(&pChan->CliStateOS) == CHANNELCLI_DISABLED) {
- if ((readb(&pChan->CliErrorOS)
+ if (readl(&pChan->cli_state_os) == CHANNELCLI_DISABLED) {
+ if ((readb(&pChan->cli_error_os)
& ULTRA_CLIERROROS_THROTTLEMSG_DISABLED) == 0) {
/* we are NOT throttling this message */
- writeb(readb(&pChan->CliErrorOS) |
+ writeb(readb(&pChan->cli_error_os) |
ULTRA_CLIERROROS_THROTTLEMSG_DISABLED,
- &pChan->CliErrorOS);
+ &pChan->cli_error_os);
/* throttle until acquire successful */
pr_info("%s Channel StateTransition INVALID! - acquire failed because OS client DISABLED @%s:%d\n",
}
return 0;
}
- if ((readl(&pChan->CliStateOS) != CHANNELCLI_OWNED)
- && (readl(&pChan->CliStateBoot) == CHANNELCLI_DISABLED)) {
+ if ((readl(&pChan->cli_state_os) != CHANNELCLI_OWNED)
+ && (readl(&pChan->cli_state_boot) == CHANNELCLI_DISABLED)) {
/* Our competitor is DISABLED, so we can transition to OWNED */
pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n",
- chanId, "CliStateOS",
- ULTRA_CHANNELCLI_STRING(readl(&pChan->CliStateOS)),
- readl(&pChan->CliStateOS),
+ chanId, "cli_state_os",
+ ULTRA_CHANNELCLI_STRING(readl(&pChan->cli_state_os)),
+ readl(&pChan->cli_state_os),
ULTRA_CHANNELCLI_STRING(CHANNELCLI_OWNED),
CHANNELCLI_OWNED,
PathName_Last_N_Nodes((u8 *) file, 4), line);
- writel(CHANNELCLI_OWNED, &pChan->CliStateOS);
+ writel(CHANNELCLI_OWNED, &pChan->cli_state_os);
mb(); /* required for channel synch */
}
- if (readl(&pChan->CliStateOS) == CHANNELCLI_OWNED) {
- if (readb(&pChan->CliErrorOS) != 0) {
+ if (readl(&pChan->cli_state_os) == CHANNELCLI_OWNED) {
+ if (readb(&pChan->cli_error_os) != 0) {
/* we are in an error msg throttling state;
* come out of it */
pr_info("%s Channel OS client acquire now successful @%s:%d\n",
chanId, PathName_Last_N_Nodes((u8 *) file, 4),
line);
- writeb(0, &pChan->CliErrorOS);
+ writeb(0, &pChan->cli_error_os);
}
return 1;
}
/* 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(&pChan->cli_state_os) != CHANNELCLI_ATTACHED) {
+ if ((readb(&pChan->cli_error_os)
& ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED) == 0) {
/* we are NOT throttling this message */
- writeb(readb(&pChan->CliErrorOS) |
+ writeb(readb(&pChan->cli_error_os) |
ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED,
- &pChan->CliErrorOS);
+ &pChan->cli_error_os);
/* throttle until acquire successful */
pr_info("%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),
+ readl(&pChan->cli_state_os)),
+ readl(&pChan->cli_state_os),
PathName_Last_N_Nodes((u8 *) file, 4),
line);
}
return 0;
}
- writel(CHANNELCLI_BUSY, &pChan->CliStateOS);
+ writel(CHANNELCLI_BUSY, &pChan->cli_state_os);
mb(); /* required for channel synch */
- if (readl(&pChan->CliStateBoot) == CHANNELCLI_BUSY) {
- if ((readb(&pChan->CliErrorOS)
+ if (readl(&pChan->cli_state_boot) == CHANNELCLI_BUSY) {
+ if ((readb(&pChan->cli_error_os)
& ULTRA_CLIERROROS_THROTTLEMSG_BUSY) == 0) {
/* we are NOT throttling this message */
- writeb(readb(&pChan->CliErrorOS) |
+ writeb(readb(&pChan->cli_error_os) |
ULTRA_CLIERROROS_THROTTLEMSG_BUSY,
- &pChan->CliErrorOS);
+ &pChan->cli_error_os);
/* throttle until acquire successful */
pr_info("%s Channel StateTransition failed - host OS acquire failed because boot BUSY @%s:%d\n",
chanId, PathName_Last_N_Nodes((u8 *) file, 4),
line);
}
/* reset busy */
- writel(CHANNELCLI_ATTACHED, &pChan->CliStateOS);
+ writel(CHANNELCLI_ATTACHED, &pChan->cli_state_os);
mb(); /* required for channel synch */
return 0;
}
- if (readb(&pChan->CliErrorOS) != 0) {
+ if (readb(&pChan->cli_error_os) != 0) {
/* we are in an error msg throttling state; come out of it */
pr_info("%s Channel OS client acquire now successful @%s:%d\n",
chanId, PathName_Last_N_Nodes((u8 *) file, 4),
line);
- writeb(0, &pChan->CliErrorOS);
+ writeb(0, &pChan->cli_error_os);
}
return 1;
}
{
struct channel_header __iomem *pChan = pChannel;
- if (readb(&pChan->CliErrorOS) != 0) {
+ if (readb(&pChan->cli_error_os) != 0) {
/* we are in an error msg throttling state; come out of it */
pr_info("%s Channel OS client error state cleared @%s:%d\n",
chanId, PathName_Last_N_Nodes((u8 *) file, 4),
line);
- writeb(0, &pChan->CliErrorOS);
+ writeb(0, &pChan->cli_error_os);
}
- if (readl(&pChan->CliStateOS) == CHANNELCLI_OWNED)
+ if (readl(&pChan->cli_state_os) == CHANNELCLI_OWNED)
return;
- if (readl(&pChan->CliStateOS) != CHANNELCLI_BUSY) {
+ if (readl(&pChan->cli_state_os) != CHANNELCLI_BUSY) {
pr_info("%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),
+ readl(&pChan->cli_state_os)),
+ readl(&pChan->cli_state_os),
PathName_Last_N_Nodes((u8 *) file, 4), line);
/* return; */
}
- writel(CHANNELCLI_ATTACHED, &pChan->CliStateOS); /* release busy */
+ writel(CHANNELCLI_ATTACHED, &pChan->cli_state_os); /* release busy */
}
/*
#define QSIZEFROMBYTES(bytes) (QSLOTSFROMBYTES(bytes)*SIZEOF_CMDRSP)
#define SignalQInit(x) \
do { \
- x->cmdQ.Size = QSIZEFROMBYTES(x->ChannelHeader.Size); \
+ 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); \
+ QSLOTSFROMBYTES(x->ChannelHeader.size); \
x->cmdQ.MaxSignals = x->cmdQ.MaxSignalSlots - 1; \
- x->rspQ.Size = QSIZEFROMBYTES(x->ChannelHeader.Size); \
+ 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); \
+ QSLOTSFROMBYTES(x->ChannelHeader.size); \
x->rspQ.MaxSignals = x->rspQ.MaxSignalSlots - 1; \
- x->ChannelHeader.oChannelSpace = \
+ x->ChannelHeader.ch_space_offset = \
offsetof(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ); \
} while (0)
#define INIT_CLIENTSTRING(chan, type, clientStr, clientStrLen) \
do { \
if (clientStr) { \
- chan->ChannelHeader.oClientString = \
+ chan->ChannelHeader.cli_str_offset = \
offsetof(type, clientString); \
memcpy(chan->clientString, clientStr, \
MINNUM(clientStrLen, \
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 = spar_vhba_channel_protocol_uuid;
- x->ChannelHeader.ZoneGuid = NULL_UUID_LE;
+ x->ChannelHeader.version_id = ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID;
+ x->ChannelHeader.signature = ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE;
+ x->ChannelHeader.srv_state = CHANNELSRV_UNINITIALIZED;
+ x->ChannelHeader.header_size = sizeof(x->ChannelHeader);
+ x->ChannelHeader.size = COVER(bytes, 4096);
+ x->ChannelHeader.chtype = spar_vhba_channel_protocol_uuid;
+ x->ChannelHeader.zone_uuid = NULL_UUID_LE;
x->vhba.wwnn = *wwnn;
x->vhba.max = *max;
INIT_CLIENTSTRING(x, ULTRA_IO_CHANNEL_PROTOCOL, 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 = spar_vnic_channel_protocol_uuid;
- x->ChannelHeader.ZoneGuid = NULL_UUID_LE;
+ x->ChannelHeader.version_id = ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID;
+ x->ChannelHeader.signature = ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE;
+ x->ChannelHeader.srv_state = CHANNELSRV_UNINITIALIZED;
+ x->ChannelHeader.header_size = sizeof(x->ChannelHeader);
+ x->ChannelHeader.size = COVER(bytes, 4096);
+ x->ChannelHeader.chtype = spar_vnic_channel_protocol_uuid;
+ x->ChannelHeader.zone_uuid = NULL_UUID_LE;
memcpy(x->vnic.macaddr, macaddr, MAX_MACADDR_LEN);
x->vnic.num_rcv_bufs = num_rcv_bufs;
x->vnic.mtu = mtu;
}
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;
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);
* channel header
*/
#define SIG_QUEUE_OFFSET(chan_hdr, q) \
- ((chan_hdr)->oChannelSpace + ((q) * sizeof(SIGNAL_QUEUE_HEADER)))
+ ((chan_hdr)->ch_space_offset + ((q) * sizeof(SIGNAL_QUEUE_HEADER)))
/** Return offset of a specific queue entry (data) from the beginning of a
* channel header
{
BOOL rc = FALSE;
- if (channel->chan_hdr.oChannelSpace < sizeof(struct channel_header)) {
+ if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header)) {
ERRDRV("oChannelSpace too small: (status=%d)\n", rc);
goto Away;
}
} 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;
errcode = visorchannel_read(channel,
- off + phdr->oChannelSpace +
- (i * sizeof(q)),
- &q, sizeof(q));
+ off + phdr->ch_space_offset +
+ (i * sizeof(q)),
+ &q, sizeof(q));
if (errcode < 0) {
seq_printf(seq,
"failed to read signal queue #%d from channel @0x%-16.16Lx errcode=%d\n",