aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-09-30 13:12:22 +0200
committerGerd Hoffmann <kraxel@redhat.com>2020-10-13 11:01:08 +0200
commitdfac05be204f5829b15b52fe23d08722e5dc1eac (patch)
tree9dc414a9427542796040dd79898a3b97befd4dee
parentcf16c3b2eaee70ff27bc1d659f5546a732285d6a (diff)
downloadseabios-hppa-dfac05be204f5829b15b52fe23d08722e5dc1eac.zip
seabios-hppa-dfac05be204f5829b15b52fe23d08722e5dc1eac.tar.gz
seabios-hppa-dfac05be204f5829b15b52fe23d08722e5dc1eac.tar.bz2
dsdt: add support for pnp ids as strings
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
-rw-r--r--src/fw/dsdt_parser.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/fw/dsdt_parser.c b/src/fw/dsdt_parser.c
index 87c1a3a..eb5496f 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");