blob: 4a1c8ed75ca68319e07f43626dd700338efa49b0 [file] [log] [blame]
Forest Bond5449c682009-04-25 10:30:44 -04001/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
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.
9 *
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.
14 *
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.
18 *
19 *
20 * File: tpci.h
21 *
22 * Purpose: PCI routines
23 *
24 * Author: Tevin Chen
25 *
26 * Date: May 21, 1996
27 *
28 */
29
30
31#ifndef __TPCI_H__
32#define __TPCI_H__
33
34#if !defined(__TTYPE_H__)
35#include "ttype.h"
36#endif
37
38
39
40
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
44
45
46//
47// Registers in the PCI configuration space
48//
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 //
59
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 //
64
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 //
69
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 //
74
75#define PCI_REG_MAX_SIZE 0x100 // maximun total PCI registers
76
77
78//
79// Bits in the COMMAND register
80//
81#define COMMAND_BUSM 0x04 //
82#define COMMAND_WAIT 0x80 //
83
84/*--------------------- Export Types ------------------------------*/
85
86/*--------------------- Export Macros ------------------------------*/
87
88// macro MAKE Bus Dev Fun ID into WORD
89#define MAKE_BDF_TO_WORD(byBusId, byDevId, byFunId) \
90 MAKEWORD( \
91 ((((BYTE)(byDevId)) & 0x1F) << 3) + \
92 (((BYTE)(byFunId)) & 0x07), \
93 (byBusId) \
94 )
95
96#define GET_BUSID(wBusDevFunId) \
97 HIBYTE(wBusDevFunId)
98
99#define GET_DEVID(wBusDevFunId) \
100 (LOBYTE(wBusDevFunId) >> 3)
101
102#define GET_FUNID(wBusDevFunId) \
103 (LOBYTE(wBusDevFunId) & 0x07)
104
105
106/*--------------------- Export Classes ----------------------------*/
107
108/*--------------------- Export Variables --------------------------*/
109
110/*--------------------- Export Functions --------------------------*/
111
112
113
114
115#endif // __TPCI_H__
116
117