blob: 094433070f4ecfd4d4370a24785fabfdbb4f4b5e [file] [log] [blame]
Li-Ta Lo81521262004-07-08 17:18:27 +00001#include "pci.h"
2
3typedef unsigned long pciaddr_t;
4typedef u8 byte;
5typedef u16 word;
6
7struct pci_dev {
8 struct pci_dev *next; /* Next device in the chain */
9 word bus; /* Higher byte can select host bridges */
10 byte dev, func; /* Device and function */
11
12 /* These fields are set by pci_fill_info() */
13 int known_fields; /* Set of info fields already known */
14 word vendor_id, device_id; /* Identity of the device */
15 int irq; /* IRQ number */
16 pciaddr_t base_addr[6]; /* Base addresses */
17 pciaddr_t size[6]; /* Region sizes */
18 pciaddr_t rom_base_addr; /* Expansion ROM base address */
19 pciaddr_t rom_size; /* Expansion ROM size */
20
21 /* Fields used internally: */
22 void *access;
23 void *methods;
24 byte *cache; /* Cached information */
25 int cache_len;
26 int hdrtype; /* Direct methods: header type */
27 void *aux; /* Auxillary data */
28};
29
30
31struct pci_filter {
32 int bus, slot, func; /* -1 = ANY */
33 int vendor, device;
34};
35
36
37#define PCITAG struct pci_filter *
38#define pciVideoPtr struct pci_dev *
39
40extern int pciNumBuses;
41
42int pciInit(void);
43int pciExit(void);
44
45
46PCITAG findPci(unsigned short bx);
47u32 pciSlotBX(pciVideoPtr pvp);
48
49void pciWriteLong(PCITAG tag, u32 idx, u32 data);
50void pciWriteWord(PCITAG tag, u32 idx, u16 data);
51void pciWriteByte(PCITAG tag, u32 idx, u8 data);
52
53u32 pciReadLong(PCITAG tag, u32 idx);
54u16 pciReadWord(PCITAG tag, u32 idx);
55u8 pciReadByte(PCITAG tag, u32 idx);