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>
14 #include <aros/arossupportbase.h>
15 #include <exec/execbase.h>
17 #include <libraries/acpica.h>
19 #include LC_LIBDEFS_FILE
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
30 struct pcipc_staticdata
32 OOP_AttrBase hiddPCIDriverAB
;
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
);
44 struct Library
*pcipc_acpiBase
;
45 ACPI_TABLE_MCFG
*pcipc_acpiMcfgTbl
;
51 struct Library LibNode
;
52 struct pcipc_staticdata psd
;
55 #define BASE(lib) ((struct pcibase*)(lib))
56 #define PSD(cl) (&((struct pcibase*)cl->UserData)->psd)
60 #define ACPICABase (_psd->pcipc_acpiBase)
62 /* PCI configuration mechanism 1 registers */
63 #define PCI_AddressPort 0x0cf8
64 #define PCI_DataPort 0x0cfc
67 * PCI configuration mechanism 2 registers
68 * This mechanism is obsolete long ago. But AROS runs on old hardware,
69 * and we support this.
71 #define PCI_CSEPort 0x0cf8
72 #define PCI_ForwardPort 0x0cfa
75 * PCI configuration mechanism selector register.
76 * Supported by some transition-time chipsets, like Intel Neptune.
78 #define PCI_MechSelect 0x0cfb
80 #define PCICS_VENDOR 0x00
81 #define PCICS_PRODUCT 0x02
82 #define PCICS_SUBCLASS 0x0a
84 #define PCI_CLASS_BRIDGE_HOST 0x0600
85 #define PCI_CLASS_DISPLAY_VGA 0x0300
87 #define PCI_VENDOR_INTEL 0x8086
88 #define PCI_VENDOR_COMPAQ 0x0e11
98 static inline UWORD
ReadConfigWord(struct pcipc_staticdata
*psd
, UBYTE bus
, UBYTE dev
, UBYTE sub
, UWORD reg
)
102 temp
.ul
= psd
->ReadConfigLong(bus
, dev
, sub
, reg
);
103 return temp
.uw
[(reg
&2)>>1];
106 ULONG
ReadConfig1Long(UBYTE bus
, UBYTE dev
, UBYTE sub
, UWORD reg
);
107 void WriteConfig1Long(UBYTE bus
, UBYTE dev
, UBYTE sub
, UWORD reg
, ULONG val
);
109 #ifdef LEGACY_SUPPORT
111 void PCIPC_ProbeConfMech(struct pcipc_staticdata
*psd
);
115 #define PCIPC_ProbeConfMech(x)