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

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
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
@@ -169,53 +169,51 @@ enum ultra_chipset_feature {
 *  queue.  Commands are easily distinguished from responses by
 *  looking at the flags.response field.
 */
typedef struct _CONTROLVM_MESSAGE_HEADER  {
	u32 Id;		/* See control_vm_id. */
struct controlvm_message_header  {
	u32 id;		/* See CONTROLVM_ID. */
	/* For requests, indicates the message type. */
	/* 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 */
	u32 SegmentIndex;	/* Index of segment containing Vm
	u32 segment_index;	/* Index of segment containing Vm
				 * message/information */
	u32 CompletionStatus;	/* Error status code or result of
	u32 completion_status;	/* Error status code or result of
				 * message completion */
	struct  {
		u32 failed:1;		   /**< =1 in a response to * signify
					    * 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
					   * bit) */
		u32 server:1;		   /**< =1 in all bus & device-related
					    * messages where the message
					    * receiver is to act as the bus or
					    * device server */
		u32 testMessage:1;	   /**< =1 for testing use only
		u32 test_message:1;	   /**< =1 for testing use only
					    * (Control and Command ignore this
					    * bit) */
		u32 partialCompletion:1;  /**< =1 if there are forthcoming
		u32 partial_completion:1;  /**< =1 if there are forthcoming
					   * responses/acks associated
					   * with this message */
		u32 preserve:1;	       /**< =1 this is to let us know to
					* preserve channel contents
					* (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*/

		    /* remaining bits in this 32-bit word are available */
	} Flags;
	u32 Reserved;		/* Natural alignment */
	u64 MessageHandle;	/* Identifies the particular message instance,
	} flags;
	u32 reserved;		/* Natural alignment */
	u64 message_handle;	/* Identifies the particular message instance,
				 * and is used to match particular */
	/* 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 */
	u32 PayloadMaxBytes;	/* Maximum bytes allocated in payload
	u32 payload_max_bytes;	/* Maximum bytes allocated in payload
				 * 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; */
	/* if non-zero, there is a payload to copy. */
} CONTROLVM_MESSAGE_HEADER;
};

typedef struct _CONTROLVM_PACKET_DEVICE_CREATE  {
	u32 busNo;	   /**< bus # (0..n-1) from the msg receiver's
@@ -241,12 +239,12 @@ typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE {
} CONTROLVM_PACKET_DEVICE_CONFIGURE;	/* for CONTROLVM_DEVICE_CONFIGURE */

typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE  {
	CONTROLVM_MESSAGE_HEADER Header;
	struct controlvm_message_header Header;
	CONTROLVM_PACKET_DEVICE_CREATE Packet;
} CONTROLVM_MESSAGE_DEVICE_CREATE;	/* total 128 bytes */

typedef struct _CONTROLVM_MESSAGE_DEVICE_CONFIGURE  {
	CONTROLVM_MESSAGE_HEADER Header;
	struct controlvm_message_header Header;
	CONTROLVM_PACKET_DEVICE_CONFIGURE Packet;
} CONTROLVM_MESSAGE_DEVICE_CONFIGURE;	/* total 56 bytes */

@@ -343,7 +341,7 @@ struct controlvm_message_packet {

/* All messages in any ControlVm queue have this layout. */
typedef struct _CONTROLVM_MESSAGE  {
	CONTROLVM_MESSAGE_HEADER hdr;
	struct controlvm_message_header hdr;
	struct controlvm_message_packet cmd;
} CONTROLVM_MESSAGE;

+20 −20
Original line number Diff line number Diff line
@@ -124,9 +124,9 @@ static void
init_msg_header(CONTROLVM_MESSAGE *msg, u32 id, uint rsp, uint svr)
{
	memset(msg, 0, sizeof(CONTROLVM_MESSAGE));
	msg->hdr.Id = id;
	msg->hdr.Flags.responseExpected = rsp;
	msg->hdr.Flags.server = svr;
	msg->hdr.id = id;
	msg->hdr.flags.response_expected = rsp;
	msg->hdr.flags.server = svr;
}

static __iomem void *
@@ -188,7 +188,7 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf)
	/* Currently by default, the bus Number is the GuestHandle.
	 * 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... */
		bus->guest_handle = 0;
		bus->bus_no = busNo;
@@ -229,7 +229,7 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf)
				      msg->cmd.create_bus.channel_bytes);
	}
	/* 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;

		cmd.msgtype = GUEST_ADD_VBUS;
@@ -309,7 +309,7 @@ destroy_bus(CONTROLVM_MESSAGE *msg, char *buf)
	}
	read_unlock(&BusListLock);

	if (msg->hdr.Flags.server)
	if (msg->hdr.flags.server)
		goto remove;

	/* client messages require us to call the virtpci callback associated
@@ -376,7 +376,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
	sema_init(&dev->interrupt_callback_lock, 1);	/* unlocked */
	sprintf(dev->devid, "vbus%u:dev%u", (unsigned) busNo, (unsigned) devNo);
	/* 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);
	else {
		pReqHandler = req_handler_find(dev->channel_uuid);
@@ -439,7 +439,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
			/* 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;

				if (!uuid_le_cmp(dev->channel_uuid,
@@ -534,7 +534,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
	result = CONTROLVM_RESP_ERROR_BUS_INVALID;

Away:
	if (!msg->hdr.Flags.testMessage) {
	if (!msg->hdr.flags.test_message) {
		uislib_iounmap(dev->chanptr);
		dev->chanptr = NULL;
	}
@@ -758,7 +758,7 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
			uislib_disable_channel_interrupts(busNo, devNo);
		}
		/* unmap the channel memory for the device. */
		if (!msg->hdr.Flags.testMessage) {
		if (!msg->hdr.flags.test_message) {
			LOGINF("destroy_device, doing iounmap");
			uislib_iounmap(dev->chanptr);
		}
@@ -779,12 +779,12 @@ init_chipset(CONTROLVM_MESSAGE *msg, char *buf)

	/* We need to make sure we have our functions registered
	* 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
	* 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.
	*/
	if (!msg->hdr.Flags.testMessage)
	if (!msg->hdr.flags.test_message)
		WAIT_ON_CALLBACK(virt_control_chan_func);

	chipset_inited = 1;
@@ -944,7 +944,7 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no,
		/* signify that the physical channel address does NOT
		 * 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.devNo = dev_no;
	msg.cmd.create_device.devInstGuid = inst_uuid;
@@ -1003,7 +1003,7 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no,
		/* signify that the physical channel address does NOT
		 * 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.devNo = dev_no;
	msg.cmd.create_device.devInstGuid = inst_uuid;
@@ -1092,7 +1092,7 @@ uislib_client_add_vnic(u32 busNo)
	CONTROLVM_MESSAGE msg;

	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.dev_count = 4;
	msg.cmd.create_bus.channel_addr = 0;
@@ -1104,7 +1104,7 @@ uislib_client_add_vnic(u32 busNo)
	busCreated = TRUE;

	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.devNo = devNo;
	msg.cmd.create_device.devInstGuid = NULL_UUID_LE;
@@ -1122,7 +1122,7 @@ uislib_client_add_vnic(u32 busNo)
AwayCleanup:
	if (busCreated) {
		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;
		if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
			LOGERR("client destroy_bus failed.\n");
@@ -1140,7 +1140,7 @@ uislib_client_delete_vnic(u32 busNo)
	CONTROLVM_MESSAGE msg;

	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.dev_no = devNo;
	if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
@@ -1149,7 +1149,7 @@ uislib_client_delete_vnic(u32 busNo)
	}

	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;
	if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
		LOGERR("client destroy_bus failed.\n");
+6 −6
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ typedef struct {
	u64 Reserved2;
	u32 switchNo;		/* 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 */
	void *bus_driver_context;

@@ -139,7 +139,7 @@ typedef struct {
		/* Add new fields above. */
		/* Remaining bits in this 32-bit word are unused. */
	} flags;
	CONTROLVM_MESSAGE_HEADER pendingMsgHdr;	/* CONTROLVM MsgHdr */
	struct controlvm_message_header pendingMsgHdr;	/* CONTROLVM MsgHdr */
	/** For private use by the bus driver */
	void *bus_driver_context;
	u64 devNo;
@@ -172,7 +172,7 @@ typedef struct {
	u32 Reserved2;		/* control_vm_id */
	struct device dev;
	BOOL dev_exists;
	CONTROLVM_MESSAGE_HEADER pendingMsgHdr;
	struct controlvm_message_header pendingMsgHdr;

} VISORCHIPSET_SWITCH_INFO;

@@ -195,7 +195,7 @@ typedef struct {
	u32 Reserved2;		/* control_vm_id */
	struct device dev;
	BOOL dev_exists;
	CONTROLVM_MESSAGE_HEADER pendingMsgHdr;
	struct controlvm_message_header pendingMsgHdr;

} VISORCHIPSET_EXTERNALPORT_INFO;

@@ -209,8 +209,8 @@ typedef struct {
	u32 busNo;		/* valid only when state.attached == 1 */
	u32 devNo;		/* valid only when state.attached == 1 */
	u64 Reserved1;
	u32 Reserved2;		/* control_vm_id */
	CONTROLVM_MESSAGE_HEADER pendingMsgHdr;
	u32 Reserved2;		/* CONTROLVM_ID */
	struct controlvm_message_header pendingMsgHdr;
	MYPROCOBJECT *procObject;

} VISORCHIPSET_INTERNALPORT_INFO;
+94 −90

File changed.

Preview size limit exceeded, changes collapsed.