panic: aml_die aml_rwgsb:2549

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

panic: aml_die aml_rwgsb:2549

Theo Buehler-3
I tried installing OpenBSD on a Dell Precision 3640. bsd.rd gets stuck
in a reboot loop as detailed further below. Booting a pre-installed
memory stick panics while parsing the aml. I upgraded to the latest BIOS
but that didn't help.

As I could not boot OpenBSD, I attached the output of FreeBSD's
'acpidump -dt'. If there's a better way to get my hands at this info,
please let me know how.

When trying to boot the latest snapshot from a memory stick, I run into
this panic (hand transcribed):

...
efifb at mainbus0 not configured
Invalid GenericSerialBus access
488bd Called: \_SB_.PCI0.I2C0.PAS1
  local0: 0xffff80000044a508 cnt:01 stk:60 integer: 1
4868c Called: \_GPE._L42
panic: aml_die aml_rwgsb:2549
stopped at      db_enter+0x10:  popq    %rbp
    TID    PID    UID     PAFLAGS     PFLAGS  CPU  COMMAND
* 17224  58818      0     0x14000 0x40000200    0K acpi0
db_enter() at db_enter+0x10
panic() at panic+0x12a
_aml_die() at _aml_die+0x3e1
aml_rwgsb() at aml_rwgsb+0x342
aml_rwfield() at aml_rwfield+0x3a0
aml_eval() at aml_eval+0x284
aml_parse() at aml_parse+0x2e19
aml_parse() at aml_parse+0x3bc
aml_eval() at aml_eval+0x317
aml_parse() at aml_parse+0x2e19
aml_eval() at aml_eval+0x317
aml_evalnode() at aml_evalnode+0xb4
acpi_gpe() at acpi_gpe+0x30
acpi_thread() at acpi_thread+0x1b8
end trace frame: 0x0, count: 1

I cannot type anything at the ddb> prompt.

Below is the output of 6.8-release bsd.rd. I tried grabbing some
information with 6.9-current, but it flashes by too quickly for my
camera to register the relevant info in a readable way.

...
efifb0 at mainbus0: 2560x1448, 32bpp
wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
aml_rwgen: unregistered RegionSpace 0x9
Could not convert 0 to 3

panic: aml_die aml_convert:2093
syncing disks...uvmfault(0xffffffff01930030, 0xbc8, 0, 1) -> e
fatal page fault in supervisor mode
trap type 6 code 0 rip ffffffff010e280b cs 0 rflags 10206 cr2 bc0 cpl 0 rsp ffff00001f76700
gsbase 0xffffffff010cdff0 keybase 0x0
panic: trap type 6 code=0, pc=ffffffff010e280b

dump to dev 17,1 not possible
rebooting...


In case it's of any use, here's the dmesg generated by the
FreeBSD-12.2-RELEASE-amd64-memstick.img. Note that it contains these
which seems to match the aml in the above transcription:

ACPI Error: No handler for Region [WST1] (0xfffff80003c27c00) [GenericSerialBus] (20200430/evregion-288)
ACPI Error: Region GenericSerialBus (ID=9) has no handler (20200430/exfldio-428)
ACPI Error: Aborting method \134_SB.PCI0.I2C0.PAS1 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
ACPI Error: Aborting method \134_GPE._L42 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
ACPI Error: AE_NOT_EXIST, while evaluating GPE method [_L42] (20200430/evgpe-708)

---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.2-RELEASE r366954 GENERIC amd64
FreeBSD clang version 10.0.1 ([hidden email]:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
VT(efifb): resolution 800x600
CPU: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (3792.23-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0xa0655  Family=0x6  Model=0xa5  Stepping=5
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x7ffafbff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x121<LAHF,ABM,Prefetch>
  Structured Extended Features=0x29c67af<FSGSBASE,TSCADJ,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,NFPUSG,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PROCTRACE>
  Structured Extended Features2=0x40000008<PKU,SGXLC>
  Structured Extended Features3=0xbc000400<MD_CLEAR,IBPB,STIBP,L1DFL,ARCH_CAP,SSBD>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
  IA32_ARCH_CAPS=0x2b<RDCL_NO,IBRS_ALL,SKIP_L1DFL_VME>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID,VID,PostIntr
  TSC: P-state invariant, performance statistics
real memory  = 34359738368 (32768 MB)
avail memory = 33005989888 (31476 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <DELL   CBX3   >
FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
FreeBSD/SMP: 1 package(s) x 8 core(s) x 2 hardware threads
arc4random: no preloaded entropy cache
ioapic0 <Version 2.0> irqs 0-119 on motherboard
Launching APs: 1 5 13 3 14 4 7 2 9 12 8 11 15 10 6
Timecounter "TSC-low" frequency 1896115752 Hz quality 1000
random: entropy device external interface
kbd1 at kbdmux0
000.000023 [4336] netmap_init               netmap: loaded module
[ath_hal] loaded
module_register_init: MOD_LOAD (vesa, 0xffffffff81115e40, 0) error 19
random: registering fast source Intel Secure Key RNG
random: fast provider: "Intel Secure Key RNG"
nexus0
efirtc0: <EFI Realtime Clock> on motherboard
efirtc0: registered as a time-of-day clock, resolution 1.000000s
cryptosoft0: <software crypto> on motherboard
acpi0: <DELL CBX3   > on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 24000000 Hz quality 950
Event timer "HPET" frequency 24000000 Hz quality 350
Event timer "HPET1" frequency 24000000 Hz quality 340
Event timer "HPET2" frequency 24000000 Hz quality 340
Event timer "HPET3" frequency 24000000 Hz quality 340
Event timer "HPET4" frequency 24000000 Hz quality 340
Event timer "HPET5" frequency 24000000 Hz quality 340
Event timer "HPET6" frequency 24000000 Hz quality 340
Event timer "HPET7" frequency 24000000 Hz quality 340
atrtc0: <AT realtime clock> port 0x70-0x77 irq 8 on acpi0
atrtc0: Warning: Couldn't map I/O.
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
apei0: <ACPI Platform Error Interface> on acpi0
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1808-0x180b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
nvme0: <Generic NVMe Device> mem 0x91030000-0x91037fff,0x91020000-0x9102ffff at device 0.0 on pci1
vgapci0: <VGA-compatible display> port 0x3000-0x303f mem 0x90000000-0x90ffffff,0x80000000-0x8fffffff at device 2.0 on pci0
vgapci0: Boot video device
xhci0: <XHCI (generic) USB 3.0 controller> mem 0x4000100000-0x400010ffff at device 20.0 on pci0
xhci0: 32 bytes context size, 64-bit DMA
usbus0 on xhci0
usbus0: 5.0Gbps Super Speed USB v3.0
pci0: <memory, RAM> at device 20.2 (no driver attached)
pci0: <serial bus> at device 21.0 (no driver attached)
pci0: <serial bus> at device 21.1 (no driver attached)
pci0: <simple comms> at device 22.0 (no driver attached)
pci0: <mass storage, RAID> at device 23.0 (no driver attached)
pci0: <simple comms> at device 30.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
hdac0: <Intel Comet Lake-H HDA Controller> mem 0x4000110000-0x4000113fff,0x4000000000-0x40000fffff at device 31.3 on pci0
pci0: <serial bus> at device 31.5 (no driver attached)
em0: <Intel(R) PRO/1000 Network Connection> mem 0x91180000-0x9119ffff at device 31.6 on pci0
em0: Using 1024 TX descriptors and 1024 RX descriptors
em0: Using an MSI interrupt
em0: Ethernet address: a4:bb:6d:5b:43:8e
em0: netmap queues/slots: TX 1/1024, RX 1/1024
acpi_button0: <Sleep Button> on acpi0
acpi_button1: <Power Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 7 flags 0x10 on acpi0
acpi_syscontainer0: <System Container> on acpi0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbdc0: non-PNP ISA device will be removed from GENERIC in FreeBSD 12.
est0: <Enhanced SpeedStep Frequency Control> on cpu0
Timecounters tick every 1.000 msec
arc4random: no preloaded entropy cache
ACPI Error: No handler for Region [WST1] (0xfffff80003c27c00) [GenericSerialBus] (20200430/evregion-288)
ACPI Error: Region GenericSerialBus (ID=9) has no handler (20200430/exfldio-428)
ACPI Error: Aborting method \134_SB.PCI0.I2C0.PAS1 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
ACPI Error: Aborting method \134_GPE._L42 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
ACPI Error: AE_NOT_EXIST, while evaluating GPE method [_L42] (20200430/evgpe-708)
ugen0.1: <0x8086 XHCI root HUB> at usbus0
uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
nvd0: <WD_BLACK AN1500> NVMe namespace
nvd0: 953752MB (1953284096 512 byte sectors)
hdacc0: <Realtek ALC256 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC256 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC256 (Analog 2.0+HP)> at nid 20,33 on hdaa0
pcm1: <Realtek ALC256 (Rear Analog Line-out)> at nid 27 on hdaa0
hdacc1: <Intel Kaby Lake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Kaby Lake Audio Function Group> at nid 1 on hdacc1
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
Trying to mount root from ufs:/dev/ufs/FreeBSD_Install [ro,noatime]...
Root mount waiting for: usbus0
Root mount waiting for: usbus0
uhub0: 26 ports with 26 removable, self powered
Root mount waiting for: usbus0
ugen0.2: <Sony Storage Media> at usbus0
umass0 on uhub0
umass0: <Sony Storage Media, class 0/0, rev 2.00/1.00, addr 1> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:0:0: Attached to scbus0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <Sony Storage Media 0100> Removable Direct Access SCSI device
da0: Serial Number 0906061314564
da0: 40.000MB/s transfers
da0: 1983MB (4062208 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
Root mount waiting for: usbus0
ugen0.3: <SONiX USB DEVICE> at usbus0
ukbd0 on uhub0
ukbd0: <SONiX USB DEVICE, class 0/0, rev 2.00/1.05, addr 2> on usbus0
kbd2 at ukbd0
ukbd1 on uhub0
ukbd1: <SONiX USB DEVICE, class 0/0, rev 2.00/1.05, addr 2> on usbus0
kbd3 at ukbd1
Root mount waiting for: usbus0
ugen0.4: <Microsoft Basic Optical Mouse> at usbus0
ugen0.5: <Generic USB3.0-CRW> at usbus0
umass1 on uhub0
umass1: <Bulk-In, Bulk-Out, Interface> on usbus0
umass1:  SCSI over Bulk-Only; quirks = 0x4000
umass1:1:1: Attached to scbus1
(probe0:umass-sim1:1:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error
(probe0:umass-sim1:1:0:0): SCSI status: Check Condition
(probe0:umass-sim1:1:0:0): SCSI sense: ILLEGAL REQUEST asc:24,0 (Invalid field in CDB)
(probe0:umass-sim1:1:0:0): Error 22, Unretryable error
da1 at umass-sim1 bus 1 scbus1 target 0 lun 0
da1: <Generic- SD/MMC CRW 1.00> Removable Direct Access SPC-4 SCSI device
da1: Serial Number 28203008282014000
da1: 400.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
da1: quirks=0x2<NO_6_BYTE>
mountroot: waiting for device /dev/ufs/FreeBSD_Install...
random: unblocking device.
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
arc4random: no preloaded entropy cache
lo0: link state changed to UP
em0: link state changed to UP
ums0 on uhub0
ums0: <Microsoft Basic Optical Mouse, class 0/0, rev 1.10/0.00, addr 3> on usbus0
ums0: 3 buttons and [XYZ] coordinates ID=0
ugen0.6: <vendor 0x058f product 0x6387> at usbus0
umass2 on uhub0
umass2: <vendor 0x058f product 0x6387, class 0/0, rev 2.00/1.05, addr 5> on usbus0
umass2:  SCSI over Bulk-Only; quirks = 0x4101
umass2:2:2: Attached to scbus2
da2 at umass-sim2 bus 2 scbus2 target 0 lun 0
da2: <  8.07> Removable Direct Access SPC-2 SCSI device
da2: Serial Number 14040459000056
da2: 40.000MB/s transfers
da2: 7450MB (15257600 512 byte sectors)
da2: quirks=0x2<NO_6_BYTE>

dell_precision.asl.gz (226K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Mark Kettenis
> Date: Tue, 23 Mar 2021 14:14:40 +0100
> From: Theo Buehler <[hidden email]>

It would help if you could try and boot a kernel that adds some debug
prints instead of calling aml_die().  Probably need to know the values
of alen, bpos, blen, mode and flag for starters.

Cheers,

Mark


> I tried installing OpenBSD on a Dell Precision 3640. bsd.rd gets stuck
> in a reboot loop as detailed further below. Booting a pre-installed
> memory stick panics while parsing the aml. I upgraded to the latest BIOS
> but that didn't help.
>
> As I could not boot OpenBSD, I attached the output of FreeBSD's
> 'acpidump -dt'. If there's a better way to get my hands at this info,
> please let me know how.
>
> When trying to boot the latest snapshot from a memory stick, I run into
> this panic (hand transcribed):
>
> ...
> efifb at mainbus0 not configured
> Invalid GenericSerialBus access
> 488bd Called: \_SB_.PCI0.I2C0.PAS1
>   local0: 0xffff80000044a508 cnt:01 stk:60 integer: 1
> 4868c Called: \_GPE._L42
> panic: aml_die aml_rwgsb:2549
> stopped at      db_enter+0x10:  popq    %rbp
>     TID    PID    UID     PAFLAGS     PFLAGS  CPU  COMMAND
> * 17224  58818      0     0x14000 0x40000200    0K acpi0
> db_enter() at db_enter+0x10
> panic() at panic+0x12a
> _aml_die() at _aml_die+0x3e1
> aml_rwgsb() at aml_rwgsb+0x342
> aml_rwfield() at aml_rwfield+0x3a0
> aml_eval() at aml_eval+0x284
> aml_parse() at aml_parse+0x2e19
> aml_parse() at aml_parse+0x3bc
> aml_eval() at aml_eval+0x317
> aml_parse() at aml_parse+0x2e19
> aml_eval() at aml_eval+0x317
> aml_evalnode() at aml_evalnode+0xb4
> acpi_gpe() at acpi_gpe+0x30
> acpi_thread() at acpi_thread+0x1b8
> end trace frame: 0x0, count: 1
>
> I cannot type anything at the ddb> prompt.
>
> Below is the output of 6.8-release bsd.rd. I tried grabbing some
> information with 6.9-current, but it flashes by too quickly for my
> camera to register the relevant info in a readable way.
>
> ...
> efifb0 at mainbus0: 2560x1448, 32bpp
> wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
> aml_rwgen: unregistered RegionSpace 0x9
> Could not convert 0 to 3
>
> panic: aml_die aml_convert:2093
> syncing disks...uvmfault(0xffffffff01930030, 0xbc8, 0, 1) -> e
> fatal page fault in supervisor mode
> trap type 6 code 0 rip ffffffff010e280b cs 0 rflags 10206 cr2 bc0 cpl 0 rsp ffff00001f76700
> gsbase 0xffffffff010cdff0 keybase 0x0
> panic: trap type 6 code=0, pc=ffffffff010e280b
>
> dump to dev 17,1 not possible
> rebooting...
>
>
> In case it's of any use, here's the dmesg generated by the
> FreeBSD-12.2-RELEASE-amd64-memstick.img. Note that it contains these
> which seems to match the aml in the above transcription:
>
> ACPI Error: No handler for Region [WST1] (0xfffff80003c27c00) [GenericSerialBus] (20200430/evregion-288)
> ACPI Error: Region GenericSerialBus (ID=9) has no handler (20200430/exfldio-428)
> ACPI Error: Aborting method \134_SB.PCI0.I2C0.PAS1 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
> ACPI Error: Aborting method \134_GPE._L42 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
> ACPI Error: AE_NOT_EXIST, while evaluating GPE method [_L42] (20200430/evgpe-708)
>
> ---<<BOOT>>---
> Copyright (c) 1992-2020 The FreeBSD Project.
> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
> The Regents of the University of California. All rights reserved.
> FreeBSD is a registered trademark of The FreeBSD Foundation.
> FreeBSD 12.2-RELEASE r366954 GENERIC amd64
> FreeBSD clang version 10.0.1 ([hidden email]:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
> VT(efifb): resolution 800x600
> CPU: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (3792.23-MHz K8-class CPU)
>   Origin="GenuineIntel"  Id=0xa0655  Family=0x6  Model=0xa5  Stepping=5
>   Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
>   Features2=0x7ffafbff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
>   AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
>   AMD Features2=0x121<LAHF,ABM,Prefetch>
>   Structured Extended Features=0x29c67af<FSGSBASE,TSCADJ,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,NFPUSG,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PROCTRACE>
>   Structured Extended Features2=0x40000008<PKU,SGXLC>
>   Structured Extended Features3=0xbc000400<MD_CLEAR,IBPB,STIBP,L1DFL,ARCH_CAP,SSBD>
>   XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
>   IA32_ARCH_CAPS=0x2b<RDCL_NO,IBRS_ALL,SKIP_L1DFL_VME>
>   VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID,VID,PostIntr
>   TSC: P-state invariant, performance statistics
> real memory  = 34359738368 (32768 MB)
> avail memory = 33005989888 (31476 MB)
> Event timer "LAPIC" quality 600
> ACPI APIC Table: <DELL   CBX3   >
> FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
> FreeBSD/SMP: 1 package(s) x 8 core(s) x 2 hardware threads
> arc4random: no preloaded entropy cache
> ioapic0 <Version 2.0> irqs 0-119 on motherboard
> Launching APs: 1 5 13 3 14 4 7 2 9 12 8 11 15 10 6
> Timecounter "TSC-low" frequency 1896115752 Hz quality 1000
> random: entropy device external interface
> kbd1 at kbdmux0
> 000.000023 [4336] netmap_init               netmap: loaded module
> [ath_hal] loaded
> module_register_init: MOD_LOAD (vesa, 0xffffffff81115e40, 0) error 19
> random: registering fast source Intel Secure Key RNG
> random: fast provider: "Intel Secure Key RNG"
> nexus0
> efirtc0: <EFI Realtime Clock> on motherboard
> efirtc0: registered as a time-of-day clock, resolution 1.000000s
> cryptosoft0: <software crypto> on motherboard
> acpi0: <DELL CBX3   > on motherboard
> acpi0: Power Button (fixed)
> cpu0: <ACPI CPU> on acpi0
> hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
> Timecounter "HPET" frequency 24000000 Hz quality 950
> Event timer "HPET" frequency 24000000 Hz quality 350
> Event timer "HPET1" frequency 24000000 Hz quality 340
> Event timer "HPET2" frequency 24000000 Hz quality 340
> Event timer "HPET3" frequency 24000000 Hz quality 340
> Event timer "HPET4" frequency 24000000 Hz quality 340
> Event timer "HPET5" frequency 24000000 Hz quality 340
> Event timer "HPET6" frequency 24000000 Hz quality 340
> Event timer "HPET7" frequency 24000000 Hz quality 340
> atrtc0: <AT realtime clock> port 0x70-0x77 irq 8 on acpi0
> atrtc0: Warning: Couldn't map I/O.
> atrtc0: registered as a time-of-day clock, resolution 1.000000s
> Event timer "RTC" frequency 32768 Hz quality 0
> attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
> Timecounter "i8254" frequency 1193182 Hz quality 0
> Event timer "i8254" frequency 1193182 Hz quality 100
> apei0: <ACPI Platform Error Interface> on acpi0
> Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
> acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1808-0x180b on acpi0
> pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
> pci0: <ACPI PCI bus> on pcib0
> pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
> pci1: <ACPI PCI bus> on pcib1
> nvme0: <Generic NVMe Device> mem 0x91030000-0x91037fff,0x91020000-0x9102ffff at device 0.0 on pci1
> vgapci0: <VGA-compatible display> port 0x3000-0x303f mem 0x90000000-0x90ffffff,0x80000000-0x8fffffff at device 2.0 on pci0
> vgapci0: Boot video device
> xhci0: <XHCI (generic) USB 3.0 controller> mem 0x4000100000-0x400010ffff at device 20.0 on pci0
> xhci0: 32 bytes context size, 64-bit DMA
> usbus0 on xhci0
> usbus0: 5.0Gbps Super Speed USB v3.0
> pci0: <memory, RAM> at device 20.2 (no driver attached)
> pci0: <serial bus> at device 21.0 (no driver attached)
> pci0: <serial bus> at device 21.1 (no driver attached)
> pci0: <simple comms> at device 22.0 (no driver attached)
> pci0: <mass storage, RAID> at device 23.0 (no driver attached)
> pci0: <simple comms> at device 30.0 (no driver attached)
> isab0: <PCI-ISA bridge> at device 31.0 on pci0
> isa0: <ISA bus> on isab0
> hdac0: <Intel Comet Lake-H HDA Controller> mem 0x4000110000-0x4000113fff,0x4000000000-0x40000fffff at device 31.3 on pci0
> pci0: <serial bus> at device 31.5 (no driver attached)
> em0: <Intel(R) PRO/1000 Network Connection> mem 0x91180000-0x9119ffff at device 31.6 on pci0
> em0: Using 1024 TX descriptors and 1024 RX descriptors
> em0: Using an MSI interrupt
> em0: Ethernet address: a4:bb:6d:5b:43:8e
> em0: netmap queues/slots: TX 1/1024, RX 1/1024
> acpi_button0: <Sleep Button> on acpi0
> acpi_button1: <Power Button> on acpi0
> acpi_tz0: <Thermal Zone> on acpi0
> uart0: <16550 or compatible> port 0x3f8-0x3ff irq 7 flags 0x10 on acpi0
> acpi_syscontainer0: <System Container> on acpi0
> atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
> atkbd0: <AT Keyboard> irq 1 on atkbdc0
> kbd0 at atkbd0
> atkbd0: [GIANT-LOCKED]
> atkbdc0: non-PNP ISA device will be removed from GENERIC in FreeBSD 12.
> est0: <Enhanced SpeedStep Frequency Control> on cpu0
> Timecounters tick every 1.000 msec
> arc4random: no preloaded entropy cache
> ACPI Error: No handler for Region [WST1] (0xfffff80003c27c00) [GenericSerialBus] (20200430/evregion-288)
> ACPI Error: Region GenericSerialBus (ID=9) has no handler (20200430/exfldio-428)
> ACPI Error: Aborting method \134_SB.PCI0.I2C0.PAS1 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
> ACPI Error: Aborting method \134_GPE._L42 due to previous error (AE_NOT_EXIST) (20200430/psparse-689)
> ACPI Error: AE_NOT_EXIST, while evaluating GPE method [_L42] (20200430/evgpe-708)
> ugen0.1: <0x8086 XHCI root HUB> at usbus0
> uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
> nvd0: <WD_BLACK AN1500> NVMe namespace
> nvd0: 953752MB (1953284096 512 byte sectors)
> hdacc0: <Realtek ALC256 HDA CODEC> at cad 0 on hdac0
> hdaa0: <Realtek ALC256 Audio Function Group> at nid 1 on hdacc0
> pcm0: <Realtek ALC256 (Analog 2.0+HP)> at nid 20,33 on hdaa0
> pcm1: <Realtek ALC256 (Rear Analog Line-out)> at nid 27 on hdaa0
> hdacc1: <Intel Kaby Lake HDA CODEC> at cad 2 on hdac0
> hdaa1: <Intel Kaby Lake Audio Function Group> at nid 1 on hdacc1
> pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
> Trying to mount root from ufs:/dev/ufs/FreeBSD_Install [ro,noatime]...
> Root mount waiting for: usbus0
> Root mount waiting for: usbus0
> uhub0: 26 ports with 26 removable, self powered
> Root mount waiting for: usbus0
> ugen0.2: <Sony Storage Media> at usbus0
> umass0 on uhub0
> umass0: <Sony Storage Media, class 0/0, rev 2.00/1.00, addr 1> on usbus0
> umass0:  SCSI over Bulk-Only; quirks = 0x8100
> umass0:0:0: Attached to scbus0
> da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
> da0: <Sony Storage Media 0100> Removable Direct Access SCSI device
> da0: Serial Number 0906061314564
> da0: 40.000MB/s transfers
> da0: 1983MB (4062208 512 byte sectors)
> da0: quirks=0x2<NO_6_BYTE>
> Root mount waiting for: usbus0
> ugen0.3: <SONiX USB DEVICE> at usbus0
> ukbd0 on uhub0
> ukbd0: <SONiX USB DEVICE, class 0/0, rev 2.00/1.05, addr 2> on usbus0
> kbd2 at ukbd0
> ukbd1 on uhub0
> ukbd1: <SONiX USB DEVICE, class 0/0, rev 2.00/1.05, addr 2> on usbus0
> kbd3 at ukbd1
> Root mount waiting for: usbus0
> ugen0.4: <Microsoft Basic Optical Mouse> at usbus0
> ugen0.5: <Generic USB3.0-CRW> at usbus0
> umass1 on uhub0
> umass1: <Bulk-In, Bulk-Out, Interface> on usbus0
> umass1:  SCSI over Bulk-Only; quirks = 0x4000
> umass1:1:1: Attached to scbus1
> (probe0:umass-sim1:1:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
> (probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error
> (probe0:umass-sim1:1:0:0): SCSI status: Check Condition
> (probe0:umass-sim1:1:0:0): SCSI sense: ILLEGAL REQUEST asc:24,0 (Invalid field in CDB)
> (probe0:umass-sim1:1:0:0): Error 22, Unretryable error
> da1 at umass-sim1 bus 1 scbus1 target 0 lun 0
> da1: <Generic- SD/MMC CRW 1.00> Removable Direct Access SPC-4 SCSI device
> da1: Serial Number 28203008282014000
> da1: 400.000MB/s transfers
> da1: Attempt to query device size failed: NOT READY, Medium not present
> da1: quirks=0x2<NO_6_BYTE>
> mountroot: waiting for device /dev/ufs/FreeBSD_Install...
> random: unblocking device.
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> arc4random: no preloaded entropy cache
> lo0: link state changed to UP
> em0: link state changed to UP
> ums0 on uhub0
> ums0: <Microsoft Basic Optical Mouse, class 0/0, rev 1.10/0.00, addr 3> on usbus0
> ums0: 3 buttons and [XYZ] coordinates ID=0
> ugen0.6: <vendor 0x058f product 0x6387> at usbus0
> umass2 on uhub0
> umass2: <vendor 0x058f product 0x6387, class 0/0, rev 2.00/1.05, addr 5> on usbus0
> umass2:  SCSI over Bulk-Only; quirks = 0x4101
> umass2:2:2: Attached to scbus2
> da2 at umass-sim2 bus 2 scbus2 target 0 lun 0
> da2: <  8.07> Removable Direct Access SPC-2 SCSI device
> da2: Serial Number 14040459000056
> da2: 40.000MB/s transfers
> da2: 7450MB (15257600 512 byte sectors)
> da2: quirks=0x2<NO_6_BYTE>
>
> [2:application/x-gunzip Show Save:dell_precision.asl.gz (167kB)]
>

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Theo Buehler-3
On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > From: Theo Buehler <[hidden email]>
>
> It would help if you could try and boot a kernel that adds some debug
> prints instead of calling aml_die().  Probably need to know the values
> of alen, bpos, blen, mode and flag for starters.

Thanks.

alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605

So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
and the aml_die("Invalid GenericSerialBus access") is hit because blen
is twice as long as it should be according to the conditional preceding
it:

        if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
            bpos & 0x3 || blen != 8)

If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
next aml_die("Could not find GenericSerialBus controller"); because
node->i2c == NULL.

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Mark Kettenis
> Date: Tue, 23 Mar 2021 16:56:33 +0100
> From: Theo Buehler <[hidden email]>
>
> On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > From: Theo Buehler <[hidden email]>
> >
> > It would help if you could try and boot a kernel that adds some debug
> > prints instead of calling aml_die().  Probably need to know the values
> > of alen, bpos, blen, mode and flag for starters.
>
> Thanks.
>
> alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
>
> So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> and the aml_die("Invalid GenericSerialBus access") is hit because blen
> is twice as long as it should be according to the conditional preceding
> it:
>
> if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
>    bpos & 0x3 || blen != 8)

Right, we need to figure out what this actually means.  The ACPI
standard isn't exactly clear on this...

> If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> next aml_die("Could not find GenericSerialBus controller"); because
> node->i2c == NULL.

If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
controller that attaches to PCI.  I suspect that it is dwiic(4).  D
you see dwiic(4) attach?

If so, the problem is that we dont't call acpi_register_gsb() for
dwiic(4) instances that attach to PCI.  I'll see if I can come up with
a diff for that.

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Theo Buehler-3
On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:

> > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > From: Theo Buehler <[hidden email]>
> >
> > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > From: Theo Buehler <[hidden email]>
> > >
> > > It would help if you could try and boot a kernel that adds some debug
> > > prints instead of calling aml_die().  Probably need to know the values
> > > of alen, bpos, blen, mode and flag for starters.
> >
> > Thanks.
> >
> > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> >
> > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > is twice as long as it should be according to the conditional preceding
> > it:
> >
> > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> >    bpos & 0x3 || blen != 8)
>
> Right, we need to figure out what this actually means.  The ACPI
> standard isn't exactly clear on this...
>
> > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > next aml_die("Could not find GenericSerialBus controller"); because
> > node->i2c == NULL.
>
> If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> you see dwiic(4) attach?

Two of them:

dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
iic0 at dwiic0
dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
iic1 at dwiic1

> If so, the problem is that we dont't call acpi_register_gsb() for
> dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> a diff for that.

Thanks a lot!

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Mark Kettenis
> Date: Tue, 23 Mar 2021 17:39:45 +0100
> From: Theo Buehler <[hidden email]>
>
> On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > From: Theo Buehler <[hidden email]>
> > >
> > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > From: Theo Buehler <[hidden email]>
> > > >
> > > > It would help if you could try and boot a kernel that adds some debug
> > > > prints instead of calling aml_die().  Probably need to know the values
> > > > of alen, bpos, blen, mode and flag for starters.
> > >
> > > Thanks.
> > >
> > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > >
> > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > is twice as long as it should be according to the conditional preceding
> > > it:
> > >
> > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > >    bpos & 0x3 || blen != 8)
> >
> > Right, we need to figure out what this actually means.  The ACPI
> > standard isn't exactly clear on this...
> >
> > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > next aml_die("Could not find GenericSerialBus controller"); because
> > > node->i2c == NULL.
> >
> > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > you see dwiic(4) attach?
>
> Two of them:
>
> dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> iic0 at dwiic0
> dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> iic1 at dwiic1
>
> > If so, the problem is that we dont't call acpi_register_gsb() for
> > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > a diff for that.
>
> Thanks a lot!

Can you try the diff below?


Index: dev/acpi/dsdt.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.261
diff -u -p -r1.261 dsdt.c
--- dev/acpi/dsdt.c 18 Mar 2021 00:17:26 -0000 1.261
+++ dev/acpi/dsdt.c 23 Mar 2021 19:27:34 -0000
@@ -2535,17 +2535,17 @@ aml_rwgsb(struct aml_value *conn, int al
  i2c_tag_t tag;
  i2c_op_t op;
  i2c_addr_t addr;
- int cmdlen, buflen;
+ int cmdlen, buflen, acclen;
  uint8_t cmd;
  uint8_t *buf;
- int err;
+ int pos, err;
 
  if (conn->type != AML_OBJTYPE_BUFFER || conn->length < 5 ||
     AML_CRSTYPE(crs) != LR_SERBUS || AML_CRSLEN(crs) > conn->length ||
     crs->lr_i2cbus.revid != 1 || crs->lr_i2cbus.type != LR_SERBUS_I2C)
  aml_die("Invalid GenericSerialBus");
  if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
-    bpos & 0x3 || blen != 8)
+    bpos & 0x3 || (blen % 8) != 0)
  aml_die("Invalid GenericSerialBus access");
 
  node = aml_searchname(conn->node,
@@ -2559,27 +2559,32 @@ aml_rwgsb(struct aml_value *conn, int al
  switch (AML_FIELD_ATTR(flag)) {
  case 0x02: /* AttribQuick */
  cmdlen = 0;
- buflen = 0;
+ buflen = acclen = 0;
  break;
  case 0x04: /* AttribSendReceive */
  cmdlen = 0;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x06: /* AttribByte */
  cmdlen = 1;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x08: /* AttribWord */
  cmdlen = 1;
- buflen = 2;
+ acclen = 2;
+ buflen = blen / 8;
  break;
  case 0x0b: /* AttribBytes */
  cmdlen = 1;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  case 0x0e: /* AttribRawBytes */
  cmdlen = 0;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2588,11 +2593,11 @@ aml_rwgsb(struct aml_value *conn, int al
  break;
  case 1: /* AttribBytes */
  cmdlen = 1;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  case 2: /* AttribRawBytes */
  cmdlen = 0;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2612,7 +2617,13 @@ aml_rwgsb(struct aml_value *conn, int al
  buf = val->v_buffer;
 
  iic_acquire_bus(tag, 0);
- err = iic_exec(tag, op, addr, &cmd, cmdlen, &buf[2], buflen, 0);
+ for (pos = 0; pos < buflen; pos += acclen) {
+ err = iic_exec(tag, op, addr, &cmd, cmdlen,
+    &buf[pos + 2], acclen, 0);
+ if (err)
+ break;
+ cmd++;
+ }
  iic_release_bus(tag, 0);
 
  /*
Index: dev/pci/dwiic_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
retrieving revision 1.15
diff -u -p -r1.15 dwiic_pci.c
--- dev/pci/dwiic_pci.c 25 Dec 2020 21:48:27 -0000 1.15
+++ dev/pci/dwiic_pci.c 23 Mar 2021 19:27:34 -0000
@@ -225,7 +225,12 @@ dwiic_pci_attach(struct device *parent,
 
  config_found((struct device *)sc, &sc->sc_iba, iicbus_print);
 
- return;
+#if NACPI > 0 && !defined(SMALL_KERNEL)
+ if (sc->sc_devnode) {
+ sc->sc_devnode->i2c = &sc->sc_i2c_tag;
+ acpi_register_gsb(acpi_softc, sc->sc_devnode);
+ }
+#endif
 }
 
 int

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Theo Buehler-3
On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:

> > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > From: Theo Buehler <[hidden email]>
> >
> > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > From: Theo Buehler <[hidden email]>
> > > >
> > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > From: Theo Buehler <[hidden email]>
> > > > >
> > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > of alen, bpos, blen, mode and flag for starters.
> > > >
> > > > Thanks.
> > > >
> > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > >
> > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > is twice as long as it should be according to the conditional preceding
> > > > it:
> > > >
> > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > >    bpos & 0x3 || blen != 8)
> > >
> > > Right, we need to figure out what this actually means.  The ACPI
> > > standard isn't exactly clear on this...
> > >
> > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > node->i2c == NULL.
> > >
> > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > you see dwiic(4) attach?
> >
> > Two of them:
> >
> > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > iic0 at dwiic0
> > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > iic1 at dwiic1
> >
> > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > a diff for that.
> >
> > Thanks a lot!
>
> Can you try the diff below?

This works. Awesome. Many thanks!

OpenBSD 6.9-beta (GENERIC.MP) #32: Tue Mar 23 20:32:41 CET 2021
    [hidden email]:/sys/arch/amd64/compile/GENERIC.MP
real mem = 34003664896 (32428MB)
avail mem = 32957722624 (31430MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.2 @ 0xe0000 (107 entries)
bios0: vendor Dell Inc. version "1.4.3" date 01/05/2021
bios0: Dell Inc. Precision 3640 Tower
acpi0 at bios0: ACPI 6.2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP MCFG SSDT SSDT FIDT BOOT SSDT SSDT HPET SSDT SSDT NHLT LPIT SSDT SSDT DBGP DBG2 SSDT MSDM SLIC DMAR BGRT ASF! APIC EINJ ERST BERT HEST FPDT
acpi0: wakeup devices PEG0(S4) PEGP(S4) PEG1(S4) PEGP(S4) PEG2(S4) PEGP(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP05(S4) PXSX(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimcfg0 at acpi0
acpimcfg0: addr 0xe0000000, bus 0-255
acpihpet0 at acpi0: 23999999 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3694.83 MHz, 06-a5-05
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 24MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3691.40 MHz, 06-a5-05
cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3691.40 MHz, 06-a5-05
cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 6 (application processor)
cpu3: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3691.40 MHz, 06-a5-05
cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 0, core 3, package 0
cpu4 at mainbus0: apid 8 (application processor)
cpu4: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3691.40 MHz, 06-a5-05
cpu4: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu4: 256KB 64b/line 8-way L2 cache
cpu4: smt 0, core 4, package 0
cpu5 at mainbus0: apid 10 (application processor)
cpu5: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3691.40 MHz, 06-a5-05
cpu5: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu5: 256KB 64b/line 8-way L2 cache
cpu5: smt 0, core 5, package 0
cpu6 at mainbus0: apid 12 (application processor)
cpu6: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3691.40 MHz, 06-a5-05
cpu6: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu6: 256KB 64b/line 8-way L2 cache
cpu6: smt 0, core 6, package 0
cpu7 at mainbus0: apid 14 (application processor)
cpu7: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3691.40 MHz, 06-a5-05
cpu7: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,PKU,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu7: 256KB 64b/line 8-way L2 cache
cpu7: smt 0, core 7, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 120 pins
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (PEG0)
acpiprt2 at acpi0: bus -1 (PEG1)
acpiprt3 at acpi0: bus -1 (PEG2)
acpiprt4 at acpi0: bus -1 (RP01)
acpiprt5 at acpi0: bus -1 (RP02)
acpiprt6 at acpi0: bus -1 (RP03)
acpiprt7 at acpi0: bus -1 (RP04)
acpiprt8 at acpi0: bus -1 (RP05)
acpiprt9 at acpi0: bus -1 (RP06)
acpiprt10 at acpi0: bus -1 (RP07)
acpiprt11 at acpi0: bus -1 (RP08)
acpiprt12 at acpi0: bus 2 (RP09)
acpiprt13 at acpi0: bus -1 (RP10)
acpiprt14 at acpi0: bus -1 (RP11)
acpiprt15 at acpi0: bus -1 (AMPB)
acpiprt16 at acpi0: bus -1 (RP12)
acpiprt17 at acpi0: bus -1 (RP13)
acpiprt18 at acpi0: bus -1 (RP14)
acpiprt19 at acpi0: bus -1 (RP15)
acpiprt20 at acpi0: bus -1 (RP16)
acpiprt21 at acpi0: bus -1 (RP17)
acpiprt22 at acpi0: bus -1 (RP18)
acpiprt23 at acpi0: bus -1 (RP19)
acpiprt24 at acpi0: bus -1 (RP20)
acpiprt25 at acpi0: bus -1 (RP21)
acpiprt26 at acpi0: bus -1 (RP22)
acpiprt27 at acpi0: bus -1 (RP23)
acpiprt28 at acpi0: bus -1 (RP24)
"PNP0C14" at acpi0 not configured
acpipci0 at acpi0 PCI0: 0x00000010 0x00000011 0x00000000
acpicmos0 at acpi0
"INT3450" at acpi0 not configured
"PNP0C14" at acpi0 not configured
acpibtn0 at acpi0: SLPB
"PNP0C14" at acpi0 not configured
"PNP0C14" at acpi0 not configured
"INT33A1" at acpi0 not configured
"CYP0004" at acpi0 not configured
acpibtn1 at acpi0: PWRB
"PNP0C14" at acpi0 not configured
"PNP0C14" at acpi0 not configured
"PNP0C14" at acpi0 not configured
"PNP0C14" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
acpipwrres0 at acpi0: DRST
acpipwrres1 at acpi0: QRST
acpipwrres2 at acpi0: DRST
acpipwrres3 at acpi0: QRST
acpipwrres4 at acpi0: DRST
acpipwrres5 at acpi0: QRST
acpipwrres6 at acpi0: DRST
acpipwrres7 at acpi0: QRST
acpipwrres8 at acpi0: DRST
acpipwrres9 at acpi0: QRST
acpipwrres10 at acpi0: DRST
acpipwrres11 at acpi0: QRST
acpipwrres12 at acpi0: DRST
acpipwrres13 at acpi0: QRST
acpipwrres14 at acpi0: DRST
acpipwrres15 at acpi0: QRST
acpipwrres16 at acpi0: DRST
acpipwrres17 at acpi0: QRST
acpipwrres18 at acpi0: DRST
acpipwrres19 at acpi0: QRST
acpipwrres20 at acpi0: DRST
acpipwrres21 at acpi0: QRST
acpipwrres22 at acpi0: DRST
acpipwrres23 at acpi0: QRST
acpipwrres24 at acpi0: DRST
acpipwrres25 at acpi0: QRST
acpipwrres26 at acpi0: DRST
acpipwrres27 at acpi0: QRST
acpipwrres28 at acpi0: DRST
acpipwrres29 at acpi0: QRST
acpipwrres30 at acpi0: DRST
acpipwrres31 at acpi0: QRST
acpipwrres32 at acpi0: DRST
acpipwrres33 at acpi0: QRST
acpipwrres34 at acpi0: DRST
acpipwrres35 at acpi0: QRST
acpipwrres36 at acpi0: DRST
acpipwrres37 at acpi0: QRST
acpipwrres38 at acpi0: DRST
acpipwrres39 at acpi0: QRST
acpipwrres40 at acpi0: DRST
acpipwrres41 at acpi0: QRST
acpipwrres42 at acpi0: DRST
acpipwrres43 at acpi0: QRST
acpipwrres44 at acpi0: DRST
acpipwrres45 at acpi0: QRST
acpipwrres46 at acpi0: DRST
acpipwrres47 at acpi0: QRST
acpipwrres48 at acpi0: USBC, resource for XDCI
acpipwrres49 at acpi0: V0PR
acpipwrres50 at acpi0: V1PR
acpipwrres51 at acpi0: V2PR
acpipwrres52 at acpi0: WRST
acpicpu0 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu4 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu5 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu6 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu7 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpipwrres53 at acpi0: FN00, resource for FAN0
acpipwrres54 at acpi0: FN01, resource for FAN1
acpipwrres55 at acpi0: FN02, resource for FAN2
acpipwrres56 at acpi0: FN03, resource for FAN3
acpipwrres57 at acpi0: FN04, resource for FAN4
acpitz0 at acpi0: critical temperature is 119 degC
acpipwrres58 at acpi0: PIN_
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD1F
cpu0: Enhanced SpeedStep 3694 MHz: speeds: 3701, 3700, 3500, 3400, 3200, 2900, 2700, 2500, 2300, 2100, 1900, 1700, 1400, 1200, 1000, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 10G Host" rev 0x05
ppb0 at pci0 dev 1 function 0 "Intel Core 6G PCIE" rev 0x05: msi
pci1 at ppb0 bus 1
nvme0 at pci1 dev 0 function 0 vendor "Marvell", unknown product 0x2241 rev 0x20: msix, NVMe 1.3
nvme0: WD_BLACK AN1500, firmware 10271043, serial WUBT21221108
scsibus1 at nvme0: 5 targets, initiator 0
sd0 at scsibus1 targ 1 lun 0: <NVMe, WD_BLACK AN1500, 1027>
sd0: 953752MB, 512 bytes/sector, 1953284096 sectors
inteldrm0 at pci0 dev 2 function 0 "Intel UHD Graphics 630" rev 0x05
drm0 at inteldrm0
inteldrm0: msi, COFFEELAKE, gen 9
"Intel Core GMM" rev 0x00 at pci0 dev 8 function 0 not configured
pchtemp0 at pci0 dev 18 function 0 "Intel 400 Series Thermal" rev 0x00
xhci0 at pci0 dev 20 function 0 "Intel 400 Series xHCI" rev 0x00: msi, xHCI 1.10
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1
"Intel 400 Series Shared SRAM" rev 0x00 at pci0 dev 20 function 2 not configured
dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
iic0 at dwiic0
dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
iic1 at dwiic1
"Intel 400 Series HECI" rev 0x00 at pci0 dev 22 function 0 not configured
ahci0 at pci0 dev 23 function 0 "Intel 400 Series AHCI" rev 0x00: msi, AHCI 1.3.1
ahci0: PHY offline on port 0
ahci0: port 1: 1.5Gb/s
ahci0: PHY offline on port 2
ahci0: PHY offline on port 3
scsibus2 at ahci0: 32 targets
cd0 at scsibus2 targ 1 lun 0: <HL-DT-ST, DVD+-RW GU90N, A1C5> removable
ppb1 at pci0 dev 29 function 0 "Intel 400 Series PCIE" rev 0xf0: msi
pci2 at ppb1 bus 2
nvme1 at pci2 dev 0 function 0 vendor "Toshiba", unknown product 0x011a rev 0x00: msix, NVMe 1.3
nvme1: KXG60ZNV512G NVMe KIOXIA 512GB, firmware 10604107, serial X0SF72UKFPB1
scsibus3 at nvme1: 2 targets, initiator 0
sd1 at scsibus3 targ 1 lun 0: <NVMe, KXG60ZNV512G NVM, 1060>
sd1: 488386MB, 512 bytes/sector, 1000215216 sectors
"Intel 400 Series UART" rev 0x00 at pci0 dev 30 function 0 not configured
pcib0 at pci0 dev 31 function 0 "Intel W480 LPC" rev 0x00
azalia0 at pci0 dev 31 function 3 "Intel 400 Series cAVS" rev 0x00: msi
azalia0: codecs: Realtek ALC256, Intel/0x280b, using Realtek ALC256
audio0 at azalia0
ichiic0 at pci0 dev 31 function 4 "Intel 400 Series SMBus" rev 0x00: apic 2 int 16
iic2 at ichiic0
"Intel 400 Series SPI" rev 0x00 at pci0 dev 31 function 5 not configured
em0 at pci0 dev 31 function 6 "Intel I219-LM" rev 0x00: msi, address a4:bb:6d:5b:43:8e
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vmm0 at mainbus0: VMX/EPT
efifb at mainbus0 not configured
umass0 at uhub0 port 1 configuration 1 interface 0 " " rev 2.00/1.05 addr 2
umass0: using SCSI over Bulk-Only
scsibus4 at umass0: 2 targets, initiator 0
sd2 at scsibus4 targ 1 lun 0: <, , 8.07> removable serial.058f6387040459000056
sd2: 7450MB, 512 bytes/sector, 15257600 sectors
uhidev0 at uhub0 port 2 configuration 1 interface 0 "SONiX USB DEVICE" rev 2.00/1.05 addr 3
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes
wskbd1 at ukbd0 mux 1
uhidev1 at uhub0 port 2 configuration 1 interface 1 "SONiX USB DEVICE" rev 2.00/1.05 addr 3
uhidev1: iclass 3/1, 4 report ids
ukbd1 at uhidev1 reportid 1: 120 variable keys, 0 key codes
wskbd2 at ukbd1 mux 1
uhid0 at uhidev1 reportid 2: input=1, output=0, feature=0
uhid1 at uhidev1 reportid 3: input=2, output=0, feature=0
uhid2 at uhidev1 reportid 4: input=63, output=63, feature=0
uhidev2 at uhub0 port 11 configuration 1 interface 0 "Microsoft Basic Optical Mouse" rev 1.10/0.00 addr 4
uhidev2: iclass 3/1
ums0 at uhidev2: 3 buttons, Z dir
wsmouse0 at ums0 mux 0
umass1 at uhub0 port 25 configuration 1 interface 0 "Generic USB3.0-CRW" rev 3.00/29.08 addr 5
umass1: using SCSI over Bulk-Only
scsibus5 at umass1: 2 targets, initiator 0
sd3 at scsibus5 targ 1 lun 0: <Generic-, SD/MMC CRW, 1.00> removable serial.0bda0328008282014000
vscsi0 at root
scsibus6 at vscsi0: 256 targets
softraid0 at root
scsibus7 at softraid0: 256 targets
root on sd2a (5427e01183e9ce88.a) swap on sd2b dump on sd2b
drm:pid7680:csr_load_work_fn *NOTICE* [drm] Failed to load DMC firmware i915/kbl_dmc_ver1_04.bin. Disabling runtime power management.
drm:pid7680:csr_load_work_fn *NOTICE* [drm] DMC firmware homepage: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915inteldrm0: 2560x1440, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wskbd1: connecting to wsdisplay0
wskbd2: connecting to wsdisplay0
wsdisplay0: screen 1-5 added (std, vt100 emulation)

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Theo Buehler-3
In reply to this post by Mark Kettenis
On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:

> > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > From: Theo Buehler <[hidden email]>
> >
> > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > From: Theo Buehler <[hidden email]>
> > > >
> > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > From: Theo Buehler <[hidden email]>
> > > > >
> > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > of alen, bpos, blen, mode and flag for starters.
> > > >
> > > > Thanks.
> > > >
> > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > >
> > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > is twice as long as it should be according to the conditional preceding
> > > > it:
> > > >
> > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > >    bpos & 0x3 || blen != 8)
> > >
> > > Right, we need to figure out what this actually means.  The ACPI
> > > standard isn't exactly clear on this...
> > >
> > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > node->i2c == NULL.
> > >
> > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > you see dwiic(4) attach?
> >
> > Two of them:
> >
> > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > iic0 at dwiic0
> > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > iic1 at dwiic1
> >
> > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > a diff for that.
> >
> > Thanks a lot!
>
> Can you try the diff below?

I tried to install a release built with this. With miniroot69.img I
still hit the reboot loop described in my first mail:

...
wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
aml_rwgen: unregistered RegionSpace 0x9
Could not convert 0 to 3

panic: aml_die aml_convert: 2095
syncing disks...uvmfault(0xffffffff818e5d78, 0xbc8, 0, 1) -> e
fatal page fault in supervisor mode
trap type 6 code 0 rip ffffffff810e216b cs 8 rflags 10286 cr2 bc8 cpl 0 rsp ffff80001f76f120
gsbase 0xffffffff818d0ff0 kgsbase 0x0
panic trap type 6, code=0, pc=ffffffff810e216b

dump to dev 17,1 not possible
rebooting...

I tried to move acpi_register_gsb() and the call to it in dwiic_pci.c
out of SMALL_KERNEL, but that didn't help.

What info would be useful to debug this further?

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Mark Kettenis
> Date: Wed, 24 Mar 2021 09:47:56 +0100
> From: Theo Buehler <[hidden email]>
>
> On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:
> > > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > > From: Theo Buehler <[hidden email]>
> > >
> > > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > > From: Theo Buehler <[hidden email]>
> > > > >
> > > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > > From: Theo Buehler <[hidden email]>
> > > > > >
> > > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > > of alen, bpos, blen, mode and flag for starters.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > > >
> > > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > > is twice as long as it should be according to the conditional preceding
> > > > > it:
> > > > >
> > > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > > >    bpos & 0x3 || blen != 8)
> > > >
> > > > Right, we need to figure out what this actually means.  The ACPI
> > > > standard isn't exactly clear on this...
> > > >
> > > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > > node->i2c == NULL.
> > > >
> > > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > > you see dwiic(4) attach?
> > >
> > > Two of them:
> > >
> > > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > > iic0 at dwiic0
> > > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > > iic1 at dwiic1
> > >
> > > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > > a diff for that.
> > >
> > > Thanks a lot!
> >
> > Can you try the diff below?
>
> I tried to install a release built with this. With miniroot69.img I
> still hit the reboot loop described in my first mail:
>
> ...
> wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
> aml_rwgen: unregistered RegionSpace 0x9
> Could not convert 0 to 3
>
> panic: aml_die aml_convert: 2095
> syncing disks...uvmfault(0xffffffff818e5d78, 0xbc8, 0, 1) -> e
> fatal page fault in supervisor mode
> trap type 6 code 0 rip ffffffff810e216b cs 8 rflags 10286 cr2 bc8 cpl 0 rsp ffff80001f76f120
> gsbase 0xffffffff818d0ff0 kgsbase 0x0
> panic trap type 6, code=0, pc=ffffffff810e216b
>
> dump to dev 17,1 not possible
> rebooting...
>
> I tried to move acpi_register_gsb() and the call to it in dwiic_pci.c
> out of SMALL_KERNEL, but that didn't help.
>
> What info would be useful to debug this further?

SMALL_KERNEL deliberately doesn't GenericSerialBus support as this
requires the presence of a whole set of I2C drivers that we have no
space for on the install media.

This machine violates the ACPI spec, since the AML should check that
the i2c bus is actually available before using it.  But pointing this
out to Dell is probably not going to help.

Here is a diff that may work better.  The GenericSerialBuffer stuff
allows us to propagate the status of an I2C transfer back up the
chain.  So here is a diff that simply returns EIO if the controller
can't be found.



Index: dev/acpi/dsdt.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.261
diff -u -p -r1.261 dsdt.c
--- dev/acpi/dsdt.c 18 Mar 2021 00:17:26 -0000 1.261
+++ dev/acpi/dsdt.c 24 Mar 2021 16:05:29 -0000
@@ -2535,51 +2535,53 @@ aml_rwgsb(struct aml_value *conn, int al
  i2c_tag_t tag;
  i2c_op_t op;
  i2c_addr_t addr;
- int cmdlen, buflen;
+ int cmdlen, buflen, acclen;
  uint8_t cmd;
  uint8_t *buf;
- int err;
+ int pos, err;
 
  if (conn->type != AML_OBJTYPE_BUFFER || conn->length < 5 ||
     AML_CRSTYPE(crs) != LR_SERBUS || AML_CRSLEN(crs) > conn->length ||
     crs->lr_i2cbus.revid != 1 || crs->lr_i2cbus.type != LR_SERBUS_I2C)
  aml_die("Invalid GenericSerialBus");
  if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
-    bpos & 0x3 || blen != 8)
+    bpos & 0x3 || (blen % 8) != 0)
  aml_die("Invalid GenericSerialBus access");
 
  node = aml_searchname(conn->node,
     (char *)&crs->lr_i2cbus.vdata[crs->lr_i2cbus.tlength - 6]);
 
- if (node == NULL || node->i2c == NULL)
- aml_die("Could not find GenericSerialBus controller");
-
  switch (((flag >> 6) & 0x3)) {
  case 0: /* Normal */
  switch (AML_FIELD_ATTR(flag)) {
  case 0x02: /* AttribQuick */
  cmdlen = 0;
- buflen = 0;
+ buflen = acclen = 0;
  break;
  case 0x04: /* AttribSendReceive */
  cmdlen = 0;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x06: /* AttribByte */
  cmdlen = 1;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x08: /* AttribWord */
  cmdlen = 1;
- buflen = 2;
+ acclen = 2;
+ buflen = blen / 8;
  break;
  case 0x0b: /* AttribBytes */
  cmdlen = 1;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  case 0x0e: /* AttribRawBytes */
  cmdlen = 0;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2588,11 +2590,11 @@ aml_rwgsb(struct aml_value *conn, int al
  break;
  case 1: /* AttribBytes */
  cmdlen = 1;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  case 2: /* AttribRawBytes */
  cmdlen = 0;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2606,13 +2608,32 @@ aml_rwgsb(struct aml_value *conn, int al
  op = I2C_OP_WRITE_WITH_STOP;
  }
 
+ buf = val->v_buffer;
+
+ /*
+ * Return an error if we can't find the I2C controller that
+ * we're supposed to use for this request.  This shouldn't
+ * happen as AML should only make use of GenericSerialBus
+ * address space after verifying that support for it has been
+ * registered.
+ */
+ if (node == NULL || node->i2c == NULL) {
+ buf[0] = EIO;
+ return;
+ }
+
  tag = node->i2c;
  addr = crs->lr_i2cbus._adr;
  cmd = bpos >> 3;
- buf = val->v_buffer;
 
  iic_acquire_bus(tag, 0);
- err = iic_exec(tag, op, addr, &cmd, cmdlen, &buf[2], buflen, 0);
+ for (pos = 0; pos < buflen; pos += acclen) {
+ err = iic_exec(tag, op, addr, &cmd, cmdlen,
+    &buf[pos + 2], acclen, 0);
+ if (err)
+ break;
+ cmd++;
+ }
  iic_release_bus(tag, 0);
 
  /*
Index: dev/pci/dwiic_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
retrieving revision 1.15
diff -u -p -r1.15 dwiic_pci.c
--- dev/pci/dwiic_pci.c 25 Dec 2020 21:48:27 -0000 1.15
+++ dev/pci/dwiic_pci.c 24 Mar 2021 16:05:29 -0000
@@ -225,7 +225,12 @@ dwiic_pci_attach(struct device *parent,
 
  config_found((struct device *)sc, &sc->sc_iba, iicbus_print);
 
- return;
+#if NACPI > 0 && !defined(SMALL_KERNEL)
+ if (sc->sc_devnode) {
+ sc->sc_devnode->i2c = &sc->sc_i2c_tag;
+ acpi_register_gsb(acpi_softc, sc->sc_devnode);
+ }
+#endif
 }
 
 int

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Theo Buehler-3
On Wed, Mar 24, 2021 at 05:11:52PM +0100, Mark Kettenis wrote:

> > Date: Wed, 24 Mar 2021 09:47:56 +0100
> > From: Theo Buehler <[hidden email]>
> >
> > On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:
> > > > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > > > From: Theo Buehler <[hidden email]>
> > > >
> > > > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > > > From: Theo Buehler <[hidden email]>
> > > > > >
> > > > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > >
> > > > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > > > of alen, bpos, blen, mode and flag for starters.
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > > > >
> > > > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > > > is twice as long as it should be according to the conditional preceding
> > > > > > it:
> > > > > >
> > > > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > > > >    bpos & 0x3 || blen != 8)
> > > > >
> > > > > Right, we need to figure out what this actually means.  The ACPI
> > > > > standard isn't exactly clear on this...
> > > > >
> > > > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > > > node->i2c == NULL.
> > > > >
> > > > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > > > you see dwiic(4) attach?
> > > >
> > > > Two of them:
> > > >
> > > > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > > > iic0 at dwiic0
> > > > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > > > iic1 at dwiic1
> > > >
> > > > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > > > a diff for that.
> > > >
> > > > Thanks a lot!
> > >
> > > Can you try the diff below?
> >
> > I tried to install a release built with this. With miniroot69.img I
> > still hit the reboot loop described in my first mail:
> >
> > ...
> > wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
> > aml_rwgen: unregistered RegionSpace 0x9
> > Could not convert 0 to 3
> >
> > panic: aml_die aml_convert: 2095
> > syncing disks...uvmfault(0xffffffff818e5d78, 0xbc8, 0, 1) -> e
> > fatal page fault in supervisor mode
> > trap type 6 code 0 rip ffffffff810e216b cs 8 rflags 10286 cr2 bc8 cpl 0 rsp ffff80001f76f120
> > gsbase 0xffffffff818d0ff0 kgsbase 0x0
> > panic trap type 6, code=0, pc=ffffffff810e216b
> >
> > dump to dev 17,1 not possible
> > rebooting...
> >
> > I tried to move acpi_register_gsb() and the call to it in dwiic_pci.c
> > out of SMALL_KERNEL, but that didn't help.
> >
> > What info would be useful to debug this further?
>
> SMALL_KERNEL deliberately doesn't GenericSerialBus support as this
> requires the presence of a whole set of I2C drivers that we have no
> space for on the install media.
>
> This machine violates the ACPI spec, since the AML should check that
> the i2c bus is actually available before using it.  But pointing this
> out to Dell is probably not going to help.
>
> Here is a diff that may work better.  The GenericSerialBuffer stuff
> allows us to propagate the status of an I2C transfer back up the
> chain.  So here is a diff that simply returns EIO if the controller
> can't be found.

The new blen and EIO logic isn't included in bsd.rd since aml_rwgsb() is
inside #ifndef SMALL_KERNEL.  We instead fall back to aml_rwgen() in the
switch over ref1->v_opregion.iospace in aml_rwfield().

The diff below gives me a working bsd.rd. It pushes SMALL_KERNEL down a
bit so as to only guard iic_exec(), but perhaps it would be preferable
to signal the error from aml_rwfield() instead (I don't know how).

Index: dev/acpi/dsdt.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.261
diff -u -p -r1.261 dsdt.c
--- dev/acpi/dsdt.c 18 Mar 2021 00:17:26 -0000 1.261
+++ dev/acpi/dsdt.c 25 Mar 2021 06:44:48 -0000
@@ -2524,8 +2524,6 @@ aml_rwgpio(struct aml_value *conn, int b
  }
 }
 
-#ifndef SMALL_KERNEL
-
 void
 aml_rwgsb(struct aml_value *conn, int alen, int bpos, int blen,
     struct aml_value *val, int mode, int flag)
@@ -2535,51 +2533,56 @@ aml_rwgsb(struct aml_value *conn, int al
  i2c_tag_t tag;
  i2c_op_t op;
  i2c_addr_t addr;
- int cmdlen, buflen;
+ int cmdlen, buflen, acclen;
  uint8_t cmd;
  uint8_t *buf;
- int err;
+#ifndef SMALL_KERNEL
+ int pos;
+#endif
+ int err = 0;
 
  if (conn->type != AML_OBJTYPE_BUFFER || conn->length < 5 ||
     AML_CRSTYPE(crs) != LR_SERBUS || AML_CRSLEN(crs) > conn->length ||
     crs->lr_i2cbus.revid != 1 || crs->lr_i2cbus.type != LR_SERBUS_I2C)
  aml_die("Invalid GenericSerialBus");
  if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
-    bpos & 0x3 || blen != 8)
+    bpos & 0x3 || (blen % 8) != 0)
  aml_die("Invalid GenericSerialBus access");
 
  node = aml_searchname(conn->node,
     (char *)&crs->lr_i2cbus.vdata[crs->lr_i2cbus.tlength - 6]);
 
- if (node == NULL || node->i2c == NULL)
- aml_die("Could not find GenericSerialBus controller");
-
  switch (((flag >> 6) & 0x3)) {
  case 0: /* Normal */
  switch (AML_FIELD_ATTR(flag)) {
  case 0x02: /* AttribQuick */
  cmdlen = 0;
- buflen = 0;
+ buflen = acclen = 0;
  break;
  case 0x04: /* AttribSendReceive */
  cmdlen = 0;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x06: /* AttribByte */
  cmdlen = 1;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x08: /* AttribWord */
  cmdlen = 1;
- buflen = 2;
+ acclen = 2;
+ buflen = blen / 8;
  break;
  case 0x0b: /* AttribBytes */
  cmdlen = 1;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  case 0x0e: /* AttribRawBytes */
  cmdlen = 0;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2588,11 +2591,11 @@ aml_rwgsb(struct aml_value *conn, int al
  break;
  case 1: /* AttribBytes */
  cmdlen = 1;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  case 2: /* AttribRawBytes */
  cmdlen = 0;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2606,14 +2609,35 @@ aml_rwgsb(struct aml_value *conn, int al
  op = I2C_OP_WRITE_WITH_STOP;
  }
 
+ buf = val->v_buffer;
+
+ /*
+ * Return an error if we can't find the I2C controller that
+ * we're supposed to use for this request.  This shouldn't
+ * happen as AML should only make use of GenericSerialBus
+ * address space after verifying that support for it has been
+ * registered.
+ */
+ if (node == NULL || node->i2c == NULL) {
+ buf[0] = EIO;
+ return;
+ }
+
  tag = node->i2c;
  addr = crs->lr_i2cbus._adr;
  cmd = bpos >> 3;
- buf = val->v_buffer;
 
+#ifndef SMALL_KERNEL
  iic_acquire_bus(tag, 0);
- err = iic_exec(tag, op, addr, &cmd, cmdlen, &buf[2], buflen, 0);
+ for (pos = 0; pos < buflen; pos += acclen) {
+ err = iic_exec(tag, op, addr, &cmd, cmdlen,
+    &buf[pos + 2], acclen, 0);
+ if (err)
+ break;
+ cmd++;
+ }
  iic_release_bus(tag, 0);
+#endif
 
  /*
  * The ACPI specification doesn't tell us what the status
@@ -2624,8 +2648,6 @@ aml_rwgsb(struct aml_value *conn, int al
  buf[0] = err;
 }
 
-#endif
-
 void
 aml_rwindexfield(struct aml_value *fld, struct aml_value *val, int mode)
 {
@@ -2727,13 +2749,11 @@ aml_rwfield(struct aml_value *fld, int b
  aml_rwgpio(ref2, bpos, blen, val, mode,
     fld->v_field.flags);
  break;
-#ifndef SMALL_KERNEL
  case ACPI_OPREG_GSB:
  aml_rwgsb(ref2, fld->v_field.ref3,
     fld->v_field.bitpos + bpos, blen,
     val, mode, fld->v_field.flags);
  break;
-#endif
  default:
  aml_rwgen(ref1, fld->v_field.bitpos + bpos, blen,
     val, mode, fld->v_field.flags);
Index: dev/pci/dwiic_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
retrieving revision 1.15
diff -u -p -r1.15 dwiic_pci.c
--- dev/pci/dwiic_pci.c 25 Dec 2020 21:48:27 -0000 1.15
+++ dev/pci/dwiic_pci.c 24 Mar 2021 18:48:46 -0000
@@ -225,7 +225,12 @@ dwiic_pci_attach(struct device *parent,
 
  config_found((struct device *)sc, &sc->sc_iba, iicbus_print);
 
- return;
+#if NACPI > 0 && !defined(SMALL_KERNEL)
+ if (sc->sc_devnode) {
+ sc->sc_devnode->i2c = &sc->sc_i2c_tag;
+ acpi_register_gsb(acpi_softc, sc->sc_devnode);
+ }
+#endif
 }
 
 int

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Theo Buehler-3
On Thu, Mar 25, 2021 at 08:00:57AM +0100, Theo Buehler wrote:

> On Wed, Mar 24, 2021 at 05:11:52PM +0100, Mark Kettenis wrote:
> > > Date: Wed, 24 Mar 2021 09:47:56 +0100
> > > From: Theo Buehler <[hidden email]>
> > >
> > > On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:
> > > > > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > > > > From: Theo Buehler <[hidden email]>
> > > > >
> > > > > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > >
> > > > > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > > >
> > > > > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > > > > of alen, bpos, blen, mode and flag for starters.
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > > > > >
> > > > > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > > > > is twice as long as it should be according to the conditional preceding
> > > > > > > it:
> > > > > > >
> > > > > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > > > > >    bpos & 0x3 || blen != 8)
> > > > > >
> > > > > > Right, we need to figure out what this actually means.  The ACPI
> > > > > > standard isn't exactly clear on this...
> > > > > >
> > > > > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > > > > node->i2c == NULL.
> > > > > >
> > > > > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > > > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > > > > you see dwiic(4) attach?
> > > > >
> > > > > Two of them:
> > > > >
> > > > > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > > > > iic0 at dwiic0
> > > > > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > > > > iic1 at dwiic1
> > > > >
> > > > > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > > > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > > > > a diff for that.
> > > > >
> > > > > Thanks a lot!
> > > >
> > > > Can you try the diff below?
> > >
> > > I tried to install a release built with this. With miniroot69.img I
> > > still hit the reboot loop described in my first mail:
> > >
> > > ...
> > > wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
> > > aml_rwgen: unregistered RegionSpace 0x9
> > > Could not convert 0 to 3
> > >
> > > panic: aml_die aml_convert: 2095
> > > syncing disks...uvmfault(0xffffffff818e5d78, 0xbc8, 0, 1) -> e
> > > fatal page fault in supervisor mode
> > > trap type 6 code 0 rip ffffffff810e216b cs 8 rflags 10286 cr2 bc8 cpl 0 rsp ffff80001f76f120
> > > gsbase 0xffffffff818d0ff0 kgsbase 0x0
> > > panic trap type 6, code=0, pc=ffffffff810e216b
> > >
> > > dump to dev 17,1 not possible
> > > rebooting...
> > >
> > > I tried to move acpi_register_gsb() and the call to it in dwiic_pci.c
> > > out of SMALL_KERNEL, but that didn't help.
> > >
> > > What info would be useful to debug this further?
> >
> > SMALL_KERNEL deliberately doesn't GenericSerialBus support as this
> > requires the presence of a whole set of I2C drivers that we have no
> > space for on the install media.
> >
> > This machine violates the ACPI spec, since the AML should check that
> > the i2c bus is actually available before using it.  But pointing this
> > out to Dell is probably not going to help.
> >
> > Here is a diff that may work better.  The GenericSerialBuffer stuff
> > allows us to propagate the status of an I2C transfer back up the
> > chain.  So here is a diff that simply returns EIO if the controller
> > can't be found.
>
> The new blen and EIO logic isn't included in bsd.rd since aml_rwgsb() is
> inside #ifndef SMALL_KERNEL.  We instead fall back to aml_rwgen() in the
> switch over ref1->v_opregion.iospace in aml_rwfield().
>
> The diff below gives me a working bsd.rd. It pushes SMALL_KERNEL down a
> bit so as to only guard iic_exec(), but perhaps it would be preferable
> to signal the error from aml_rwfield() instead (I don't know how).

Sorry, I meant "signal the error from aml_rwgen()".

>
> Index: dev/acpi/dsdt.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
> retrieving revision 1.261
> diff -u -p -r1.261 dsdt.c
> --- dev/acpi/dsdt.c 18 Mar 2021 00:17:26 -0000 1.261
> +++ dev/acpi/dsdt.c 25 Mar 2021 06:44:48 -0000
> @@ -2524,8 +2524,6 @@ aml_rwgpio(struct aml_value *conn, int b
>   }
>  }
>  
> -#ifndef SMALL_KERNEL
> -
>  void
>  aml_rwgsb(struct aml_value *conn, int alen, int bpos, int blen,
>      struct aml_value *val, int mode, int flag)
> @@ -2535,51 +2533,56 @@ aml_rwgsb(struct aml_value *conn, int al
>   i2c_tag_t tag;
>   i2c_op_t op;
>   i2c_addr_t addr;
> - int cmdlen, buflen;
> + int cmdlen, buflen, acclen;
>   uint8_t cmd;
>   uint8_t *buf;
> - int err;
> +#ifndef SMALL_KERNEL
> + int pos;
> +#endif
> + int err = 0;
>  
>   if (conn->type != AML_OBJTYPE_BUFFER || conn->length < 5 ||
>      AML_CRSTYPE(crs) != LR_SERBUS || AML_CRSLEN(crs) > conn->length ||
>      crs->lr_i2cbus.revid != 1 || crs->lr_i2cbus.type != LR_SERBUS_I2C)
>   aml_die("Invalid GenericSerialBus");
>   if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> -    bpos & 0x3 || blen != 8)
> +    bpos & 0x3 || (blen % 8) != 0)
>   aml_die("Invalid GenericSerialBus access");
>  
>   node = aml_searchname(conn->node,
>      (char *)&crs->lr_i2cbus.vdata[crs->lr_i2cbus.tlength - 6]);
>  
> - if (node == NULL || node->i2c == NULL)
> - aml_die("Could not find GenericSerialBus controller");
> -
>   switch (((flag >> 6) & 0x3)) {
>   case 0: /* Normal */
>   switch (AML_FIELD_ATTR(flag)) {
>   case 0x02: /* AttribQuick */
>   cmdlen = 0;
> - buflen = 0;
> + buflen = acclen = 0;
>   break;
>   case 0x04: /* AttribSendReceive */
>   cmdlen = 0;
> - buflen = 1;
> + acclen = 1;
> + buflen = blen / 8;
>   break;
>   case 0x06: /* AttribByte */
>   cmdlen = 1;
> - buflen = 1;
> + acclen = 1;
> + buflen = blen / 8;
>   break;
>   case 0x08: /* AttribWord */
>   cmdlen = 1;
> - buflen = 2;
> + acclen = 2;
> + buflen = blen / 8;
>   break;
>   case 0x0b: /* AttribBytes */
>   cmdlen = 1;
> - buflen = alen;
> + acclen = alen;
> + buflen = blen / 8;
>   break;
>   case 0x0e: /* AttribRawBytes */
>   cmdlen = 0;
> - buflen = alen;
> + acclen = alen;
> + buflen = blen / 8;
>   break;
>   default:
>   aml_die("unsupported access type 0x%x", flag);
> @@ -2588,11 +2591,11 @@ aml_rwgsb(struct aml_value *conn, int al
>   break;
>   case 1: /* AttribBytes */
>   cmdlen = 1;
> - buflen = AML_FIELD_ATTR(flag);
> + acclen = buflen = AML_FIELD_ATTR(flag);
>   break;
>   case 2: /* AttribRawBytes */
>   cmdlen = 0;
> - buflen = AML_FIELD_ATTR(flag);
> + acclen = buflen = AML_FIELD_ATTR(flag);
>   break;
>   default:
>   aml_die("unsupported access type 0x%x", flag);
> @@ -2606,14 +2609,35 @@ aml_rwgsb(struct aml_value *conn, int al
>   op = I2C_OP_WRITE_WITH_STOP;
>   }
>  
> + buf = val->v_buffer;
> +
> + /*
> + * Return an error if we can't find the I2C controller that
> + * we're supposed to use for this request.  This shouldn't
> + * happen as AML should only make use of GenericSerialBus
> + * address space after verifying that support for it has been
> + * registered.
> + */
> + if (node == NULL || node->i2c == NULL) {
> + buf[0] = EIO;
> + return;
> + }
> +
>   tag = node->i2c;
>   addr = crs->lr_i2cbus._adr;
>   cmd = bpos >> 3;
> - buf = val->v_buffer;
>  
> +#ifndef SMALL_KERNEL
>   iic_acquire_bus(tag, 0);
> - err = iic_exec(tag, op, addr, &cmd, cmdlen, &buf[2], buflen, 0);
> + for (pos = 0; pos < buflen; pos += acclen) {
> + err = iic_exec(tag, op, addr, &cmd, cmdlen,
> +    &buf[pos + 2], acclen, 0);
> + if (err)
> + break;
> + cmd++;
> + }
>   iic_release_bus(tag, 0);
> +#endif
>  
>   /*
>   * The ACPI specification doesn't tell us what the status
> @@ -2624,8 +2648,6 @@ aml_rwgsb(struct aml_value *conn, int al
>   buf[0] = err;
>  }
>  
> -#endif
> -
>  void
>  aml_rwindexfield(struct aml_value *fld, struct aml_value *val, int mode)
>  {
> @@ -2727,13 +2749,11 @@ aml_rwfield(struct aml_value *fld, int b
>   aml_rwgpio(ref2, bpos, blen, val, mode,
>      fld->v_field.flags);
>   break;
> -#ifndef SMALL_KERNEL
>   case ACPI_OPREG_GSB:
>   aml_rwgsb(ref2, fld->v_field.ref3,
>      fld->v_field.bitpos + bpos, blen,
>      val, mode, fld->v_field.flags);
>   break;
> -#endif
>   default:
>   aml_rwgen(ref1, fld->v_field.bitpos + bpos, blen,
>      val, mode, fld->v_field.flags);
> Index: dev/pci/dwiic_pci.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 dwiic_pci.c
> --- dev/pci/dwiic_pci.c 25 Dec 2020 21:48:27 -0000 1.15
> +++ dev/pci/dwiic_pci.c 24 Mar 2021 18:48:46 -0000
> @@ -225,7 +225,12 @@ dwiic_pci_attach(struct device *parent,
>  
>   config_found((struct device *)sc, &sc->sc_iba, iicbus_print);
>  
> - return;
> +#if NACPI > 0 && !defined(SMALL_KERNEL)
> + if (sc->sc_devnode) {
> + sc->sc_devnode->i2c = &sc->sc_i2c_tag;
> + acpi_register_gsb(acpi_softc, sc->sc_devnode);
> + }
> +#endif
>  }
>  
>  int

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Mark Kettenis
In reply to this post by Theo Buehler-3
> Date: Thu, 25 Mar 2021 08:00:56 +0100
> From: Theo Buehler <[hidden email]>
>
> On Wed, Mar 24, 2021 at 05:11:52PM +0100, Mark Kettenis wrote:
> > > Date: Wed, 24 Mar 2021 09:47:56 +0100
> > > From: Theo Buehler <[hidden email]>
> > >
> > > On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:
> > > > > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > > > > From: Theo Buehler <[hidden email]>
> > > > >
> > > > > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > >
> > > > > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > > >
> > > > > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > > > > of alen, bpos, blen, mode and flag for starters.
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > > > > >
> > > > > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > > > > is twice as long as it should be according to the conditional preceding
> > > > > > > it:
> > > > > > >
> > > > > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > > > > >    bpos & 0x3 || blen != 8)
> > > > > >
> > > > > > Right, we need to figure out what this actually means.  The ACPI
> > > > > > standard isn't exactly clear on this...
> > > > > >
> > > > > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > > > > node->i2c == NULL.
> > > > > >
> > > > > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > > > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > > > > you see dwiic(4) attach?
> > > > >
> > > > > Two of them:
> > > > >
> > > > > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > > > > iic0 at dwiic0
> > > > > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > > > > iic1 at dwiic1
> > > > >
> > > > > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > > > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > > > > a diff for that.
> > > > >
> > > > > Thanks a lot!
> > > >
> > > > Can you try the diff below?
> > >
> > > I tried to install a release built with this. With miniroot69.img I
> > > still hit the reboot loop described in my first mail:
> > >
> > > ...
> > > wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
> > > aml_rwgen: unregistered RegionSpace 0x9
> > > Could not convert 0 to 3
> > >
> > > panic: aml_die aml_convert: 2095
> > > syncing disks...uvmfault(0xffffffff818e5d78, 0xbc8, 0, 1) -> e
> > > fatal page fault in supervisor mode
> > > trap type 6 code 0 rip ffffffff810e216b cs 8 rflags 10286 cr2 bc8 cpl 0 rsp ffff80001f76f120
> > > gsbase 0xffffffff818d0ff0 kgsbase 0x0
> > > panic trap type 6, code=0, pc=ffffffff810e216b
> > >
> > > dump to dev 17,1 not possible
> > > rebooting...
> > >
> > > I tried to move acpi_register_gsb() and the call to it in dwiic_pci.c
> > > out of SMALL_KERNEL, but that didn't help.
> > >
> > > What info would be useful to debug this further?
> >
> > SMALL_KERNEL deliberately doesn't GenericSerialBus support as this
> > requires the presence of a whole set of I2C drivers that we have no
> > space for on the install media.
> >
> > This machine violates the ACPI spec, since the AML should check that
> > the i2c bus is actually available before using it.  But pointing this
> > out to Dell is probably not going to help.
> >
> > Here is a diff that may work better.  The GenericSerialBuffer stuff
> > allows us to propagate the status of an I2C transfer back up the
> > chain.  So here is a diff that simply returns EIO if the controller
> > can't be found.
>
> The new blen and EIO logic isn't included in bsd.rd since aml_rwgsb() is
> inside #ifndef SMALL_KERNEL.  We instead fall back to aml_rwgen() in the
> switch over ref1->v_opregion.iospace in aml_rwfield().
>
> The diff below gives me a working bsd.rd. It pushes SMALL_KERNEL down a
> bit so as to only guard iic_exec(), but perhaps it would be preferable
> to signal the error from aml_rwfield() instead (I don't know how).

Thanks!  I think it is cleaner to provide a separate dummy
implementation for SMALL_KERNEL.  That way it is easier to see that
the implementation will always fail if SMALL_KERNEL is defined.

Also it turns out that ACPI allows code to do GenericSerialBus access
without proper check.  In that case "writes are ignored and reads will
return indeterminate data".

Anyway, the essentials of this diff have been in snaps for a bit.  So
it is time to ask for oks.

ok?


Index: dev/acpi/dsdt.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.261
diff -u -p -r1.261 dsdt.c
--- dev/acpi/dsdt.c 18 Mar 2021 00:17:26 -0000 1.261
+++ dev/acpi/dsdt.c 29 Mar 2021 19:19:25 -0000
@@ -2535,51 +2535,53 @@ aml_rwgsb(struct aml_value *conn, int al
  i2c_tag_t tag;
  i2c_op_t op;
  i2c_addr_t addr;
- int cmdlen, buflen;
+ int cmdlen, buflen, acclen;
  uint8_t cmd;
  uint8_t *buf;
- int err;
+ int pos, err;
 
  if (conn->type != AML_OBJTYPE_BUFFER || conn->length < 5 ||
     AML_CRSTYPE(crs) != LR_SERBUS || AML_CRSLEN(crs) > conn->length ||
     crs->lr_i2cbus.revid != 1 || crs->lr_i2cbus.type != LR_SERBUS_I2C)
  aml_die("Invalid GenericSerialBus");
  if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
-    bpos & 0x3 || blen != 8)
+    bpos & 0x3 || (blen % 8) != 0)
  aml_die("Invalid GenericSerialBus access");
 
  node = aml_searchname(conn->node,
     (char *)&crs->lr_i2cbus.vdata[crs->lr_i2cbus.tlength - 6]);
 
- if (node == NULL || node->i2c == NULL)
- aml_die("Could not find GenericSerialBus controller");
-
  switch (((flag >> 6) & 0x3)) {
  case 0: /* Normal */
  switch (AML_FIELD_ATTR(flag)) {
  case 0x02: /* AttribQuick */
  cmdlen = 0;
- buflen = 0;
+ buflen = acclen = 0;
  break;
  case 0x04: /* AttribSendReceive */
  cmdlen = 0;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x06: /* AttribByte */
  cmdlen = 1;
- buflen = 1;
+ acclen = 1;
+ buflen = blen / 8;
  break;
  case 0x08: /* AttribWord */
  cmdlen = 1;
- buflen = 2;
+ acclen = 2;
+ buflen = blen / 8;
  break;
  case 0x0b: /* AttribBytes */
  cmdlen = 1;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  case 0x0e: /* AttribRawBytes */
  cmdlen = 0;
- buflen = alen;
+ acclen = alen;
+ buflen = blen / 8;
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2588,11 +2590,11 @@ aml_rwgsb(struct aml_value *conn, int al
  break;
  case 1: /* AttribBytes */
  cmdlen = 1;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  case 2: /* AttribRawBytes */
  cmdlen = 0;
- buflen = AML_FIELD_ATTR(flag);
+ acclen = buflen = AML_FIELD_ATTR(flag);
  break;
  default:
  aml_die("unsupported access type 0x%x", flag);
@@ -2606,13 +2608,32 @@ aml_rwgsb(struct aml_value *conn, int al
  op = I2C_OP_WRITE_WITH_STOP;
  }
 
+ buf = val->v_buffer;
+
+ /*
+ * Return an error if we can't find the I2C controller that
+ * we're supposed to use for this request.  This shouldn't
+ * happen as AML should only make use of GenericSerialBus
+ * address space after verifying that support for it has been
+ * registered.
+ */
+ if (node == NULL || node->i2c == NULL) {
+ buf[0] = EIO;
+ return;
+ }
+
  tag = node->i2c;
  addr = crs->lr_i2cbus._adr;
  cmd = bpos >> 3;
- buf = val->v_buffer;
 
  iic_acquire_bus(tag, 0);
- err = iic_exec(tag, op, addr, &cmd, cmdlen, &buf[2], buflen, 0);
+ for (pos = 0; pos < buflen; pos += acclen) {
+ err = iic_exec(tag, op, addr, &cmd, cmdlen,
+    &buf[pos + 2], acclen, 0);
+ if (err)
+ break;
+ cmd++;
+ }
  iic_release_bus(tag, 0);
 
  /*
@@ -2624,6 +2645,58 @@ aml_rwgsb(struct aml_value *conn, int al
  buf[0] = err;
 }
 
+#else
+
+/*
+ * We don't support GenericSerialBus in RAMDISK kernels.  Provide a
+ * dummy implementation that returns a non-zero error status.
+ */
+
+void
+aml_rwgsb(struct aml_value *conn, int alen, int bpos, int blen,
+    struct aml_value *val, int mode, int flag)
+{
+ int buflen;
+ uint8_t *buf;
+
+ if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
+    bpos & 0x3 || (blen % 8) != 0)
+ aml_die("Invalid GenericSerialBus access");
+
+ switch (((flag >> 6) & 0x3)) {
+ case 0: /* Normal */
+ switch (AML_FIELD_ATTR(flag)) {
+ case 0x02: /* AttribQuick */
+ buflen = 0;
+ break;
+ case 0x04: /* AttribSendReceive */
+ case 0x06: /* AttribByte */
+ case 0x08: /* AttribWord */
+ case 0x0b: /* AttribBytes */
+ case 0x0e: /* AttribRawBytes */
+ buflen = blen / 8;
+ break;
+ default:
+ aml_die("unsupported access type 0x%x", flag);
+ break;
+ }
+ break;
+ case 1: /* AttribBytes */
+ case 2: /* AttribRawBytes */
+ buflen = AML_FIELD_ATTR(flag);
+ break;
+ default:
+ aml_die("unsupported access type 0x%x", flag);
+ break;
+ }
+
+ if (mode == ACPI_IOREAD)
+ _aml_setvalue(val, AML_OBJTYPE_BUFFER, buflen + 2, NULL);
+
+ buf = val->v_buffer;
+ buf[0] = EIO;
+}
+
 #endif
 
 void
@@ -2727,13 +2800,11 @@ aml_rwfield(struct aml_value *fld, int b
  aml_rwgpio(ref2, bpos, blen, val, mode,
     fld->v_field.flags);
  break;
-#ifndef SMALL_KERNEL
  case ACPI_OPREG_GSB:
  aml_rwgsb(ref2, fld->v_field.ref3,
     fld->v_field.bitpos + bpos, blen,
     val, mode, fld->v_field.flags);
  break;
-#endif
  default:
  aml_rwgen(ref1, fld->v_field.bitpos + bpos, blen,
     val, mode, fld->v_field.flags);
Index: dev/pci/dwiic_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
retrieving revision 1.15
diff -u -p -r1.15 dwiic_pci.c
--- dev/pci/dwiic_pci.c 25 Dec 2020 21:48:27 -0000 1.15
+++ dev/pci/dwiic_pci.c 29 Mar 2021 19:19:25 -0000
@@ -225,7 +225,12 @@ dwiic_pci_attach(struct device *parent,
 
  config_found((struct device *)sc, &sc->sc_iba, iicbus_print);
 
- return;
+#if NACPI > 0 && !defined(SMALL_KERNEL)
+ if (sc->sc_devnode) {
+ sc->sc_devnode->i2c = &sc->sc_i2c_tag;
+ acpi_register_gsb(acpi_softc, sc->sc_devnode);
+ }
+#endif
 }
 
 int

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Theo Buehler-3
On Mon, Mar 29, 2021 at 09:25:04PM +0200, Mark Kettenis wrote:

> > Date: Thu, 25 Mar 2021 08:00:56 +0100
> > From: Theo Buehler <[hidden email]>
> >
> > On Wed, Mar 24, 2021 at 05:11:52PM +0100, Mark Kettenis wrote:
> > > > Date: Wed, 24 Mar 2021 09:47:56 +0100
> > > > From: Theo Buehler <[hidden email]>
> > > >
> > > > On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:
> > > > > > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > > > > > From: Theo Buehler <[hidden email]>
> > > > > >
> > > > > > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > > > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > > >
> > > > > > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > > > >
> > > > > > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > > > > > of alen, bpos, blen, mode and flag for starters.
> > > > > > > >
> > > > > > > > Thanks.
> > > > > > > >
> > > > > > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > > > > > >
> > > > > > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > > > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > > > > > is twice as long as it should be according to the conditional preceding
> > > > > > > > it:
> > > > > > > >
> > > > > > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > > > > > >    bpos & 0x3 || blen != 8)
> > > > > > >
> > > > > > > Right, we need to figure out what this actually means.  The ACPI
> > > > > > > standard isn't exactly clear on this...
> > > > > > >
> > > > > > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > > > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > > > > > node->i2c == NULL.
> > > > > > >
> > > > > > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > > > > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > > > > > you see dwiic(4) attach?
> > > > > >
> > > > > > Two of them:
> > > > > >
> > > > > > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > > > > > iic0 at dwiic0
> > > > > > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > > > > > iic1 at dwiic1
> > > > > >
> > > > > > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > > > > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > > > > > a diff for that.
> > > > > >
> > > > > > Thanks a lot!
> > > > >
> > > > > Can you try the diff below?
> > > >
> > > > I tried to install a release built with this. With miniroot69.img I
> > > > still hit the reboot loop described in my first mail:
> > > >
> > > > ...
> > > > wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
> > > > aml_rwgen: unregistered RegionSpace 0x9
> > > > Could not convert 0 to 3
> > > >
> > > > panic: aml_die aml_convert: 2095
> > > > syncing disks...uvmfault(0xffffffff818e5d78, 0xbc8, 0, 1) -> e
> > > > fatal page fault in supervisor mode
> > > > trap type 6 code 0 rip ffffffff810e216b cs 8 rflags 10286 cr2 bc8 cpl 0 rsp ffff80001f76f120
> > > > gsbase 0xffffffff818d0ff0 kgsbase 0x0
> > > > panic trap type 6, code=0, pc=ffffffff810e216b
> > > >
> > > > dump to dev 17,1 not possible
> > > > rebooting...
> > > >
> > > > I tried to move acpi_register_gsb() and the call to it in dwiic_pci.c
> > > > out of SMALL_KERNEL, but that didn't help.
> > > >
> > > > What info would be useful to debug this further?
> > >
> > > SMALL_KERNEL deliberately doesn't GenericSerialBus support as this
> > > requires the presence of a whole set of I2C drivers that we have no
> > > space for on the install media.
> > >
> > > This machine violates the ACPI spec, since the AML should check that
> > > the i2c bus is actually available before using it.  But pointing this
> > > out to Dell is probably not going to help.
> > >
> > > Here is a diff that may work better.  The GenericSerialBuffer stuff
> > > allows us to propagate the status of an I2C transfer back up the
> > > chain.  So here is a diff that simply returns EIO if the controller
> > > can't be found.
> >
> > The new blen and EIO logic isn't included in bsd.rd since aml_rwgsb() is
> > inside #ifndef SMALL_KERNEL.  We instead fall back to aml_rwgen() in the
> > switch over ref1->v_opregion.iospace in aml_rwfield().
> >
> > The diff below gives me a working bsd.rd. It pushes SMALL_KERNEL down a
> > bit so as to only guard iic_exec(), but perhaps it would be preferable
> > to signal the error from aml_rwfield() instead (I don't know how).
>
> Thanks!  I think it is cleaner to provide a separate dummy
> implementation for SMALL_KERNEL.  That way it is easier to see that
> the implementation will always fail if SMALL_KERNEL is defined.

This makes a lot of sense and is indeed cleaner.

> Also it turns out that ACPI allows code to do GenericSerialBus access
> without proper check.  In that case "writes are ignored and reads will
> return indeterminate data".

Doesn't the "This shouldn't happen" comment need a small update to
reflect that?

> Anyway, the essentials of this diff have been in snaps for a bit.  So
> it is time to ask for oks.
>
> ok?

I'm definitely in favor of this going in. I'm biased...

The dummy implementation reads fine to me. I won't be able to test it
for a couple of days since a bulk build is running on the machine.  I
will report back as soon as I can. However, I don't see the point in
waiting any longer, so fwiw:

ok tb


>
>
> Index: dev/acpi/dsdt.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
> retrieving revision 1.261
> diff -u -p -r1.261 dsdt.c
> --- dev/acpi/dsdt.c 18 Mar 2021 00:17:26 -0000 1.261
> +++ dev/acpi/dsdt.c 29 Mar 2021 19:19:25 -0000
> @@ -2535,51 +2535,53 @@ aml_rwgsb(struct aml_value *conn, int al
>   i2c_tag_t tag;
>   i2c_op_t op;
>   i2c_addr_t addr;
> - int cmdlen, buflen;
> + int cmdlen, buflen, acclen;
>   uint8_t cmd;
>   uint8_t *buf;
> - int err;
> + int pos, err;
>  
>   if (conn->type != AML_OBJTYPE_BUFFER || conn->length < 5 ||
>      AML_CRSTYPE(crs) != LR_SERBUS || AML_CRSLEN(crs) > conn->length ||
>      crs->lr_i2cbus.revid != 1 || crs->lr_i2cbus.type != LR_SERBUS_I2C)
>   aml_die("Invalid GenericSerialBus");
>   if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> -    bpos & 0x3 || blen != 8)
> +    bpos & 0x3 || (blen % 8) != 0)
>   aml_die("Invalid GenericSerialBus access");
>  
>   node = aml_searchname(conn->node,
>      (char *)&crs->lr_i2cbus.vdata[crs->lr_i2cbus.tlength - 6]);
>  
> - if (node == NULL || node->i2c == NULL)
> - aml_die("Could not find GenericSerialBus controller");
> -
>   switch (((flag >> 6) & 0x3)) {
>   case 0: /* Normal */
>   switch (AML_FIELD_ATTR(flag)) {
>   case 0x02: /* AttribQuick */
>   cmdlen = 0;
> - buflen = 0;
> + buflen = acclen = 0;
>   break;
>   case 0x04: /* AttribSendReceive */
>   cmdlen = 0;
> - buflen = 1;
> + acclen = 1;
> + buflen = blen / 8;
>   break;
>   case 0x06: /* AttribByte */
>   cmdlen = 1;
> - buflen = 1;
> + acclen = 1;
> + buflen = blen / 8;
>   break;
>   case 0x08: /* AttribWord */
>   cmdlen = 1;
> - buflen = 2;
> + acclen = 2;
> + buflen = blen / 8;
>   break;
>   case 0x0b: /* AttribBytes */
>   cmdlen = 1;
> - buflen = alen;
> + acclen = alen;
> + buflen = blen / 8;
>   break;
>   case 0x0e: /* AttribRawBytes */
>   cmdlen = 0;
> - buflen = alen;
> + acclen = alen;
> + buflen = blen / 8;
>   break;
>   default:
>   aml_die("unsupported access type 0x%x", flag);
> @@ -2588,11 +2590,11 @@ aml_rwgsb(struct aml_value *conn, int al
>   break;
>   case 1: /* AttribBytes */
>   cmdlen = 1;
> - buflen = AML_FIELD_ATTR(flag);
> + acclen = buflen = AML_FIELD_ATTR(flag);
>   break;
>   case 2: /* AttribRawBytes */
>   cmdlen = 0;
> - buflen = AML_FIELD_ATTR(flag);
> + acclen = buflen = AML_FIELD_ATTR(flag);
>   break;
>   default:
>   aml_die("unsupported access type 0x%x", flag);
> @@ -2606,13 +2608,32 @@ aml_rwgsb(struct aml_value *conn, int al
>   op = I2C_OP_WRITE_WITH_STOP;
>   }
>  
> + buf = val->v_buffer;
> +
> + /*
> + * Return an error if we can't find the I2C controller that
> + * we're supposed to use for this request.  This shouldn't
> + * happen as AML should only make use of GenericSerialBus
> + * address space after verifying that support for it has been
> + * registered.
> + */
> + if (node == NULL || node->i2c == NULL) {
> + buf[0] = EIO;
> + return;
> + }
> +
>   tag = node->i2c;
>   addr = crs->lr_i2cbus._adr;
>   cmd = bpos >> 3;
> - buf = val->v_buffer;
>  
>   iic_acquire_bus(tag, 0);
> - err = iic_exec(tag, op, addr, &cmd, cmdlen, &buf[2], buflen, 0);
> + for (pos = 0; pos < buflen; pos += acclen) {
> + err = iic_exec(tag, op, addr, &cmd, cmdlen,
> +    &buf[pos + 2], acclen, 0);
> + if (err)
> + break;
> + cmd++;
> + }
>   iic_release_bus(tag, 0);
>  
>   /*
> @@ -2624,6 +2645,58 @@ aml_rwgsb(struct aml_value *conn, int al
>   buf[0] = err;
>  }
>  
> +#else
> +
> +/*
> + * We don't support GenericSerialBus in RAMDISK kernels.  Provide a
> + * dummy implementation that returns a non-zero error status.
> + */
> +
> +void
> +aml_rwgsb(struct aml_value *conn, int alen, int bpos, int blen,
> +    struct aml_value *val, int mode, int flag)
> +{
> + int buflen;
> + uint8_t *buf;
> +
> + if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> +    bpos & 0x3 || (blen % 8) != 0)
> + aml_die("Invalid GenericSerialBus access");
> +
> + switch (((flag >> 6) & 0x3)) {
> + case 0: /* Normal */
> + switch (AML_FIELD_ATTR(flag)) {
> + case 0x02: /* AttribQuick */
> + buflen = 0;
> + break;
> + case 0x04: /* AttribSendReceive */
> + case 0x06: /* AttribByte */
> + case 0x08: /* AttribWord */
> + case 0x0b: /* AttribBytes */
> + case 0x0e: /* AttribRawBytes */
> + buflen = blen / 8;
> + break;
> + default:
> + aml_die("unsupported access type 0x%x", flag);
> + break;
> + }
> + break;
> + case 1: /* AttribBytes */
> + case 2: /* AttribRawBytes */
> + buflen = AML_FIELD_ATTR(flag);
> + break;
> + default:
> + aml_die("unsupported access type 0x%x", flag);
> + break;
> + }
> +
> + if (mode == ACPI_IOREAD)
> + _aml_setvalue(val, AML_OBJTYPE_BUFFER, buflen + 2, NULL);
> +
> + buf = val->v_buffer;
> + buf[0] = EIO;
> +}
> +
>  #endif
>  
>  void
> @@ -2727,13 +2800,11 @@ aml_rwfield(struct aml_value *fld, int b
>   aml_rwgpio(ref2, bpos, blen, val, mode,
>      fld->v_field.flags);
>   break;
> -#ifndef SMALL_KERNEL
>   case ACPI_OPREG_GSB:
>   aml_rwgsb(ref2, fld->v_field.ref3,
>      fld->v_field.bitpos + bpos, blen,
>      val, mode, fld->v_field.flags);
>   break;
> -#endif
>   default:
>   aml_rwgen(ref1, fld->v_field.bitpos + bpos, blen,
>      val, mode, fld->v_field.flags);
> Index: dev/pci/dwiic_pci.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 dwiic_pci.c
> --- dev/pci/dwiic_pci.c 25 Dec 2020 21:48:27 -0000 1.15
> +++ dev/pci/dwiic_pci.c 29 Mar 2021 19:19:25 -0000
> @@ -225,7 +225,12 @@ dwiic_pci_attach(struct device *parent,
>  
>   config_found((struct device *)sc, &sc->sc_iba, iicbus_print);
>  
> - return;
> +#if NACPI > 0 && !defined(SMALL_KERNEL)
> + if (sc->sc_devnode) {
> + sc->sc_devnode->i2c = &sc->sc_i2c_tag;
> + acpi_register_gsb(acpi_softc, sc->sc_devnode);
> + }
> +#endif
>  }
>  
>  int

Reply | Threaded
Open this post in threaded view
|

Re: panic: aml_die aml_rwgsb:2549

Mark Kettenis
> Date: Mon, 29 Mar 2021 21:55:46 +0200
> From: Theo Buehler <[hidden email]>
> Cc: [hidden email]
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> On Mon, Mar 29, 2021 at 09:25:04PM +0200, Mark Kettenis wrote:
> > > Date: Thu, 25 Mar 2021 08:00:56 +0100
> > > From: Theo Buehler <[hidden email]>
> > >
> > > On Wed, Mar 24, 2021 at 05:11:52PM +0100, Mark Kettenis wrote:
> > > > > Date: Wed, 24 Mar 2021 09:47:56 +0100
> > > > > From: Theo Buehler <[hidden email]>
> > > > >
> > > > > On Tue, Mar 23, 2021 at 08:29:29PM +0100, Mark Kettenis wrote:
> > > > > > > Date: Tue, 23 Mar 2021 17:39:45 +0100
> > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > >
> > > > > > > On Tue, Mar 23, 2021 at 05:28:37PM +0100, Mark Kettenis wrote:
> > > > > > > > > Date: Tue, 23 Mar 2021 16:56:33 +0100
> > > > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > > > >
> > > > > > > > > On Tue, Mar 23, 2021 at 04:13:53PM +0100, Mark Kettenis wrote:
> > > > > > > > > > > Date: Tue, 23 Mar 2021 14:14:40 +0100
> > > > > > > > > > > From: Theo Buehler <[hidden email]>
> > > > > > > > > >
> > > > > > > > > > It would help if you could try and boot a kernel that adds some debug
> > > > > > > > > > prints instead of calling aml_die().  Probably need to know the values
> > > > > > > > > > of alen, bpos, blen, mode and flag for starters.
> > > > > > > > >
> > > > > > > > > Thanks.
> > > > > > > > >
> > > > > > > > > alen 0x00, bpos 0x278, blen 0x10, mode 0x00, flag 0x605
> > > > > > > > >
> > > > > > > > > So: AML_FIELD_ACCESS(flag) == AML_FIELD_BUFFER_ACC, bpos & 0x03 == 0
> > > > > > > > > and the aml_die("Invalid GenericSerialBus access") is hit because blen
> > > > > > > > > is twice as long as it should be according to the conditional preceding
> > > > > > > > > it:
> > > > > > > > >
> > > > > > > > > if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > > > > > > > >    bpos & 0x3 || blen != 8)
> > > > > > > >
> > > > > > > > Right, we need to figure out what this actually means.  The ACPI
> > > > > > > > standard isn't exactly clear on this...
> > > > > > > >
> > > > > > > > > If I skip the aml_die("Invalid GenericSerialBus access"), it hits the
> > > > > > > > > next aml_die("Could not find GenericSerialBus controller"); because
> > > > > > > > > node->i2c == NULL.
> > > > > > > >
> > > > > > > > If I'm reading the AML and FreeBSD dmesg correctly this is an i2c
> > > > > > > > controller that attaches to PCI.  I suspect that it is dwiic(4).  D
> > > > > > > > you see dwiic(4) attach?
> > > > > > >
> > > > > > > Two of them:
> > > > > > >
> > > > > > > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 22
> > > > > > > iic0 at dwiic0
> > > > > > > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 23
> > > > > > > iic1 at dwiic1
> > > > > > >
> > > > > > > > If so, the problem is that we dont't call acpi_register_gsb() for
> > > > > > > > dwiic(4) instances that attach to PCI.  I'll see if I can come up with
> > > > > > > > a diff for that.
> > > > > > >
> > > > > > > Thanks a lot!
> > > > > >
> > > > > > Can you try the diff below?
> > > > >
> > > > > I tried to install a release built with this. With miniroot69.img I
> > > > > still hit the reboot loop described in my first mail:
> > > > >
> > > > > ...
> > > > > wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation), using wskbd0
> > > > > aml_rwgen: unregistered RegionSpace 0x9
> > > > > Could not convert 0 to 3
> > > > >
> > > > > panic: aml_die aml_convert: 2095
> > > > > syncing disks...uvmfault(0xffffffff818e5d78, 0xbc8, 0, 1) -> e
> > > > > fatal page fault in supervisor mode
> > > > > trap type 6 code 0 rip ffffffff810e216b cs 8 rflags 10286 cr2 bc8 cpl 0 rsp ffff80001f76f120
> > > > > gsbase 0xffffffff818d0ff0 kgsbase 0x0
> > > > > panic trap type 6, code=0, pc=ffffffff810e216b
> > > > >
> > > > > dump to dev 17,1 not possible
> > > > > rebooting...
> > > > >
> > > > > I tried to move acpi_register_gsb() and the call to it in dwiic_pci.c
> > > > > out of SMALL_KERNEL, but that didn't help.
> > > > >
> > > > > What info would be useful to debug this further?
> > > >
> > > > SMALL_KERNEL deliberately doesn't GenericSerialBus support as this
> > > > requires the presence of a whole set of I2C drivers that we have no
> > > > space for on the install media.
> > > >
> > > > This machine violates the ACPI spec, since the AML should check that
> > > > the i2c bus is actually available before using it.  But pointing this
> > > > out to Dell is probably not going to help.
> > > >
> > > > Here is a diff that may work better.  The GenericSerialBuffer stuff
> > > > allows us to propagate the status of an I2C transfer back up the
> > > > chain.  So here is a diff that simply returns EIO if the controller
> > > > can't be found.
> > >
> > > The new blen and EIO logic isn't included in bsd.rd since aml_rwgsb() is
> > > inside #ifndef SMALL_KERNEL.  We instead fall back to aml_rwgen() in the
> > > switch over ref1->v_opregion.iospace in aml_rwfield().
> > >
> > > The diff below gives me a working bsd.rd. It pushes SMALL_KERNEL down a
> > > bit so as to only guard iic_exec(), but perhaps it would be preferable
> > > to signal the error from aml_rwfield() instead (I don't know how).
> >
> > Thanks!  I think it is cleaner to provide a separate dummy
> > implementation for SMALL_KERNEL.  That way it is easier to see that
> > the implementation will always fail if SMALL_KERNEL is defined.
>
> This makes a lot of sense and is indeed cleaner.
>
> > Also it turns out that ACPI allows code to do GenericSerialBus access
> > without proper check.  In that case "writes are ignored and reads will
> > return indeterminate data".
>
> Doesn't the "This shouldn't happen" comment need a small update to
> reflect that?

Good point.  I'll adjust that before I commit this.

> > Anyway, the essentials of this diff have been in snaps for a bit.  So
> > it is time to ask for oks.
> >
> > ok?
>
> I'm definitely in favor of this going in. I'm biased...
>
> The dummy implementation reads fine to me. I won't be able to test it
> for a couple of days since a bulk build is running on the machine.  I
> will report back as soon as I can. However, I don't see the point in
> waiting any longer, so fwiw:
>
> ok tb
>
>
> >
> >
> > Index: dev/acpi/dsdt.c
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
> > retrieving revision 1.261
> > diff -u -p -r1.261 dsdt.c
> > --- dev/acpi/dsdt.c 18 Mar 2021 00:17:26 -0000 1.261
> > +++ dev/acpi/dsdt.c 29 Mar 2021 19:19:25 -0000
> > @@ -2535,51 +2535,53 @@ aml_rwgsb(struct aml_value *conn, int al
> >   i2c_tag_t tag;
> >   i2c_op_t op;
> >   i2c_addr_t addr;
> > - int cmdlen, buflen;
> > + int cmdlen, buflen, acclen;
> >   uint8_t cmd;
> >   uint8_t *buf;
> > - int err;
> > + int pos, err;
> >  
> >   if (conn->type != AML_OBJTYPE_BUFFER || conn->length < 5 ||
> >      AML_CRSTYPE(crs) != LR_SERBUS || AML_CRSLEN(crs) > conn->length ||
> >      crs->lr_i2cbus.revid != 1 || crs->lr_i2cbus.type != LR_SERBUS_I2C)
> >   aml_die("Invalid GenericSerialBus");
> >   if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > -    bpos & 0x3 || blen != 8)
> > +    bpos & 0x3 || (blen % 8) != 0)
> >   aml_die("Invalid GenericSerialBus access");
> >  
> >   node = aml_searchname(conn->node,
> >      (char *)&crs->lr_i2cbus.vdata[crs->lr_i2cbus.tlength - 6]);
> >  
> > - if (node == NULL || node->i2c == NULL)
> > - aml_die("Could not find GenericSerialBus controller");
> > -
> >   switch (((flag >> 6) & 0x3)) {
> >   case 0: /* Normal */
> >   switch (AML_FIELD_ATTR(flag)) {
> >   case 0x02: /* AttribQuick */
> >   cmdlen = 0;
> > - buflen = 0;
> > + buflen = acclen = 0;
> >   break;
> >   case 0x04: /* AttribSendReceive */
> >   cmdlen = 0;
> > - buflen = 1;
> > + acclen = 1;
> > + buflen = blen / 8;
> >   break;
> >   case 0x06: /* AttribByte */
> >   cmdlen = 1;
> > - buflen = 1;
> > + acclen = 1;
> > + buflen = blen / 8;
> >   break;
> >   case 0x08: /* AttribWord */
> >   cmdlen = 1;
> > - buflen = 2;
> > + acclen = 2;
> > + buflen = blen / 8;
> >   break;
> >   case 0x0b: /* AttribBytes */
> >   cmdlen = 1;
> > - buflen = alen;
> > + acclen = alen;
> > + buflen = blen / 8;
> >   break;
> >   case 0x0e: /* AttribRawBytes */
> >   cmdlen = 0;
> > - buflen = alen;
> > + acclen = alen;
> > + buflen = blen / 8;
> >   break;
> >   default:
> >   aml_die("unsupported access type 0x%x", flag);
> > @@ -2588,11 +2590,11 @@ aml_rwgsb(struct aml_value *conn, int al
> >   break;
> >   case 1: /* AttribBytes */
> >   cmdlen = 1;
> > - buflen = AML_FIELD_ATTR(flag);
> > + acclen = buflen = AML_FIELD_ATTR(flag);
> >   break;
> >   case 2: /* AttribRawBytes */
> >   cmdlen = 0;
> > - buflen = AML_FIELD_ATTR(flag);
> > + acclen = buflen = AML_FIELD_ATTR(flag);
> >   break;
> >   default:
> >   aml_die("unsupported access type 0x%x", flag);
> > @@ -2606,13 +2608,32 @@ aml_rwgsb(struct aml_value *conn, int al
> >   op = I2C_OP_WRITE_WITH_STOP;
> >   }
> >  
> > + buf = val->v_buffer;
> > +
> > + /*
> > + * Return an error if we can't find the I2C controller that
> > + * we're supposed to use for this request.  This shouldn't
> > + * happen as AML should only make use of GenericSerialBus
> > + * address space after verifying that support for it has been
> > + * registered.
> > + */
> > + if (node == NULL || node->i2c == NULL) {
> > + buf[0] = EIO;
> > + return;
> > + }
> > +
> >   tag = node->i2c;
> >   addr = crs->lr_i2cbus._adr;
> >   cmd = bpos >> 3;
> > - buf = val->v_buffer;
> >  
> >   iic_acquire_bus(tag, 0);
> > - err = iic_exec(tag, op, addr, &cmd, cmdlen, &buf[2], buflen, 0);
> > + for (pos = 0; pos < buflen; pos += acclen) {
> > + err = iic_exec(tag, op, addr, &cmd, cmdlen,
> > +    &buf[pos + 2], acclen, 0);
> > + if (err)
> > + break;
> > + cmd++;
> > + }
> >   iic_release_bus(tag, 0);
> >  
> >   /*
> > @@ -2624,6 +2645,58 @@ aml_rwgsb(struct aml_value *conn, int al
> >   buf[0] = err;
> >  }
> >  
> > +#else
> > +
> > +/*
> > + * We don't support GenericSerialBus in RAMDISK kernels.  Provide a
> > + * dummy implementation that returns a non-zero error status.
> > + */
> > +
> > +void
> > +aml_rwgsb(struct aml_value *conn, int alen, int bpos, int blen,
> > +    struct aml_value *val, int mode, int flag)
> > +{
> > + int buflen;
> > + uint8_t *buf;
> > +
> > + if (AML_FIELD_ACCESS(flag) != AML_FIELD_BUFFERACC ||
> > +    bpos & 0x3 || (blen % 8) != 0)
> > + aml_die("Invalid GenericSerialBus access");
> > +
> > + switch (((flag >> 6) & 0x3)) {
> > + case 0: /* Normal */
> > + switch (AML_FIELD_ATTR(flag)) {
> > + case 0x02: /* AttribQuick */
> > + buflen = 0;
> > + break;
> > + case 0x04: /* AttribSendReceive */
> > + case 0x06: /* AttribByte */
> > + case 0x08: /* AttribWord */
> > + case 0x0b: /* AttribBytes */
> > + case 0x0e: /* AttribRawBytes */
> > + buflen = blen / 8;
> > + break;
> > + default:
> > + aml_die("unsupported access type 0x%x", flag);
> > + break;
> > + }
> > + break;
> > + case 1: /* AttribBytes */
> > + case 2: /* AttribRawBytes */
> > + buflen = AML_FIELD_ATTR(flag);
> > + break;
> > + default:
> > + aml_die("unsupported access type 0x%x", flag);
> > + break;
> > + }
> > +
> > + if (mode == ACPI_IOREAD)
> > + _aml_setvalue(val, AML_OBJTYPE_BUFFER, buflen + 2, NULL);
> > +
> > + buf = val->v_buffer;
> > + buf[0] = EIO;
> > +}
> > +
> >  #endif
> >  
> >  void
> > @@ -2727,13 +2800,11 @@ aml_rwfield(struct aml_value *fld, int b
> >   aml_rwgpio(ref2, bpos, blen, val, mode,
> >      fld->v_field.flags);
> >   break;
> > -#ifndef SMALL_KERNEL
> >   case ACPI_OPREG_GSB:
> >   aml_rwgsb(ref2, fld->v_field.ref3,
> >      fld->v_field.bitpos + bpos, blen,
> >      val, mode, fld->v_field.flags);
> >   break;
> > -#endif
> >   default:
> >   aml_rwgen(ref1, fld->v_field.bitpos + bpos, blen,
> >      val, mode, fld->v_field.flags);
> > Index: dev/pci/dwiic_pci.c
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
> > retrieving revision 1.15
> > diff -u -p -r1.15 dwiic_pci.c
> > --- dev/pci/dwiic_pci.c 25 Dec 2020 21:48:27 -0000 1.15
> > +++ dev/pci/dwiic_pci.c 29 Mar 2021 19:19:25 -0000
> > @@ -225,7 +225,12 @@ dwiic_pci_attach(struct device *parent,
> >  
> >   config_found((struct device *)sc, &sc->sc_iba, iicbus_print);
> >  
> > - return;
> > +#if NACPI > 0 && !defined(SMALL_KERNEL)
> > + if (sc->sc_devnode) {
> > + sc->sc_devnode->i2c = &sc->sc_i2c_tag;
> > + acpi_register_gsb(acpi_softc, sc->sc_devnode);
> > + }
> > +#endif
> >  }
> >  
> >  int
>