* 1 if the insertion succeeds, 0 if the queue was full.
*/
unsigned char
-visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal)
+visor_signal_insert(struct channel_header __iomem *pChannel, u32 Queue,
+ void *pSignal)
{
void __iomem *psignal;
unsigned int head, tail, nof;
* 1 if the removal succeeds, 0 if the queue was empty.
*/
unsigned char
-visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal)
+visor_signal_remove(struct channel_header __iomem *pChannel, u32 Queue,
+ void *pSignal)
{
void __iomem *psource;
unsigned int head, tail;
* # of signals copied.
*/
unsigned int
-SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal)
+SignalRemoveAll(struct channel_header *pChannel, u32 Queue, void *pSignal)
{
void *psource;
unsigned int head, tail, signalCount = 0;
* 1 if the signal queue is empty, 0 otherwise.
*/
unsigned char
-visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel, u32 Queue)
+visor_signalqueue_empty(struct channel_header __iomem *pChannel, u32 Queue)
{
SIGNAL_QUEUE_HEADER __iomem *pqhdr =
(SIGNAL_QUEUE_HEADER __iomem *) ((char __iomem *) pChannel +
}
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 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;
#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
newstate, logCtx) \
do { \
ULTRA_CHANNEL_CLIENT_CHK_TRANSITION( \
- readl(&(((CHANNEL_HEADER __iomem *) \
+ readl(&(((struct channel_header __iomem *) \
(pChan))->CliStateOS)), \
newstate, \
chanId, logCtx, __FILE__, __LINE__); \
pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \
chanId, "CliStateOS", \
ULTRA_CHANNELCLI_STRING( \
- readl(&((CHANNEL_HEADER __iomem *) \
+ readl(&((struct channel_header __iomem *)\
(pChan))->CliStateOS)), \
- readl(&((CHANNEL_HEADER __iomem *) \
+ readl(&((struct channel_header __iomem *) \
(pChan))->CliStateOS), \
ULTRA_CHANNELCLI_STRING(newstate), \
newstate, \
PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \
- writel(newstate, &((CHANNEL_HEADER __iomem *) \
+ writel(newstate, &((struct channel_header __iomem *) \
(pChan))->CliStateOS); \
mb(); /* required for channel synch */ \
} while (0)
#pragma pack(push, 1) /* both GCC and VC now allow this pragma */
/* Common Channel Header */
-typedef struct _CHANNEL_HEADER {
+struct channel_header {
u64 Signature; /* Signature */
u32 LegacyState; /* DEPRECATED - being replaced by */
/* / SrvState, CliStateBoot, and CliStateOS below */
- u32 HeaderSize; /* sizeof(CHANNEL_HEADER) */
+ 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; /* CHANNEL_HEADER Version ID */
+ 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
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;
+};
#define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0)
uuid_le guid;
memcpy_fromio(&guid,
- &((CHANNEL_HEADER __iomem *)(pChannel))->Type,
+ &((struct channel_header __iomem *)
+ (pChannel))->Type,
sizeof(guid));
/* caller wants us to verify type GUID */
if (uuid_le_cmp(guid, expectedTypeGuid) != 0) {
}
if (expectedMinBytes > 0) { /* caller wants us to verify
* channel size */
- unsigned long long bytes = readq(&((CHANNEL_HEADER __iomem *)
- (pChannel))->Size);
+ unsigned long long bytes =
+ readq(&((struct channel_header __iomem *)
+ (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(&((CHANNEL_HEADER __iomem *)
+ unsigned long ver = readl(&((struct channel_header __iomem *)
(pChannel))->VersionId);
if (ver != expectedVersionId) {
pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n",
}
if (expectedSignature > 0) { /* caller wants us to verify
* channel signature */
- unsigned long long sig = readq(&((CHANNEL_HEADER __iomem *)
- (pChannel))->Signature);
+ unsigned long long sig =
+ readq(&((struct channel_header __iomem *)
+ (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,
ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId,
void *logCtx, char *file, int line, char *func)
{
- CHANNEL_HEADER __iomem *pChan = pChannel;
+ struct channel_header __iomem *pChan = pChannel;
if (readl(&pChan->CliStateOS) == CHANNELCLI_DISABLED) {
if ((readb(&pChan->CliErrorOS)
ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId,
void *logCtx, char *file, int line, char *func)
{
- CHANNEL_HEADER __iomem *pChan = pChannel;
+ struct channel_header __iomem *pChan = pChannel;
if (readb(&pChan->CliErrorOS) != 0) {
/* we are in an error msg throttling state; come out of it */
* full.
*/
-unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue,
- void *pSignal);
+unsigned char visor_signal_insert(struct channel_header __iomem *pChannel,
+ u32 Queue, void *pSignal);
/*
* Routine Description:
* empty.
*/
-unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue,
- void *pSignal);
+unsigned char visor_signal_remove(struct channel_header __iomem *pChannel,
+ u32 Queue, void *pSignal);
/*
* Routine Description:
* Return value:
* # of signals copied.
*/
-unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue,
+unsigned int SignalRemoveAll(struct channel_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,
+unsigned char visor_signalqueue_empty(struct channel_header __iomem *pChannel,
u32 Queue);
#endif
} GUEST_DEVICES;
typedef struct _ULTRA_CONTROLVM_CHANNEL_PROTOCOL {
- CHANNEL_HEADER Header;
+ struct channel_header Header;
GUEST_PHYSICAL_ADDRESS gpControlVm; /* guest physical address of
* this channel */
GUEST_PHYSICAL_ADDRESS gpPartitionTables; /* guest physical address of
/* ----------------------- */
/* Offsets/sizes for diagnostic channel attributes... */
-#define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(ULTRA_CHANNEL_PROTOCOL))
+#define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(struct channel_header))
#define DIAG_CH_QUEUE_HEADER_SIZE (sizeof(SIGNAL_QUEUE_HEADER))
#define DIAG_CH_PROTOCOL_HEADER_OFFSET \
(DIAG_CH_QUEUE_HEADER_OFFSET + DIAG_CH_QUEUE_HEADER_SIZE)
*Reserved: Reserved area to allow for correct channel size padding.
*/
typedef struct _ULTRA_DIAG_CHANNEL_PROTOCOL {
- ULTRA_CHANNEL_PROTOCOL CommonChannelHeader;
+ struct channel_header CommonChannelHeader;
SIGNAL_QUEUE_HEADER QueueHeader;
DIAG_CHANNEL_PROTOCOL_HEADER DiagChannelHeader;
DIAG_CHANNEL_EVENT Events[(DIAG_CH_SIZE - DIAG_CH_EVENT_OFFSET) /
* 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;
+ struct channel_header ChannelHeader;
SIGNAL_QUEUE_HEADER cmdQ;
SIGNAL_QUEUE_HEADER rspQ;
union {
} ULTRA_VBUS_HEADERINFO;
struct ultra_vbus_channel_protocol {
- ULTRA_CHANNEL_PROTOCOL ChannelHeader; /* initialized by server */
+ struct channel_header ChannelHeader; /* initialized by server */
ULTRA_VBUS_HEADERINFO HdrInfo; /* initialized by server */
/* the remainder of this channel is filled in by the client */
struct ultra_vbus_deviceinfo ChpInfo;
#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
*/
if (!uuid_le_cmp(dev->channel_uuid,
spar_vhba_channel_protocol_uuid)) {
- wait_for_valid_guid(&((CHANNEL_HEADER
- __iomem *) (dev->
+ wait_for_valid_guid(&((
+ struct channel_header
+ __iomem *) (dev->
chanptr))->
Type);
if (!ULTRA_VHBA_CHANNEL_OK_CLIENT
} else
if (!uuid_le_cmp(dev->channel_uuid,
spar_vnic_channel_protocol_uuid)) {
- wait_for_valid_guid(&((CHANNEL_HEADER
- __iomem *) (dev->
+ wait_for_valid_guid(&((
+ struct channel_header
+ __iomem *) (dev->
chanptr))->
Type);
if (!ULTRA_VNIC_CHANNEL_OK_CLIENT
LOGINF("sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL):%lu bytes\n",
(ulong) sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL));
LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n",
- (ulong) sizeof(CHANNEL_HEADER));
+ (ulong) sizeof(struct channel_header));
LOGINF("sizeof(ULTRA_IO_CHANNEL_PROTOCOL):%lu bytes\n",
(ulong) sizeof(ULTRA_IO_CHANNEL_PROTOCOL));
LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP);
virthba_ISR(int irq, void *dev_id)
{
struct virthba_info *virthbainfo = (struct virthba_info *) dev_id;
- CHANNEL_HEADER __iomem *pChannelHeader;
+ struct channel_header __iomem *pChannelHeader;
SIGNAL_QUEUE_HEADER __iomem *pqhdr;
u64 mask;
unsigned long long rc1;
int rsp;
int i;
irq_handler_t handler = virthba_ISR;
- CHANNEL_HEADER __iomem *pChannelHeader;
+ struct channel_header __iomem *pChannelHeader;
SIGNAL_QUEUE_HEADER __iomem *pqhdr;
u64 mask;
LOGERR("vbus channel not present");
return -1;
}
- off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.chpInfoByteOffset;
+ off = sizeof(struct channel_header) + chan->HdrInfo.chpInfoByteOffset;
if (chan->HdrInfo.chpInfoByteOffset == 0) {
LOGERR("vbus channel not used, because chpInfoByteOffset == 0");
return -1;
LOGERR("vbus channel not present");
return -1;
}
- off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.busInfoByteOffset;
+ off = sizeof(struct channel_header) + chan->HdrInfo.busInfoByteOffset;
if (chan->HdrInfo.busInfoByteOffset == 0) {
LOGERR("vbus channel not used, because busInfoByteOffset == 0");
return -1;
return -1;
}
off =
- (sizeof(ULTRA_CHANNEL_PROTOCOL) +
+ (sizeof(struct channel_header) +
chan->HdrInfo.devInfoByteOffset) +
(chan->HdrInfo.deviceInfoStructBytes * devix);
if (chan->HdrInfo.devInfoByteOffset == 0) {
struct VISORCHANNEL_Tag {
MEMREGION *memregion; /* from visor_memregion_create() */
- CHANNEL_HEADER chan_hdr;
+ struct channel_header chan_hdr;
uuid_le guid;
ulong size;
BOOL needs_lock;
/* 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;
}
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;
{
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);
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);
{
BOOL rc = FALSE;
- if (channel->chan_hdr.oChannelSpace < sizeof(CHANNEL_HEADER)) {
+ if (channel->chan_hdr.oChannelSpace < sizeof(struct channel_header)) {
ERRDRV("oChannelSpace too small: (status=%d)\n", rc);
goto Away;
}
HOSTADDRESS addr = 0;
ulong nbytes = 0, nbytes_region = 0;
MEMREGION *memregion = NULL;
- CHANNEL_HEADER hdr;
- CHANNEL_HEADER *phdr = &hdr;
+ struct channel_header hdr;
+ struct channel_header *phdr = &hdr;
int i = 0;
int errcode = 0;
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",
/* 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;