Hi,
thanks to Mark, we have enough PCI bus number accounting, now to allow us
to attach ACPI bus numbers via ACPI. A patch to do this is below.
regards Christian
Index: arch/i386/i386/mainbus.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/mainbus.c,v
retrieving revision 1.49
diff -u -r1.49 mainbus.c
--- arch/i386/i386/mainbus.c 19 Sep 2012 23:03:12 -0000 1.49
+++ arch/i386/i386/mainbus.c 21 Sep 2012 11:36:59 -0000
@@ -245,6 +245,9 @@
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
Index: dev/acpi/acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.239
diff -u -r1.239 acpi.c
--- dev/acpi/acpi.c 7 Sep 2012 19:19:59 -0000 1.239
+++ dev/acpi/acpi.c 21 Sep 2012 11:37:01 -0000
@@ -394,6 +394,8 @@
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 @@
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;
@@ -600,6 +603,25 @@
}
return PCI_PMCSR_STATE_D3;
+}
+
+void
+acpi_pciroots_attach(struct device *dev, void *aux, cfprint_t pr)
+{
+ struct acpi_pci *pdev;
+ struct pcibus_attach_args *pba = aux;
+
+ if (pba->pba_busex == NULL) {
+ printf("cannot attach ACPI discovered busses\n");
+ return;
+ }
+ 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
Index: dev/acpi/acpivar.h
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpivar.h,v
retrieving revision 1.72
diff -u -r1.72 acpivar.h
--- dev/acpi/acpivar.h 7 Sep 2012 19:19:59 -0000 1.72
+++ dev/acpi/acpivar.h 21 Sep 2012 11:37:01 -0000
@@ -323,6 +323,8 @@
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 */