acpi: Skip \_SB_ and \_TZ_ only for devices.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 17 Apr 2011 04:39:19 +0000 (12:39 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 17 Apr 2011 04:41:29 +0000 (12:41 +0800)
Obtained-from: FreeBSD (r214765 jkim@freebsd.org)

  Adjust a comment to clarify why \_SB_ and \_TZ_ are defined as device
  type in ACPICA.  Reshuffle the code a bit to make sure this kludge only
  applies to these two specical cases and to make it cleaner.

sys/dev/acpica5/acpi.c

index 8b8a4b8..07ef3b3 100644 (file)
@@ -1607,8 +1607,7 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status)
     ACPI_HANDLE h;
     device_t bus, child;
     int order;
-    char *handle_str, **search;
-    static char *scopes[] = {"\\_PR_", "\\_TZ_", "\\_SI_", "\\_SB_", NULL};
+    char *handle_str;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
@@ -1624,23 +1623,23 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status)
        handle_str = acpi_name(handle);
        switch (type) {
        case ACPI_TYPE_DEVICE:
-       case ACPI_TYPE_PROCESSOR:
-       case ACPI_TYPE_THERMAL:
-       case ACPI_TYPE_POWER:
            /*
             * Since we scan from \, be sure to skip system scope objects.
-            * At least \_SB and \_TZ are detected as devices (ACPI-CA bug?)
+            * \_SB_ and \_TZ_ are defined in ACPICA as devices to work around
+            * BIOS bugs.  For example, \_SB_ is to allow \_SB_._INI to be run
+            * during the intialization and \_TZ_ is to support Notify() on it.
             */
-           for (search = scopes; *search != NULL; search++) {
-               if (strcmp(handle_str, *search) == 0)
-                   break;
-           }
-           if (*search != NULL)
+           if (strcmp(handle_str, "\\_SB_") == 0 ||
+               strcmp(handle_str, "\\_TZ_") == 0)
                break;
 
-           if (type == ACPI_TYPE_DEVICE && acpi_parse_prw(handle, &prw) == 0)
+           if (acpi_parse_prw(handle, &prw) == 0)
                AcpiSetupGpeForWake(handle, prw.gpe_handle, prw.gpe_bit);
 
+           /* FALLTHROUGH */
+       case ACPI_TYPE_PROCESSOR:
+       case ACPI_TYPE_THERMAL:
+       case ACPI_TYPE_POWER:
            /* 
             * Create a placeholder device for this node.  Sort the
             * placeholder so that the probe/attach passes will run