summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/acpica_osd.h
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2000-08-31 11:16:42 +0000
committeriwasaki <iwasaki@FreeBSD.org>2000-08-31 11:16:42 +0000
commit7f8b311e6aed4778d98c795a6667694494e8df47 (patch)
tree8b4146729e7f8ff2e7f8ed631471443ceb8b70e2 /sys/i386/include/acpica_osd.h
parente6fd189e34948ac9c5cb54d8b3d73331464e8fa4 (diff)
downloadFreeBSD-src-7f8b311e6aed4778d98c795a6667694494e8df47.zip
FreeBSD-src-7f8b311e6aed4778d98c795a6667694494e8df47.tar.gz
Modified PCI config space access code via pcib_if rather than using
pci_cfg{read|write}. - Obtain device_t pcib instance by calling device_find_child(). - Call PCIB_{READ|WRITE}_CONFIG() to access to pcib interfaces. Reviewed by: dfr, takawata
Diffstat (limited to 'sys/i386/include/acpica_osd.h')
-rw-r--r--sys/i386/include/acpica_osd.h63
1 files changed, 36 insertions, 27 deletions
diff --git a/sys/i386/include/acpica_osd.h b/sys/i386/include/acpica_osd.h
index acc67af..ee05c15 100644
--- a/sys/i386/include/acpica_osd.h
+++ b/sys/i386/include/acpica_osd.h
@@ -30,12 +30,14 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/vmparam.h>
#include <sys/acpi.h>
#include <vm/vm.h>
#include <vm/pmap.h>
-#include <pci/pcivar.h>
+
+#include "pcib_if.h"
#define ACPI_BUS_SPACE_IO I386_BUS_SPACE_IO
@@ -47,6 +49,27 @@ static UINT32 OsdInX(ACPI_IO_ADDRESS, int);
static void OsdOutX(ACPI_IO_ADDRESS, UINT32, int);
/*
+ * New-bus dependent code
+ */
+
+static device_t get_pcib_device(void);
+
+static __inline device_t
+get_pcib_device()
+{
+ device_t nexus, pcib;
+
+ if ((nexus = device_find_child(root_bus, "nexus", 0)) == NULL) {
+ return (NULL);
+ }
+ if ((pcib = device_find_child(nexus, "pcib", 0)) == NULL) {
+ return (NULL);
+ }
+
+ return (pcib);
+}
+
+/*
* Platform/Hardware independent I/O interfaces
*/
@@ -200,21 +223,14 @@ OsdUnMapMemory(void *LogicalAddress, UINT32 Length)
static __inline ACPI_STATUS
OsdReadPciCfg(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 *Value, int bytes)
{
- pcicfgregs pcicfg;
+ static device_t pcib = NULL;
- /*
- * XXX Hack for Alpha(tsunami) systems.
- * pcicfg.hose is set to -1 in the hope that,
- * tsunami_cfgreadX() will set it up right.
- * Other Alpha systems (and i386's) don't seem to use hose.
- */
- pcicfg.hose = -1;
-
- pcicfg.bus = Bus;
- pcicfg.slot = (DeviceFunction >> 16) & 0xff;
- pcicfg.func = DeviceFunction & 0xff;
+ if (pcib == NULL && (pcib = get_pcib_device()) == NULL) {
+ return (AE_ERROR);
+ }
- *Value = pci_cfgread(&pcicfg, Register, bytes);
+ *Value = PCIB_READ_CONFIG(pcib, Bus, (DeviceFunction >> 16) & 0xff,
+ DeviceFunction & 0xff, Register, bytes);
return (AE_OK);
}
@@ -264,21 +280,14 @@ OsdReadPciCfgDword(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 *V
static __inline ACPI_STATUS
OsdWritePciCfg(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 Value, int bytes)
{
- pcicfgregs pcicfg;
+ static device_t pcib = NULL;
- /*
- * XXX Hack for Alpha(tsunami) systems.
- * pcicfg.hose is set to -1 in the hope that,
- * tsunami_cfgreadX() will set it up right.
- * Other Alpha systems (and i386's) don't seem to use hose.
- */
- pcicfg.hose = -1;
-
- pcicfg.bus = Bus;
- pcicfg.slot = (DeviceFunction >> 16) & 0xff;
- pcicfg.func = DeviceFunction & 0xff;
+ if (pcib == NULL && (pcib = get_pcib_device()) == NULL) {
+ return (AE_ERROR);
+ }
- pci_cfgwrite(&pcicfg, Register, Value, bytes);
+ PCIB_WRITE_CONFIG(pcib, Bus, (DeviceFunction >> 16) & 0xff,
+ DeviceFunction & 0xff, Register, Value, bytes);
return (AE_OK);
}
OpenPOWER on IntegriCloud