[4] | 1 | /*
|
---|
| 2 | pci.h
|
---|
| 3 |
|
---|
| 4 | Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | /* tempory functions: to be replaced later (see pci_intel.h) */
|
---|
| 8 | _PROTOTYPE( unsigned pci_inb, (U16_t port) );
|
---|
| 9 | _PROTOTYPE( unsigned pci_inw, (U16_t port) );
|
---|
| 10 | _PROTOTYPE( unsigned pci_inl, (U16_t port) );
|
---|
| 11 |
|
---|
| 12 | _PROTOTYPE( void pci_outb, (U16_t port, U8_t value) );
|
---|
| 13 | _PROTOTYPE( void pci_outw, (U16_t port, U16_t value) );
|
---|
| 14 | _PROTOTYPE( void pci_outl, (U16_t port, U32_t value) );
|
---|
| 15 |
|
---|
| 16 | /* pci.c */
|
---|
| 17 | _PROTOTYPE( void pci_init, (void) );
|
---|
| 18 | _PROTOTYPE( int pci_find_dev, (U8_t bus, U8_t dev, U8_t func,
|
---|
| 19 | int *devindp) );
|
---|
| 20 | _PROTOTYPE( int pci_first_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
|
---|
| 21 | _PROTOTYPE( int pci_next_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
|
---|
| 22 | _PROTOTYPE( void pci_reserve, (int devind) );
|
---|
| 23 | _PROTOTYPE( void pci_ids, (int devind, u16_t *vidp, u16_t *didp) );
|
---|
| 24 | _PROTOTYPE( char *pci_slot_name, (int devind) );
|
---|
| 25 | _PROTOTYPE( char *pci_dev_name, (U16_t vid, U16_t did) );
|
---|
| 26 | _PROTOTYPE( u8_t pci_attr_r8, (int devind, int port) );
|
---|
| 27 | _PROTOTYPE( u16_t pci_attr_r16, (int devind, int port) );
|
---|
| 28 | _PROTOTYPE( u32_t pci_attr_r32, (int devind, int port) );
|
---|
| 29 | _PROTOTYPE( void pci_attr_w16, (int devind, int port, U16_t value) );
|
---|
| 30 | _PROTOTYPE( void pci_attr_w32, (int devind, int port, u32_t value) );
|
---|
| 31 |
|
---|
| 32 | #define PCI_VID 0x00 /* Vendor ID, 16-bit */
|
---|
| 33 | #define PCI_DID 0x02 /* Device ID, 16-bit */
|
---|
| 34 | #define PCI_CR 0x04 /* Command Register, 16-bit */
|
---|
| 35 | #define PCI_PCISTS 0x06 /* PCI status, 16-bit */
|
---|
| 36 | #define PSR_SSE 0x4000 /* Signaled System Error */
|
---|
| 37 | #define PSR_RMAS 0x2000 /* Received Master Abort Status */
|
---|
| 38 | #define PSR_RTAS 0x1000 /* Received Target Abort Status */
|
---|
| 39 | #define PCI_REV 0x08 /* Revision ID */
|
---|
| 40 | #define PCI_PIFR 0x09 /* Prog. Interface Register */
|
---|
| 41 | #define PCI_SCR 0x0A /* Sub-Class Register */
|
---|
| 42 | #define PCI_BCR 0x0B /* Base-Class Register */
|
---|
| 43 | #define PCI_HEADT 0x0E /* Header type, 8-bit */
|
---|
| 44 | #define PHT_MULTIFUNC 0x80 /* Multiple functions */
|
---|
| 45 | #define PCI_BAR 0x10 /* Base Address Register */
|
---|
| 46 | #define PCI_BAR_2 0x14 /* Base Address Register */
|
---|
| 47 | #define PCI_BAR_3 0x18 /* Base Address Register */
|
---|
| 48 | #define PCI_BAR_4 0x1C /* Base Address Register */
|
---|
| 49 | #define PCI_ILR 0x3C /* Interrupt Line Register */
|
---|
| 50 | #define PCI_IPR 0x3D /* Interrupt Pin Register */
|
---|
| 51 |
|
---|
| 52 | /* Device type values as ([PCI_BCR] << 16) | ([PCI_SCR] << 8) | [PCI_PIFR] */
|
---|
| 53 | #define PCI_T3_PCI2PCI 0x060400 /* PCI-to-PCI Bridge device */
|
---|
| 54 | #define PCI_T3_PCI2PCI_SUBTR 0x060401 /* Subtr. PCI-to-PCI Bridge */
|
---|
| 55 |
|
---|
| 56 | /* PCI bridge devices (AGP) */
|
---|
| 57 | #define PPB_SBUSN 0x19 /* Secondary Bus Number */
|
---|
| 58 |
|
---|
| 59 | /* Intel compatible PCI bridge devices (AGP) */
|
---|
| 60 | #define PPB_SSTS 0x1E /* Secondary PCI-to-PCI Status Register */
|
---|
| 61 |
|
---|
| 62 | #define NO_VID 0xffff /* No PCI card present */
|
---|
| 63 |
|
---|
| 64 | struct pci_vendor
|
---|
| 65 | {
|
---|
| 66 | u16_t vid;
|
---|
| 67 | char *name;
|
---|
| 68 | };
|
---|
| 69 |
|
---|
| 70 | struct pci_device
|
---|
| 71 | {
|
---|
| 72 | u16_t vid;
|
---|
| 73 | u16_t did;
|
---|
| 74 | char *name;
|
---|
| 75 | };
|
---|
| 76 |
|
---|
| 77 | struct pci_baseclass
|
---|
| 78 | {
|
---|
| 79 | u8_t baseclass;
|
---|
| 80 | char *name;
|
---|
| 81 | };
|
---|
| 82 |
|
---|
| 83 | struct pci_subclass
|
---|
| 84 | {
|
---|
| 85 | u8_t baseclass;
|
---|
| 86 | u8_t subclass;
|
---|
| 87 | u16_t infclass;
|
---|
| 88 | char *name;
|
---|
| 89 | };
|
---|
| 90 |
|
---|
| 91 | struct pci_intel_ctrl
|
---|
| 92 | {
|
---|
| 93 | u16_t vid;
|
---|
| 94 | u16_t did;
|
---|
| 95 | };
|
---|
| 96 |
|
---|
| 97 | struct pci_isabridge
|
---|
| 98 | {
|
---|
| 99 | u16_t vid;
|
---|
| 100 | u16_t did;
|
---|
| 101 | int checkclass;
|
---|
| 102 | int type;
|
---|
| 103 | };
|
---|
| 104 |
|
---|
| 105 | struct pci_pcibridge
|
---|
| 106 | {
|
---|
| 107 | u16_t vid;
|
---|
| 108 | u16_t did;
|
---|
| 109 | int type;
|
---|
| 110 | };
|
---|
| 111 |
|
---|
| 112 | #define PCI_IB_PIIX 1 /* Intel PIIX compatible ISA bridge */
|
---|
| 113 | #define PCI_IB_VIA 2 /* VIA compatible ISA bridge */
|
---|
| 114 | #define PCI_IB_AMD 3 /* AMD compatible ISA bridge */
|
---|
| 115 | #define PCI_IB_SIS 4 /* SIS compatible ISA bridge */
|
---|
| 116 |
|
---|
| 117 | #define PCI_PCIB_INTEL 1 /* Intel compatible PCI bridge */
|
---|
| 118 | #define PCI_AGPB_INTEL 2 /* Intel compatible AGP bridge */
|
---|
| 119 | #define PCI_AGPB_VIA 3 /* VIA compatible AGP bridge */
|
---|
| 120 |
|
---|
| 121 | extern struct pci_vendor pci_vendor_table[];
|
---|
| 122 | extern struct pci_device pci_device_table[];
|
---|
| 123 | extern struct pci_baseclass pci_baseclass_table[];
|
---|
| 124 | extern struct pci_subclass pci_subclass_table[];
|
---|
| 125 | extern struct pci_intel_ctrl pci_intel_ctrl[];
|
---|
| 126 | extern struct pci_isabridge pci_isabridge[];
|
---|
| 127 | extern struct pci_pcibridge pci_pcibridge[];
|
---|
| 128 |
|
---|
| 129 | /*
|
---|
| 130 | * $PchId: pci.h,v 1.4 2001/12/06 20:21:22 philip Exp $
|
---|
| 131 | */
|
---|