1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
20 #ifndef __DRV_TYPES_PCI_H__
21 #define __DRV_TYPES_PCI_H__
25 #include <linux/pci.h>
29 #define INTEL_VENDOR_ID 0x8086
30 #define SIS_VENDOR_ID 0x1039
31 #define ATI_VENDOR_ID 0x1002
32 #define ATI_DEVICE_ID 0x7914
33 #define AMD_VENDOR_ID 0x1022
35 #define PCI_MAX_BRIDGE_NUMBER 255
36 #define PCI_MAX_DEVICES 32
37 #define PCI_MAX_FUNCTION 8
39 #define PCI_CONF_ADDRESS 0x0CF8 /* PCI Configuration Space Address */
40 #define PCI_CONF_DATA 0x0CFC /* PCI Configuration Space Data */
42 #define PCI_CLASS_BRIDGE_DEV 0x06
43 #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04
45 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
47 #define U1DONTCARE 0xFF
48 #define U2DONTCARE 0xFFFF
49 #define U4DONTCARE 0xFFFFFFFF
51 #define PCI_VENDER_ID_REALTEK 0x10ec
53 #define HAL_HW_PCI_8180_DEVICE_ID 0x8180
54 #define HAL_HW_PCI_8185_DEVICE_ID 0x8185 /* 8185 or 8185b */
55 #define HAL_HW_PCI_8188_DEVICE_ID 0x8188 /* 8185b */
56 #define HAL_HW_PCI_8198_DEVICE_ID 0x8198 /* 8185b */
57 #define HAL_HW_PCI_8190_DEVICE_ID 0x8190 /* 8190 */
58 #define HAL_HW_PCI_8723E_DEVICE_ID 0x8723 /* 8723E */
59 #define HAL_HW_PCI_8192_DEVICE_ID 0x8192 /* 8192 PCI-E */
60 #define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192 /* 8192 SE */
61 #define HAL_HW_PCI_8174_DEVICE_ID 0x8174 /* 8192 SE */
62 #define HAL_HW_PCI_8173_DEVICE_ID 0x8173 /* 8191 SE Crab */
63 #define HAL_HW_PCI_8172_DEVICE_ID 0x8172 /* 8191 SE RE */
64 #define HAL_HW_PCI_8171_DEVICE_ID 0x8171 /* 8191 SE Unicron */
65 #define HAL_HW_PCI_0045_DEVICE_ID 0x0045 /* 8190 PCI for Ceraga */
66 #define HAL_HW_PCI_0046_DEVICE_ID 0x0046 /* 8190 Cardbus for Ceraga */
67 #define HAL_HW_PCI_0044_DEVICE_ID 0x0044 /* 8192e PCIE for Ceraga */
68 #define HAL_HW_PCI_0047_DEVICE_ID 0x0047 /* 8192e Express Card for Ceraga */
69 #define HAL_HW_PCI_700F_DEVICE_ID 0x700F
70 #define HAL_HW_PCI_701F_DEVICE_ID 0x701F
71 #define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304
72 #define HAL_HW_PCI_8188EE_DEVICE_ID 0x8179
74 #define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 /* 8190 support 16 pages of IO registers */
75 #define HAL_HW_PCI_REVISION_ID_8190PCI 0x00
76 #define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000 /* 8192 support 16 pages of IO registers */
77 #define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01
78 #define HAL_MEMORY_MAPPED_IO_RANGE_8192SE 0x4000 /* 8192 support 16 pages of IO registers */
79 #define HAL_HW_PCI_REVISION_ID_8192SE 0x10
80 #define HAL_HW_PCI_REVISION_ID_8192CE 0x1
81 #define HAL_MEMORY_MAPPED_IO_RANGE_8192CE 0x4000 /* 8192 support 16 pages of IO registers */
82 #define HAL_HW_PCI_REVISION_ID_8192DE 0x0
83 #define HAL_MEMORY_MAPPED_IO_RANGE_8192DE 0x4000 /* 8192 support 16 pages of IO registers */
85 enum pci_bridge_vendor {
86 PCI_BRIDGE_VENDOR_INTEL = 0x0,/* 0b'0000,0001 */
87 PCI_BRIDGE_VENDOR_ATI, /* = 0x02, */ /* 0b'0000,0010 */
88 PCI_BRIDGE_VENDOR_AMD, /* = 0x04, */ /* 0b'0000,0100 */
89 PCI_BRIDGE_VENDOR_SIS ,/* = 0x08, */ /* 0b'0000,1000 */
90 PCI_BRIDGE_VENDOR_UNKNOWN, /* = 0x40, */ /* 0b'0100,0000 */
91 PCI_BRIDGE_VENDOR_MAX ,/* = 0x80 */
94 /* copy this data structor defination from MSDN SDK */
95 typedef struct _PCI_COMMON_CONFIG {
110 struct _PCI_HEADER_TYPE_0 {
111 u32 BaseAddresses[6];
126 struct _PCI_HEADER_TYPE_1 {
127 ULONG BaseAddresses[PCI_TYPE1_ADDRESSES];
128 UCHAR PrimaryBusNumber;
129 UCHAR SecondaryBusNumber;
130 UCHAR SubordinateBusNumber;
131 UCHAR SecondaryLatencyTimer;
134 USHORT SecondaryStatus;
137 USHORT PrefetchableMemoryBase;
138 USHORT PrefetchableMemoryLimit;
139 ULONG PrefetchableMemoryBaseUpper32;
140 ULONG PrefetchableMemoryLimitUpper32;
144 ULONG ExpansionROMBase;
147 USHORT BridgeControl;
150 struct _PCI_HEADER_TYPE_2 {
152 UCHAR CapabilitiesPtr;
154 USHORT SecondaryStatus;
155 UCHAR PrimaryBusNumber;
156 UCHAR CardbusBusNumber;
157 UCHAR SubordinateBusNumber;
158 UCHAR CardbusLatencyTimer;
173 USHORT BridgeControl;
176 ULONG LegacyBaseAddress;
179 UCHAR MultiMediaControl;
195 u8 DeviceSpecific[108];
196 } PCI_COMMON_CONFIG , *PPCI_COMMON_CONFIG;
198 typedef struct _RT_PCI_CAPABILITIES_HEADER {
201 } RT_PCI_CAPABILITIES_HEADER, *PRT_PCI_CAPABILITIES_HEADER;
207 /* PCIeCap is only differece between B-cut and C-cut. */
208 /* Configuration Space offset 72[7:4] */
210 /* 1: C cut and later. */
220 u8 pcibridge_funcnum;
222 u16 pcibridge_vendorid;
223 u16 pcibridge_deviceid;
224 u8 pcibridge_pciehdr_offset;
225 u8 pcibridge_linkctrlreg;
230 typedef struct _RT_ISR_CONTENT {
236 } RT_ISR_CONTENT, *PRT_ISR_CONTENT;
238 /* #define RegAddr(addr) (addr + 0xB2000000UL) */
239 /* some platform macros will def here */
240 static inline void NdisRawWritePortUlong(u32 port, u32 val)
243 /* writel(val, (u8 *)RegAddr(port)); */
246 static inline void NdisRawWritePortUchar(u32 port, u8 val)
249 /* writeb(val, (u8 *)RegAddr(port)); */
252 static inline void NdisRawReadPortUchar(u32 port, u8 *pval)
255 /* *pval = readb((u8 *)RegAddr(port)); */
258 static inline void NdisRawReadPortUshort(u32 port, u16 *pval)
261 /* *pval = readw((u8 *)RegAddr(port)); */
264 static inline void NdisRawReadPortUlong(u32 port, u32 *pval)
267 /* *pval = readl((u8 *)RegAddr(port)); */