Commit 98d7b594 authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

staging: unisys: refactor CONTROLVM_MESSAGE_HEADER

This patch removes the typedef from CONTROLVM_MESSAGE_HEADER, using the
struct controlvm_message_header name directly instead. It fixes
CamelCase names and updates all references to changed names:

MessageSize => message_size
SegmentIndex => segment_index
CompletionStatus => completion_status
responseExpected => response_expected
testMessage => test_message
partialCompletion => partial_completion
writerInDiag => writer_in_diag
Flags => flags
Reserved => reserved
MessageHandle => message_handle
PayloadVmOffset => payload_vm_offset
PayloadMaxBytes => payload_max_bytes
PayloadBytes => payload_bytes
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2ea5117b
...@@ -169,53 +169,51 @@ enum ultra_chipset_feature { ...@@ -169,53 +169,51 @@ enum ultra_chipset_feature {
* queue. Commands are easily distinguished from responses by * queue. Commands are easily distinguished from responses by
* looking at the flags.response field. * looking at the flags.response field.
*/ */
typedef struct _CONTROLVM_MESSAGE_HEADER { struct controlvm_message_header {
u32 Id; /* See control_vm_id. */ u32 id; /* See CONTROLVM_ID. */
/* For requests, indicates the message type. */ /* For requests, indicates the message type. */
/* For responses, indicates the type of message we are responding to. */ /* 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 */ * of message */
u32 SegmentIndex; /* Index of segment containing Vm u32 segment_index; /* Index of segment containing Vm
* message/information */ * message/information */
u32 CompletionStatus; /* Error status code or result of u32 completion_status; /* Error status code or result of
* message completion */ * message completion */
struct { struct {
u32 failed:1; /**< =1 in a response to * signify u32 failed:1; /**< =1 in a response to * signify
* failure */ * 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 * response (Control ignores this
* bit) */ * bit) */
u32 server:1; /**< =1 in all bus & device-related u32 server:1; /**< =1 in all bus & device-related
* messages where the message * messages where the message
* receiver is to act as the bus or * receiver is to act as the bus or
* device server */ * device server */
u32 testMessage:1; /**< =1 for testing use only u32 test_message:1; /**< =1 for testing use only
* (Control and Command ignore this * (Control and Command ignore this
* bit) */ * bit) */
u32 partialCompletion:1; /**< =1 if there are forthcoming u32 partial_completion:1; /**< =1 if there are forthcoming
* responses/acks associated * responses/acks associated
* with this message */ * with this message */
u32 preserve:1; /**< =1 this is to let us know to u32 preserve:1; /**< =1 this is to let us know to
* preserve channel contents * preserve channel contents
* (for running guests)*/ * (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*/ * Diagnostic Partition*/
} flags;
/* remaining bits in this 32-bit word are available */ u32 reserved; /* Natural alignment */
} Flags; u64 message_handle; /* Identifies the particular message instance,
u32 Reserved; /* Natural alignment */
u64 MessageHandle; /* Identifies the particular message instance,
* and is used to match particular */ * and is used to match particular */
/* request instances with the corresponding response instance. */ /* 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 */ * instance of ControlVm segment */
u32 PayloadMaxBytes; /* Maximum bytes allocated in payload u32 payload_max_bytes; /* Maximum bytes allocated in payload
* area of ControlVm segment */ * 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; */ * area to copy between IO/Command; */
/* if non-zero, there is a payload to copy. */ /* if non-zero, there is a payload to copy. */
} CONTROLVM_MESSAGE_HEADER; };
typedef struct _CONTROLVM_PACKET_DEVICE_CREATE { typedef struct _CONTROLVM_PACKET_DEVICE_CREATE {
u32 busNo; /**< bus # (0..n-1) from the msg receiver's u32 busNo; /**< bus # (0..n-1) from the msg receiver's
...@@ -241,12 +239,12 @@ typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE { ...@@ -241,12 +239,12 @@ typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE {
} CONTROLVM_PACKET_DEVICE_CONFIGURE; /* for CONTROLVM_DEVICE_CONFIGURE */ } CONTROLVM_PACKET_DEVICE_CONFIGURE; /* for CONTROLVM_DEVICE_CONFIGURE */
typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE { typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE {
CONTROLVM_MESSAGE_HEADER Header; struct controlvm_message_header Header;
CONTROLVM_PACKET_DEVICE_CREATE Packet; CONTROLVM_PACKET_DEVICE_CREATE Packet;
} CONTROLVM_MESSAGE_DEVICE_CREATE; /* total 128 bytes */ } CONTROLVM_MESSAGE_DEVICE_CREATE; /* total 128 bytes */
typedef struct _CONTROLVM_MESSAGE_DEVICE_CONFIGURE { typedef struct _CONTROLVM_MESSAGE_DEVICE_CONFIGURE {
CONTROLVM_MESSAGE_HEADER Header; struct controlvm_message_header Header;
CONTROLVM_PACKET_DEVICE_CONFIGURE Packet; CONTROLVM_PACKET_DEVICE_CONFIGURE Packet;
} CONTROLVM_MESSAGE_DEVICE_CONFIGURE; /* total 56 bytes */ } CONTROLVM_MESSAGE_DEVICE_CONFIGURE; /* total 56 bytes */
...@@ -343,7 +341,7 @@ struct controlvm_message_packet { ...@@ -343,7 +341,7 @@ struct controlvm_message_packet {
/* All messages in any ControlVm queue have this layout. */ /* All messages in any ControlVm queue have this layout. */
typedef struct _CONTROLVM_MESSAGE { typedef struct _CONTROLVM_MESSAGE {
CONTROLVM_MESSAGE_HEADER hdr; struct controlvm_message_header hdr;
struct controlvm_message_packet cmd; struct controlvm_message_packet cmd;
} CONTROLVM_MESSAGE; } CONTROLVM_MESSAGE;
......
...@@ -124,9 +124,9 @@ static void ...@@ -124,9 +124,9 @@ static void
init_msg_header(CONTROLVM_MESSAGE *msg, u32 id, uint rsp, uint svr) init_msg_header(CONTROLVM_MESSAGE *msg, u32 id, uint rsp, uint svr)
{ {
memset(msg, 0, sizeof(CONTROLVM_MESSAGE)); memset(msg, 0, sizeof(CONTROLVM_MESSAGE));
msg->hdr.Id = id; msg->hdr.id = id;
msg->hdr.Flags.responseExpected = rsp; msg->hdr.flags.response_expected = rsp;
msg->hdr.Flags.server = svr; msg->hdr.flags.server = svr;
} }
static __iomem void * static __iomem void *
...@@ -188,7 +188,7 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -188,7 +188,7 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf)
/* Currently by default, the bus Number is the GuestHandle. /* Currently by default, the bus Number is the GuestHandle.
* Configure Bus message can override this. * 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... */ /* This implies we're the IOVM so set guest handle to 0... */
bus->guest_handle = 0; bus->guest_handle = 0;
bus->bus_no = busNo; bus->bus_no = busNo;
...@@ -229,7 +229,7 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -229,7 +229,7 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf)
msg->cmd.create_bus.channel_bytes); msg->cmd.create_bus.channel_bytes);
} }
/* the msg is bound for virtpci; send guest_msgs struct to callback */ /* 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; struct guest_msgs cmd;
cmd.msgtype = GUEST_ADD_VBUS; cmd.msgtype = GUEST_ADD_VBUS;
...@@ -309,7 +309,7 @@ destroy_bus(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -309,7 +309,7 @@ destroy_bus(CONTROLVM_MESSAGE *msg, char *buf)
} }
read_unlock(&BusListLock); read_unlock(&BusListLock);
if (msg->hdr.Flags.server) if (msg->hdr.flags.server)
goto remove; goto remove;
/* client messages require us to call the virtpci callback associated /* client messages require us to call the virtpci callback associated
...@@ -376,7 +376,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -376,7 +376,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
sema_init(&dev->interrupt_callback_lock, 1); /* unlocked */ sema_init(&dev->interrupt_callback_lock, 1); /* unlocked */
sprintf(dev->devid, "vbus%u:dev%u", (unsigned) busNo, (unsigned) devNo); sprintf(dev->devid, "vbus%u:dev%u", (unsigned) busNo, (unsigned) devNo);
/* map the channel memory for the device. */ /* 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); dev->chanptr = (void __iomem *)__va(dev->channel_addr);
else { else {
pReqHandler = req_handler_find(dev->channel_uuid); pReqHandler = req_handler_find(dev->channel_uuid);
...@@ -439,7 +439,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -439,7 +439,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
/* the msg is bound for virtpci; send /* the msg is bound for virtpci; send
* guest_msgs struct to callback * guest_msgs struct to callback
*/ */
if (!msg->hdr.Flags.server) { if (!msg->hdr.flags.server) {
struct guest_msgs cmd; struct guest_msgs cmd;
if (!uuid_le_cmp(dev->channel_uuid, if (!uuid_le_cmp(dev->channel_uuid,
...@@ -534,7 +534,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -534,7 +534,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
result = CONTROLVM_RESP_ERROR_BUS_INVALID; result = CONTROLVM_RESP_ERROR_BUS_INVALID;
Away: Away:
if (!msg->hdr.Flags.testMessage) { if (!msg->hdr.flags.test_message) {
uislib_iounmap(dev->chanptr); uislib_iounmap(dev->chanptr);
dev->chanptr = NULL; dev->chanptr = NULL;
} }
...@@ -758,7 +758,7 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -758,7 +758,7 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
uislib_disable_channel_interrupts(busNo, devNo); uislib_disable_channel_interrupts(busNo, devNo);
} }
/* unmap the channel memory for the device. */ /* unmap the channel memory for the device. */
if (!msg->hdr.Flags.testMessage) { if (!msg->hdr.flags.test_message) {
LOGINF("destroy_device, doing iounmap"); LOGINF("destroy_device, doing iounmap");
uislib_iounmap(dev->chanptr); uislib_iounmap(dev->chanptr);
} }
...@@ -779,12 +779,12 @@ init_chipset(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -779,12 +779,12 @@ init_chipset(CONTROLVM_MESSAGE *msg, char *buf)
/* We need to make sure we have our functions registered /* We need to make sure we have our functions registered
* before processing messages. If we are a test vehicle the * 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 * 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. * functions.
*/ */
if (!msg->hdr.Flags.testMessage) if (!msg->hdr.flags.test_message)
WAIT_ON_CALLBACK(virt_control_chan_func); WAIT_ON_CALLBACK(virt_control_chan_func);
chipset_inited = 1; chipset_inited = 1;
...@@ -944,7 +944,7 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, ...@@ -944,7 +944,7 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no,
/* signify that the physical channel address does NOT /* signify that the physical channel address does NOT
* need to be ioremap()ed * need to be ioremap()ed
*/ */
msg.hdr.Flags.testMessage = 1; msg.hdr.flags.test_message = 1;
msg.cmd.create_device.busNo = bus_no; msg.cmd.create_device.busNo = bus_no;
msg.cmd.create_device.devNo = dev_no; msg.cmd.create_device.devNo = dev_no;
msg.cmd.create_device.devInstGuid = inst_uuid; msg.cmd.create_device.devInstGuid = inst_uuid;
...@@ -1003,7 +1003,7 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, ...@@ -1003,7 +1003,7 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no,
/* signify that the physical channel address does NOT /* signify that the physical channel address does NOT
* need to be ioremap()ed * need to be ioremap()ed
*/ */
msg.hdr.Flags.testMessage = 1; msg.hdr.flags.test_message = 1;
msg.cmd.create_device.busNo = bus_no; msg.cmd.create_device.busNo = bus_no;
msg.cmd.create_device.devNo = dev_no; msg.cmd.create_device.devNo = dev_no;
msg.cmd.create_device.devInstGuid = inst_uuid; msg.cmd.create_device.devInstGuid = inst_uuid;
...@@ -1092,7 +1092,7 @@ uislib_client_add_vnic(u32 busNo) ...@@ -1092,7 +1092,7 @@ uislib_client_add_vnic(u32 busNo)
CONTROLVM_MESSAGE msg; CONTROLVM_MESSAGE msg;
init_msg_header(&msg, CONTROLVM_BUS_CREATE, 0, 0); init_msg_header(&msg, CONTROLVM_BUS_CREATE, 0, 0);
msg.hdr.Flags.testMessage = 1; msg.hdr.flags.test_message = 1;
msg.cmd.create_bus.bus_no = busNo; msg.cmd.create_bus.bus_no = busNo;
msg.cmd.create_bus.dev_count = 4; msg.cmd.create_bus.dev_count = 4;
msg.cmd.create_bus.channel_addr = 0; msg.cmd.create_bus.channel_addr = 0;
...@@ -1104,7 +1104,7 @@ uislib_client_add_vnic(u32 busNo) ...@@ -1104,7 +1104,7 @@ uislib_client_add_vnic(u32 busNo)
busCreated = TRUE; busCreated = TRUE;
init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0); init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0);
msg.hdr.Flags.testMessage = 1; msg.hdr.flags.test_message = 1;
msg.cmd.create_device.busNo = busNo; msg.cmd.create_device.busNo = busNo;
msg.cmd.create_device.devNo = devNo; msg.cmd.create_device.devNo = devNo;
msg.cmd.create_device.devInstGuid = NULL_UUID_LE; msg.cmd.create_device.devInstGuid = NULL_UUID_LE;
...@@ -1122,7 +1122,7 @@ uislib_client_add_vnic(u32 busNo) ...@@ -1122,7 +1122,7 @@ uislib_client_add_vnic(u32 busNo)
AwayCleanup: AwayCleanup:
if (busCreated) { if (busCreated) {
init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0);
msg.hdr.Flags.testMessage = 1; msg.hdr.flags.test_message = 1;
msg.cmd.destroy_bus.bus_no = busNo; msg.cmd.destroy_bus.bus_no = busNo;
if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
LOGERR("client destroy_bus failed.\n"); LOGERR("client destroy_bus failed.\n");
...@@ -1140,7 +1140,7 @@ uislib_client_delete_vnic(u32 busNo) ...@@ -1140,7 +1140,7 @@ uislib_client_delete_vnic(u32 busNo)
CONTROLVM_MESSAGE msg; CONTROLVM_MESSAGE msg;
init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0); init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0);
msg.hdr.Flags.testMessage = 1; msg.hdr.flags.test_message = 1;
msg.cmd.destroy_device.bus_no = busNo; msg.cmd.destroy_device.bus_no = busNo;
msg.cmd.destroy_device.dev_no = devNo; msg.cmd.destroy_device.dev_no = devNo;
if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
...@@ -1149,7 +1149,7 @@ uislib_client_delete_vnic(u32 busNo) ...@@ -1149,7 +1149,7 @@ uislib_client_delete_vnic(u32 busNo)
} }
init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0);
msg.hdr.Flags.testMessage = 1; msg.hdr.flags.test_message = 1;
msg.cmd.destroy_bus.bus_no = busNo; msg.cmd.destroy_bus.bus_no = busNo;
if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
LOGERR("client destroy_bus failed.\n"); LOGERR("client destroy_bus failed.\n");
......
...@@ -86,7 +86,7 @@ typedef struct { ...@@ -86,7 +86,7 @@ typedef struct {
u64 Reserved2; u64 Reserved2;
u32 switchNo; /* when devState.attached==1 */ u32 switchNo; /* when devState.attached==1 */
u32 internalPortNo; /* when devState.attached==1 */ u32 internalPortNo; /* when devState.attached==1 */
CONTROLVM_MESSAGE_HEADER pendingMsgHdr; /* CONTROLVM_MESSAGE */ struct controlvm_message_header pendingMsgHdr; /* CONTROLVM_MESSAGE */
/** For private use by the bus driver */ /** For private use by the bus driver */
void *bus_driver_context; void *bus_driver_context;
...@@ -139,7 +139,7 @@ typedef struct { ...@@ -139,7 +139,7 @@ typedef struct {
/* Add new fields above. */ /* Add new fields above. */
/* Remaining bits in this 32-bit word are unused. */ /* Remaining bits in this 32-bit word are unused. */
} flags; } flags;
CONTROLVM_MESSAGE_HEADER pendingMsgHdr; /* CONTROLVM MsgHdr */ struct controlvm_message_header pendingMsgHdr; /* CONTROLVM MsgHdr */
/** For private use by the bus driver */ /** For private use by the bus driver */
void *bus_driver_context; void *bus_driver_context;
u64 devNo; u64 devNo;
...@@ -172,7 +172,7 @@ typedef struct { ...@@ -172,7 +172,7 @@ typedef struct {
u32 Reserved2; /* control_vm_id */ u32 Reserved2; /* control_vm_id */
struct device dev; struct device dev;
BOOL dev_exists; BOOL dev_exists;
CONTROLVM_MESSAGE_HEADER pendingMsgHdr; struct controlvm_message_header pendingMsgHdr;
} VISORCHIPSET_SWITCH_INFO; } VISORCHIPSET_SWITCH_INFO;
...@@ -195,7 +195,7 @@ typedef struct { ...@@ -195,7 +195,7 @@ typedef struct {
u32 Reserved2; /* control_vm_id */ u32 Reserved2; /* control_vm_id */
struct device dev; struct device dev;
BOOL dev_exists; BOOL dev_exists;
CONTROLVM_MESSAGE_HEADER pendingMsgHdr; struct controlvm_message_header pendingMsgHdr;
} VISORCHIPSET_EXTERNALPORT_INFO; } VISORCHIPSET_EXTERNALPORT_INFO;
...@@ -209,8 +209,8 @@ typedef struct { ...@@ -209,8 +209,8 @@ typedef struct {
u32 busNo; /* valid only when state.attached == 1 */ u32 busNo; /* valid only when state.attached == 1 */
u32 devNo; /* valid only when state.attached == 1 */ u32 devNo; /* valid only when state.attached == 1 */
u64 Reserved1; u64 Reserved1;
u32 Reserved2; /* control_vm_id */ u32 Reserved2; /* CONTROLVM_ID */
CONTROLVM_MESSAGE_HEADER pendingMsgHdr; struct controlvm_message_header pendingMsgHdr;
MYPROCOBJECT *procObject; MYPROCOBJECT *procObject;
} VISORCHIPSET_INTERNALPORT_INFO; } VISORCHIPSET_INTERNALPORT_INFO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment