Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Don't manipulate the pte to get uncached memory, us...
details: https://anonhg.NetBSD.org/src/rev/6d2be354a0c4
branches: trunk
changeset: 326937:6d2be354a0c4
user: matt <matt%NetBSD.org@localhost>
date: Sat Feb 22 20:33:00 2014 +0000
description:
Don't manipulate the pte to get uncached memory, use PMAP_NOCACHE instead.
Convert footbring to kenter_pa/kremove
diffstat:
sys/arch/arm/footbridge/footbridge_io.c | 26 +++++++++++++-------------
sys/arch/arm/gemini/gemini_space.c | 31 ++++++++++++-------------------
sys/arch/arm/ixp12x0/ixp12x0_io.c | 14 +++++++-------
sys/arch/arm/mainbus/mainbus_io.c | 18 ++++++++----------
sys/arch/arm/marvell/mvsoc_space.c | 21 ++++++++-------------
sys/arch/arm/mpcore/mpcore_space.c | 17 ++++++-----------
sys/arch/arm/sa11x0/sa11x0_io.c | 19 +++++++++----------
sys/arch/arm/xscale/ixp425_pci_space.c | 15 ++++++++-------
sys/arch/arm/xscale/pxa2x0_space.c | 19 ++++++++-----------
sys/arch/evbarm/adi_brh/obio_space.c | 17 +++++++++--------
sys/arch/evbarm/hdl_g/obio_space.c | 17 +++++++++--------
sys/arch/evbarm/iq80310/obio_space.c | 16 ++++++++--------
sys/arch/evbarm/iq80321/obio_space.c | 17 +++++++++--------
sys/arch/iyonix/iyonix/obio_space.c | 17 +++++++++--------
14 files changed, 123 insertions(+), 141 deletions(-)
diffs (truncated from 700 to 300 lines):
diff -r 73e8f91a19f6 -r 6d2be354a0c4 sys/arch/arm/footbridge/footbridge_io.c
--- a/sys/arch/arm/footbridge/footbridge_io.c Sat Feb 22 19:16:06 2014 +0000
+++ b/sys/arch/arm/footbridge/footbridge_io.c Sat Feb 22 20:33:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: footbridge_io.c,v 1.21 2012/02/12 16:34:07 matt Exp $ */
+/* $NetBSD: footbridge_io.c,v 1.22 2014/02/22 20:33:00 matt Exp $ */
/*
* Copyright (c) 1997 Causality Limited
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.21 2012/02/12 16:34:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.22 2014/02/22 20:33:00 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -179,7 +179,8 @@
}
int
-footbridge_mem_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp)
+footbridge_mem_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
+ bus_space_handle_t *bshp)
{
bus_addr_t startpa, endpa, pa;
vaddr_t va;
@@ -214,15 +215,14 @@
/* Now map the pages */
/* The cookie is the physical base address for the I/O area */
- for (pa = startpa; pa < endpa; pa+=PAGE_SIZE, va += PAGE_SIZE) {
- pmap_enter(pmap_kernel(), va, (bus_addr_t)t + pa, VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE| PMAP_WIRED);
- if ((flags & BUS_SPACE_MAP_CACHEABLE) == 0) {
- pt_entry_t *pte;
- pte = vtopte(va);
- *pte &= ~L2_S_CACHE_MASK;
- PTE_SYNC(pte);
- }
+ const int pmapflags =
+ (flags & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
+ ? 0
+ : PMAP_NOCACHE;
+
+ for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
+ pmap_kenter_pa(va, (bus_addr_t)t + pa,
+ VM_PROT_READ | VM_PROT_WRITE, pmapflags);
}
pmap_update(pmap_kernel());
@@ -274,7 +274,7 @@
startva = trunc_page(bsh);
endva = round_page(bsh + size);
- pmap_remove(pmap_kernel(), startva, endva);
+ pmap_kremove(startva, endva);
pmap_update(pmap_kernel());
uvm_km_free(kernel_map, startva, endva - startva, UVM_KMF_VAONLY);
}
diff -r 73e8f91a19f6 -r 6d2be354a0c4 sys/arch/arm/gemini/gemini_space.c
--- a/sys/arch/arm/gemini/gemini_space.c Sat Feb 22 19:16:06 2014 +0000
+++ b/sys/arch/arm/gemini/gemini_space.c Sat Feb 22 20:33:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gemini_space.c,v 1.3 2011/07/01 19:32:28 dyoung Exp $ */
+/* $NetBSD: gemini_space.c,v 1.4 2014/02/22 20:33:00 matt Exp $ */
/* adapted from:
* NetBSD: pxa2x0_space.c,v 1.8 2005/11/24 13:08:32 yamt Exp
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gemini_space.c,v 1.3 2011/07/01 19:32:28 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gemini_space.c,v 1.4 2014/02/22 20:33:00 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -175,10 +175,7 @@
gemini_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
int flag, bus_space_handle_t *bshp)
{
- u_long startpa, endpa, pa;
- vaddr_t va;
- pt_entry_t *pte;
- const struct pmap_devmap *pd;
+ const struct pmap_devmap *pd;
if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
/* Device was statically mapped. */
@@ -186,28 +183,24 @@
return 0;
}
- startpa = trunc_page(bpa);
- endpa = round_page(bpa + size);
+ paddr_t startpa = trunc_page(bpa);
+ paddr_t endpa = round_page(bpa + size);
/* XXX use extent manager to check duplicate mapping */
- va = uvm_km_alloc(kernel_map, endpa - startpa, 0,
+ vaddr_t va = uvm_km_alloc(kernel_map, endpa - startpa, 0,
UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
if (! va)
return(ENOMEM);
*bshp = (bus_space_handle_t)(va + (bpa - startpa));
- for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
- pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
- if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
- pte = vtopte(va);
- *pte &= ~L2_S_CACHE_MASK;
- PTE_SYNC(pte);
- /* XXX: pmap_kenter_pa() also does PTE_SYNC(). a bit of
- * waste.
- */
- }
+ const int pmapflags =
+ (flag & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
+ ? 0
+ : PMAP_NOCACHE;
+ for (paddr_t pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
+ pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);
}
pmap_update(pmap_kernel());
diff -r 73e8f91a19f6 -r 6d2be354a0c4 sys/arch/arm/ixp12x0/ixp12x0_io.c
--- a/sys/arch/arm/ixp12x0/ixp12x0_io.c Sat Feb 22 19:16:06 2014 +0000
+++ b/sys/arch/arm/ixp12x0/ixp12x0_io.c Sat Feb 22 20:33:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixp12x0_io.c,v 1.15 2011/07/01 20:27:50 dyoung Exp $ */
+/* $NetBSD: ixp12x0_io.c,v 1.16 2014/02/22 20:33:00 matt Exp $ */
/*
* Copyright (c) 2002, 2003
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixp12x0_io.c,v 1.15 2011/07/01 20:27:50 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp12x0_io.c,v 1.16 2014/02/22 20:33:00 matt Exp $");
/*
* bus_space I/O functions for ixp12x0
@@ -141,7 +141,6 @@
paddr_t pa;
paddr_t offset;
vaddr_t va;
- pt_entry_t *pte;
if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
/* Device was statically mapped. */
@@ -160,11 +159,12 @@
*bshp = va + offset;
+ const int pmapflags =
+ (flag & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
+ ? 0
+ : PMAP_NOCACHE;
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
- pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
- pte = vtopte(va);
- *pte &= ~L2_S_CACHE_MASK;
- PTE_SYNC(pte);
+ pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);
}
pmap_update(pmap_kernel());
diff -r 73e8f91a19f6 -r 6d2be354a0c4 sys/arch/arm/mainbus/mainbus_io.c
--- a/sys/arch/arm/mainbus/mainbus_io.c Sat Feb 22 19:16:06 2014 +0000
+++ b/sys/arch/arm/mainbus/mainbus_io.c Sat Feb 22 20:33:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus_io.c,v 1.22 2012/07/15 20:53:23 matt Exp $ */
+/* $NetBSD: mainbus_io.c,v 1.23 2014/02/22 20:33:00 matt Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus_io.c,v 1.22 2012/07/15 20:53:23 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus_io.c,v 1.23 2014/02/22 20:33:00 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -177,7 +177,6 @@
{
u_long startpa, endpa, pa;
vaddr_t va;
- pt_entry_t *pte;
if ((u_long)bpa > (u_long)KERNEL_BASE) {
/* XXX This is a temporary hack to aid transition. */
@@ -197,13 +196,12 @@
*bshp = (bus_space_handle_t)(va + (bpa - startpa));
- for(pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
- pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
- if ((flags & BUS_SPACE_MAP_CACHEABLE) == 0) {
- pte = vtopte(va);
- *pte &= ~L2_S_CACHE_MASK;
- PTE_SYNC(pte);
- }
+ const int pmapflags =
+ (flags & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
+ ? 0
+ : PMAP_NOCACHE;
+ for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
+ pmap_kenter_pa(va, pa, VM_PROT_READ|VM_PROT_WRITE, pmapflags);
}
pmap_update(pmap_kernel());
diff -r 73e8f91a19f6 -r 6d2be354a0c4 sys/arch/arm/marvell/mvsoc_space.c
--- a/sys/arch/arm/marvell/mvsoc_space.c Sat Feb 22 19:16:06 2014 +0000
+++ b/sys/arch/arm/marvell/mvsoc_space.c Sat Feb 22 20:33:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mvsoc_space.c,v 1.6 2013/05/29 20:47:14 rkujawa Exp $ */
+/* $NetBSD: mvsoc_space.c,v 1.7 2014/02/22 20:33:00 matt Exp $ */
/*
* Copyright (c) 2007 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsoc_space.c,v 1.6 2013/05/29 20:47:14 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoc_space.c,v 1.7 2014/02/22 20:33:00 matt Exp $");
#include "opt_mvsoc.h"
#include "mvpex.h"
@@ -321,7 +321,6 @@
{
const struct pmap_devmap *pd;
paddr_t startpa, endpa, offset, pa;
- pt_entry_t *pte;
vaddr_t va;
/*
@@ -369,18 +368,14 @@
*handlep = va + offset;
+ const int pmapflags =
+ (flags & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
+ ? 0
+ : PMAP_NOCACHE;
+
/* Now map the pages */
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
- pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
- if ((flags & BUS_SPACE_MAP_CACHEABLE) == 0) {
- pte = vtopte(va);
- *pte &= ~L2_S_CACHE_MASK;
- PTE_SYNC(pte);
- /*
- * XXX: pmap_kenter_pa() also does PTE_SYNC(). a bit of
- * waste.
- */
- }
+ pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);
}
pmap_update(pmap_kernel());
diff -r 73e8f91a19f6 -r 6d2be354a0c4 sys/arch/arm/mpcore/mpcore_space.c
--- a/sys/arch/arm/mpcore/mpcore_space.c Sat Feb 22 19:16:06 2014 +0000
+++ b/sys/arch/arm/mpcore/mpcore_space.c Sat Feb 22 20:33:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpcore_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $ */
+/* $NetBSD: mpcore_space.c,v 1.3 2014/02/22 20:33:00 matt Exp $ */
/* derived from: */
/* NetBSD: imx_space.c,v 1.2 2010/11/13 05:00:31 bsh Exp */
@@ -170,7 +170,6 @@
{
u_long startpa, endpa, pa;
vaddr_t va;
- pt_entry_t *pte;
const struct pmap_devmap *pd;
if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
@@ -191,16 +190,12 @@
*bshp = (bus_space_handle_t)(va + (bpa - startpa));
+ const int pmapflags =
+ (flag & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
+ ? 0
+ : PMAP_NOCACHE;
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
- pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
- if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
- pte = vtopte(va);
- *pte &= ~L2_S_CACHE_MASK;
- PTE_SYNC(pte);
Home |
Main Index |
Thread Index |
Old Index