Indentation fix, cleanup.
[AROS.git] / arch / all-pc / hidds / pcipc / pci.h
blobbcab26c2225aab96d6387174f5e266a27a4d04f3
1 #ifndef _PCI_H
2 #define _PCI_H
4 #include <exec/types.h>
5 #include <exec/libraries.h>
6 #include <exec/execbase.h>
7 #include <exec/nodes.h>
8 #include <exec/lists.h>
10 #include <dos/bptr.h>
12 #include <oop/oop.h>
14 #include <aros/arossupportbase.h>
15 #include <exec/execbase.h>
17 #include <libraries/acpica.h>
19 #include LC_LIBDEFS_FILE
21 #ifdef __i386__
23 * On i386 we can support very old Pentium-1 motherboards with PCI
24 * configuration mechanism 2.
25 * x86-64 is much more legacy-free...
27 #define LEGACY_SUPPORT
28 #endif
30 struct pci_staticdata
32 OOP_AttrBase hiddPCIDriverAB;
33 OOP_AttrBase hiddAB;
35 OOP_AttrBase hidd_PCIDeviceAB;
37 OOP_Class *driverClass;
39 /* Low-level sub-methods */
40 ULONG (*ReadConfigLong)(UBYTE bus, UBYTE dev, UBYTE sub, UWORD reg);
41 void (*WriteConfigLong)(UBYTE bus, UBYTE dev, UBYTE sub, UWORD reg, ULONG val);
43 ACPI_TABLE_MCFG *mcfg_tbl;
47 struct pcibase
49 struct Library LibNode;
50 struct pci_staticdata psd;
53 /* PCI configuration mechanism 1 registers */
54 #define PCI_AddressPort 0x0cf8
55 #define PCI_DataPort 0x0cfc
58 * PCI configuration mechanism 2 registers
59 * This mechanism is obsolete long ago. But AROS runs on old hardware,
60 * and we support this.
62 #define PCI_CSEPort 0x0cf8
63 #define PCI_ForwardPort 0x0cfa
66 * PCI configuration mechanism selector register.
67 * Supported by some transition-time chipsets, like Intel Neptune.
69 #define PCI_MechSelect 0x0cfb
71 #define PCICS_VENDOR 0x00
72 #define PCICS_PRODUCT 0x02
73 #define PCICS_SUBCLASS 0x0a
75 #define PCI_CLASS_BRIDGE_HOST 0x0600
76 #define PCI_CLASS_DISPLAY_VGA 0x0300
78 #define PCI_VENDOR_INTEL 0x8086
79 #define PCI_VENDOR_COMPAQ 0x0e11
81 #define BASE(lib) ((struct pcibase*)(lib))
83 #define PSD(cl) (&((struct pcibase*)cl->UserData)->psd)
85 typedef union _pcicfg
87 ULONG ul;
88 UWORD uw[2];
89 UBYTE ub[4];
90 } pcicfg;
92 static inline UWORD ReadConfigWord(struct pci_staticdata *psd, UBYTE bus, UBYTE dev, UBYTE sub, UWORD reg)
94 pcicfg temp;
96 temp.ul = psd->ReadConfigLong(bus, dev, sub, reg);
97 return temp.uw[(reg&2)>>1];
100 ULONG ReadConfig1Long(UBYTE bus, UBYTE dev, UBYTE sub, UWORD reg);
101 void WriteConfig1Long(UBYTE bus, UBYTE dev, UBYTE sub, UWORD reg, ULONG val);
103 #ifdef LEGACY_SUPPORT
105 void ProbePCI(struct pci_staticdata *psd);
107 #else
109 #define ProbePCI(x)
111 #endif
113 #endif /* _PCI_H */