2 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
9 #include <exec/types.h>
10 #include <exec/libraries.h>
11 #include <exec/execbase.h>
12 #include <exec/nodes.h>
13 #include <exec/lists.h>
19 #include <aros/arossupportbase.h>
20 #include <exec/execbase.h>
22 #include <libraries/acpica.h>
24 #include LC_LIBDEFS_FILE
28 * On i386 we can support very old Pentium-1 motherboards with PCI
29 * configuration mechanism 2.
30 * x86-64 is much more legacy-free...
32 #define LEGACY_SUPPORT
36 struct pcipc_staticdata
38 OOP_AttrBase hiddPCIDriverAB
;
41 OOP_AttrBase hidd_PCIDeviceAB
;
43 OOP_Class
*driverClass
;
45 /* Low-level sub-methods */
46 ULONG (*ReadConfigLong
)(UBYTE bus
, UBYTE dev
, UBYTE sub
, UWORD reg
);
47 void (*WriteConfigLong
)(UBYTE bus
, UBYTE dev
, UBYTE sub
, UWORD reg
, ULONG val
);
50 ACPI_TABLE_MCFG
*pcipc_acpiMcfgTbl
;
51 struct MinList pcipc_irqRoutingTable
;
56 struct Library LibNode
;
57 struct pcipc_staticdata psd
;
60 #define BASE(lib) ((struct pcibase*)(lib))
61 #define PSD(cl) (&((struct pcibase*)cl->UserData)->psd)
64 /* PCI configuration mechanism 1 registers */
65 #define PCI_AddressPort 0x0cf8
66 #define PCI_DataPort 0x0cfc
69 * PCI configuration mechanism 2 registers
70 * This mechanism is obsolete long ago. But AROS runs on old hardware,
71 * and we support this.
73 #define PCI_CSEPort 0x0cf8
74 #define PCI_ForwardPort 0x0cfa
77 * PCI configuration mechanism selector register.
78 * Supported by some transition-time chipsets, like Intel Neptune.
80 #define PCI_MechSelect 0x0cfb
82 #define PCICS_PRODUCT 0x02
84 #define PCIBR_SUBCLASS 0x0a
85 #define PCIBR_SECBUS 0x19
95 static inline UWORD
ReadConfigWord(struct pcipc_staticdata
*psd
, UBYTE bus
,
96 UBYTE dev
, UBYTE sub
, UWORD reg
)
100 temp
.ul
= psd
->ReadConfigLong(bus
, dev
, sub
, reg
);
101 return temp
.uw
[(reg
&2)>>1];
104 static inline UWORD
ReadConfigByte(struct pcipc_staticdata
*psd
, UBYTE bus
,
105 UBYTE dev
, UBYTE sub
, UWORD reg
)
109 temp
.ul
= psd
->ReadConfigLong(bus
, dev
, sub
, reg
);
110 return temp
.ub
[reg
& 3];
113 ULONG
ReadConfig1Long(UBYTE bus
, UBYTE dev
, UBYTE sub
, UWORD reg
);
114 void WriteConfig1Long(UBYTE bus
, UBYTE dev
, UBYTE sub
, UWORD reg
, ULONG val
);
116 #ifdef LEGACY_SUPPORT
118 void PCIPC_ProbeConfMech(struct pcipc_staticdata
*psd
);
122 #define PCIPC_ProbeConfMech(x)