1) Skip over bogus device nodes, prevents a panic in pci_make_tag.

2) Clarify a printf.
This commit is contained in:
skd 2004-04-22 18:01:47 +00:00
parent cb0651e44a
commit 3d1c65c141
1 changed files with 56 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpacpi.c,v 1.20 2004/04/10 14:17:21 kochi Exp $ */
/* $NetBSD: mpacpi.c,v 1.21 2004/04/22 18:01:47 skd Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.20 2004/04/10 14:17:21 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.21 2004/04/22 18:01:47 skd Exp $");
#include "opt_acpi.h"
#include "opt_mpbios.h"
@ -434,6 +434,7 @@ mpacpi_pcihier_cb(ACPI_HANDLE handle, UINT32 level, void *ct, void **status)
struct mpacpi_pcibus *mpr, *mparent;
struct mpacpi_walk_status *mpw = ct;
int bus;
int maxdev;
mparent = mpw->mpw_mpr;
acpi = mpw->mpw_acpi;
@ -442,6 +443,58 @@ mpacpi_pcihier_cb(ACPI_HANDLE handle, UINT32 level, void *ct, void **status)
if (ACPI_FAILURE(ret))
return AE_OK;
#if !defined(PCI_CONF_MODE)
maxdev = ( pci_mode == 1 ) ? 32 : 16;
#elif (PCI_CONF_MODE == 1)
maxdev = 32;
#elif (PCI_CONF_MODE == 2)
maxdev = 16;
#endif
if ( mparent->mpr_bus >= 256 || ACPI_HIWORD(val) >= maxdev
|| ACPI_LOWORD(val) >= 8 ) {
if (mp_verbose) {
ACPI_BUFFER Buffer;
ACPI_DEVICE_INFO *Info;
ACPI_STATUS Status;
ACPI_NATIVE_UINT i;
printf("mpacpi: bad device found at bus %x dev %x, function %x\n",
mparent->mpr_bus,
ACPI_HIWORD(val),
ACPI_LOWORD(val));
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiGetObjectInfo (handle, &Buffer);
if (ACPI_SUCCESS (Status))
{
Info = Buffer.Pointer;
AcpiOsPrintf ("HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
Info->HardwareId.Value,
ACPI_FORMAT_UINT64 (Info->Address),
Info->CurrentStatus);
if (Info->Valid & ACPI_VALID_CID)
{
for (i = 0; i < Info->CompatibilityId.Count; i++)
{
AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i, Info->CompatibilityId.Id[i].Value);
}
}
ACPI_MEM_FREE (Info);
}
else
{
AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
}
}
return AE_OK;
}
tag = pci_make_tag(acpi->sc_pc, mparent->mpr_bus,
ACPI_HIWORD(val), ACPI_LOWORD(val));
class = pci_conf_read(acpi->sc_pc, tag, PCI_CLASS_REG);
@ -744,7 +797,7 @@ mpacpi_print_intr(struct mp_intr_map *mpi)
}
}
printf("%s: int%d attached to %s",
printf("%s: pin %d attached to %s",
sc ? sc->sc_pic.pic_dev.dv_xname : "local apic",
pin, busname);