Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi/acpica The new acpi code tries to read the pci ...



details:   https://anonhg.NetBSD.org/src/rev/afadf9c9674f
branches:  trunk
changeset: 343263:afadf9c9674f
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 26 22:52:14 2016 +0000

description:
The new acpi code tries to read the pci configuration registers in the
acpi_probe() phase, before acpi_softc is allocated. Detect this and use
a NULL chipset handle instead of crashing.

diffstat:

 sys/dev/acpi/acpica/OsdHardware.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (72 lines):

diff -r 00c73381c597 -r afadf9c9674f sys/dev/acpi/acpica/OsdHardware.c
--- a/sys/dev/acpi/acpica/OsdHardware.c Tue Jan 26 21:19:20 2016 +0000
+++ b/sys/dev/acpi/acpica/OsdHardware.c Tue Jan 26 22:52:14 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: OsdHardware.c,v 1.9 2013/12/27 18:53:25 christos Exp $ */
+/*     $NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $        */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.9 2013/12/27 18:53:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -212,15 +212,15 @@
 {
        pcitag_t tag;
        pcireg_t tmp;
+       pci_chipset_tag_t pc = acpi_softc ? acpi_softc->sc_pc : NULL;
 
        /* XXX Need to deal with "segment" ("hose" in Alpha terminology). */
 
        if (PciId->Bus >= 256 || PciId->Device >= 32 || PciId->Function >= 8)
                return AE_BAD_PARAMETER;
 
-       tag = pci_make_tag(acpi_softc->sc_pc, PciId->Bus, PciId->Device,
-           PciId->Function);
-       tmp = pci_conf_read(acpi_softc->sc_pc, tag, Register & ~3);
+       tag = pci_make_tag(pc, PciId->Bus, PciId->Device, PciId->Function);
+       tmp = pci_conf_read(pc, tag, Register & ~3);
 
        switch (Width) {
        case 8:
@@ -253,21 +253,21 @@
 {
        pcitag_t tag;
        pcireg_t tmp;
+       pci_chipset_tag_t pc = acpi_softc ? acpi_softc->sc_pc : NULL;
 
        /* XXX Need to deal with "segment" ("hose" in Alpha terminology). */
 
-       tag = pci_make_tag(acpi_softc->sc_pc, PciId->Bus, PciId->Device,
-           PciId->Function);
+       tag = pci_make_tag(pc, PciId->Bus, PciId->Device, PciId->Function);
 
        switch (Width) {
        case 8:
-               tmp = pci_conf_read(acpi_softc->sc_pc, tag, Register & ~3);
+               tmp = pci_conf_read(pc, tag, Register & ~3);
                tmp &= ~(0xff << ((Register & 3) * 8));
                tmp |= (Value << ((Register & 3) * 8));
                break;
 
        case 16:
-               tmp = pci_conf_read(acpi_softc->sc_pc, tag, Register & ~3);
+               tmp = pci_conf_read(pc, tag, Register & ~3);
                tmp &= ~(0xffff << ((Register & 3) * 8));
                tmp |= (Value << ((Register & 3) * 8));
                break;
@@ -280,7 +280,7 @@
                return AE_BAD_PARAMETER;
        }
 
-       pci_conf_write(acpi_softc->sc_pc, tag, Register & ~3, tmp);
+       pci_conf_write(pc, tag, Register & ~3, tmp);
 
        return AE_OK;
 }



Home | Main Index | Thread Index | Old Index