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

staging: unisys: refactor CONTROLVM_PACKET_DEVICE_CREATE

Get rid of the typedef for CONTROLVM_PACKET_DEVICE_CREATE, instead using
struct controlvm_packet_device_create. Fix CamelCase names and update
all references to changed names. Clean up comments.

busNo => bus_no
devNo => dev_no
channelAddr => channel_addr
channelBytes => channel_bytes
dataTypeGuid => data_type_uuid
devInstGuid => dev_inst_uuid
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 98d7b594
...@@ -215,20 +215,17 @@ struct controlvm_message_header { ...@@ -215,20 +215,17 @@ struct controlvm_message_header {
/* if non-zero, there is a payload to copy. */ /* if non-zero, there is a payload to copy. */
}; };
typedef struct _CONTROLVM_PACKET_DEVICE_CREATE { struct controlvm_packet_device_create {
u32 busNo; /**< bus # (0..n-1) from the msg receiver's u32 bus_no; /* bus # (0..n-1) from the msg receiver's end */
* perspective */ u32 dev_no; /* bus-relative (0..n-1) device number */
u64 channel_addr; /* Guest physical address of the channel, which
/* Control uses header SegmentIndex field to access bus number... */ * can be dereferenced by the receiver of this
u32 devNo; /**< bus-relative (0..n-1) device number */ * ControlVm command */
u64 channelAddr; /**< Guest physical address of the channel, which u64 channel_bytes; /* specifies size of the channel in bytes */
* can be dereferenced by the receiver uuid_le data_type_uuid; /* specifies format of data in channel */
* of this ControlVm command */ uuid_le dev_inst_uuid; /* instance guid for the device */
u64 channelBytes; /**< specifies size of the channel in bytes */ struct irq_info intr; /* specifies interrupt information */
uuid_le dataTypeGuid;/**< specifies format of data in channel */ }; /* for CONTROLVM_DEVICE_CREATE */
uuid_le devInstGuid; /**< instance guid for the device */
struct irq_info intr; /**< specifies interrupt information */
} CONTROLVM_PACKET_DEVICE_CREATE; /* for CONTROLVM_DEVICE_CREATE */
typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE { typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE {
u32 busNo; /**< bus # (0..n-1) from the msg u32 busNo; /**< bus # (0..n-1) from the msg
...@@ -240,7 +237,7 @@ typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE { ...@@ -240,7 +237,7 @@ typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE {
typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE { typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE {
struct controlvm_message_header Header; struct controlvm_message_header Header;
CONTROLVM_PACKET_DEVICE_CREATE Packet; struct 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 {
...@@ -285,7 +282,7 @@ struct controlvm_message_packet { ...@@ -285,7 +282,7 @@ struct controlvm_message_packet {
* sendBusInterruptHandle is kept in CP. */ * sendBusInterruptHandle is kept in CP. */
} configure_bus; /* for CONTROLVM_BUS_CONFIGURE */ } configure_bus; /* for CONTROLVM_BUS_CONFIGURE */
/* for CONTROLVM_DEVICE_CREATE */ /* for CONTROLVM_DEVICE_CREATE */
CONTROLVM_PACKET_DEVICE_CREATE create_device; struct controlvm_packet_device_create create_device;
struct { struct {
u32 bus_no; /* bus # (0..n-1) from the msg u32 bus_no; /* bus # (0..n-1) from the msg
* receiver's perspective */ * receiver's perspective */
......
...@@ -354,8 +354,8 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -354,8 +354,8 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
u64 minSize = MIN_IO_CHANNEL_SIZE; u64 minSize = MIN_IO_CHANNEL_SIZE;
struct req_handler_info *pReqHandler; struct req_handler_info *pReqHandler;
busNo = msg->cmd.create_device.busNo; busNo = msg->cmd.create_device.bus_no;
devNo = msg->cmd.create_device.devNo; devNo = msg->cmd.create_device.dev_no;
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo,
POSTCODE_SEVERITY_INFO); POSTCODE_SEVERITY_INFO);
...@@ -368,9 +368,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -368,9 +368,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; return CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
} }
dev->channel_uuid = msg->cmd.create_device.dataTypeGuid; dev->channel_uuid = msg->cmd.create_device.data_type_uuid;
dev->intr = msg->cmd.create_device.intr; dev->intr = msg->cmd.create_device.intr;
dev->channel_addr = msg->cmd.create_device.channelAddr; dev->channel_addr = msg->cmd.create_device.channel_addr;
dev->bus_no = busNo; dev->bus_no = busNo;
dev->dev_no = devNo; dev->dev_no = devNo;
sema_init(&dev->interrupt_callback_lock, 1); /* unlocked */ sema_init(&dev->interrupt_callback_lock, 1); /* unlocked */
...@@ -385,9 +385,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -385,9 +385,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
* channel * channel
*/ */
minSize = pReqHandler->min_channel_bytes; minSize = pReqHandler->min_channel_bytes;
if (minSize > msg->cmd.create_device.channelBytes) { if (minSize > msg->cmd.create_device.channel_bytes) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: channel size is too small, channel size:0x%lx, required size:0x%lx", LOGERR("CONTROLVM_DEVICE_CREATE Failed: channel size is too small, channel size:0x%lx, required size:0x%lx",
(ulong) msg->cmd.create_device.channelBytes, (ulong) msg->cmd.create_device.channel_bytes,
(ulong) minSize); (ulong) minSize);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR); POSTCODE_SEVERITY_ERR);
...@@ -396,19 +396,19 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) ...@@ -396,19 +396,19 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
} }
dev->chanptr = dev->chanptr =
uislib_ioremap_cache(dev->channel_addr, uislib_ioremap_cache(dev->channel_addr,
msg->cmd.create_device.channelBytes); msg->cmd.create_device.channel_bytes);
if (!dev->chanptr) { if (!dev->chanptr) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", LOGERR("CONTROLVM_DEVICE_CREATE Failed: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
dev->channel_addr, dev->channel_addr,
msg->cmd.create_device.channelBytes); msg->cmd.create_device.channel_bytes);
result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED; result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED;
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR); POSTCODE_SEVERITY_ERR);
goto Away; goto Away;
} }
} }
dev->instance_uuid = msg->cmd.create_device.devInstGuid; dev->instance_uuid = msg->cmd.create_device.dev_inst_uuid;
dev->channel_bytes = msg->cmd.create_device.channelBytes; dev->channel_bytes = msg->cmd.create_device.channel_bytes;
read_lock(&BusListLock); read_lock(&BusListLock);
for (bus = BusListHead; bus; bus = bus->next) { for (bus = BusListHead; bus; bus = bus->next) {
...@@ -945,15 +945,15 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, ...@@ -945,15 +945,15 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no,
* need to be ioremap()ed * need to be ioremap()ed
*/ */
msg.hdr.flags.test_message = 1; msg.hdr.flags.test_message = 1;
msg.cmd.create_device.busNo = bus_no; msg.cmd.create_device.bus_no = bus_no;
msg.cmd.create_device.devNo = dev_no; msg.cmd.create_device.dev_no = dev_no;
msg.cmd.create_device.devInstGuid = inst_uuid; msg.cmd.create_device.dev_inst_uuid = inst_uuid;
if (intr) if (intr)
msg.cmd.create_device.intr = *intr; msg.cmd.create_device.intr = *intr;
else else
memset(&msg.cmd.create_device.intr, 0, memset(&msg.cmd.create_device.intr, 0,
sizeof(struct irq_info)); sizeof(struct irq_info));
msg.cmd.create_device.channelAddr = phys_chan_addr; msg.cmd.create_device.channel_addr = phys_chan_addr;
if (chan_bytes < MIN_IO_CHANNEL_SIZE) { if (chan_bytes < MIN_IO_CHANNEL_SIZE) {
LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n",
chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE); chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE);
...@@ -961,8 +961,8 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, ...@@ -961,8 +961,8 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no,
MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
return 0; return 0;
} }
msg.cmd.create_device.channelBytes = chan_bytes; msg.cmd.create_device.channel_bytes = chan_bytes;
msg.cmd.create_device.dataTypeGuid = spar_vhba_channel_protocol_uuid; msg.cmd.create_device.data_type_uuid = spar_vhba_channel_protocol_uuid;
if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
LOGERR("VHBA create_device failed.\n"); LOGERR("VHBA create_device failed.\n");
POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no,
...@@ -1004,15 +1004,15 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, ...@@ -1004,15 +1004,15 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no,
* need to be ioremap()ed * need to be ioremap()ed
*/ */
msg.hdr.flags.test_message = 1; msg.hdr.flags.test_message = 1;
msg.cmd.create_device.busNo = bus_no; msg.cmd.create_device.bus_no = bus_no;
msg.cmd.create_device.devNo = dev_no; msg.cmd.create_device.dev_no = dev_no;
msg.cmd.create_device.devInstGuid = inst_uuid; msg.cmd.create_device.dev_inst_uuid = inst_uuid;
if (intr) if (intr)
msg.cmd.create_device.intr = *intr; msg.cmd.create_device.intr = *intr;
else else
memset(&msg.cmd.create_device.intr, 0, memset(&msg.cmd.create_device.intr, 0,
sizeof(struct irq_info)); sizeof(struct irq_info));
msg.cmd.create_device.channelAddr = phys_chan_addr; msg.cmd.create_device.channel_addr = phys_chan_addr;
if (chan_bytes < MIN_IO_CHANNEL_SIZE) { if (chan_bytes < MIN_IO_CHANNEL_SIZE) {
LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n",
chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE); chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE);
...@@ -1020,8 +1020,8 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, ...@@ -1020,8 +1020,8 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no,
MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
return 0; return 0;
} }
msg.cmd.create_device.channelBytes = chan_bytes; msg.cmd.create_device.channel_bytes = chan_bytes;
msg.cmd.create_device.dataTypeGuid = spar_vnic_channel_protocol_uuid; msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid;
if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
LOGERR("VNIC create_device failed.\n"); LOGERR("VNIC create_device failed.\n");
POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no,
...@@ -1105,13 +1105,13 @@ uislib_client_add_vnic(u32 busNo) ...@@ -1105,13 +1105,13 @@ uislib_client_add_vnic(u32 busNo)
init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0); init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0);
msg.hdr.flags.test_message = 1; msg.hdr.flags.test_message = 1;
msg.cmd.create_device.busNo = busNo; msg.cmd.create_device.bus_no = busNo;
msg.cmd.create_device.devNo = devNo; msg.cmd.create_device.dev_no = devNo;
msg.cmd.create_device.devInstGuid = NULL_UUID_LE; msg.cmd.create_device.dev_inst_uuid = NULL_UUID_LE;
memset(&msg.cmd.create_device.intr, 0, sizeof(struct irq_info)); memset(&msg.cmd.create_device.intr, 0, sizeof(struct irq_info));
msg.cmd.create_device.channelAddr = PhysicalDataChan; msg.cmd.create_device.channel_addr = PhysicalDataChan;
msg.cmd.create_device.channelBytes = MIN_IO_CHANNEL_SIZE; msg.cmd.create_device.channel_bytes = MIN_IO_CHANNEL_SIZE;
msg.cmd.create_device.dataTypeGuid = spar_vnic_channel_protocol_uuid; msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid;
if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
LOGERR("client create_device failed"); LOGERR("client create_device failed");
goto AwayCleanup; goto AwayCleanup;
......
...@@ -1229,8 +1229,8 @@ static void ...@@ -1229,8 +1229,8 @@ static void
my_device_create(CONTROLVM_MESSAGE *inmsg) my_device_create(CONTROLVM_MESSAGE *inmsg)
{ {
struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_packet *cmd = &inmsg->cmd;
ulong busNo = cmd->create_device.busNo; ulong busNo = cmd->create_device.bus_no;
ulong devNo = cmd->create_device.devNo; ulong devNo = cmd->create_device.dev_no;
VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL;
VISORCHIPSET_BUS_INFO *pBusInfo = NULL; VISORCHIPSET_BUS_INFO *pBusInfo = NULL;
int rc = CONTROLVM_RESP_SUCCESS; int rc = CONTROLVM_RESP_SUCCESS;
...@@ -1274,7 +1274,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) ...@@ -1274,7 +1274,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg)
INIT_LIST_HEAD(&pDevInfo->entry); INIT_LIST_HEAD(&pDevInfo->entry);
pDevInfo->busNo = busNo; pDevInfo->busNo = busNo;
pDevInfo->devNo = devNo; pDevInfo->devNo = devNo;
pDevInfo->devInstGuid = cmd->create_device.devInstGuid; pDevInfo->devInstGuid = cmd->create_device.dev_inst_uuid;
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo,
POSTCODE_SEVERITY_INFO); POSTCODE_SEVERITY_INFO);
...@@ -1282,9 +1282,9 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) ...@@ -1282,9 +1282,9 @@ my_device_create(CONTROLVM_MESSAGE *inmsg)
pDevInfo->chanInfo.addrType = ADDRTYPE_localTest; pDevInfo->chanInfo.addrType = ADDRTYPE_localTest;
else else
pDevInfo->chanInfo.addrType = ADDRTYPE_localPhysical; pDevInfo->chanInfo.addrType = ADDRTYPE_localPhysical;
pDevInfo->chanInfo.channelAddr = cmd->create_device.channelAddr; pDevInfo->chanInfo.channelAddr = cmd->create_device.channel_addr;
pDevInfo->chanInfo.nChannelBytes = cmd->create_device.channelBytes; pDevInfo->chanInfo.nChannelBytes = cmd->create_device.channel_bytes;
pDevInfo->chanInfo.channelTypeGuid = cmd->create_device.dataTypeGuid; pDevInfo->chanInfo.channelTypeGuid = cmd->create_device.data_type_uuid;
pDevInfo->chanInfo.intr = cmd->create_device.intr; pDevInfo->chanInfo.intr = cmd->create_device.intr;
list_add(&pDevInfo->entry, &DevInfoList); list_add(&pDevInfo->entry, &DevInfoList);
POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo, POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo,
...@@ -1848,8 +1848,8 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) ...@@ -1848,8 +1848,8 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr)
break; break;
case CONTROLVM_DEVICE_CREATE: case CONTROLVM_DEVICE_CREATE:
LOGINF("DEVICE_CREATE(%lu,%lu)", LOGINF("DEVICE_CREATE(%lu,%lu)",
(ulong) cmd->create_device.busNo, (ulong) cmd->create_device.bus_no,
(ulong) cmd->create_device.devNo); (ulong) cmd->create_device.dev_no);
my_device_create(&inmsg); my_device_create(&inmsg);
break; break;
case CONTROLVM_DEVICE_CHANGESTATE: case CONTROLVM_DEVICE_CHANGESTATE:
...@@ -2130,7 +2130,7 @@ setup_crash_devices_work_queue(struct work_struct *work) ...@@ -2130,7 +2130,7 @@ setup_crash_devices_work_queue(struct work_struct *work)
} }
/* reuse create device message for storage device */ /* reuse create device message for storage device */
if (localCrashCreateDevMsg.cmd.create_device.channelAddr != 0) if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0)
my_device_create(&localCrashCreateDevMsg); my_device_create(&localCrashCreateDevMsg);
else { else {
LOGERR("CrashCreateDevMsg is null, no dump will be taken"); LOGERR("CrashCreateDevMsg is null, no dump will be taken");
......
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