summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2024-01-08 19:52:30 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2024-01-08 19:52:30 +0000
commit86838aa7e194992d35ddaeb9f3cd7b3388c5e9b3 (patch)
tree9efe8d51b6e80e6c80ef945c196da9092c30c684 /sys
parentc5ed4da9e321343f148e897529ca45cbf409e155 (diff)
Implement RootPathString support in the LoadTable() AML function. Fixes
booting OpenBSD on some (ancient?) Hyper-V version. Tested by Henryk Paluch ok mlarkin@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpi.c10
-rw-r--r--sys/dev/acpi/dsdt.c21
-rw-r--r--sys/dev/acpi/dsdt.h6
3 files changed, 22 insertions, 15 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index ba6a3c468a4..70b67bb8fa7 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.425 2023/07/08 08:01:10 tobhe Exp $ */
+/* $OpenBSD: acpi.c,v 1.426 2024/01/08 19:52:29 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -1104,16 +1104,16 @@ acpi_attach_common(struct acpi_softc *sc, paddr_t base)
printf(" !DSDT");
p_dsdt = entry->q_table;
- acpi_parse_aml(sc, p_dsdt->aml, p_dsdt->hdr_length -
- sizeof(p_dsdt->hdr));
+ acpi_parse_aml(sc, NULL, p_dsdt->aml,
+ p_dsdt->hdr_length - sizeof(p_dsdt->hdr));
/* Load SSDT's */
SIMPLEQ_FOREACH(entry, &sc->sc_tables, q_next) {
if (memcmp(entry->q_table, SSDT_SIG,
sizeof(SSDT_SIG) - 1) == 0) {
p_dsdt = entry->q_table;
- acpi_parse_aml(sc, p_dsdt->aml, p_dsdt->hdr_length -
- sizeof(p_dsdt->hdr));
+ acpi_parse_aml(sc, NULL, p_dsdt->aml,
+ p_dsdt->hdr_length - sizeof(p_dsdt->hdr));
}
}
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index 1a5694c9e4b..24ebf445551 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.264 2021/12/09 20:21:35 patrick Exp $ */
+/* $OpenBSD: dsdt.c,v 1.265 2024/01/08 19:52:29 kettenis Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -634,8 +634,9 @@ __aml_search(struct aml_node *root, uint8_t *nameseg, int create)
SIMPLEQ_INIT(&node->son);
SIMPLEQ_INSERT_TAIL(&root->son, node, sib);
+ return node;
}
- return node;
+ return NULL;
}
/* Get absolute pathname of AML node */
@@ -3742,8 +3743,6 @@ aml_loadtable(struct acpi_softc *sc, const char *signature,
struct acpi_dsdt *p_dsdt;
struct acpi_q *entry;
- if (strlen(rootpath) > 0)
- aml_die("LoadTable: RootPathString unsupported");
if (strlen(parameterpath) > 0)
aml_die("LoadTable: ParameterPathString unsupported");
@@ -3755,8 +3754,8 @@ aml_loadtable(struct acpi_softc *sc, const char *signature,
strncmp(hdr->oemtableid, oemtableid,
sizeof(hdr->oemtableid)) == 0) {
p_dsdt = entry->q_table;
- acpi_parse_aml(sc, p_dsdt->aml, p_dsdt->hdr_length -
- sizeof(p_dsdt->hdr));
+ acpi_parse_aml(sc, rootpath, p_dsdt->aml,
+ p_dsdt->hdr_length - sizeof(p_dsdt->hdr));
return aml_allocvalue(AML_OBJTYPE_DDBHANDLE, 0, 0);
}
}
@@ -4520,11 +4519,19 @@ parse_error:
}
int
-acpi_parse_aml(struct acpi_softc *sc, uint8_t *start, uint32_t length)
+acpi_parse_aml(struct acpi_softc *sc, const char *rootpath,
+ uint8_t *start, uint32_t length)
{
+ struct aml_node *root = &aml_root;
struct aml_scope *scope;
struct aml_value res;
+ if (rootpath) {
+ root = aml_searchname(&aml_root, rootpath);
+ if (root == NULL)
+ aml_die("Invalid RootPathName %s\n", rootpath);
+ }
+
aml_root.start = start;
memset(&res, 0, sizeof(res));
res.type = AML_OBJTYPE_SCOPE;
diff --git a/sys/dev/acpi/dsdt.h b/sys/dev/acpi/dsdt.h
index 41633ced748..f63d8b4ac91 100644
--- a/sys/dev/acpi/dsdt.h
+++ b/sys/dev/acpi/dsdt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.h,v 1.80 2023/04/02 11:32:48 jsg Exp $ */
+/* $OpenBSD: dsdt.h,v 1.81 2024/01/08 19:52:29 kettenis Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -56,8 +56,8 @@ void aml_walktree(struct aml_node *);
void aml_find_node(struct aml_node *, const char *,
int (*)(struct aml_node *, void *), void *);
-int acpi_parse_aml(struct acpi_softc *, u_int8_t *,
- uint32_t);
+int acpi_parse_aml(struct acpi_softc *, const char *,
+ u_int8_t *, uint32_t);
void aml_register_notify(struct aml_node *, const char *,
int (*)(struct aml_node *, int, void *), void *,
int);