From 62327e715f7cd587fd350bc1f05e2fd7cb8c50b8 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 31 May 2010 02:15:15 +0000 Subject: [PATCH] [DDK/XDK] - Use PCI_COMMON_HEADER_LAYOUT for C, too, place it where it belongs svn path=/trunk/; revision=47480 --- reactos/include/ddk/wdm.h | 155 ++++++++++++++++------------------ reactos/include/xdk/iotypes.h | 155 ++++++++++++++++------------------ 2 files changed, 148 insertions(+), 162 deletions(-) diff --git a/reactos/include/ddk/wdm.h b/reactos/include/ddk/wdm.h index af239bbb4c3..aaa474bd057 100644 --- a/reactos/include/ddk/wdm.h +++ b/reactos/include/ddk/wdm.h @@ -4172,80 +4172,6 @@ typedef struct _SHARE_ACCESS { ULONG SharedDelete; } SHARE_ACCESS, *PSHARE_ACCESS; -/* While MS WDK uses inheritance in C++, we cannot do this with gcc, as - inheritance, even from a struct renders the type non-POD. So we use - this hack */ -#define PCI_COMMON_HEADER_LAYOUT \ - USHORT VendorID; \ - USHORT DeviceID; \ - USHORT Command; \ - USHORT Status; \ - UCHAR RevisionID; \ - UCHAR ProgIf; \ - UCHAR SubClass; \ - UCHAR BaseClass; \ - UCHAR CacheLineSize; \ - UCHAR LatencyTimer; \ - UCHAR HeaderType; \ - UCHAR BIST; \ - union { \ - struct _PCI_HEADER_TYPE_0 { \ - ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \ - ULONG CIS; \ - USHORT SubVendorID; \ - USHORT SubSystemID; \ - ULONG ROMBaseAddress; \ - UCHAR CapabilitiesPtr; \ - UCHAR Reserved1[3]; \ - ULONG Reserved2; \ - UCHAR InterruptLine; \ - UCHAR InterruptPin; \ - UCHAR MinimumGrant; \ - UCHAR MaximumLatency; \ - } type0; \ - struct _PCI_HEADER_TYPE_1 { \ - ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \ - UCHAR PrimaryBus; \ - UCHAR SecondaryBus; \ - UCHAR SubordinateBus; \ - UCHAR SecondaryLatency; \ - UCHAR IOBase; \ - UCHAR IOLimit; \ - USHORT SecondaryStatus; \ - USHORT MemoryBase; \ - USHORT MemoryLimit; \ - USHORT PrefetchBase; \ - USHORT PrefetchLimit; \ - ULONG PrefetchBaseUpper32; \ - ULONG PrefetchLimitUpper32; \ - USHORT IOBaseUpper16; \ - USHORT IOLimitUpper16; \ - UCHAR CapabilitiesPtr; \ - UCHAR Reserved1[3]; \ - ULONG ROMBaseAddress; \ - UCHAR InterruptLine; \ - UCHAR InterruptPin; \ - USHORT BridgeControl; \ - } type1; \ - struct _PCI_HEADER_TYPE_2 { \ - ULONG SocketRegistersBaseAddress; \ - UCHAR CapabilitiesPtr; \ - UCHAR Reserved; \ - USHORT SecondaryStatus; \ - UCHAR PrimaryBus; \ - UCHAR SecondaryBus; \ - UCHAR SubordinateBus; \ - UCHAR SecondaryLatency; \ - struct { \ - ULONG Base; \ - ULONG Limit; \ - } Range[PCI_TYPE2_ADDRESSES-1]; \ - UCHAR InterruptLine; \ - UCHAR InterruptPin; \ - USHORT BridgeControl; \ - } type2; \ - } u; - typedef enum _CREATE_FILE_TYPE { CreateFileTypeNone, CreateFileTypeNamedPipe, @@ -6665,21 +6591,88 @@ typedef struct _PCI_SLOT_NUMBER { #define PCI_TYPE1_ADDRESSES 2 #define PCI_TYPE2_ADDRESSES 5 +/* While MS WDK uses inheritance in C++, we cannot do this with gcc, as + inheritance, even from a struct renders the type non-POD. So we use + this hack */ +#define PCI_COMMON_HEADER_LAYOUT \ + USHORT VendorID; \ + USHORT DeviceID; \ + USHORT Command; \ + USHORT Status; \ + UCHAR RevisionID; \ + UCHAR ProgIf; \ + UCHAR SubClass; \ + UCHAR BaseClass; \ + UCHAR CacheLineSize; \ + UCHAR LatencyTimer; \ + UCHAR HeaderType; \ + UCHAR BIST; \ + union { \ + struct _PCI_HEADER_TYPE_0 { \ + ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \ + ULONG CIS; \ + USHORT SubVendorID; \ + USHORT SubSystemID; \ + ULONG ROMBaseAddress; \ + UCHAR CapabilitiesPtr; \ + UCHAR Reserved1[3]; \ + ULONG Reserved2; \ + UCHAR InterruptLine; \ + UCHAR InterruptPin; \ + UCHAR MinimumGrant; \ + UCHAR MaximumLatency; \ + } type0; \ + struct _PCI_HEADER_TYPE_1 { \ + ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \ + UCHAR PrimaryBus; \ + UCHAR SecondaryBus; \ + UCHAR SubordinateBus; \ + UCHAR SecondaryLatency; \ + UCHAR IOBase; \ + UCHAR IOLimit; \ + USHORT SecondaryStatus; \ + USHORT MemoryBase; \ + USHORT MemoryLimit; \ + USHORT PrefetchBase; \ + USHORT PrefetchLimit; \ + ULONG PrefetchBaseUpper32; \ + ULONG PrefetchLimitUpper32; \ + USHORT IOBaseUpper16; \ + USHORT IOLimitUpper16; \ + UCHAR CapabilitiesPtr; \ + UCHAR Reserved1[3]; \ + ULONG ROMBaseAddress; \ + UCHAR InterruptLine; \ + UCHAR InterruptPin; \ + USHORT BridgeControl; \ + } type1; \ + struct _PCI_HEADER_TYPE_2 { \ + ULONG SocketRegistersBaseAddress; \ + UCHAR CapabilitiesPtr; \ + UCHAR Reserved; \ + USHORT SecondaryStatus; \ + UCHAR PrimaryBus; \ + UCHAR SecondaryBus; \ + UCHAR SubordinateBus; \ + UCHAR SecondaryLatency; \ + struct { \ + ULONG Base; \ + ULONG Limit; \ + } Range[PCI_TYPE2_ADDRESSES-1]; \ + UCHAR InterruptLine; \ + UCHAR InterruptPin; \ + USHORT BridgeControl; \ + } type2; \ + } u; + typedef struct _PCI_COMMON_HEADER { PCI_COMMON_HEADER_LAYOUT } PCI_COMMON_HEADER, *PPCI_COMMON_HEADER; -#ifdef __cplusplus typedef struct _PCI_COMMON_CONFIG { PCI_COMMON_HEADER_LAYOUT UCHAR DeviceSpecific[192]; } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; -#else -typedef struct _PCI_COMMON_CONFIG { - PCI_COMMON_HEADER DUMMYSTRUCTNAME; - UCHAR DeviceSpecific[192]; -} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; -#endif #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific)) diff --git a/reactos/include/xdk/iotypes.h b/reactos/include/xdk/iotypes.h index aac22cb3668..19af071d420 100644 --- a/reactos/include/xdk/iotypes.h +++ b/reactos/include/xdk/iotypes.h @@ -495,80 +495,6 @@ typedef struct _SHARE_ACCESS { ULONG SharedDelete; } SHARE_ACCESS, *PSHARE_ACCESS; -/* While MS WDK uses inheritance in C++, we cannot do this with gcc, as - inheritance, even from a struct renders the type non-POD. So we use - this hack */ -#define PCI_COMMON_HEADER_LAYOUT \ - USHORT VendorID; \ - USHORT DeviceID; \ - USHORT Command; \ - USHORT Status; \ - UCHAR RevisionID; \ - UCHAR ProgIf; \ - UCHAR SubClass; \ - UCHAR BaseClass; \ - UCHAR CacheLineSize; \ - UCHAR LatencyTimer; \ - UCHAR HeaderType; \ - UCHAR BIST; \ - union { \ - struct _PCI_HEADER_TYPE_0 { \ - ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \ - ULONG CIS; \ - USHORT SubVendorID; \ - USHORT SubSystemID; \ - ULONG ROMBaseAddress; \ - UCHAR CapabilitiesPtr; \ - UCHAR Reserved1[3]; \ - ULONG Reserved2; \ - UCHAR InterruptLine; \ - UCHAR InterruptPin; \ - UCHAR MinimumGrant; \ - UCHAR MaximumLatency; \ - } type0; \ - struct _PCI_HEADER_TYPE_1 { \ - ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \ - UCHAR PrimaryBus; \ - UCHAR SecondaryBus; \ - UCHAR SubordinateBus; \ - UCHAR SecondaryLatency; \ - UCHAR IOBase; \ - UCHAR IOLimit; \ - USHORT SecondaryStatus; \ - USHORT MemoryBase; \ - USHORT MemoryLimit; \ - USHORT PrefetchBase; \ - USHORT PrefetchLimit; \ - ULONG PrefetchBaseUpper32; \ - ULONG PrefetchLimitUpper32; \ - USHORT IOBaseUpper16; \ - USHORT IOLimitUpper16; \ - UCHAR CapabilitiesPtr; \ - UCHAR Reserved1[3]; \ - ULONG ROMBaseAddress; \ - UCHAR InterruptLine; \ - UCHAR InterruptPin; \ - USHORT BridgeControl; \ - } type1; \ - struct _PCI_HEADER_TYPE_2 { \ - ULONG SocketRegistersBaseAddress; \ - UCHAR CapabilitiesPtr; \ - UCHAR Reserved; \ - USHORT SecondaryStatus; \ - UCHAR PrimaryBus; \ - UCHAR SecondaryBus; \ - UCHAR SubordinateBus; \ - UCHAR SecondaryLatency; \ - struct { \ - ULONG Base; \ - ULONG Limit; \ - } Range[PCI_TYPE2_ADDRESSES-1]; \ - UCHAR InterruptLine; \ - UCHAR InterruptPin; \ - USHORT BridgeControl; \ - } type2; \ - } u; - typedef enum _CREATE_FILE_TYPE { CreateFileTypeNone, CreateFileTypeNamedPipe, @@ -2988,21 +2914,88 @@ typedef struct _PCI_SLOT_NUMBER { #define PCI_TYPE1_ADDRESSES 2 #define PCI_TYPE2_ADDRESSES 5 +/* While MS WDK uses inheritance in C++, we cannot do this with gcc, as + inheritance, even from a struct renders the type non-POD. So we use + this hack */ +#define PCI_COMMON_HEADER_LAYOUT \ + USHORT VendorID; \ + USHORT DeviceID; \ + USHORT Command; \ + USHORT Status; \ + UCHAR RevisionID; \ + UCHAR ProgIf; \ + UCHAR SubClass; \ + UCHAR BaseClass; \ + UCHAR CacheLineSize; \ + UCHAR LatencyTimer; \ + UCHAR HeaderType; \ + UCHAR BIST; \ + union { \ + struct _PCI_HEADER_TYPE_0 { \ + ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \ + ULONG CIS; \ + USHORT SubVendorID; \ + USHORT SubSystemID; \ + ULONG ROMBaseAddress; \ + UCHAR CapabilitiesPtr; \ + UCHAR Reserved1[3]; \ + ULONG Reserved2; \ + UCHAR InterruptLine; \ + UCHAR InterruptPin; \ + UCHAR MinimumGrant; \ + UCHAR MaximumLatency; \ + } type0; \ + struct _PCI_HEADER_TYPE_1 { \ + ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \ + UCHAR PrimaryBus; \ + UCHAR SecondaryBus; \ + UCHAR SubordinateBus; \ + UCHAR SecondaryLatency; \ + UCHAR IOBase; \ + UCHAR IOLimit; \ + USHORT SecondaryStatus; \ + USHORT MemoryBase; \ + USHORT MemoryLimit; \ + USHORT PrefetchBase; \ + USHORT PrefetchLimit; \ + ULONG PrefetchBaseUpper32; \ + ULONG PrefetchLimitUpper32; \ + USHORT IOBaseUpper16; \ + USHORT IOLimitUpper16; \ + UCHAR CapabilitiesPtr; \ + UCHAR Reserved1[3]; \ + ULONG ROMBaseAddress; \ + UCHAR InterruptLine; \ + UCHAR InterruptPin; \ + USHORT BridgeControl; \ + } type1; \ + struct _PCI_HEADER_TYPE_2 { \ + ULONG SocketRegistersBaseAddress; \ + UCHAR CapabilitiesPtr; \ + UCHAR Reserved; \ + USHORT SecondaryStatus; \ + UCHAR PrimaryBus; \ + UCHAR SecondaryBus; \ + UCHAR SubordinateBus; \ + UCHAR SecondaryLatency; \ + struct { \ + ULONG Base; \ + ULONG Limit; \ + } Range[PCI_TYPE2_ADDRESSES-1]; \ + UCHAR InterruptLine; \ + UCHAR InterruptPin; \ + USHORT BridgeControl; \ + } type2; \ + } u; + typedef struct _PCI_COMMON_HEADER { PCI_COMMON_HEADER_LAYOUT } PCI_COMMON_HEADER, *PPCI_COMMON_HEADER; -#ifdef __cplusplus typedef struct _PCI_COMMON_CONFIG { PCI_COMMON_HEADER_LAYOUT UCHAR DeviceSpecific[192]; } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; -#else -typedef struct _PCI_COMMON_CONFIG { - PCI_COMMON_HEADER DUMMYSTRUCTNAME; - UCHAR DeviceSpecific[192]; -} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; -#endif #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific)) -- 2.17.1