git: 555ffd9022de - main - pci: use uint32_t for eecp

From: ShengYi Hung <aokblast_at_FreeBSD.org>
Date: Sat, 09 May 2026 09:09:28 UTC
The branch main has been updated by aokblast:

URL: https://cgit.FreeBSD.org/src/commit/?id=555ffd9022de0c497881bafc413e3e1d05af10d4

commit 555ffd9022de0c497881bafc413e3e1d05af10d4
Author:     Gisle Nes <gisle@gisle.net>
AuthorDate: 2026-04-07 16:48:15 +0000
Commit:     ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-05-09 09:09:05 +0000

    pci: use uint32_t for eecp
    
    eecp holds the extended capability offset. If that offset is larger
    than 0xff, storing it in uint8_t truncates it, which can make the
    early EHCI/XHCI capability walk read the wrong location and loop during
    boot.
    
    Seen on AMD device 1022:151e, where HCCPARAMS1 = 0x0118ffc5 and the
    first xHCI extended capability offset is 0x460. Widen eecp to uint32_t
    in xhci_early_takeover(), matching xhci_pci_take_controller().
    
    Signed-off-by: Gisle Nes <gisle@gisle.net>
    Reviewed by:    zlei, aokblast
    MFC after:      3 days
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2127
    Closes:         https://github.com/freebsd/freebsd-src/pull/2127
---
 sys/dev/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 0dddd2dd263f..b5a3012accd6 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -3756,7 +3756,7 @@ xhci_early_takeover(device_t self)
 	struct resource *res;
 	uint32_t cparams;
 	uint32_t eec;
-	uint8_t eecp;
+	uint32_t eecp;
 	uint8_t bios_sem;
 	uint8_t offs;
 	int rid;