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