summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorChristian Ehrhardt <ehrhardt@cvs.openbsd.org>2012-10-04 08:32:21 +0000
committerChristian Ehrhardt <ehrhardt@cvs.openbsd.org>2012-10-04 08:32:21 +0000
commitd525c72d29f74e6fd969b94ba05eb9e61117bf42 (patch)
treef8c1a3ca3f260146f7b30f303c9126a5c130e395 /sys
parent02f35d5431bb0a3b460c7ea9538769c94699f136 (diff)
Use information provided by ACPI to attach secondary PCI host bridges.
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/mainbus.c5
-rw-r--r--sys/arch/i386/i386/mainbus.c5
-rw-r--r--sys/dev/acpi/acpi.c22
-rw-r--r--sys/dev/acpi/acpivar.h4
4 files changed, 32 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c
index 064ef2cf7aa..19e58621307 100644
--- a/sys/arch/amd64/amd64/mainbus.c
+++ b/sys/arch/amd64/amd64/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.25 2012/09/19 23:23:50 kettenis Exp $ */
+/* $OpenBSD: mainbus.c,v 1.26 2012/10/04 08:32:20 ehrhardt Exp $ */
/* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */
/*
@@ -218,6 +218,9 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
mba.mba_pba.pba_domain = pci_ndomains++;
mba.mba_pba.pba_bus = 0;
config_found(self, &mba.mba_pba, mainbus_print);
+#if NACPI > 0
+ acpi_pciroots_attach(self, &mba.mba_pba, mainbus_print);
+#endif
}
#endif
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index a0a5d0579c7..1af1664aa48 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.49 2012/09/19 23:03:12 kettenis Exp $ */
+/* $OpenBSD: mainbus.c,v 1.50 2012/10/04 08:32:20 ehrhardt Exp $ */
/* $NetBSD: mainbus.c,v 1.21 1997/06/06 23:14:20 thorpej Exp $ */
/*
@@ -245,6 +245,9 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
mba.mba_pba.pba_domain = pci_ndomains++;
mba.mba_pba.pba_bus = 0;
config_found(self, &mba.mba_pba, mainbus_print);
+#if NACPI > 0
+ acpi_pciroots_attach(self, &mba.mba_pba, mainbus_print);
+#endif
}
#endif
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 439680e4e8c..b3468d22cb6 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.239 2012/09/07 19:19:59 kettenis Exp $ */
+/* $OpenBSD: acpi.c,v 1.240 2012/10/04 08:32:20 ehrhardt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -394,6 +394,8 @@ acpi_match(struct device *parent, void *match, void *aux)
TAILQ_HEAD(, acpi_pci) acpi_pcidevs =
TAILQ_HEAD_INITIALIZER(acpi_pcidevs);
+TAILQ_HEAD(, acpi_pci) acpi_pcirootdevs =
+ TAILQ_HEAD_INITIALIZER(acpi_pcirootdevs);
int acpi_getpci(struct aml_node *node, void *arg);
int acpi_getminbus(union acpi_resource *crs, void *arg);
@@ -482,6 +484,7 @@ acpi_getpci(struct aml_node *node, void *arg)
node->pci = pci;
dnprintf(10, "found PCI root: %s %d\n",
aml_nodename(node), pci->bus);
+ TAILQ_INSERT_TAIL(&acpi_pcirootdevs, pci, next);
}
aml_freevalue(&res);
return 0;
@@ -603,6 +606,23 @@ acpi_pci_min_powerstate(pci_chipset_tag_t pc, pcitag_t tag)
}
void
+acpi_pciroots_attach(struct device *dev, void *aux, cfprint_t pr)
+{
+ struct acpi_pci *pdev;
+ struct pcibus_attach_args *pba = aux;
+
+ KASSERT(pba->pba_busex != NULL);
+
+ TAILQ_FOREACH(pdev, &acpi_pcirootdevs, next) {
+ if (extent_alloc_region(pba->pba_busex, pdev->bus,
+ 1, EX_NOWAIT) != 0)
+ continue;
+ pba->pba_bus = pdev->bus;
+ config_found(dev, pba, pr);
+ }
+}
+
+void
acpi_attach(struct device *parent, struct device *self, void *aux)
{
struct bios_attach_args *ba = aux;
diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h
index 91e22054181..b791df6092a 100644
--- a/sys/dev/acpi/acpivar.h
+++ b/sys/dev/acpi/acpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivar.h,v 1.72 2012/09/07 19:19:59 kettenis Exp $ */
+/* $OpenBSD: acpivar.h,v 1.73 2012/10/04 08:32:20 ehrhardt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -323,6 +323,8 @@ int acpi_dotask(struct acpi_softc *);
void acpi_powerdown_task(void *, int);
void acpi_sleep_task(void *, int);
+void acpi_pciroots_attach(struct device *, void *, cfprint_t);
+
#endif
#endif /* !_ACPI_WAKECODE */