Module Name: src Committed By: jmcneill Date: Sat Aug 13 21:51:33 UTC 2022
Modified Files: src/sys/dev/pci: pciconf.c Log Message: pciconf: Skip callbacks for reserved ranges if resource allocation fails. In the event that a BAR write is ignored, no need to notify the callback of any changes. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/pciconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/pciconf.c diff -u src/sys/dev/pci/pciconf.c:1.53 src/sys/dev/pci/pciconf.c:1.54 --- src/sys/dev/pci/pciconf.c:1.53 Mon Aug 30 22:49:03 2021 +++ src/sys/dev/pci/pciconf.c Sat Aug 13 21:51:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pciconf.c,v 1.53 2021/08/30 22:49:03 jmcneill Exp $ */ +/* $NetBSD: pciconf.c,v 1.54 2022/08/13 21:51:33 jmcneill Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.53 2021/08/30 22:49:03 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.54 2022/08/13 21:51:33 jmcneill Exp $"); #include "opt_pci.h" @@ -1068,7 +1068,16 @@ setup_memwins(pciconf_bus_t *pb) } if (rsvd != NULL && rsvd->start != pm->address) { - rsvd->callback(rsvd->callback_arg, pm->address); + /* + * Resource allocation will never reuse a reserved + * address. Check to see if the BAR is still reserved + * to cover the case where the new resource was not + * applied. In this case, there is no need to notify + * the device callback of a change. + */ + if (!pci_bar_is_reserved(pb, pd, pm->reg)) { + rsvd->callback(rsvd->callback_arg, pm->address); + } } } for (pm = pb->pcimemwin; pm < &pb->pcimemwin[pb->nmemwin]; pm++) {