Commit 314b1c8b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: codingsyle cleanups for ChannelMessages.h

Everything but the typedefs are taken care of.

Also a number of unused defines were removed.

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ee3d7ddf
...@@ -21,163 +21,126 @@ ...@@ -21,163 +21,126 @@
* *
*/ */
#ifndef __CHANNELMESSAGES_H
#pragma once #define __CHANNELMESSAGES_H
#include "VmbusPacketFormat.h" #include "VmbusPacketFormat.h"
#define C_ASSERT(x)
typedef u32 NTSTATUS;
#pragma pack(push,1)
/* Version 1 messages */ /* Version 1 messages */
typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE {
ChannelMessageInvalid = 0,
typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE ChannelMessageOfferChannel = 1,
{ ChannelMessageRescindChannelOffer = 2,
ChannelMessageInvalid = 0, ChannelMessageRequestOffers = 3,
ChannelMessageOfferChannel = 1, ChannelMessageAllOffersDelivered = 4,
ChannelMessageRescindChannelOffer = 2, ChannelMessageOpenChannel = 5,
ChannelMessageRequestOffers = 3, ChannelMessageOpenChannelResult = 6,
ChannelMessageAllOffersDelivered = 4, ChannelMessageCloseChannel = 7,
ChannelMessageOpenChannel = 5, ChannelMessageGpadlHeader = 8,
ChannelMessageOpenChannelResult = 6, ChannelMessageGpadlBody = 9,
ChannelMessageCloseChannel = 7, ChannelMessageGpadlCreated = 10,
ChannelMessageGpadlHeader = 8, ChannelMessageGpadlTeardown = 11,
ChannelMessageGpadlBody = 9, ChannelMessageGpadlTorndown = 12,
ChannelMessageGpadlCreated = 10, ChannelMessageRelIdReleased = 13,
ChannelMessageGpadlTeardown = 11, ChannelMessageInitiateContact = 14,
ChannelMessageGpadlTorndown = 12, ChannelMessageVersionResponse = 15,
ChannelMessageRelIdReleased = 13, ChannelMessageUnload = 16,
ChannelMessageInitiateContact = 14,
ChannelMessageVersionResponse = 15,
ChannelMessageUnload = 16,
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
ChannelMessageViewRangeAdd = 17, ChannelMessageViewRangeAdd = 17,
ChannelMessageViewRangeRemove = 18, ChannelMessageViewRangeRemove = 18,
#endif #endif
ChannelMessageCount ChannelMessageCount
} VMBUS_CHANNEL_MESSAGE_TYPE, *PVMBUS_CHANNEL_MESSAGE_TYPE; } __attribute__((packed)) VMBUS_CHANNEL_MESSAGE_TYPE, *PVMBUS_CHANNEL_MESSAGE_TYPE;
/* begin_wpp config */ typedef struct _VMBUS_CHANNEL_MESSAGE_HEADER {
/* CUSTOM_TYPE(ChannelMessageType, ItemEnum(_VMBUS_CHANNEL_MESSAGE_TYPE)); */ VMBUS_CHANNEL_MESSAGE_TYPE MessageType;
/* end_wpp */ u32 Padding;
} __attribute__((packed)) VMBUS_CHANNEL_MESSAGE_HEADER, *PVMBUS_CHANNEL_MESSAGE_HEADER;
typedef struct _VMBUS_CHANNEL_MESSAGE_HEADER
{
VMBUS_CHANNEL_MESSAGE_TYPE MessageType;
u32 Padding;
} VMBUS_CHANNEL_MESSAGE_HEADER, *PVMBUS_CHANNEL_MESSAGE_HEADER;
/* Query VMBus Version parameters */ /* Query VMBus Version parameters */
typedef struct _VMBUS_CHANNEL_QUERY_VMBUS_VERSION typedef struct _VMBUS_CHANNEL_QUERY_VMBUS_VERSION {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u32 Version;
u32 Version; } __attribute__((packed)) VMBUS_CHANNEL_QUERY_VMBUS_VERSION, *PVMBUS_CHANNEL_QUERY_VMBUS_VERSION;
} VMBUS_CHANNEL_QUERY_VMBUS_VERSION, *PVMBUS_CHANNEL_QUERY_VMBUS_VERSION;
/* VMBus Version Supported parameters */ /* VMBus Version Supported parameters */
typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; bool VersionSupported;
bool VersionSupported; } __attribute__((packed)) VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED;
} VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED;
/* Offer Channel parameters */ /* Offer Channel parameters */
typedef struct _VMBUS_CHANNEL_OFFER_CHANNEL typedef struct _VMBUS_CHANNEL_OFFER_CHANNEL {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; struct vmbus_channel_offer Offer;
struct vmbus_channel_offer Offer; u32 ChildRelId;
u32 ChildRelId; u8 MonitorId;
u8 MonitorId; bool MonitorAllocated;
bool MonitorAllocated; } __attribute__((packed)) VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL;
} VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL;
/* Make sure VMBUS_CHANNEL_OFFER_CHANNEL fits into Synic message. */
C_ASSERT(sizeof(VMBUS_CHANNEL_OFFER_CHANNEL) <= MAXIMUM_SYNIC_MESSAGE_BYTES);
/* Rescind Offer parameters */ /* Rescind Offer parameters */
typedef struct _VMBUS_CHANNEL_RESCIND_OFFER typedef struct _VMBUS_CHANNEL_RESCIND_OFFER {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u32 ChildRelId;
u32 ChildRelId; } __attribute__((packed)) VMBUS_CHANNEL_RESCIND_OFFER, *PVMBUS_CHANNEL_RESCIND_OFFER;
} VMBUS_CHANNEL_RESCIND_OFFER, *PVMBUS_CHANNEL_RESCIND_OFFER;
/* Request Offer -- no parameters, SynIC message contains the partition ID */
/* Set Snoop -- no parameters, SynIC message contains the partition ID */
/* Clear Snoop -- no parameters, SynIC message contains the partition ID */
/* All Offers Delivered -- no parameters, SynIC message contains the partition ID */
/* Flush Client -- no parameters, SynIC message contains the partition ID */
/* Open Channel parameters */
typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL
{
VMBUS_CHANNEL_MESSAGE_HEADER Header;
/* Identifies the specific VMBus channel that is being opened. */
u32 ChildRelId;
/* ID making a particular open request at a channel offer unique. */
u32 OpenId;
/* GPADL for the channel's ring buffer. */
u32 RingBufferGpadlHandle;
/* GPADL for the channel's server context save area. */ /*
* Request Offer -- no parameters, SynIC message contains the partition ID
u32 ServerContextAreaGpadlHandle; * Set Snoop -- no parameters, SynIC message contains the partition ID
* Clear Snoop -- no parameters, SynIC message contains the partition ID
* All Offers Delivered -- no parameters, SynIC message contains the partition
* ID
* Flush Client -- no parameters, SynIC message contains the partition ID
*/
/* Open Channel parameters */
typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL {
VMBUS_CHANNEL_MESSAGE_HEADER Header;
/* /* Identifies the specific VMBus channel that is being opened. */
* The upstream ring buffer begins at offset zero in the memory u32 ChildRelId;
* described by RingBufferGpadlHandle. The downstream ring buffer
* follows it at this offset (in pages).
*/
u32 DownstreamRingBufferPageOffset; /* ID making a particular open request at a channel offer unique. */
u32 OpenId;
/* GPADL for the channel's ring buffer. */
u32 RingBufferGpadlHandle;
/* User-specific data to be passed along to the server endpoint. */ /* GPADL for the channel's server context save area. */
u32 ServerContextAreaGpadlHandle;
unsigned char UserData[MAX_USER_DEFINED_BYTES]; /*
* The upstream ring buffer begins at offset zero in the memory
* described by RingBufferGpadlHandle. The downstream ring buffer
* follows it at this offset (in pages).
*/
u32 DownstreamRingBufferPageOffset;
} VMBUS_CHANNEL_OPEN_CHANNEL, *PVMBUS_CHANNEL_OPEN_CHANNEL; /* User-specific data to be passed along to the server endpoint. */
unsigned char UserData[MAX_USER_DEFINED_BYTES];
} __attribute__((packed)) VMBUS_CHANNEL_OPEN_CHANNEL, *PVMBUS_CHANNEL_OPEN_CHANNEL;
/* Reopen Channel parameters; */ /* Reopen Channel parameters; */
typedef VMBUS_CHANNEL_OPEN_CHANNEL VMBUS_CHANNEL_REOPEN_CHANNEL, *PVMBUS_CHANNEL_REOPEN_CHANNEL; typedef VMBUS_CHANNEL_OPEN_CHANNEL VMBUS_CHANNEL_REOPEN_CHANNEL, *PVMBUS_CHANNEL_REOPEN_CHANNEL;
/* Open Channel Result parameters */ /* Open Channel Result parameters */
typedef struct _VMBUS_CHANNEL_OPEN_RESULT typedef struct _VMBUS_CHANNEL_OPEN_RESULT {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u32 ChildRelId;
u32 ChildRelId; u32 OpenId;
u32 OpenId; u32 Status;
NTSTATUS Status; } __attribute__((packed)) VMBUS_CHANNEL_OPEN_RESULT, *PVMBUS_CHANNEL_OPEN_RESULT;
} VMBUS_CHANNEL_OPEN_RESULT, *PVMBUS_CHANNEL_OPEN_RESULT;
/* Close channel parameters; */ /* Close channel parameters; */
typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u32 ChildRelId;
u32 ChildRelId; } __attribute__((packed)) VMBUS_CHANNEL_CLOSE_CHANNEL, *PVMBUS_CHANNEL_CLOSE_CHANNEL;
} VMBUS_CHANNEL_CLOSE_CHANNEL, *PVMBUS_CHANNEL_CLOSE_CHANNEL;
/* Channel Message GPADL */ /* Channel Message GPADL */
#define GPADL_TYPE_RING_BUFFER 1 #define GPADL_TYPE_RING_BUFFER 1
#define GPADL_TYPE_SERVER_SAVE_AREA 2 #define GPADL_TYPE_SERVER_SAVE_AREA 2
#define GPADL_TYPE_TRANSACTION 8 #define GPADL_TYPE_TRANSACTION 8
/* /*
* The number of PFNs in a GPADL message is defined by the number of * The number of PFNs in a GPADL message is defined by the number of
...@@ -185,131 +148,75 @@ typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL ...@@ -185,131 +148,75 @@ typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL
* implied number of PFNs won't fit in this packet, there will be a * implied number of PFNs won't fit in this packet, there will be a
* follow-up packet that contains more. * follow-up packet that contains more.
*/ */
typedef struct _VMBUS_CHANNEL_GPADL_HEADER {
VMBUS_CHANNEL_MESSAGE_HEADER Header;
typedef struct _VMBUS_CHANNEL_GPADL_HEADER u32 ChildRelId;
{ u32 Gpadl;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u16 RangeBufLen;
u32 ChildRelId; u16 RangeCount;
u32 Gpadl; GPA_RANGE Range[0];
u16 RangeBufLen; } __attribute__((packed)) VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER;
u16 RangeCount;
GPA_RANGE Range[0];
} VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER;
/* This is the followup packet that contains more PFNs. */ /* This is the followup packet that contains more PFNs. */
typedef struct _VMBUS_CHANNEL_GPADL_BODY {
VMBUS_CHANNEL_MESSAGE_HEADER Header;
typedef struct _VMBUS_CHANNEL_GPADL_BODY u32 MessageNumber;
{ u32 Gpadl;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u64 Pfn[0];
u32 MessageNumber; } __attribute__((packed)) VMBUS_CHANNEL_GPADL_BODY, *PVMBUS_CHANNEL_GPADL_BODY;
u32 Gpadl;
u64 Pfn[0]; typedef struct _VMBUS_CHANNEL_GPADL_CREATED {
} VMBUS_CHANNEL_GPADL_BODY, *PVMBUS_CHANNEL_GPADL_BODY; VMBUS_CHANNEL_MESSAGE_HEADER Header;
u32 ChildRelId;
u32 Gpadl;
typedef struct _VMBUS_CHANNEL_GPADL_CREATED u32 CreationStatus;
{ } __attribute__((packed)) VMBUS_CHANNEL_GPADL_CREATED, *PVMBUS_CHANNEL_GPADL_CREATED;
VMBUS_CHANNEL_MESSAGE_HEADER Header;
u32 ChildRelId; typedef struct _VMBUS_CHANNEL_GPADL_TEARDOWN {
u32 Gpadl; VMBUS_CHANNEL_MESSAGE_HEADER Header;
u32 CreationStatus; u32 ChildRelId;
} VMBUS_CHANNEL_GPADL_CREATED, *PVMBUS_CHANNEL_GPADL_CREATED; u32 Gpadl;
} __attribute__((packed)) VMBUS_CHANNEL_GPADL_TEARDOWN, *PVMBUS_CHANNEL_GPADL_TEARDOWN;
typedef struct _VMBUS_CHANNEL_GPADL_TEARDOWN
{ typedef struct _VMBUS_CHANNEL_GPADL_TORNDOWN {
VMBUS_CHANNEL_MESSAGE_HEADER Header; VMBUS_CHANNEL_MESSAGE_HEADER Header;
u32 ChildRelId; u32 Gpadl;
u32 Gpadl; } __attribute__((packed)) VMBUS_CHANNEL_GPADL_TORNDOWN, *PVMBUS_CHANNEL_GPADL_TORNDOWN;
} VMBUS_CHANNEL_GPADL_TEARDOWN, *PVMBUS_CHANNEL_GPADL_TEARDOWN;
typedef struct _VMBUS_CHANNEL_GPADL_TORNDOWN
{
VMBUS_CHANNEL_MESSAGE_HEADER Header;
u32 Gpadl;
} VMBUS_CHANNEL_GPADL_TORNDOWN, *PVMBUS_CHANNEL_GPADL_TORNDOWN;
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
typedef struct _VMBUS_CHANNEL_VIEW_RANGE_ADD typedef struct _VMBUS_CHANNEL_VIEW_RANGE_ADD {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; PHYSICAL_ADDRESS ViewRangeBase;
PHYSICAL_ADDRESS ViewRangeBase; u64 ViewRangeLength;
u64 ViewRangeLength; u32 ChildRelId;
u32 ChildRelId; } __attribute__((packed)) VMBUS_CHANNEL_VIEW_RANGE_ADD, *PVMBUS_CHANNEL_VIEW_RANGE_ADD;
} VMBUS_CHANNEL_VIEW_RANGE_ADD, *PVMBUS_CHANNEL_VIEW_RANGE_ADD;
typedef struct _VMBUS_CHANNEL_VIEW_RANGE_REMOVE {
typedef struct _VMBUS_CHANNEL_VIEW_RANGE_REMOVE VMBUS_CHANNEL_MESSAGE_HEADER Header;
{ PHYSICAL_ADDRESS ViewRangeBase;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u32 ChildRelId;
PHYSICAL_ADDRESS ViewRangeBase; } __attribute__((packed)) VMBUS_CHANNEL_VIEW_RANGE_REMOVE, *PVMBUS_CHANNEL_VIEW_RANGE_REMOVE;
u32 ChildRelId;
} VMBUS_CHANNEL_VIEW_RANGE_REMOVE, *PVMBUS_CHANNEL_VIEW_RANGE_REMOVE;
#endif #endif
typedef struct _VMBUS_CHANNEL_RELID_RELEASED typedef struct _VMBUS_CHANNEL_RELID_RELEASED {
{ VMBUS_CHANNEL_MESSAGE_HEADER Header;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u32 ChildRelId;
u32 ChildRelId; } __attribute__((packed)) VMBUS_CHANNEL_RELID_RELEASED, *PVMBUS_CHANNEL_RELID_RELEASED;
} VMBUS_CHANNEL_RELID_RELEASED, *PVMBUS_CHANNEL_RELID_RELEASED;
typedef struct _VMBUS_CHANNEL_INITIATE_CONTACT {
typedef struct _VMBUS_CHANNEL_INITIATE_CONTACT VMBUS_CHANNEL_MESSAGE_HEADER Header;
{ u32 VMBusVersionRequested;
VMBUS_CHANNEL_MESSAGE_HEADER Header; u32 Padding2;
u32 VMBusVersionRequested; u64 InterruptPage;
u32 Padding2; u64 MonitorPage1;
u64 InterruptPage; u64 MonitorPage2;
u64 MonitorPage1; } __attribute__((packed)) VMBUS_CHANNEL_INITIATE_CONTACT, *PVMBUS_CHANNEL_INITIATE_CONTACT;
u64 MonitorPage2;
} VMBUS_CHANNEL_INITIATE_CONTACT, *PVMBUS_CHANNEL_INITIATE_CONTACT; typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE {
VMBUS_CHANNEL_MESSAGE_HEADER Header;
typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE bool VersionSupported;
{ } __attribute__((packed)) VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE;
VMBUS_CHANNEL_MESSAGE_HEADER Header;
bool VersionSupported;
} VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE;
typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD; typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD;
#endif
/* Kind of a table to use the preprocessor to get us the right type for a */
/* specified message ID. Used with ChAllocateSendMessage() */
#define ChannelMessageQueryVmbusVersion_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
#define ChannelMessageVmbusVersionSupported_TYPE VMBUS_CHANNEL_VERSION_SUPPORTED
#define ChannelMessageOfferChannel_TYPE VMBUS_CHANNEL_OFFER_CHANNEL
#define ChannelMessageRescindChannelOffer_TYPE VMBUS_CHANNEL_RESCIND_OFFER
#define ChannelMessageRequestOffers_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
#define ChannelMessageAllOffersDelivered_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
#define ChannelMessageOpenChannel_TYPE VMBUS_CHANNEL_OPEN_CHANNEL
#define ChannelMessageOpenChannelResult_TYPE VMBUS_CHANNEL_OPEN_RESULT
#define ChannelMessageCloseChannel_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
#define ChannelMessageAllGpadlsUnmapped_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
#define ChannelMessageGpadlHeader_TYPE VMBUS_CHANNEL_GPADL_HEADER
#define ChannelMessageGpadlBody_TYPE VMBUS_CHANNEL_GPADL_BODY
#define ChannelMessageGpadlCreated_TYPE VMBUS_CHANNEL_GPADL_CREATED
#define ChannelMessageGpadlTeardown_TYPE VMBUS_CHANNEL_GPADL_TEARDOWN
#define ChannelMessageGpadlTorndown_TYPE VMBUS_CHANNEL_GPADL_TORNDOWN
#define ChannelMessageViewRangeAdd_TYPE VMBUS_CHANNEL_VIEW_RANGE_ADD
#define ChannelMessageViewRangeRemove_TYPE VMBUS_CHANNEL_VIEW_RANGE_REMOVE
#define ChannelMessageRelIdReleased_TYPE VMBUS_CHANNEL_RELID_RELEASED
#define ChannelMessageInitiateContact_TYPE VMBUS_CHANNEL_INITIATE_CONTACT
#define ChannelMessageVersionResponse_TYPE VMBUS_CHANNEL_VERSION_RESPONSE
#define ChannelMessageUnload_TYPE VMBUS_CHANNEL_UNLOAD
/* Preprocessor wrapper to ChAllocateSendMessageSize() converting the return */
/* value to the correct pointer and calculate the needed size. */
/* Argument: */
/* Id - the numberic ID (type VMBUS_CHANNEL_MESSAGE_TYPE) of the message to */
/* send. */
#define ChAllocateSendMessage(Id, Fn, Context) \
(Id##_TYPE*)ChAllocateSendMessageSized(sizeof(Id##_TYPE), Id, Fn, Context)
#pragma pack(pop)
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