* Add aux argument to functions called from apic_madt_walk

* Improve acpi interrupt fixup a bit
	* Source is an array, don't compare it to NULL, instead
	  look for an empty string to denote a link-device-less
	  entry.
	* For root PCI busses, try to use the _BBN method to get
	  numbering right.
* Add acpi_md_callback() function for MD handling after the init,
  but before * at acpi probing.
This commit is contained in:
fvdl 2003-01-07 18:46:48 +00:00
parent 8db111aeb4
commit 9352d5f785
3 changed files with 38 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi.c,v 1.27 2003/01/05 22:33:21 christos Exp $ */
/* $NetBSD: acpi.c,v 1.28 2003/01/07 18:46:48 fvdl Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.27 2003/01/05 22:33:21 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.28 2003/01/07 18:46:48 fvdl Exp $");
#include "opt_acpi.h"
@ -303,6 +303,7 @@ acpi_attach(struct device *parent, struct device *self, void *aux)
if (acpi_dbgr & ACPI_DBGR_PROBE)
acpi_osd_debugger();
#endif
acpi_md_callback((struct device *)sc);
acpi_build_tree(sc);
/*
@ -1041,21 +1042,44 @@ acpi_pci_fixup_bus(ACPI_HANDLE handle, UINT32 level, void *context,
ACPI_PCI_ROUTING_TABLE *PrtElement;
ACPI_HANDLE link;
uint line;
ACPI_NAMESPACE_NODE *node;
ACPI_INTEGER val;
rv = acpi_get(handle, &buf, AcpiGetIrqRoutingTable);
if (ACPI_FAILURE(rv))
return (AE_OK);
/*
* If at level 1, this is a PCI root bus. Try the _BBN method
* to get the right PCI bus numbering for the following
* busses (this is a depth-first walk). It may fail,
* for example if there's only one root bus, but that
* case should be ok, so we'll ignore that.
*/
if (level == 1) {
node = AcpiNsMapHandleToNode(handle);
rv = AcpiUtEvaluateNumericObject(METHOD_NAME__BBN, node, &val);
if (!ACPI_FAILURE(rv)) {
#ifdef ACPI_DEBUG
printf("%s: fixing up PCI bus %d\n", sc->sc_dev.dv_xname,
sc->sc_pci_bus);
printf("%s: fixup: _BBN success, bus # was %d now %d\n",
sc->sc_dev.dv_xname, sc->sc_pci_bus,
ACPI_LOWORD(val));
#endif
sc->sc_pci_bus = ACPI_LOWORD(val);
}
}
#ifdef ACPI_DEBUG
printf("%s: fixing up PCI bus %d at level %u\n", sc->sc_dev.dv_xname,
sc->sc_pci_bus, level);
#endif
for (Buffer = buf.Pointer; ; Buffer += PrtElement->Length) {
PrtElement = (ACPI_PCI_ROUTING_TABLE *)Buffer;
if (PrtElement->Length == 0)
break;
if (PrtElement->Source == NULL)
if (PrtElement->Source[0] == 0)
continue;
link = acpi_get_node(PrtElement->Source);

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_madt.c,v 1.1 2003/01/05 01:03:44 fvdl Exp $ */
/* $NetBSD: acpi_madt.c,v 1.2 2003/01/07 18:46:49 fvdl Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -50,11 +50,11 @@
#include <dev/acpi/acpica/Subsystem/acnamesp.h>
#include <dev/acpi/acpi_madt.h>
/* #define ACPI_MADT_DEBUG */
#undef ACPI_MADT_DEBUG
#ifdef ACPI_MADT_DEBUG
static void acpi_madt_print(void);
static ACPI_STATUS acpi_madt_print_entry(APIC_HEADER *);
static ACPI_STATUS acpi_madt_print_entry(APIC_HEADER *, void *);
static void acpi_print_apic_proc(PROCESSOR_APIC *);
static void acpi_print_ioapic(IO_APIC *);
static void acpi_print_intsrc_ovr(INT_SOURCE_OVERRIDE *);
@ -180,7 +180,7 @@ acpi_print_platint(INT_PLATFORM *p)
#endif
void
acpi_madt_walk(ACPI_STATUS (*func)(APIC_HEADER *))
acpi_madt_walk(ACPI_STATUS (*func)(APIC_HEADER *, void *), void *aux)
{
char *madtend, *where;
APIC_HEADER *hdrp;
@ -191,7 +191,7 @@ acpi_madt_walk(ACPI_STATUS (*func)(APIC_HEADER *))
where = (char *)AcpiGbl_MADT + sizeof (APIC_TABLE);
while (where < madtend) {
hdrp = (APIC_HEADER *)where;
if (func(hdrp) != AE_OK)
if (func(hdrp, aux) != AE_OK)
break;
where += hdrp->Length;
}
@ -210,11 +210,11 @@ acpi_madt_print(void)
ap->PCATCompat ? "" : " not");
printf("entries:\n");
acpi_madt_walk(acpi_madt_print_entry);
acpi_madt_walk(acpi_madt_print_entry, NULL);
}
static ACPI_STATUS
acpi_madt_print_entry(APIC_HEADER *hdrp)
acpi_madt_print_entry(APIC_HEADER *hdrp, void *aux)
{
switch (hdrp->Type) {
case APIC_PROC:

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_madt.h,v 1.1 2003/01/05 01:03:44 fvdl Exp $ */
/* $NetBSD: acpi_madt.h,v 1.2 2003/01/07 18:46:49 fvdl Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -152,4 +152,4 @@ extern ACPI_TABLE_HEADER *AcpiGbl_MADT;
ACPI_STATUS acpi_madt_map(void);
void acpi_madt_unmap(void);
void acpi_madt_walk(ACPI_STATUS (*)(APIC_HEADER *));
void acpi_madt_walk(ACPI_STATUS (*)(APIC_HEADER *, void *), void *);