Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci pciconf: Skip callbacks for reserved ranges if r...
details: https://anonhg.NetBSD.org/src/rev/03c2737307ba
branches: trunk
changeset: 368941:03c2737307ba
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Aug 13 21:51:33 2022 +0000
description:
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.
diffstat:
sys/dev/pci/pciconf.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 3d94b3fdafbc -r 03c2737307ba sys/dev/pci/pciconf.c
--- a/sys/dev/pci/pciconf.c Sat Aug 13 20:08:36 2022 +0000
+++ b/sys/dev/pci/pciconf.c Sat Aug 13 21:51:33 2022 +0000
@@ -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 @@
}
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++) {
Home |
Main Index |
Thread Index |
Old Index