Commit 4bedd6be authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: fix coding style issues in VmbusPacketFormat.h

Heh, volatiles, like that was a good idea...  Turns out they were not
even used, wierd stuff.

All clean except for the typedefs.

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b3715ee4
...@@ -21,300 +21,148 @@ ...@@ -21,300 +21,148 @@
* *
*/ */
#ifndef _VMBUSPACKETFORMAT_H_
#pragma once typedef struct {
u16 Type;
/* #ifndef PAGE_SIZE */ u16 DataOffset8;
/* #if defined(_IA64_) */ u16 Length8;
/* #error This does not work for IA64 */ u16 Flags;
/* #else */ u64 TransactionId;
/* #define PAGE_SIZE 0x1000 */ } __attribute__((packed)) VMPACKET_DESCRIPTOR, *PVMPACKET_DESCRIPTOR;
/* #endif */
/* #endif */
/* allow nameless unions */
/* #pragma warning(disable : 4201) */
typedef struct
{
union
{
struct
{
volatile u32 In; /* Offset in bytes from the ring base */
volatile u32 Out; /* Offset in bytes from the ring base */
};
volatile long long InOut;
};
/* If the receiving endpoint sets this to some non-zero value, the sending */
/* endpoint should not send any interrupts. */
volatile u32 InterruptMask;
} VMRCB, *PVMRCB;
typedef struct
{
union
{
struct
{
VMRCB Control;
};
u8 Reserved[PAGE_SIZE];
};
/* Beginning of the ring data. Note: It must be guaranteed that */
/* this data does not share a page with the control structure. */
u8 Data[1];
} VMRING, *PVMRING;
#pragma pack(push, 1)
typedef struct
{
u16 Type;
u16 DataOffset8;
u16 Length8;
u16 Flags;
u64 TransactionId;
} VMPACKET_DESCRIPTOR, *PVMPACKET_DESCRIPTOR;
typedef u32 PREVIOUS_PACKET_OFFSET, *PPREVIOUS_PACKET_OFFSET; typedef u32 PREVIOUS_PACKET_OFFSET, *PPREVIOUS_PACKET_OFFSET;
typedef struct typedef struct {
{ PREVIOUS_PACKET_OFFSET PreviousPacketStartOffset;
PREVIOUS_PACKET_OFFSET PreviousPacketStartOffset; VMPACKET_DESCRIPTOR Descriptor;
VMPACKET_DESCRIPTOR Descriptor; } __attribute__((packed)) VMPACKET_HEADER, *PVMPACKET_HEADER;
} VMPACKET_HEADER, *PVMPACKET_HEADER;
typedef struct
{
u32 ByteCount;
u32 ByteOffset;
} VMTRANSFER_PAGE_RANGE, *PVMTRANSFER_PAGE_RANGE;
#ifdef __cplusplus
typedef struct _VMTRANSFER_PAGE_PACKET_HEADER : VMPACKET_DESCRIPTOR {
#else typedef struct {
u32 ByteCount;
u32 ByteOffset;
} __attribute__((packed)) VMTRANSFER_PAGE_RANGE, *PVMTRANSFER_PAGE_RANGE;
typedef struct VMTRANSFER_PAGE_PACKET_HEADER { typedef struct VMTRANSFER_PAGE_PACKET_HEADER {
VMPACKET_DESCRIPTOR d;
VMPACKET_DESCRIPTOR d; u16 TransferPageSetId;
bool SenderOwnsSet;
#endif u8 Reserved;
u32 RangeCount;
u16 TransferPageSetId; VMTRANSFER_PAGE_RANGE Ranges[1];
bool SenderOwnsSet; } __attribute__((packed)) VMTRANSFER_PAGE_PACKET_HEADER, *PVMTRANSFER_PAGE_PACKET_HEADER;
u8 Reserved;
u32 RangeCount;
VMTRANSFER_PAGE_RANGE Ranges[1];
} VMTRANSFER_PAGE_PACKET_HEADER, *PVMTRANSFER_PAGE_PACKET_HEADER;
#ifdef __cplusplus
typedef struct _VMGPADL_PACKET_HEADER : VMPACKET_DESCRIPTOR {
#else
typedef struct _VMGPADL_PACKET_HEADER { typedef struct _VMGPADL_PACKET_HEADER {
VMPACKET_DESCRIPTOR d;
VMPACKET_DESCRIPTOR d; u32 Gpadl;
u32 Reserved;
#endif } __attribute__((packed)) VMGPADL_PACKET_HEADER, *PVMGPADL_PACKET_HEADER;
u32 Gpadl;
u32 Reserved;
} VMGPADL_PACKET_HEADER, *PVMGPADL_PACKET_HEADER;
#ifdef __cplusplus
typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET : VMPACKET_DESCRIPTOR {
#else
typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET { typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET {
VMPACKET_DESCRIPTOR d;
u32 Gpadl;
u16 TransferPageSetId;
u16 Reserved;
} __attribute__((packed)) VMADD_REMOVE_TRANSFER_PAGE_SET, *PVMADD_REMOVE_TRANSFER_PAGE_SET;
VMPACKET_DESCRIPTOR d; /*
* This structure defines a range in guest physical space that can be made to
#endif * look virtually contiguous.
*/
u32 Gpadl;
u16 TransferPageSetId;
u16 Reserved;
} VMADD_REMOVE_TRANSFER_PAGE_SET, *PVMADD_REMOVE_TRANSFER_PAGE_SET;
#pragma pack(pop)
/* This structure defines a range in guest physical space that can be made */
/* to look virtually contiguous. */
typedef struct _GPA_RANGE { typedef struct _GPA_RANGE {
u32 ByteCount;
u32 ByteCount; u32 ByteOffset;
u32 ByteOffset; u64 PfnArray[0];
u64 PfnArray[0];
} GPA_RANGE, *PGPA_RANGE; } GPA_RANGE, *PGPA_RANGE;
/*
* This is the format for an Establish Gpadl packet, which contains a handle by
#pragma pack(push, 1) * which this GPADL will be known and a set of GPA ranges associated with it.
* This can be converted to a MDL by the guest OS. If there are multiple GPA
* ranges, then the resulting MDL will be "chained," representing multiple VA
/* This is the format for an Establish Gpadl packet, which contains a handle */ * ranges.
/* by which this GPADL will be known and a set of GPA ranges associated with */ */
/* it. This can be converted to a MDL by the guest OS. If there are multiple */
/* GPA ranges, then the resulting MDL will be "chained," representing multiple */
/* VA ranges. */
#ifdef __cplusplus
typedef struct _VMESTABLISH_GPADL : VMPACKET_DESCRIPTOR {
#else
typedef struct _VMESTABLISH_GPADL { typedef struct _VMESTABLISH_GPADL {
VMPACKET_DESCRIPTOR d;
u32 Gpadl;
u32 RangeCount;
GPA_RANGE Range[1];
} __attribute__((packed)) VMESTABLISH_GPADL, *PVMESTABLISH_GPADL;
VMPACKET_DESCRIPTOR d; /*
* This is the format for a Teardown Gpadl packet, which indicates that the
#endif * GPADL handle in the Establish Gpadl packet will never be referenced again.
*/
u32 Gpadl;
u32 RangeCount;
GPA_RANGE Range[1];
} VMESTABLISH_GPADL, *PVMESTABLISH_GPADL;
/* This is the format for a Teardown Gpadl packet, which indicates that the */
/* GPADL handle in the Establish Gpadl packet will never be referenced again. */
#ifdef __cplusplus
typedef struct _VMTEARDOWN_GPADL : VMPACKET_DESCRIPTOR {
#else
typedef struct _VMTEARDOWN_GPADL { typedef struct _VMTEARDOWN_GPADL {
VMPACKET_DESCRIPTOR d;
u32 Gpadl;
u32 Reserved; /* for alignment to a 8-byte boundary */
} __attribute__((packed)) VMTEARDOWN_GPADL, *PVMTEARDOWN_GPADL;
VMPACKET_DESCRIPTOR d; /*
* This is the format for a GPA-Direct packet, which contains a set of GPA
#endif * ranges, in addition to commands and/or data.
*/
u32 Gpadl;
u32 Reserved; /* for alignment to a 8-byte boundary */
} VMTEARDOWN_GPADL, *PVMTEARDOWN_GPADL;
/* This is the format for a GPA-Direct packet, which contains a set of GPA */
/* ranges, in addition to commands and/or data. */
#ifdef __cplusplus
typedef struct _VMDATA_GPA_DIRECT : VMPACKET_DESCRIPTOR {
#else
typedef struct _VMDATA_GPA_DIRECT { typedef struct _VMDATA_GPA_DIRECT {
VMPACKET_DESCRIPTOR d;
VMPACKET_DESCRIPTOR d; u32 Reserved;
u32 RangeCount;
#endif GPA_RANGE Range[1];
} __attribute__((packed)) VMDATA_GPA_DIRECT, *PVMDATA_GPA_DIRECT;
u32 Reserved;
u32 RangeCount;
GPA_RANGE Range[1];
} VMDATA_GPA_DIRECT, *PVMDATA_GPA_DIRECT;
/* This is the format for a Additional Data Packet. */ /* This is the format for a Additional Data Packet. */
#ifdef __cplusplus
typedef struct _VMADDITIONAL_DATA : VMPACKET_DESCRIPTOR {
#else
typedef struct _VMADDITIONAL_DATA { typedef struct _VMADDITIONAL_DATA {
VMPACKET_DESCRIPTOR d;
VMPACKET_DESCRIPTOR d; u64 TotalBytes;
u32 ByteOffset;
#endif u32 ByteCount;
unsigned char Data[1];
u64 TotalBytes; } __attribute__((packed)) VMADDITIONAL_DATA, *PVMADDITIONAL_DATA;
u32 ByteOffset;
u32 ByteCount;
unsigned char Data[1];
} VMADDITIONAL_DATA, *PVMADDITIONAL_DATA;
#pragma pack(pop)
typedef union { typedef union {
VMPACKET_DESCRIPTOR SimpleHeader; VMPACKET_DESCRIPTOR SimpleHeader;
VMTRANSFER_PAGE_PACKET_HEADER TransferPageHeader; VMTRANSFER_PAGE_PACKET_HEADER TransferPageHeader;
VMGPADL_PACKET_HEADER GpadlHeader; VMGPADL_PACKET_HEADER GpadlHeader;
VMADD_REMOVE_TRANSFER_PAGE_SET AddRemoveTransferPageHeader; VMADD_REMOVE_TRANSFER_PAGE_SET AddRemoveTransferPageHeader;
VMESTABLISH_GPADL EstablishGpadlHeader; VMESTABLISH_GPADL EstablishGpadlHeader;
VMTEARDOWN_GPADL TeardownGpadlHeader; VMTEARDOWN_GPADL TeardownGpadlHeader;
VMDATA_GPA_DIRECT DataGpaDirectHeader; VMDATA_GPA_DIRECT DataGpaDirectHeader;
} VMPACKET_LARGEST_POSSIBLE_HEADER, *PVMPACKET_LARGEST_POSSIBLE_HEADER; } VMPACKET_LARGEST_POSSIBLE_HEADER, *PVMPACKET_LARGEST_POSSIBLE_HEADER;
#define VMPACKET_DATA_START_ADDRESS(__packet) \ #define VMPACKET_DATA_START_ADDRESS(__packet) \
(void *)(((unsigned char *)__packet) + ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8 * 8) (void *)(((unsigned char *)__packet) + \
((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8 * 8)
#define VMPACKET_DATA_LENGTH(__packet) \ #define VMPACKET_DATA_LENGTH(__packet) \
((((PVMPACKET_DESCRIPTOR)__packet)->Length8 - ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8) * 8) ((((PVMPACKET_DESCRIPTOR)__packet)->Length8 - \
((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8) * 8)
#define VMPACKET_TRANSFER_MODE(__packet) ((PVMPACKET_DESCRIPTOR)__packet)->Type #define VMPACKET_TRANSFER_MODE(__packet) \
(((PVMPACKET_DESCRIPTOR)__packet)->Type)
typedef enum { typedef enum {
VmbusServerEndpoint = 0, VmbusServerEndpoint = 0,
VmbusClientEndpoint, VmbusClientEndpoint,
VmbusEndpointMaximum VmbusEndpointMaximum
} ENDPOINT_TYPE, *PENDPOINT_TYPE; } ENDPOINT_TYPE, *PENDPOINT_TYPE;
typedef enum { typedef enum {
VmbusPacketTypeInvalid = 0x0, VmbusPacketTypeInvalid = 0x0,
VmbusPacketTypeSynch = 0x1, VmbusPacketTypeSynch = 0x1,
VmbusPacketTypeAddTransferPageSet = 0x2, VmbusPacketTypeAddTransferPageSet = 0x2,
VmbusPacketTypeRemoveTransferPageSet = 0x3, VmbusPacketTypeRemoveTransferPageSet = 0x3,
VmbusPacketTypeEstablishGpadl = 0x4, VmbusPacketTypeEstablishGpadl = 0x4,
VmbusPacketTypeTearDownGpadl = 0x5, VmbusPacketTypeTearDownGpadl = 0x5,
VmbusPacketTypeDataInBand = 0x6, VmbusPacketTypeDataInBand = 0x6,
VmbusPacketTypeDataUsingTransferPages = 0x7, VmbusPacketTypeDataUsingTransferPages = 0x7,
VmbusPacketTypeDataUsingGpadl = 0x8, VmbusPacketTypeDataUsingGpadl = 0x8,
VmbusPacketTypeDataUsingGpaDirect = 0x9, VmbusPacketTypeDataUsingGpaDirect = 0x9,
VmbusPacketTypeCancelRequest = 0xa, VmbusPacketTypeCancelRequest = 0xa,
VmbusPacketTypeCompletion = 0xb, VmbusPacketTypeCompletion = 0xb,
VmbusPacketTypeDataUsingAdditionalPackets = 0xc, VmbusPacketTypeDataUsingAdditionalPackets = 0xc,
VmbusPacketTypeAdditionalData = 0xd VmbusPacketTypeAdditionalData = 0xd
} VMBUS_PACKET_TYPE, *PVMBUS_PACKET_TYPE; } VMBUS_PACKET_TYPE, *PVMBUS_PACKET_TYPE;
#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1 #define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
#endif
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