From f6d21d670c7c47d91a5c7e9481c9699a008ec7b7 Mon Sep 17 00:00:00 2001 From: kettenis Date: Thu, 27 Apr 2023 09:00:03 +0000 Subject: [PATCH] Fix config space access for the root bus of a dwpcie(4) controller when the root bus number isn't zero. ok patrick@, dlg@ --- sys/dev/fdt/dwpcie.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/fdt/dwpcie.c b/sys/dev/fdt/dwpcie.c index 5f7dfdcd3d6..f0d6c9e95b3 100644 --- a/sys/dev/fdt/dwpcie.c +++ b/sys/dev/fdt/dwpcie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwpcie.c,v 1.46 2023/04/25 11:36:55 patrick Exp $ */ +/* $OpenBSD: dwpcie.c,v 1.47 2023/04/27 09:00:03 kettenis Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -1482,6 +1482,7 @@ dwpcie_conf_read(void *v, pcitag_t tag, int reg) dwpcie_decompose_tag(sc, tag, &bus, &dev, &fn); if (bus == sc->sc_bus) { KASSERT(dev == 0); + tag = dwpcie_make_tag(sc, 0, dev, fn); return HREAD4(sc, tag | reg); } @@ -1515,6 +1516,7 @@ dwpcie_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data) dwpcie_decompose_tag(sc, tag, &bus, &dev, &fn); if (bus == sc->sc_bus) { KASSERT(dev == 0); + tag = dwpcie_make_tag(sc, 0, dev, fn); HWRITE4(sc, tag | reg, data); return; } -- 2.20.1