Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libarch/alpha Fix multiple bugs:
details: https://anonhg.NetBSD.org/src/rev/5d8a275c2620
branches: trunk
changeset: 534190:5d8a275c2620
user: mycroft <mycroft%NetBSD.org@localhost>
date: Fri Jul 19 22:03:39 2002 +0000
description:
Fix multiple bugs:
* Select dense or sparse space based on the prefetchable flag, like the kernel
does. In particular, non-prefetchable mappings are forced to sparse space.
* If no window is matched, return MAP_FAILED, rather than falling through and
blowing chunks.
* Ignore addr_shift (set it to 0) for dense mappings.
diffstat:
lib/libarch/alpha/alpha_pci_mem.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diffs (43 lines):
diff -r a63fa58fd4ae -r 5d8a275c2620 lib/libarch/alpha/alpha_pci_mem.c
--- a/lib/libarch/alpha/alpha_pci_mem.c Fri Jul 19 19:29:28 2002 +0000
+++ b/lib/libarch/alpha/alpha_pci_mem.c Fri Jul 19 22:03:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_pci_mem.c,v 1.3 2001/07/17 17:46:42 thorpej Exp $ */
+/* $NetBSD: alpha_pci_mem.c,v 1.4 2002/07/19 22:03:39 mycroft Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -88,19 +88,31 @@
(memaddr + (memsize - 1)) > abw->abw_abst.abst_bus_end)
continue;
- /* If we want linear, the window must be dense. */
- if (linear && (abw->abw_abst.abst_flags & ABST_DENSE) == 0)
+ /*
+ * Prefetchable memory must be mapped in dense space;
+ * otherwise use sparse space.
+ */
+ if (prefetchable &&
+ (abw->abw_abst.abst_flags & ABST_DENSE) == 0)
+ continue;
+ if (!prefetchable &&
+ (abw->abw_abst.abst_flags & ABST_DENSE) != 0)
continue;
/* Looks like we have a winner! */
goto found;
}
+ /* Not found in any of the windows. */
+ return (MAP_FAILED);
+
found:
fd = open(_PATH_MEM, O_RDWR, 0600);
if (fd == -1)
return (MAP_FAILED);
+ if (prefetchable)
+ abw->abw_abst.abst_addr_shift = 0;
memsize <<= abw->abw_abst.abst_addr_shift;
offset = (memaddr - abw->abw_abst.abst_bus_start) <<
abw->abw_abst.abst_addr_shift;
Home |
Main Index |
Thread Index |
Old Index