aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-09-24 11:34:23 +0200
committerGerd Hoffmann <kraxel@redhat.com>2020-10-15 11:21:43 +0200
commit5c8150220cfbac9a1a3a5ec97be12a011d1b6d6d (patch)
tree94c54d5ad3ce99c14c16c6fa040716d4dcca112b
parent65f7877216b5dbba657560bc51c1870a97b29e97 (diff)
downloadseabios-5c8150220cfbac9a1a3a5ec97be12a011d1b6d6d.tar.gz
dsdt: add (numeric) _UID support
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--src/fw/dsdt_parser.c18
-rw-r--r--src/util.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/src/fw/dsdt_parser.c b/src/fw/dsdt_parser.c
index fee3c090..f6413c66 100644
--- a/src/fw/dsdt_parser.c
+++ b/src/fw/dsdt_parser.c
@@ -21,6 +21,7 @@ struct acpi_device {
struct acpi_device *parent;
char name[16];
u8 *hid_aml;
+ u8 *uid_aml;
u8 *sta_aml;
u8 *crs_data;
int crs_size;
@@ -428,6 +429,8 @@ static int parse_termobj(struct parse_state *s,
s->dev->hid_aml = ptr;
if (s->dev && strcmp(s->name, "_STA") == 0)
s->dev->sta_aml = ptr;
+ if (s->dev && strcmp(s->name, "_UID") == 0)
+ s->dev->uid_aml = ptr;
break;
case 0x0a: /* byte prefix */
offset++;
@@ -599,6 +602,19 @@ char *acpi_dsdt_name(struct acpi_device *dev)
return dev->name;
}
+u64 acpi_dsdt_uid(struct acpi_device *dev)
+{
+ int error = 0;
+ u64 value = 0;
+
+ if (!CONFIG_ACPI_PARSE || !dev || !dev->uid_aml)
+ return 0;
+ parse_termarg_int(dev->uid_aml + 5, &error, &value);
+ if (error)
+ return 0;
+ return value;
+}
+
int acpi_dsdt_find_io(struct acpi_device *dev, u64 *min, u64 *max)
{
if (!CONFIG_ACPI_PARSE || !dev || !dev->crs_data)
@@ -671,6 +687,8 @@ void acpi_dsdt_parse(void)
dprintf(1, " %s", acpi_dsdt_name(dev));
if (dev->hid_aml)
dprintf(1, ", hid");
+ if (dev->uid_aml)
+ dprintf(1, ", uid %lld", acpi_dsdt_uid(dev));
if (dev->sta_aml)
dprintf(1, ", sta (0x%x)", dev->sta_aml[0]);
if (dev->crs_data)
diff --git a/src/util.h b/src/util.h
index d4071fc5..f3695ac5 100644
--- a/src/util.h
+++ b/src/util.h
@@ -100,6 +100,7 @@ void acpi_dsdt_parse(void);
struct acpi_device *acpi_dsdt_find_string(struct acpi_device *prev, const char *hid);
struct acpi_device *acpi_dsdt_find_eisaid(struct acpi_device *prev, u16 eisaid);
char *acpi_dsdt_name(struct acpi_device *dev);
+u64 acpi_dsdt_uid(struct acpi_device *dev);
int acpi_dsdt_present_eisaid(u16 eisaid);
int acpi_dsdt_find_io(struct acpi_device *dev, u64 *min, u64 *max);
int acpi_dsdt_find_mem(struct acpi_device *dev, u64 *min, u64 *max);