Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/powerpc Pull avail_start/avail_end logic fo...



details:   https://anonhg.NetBSD.org/src/rev/a1320f1ca34c
branches:  trunk
changeset: 510949:a1320f1ca34c
user:      briggs <briggs%NetBSD.org@localhost>
date:      Sun Jun 10 02:31:25 2001 +0000

description:
Pull avail_start/avail_end logic for bus_dmamem_alloc() from macppc port,
as suggested by matt%netbsd.org@localhost--the vm_physmem array may not be in order.

diffstat:

 sys/arch/powerpc/powerpc/bus_dma.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 0cb87d2a5756 -r a1320f1ca34c sys/arch/powerpc/powerpc/bus_dma.c
--- a/sys/arch/powerpc/powerpc/bus_dma.c        Sun Jun 10 02:31:00 2001 +0000
+++ b/sys/arch/powerpc/powerpc/bus_dma.c        Sun Jun 10 02:31:25 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.1 2001/06/06 17:37:37 matt Exp $ */
+/*     $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -419,10 +419,15 @@
        int *rsegs;
        int flags;
 {
-       paddr_t avail_start, avail_end;
+       paddr_t avail_start = 0xffffffff, avail_end = 0;
+       int bank;
 
-       avail_start = vm_physmem[0].avail_start << PGSHIFT;
-       avail_end = vm_physmem[vm_nphysseg - 1].avail_end << PGSHIFT;
+       for (bank = 0; bank < vm_nphysseg; bank++) {
+               if (avail_start > vm_physmem[bank].avail_start << PGSHIFT)
+                       avail_start = vm_physmem[bank].avail_start << PGSHIFT;
+               if (avail_end < vm_physmem[bank].avail_end << PGSHIFT)
+                       avail_end = vm_physmem[bank].avail_end << PGSHIFT;
+       }
 
        return _bus_dmamem_alloc_range(t, size, alignment, boundary, segs,
            nsegs, rsegs, flags, avail_start, avail_end - PAGE_SIZE);



Home | Main Index | Thread Index | Old Index