Hello!

> Can you try the attached diff?

Good work! Your patch applied to stock 7.4 source without problems and system booted fine. Here is dmesg output:

OpenBSD 7.4 (HPUEFI2) #0: Mon Dec 25 09:17:37 CET 2023
    ansi...@obsd74-uefi.my.domain:/usr/src/sys/arch/amd64/compile/HPUEFI2
real mem = 2110689280 (2012MB)
avail mem = 2044784640 (1950MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x7fdf1000 (12 entries)
bios0: vendor Microsoft Corporation version "Hyper-V UEFI Release v1.0" date 11/26/2012
bios0: Microsoft Corporation Virtual Machine
efi0 at bios0: UEFI 2.3.1
efi0: EDK II rev 0x10000
acpi0 at bios0: ACPI 4.0
acpi0: sleep states S0 S5
acpi0: tables DSDT FACP APIC OEM0 WAET OEM1 SRAT BGRT
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee00000
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 11, 24 pins
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+, 2000.21 MHz, 0f-4b-02
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SSE3,CX16,HV,NXE,MMXX,FFXSR,LONG,3DNOW2,3DNOW,LAHF,CMPLEG,AMCR8
cpu0: 64KB 64b/line 2-way D-cache, 64KB 64b/line 2-way I-cache
cpu0: 512KB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 200MHz
acpihve0 at acpi0
"ACPI0004" at acpi0 not configured
"VMBus" at acpi0 not configured
"Hyper_V_Gen_Counter_V1" at acpi0 not configured
acpicmos0 at acpi0
com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo
acpicpu0 at acpi0: C1(@1 halt!)
pvbus0 at mainbus0: Hyper-V 6.3
hyperv0 at pvbus0: protocol 3.0, features 0xc7f
hyperv0: heartbeat, kvp, shutdown, timesync
hvn0 at hyperv0 channel 12: NVS 5.0 NDIS 6.30, address 00:15:5d:00:33:03
hvs0 at hyperv0 channel 13: scsi, protocol 6.0
scsibus1 at hvs0: 2 targets
sd0 at scsibus1 targ 0 lun 0: <Msft, Virtual Disk, 1.0> naa.600224806339816dd00df20d64df290b
sd0: 20480MB, 512 bytes/sector, 41943040 sectors, thin
sd1 at scsibus1 targ 0 lun 1: <Msft, Virtual Disk, 1.0> naa.60022480d40507eafb74508ae0298284
sd1: 664MB, 512 bytes/sector, 1360832 sectors, thin
pci0 at mainbus0 bus 0
isa0 at mainbus0
isadma0 at isa0
efifb0 at mainbus0: 1024x768, 32bpp
wsdisplay0 at efifb0 mux 1
wsdisplay0: screen 0-5 added (std, vt100 emulation)
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (e7990a24dbae92d0.a) swap on sd0b dump on sd0b

Best regards
  --Henryk Paluch

On 12/21/23 17:39, Mark Kettenis wrote:
Date: Wed, 20 Dec 2023 12:00:47 +0100
From: Henryk Paluch <hpal...@seznam.cz>

Hello!

  > Ah, cool.  That is a bit of a heck though.  I did look into what is
  > needed to fix this properly.  If I send you a diff, can you test it?

Feel free to send me patches. I will test them.

Best regards
    --Henryk Paluch

Can you try the attached diff?


Index: dev/acpi/acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.425
diff -u -p -r1.425 acpi.c
--- dev/acpi/acpi.c     8 Jul 2023 08:01:10 -0000       1.425
+++ dev/acpi/acpi.c     21 Dec 2023 16:37:18 -0000
@@ -1104,16 +1104,16 @@ acpi_attach_common(struct acpi_softc *sc
                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));
                }
        }
Index: dev/acpi/dsdt.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.264
diff -u -p -r1.264 dsdt.c
--- dev/acpi/dsdt.c     9 Dec 2021 20:21:35 -0000       1.264
+++ dev/acpi/dsdt.c     21 Dec 2023 16:37:18 -0000
@@ -634,8 +634,9 @@ __aml_search(struct aml_node *root, uint
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, con
        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, con
                    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,10 +4519,18 @@ 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));
Index: dev/acpi/dsdt.h
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.h,v
retrieving revision 1.80
diff -u -p -r1.80 dsdt.h
--- dev/acpi/dsdt.h     2 Apr 2023 11:32:48 -0000       1.80
+++ dev/acpi/dsdt.h     21 Dec 2023 16:37:18 -0000
@@ -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);


Reply via email to