| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bus_space_alignstride_chipdep.c,v 1.11 2009/12/14 00:46:05 matt Exp $ */ | | 1 | /* $NetBSD: bus_space_alignstride_chipdep.c,v 1.12 2009/12/15 06:07:14 rmind Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -71,27 +71,27 @@ | | | @@ -71,27 +71,27 @@ |
71 | * declared. | | 71 | * declared. |
72 | * CHIP_EX_STORE_SIZE | | 72 | * CHIP_EX_STORE_SIZE |
73 | * Size of the device-provided static storage area | | 73 | * Size of the device-provided static storage area |
74 | * for the memory or I/O memory space extent. | | 74 | * for the memory or I/O memory space extent. |
75 | * CHIP_LITTLE_ENDIAN | CHIP_BIG_ENDIAN | | 75 | * CHIP_LITTLE_ENDIAN | CHIP_BIG_ENDIAN |
76 | * For endian-specific busses, like PCI (little). | | 76 | * For endian-specific busses, like PCI (little). |
77 | * CHIP_ACCESS_SIZE | | 77 | * CHIP_ACCESS_SIZE |
78 | * Size (in bytes) of minimum bus access, e.g. 4 | | 78 | * Size (in bytes) of minimum bus access, e.g. 4 |
79 | * to indicate all bus cycles are 32-bits. Defaults | | 79 | * to indicate all bus cycles are 32-bits. Defaults |
80 | * to 1, indicating any access size is valid. | | 80 | * to 1, indicating any access size is valid. |
81 | */ | | 81 | */ |
82 | | | 82 | |
83 | #include <sys/cdefs.h> | | 83 | #include <sys/cdefs.h> |
84 | __KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.11 2009/12/14 00:46:05 matt Exp $"); | | 84 | __KERNEL_RCSID(0, "$NetBSD: bus_space_alignstride_chipdep.c,v 1.12 2009/12/15 06:07:14 rmind Exp $"); |
85 | | | 85 | |
86 | #ifdef CHIP_EXTENT | | 86 | #ifdef CHIP_EXTENT |
87 | #include <sys/extent.h> | | 87 | #include <sys/extent.h> |
88 | #endif | | 88 | #endif |
89 | #include <sys/malloc.h> | | 89 | #include <sys/malloc.h> |
90 | | | 90 | |
91 | #include <machine/locore.h> | | 91 | #include <machine/locore.h> |
92 | | | 92 | |
93 | #include <uvm/uvm_extern.h> | | 93 | #include <uvm/uvm_extern.h> |
94 | | | 94 | |
95 | #define __C(A,B) __CONCAT(A,B) | | 95 | #define __C(A,B) __CONCAT(A,B) |
96 | #define __S(S) __STRING(S) | | 96 | #define __S(S) __STRING(S) |
97 | | | 97 | |
| @@ -762,27 +762,27 @@ __BS(map)(void *v, bus_addr_t addr, bus_ | | | @@ -762,27 +762,27 @@ __BS(map)(void *v, bus_addr_t addr, bus_ |
762 | va = uvm_km_alloc(kernel_map, size, PAGE_SIZE, | | 762 | va = uvm_km_alloc(kernel_map, size, PAGE_SIZE, |
763 | UVM_KMF_VAONLY | UVM_KMF_NOWAIT); | | 763 | UVM_KMF_VAONLY | UVM_KMF_NOWAIT); |
764 | if (va == 0) | | 764 | if (va == 0) |
765 | return ENOMEM; | | 765 | return ENOMEM; |
766 | | | 766 | |
767 | /* check use of handle_is_kseg2 in BS(unmap) */ | | 767 | /* check use of handle_is_kseg2 in BS(unmap) */ |
768 | KASSERT((va & ~MIPS_PHYS_MASK) == MIPS_KSEG2_START); | | 768 | KASSERT((va & ~MIPS_PHYS_MASK) == MIPS_KSEG2_START); |
769 | | | 769 | |
770 | *hp = va + (addr & PAGE_MASK); | | 770 | *hp = va + (addr & PAGE_MASK); |
771 | pa = trunc_page(addr); | | 771 | pa = trunc_page(addr); |
772 | | | 772 | |
773 | s = splhigh(); | | 773 | s = splhigh(); |
774 | while (size != 0) { | | 774 | while (size != 0) { |
775 | pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE); | | 775 | pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0); |
776 | pa += PAGE_SIZE; | | 776 | pa += PAGE_SIZE; |
777 | va += PAGE_SIZE; | | 777 | va += PAGE_SIZE; |
778 | size -= PAGE_SIZE; | | 778 | size -= PAGE_SIZE; |
779 | } | | 779 | } |
780 | pmap_update(pmap_kernel()); | | 780 | pmap_update(pmap_kernel()); |
781 | splx(s); | | 781 | splx(s); |
782 | } else { | | 782 | } else { |
783 | if (flags & BUS_SPACE_MAP_CACHEABLE) | | 783 | if (flags & BUS_SPACE_MAP_CACHEABLE) |
784 | *hp = MIPS_PHYS_TO_KSEG0(addr); | | 784 | *hp = MIPS_PHYS_TO_KSEG0(addr); |
785 | else | | 785 | else |
786 | *hp = MIPS_PHYS_TO_KSEG1(addr); | | 786 | *hp = MIPS_PHYS_TO_KSEG1(addr); |
787 | } | | 787 | } |
788 | #endif | | 788 | #endif |