Merge branch 'rmobile/kota2' into rmobile-latest
[pandora-kernel.git] / drivers / staging / rtl8192e / rtl_pci.h
1 /******************************************************************************
2  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3  *
4  * Based on the r8180 driver, which is:
5  * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al.
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18  *
19  * The full GNU General Public License is included in this distribution in the
20  * file called LICENSE.
21  *
22  * Contact Information:
23  * wlanfae <wlanfae@realtek.com>
24  ******************************************************************************/
25 #ifndef _RTL_PCI_H
26 #define _RTL_PCI_H
27
28 #include <linux/types.h>
29 #include <linux/pci.h>
30 #include "rtllib.h"
31
32 static inline void NdisRawWritePortUlong(u32 port,  u32 val)
33 {
34         outl(val, port);
35 }
36
37 static inline void NdisRawWritePortUchar(u32 port,  u8 val)
38 {
39         outb(val, port);
40 }
41
42 static inline void NdisRawReadPortUchar(u32 port, u8 *pval)
43 {
44         *pval = inb(port);
45 }
46
47 static inline void NdisRawReadPortUshort(u32 port, u16 *pval)
48 {
49         *pval = inw(port);
50 }
51
52 static inline void NdisRawReadPortUlong(u32 port, u32 *pval)
53 {
54         *pval = inl(port);
55 }
56
57 struct mp_adapter {
58         u8              LinkCtrlReg;
59
60         u8              BusNumber;
61         u8              DevNumber;
62         u8              FuncNumber;
63
64         u8              PciBridgeBusNum;
65         u8              PciBridgeDevNum;
66         u8              PciBridgeFuncNum;
67         u8              PciBridgeVendor;
68         u16             PciBridgeVendorId;
69         u16             PciBridgeDeviceId;
70         u8              PciBridgePCIeHdrOffset;
71         u8              PciBridgeLinkCtrlReg;
72 };
73
74 struct rt_pci_capab_header {
75         unsigned char   CapabilityID;
76         unsigned char   Next;
77 };
78
79 #define PCI_MAX_BRIDGE_NUMBER                           255
80 #define PCI_MAX_DEVICES                                         32
81 #define PCI_MAX_FUNCTION                                        8
82
83 #define PCI_CONF_ADDRESS                                        0x0CF8
84 #define PCI_CONF_DATA                                           0x0CFC
85
86 #define PCI_CLASS_BRIDGE_DEV                            0x06
87 #define PCI_SUBCLASS_BR_PCI_TO_PCI              0x04
88
89 #define U1DONTCARE                                              0xFF
90 #define U2DONTCARE                                              0xFFFF
91 #define U4DONTCARE                                              0xFFFFFFFF
92
93 #define INTEL_VENDOR_ID                                 0x8086
94 #define SIS_VENDOR_ID                                           0x1039
95 #define ATI_VENDOR_ID                                           0x1002
96 #define ATI_DEVICE_ID                                           0x7914
97 #define AMD_VENDOR_ID                                           0x1022
98
99 #define PCI_CAPABILITY_ID_PCI_EXPRESS           0x10
100
101 struct net_device;
102 bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev);
103
104 #endif