Source-Changes-HG archive

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

[src/netbsd-6]: src/sys Pull up following revision(s) (requested by chs in ti...



details:   https://anonhg.NetBSD.org/src/rev/6156ae328bdd
branches:  netbsd-6
changeset: 775483:6156ae328bdd
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Nov 22 00:39:00 2012 +0000

description:
Pull up following revision(s) (requested by chs in ticket #683):
        sys/arch/ia64/include/acpi_machdep.h: revision 1.6
        sys/arch/x86/include/acpi_machdep.h: revision 1.11
        sys/dev/acpi/acpi.c: revision 1.255
        sys/arch/x86/acpi/acpi_machdep.c: revision 1.4
        sys/arch/x86/x86/mpacpi.c: revision 1.95
        sys/arch/x86/x86/mpacpi.c: revision 1.96
        sys/arch/ia64/acpi/acpi_machdep.c: revision 1.6
locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.
as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have.  the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.

diffstat:

 sys/arch/ia64/acpi/acpi_machdep.c    |    6 +-
 sys/arch/ia64/include/acpi_machdep.h |    5 +-
 sys/arch/x86/acpi/acpi_machdep.c     |    8 +-
 sys/arch/x86/include/acpi_machdep.h  |    5 +-
 sys/arch/x86/x86/mpacpi.c            |  345 +++++++---------------------------
 sys/dev/acpi/acpi.c                  |   41 ++--
 6 files changed, 107 insertions(+), 303 deletions(-)

diffs (truncated from 607 to 300 lines):

diff -r 73237f696c63 -r 6156ae328bdd sys/arch/ia64/acpi/acpi_machdep.c
--- a/sys/arch/ia64/acpi/acpi_machdep.c Thu Nov 22 00:34:25 2012 +0000
+++ b/sys/arch/ia64/acpi/acpi_machdep.c Thu Nov 22 00:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_machdep.c,v 1.5 2011/06/12 11:31:30 jruoho Exp $  */
+/*     $NetBSD: acpi_machdep.c,v 1.5.8.1 2012/11/22 00:39:01 riz Exp $ */
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -28,7 +28,7 @@
  * Machine-dependent routines for ACPICA.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.5 2011/06/12 11:31:30 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.5.8.1 2012/11/22 00:39:01 riz Exp $");
 
 #include <sys/param.h>
 
@@ -189,7 +189,7 @@
 }
 
 void
-acpi_md_callback(void)
+acpi_md_callback(struct acpi_softc *sc)
 {
        /* Nothing. */
 }
diff -r 73237f696c63 -r 6156ae328bdd sys/arch/ia64/include/acpi_machdep.h
--- a/sys/arch/ia64/include/acpi_machdep.h      Thu Nov 22 00:34:25 2012 +0000
+++ b/sys/arch/ia64/include/acpi_machdep.h      Thu Nov 22 00:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_machdep.h,v 1.5 2011/06/12 11:31:30 jruoho Exp $  */
+/*     $NetBSD: acpi_machdep.h,v 1.5.8.1 2012/11/22 00:39:00 riz Exp $ */
 
 ACPI_STATUS            acpi_md_OsInitialize(void);
 ACPI_PHYSICAL_ADDRESS  acpi_md_OsGetRootPointer(void);
@@ -28,4 +28,5 @@
 int            acpi_md_sleep(int);
 uint32_t       acpi_md_pdc(void);
 uint32_t       acpi_md_ncpus(void);
-void           acpi_md_callback(void);
+struct acpi_softc;
+void           acpi_md_callback(struct acpi_softc *);
diff -r 73237f696c63 -r 6156ae328bdd sys/arch/x86/acpi/acpi_machdep.c
--- a/sys/arch/x86/acpi/acpi_machdep.c  Thu Nov 22 00:34:25 2012 +0000
+++ b/sys/arch/x86/acpi/acpi_machdep.c  Thu Nov 22 00:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.3 2012/01/30 21:47:24 rmind Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.3.2.1 2012/11/22 00:39:00 riz Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.3 2012/01/30 21:47:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.3.2.1 2012/11/22 00:39:00 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -283,12 +283,12 @@
 }
 
 void
-acpi_md_callback(void)
+acpi_md_callback(struct acpi_softc *sc)
 {
 #ifdef MPBIOS
        if (!mpbios_scanned)
 #endif
-       mpacpi_find_interrupts(acpi_softc);
+       mpacpi_find_interrupts(sc);
 
 #ifndef XEN
        acpi_md_sleep_init();
diff -r 73237f696c63 -r 6156ae328bdd sys/arch/x86/include/acpi_machdep.h
--- a/sys/arch/x86/include/acpi_machdep.h       Thu Nov 22 00:34:25 2012 +0000
+++ b/sys/arch/x86/include/acpi_machdep.h       Thu Nov 22 00:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_machdep.h,v 1.10 2011/06/12 11:31:31 jruoho Exp $ */
+/*     $NetBSD: acpi_machdep.h,v 1.10.8.1 2012/11/22 00:39:00 riz Exp $        */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -75,6 +75,7 @@
 
 uint32_t       acpi_md_pdc(void);
 uint32_t       acpi_md_ncpus(void);
-void           acpi_md_callback(void);
+struct acpi_softc;
+void           acpi_md_callback(struct acpi_softc *);
 
 #endif /* !_X86_ACPI_MACHDEP_H_ */
diff -r 73237f696c63 -r 6156ae328bdd sys/arch/x86/x86/mpacpi.c
--- a/sys/arch/x86/x86/mpacpi.c Thu Nov 22 00:34:25 2012 +0000
+++ b/sys/arch/x86/x86/mpacpi.c Thu Nov 22 00:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpacpi.c,v 1.92 2011/07/01 18:21:31 dyoung Exp $       */
+/*     $NetBSD: mpacpi.c,v 1.92.8.1 2012/11/22 00:39:00 riz Exp $      */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.92 2011/07/01 18:21:31 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.92.8.1 2012/11/22 00:39:00 riz Exp $");
 
 #include "acpica.h"
 #include "opt_acpi.h"
@@ -91,6 +91,7 @@
        TAILQ_ENTRY(mpacpi_pcibus) mpr_list;
        ACPI_HANDLE mpr_handle;         /* Same thing really, but.. */
        ACPI_BUFFER mpr_buf;            /* preserve _PRT */
+       int mpr_seg;                    /* PCI segment number */
        int mpr_bus;                    /* PCI bus number */
 };
 
@@ -108,10 +109,6 @@
 static ACPI_STATUS mpacpi_nonpci_intr(ACPI_SUBTABLE_HEADER *, void *);
 
 #if NPCI > 0
-/* Callbacks for the ACPI namespace walk */
-static ACPI_STATUS mpacpi_pcibus_cb(ACPI_HANDLE, uint32_t, void *, void **);
-static int mpacpi_derive_bus(ACPI_HANDLE, struct acpi_softc *);
-
 static int mpacpi_pcircount(struct mpacpi_pcibus *);
 static int mpacpi_pciroute(struct mpacpi_pcibus *);
 static int mpacpi_find_pcibusses(struct acpi_softc *);
@@ -484,286 +481,74 @@
 
 #if NPCI > 0
 
-/*
- * Find all PCI busses from ACPI namespace and construct mpacpi_pcibusses list.
- *
- * Note:
- * We cannot find all PCI busses in the system from ACPI namespace.
- * For example, a PCI-to-PCI bridge on an add-on PCI card is not
- * described in the ACPI namespace.
- * We search valid devices which have _PRT (PCI interrupt routing table)
- * method.
- * Such devices are either one of PCI root bridge or PCI-to-PCI bridge.
- */
-static int
-mpacpi_find_pcibusses(struct acpi_softc *acpi)
+static void
+mpacpi_pci_foundbus(struct acpi_devnode *ad)
 {
-       ACPI_HANDLE sbhandle;
-
-       if (AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sbhandle) != AE_OK)
-               return ENOENT;
-       TAILQ_INIT(&mpacpi_pcibusses);
-       AcpiWalkNamespace(ACPI_TYPE_DEVICE, sbhandle, 100,
-           mpacpi_pcibus_cb, NULL, acpi, NULL);
-       return 0;
-}
-
-static const char * const pciroot_hid[] = {
-       "PNP0A03",                      /* PCI root bridge */
-       "PNP0A08",                      /* PCI-X root bridge */
-       NULL
-};
-
-/*
- * mpacpi_get_bbn:
- *
- * Get or guess the Base Bus Number and sanity check it.
- */
-static ACPI_STATUS
-mpacpi_get_bbn(struct acpi_softc *acpi, ACPI_HANDLE handle, int *bus)
-{
-       ACPI_STATUS rv;
-       ACPI_INTEGER val;
-#if NPCHB > 0
-       pcireg_t class, dvid;
-       pcitag_t tag;
-#endif
-
-       rv = acpi_eval_integer(handle, METHOD_NAME__BBN, &val);
-       if (ACPI_SUCCESS(rv))
-               *bus = ACPI_LOWORD(val);
-       else
-               *bus = 0;
-
-       /* If the _BBN is not 0, assume it is valid. */
-       if (*bus != 0)
-               return AE_OK;
-
-       rv = acpi_eval_integer(handle, METHOD_NAME__ADR, &val);
-       if (ACPI_FAILURE(rv) || val == 0xffffffff)
-               return AE_ERROR;
-
-       /* If the _ADR is also 0, assume the _BBN is valid. */
-       if (val == 0)
-               return AE_OK;
-
-#if NPCHB > 0
-       tag = pci_make_tag(acpi->sc_pc, 0,
-           ACPI_HIWORD(val), ACPI_LOWORD(val));
-
-       dvid = pci_conf_read(acpi->sc_pc, tag, PCI_ID_REG);
-       if (PCI_VENDOR(dvid) == PCI_VENDOR_INVALID || PCI_VENDOR(dvid) == 0)
-               return AE_ERROR;
+       struct mpacpi_pcibus *mpr;
+       ACPI_BUFFER buf;
+       int rv;
 
-       /* Check if this is a host bridge device. */
-       class = pci_conf_read(acpi->sc_pc, tag, PCI_CLASS_REG);
-       if (PCI_CLASS(class) != PCI_CLASS_BRIDGE ||
-           PCI_SUBCLASS(class) != PCI_SUBCLASS_BRIDGE_HOST)
-               return AE_ERROR;
-
-       *bus = pchb_get_bus_number(acpi->sc_pc, tag);
-       return *bus != -1 ? AE_OK : AE_ERROR;
-#else
-       return AE_ERROR;
-#endif
-}
-
-/*
- * mpacpi_derive_bus:
- *
- * Derive PCI bus number for the ACPI handle.
- *
- * If a device is not a PCI root bridge, it doesn't have _BBN method
- * and we have no direct method to know the bus number.
- * We have to walk up to search its root bridge and then walk down
- * to resolve the bus number.
- */
-static int
-mpacpi_derive_bus(ACPI_HANDLE handle, struct acpi_softc *acpi)
-{
-       ACPI_HANDLE parent, current;
-       ACPI_STATUS rv;
-       ACPI_INTEGER val;
-       ACPI_DEVICE_INFO *devinfo;
-       struct ac_dev {
-               TAILQ_ENTRY(ac_dev) list;
-               ACPI_HANDLE handle;
-       };
-       TAILQ_HEAD(, ac_dev) dev_list;
-       struct ac_dev *dev;
-       pcireg_t binf, class, dvid;
-       pcitag_t tag;
-       int bus;
+       /*
+        * set mpr_buf from _PRT (if it exists).
+        * set mpr_seg and mpr_bus from previously cached info.
+        */
 
-       TAILQ_INIT(&dev_list);
-
-       /* first, search parent root bus */
-       for (current = handle;; current = parent) {
-               rv = AcpiGetObjectInfo(current, &devinfo);
-               if (ACPI_FAILURE(rv))
-                       goto out;
-
-               /* add this device to the list only if it's active */
-               if ((devinfo->Valid & ACPI_VALID_STA) == 0 ||
-                   (devinfo->CurrentStatus & ACPI_STA_OK) == ACPI_STA_OK) {
-                       ACPI_FREE(devinfo);
-                       dev = kmem_zalloc(sizeof(struct ac_dev), KM_SLEEP);
-                       if (dev == NULL) {
-                               rv = AE_NO_MEMORY;
-                               goto out;
-                       }
-                       dev->handle = current;
-                       TAILQ_INSERT_HEAD(&dev_list, dev, list);
-               } else
-                       ACPI_FREE(devinfo);
-
-               rv = AcpiGetParent(current, &parent);
-               if (ACPI_FAILURE(rv))
-                       goto out;
-
-               rv = AcpiGetObjectInfo(parent, &devinfo);
-               if (ACPI_FAILURE(rv))
-                       goto out;
-
-               if (acpi_match_hid(devinfo, pciroot_hid)) {
-                       rv = mpacpi_get_bbn(acpi, parent, &bus);
-                       if (ACPI_FAILURE(rv))
-                               bus = 0;
-                       ACPI_FREE(devinfo);
-                       break;
-               }
-
-               ACPI_FREE(devinfo);
+       rv = acpi_get(ad->ad_handle, &buf, AcpiGetIrqRoutingTable);
+       if (ACPI_FAILURE(rv)) {
+               buf.Length = 0; 
+               buf.Pointer = NULL; 
        }
 



Home | Main Index | Thread Index | Old Index