Current-Users archive

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

Re: pchb@acpi again



Hi! Chuck,


From: KIYOHARA Takashi <kiyohara%kk.iij4u.or.jp@localhost>
Date: Mon, 22 Apr 2013 21:21:50 +0900 (JST)

> > so I guess the easiest thing for now would be to add another MD callback
> > that is called from acpi_build_tree() just before the call to
> > acpi_pcidev_scan().  in that callback you could adjust ACPI_VALID_ADR
> > and ad->ad_devinfo->Address as I was originally thinking.
> > once we eventually migrate more of the logic from x86/mpacpi.c
> > to dev/acpi/*.c, maybe we'll find that we can merge some of these
> > callbacks.
> 
> I wish to call each device(or node?), like acpi_device_md_callback().
> Please add new callback.

I have wrote new patch.
It call acpi_node_md_callback() and retry.

Thanks,
--
kiyohara
Index: acpi_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_pci.c,v
retrieving revision 1.18
diff -u -r1.18 acpi_pci.c
--- acpi_pci.c  31 Dec 2010 10:56:39 -0000      1.18
+++ acpi_pci.c  27 Apr 2013 07:21:35 -0000
@@ -45,6 +45,8 @@
 #include <dev/acpi/acpivar.h>
 #include <dev/acpi/acpi_pci.h>
 
+#include <machine/acpi_machdep.h>
+
 #include "locators.h"
 
 #define _COMPONENT       ACPI_BUS_COMPONENT
@@ -175,6 +177,9 @@
        ACPI_STATUS rv;
 
        ad->ad_pciinfo = NULL;
+       ap = NULL;
+
+retry:
 
        /*
         * We attach PCI information only to devices that are present,
@@ -189,11 +194,11 @@
                goto rec;
 
        if (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) {
-
-               ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
-
-               if (ap == NULL)
-                       return AE_NO_MEMORY;
+               if (ap == NULL) {
+                       ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
+                       if (ap == NULL)
+                               return AE_NO_MEMORY;
+               }
 
                /*
                 * If no _SEG exist, all PCI bus segments are assumed
@@ -224,6 +229,7 @@
                }
 
                ap->ap_flags |= ACPI_PCI_INFO_BRIDGE;
+               ad->ad_pciinfo = ap;
 
                /*
                 * This ACPI node denotes a PCI root bridge, but it may also
@@ -242,11 +248,8 @@
                                    "invalid PCI address for %s\n", 
ad->ad_name);
                        else
                                ap->ap_flags |= ACPI_PCI_INFO_DEVICE;
+                       goto rec;
                }
-
-               ad->ad_pciinfo = ap;
-
-               goto rec;
        }
 
        if ((ad->ad_parent != NULL) &&
@@ -259,10 +262,11 @@
                 * bridge. We have the same PCI segment number, and
                 * our bus number is its downstream bus number.
                 */
-               ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
-
-               if (ap == NULL)
-                       return AE_NO_MEMORY;
+               if (ap == NULL) {
+                       ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
+                       if (ap == NULL)
+                               return AE_NO_MEMORY;
+               }
 
                ap->ap_segment = ad->ad_parent->ad_pciinfo->ap_segment;
                ap->ap_bus = ad->ad_parent->ad_pciinfo->ap_downbus;
@@ -279,6 +283,7 @@
                }
 
                ap->ap_flags |= ACPI_PCI_INFO_DEVICE;
+               ad->ad_pciinfo = ap;
 
                if (ap->ap_function == 0xFFFF) {
                        /*
@@ -295,12 +300,12 @@
 
                        if (ACPI_SUCCESS(rv))
                                ap->ap_flags |= ACPI_PCI_INFO_BRIDGE;
-               }
 
-               ad->ad_pciinfo = ap;
-
-               goto rec;
+                       goto rec;
+               }
        }
+       if (acpi_node_md_callback(ad) != 0)
+               goto retry;
 
 rec:
        SIMPLEQ_FOREACH(child, &ad->ad_child_head, ad_child_list) {


Home | Main Index | Thread Index | Old Index