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;
......
...@@ -76,9 +76,9 @@ typedef struct { ...@@ -76,9 +76,9 @@ typedef struct {
unsigned int crc; unsigned int crc;
} MESSAGE_ENVELOPE; } MESSAGE_ENVELOPE;
static CONTROLVM_MESSAGE_HEADER g_DiagMsgHdr; static struct controlvm_message_header g_DiagMsgHdr;
static CONTROLVM_MESSAGE_HEADER g_ChipSetMsgHdr; static struct controlvm_message_header g_ChipSetMsgHdr;
static CONTROLVM_MESSAGE_HEADER g_DelDumpMsgHdr; static struct controlvm_message_header g_DelDumpMsgHdr;
static const uuid_le UltraDiagPoolChannelProtocolGuid = static const uuid_le UltraDiagPoolChannelProtocolGuid =
SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID; SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID;
/* 0xffffff is an invalid Bus/Device number */ /* 0xffffff is an invalid Bus/Device number */
...@@ -117,9 +117,9 @@ static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info; ...@@ -117,9 +117,9 @@ static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info;
static struct channel_header *Test_Vnic_channel; static struct channel_header *Test_Vnic_channel;
typedef struct { typedef struct {
CONTROLVM_MESSAGE_HEADER Dumpcapture_header; struct controlvm_message_header Dumpcapture_header;
CONTROLVM_MESSAGE_HEADER Gettextdump_header; struct controlvm_message_header Gettextdump_header;
CONTROLVM_MESSAGE_HEADER Dumpcomplete_header; struct controlvm_message_header Dumpcomplete_header;
BOOL Gettextdump_outstanding; BOOL Gettextdump_outstanding;
u32 crc32; u32 crc32;
ulong length; ulong length;
...@@ -182,7 +182,7 @@ struct putfile_request { ...@@ -182,7 +182,7 @@ struct putfile_request {
u64 sig; /* PUTFILE_REQUEST_SIG */ u64 sig; /* PUTFILE_REQUEST_SIG */
/* header from original TransmitFile request */ /* header from original TransmitFile request */
CONTROLVM_MESSAGE_HEADER controlvm_header; struct controlvm_message_header controlvm_header;
u64 file_request_number; /* from original TransmitFile request */ u64 file_request_number; /* from original TransmitFile request */
/* link to next struct putfile_request */ /* link to next struct putfile_request */
...@@ -344,12 +344,14 @@ static struct platform_device Visorchipset_platform_device = { ...@@ -344,12 +344,14 @@ static struct platform_device Visorchipset_platform_device = {
}; };
/* Function prototypes */ /* Function prototypes */
static void controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response); static void controlvm_respond(struct controlvm_message_header *msgHdr,
static void controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response);
int response, static void controlvm_respond_chipset_init(
enum ultra_chipset_feature features); struct controlvm_message_header *msgHdr, int response,
static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER * enum ultra_chipset_feature features);
msgHdr, int response, struct spar_segment_state state); 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, static ssize_t toolaction_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -680,42 +682,42 @@ chipset_init(CONTROLVM_MESSAGE *inmsg) ...@@ -680,42 +682,42 @@ chipset_init(CONTROLVM_MESSAGE *inmsg)
Away: Away:
if (rc < 0) if (rc < 0)
cleanup_controlvm_structures(); cleanup_controlvm_structures();
if (inmsg->hdr.Flags.responseExpected) if (inmsg->hdr.flags.response_expected)
controlvm_respond_chipset_init(&inmsg->hdr, rc, features); controlvm_respond_chipset_init(&inmsg->hdr, rc, features);
} }
static void static void
controlvm_init_response(CONTROLVM_MESSAGE *msg, controlvm_init_response(CONTROLVM_MESSAGE *msg,
CONTROLVM_MESSAGE_HEADER *msgHdr, int response) struct controlvm_message_header *msgHdr, int response)
{ {
memset(msg, 0, sizeof(CONTROLVM_MESSAGE)); memset(msg, 0, sizeof(CONTROLVM_MESSAGE));
memcpy(&msg->hdr, msgHdr, sizeof(CONTROLVM_MESSAGE_HEADER)); memcpy(&msg->hdr, msgHdr, sizeof(struct controlvm_message_header));
msg->hdr.PayloadBytes = 0; msg->hdr.payload_bytes = 0;
msg->hdr.PayloadVmOffset = 0; msg->hdr.payload_vm_offset = 0;
msg->hdr.PayloadMaxBytes = 0; msg->hdr.payload_max_bytes = 0;
if (response < 0) { if (response < 0) {
msg->hdr.Flags.failed = 1; msg->hdr.flags.failed = 1;
msg->hdr.CompletionStatus = (u32) (-response); msg->hdr.completion_status = (u32) (-response);
} }
} }
static void static void
controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response) controlvm_respond(struct controlvm_message_header *msgHdr, int response)
{ {
CONTROLVM_MESSAGE outmsg; CONTROLVM_MESSAGE outmsg;
controlvm_init_response(&outmsg, msgHdr, response); controlvm_init_response(&outmsg, msgHdr, response);
/* For DiagPool channel DEVICE_CHANGESTATE, we need to send /* For DiagPool channel DEVICE_CHANGESTATE, we need to send
* back the deviceChangeState structure in the packet. */ * back the deviceChangeState structure in the packet. */
if (msgHdr->Id == CONTROLVM_DEVICE_CHANGESTATE if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE
&& g_DeviceChangeStatePacket.device_change_state.bus_no == && g_DeviceChangeStatePacket.device_change_state.bus_no ==
g_diagpoolBusNo g_diagpoolBusNo
&& g_DeviceChangeStatePacket.device_change_state.dev_no == && g_DeviceChangeStatePacket.device_change_state.dev_no ==
g_diagpoolDevNo) g_diagpoolDevNo)
outmsg.cmd = g_DeviceChangeStatePacket; 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", LOGINF("%s controlvm_msg=0x%x response=%d for test message",
__func__, outmsg.hdr.Id, response); __func__, outmsg.hdr.id, response);
return; return;
} }
if (!visorchannel_signalinsert(ControlVm_channel, if (!visorchannel_signalinsert(ControlVm_channel,
...@@ -726,7 +728,8 @@ controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response) ...@@ -726,7 +728,8 @@ controlvm_respond(CONTROLVM_MESSAGE_HEADER *msgHdr, int response)
} }
static void static void
controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response, controlvm_respond_chipset_init(struct controlvm_message_header *msgHdr,
int response,
enum ultra_chipset_feature features) enum ultra_chipset_feature features)
{ {
CONTROLVM_MESSAGE outmsg; CONTROLVM_MESSAGE outmsg;
...@@ -740,9 +743,9 @@ controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response, ...@@ -740,9 +743,9 @@ controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER *msgHdr, int response,
} }
} }
static void static void controlvm_respond_physdev_changestate(
controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER *msgHdr, struct controlvm_message_header *msgHdr, int response,
int response, struct spar_segment_state state) struct spar_segment_state state)
{ {
CONTROLVM_MESSAGE outmsg; CONTROLVM_MESSAGE outmsg;
...@@ -839,16 +842,16 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) ...@@ -839,16 +842,16 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response)
need_clear = TRUE; need_clear = TRUE;
} }
if (p->pendingMsgHdr.Id == CONTROLVM_INVALID) { if (p->pendingMsgHdr.id == CONTROLVM_INVALID) {
LOGERR("bus_responder no pending msg"); LOGERR("bus_responder no pending msg");
return; /* no controlvm response needed */ return; /* no controlvm response needed */
} }
if (p->pendingMsgHdr.Id != (u32) cmdId) { if (p->pendingMsgHdr.id != (u32) cmdId) {
LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.Id); LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id);
return; return;
} }
controlvm_respond(&p->pendingMsgHdr, response); controlvm_respond(&p->pendingMsgHdr, response);
p->pendingMsgHdr.Id = CONTROLVM_INVALID; p->pendingMsgHdr.id = CONTROLVM_INVALID;
if (need_clear) { if (need_clear) {
busInfo_clear(p); busInfo_clear(p);
delbusdevices(&DevInfoList, busNo); delbusdevices(&DevInfoList, busNo);
...@@ -868,12 +871,12 @@ device_changestate_responder(enum controlvm_id cmdId, ...@@ -868,12 +871,12 @@ device_changestate_responder(enum controlvm_id cmdId,
LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo); LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo);
return; return;
} }
if (p->pendingMsgHdr.Id == CONTROLVM_INVALID) { if (p->pendingMsgHdr.id == CONTROLVM_INVALID) {
LOGERR("device_responder no pending msg"); LOGERR("device_responder no pending msg");
return; /* no controlvm response needed */ return; /* no controlvm response needed */
} }
if (p->pendingMsgHdr.Id != cmdId) { if (p->pendingMsgHdr.id != cmdId) {
LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.Id); LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id);
return; return;
} }
...@@ -889,7 +892,7 @@ device_changestate_responder(enum controlvm_id cmdId, ...@@ -889,7 +892,7 @@ device_changestate_responder(enum controlvm_id cmdId,
return; return;
} }
p->pendingMsgHdr.Id = CONTROLVM_INVALID; p->pendingMsgHdr.id = CONTROLVM_INVALID;
} }
static void static void
...@@ -911,23 +914,23 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, ...@@ -911,23 +914,23 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo,
need_clear = TRUE; need_clear = TRUE;
} }
if (p->pendingMsgHdr.Id == CONTROLVM_INVALID) { if (p->pendingMsgHdr.id == CONTROLVM_INVALID) {
LOGERR("device_responder no pending msg"); LOGERR("device_responder no pending msg");
return; /* no controlvm response needed */ return; /* no controlvm response needed */
} }
if (p->pendingMsgHdr.Id != (u32) cmdId) { if (p->pendingMsgHdr.id != (u32) cmdId) {
LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.Id); LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id);
return; return;
} }
controlvm_respond(&p->pendingMsgHdr, response); controlvm_respond(&p->pendingMsgHdr, response);
p->pendingMsgHdr.Id = CONTROLVM_INVALID; p->pendingMsgHdr.id = CONTROLVM_INVALID;
if (need_clear) if (need_clear)
devInfo_clear(p); devInfo_clear(p);
} }
static void static void
bus_epilog(u32 busNo, bus_epilog(u32 busNo,
u32 cmd, CONTROLVM_MESSAGE_HEADER *msgHdr, u32 cmd, struct controlvm_message_header *msgHdr,
int response, BOOL needResponse) int response, BOOL needResponse)
{ {
BOOL notified = FALSE; BOOL notified = FALSE;
...@@ -940,9 +943,9 @@ bus_epilog(u32 busNo, ...@@ -940,9 +943,9 @@ bus_epilog(u32 busNo,
} }
if (needResponse) { if (needResponse) {
memcpy(&pBusInfo->pendingMsgHdr, msgHdr, memcpy(&pBusInfo->pendingMsgHdr, msgHdr,
sizeof(CONTROLVM_MESSAGE_HEADER)); sizeof(struct controlvm_message_header));
} else } else
pBusInfo->pendingMsgHdr.Id = CONTROLVM_INVALID; pBusInfo->pendingMsgHdr.id = CONTROLVM_INVALID;
down(&NotifierLock); down(&NotifierLock);
if (response == CONTROLVM_RESP_SUCCESS) { if (response == CONTROLVM_RESP_SUCCESS) {
...@@ -994,7 +997,7 @@ bus_epilog(u32 busNo, ...@@ -994,7 +997,7 @@ bus_epilog(u32 busNo,
static void static void
device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
CONTROLVM_MESSAGE_HEADER *msgHdr, int response, struct controlvm_message_header *msgHdr, int response,
BOOL needResponse, BOOL for_visorbus) BOOL needResponse, BOOL for_visorbus)
{ {
VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers = NULL; VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers = NULL;
...@@ -1017,9 +1020,9 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, ...@@ -1017,9 +1020,9 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
notifiers = &BusDev_Client_Notifiers; notifiers = &BusDev_Client_Notifiers;
if (needResponse) { if (needResponse) {
memcpy(&pDevInfo->pendingMsgHdr, msgHdr, memcpy(&pDevInfo->pendingMsgHdr, msgHdr,
sizeof(CONTROLVM_MESSAGE_HEADER)); sizeof(struct controlvm_message_header));
} else } else
pDevInfo->pendingMsgHdr.Id = CONTROLVM_INVALID; pDevInfo->pendingMsgHdr.id = CONTROLVM_INVALID;
down(&NotifierLock); down(&NotifierLock);
if (response >= 0) { if (response >= 0) {
...@@ -1125,12 +1128,12 @@ bus_create(CONTROLVM_MESSAGE *inmsg) ...@@ -1125,12 +1128,12 @@ bus_create(CONTROLVM_MESSAGE *inmsg)
POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO);
if (inmsg->hdr.Flags.testMessage == 1) if (inmsg->hdr.flags.test_message == 1)
pBusInfo->chanInfo.addrType = ADDRTYPE_localTest; pBusInfo->chanInfo.addrType = ADDRTYPE_localTest;
else else
pBusInfo->chanInfo.addrType = ADDRTYPE_localPhysical; pBusInfo->chanInfo.addrType = ADDRTYPE_localPhysical;
pBusInfo->flags.server = inmsg->hdr.Flags.server; pBusInfo->flags.server = inmsg->hdr.flags.server;
pBusInfo->chanInfo.channelAddr = cmd->create_bus.channel_addr; pBusInfo->chanInfo.channelAddr = cmd->create_bus.channel_addr;
pBusInfo->chanInfo.nChannelBytes = cmd->create_bus.channel_bytes; pBusInfo->chanInfo.nChannelBytes = cmd->create_bus.channel_bytes;
pBusInfo->chanInfo.channelTypeGuid = cmd->create_bus.bus_data_type_uuid; pBusInfo->chanInfo.channelTypeGuid = cmd->create_bus.bus_data_type_uuid;
...@@ -1142,7 +1145,7 @@ bus_create(CONTROLVM_MESSAGE *inmsg) ...@@ -1142,7 +1145,7 @@ bus_create(CONTROLVM_MESSAGE *inmsg)
Away: Away:
bus_epilog(busNo, CONTROLVM_BUS_CREATE, &inmsg->hdr, bus_epilog(busNo, CONTROLVM_BUS_CREATE, &inmsg->hdr,
rc, inmsg->hdr.Flags.responseExpected == 1); rc, inmsg->hdr.flags.response_expected == 1);
} }
static void static void
...@@ -1168,7 +1171,7 @@ bus_destroy(CONTROLVM_MESSAGE *inmsg) ...@@ -1168,7 +1171,7 @@ bus_destroy(CONTROLVM_MESSAGE *inmsg)
Away: Away:
bus_epilog(busNo, CONTROLVM_BUS_DESTROY, &inmsg->hdr, bus_epilog(busNo, CONTROLVM_BUS_DESTROY, &inmsg->hdr,
rc, inmsg->hdr.Flags.responseExpected == 1); rc, inmsg->hdr.flags.response_expected == 1);
} }
static void static void
...@@ -1201,9 +1204,9 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx) ...@@ -1201,9 +1204,9 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx)
goto Away; goto Away;
} }
/* TBD - add this check to other commands also... */ /* TBD - add this check to other commands also... */
if (pBusInfo->pendingMsgHdr.Id != CONTROLVM_INVALID) { if (pBusInfo->pendingMsgHdr.id != CONTROLVM_INVALID) {
LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding", LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding",
busNo, (uint) pBusInfo->pendingMsgHdr.Id); busNo, (uint) pBusInfo->pendingMsgHdr.id);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR); POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT; rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
...@@ -1219,7 +1222,7 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx) ...@@ -1219,7 +1222,7 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx)
POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO);
Away: Away:
bus_epilog(busNo, CONTROLVM_BUS_CONFIGURE, &inmsg->hdr, bus_epilog(busNo, CONTROLVM_BUS_CONFIGURE, &inmsg->hdr,
rc, inmsg->hdr.Flags.responseExpected == 1); rc, inmsg->hdr.flags.response_expected == 1);
} }
static void static void
...@@ -1275,7 +1278,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) ...@@ -1275,7 +1278,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg)
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo,
POSTCODE_SEVERITY_INFO); POSTCODE_SEVERITY_INFO);
if (inmsg->hdr.Flags.testMessage == 1) if (inmsg->hdr.flags.test_message == 1)
pDevInfo->chanInfo.addrType = ADDRTYPE_localTest; pDevInfo->chanInfo.addrType = ADDRTYPE_localTest;
else else
pDevInfo->chanInfo.addrType = ADDRTYPE_localPhysical; pDevInfo->chanInfo.addrType = ADDRTYPE_localPhysical;
...@@ -1296,7 +1299,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) ...@@ -1296,7 +1299,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg)
} }
device_epilog(busNo, devNo, segment_state_running, device_epilog(busNo, devNo, segment_state_running,
CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc,
inmsg->hdr.Flags.responseExpected == 1, inmsg->hdr.flags.response_expected == 1,
FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid)); FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid));
} }
...@@ -1330,7 +1333,7 @@ my_device_changestate(CONTROLVM_MESSAGE *inmsg) ...@@ -1330,7 +1333,7 @@ my_device_changestate(CONTROLVM_MESSAGE *inmsg)
if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo)
device_epilog(busNo, devNo, state, CONTROLVM_DEVICE_CHANGESTATE, device_epilog(busNo, devNo, state, CONTROLVM_DEVICE_CHANGESTATE,
&inmsg->hdr, rc, &inmsg->hdr, rc,
inmsg->hdr.Flags.responseExpected == 1, inmsg->hdr.flags.response_expected == 1,
FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid)); FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid));
} }
...@@ -1360,7 +1363,7 @@ my_device_destroy(CONTROLVM_MESSAGE *inmsg) ...@@ -1360,7 +1363,7 @@ my_device_destroy(CONTROLVM_MESSAGE *inmsg)
if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo)
device_epilog(busNo, devNo, segment_state_running, device_epilog(busNo, devNo, segment_state_running,
CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc, CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc,
inmsg->hdr.Flags.responseExpected == 1, inmsg->hdr.flags.response_expected == 1,
FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid)); FOR_VISORBUS(pDevInfo->chanInfo.channelTypeGuid));
} }
...@@ -1490,15 +1493,15 @@ visorchipset_chipset_notready(void) ...@@ -1490,15 +1493,15 @@ visorchipset_chipset_notready(void)
EXPORT_SYMBOL_GPL(visorchipset_chipset_notready); EXPORT_SYMBOL_GPL(visorchipset_chipset_notready);
static void static void
chipset_ready(CONTROLVM_MESSAGE_HEADER *msgHdr) chipset_ready(struct controlvm_message_header *msgHdr)
{ {
int rc = visorchipset_chipset_ready(); int rc = visorchipset_chipset_ready();
if (rc != CONTROLVM_RESP_SUCCESS) if (rc != CONTROLVM_RESP_SUCCESS)
rc = -rc; rc = -rc;
if (msgHdr->Flags.responseExpected && !visorchipset_holdchipsetready) if (msgHdr->flags.response_expected && !visorchipset_holdchipsetready)
controlvm_respond(msgHdr, rc); 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 /* Send CHIPSET_READY response when all modules have been loaded
* and disks mounted for the partition * and disks mounted for the partition
*/ */
...@@ -1508,24 +1511,24 @@ chipset_ready(CONTROLVM_MESSAGE_HEADER *msgHdr) ...@@ -1508,24 +1511,24 @@ chipset_ready(CONTROLVM_MESSAGE_HEADER *msgHdr)
} }
static void static void
chipset_selftest(CONTROLVM_MESSAGE_HEADER *msgHdr) chipset_selftest(struct controlvm_message_header *msgHdr)
{ {
int rc = visorchipset_chipset_selftest(); int rc = visorchipset_chipset_selftest();
if (rc != CONTROLVM_RESP_SUCCESS) if (rc != CONTROLVM_RESP_SUCCESS)
rc = -rc; rc = -rc;
if (msgHdr->Flags.responseExpected) if (msgHdr->flags.response_expected)
controlvm_respond(msgHdr, rc); controlvm_respond(msgHdr, rc);
} }
static void static void
chipset_notready(CONTROLVM_MESSAGE_HEADER *msgHdr) chipset_notready(struct controlvm_message_header *msgHdr)
{ {
int rc = visorchipset_chipset_notready(); int rc = visorchipset_chipset_notready();
if (rc != CONTROLVM_RESP_SUCCESS) if (rc != CONTROLVM_RESP_SUCCESS)
rc = -rc; rc = -rc;
if (msgHdr->Flags.responseExpected) if (msgHdr->flags.response_expected)
controlvm_respond(msgHdr, rc); controlvm_respond(msgHdr, rc);
} }
...@@ -1538,8 +1541,9 @@ read_controlvm_event(CONTROLVM_MESSAGE *msg) ...@@ -1538,8 +1541,9 @@ read_controlvm_event(CONTROLVM_MESSAGE *msg)
if (visorchannel_signalremove(ControlVm_channel, if (visorchannel_signalremove(ControlVm_channel,
CONTROLVM_QUEUE_EVENT, msg)) { CONTROLVM_QUEUE_EVENT, msg)) {
/* got a message */ /* got a message */
if (msg->hdr.Flags.testMessage == 1) { 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); 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 FALSE;
} }
return TRUE; return TRUE;
...@@ -1666,7 +1670,7 @@ parahotplug_process_list(void) ...@@ -1666,7 +1670,7 @@ parahotplug_process_list(void)
list_entry(pos, struct parahotplug_request, list); list_entry(pos, struct parahotplug_request, list);
if (time_after_eq(jiffies, req->expiration)) { if (time_after_eq(jiffies, req->expiration)) {
list_del(pos); list_del(pos);
if (req->msg.hdr.Flags.responseExpected) if (req->msg.hdr.flags.response_expected)
controlvm_respond_physdev_changestate( controlvm_respond_physdev_changestate(
&req->msg.hdr, &req->msg.hdr,
CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT, CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT,
...@@ -1702,7 +1706,7 @@ parahotplug_request_complete(int id, u16 active) ...@@ -1702,7 +1706,7 @@ parahotplug_request_complete(int id, u16 active)
list_del(pos); list_del(pos);
spin_unlock(&Parahotplug_request_list_lock); spin_unlock(&Parahotplug_request_list_lock);
req->msg.cmd.device_change_state.state.active = active; req->msg.cmd.device_change_state.state.active = active;
if (req->msg.hdr.Flags.responseExpected) if (req->msg.hdr.flags.response_expected)
controlvm_respond_physdev_changestate( controlvm_respond_physdev_changestate(
&req->msg.hdr, CONTROLVM_RESP_SUCCESS, &req->msg.hdr, CONTROLVM_RESP_SUCCESS,
req->msg.cmd.device_change_state.state); req->msg.cmd.device_change_state.state);
...@@ -1781,13 +1785,13 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) ...@@ -1781,13 +1785,13 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr)
CONTROLVM_MESSAGE ackmsg; CONTROLVM_MESSAGE ackmsg;
/* create parsing context if necessary */ /* create parsing context if necessary */
isLocalAddr = (inmsg.hdr.Flags.testMessage == 1); isLocalAddr = (inmsg.hdr.flags.test_message == 1);
if (channel_addr == 0) { if (channel_addr == 0) {
LOGERR("HUH? channel_addr is 0!"); LOGERR("HUH? channel_addr is 0!");
return TRUE; return TRUE;
} }
parametersAddr = channel_addr + inmsg.hdr.PayloadVmOffset; parametersAddr = channel_addr + inmsg.hdr.payload_vm_offset;
parametersBytes = inmsg.hdr.PayloadBytes; parametersBytes = inmsg.hdr.payload_bytes;
/* Parameter and channel addresses within test messages actually lie /* Parameter and channel addresses within test messages actually lie
* within our OS-controlled memory. We need to know that, because it * within our OS-controlled memory. We need to know that, because it
...@@ -1805,7 +1809,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) ...@@ -1805,7 +1809,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr)
return FALSE; return FALSE;
} }
LOGWRN("parsing failed"); 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("parametersAddr=0x%llx", (u64) parametersAddr);
LOGWRN("parametersBytes=%lu", (ulong) parametersBytes); LOGWRN("parametersBytes=%lu", (ulong) parametersBytes);
LOGWRN("isLocalAddr=%d", isLocalAddr); LOGWRN("isLocalAddr=%d", isLocalAddr);
...@@ -1821,7 +1825,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) ...@@ -1821,7 +1825,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr)
(ControlVm_channel, CONTROLVM_QUEUE_ACK, &ackmsg))) (ControlVm_channel, CONTROLVM_QUEUE_ACK, &ackmsg)))
LOGWRN("failed to send ACK failed"); LOGWRN("failed to send ACK failed");
} }
switch (inmsg.hdr.Id) { switch (inmsg.hdr.id) {
case CONTROLVM_CHIPSET_INIT: case CONTROLVM_CHIPSET_INIT:
LOGINF("CHIPSET_INIT(#busses=%lu,#switches=%lu)", LOGINF("CHIPSET_INIT(#busses=%lu,#switches=%lu)",
(ulong) inmsg.cmd.init_chipset.bus_count, (ulong) inmsg.cmd.init_chipset.bus_count,
...@@ -1879,7 +1883,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) ...@@ -1879,7 +1883,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr)
(ulong) cmd->configure_device.busNo, (ulong) cmd->configure_device.busNo,
(ulong) cmd->configure_device.devNo); (ulong) cmd->configure_device.devNo);
/* no op for now, just send a respond that we passed */ /* 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); controlvm_respond(&inmsg.hdr, CONTROLVM_RESP_SUCCESS);
break; break;
case CONTROLVM_CHIPSET_READY: case CONTROLVM_CHIPSET_READY:
...@@ -1895,8 +1899,8 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) ...@@ -1895,8 +1899,8 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr)
chipset_notready(&inmsg.hdr); chipset_notready(&inmsg.hdr);
break; break;
default: default:
LOGERR("unrecognized controlvm cmd=%d", (int) inmsg.hdr.Id); LOGERR("unrecognized controlvm cmd=%d", (int) inmsg.hdr.id);
if (inmsg.hdr.Flags.responseExpected) if (inmsg.hdr.flags.response_expected)
controlvm_respond(&inmsg.hdr, controlvm_respond(&inmsg.hdr,
-CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN); -CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN);
break; break;
...@@ -1953,24 +1957,24 @@ controlvm_periodic_work(struct work_struct *work) ...@@ -1953,24 +1957,24 @@ controlvm_periodic_work(struct work_struct *work)
* should be sent * should be sent
*/ */
if (visorchipset_holdchipsetready if (visorchipset_holdchipsetready
&& (g_ChipSetMsgHdr.Id != CONTROLVM_INVALID)) { && (g_ChipSetMsgHdr.id != CONTROLVM_INVALID)) {
if (check_chipset_events() == 1) { if (check_chipset_events() == 1) {
LOGINF("Sending CHIPSET_READY response"); LOGINF("Sending CHIPSET_READY response");
controlvm_respond(&g_ChipSetMsgHdr, 0); controlvm_respond(&g_ChipSetMsgHdr, 0);
clear_chipset_events(); clear_chipset_events();
memset(&g_ChipSetMsgHdr, 0, memset(&g_ChipSetMsgHdr, 0,
sizeof(CONTROLVM_MESSAGE_HEADER)); sizeof(struct controlvm_message_header));
} }
} }
while (visorchannel_signalremove(ControlVm_channel, while (visorchannel_signalremove(ControlVm_channel,
CONTROLVM_QUEUE_RESPONSE, CONTROLVM_QUEUE_RESPONSE,
&inmsg)) { &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.", LOGERR("Payload of size %lu returned @%lu with unexpected message id %d.",
(ulong) inmsg.hdr.PayloadMaxBytes, (ulong) inmsg.hdr.payload_max_bytes,
(ulong) inmsg.hdr.PayloadVmOffset, (ulong) inmsg.hdr.payload_vm_offset,
inmsg.hdr.Id); inmsg.hdr.id);
} }
} }
if (!gotACommand) { if (!gotACommand) {
...@@ -2055,7 +2059,7 @@ setup_crash_devices_work_queue(struct work_struct *work) ...@@ -2055,7 +2059,7 @@ setup_crash_devices_work_queue(struct work_struct *work)
POSTCODE_LINUX_2(CRASH_DEV_ENTRY_PC, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_2(CRASH_DEV_ENTRY_PC, POSTCODE_SEVERITY_INFO);
/* send init chipset msg */ /* send init chipset msg */
msg.hdr.Id = CONTROLVM_CHIPSET_INIT; msg.hdr.id = CONTROLVM_CHIPSET_INIT;
msg.cmd.init_chipset.bus_count = 23; msg.cmd.init_chipset.bus_count = 23;
msg.cmd.init_chipset.switch_count = 0; msg.cmd.init_chipset.switch_count = 0;
...@@ -2406,11 +2410,11 @@ visorchipset_init(void) ...@@ -2406,11 +2410,11 @@ visorchipset_init(void)
goto Away; 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 = Putfile_buffer_list_pool =
kmem_cache_create(Putfile_buffer_list_pool_name, kmem_cache_create(Putfile_buffer_list_pool_name,
...@@ -2499,11 +2503,11 @@ visorchipset_exit(void) ...@@ -2499,11 +2503,11 @@ visorchipset_exit(void)
cleanup_controlvm_structures(); 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", LOGINF("Channel %s (ControlVm) disconnected",
visorchannel_id(ControlVm_channel, s)); visorchannel_id(ControlVm_channel, s));
......
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