]> xenbits.xensource.com Git - seabios.git/commitdiff
dsdt: add support for pnp ids as strings
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 30 Sep 2020 11:12:22 +0000 (13:12 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 13 Oct 2020 09:01:08 +0000 (11:01 +0200)
PNP devices can be declared using eisaid encoding ...

Name (_HID, EisaId ("PNP0103"))

... or as string ...

Name (_HID, "PNP0A06")

.. so lets support both variants.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200930111222.6020-3-kraxel@redhat.com

src/fw/dsdt_parser.c

index 87c1a3ac3a008994cb6883f86bfeec31d9c3162a..eb5496f3515aaa87c06fb0dd304be068e51c01d6 100644 (file)
@@ -515,7 +515,8 @@ static void parse_termlist(struct parse_state *s,
 }
 
 static struct acpi_device *acpi_dsdt_find(struct acpi_device *prev,
-                                          const u8 *aml, int size)
+                                          const u8 *aml1, int size1,
+                                          const u8 *aml2, int size2)
 {
     struct acpi_device *dev;
     struct hlist_node *node;
@@ -527,11 +528,13 @@ static struct acpi_device *acpi_dsdt_find(struct acpi_device *prev,
 
     for (; node != NULL; node = dev->node.next) {
         dev = container_of(node, struct acpi_device, node);
-        if (!aml)
+        if (!aml1 && !aml2)
             return dev;
         if (!dev->hid_aml)
             continue;
-        if (memcmp(dev->hid_aml + 5, aml, size) == 0)
+        if (aml1 && memcmp(dev->hid_aml + 5, aml1, size1) == 0)
+            return dev;
+        if (aml2 && memcmp(dev->hid_aml + 5, aml2, size2) == 0)
             return dev;
     }
     return NULL;
@@ -568,19 +571,21 @@ struct acpi_device *acpi_dsdt_find_string(struct acpi_device *prev,
 
     u8 aml[10];
     int len = snprintf((char*)aml, sizeof(aml), "\x0d%s", hid);
-    return acpi_dsdt_find(prev, aml, len);
+    return acpi_dsdt_find(prev, aml, len, NULL, 0);
 }
 
 struct acpi_device *acpi_dsdt_find_eisaid(struct acpi_device *prev, u16 eisaid)
 {
     if (!CONFIG_ACPI_PARSE)
         return NULL;
-    u8 aml[] = {
+    u8 aml1[] = {
         0x0c, 0x41, 0xd0,
         eisaid >> 8,
         eisaid & 0xff
     };
-    return acpi_dsdt_find(prev, aml, 5);
+    u8 aml2[10];
+    int len2 = snprintf((char*)aml2, sizeof(aml2), "\x0dPNP%04X", eisaid);
+    return acpi_dsdt_find(prev, aml1, 5, aml2, len2);
 }
 
 char *acpi_dsdt_name(struct acpi_device *dev)
@@ -651,9 +656,9 @@ void acpi_dsdt_parse(void)
 
     struct acpi_device *dev;
     dprintf(1, "ACPI: dumping dsdt devices\n");
-    for (dev = acpi_dsdt_find(NULL, NULL, 0);
+    for (dev = acpi_dsdt_find(NULL, NULL, 0, NULL, 0);
          dev != NULL;
-         dev = acpi_dsdt_find(dev, NULL, 0)) {
+         dev = acpi_dsdt_find(dev, NULL, 0, NULL, 0)) {
         dprintf(1, "    %s", acpi_dsdt_name(dev));
         if (dev->hid_aml)
             dprintf(1, ", hid");