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 --- src/fw/dsdt_parser.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/fw/dsdt_parser.c b/src/fw/dsdt_parser.c index 87c1a3ac3a00..eb5496f3515a 100644 --- a/src/fw/dsdt_parser.c +++ b/src/fw/dsdt_parser.c @@ -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");