From 98863e5f3c95b3543b91c3043f6a03a844ff961a Mon Sep 17 00:00:00 2001 From: patrick Date: Thu, 9 Dec 2021 20:21:35 +0000 Subject: [PATCH] Broken ACPI tables containing scopes that are larger than their outer shell are caught by our ACPI parser. Unfortunately in such cases our reaction was to start parsing AML somewhere outside our current scope. The intention was to clamp down the inner scope to the maximum of the outer one. So, rectify it. This issue has shown up in EDK2's QEMU SBSA target, where the SSDT table was generated incorrectly. Surprisingly neither Linux nor ACPICA's iASL noticed that the table was broken. ok kettenis@ millert@ --- sys/dev/acpi/dsdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index 0791607b19d..1a5694c9e4b 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.263 2021/05/22 13:13:14 kettenis Exp $ */ +/* $OpenBSD: dsdt.c,v 1.264 2021/12/09 20:21:35 patrick Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave * @@ -1423,7 +1423,7 @@ aml_parseend(struct aml_scope *scope) "Bad scope... runover pos:%.4x new end:%.4x scope " "end:%.4x\n", aml_pc(pos), aml_pc(pos+len), aml_pc(scope->end)); - pos = scope->end; + return scope->end; } return pos+len; } -- 2.20.1