On Sun, Feb 08, 2026 at 10:40:53AM +0100, Matthieu Herrb wrote:
> Hi,
> 
> while upgrading my X40 from 7.8 to -current, I found that the kernel
> from current snapshots panic on boot. here's an AI powered transcript
> of the screen shot (I did proof read it, it looks like it is correct):
> 
> 0x1014), c1(@1 halt()), PSS
> acpipwrres0 at acpi0: PUBS, resource for USB0, USB1, USB7
> acpitz0 at acpi0
> acpitz0: critical temperature is 95 degC
> panic: pci_make_tag: bad request
> Stopped at      db_enter+0x4:     popl    %ebp
> TID    PID     UID     PRFLAGS PFLAGS    CPU     COMMAND
> * 0     0       0       0x10000  0x200   0       swapper
> db_enter(d1264a7c,d0f10565,1,2,d1264a80) at db_enter+0x4
> panic(d0d1a60b,0,d1264b10,d0949fb3,0) at panic+0x76
> pci_make_tag(0,c7,84,d0a0) at pci_make_tag+0x93
> aml_rdpciaddr(d3dd9704,d1264b20) at aml_rdpciaddr+0x173
> acpi_found(d3ddc744,d3d94800,d0a0d9b0,0,d3ddc744) at acpi_found+0xb7
> aml_walknodes(d3ddc744,0,d0a0d9b0,d3d94800,d0a0d9b0) at aml_walknodes+0x65
> aml_walknodes(d3ddc784,0,d0a0d9b0,d3d94800,d0a0d9b0) at aml_walknodes+0x39
> aml_walknodes(d3dd9704,0,d0a0d9b0,d3d94800,d0a0d9b0) at aml_walknodes+0x39
> aml_walknodes(d3db8584,0,d0a0d9b0,d3d94800,d0a0d9b0) at aml_walknodes+0x39
> aml_walknodes(d3d9c504,0,d0a0d9b0,d3d94800,0) at aml_walknodes+0x39
> aml_walknodes(d103c23c,0,d0a0d9b0,d3d94800) at aml_walknodes+0x39
> acpi_attach_common(d3d94800,f6f90) at acpi_attach_common+0x663
> acpi_attach(d3d9c000,d3d94800,d1264dd8) at acpi_attach+0x2c
> config_attach(d3d9c000,d0f200b4,d1264dd8,d07e40c0) at config_attach+0x188
> https://www.openbsd.org/ddb.html describes the minimum info required in bug
> reports. Insufficient info makes it difficult to find and fix bugs.
> ddb>
> 

Reverting the following commit makes the machine boot fine.

commit 0c90e2b526b26d9f50dde7f7712cec107cda3326
Author: jcs <[email protected]>
Date:   Sun Nov 23 19:56:24 2025 +0000

    Make aml_rdpciaddr work better through PCI bridges
    
    When looking up the address of a PCI device from which to read for
    an opregion, walk from the root inward and each time a PCI bridge is
    encountered, read its bus info register and note its bus id.
    
    Previously we were walking outward from the device and only changing
    buses if there was a _BBN node which is not always the case.
    
    This should fix booting of late Intel Macs which have AML that tries
    to read the PCI class of the SSD after powering up the PCI port in
    its _PS0 method, waiting in a loop for it to read 1 (Mass Storage).
    Since we were previously reading the PCI class of the bridge instead
    and always getting 6, this loop would have to timeout which took
    many minutes.  Now we are properly reading from the device itself
    which is on a different bus, and the PCI class reads correctly.
    
    feedback from miod
    ok kettenis

diff --git sys/dev/acpi/dsdt.c sys/dev/acpi/dsdt.c
index d79862fc333..9f7abd43bb2 100644
--- sys/dev/acpi/dsdt.c
+++ sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.275 2025/06/22 11:19:00 kettenis Exp $ */
+/* $OpenBSD: dsdt.c,v 1.276 2025/11/23 19:56:24 jcs Exp $ */
 /*
  * Copyright (c) 2005 Jordan Hargrave <[email protected]>
  *
@@ -36,6 +36,8 @@
 
 #include <dev/i2c/i2cvar.h>
 
+#include <dev/pci/ppbreg.h>
+
 #ifdef SMALL_KERNEL
 #undef ACPI_DEBUG
 #endif
@@ -2347,29 +2349,66 @@ void aml_rwindexfield(struct aml_value *, struct 
aml_value *val, int);
 int
 aml_rdpciaddr(struct aml_node *pcidev, union amlpci_t *addr)
 {
+       struct aml_node *path[10] = { NULL };
+       pci_chipset_tag_t pc;
+       pcitag_t tag;
        int64_t res;
+       int n, reg;
 
-       addr->bus = 0;
-       addr->seg = 0;
-       if (aml_evalinteger(acpi_softc, pcidev, "_ADR", 0, NULL, &res) == 0) {
-               addr->fun = res & 0xFFFF;
-               addr->dev = res >> 16;
+       /* invert */
+       n = 0;
+       for (;;) {
+               path[n] = pcidev;
+               pcidev = pcidev->parent;
+               if (pcidev == NULL || n == nitems(path) - 1)
+                       break;
+               n++;
        }
-       while (pcidev != NULL) {
-               /* HID device (PCI or PCIE root): eval _SEG and _BBN */
-               if (__aml_search(pcidev, "_HID", 0)) {
-                       if (aml_evalinteger(acpi_softc, pcidev, "_SEG",
-                               0, NULL, &res) == 0) {
+
+       /* start from root */
+       addr->seg = 0;
+       for (; n >= 0; n--) {
+               if (aml_evalinteger(acpi_softc, path[n], "_ADR", 0, NULL,
+                   &res) == 0) {
+                       addr->dev = res >> 16;
+                       addr->fun = res & 0xFFFF;
+               } else if (__aml_search(path[n], "_HID", 0)) {
+                       /* HID device (PCI or PCIE root): eval _SEG and _BBN */
+                       if (aml_evalinteger(acpi_softc, path[n], "_SEG", 0,
+                           NULL, &res) == 0) {
                                addr->seg = res;
+                               addr->bus = 0;
+                               addr->dev = 0;
+                               addr->fun = 0;
                        }
-                       if (aml_evalinteger(acpi_softc, pcidev, "_BBN",
-                               0, NULL, &res) == 0) {
+                       if (aml_evalinteger(acpi_softc, pcidev, "_BBN", 0, NULL,
+                           &res) == 0) {
                                addr->bus = res;
-                               break;
+                               addr->dev = 0;
+                               addr->fun = 0;
                        }
                }
-               pcidev = pcidev->parent;
+
+               if (n == 0)
+                       break;
+
+               /* an intermediate device, if it's a bridge jump busses */
+               pc = pci_lookup_segment(ACPI_PCI_SEG(addr->addr),
+                   ACPI_PCI_BUS(addr->addr));
+               tag = pci_make_tag(pc, addr->bus, addr->dev, addr->fun);
+               reg = pci_conf_read(pc, tag, PCI_CLASS_REG);
+               if (PCI_CLASS(reg) == PCI_CLASS_BRIDGE &&
+                   PCI_SUBCLASS(reg) == PCI_SUBCLASS_BRIDGE_PCI) {
+                       reg = pci_conf_read(pc, tag, PPB_REG_BUSINFO);
+                       addr->bus = PPB_BUSINFO_SECONDARY(reg);
+                       addr->dev = 0;
+                       addr->fun = 0;
+               }
        }
+
+       dnprintf(50, "%s: %s: addr 0x%llx\n", __func__, aml_nodename(pcidev),
+           addr->addr);
+
        return (0);
 }
 

Dmesg with a "fixed" kernel:

OpenBSD 7.8-current (GENERIC) #10: Sun Feb  8 12:29:09 CET 2026
    [email protected]:/usr/obj/GENERIC
real mem  = 1332035584 (1270MB)
avail mem = 1290035200 (1230MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 03/01/06, BIOS32 rev. 0 @ 0xfd740, SMBIOS rev. 2.33 @ 
0xe0010 (56 entries)
bios0: vendor IBM version "1UETD1WW (2.06 )" date 03/01/2006
bios0: IBM 2371F4G
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT TCPA APIC BOOT
acpi0: wakeup devices LID_(S3) SLPB(S3) PCI0(S3) PCI1(S4) DOCK(S4) USB0(S3) 
USB1(S3) USB2(S3) AC9M(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Pentium(R) M processor 1.40GHz ("GenuineIntel" 686-class) 1.40 
GHz, 06-0d-06, patch 00000018
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,TM,PBE,EST,TM2,PERF,MELTDOWN
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins, remapped
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 2 (PCI1)
acpiprt2 at acpi0: bus -1 (DOCK)
acpibtn0 at acpi0: LID_(wakeup)
acpibtn1 at acpi0: SLPB(wakeup)
"PNP0A03" at acpi0 not configured
acpicmos0 at acpi0
"PNP0303" at acpi0 not configured
"IBM3780" at acpi0 not configured
acpibat0 at acpi0: BAT0 model "IBM-COMPATIBLE" serial 13932 type LION oem 
"PSPSP 04"
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0: version 1.0
acpicpu0 at acpi0: C1 (unknown FFH class 0): !C3(250@85 io@0x1015), !C2(500@1 
io@0x1014), C1(@1 halt!), PSS
acpipwrres0 at acpi0: PUBS, resource for USB0, USB1, USB7
acpitz0 at acpi0
acpitz0: critical temperature is 95 degC
acpidock0 at acpi0: GDCK not docked (0)
acpidock1 at acpi0: MDCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc0000/0xc800! 0xcc800/0x1000 0xcd800/0x1000 0xdc000/0x4000! 
0xe0000/0x10000
cpu0: Enhanced SpeedStep 1396 MHz: speeds: 1400, 1300, 1200, 1100, 1000, 900, 
800, 600 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82855GM Host" rev 0x02
"Intel 82855GM Memory" rev 0x02 at pci0 dev 0 function 1 not configured
"Intel 82855GM Config" rev 0x02 at pci0 dev 0 function 3 not configured
inteldrm0 at pci0 dev 2 function 0 "Intel 82855GM Video" rev 0x02
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0xe0000000, size 0x8000000
inteldrm0: apic 1 int 16, I85X, gen 2
"Intel 82855GM Video" rev 0x02 at pci0 dev 2 function 1 not configured
uhci0 at pci0 dev 29 function 0 "Intel 82801DB USB" rev 0x01: apic 1 int 16
uhci1 at pci0 dev 29 function 1 "Intel 82801DB USB" rev 0x01: apic 1 int 19
uhci2 at pci0 dev 29 function 2 "Intel 82801DB USB" rev 0x01: apic 1 int 18
ehci0 at pci0 dev 29 function 7 "Intel 82801DB USB" rev 0x01: apic 1 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 
addr 1
ppb0 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0x81
pci1 at ppb0 bus 2
2:0:0: mem address conflict 0xb0000000/0x1000
cbb0 at pci1 dev 0 function 0 "Ricoh 5C476 CardBus" rev 0x8d: apic 1 int 16
sdhc0 at pci1 dev 0 function 1 "Ricoh 5C822 SD/MMC" rev 0x13: apic 1 int 17
sdhc0: SDHC 1.00, 33 MHz base clock
sdmmc0 at sdhc0: 4-bit
em0 at pci1 dev 1 function 0 "Intel 82541GI" rev 0x00: apic 1 int 20, address 
00:0a:e4:2a:76:49
iwi0 at pci1 dev 2 function 0 "Intel PRO/Wireless 2200BG" rev 0x05: apic 1 int 
21, address 00:0e:35:98:af:79
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 3 device 0 cacheline 0x0, lattimer 0xb0
pcmcia0 at cardslot0
ichpcib0 at pci0 dev 31 function 0 "Intel 82801DBM LPC" rev 0x01
pciide0 at pci0 dev 31 function 1 "Intel 82801DBM IDE" rev 0x01: DMA, channel 0 
configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <KingSpec KSD-PA18.1-064MJ>
wd0: 1-sector PIO, LBA48, 61616MB, 126189568 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
pciide0: channel 1 disabled (no drives)
ichiic0 at pci0 dev 31 function 3 "Intel 82801DB SMBus" rev 0x01: apic 1 int 17
iic0 at ichiic0
spdmem0 at iic0 addr 0x51: 1GB DDR SDRAM non-parity PC2700CL2.5
auich0 at pci0 dev 31 function 5 "Intel 82801DB AC97" rev 0x01: apic 1 int 17, 
ICH4
ac97: codec id 0x41445374 (Analog Devices AD1981B)
ac97: codec features headphone, 20 bit DAC, No 3D Stereo
audio0 at auich0
"Intel 82801DB Modem" rev 0x01 at pci0 dev 31 function 6 not configured
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
isa0 at ichpcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
aps0 at isa0 port 0x1600/31
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a (4c3a6661568cec49.a) swap on wd0b dump on wd0b
inteldrm0: 1024x768, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (std, vt100 emulation)

-- 
Matthieu Herrb

Reply via email to