Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/alchemy Now that bus_handle_t is signed, avoid...



details:   https://anonhg.NetBSD.org/src/rev/7f4ce0e3f1c1
branches:  trunk
changeset: 755488:7f4ce0e3f1c1
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jun 07 13:33:33 2010 +0000

description:
Now that bus_handle_t is signed, avoid % operations on it. Convert all
% PAGE_SIZE to & PAGE_MASK. We don't expect to support non power of two
page sizes anytime soon ;-)
This makes PCI work again on my au1550.

diffstat:

 sys/arch/mips/alchemy/au_himem_space.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 8e59a88b3e67 -r 7f4ce0e3f1c1 sys/arch/mips/alchemy/au_himem_space.c
--- a/sys/arch/mips/alchemy/au_himem_space.c    Mon Jun 07 13:04:31 2010 +0000
+++ b/sys/arch/mips/alchemy/au_himem_space.c    Mon Jun 07 13:33:33 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: au_himem_space.c,v 1.10 2009/12/16 08:26:14 matt Exp $ */
+/* $NetBSD: au_himem_space.c,v 1.11 2010/06/07 13:33:33 martin Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.10 2009/12/16 08:26:14 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.11 2010/06/07 13:33:33 martin Exp $");
 
 /*
  * This provides mappings for the upper I/O regions used on some
@@ -225,7 +225,7 @@
         * calculation is the offset into the first page, plus the
         * intended size, rounded up to a whole number of pages.
         */
-       realsz = ROUND_PAGE((addr % PAGE_SIZE) + size);
+       realsz = ROUND_PAGE((addr & PAGE_MASK) + size);
 
        va = uvm_km_alloc(kernel_map,
            realsz, PAGE_SIZE, UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
@@ -234,7 +234,7 @@
        }
 
        /* virtual address in handle (offset appropriately) */
-       *bshp = va + (addr % PAGE_SIZE);
+       *bshp = va + (addr & PAGE_MASK);
 
        /* map the pages in the kernel pmap */
        s = splhigh();
@@ -269,7 +269,7 @@
        int                     s;
 
        va = (vaddr_t)TRUNC_PAGE(bsh);
-       realsz = (vsize_t)ROUND_PAGE((bsh % PAGE_SIZE) + size);
+       realsz = (vsize_t)ROUND_PAGE((bsh & PAGE_MASK) + size);
 
        s = splhigh();
 
@@ -294,7 +294,7 @@
 
        if (acct) {
                bus_addr_t              addr;
-               addr = ((pa - c->c_physoff) + (bsh % PAGE_SIZE));
+               addr = ((pa - c->c_physoff) + (bsh & PAGE_MASK));
                extent_free(c->c_extent, addr, size, EX_NOWAIT);
        }
 }



Home | Main Index | Thread Index | Old Index