2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Purpose: PCI routines
34 #if !defined(__TTYPE_H__)
41 /*--------------------- Export Definitions -------------------------*/
42 #define MAX_PCI_BUS 4 // max. # of PCI bus that we support
43 #define MAX_PCI_DEVICE 32 // max. # of PCI devices
47 // Registers in the PCI configuration space
49 #define PCI_REG_VENDOR_ID 0x00 //
50 #define PCI_REG_DEVICE_ID 0x02 //
51 #define PCI_REG_COMMAND 0x04 //
52 #define PCI_REG_STATUS 0x06 //
53 #define PCI_REG_REV_ID 0x08 //
54 #define PCI_REG_CLASS_CODE 0x09 //
55 #define PCI_REG_CACHELINE_SIZE 0x0C //
56 #define PCI_REG_LAT_TIMER 0x0D //
57 #define PCI_REG_HDR_TYPE 0x0E //
58 #define PCI_REG_BIST 0x0F //
60 #define PCI_REG_BAR0 0x10 //
61 #define PCI_REG_BAR1 0x14 //
62 #define PCI_REG_BAR2 0x18 //
63 #define PCI_REG_CARDBUS_CIS_PTR 0x28 //
65 #define PCI_REG_SUB_VEN_ID 0x2C //
66 #define PCI_REG_SUB_SYS_ID 0x2E //
67 #define PCI_REG_EXP_ROM_BAR 0x30 //
68 #define PCI_REG_CAP 0x34 //
70 #define PCI_REG_INT_LINE 0x3C //
71 #define PCI_REG_INT_PIN 0x3D //
72 #define PCI_REG_MIN_GNT 0x3E //
73 #define PCI_REG_MAX_LAT 0x3F //
75 #define PCI_REG_MAX_SIZE 0x100 // maximun total PCI registers
79 // Bits in the COMMAND register
81 #define COMMAND_BUSM 0x04 //
82 #define COMMAND_WAIT 0x80 //
84 /*--------------------- Export Types ------------------------------*/
86 /*--------------------- Export Macros ------------------------------*/
88 // macro MAKE Bus Dev Fun ID into WORD
89 #define MAKE_BDF_TO_WORD(byBusId, byDevId, byFunId) \
91 ((((BYTE)(byDevId)) & 0x1F) << 3) + \
92 (((BYTE)(byFunId)) & 0x07), \
96 #define GET_BUSID(wBusDevFunId) \
99 #define GET_DEVID(wBusDevFunId) \
100 (LOBYTE(wBusDevFunId) >> 3)
102 #define GET_FUNID(wBusDevFunId) \
103 (LOBYTE(wBusDevFunId) & 0x07)
106 /*--------------------- Export Classes ----------------------------*/
108 /*--------------------- Export Variables --------------------------*/
110 /*--------------------- Export Functions --------------------------*/