3a04845cbb51bcb343eeb4fb3a9f33f39d92a4ed
[safe/jmp/linux-2.6] / drivers / staging / vt6655 / tpci.h
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20  *
21  *
22  * File: tpci.h
23  *
24  * Purpose: PCI routines
25  *
26  * Author: Tevin Chen
27  *
28  * Date: May 21, 1996
29  *
30  */
31
32
33 #ifndef __TPCI_H__
34 #define __TPCI_H__
35
36 #if !defined(__TTYPE_H__)
37 #include "ttype.h"
38 #endif
39
40
41
42
43 /*---------------------  Export Definitions -------------------------*/
44 #define MAX_PCI_BUS             4       // max. # of PCI bus that we support
45 #define MAX_PCI_DEVICE          32      // max. # of PCI devices
46
47
48 //
49 // Registers in the PCI configuration space
50 //
51 #define PCI_REG_VENDOR_ID       0x00    //
52 #define PCI_REG_DEVICE_ID       0x02    //
53 #define PCI_REG_COMMAND         0x04    //
54 #define PCI_REG_STATUS          0x06    //
55 #define PCI_REG_REV_ID          0x08    //
56 #define PCI_REG_CLASS_CODE      0x09    //
57 #define PCI_REG_CACHELINE_SIZE  0x0C    //
58 #define PCI_REG_LAT_TIMER       0x0D    //
59 #define PCI_REG_HDR_TYPE        0x0E    //
60 #define PCI_REG_BIST            0x0F    //
61
62 #define PCI_REG_BAR0            0x10    //
63 #define PCI_REG_BAR1            0x14    //
64 #define PCI_REG_BAR2            0x18    //
65 #define PCI_REG_CARDBUS_CIS_PTR 0x28    //
66
67 #define PCI_REG_SUB_VEN_ID      0x2C    //
68 #define PCI_REG_SUB_SYS_ID      0x2E    //
69 #define PCI_REG_EXP_ROM_BAR     0x30    //
70 #define PCI_REG_CAP             0x34    //
71
72 #define PCI_REG_INT_LINE        0x3C    //
73 #define PCI_REG_INT_PIN         0x3D    //
74 #define PCI_REG_MIN_GNT         0x3E    //
75 #define PCI_REG_MAX_LAT         0x3F    //
76
77 #define PCI_REG_MAX_SIZE        0x100   // maximun total PCI registers
78
79
80 //
81 // Bits in the COMMAND register
82 //
83 #define COMMAND_BUSM        0x04        //
84 #define COMMAND_WAIT        0x80        //
85
86 /*---------------------  Export Types  ------------------------------*/
87
88 /*---------------------  Export Macros ------------------------------*/
89
90 // macro MAKE Bus Dev Fun ID into WORD
91 #define MAKE_BDF_TO_WORD(byBusId, byDevId, byFunId) \
92     MAKEWORD(                                       \
93         ((((BYTE)(byDevId)) & 0x1F) << 3) +         \
94             (((BYTE)(byFunId)) & 0x07),             \
95         (byBusId)                                   \
96         )
97
98 #define GET_BUSID(wBusDevFunId) \
99     HIBYTE(wBusDevFunId)
100
101 #define GET_DEVID(wBusDevFunId) \
102     (LOBYTE(wBusDevFunId) >> 3)
103
104 #define GET_FUNID(wBusDevFunId) \
105     (LOBYTE(wBusDevFunId) & 0x07)
106
107
108 /*---------------------  Export Classes  ----------------------------*/
109
110 /*---------------------  Export Variables  --------------------------*/
111
112 /*---------------------  Export Functions  --------------------------*/
113
114
115
116
117 #endif // __TPCI_H__
118
119