Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Use pmap_kenter flags to create cached/uncached ent...
details: https://anonhg.NetBSD.org/src/rev/c1bbff441733
branches: trunk
changeset: 816535:c1bbff441733
user: matt <matt%NetBSD.org@localhost>
date: Mon Jul 11 16:18:55 2016 +0000
description:
Use pmap_kenter flags to create cached/uncached entries.
#include <mips/locore.h> when appropriate
diffstat:
sys/arch/arc/arc/bus_space_sparse.c | 53 ++++++++++-----------------------
sys/arch/arc/arc/c_nec_eisa.c | 6 ++-
sys/arch/emips/emips/interrupt.c | 8 ++--
sys/arch/emips/emips/xilinx_ml40x.c | 6 +-
sys/arch/emips/emips/xs_bee3.c | 6 +-
sys/arch/evbmips/cavium/machdep.c | 20 ++++++++++-
sys/arch/evbmips/gdium/machdep.c | 6 +-
sys/arch/evbmips/malta/machdep.c | 6 +-
sys/arch/hpcmips/hpcmips/bus_space.c | 57 +++++++++++++++++------------------
sys/arch/hpcmips/tx/tx3912video.c | 6 ++-
10 files changed, 85 insertions(+), 89 deletions(-)
diffs (truncated from 443 to 300 lines):
diff -r 7564da98c692 -r c1bbff441733 sys/arch/arc/arc/bus_space_sparse.c
--- a/sys/arch/arc/arc/bus_space_sparse.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/arc/arc/bus_space_sparse.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space_sparse.c,v 1.18 2011/07/01 19:28:00 dyoung Exp $ */
+/* $NetBSD: bus_space_sparse.c,v 1.19 2016/07/11 16:18:55 matt Exp $ */
/* NetBSD: bus_machdep.c,v 1.1 2000/01/26 18:48:00 drochner Exp */
/*-
@@ -39,42 +39,21 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.18 2011/07/01 19:28:00 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.19 2016/07/11 16:18:55 matt Exp $");
#include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/extent.h>
#include <sys/malloc.h>
-#include <sys/extent.h>
+#include <sys/systm.h>
#include <uvm/uvm_extern.h>
-#include <mips/cpuregs.h>
+#include <mips/locore.h>
#include <mips/pte.h>
-#include <sys/bus.h>
-
extern paddr_t kvtophys(vaddr_t); /* XXX */
-static void arc_kseg2_make_cacheable(vaddr_t vaddr, vsize_t size);
-
-static void
-arc_kseg2_make_cacheable(vaddr_t vaddr, vsize_t size)
-{
- vaddr_t start, end;
- pt_entry_t *pte;
- uint32_t entry, mask;
-
- start = mips_trunc_page(vaddr);
- end = mips_round_page(vaddr + size);
- mask = ~(CPUISMIPS3 ? MIPS3_PG_UNCACHED : MIPS1_PG_N);
- for (; start < end; start += PAGE_SIZE) {
- pte = kvtopte(start);
- entry = pte->pt_entry & mask;
- pte->pt_entry &= entry;
- tlb_update(start, entry);
- }
-}
-
void
arc_sparse_bus_space_init(bus_space_tag_t bst, const char *name, paddr_t paddr,
bus_addr_t start, bus_size_t size)
@@ -96,7 +75,9 @@
* Since all buses can be linearly mappable, we don't have to check
* BUS_SPACE_MAP_LINEAR and BUS_SPACE_MAP_PREFETCHABLE.
*/
- int cacheable = (flags & BUS_SPACE_MAP_CACHEABLE);
+ const u_int pmap_flags = (flags & BUS_SPACE_MAP_CACHEABLE)
+ ? PMAP_WRITE_BACK
+ : 0;
/*
* XXX - `bst->bs_pbase' must be page aligned,
@@ -111,22 +92,20 @@
MIPS_PHYS_TO_KSEG0(start) :
MIPS_PHYS_TO_KSEG1(start));
} else {
- vaddr_t va,
- vaddr = uvm_km_alloc(kernel_map, (vsize_t)(end - start), 0,
- UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
+ vaddr_t vaddr = uvm_km_alloc(kernel_map, (vsize_t)(end - start),
+ 0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
if (vaddr == 0)
panic("arc_sparse_bus_space_compose_handle: "
"cannot allocate KVA 0x%llx..0x%llx",
start, end);
- for (va = vaddr; start < end;
- start += PAGE_SIZE, va += PAGE_SIZE)
- pmap_kenter_pa(va, start,
- VM_PROT_READ|VM_PROT_WRITE, 0);
+ for (vaddr_t va = vaddr; start < end;
+ start += PAGE_SIZE, va += PAGE_SIZE) {
+ pmap_kenter_pa(va, start, VM_PROT_READ|VM_PROT_WRITE,
+ pmap_flags);
+ }
pmap_update(pmap_kernel());
vaddr += (offset & PGOFSET);
- if (cacheable)
- arc_kseg2_make_cacheable(vaddr, size);
*bshp = vaddr;
}
return 0;
diff -r 7564da98c692 -r c1bbff441733 sys/arch/arc/arc/c_nec_eisa.c
--- a/sys/arch/arc/arc/c_nec_eisa.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/arc/arc/c_nec_eisa.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: c_nec_eisa.c,v 1.16 2011/02/20 07:52:42 matt Exp $ */
+/* $NetBSD: c_nec_eisa.c,v 1.17 2016/07/11 16:18:55 matt Exp $ */
/*-
* Copyright (c) 2003 Izumi Tsutsui. All rights reserved.
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.16 2011/02/20 07:52:42 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.17 2016/07/11 16:18:55 matt Exp $");
#define __INTR_PRIVATE
#include <sys/param.h>
@@ -66,6 +66,8 @@
#include <uvm/uvm_extern.h>
+#include <mips/locore.h>
+
#include <machine/autoconf.h>
#include <machine/pio.h>
#include <machine/platform.h>
diff -r 7564da98c692 -r c1bbff441733 sys/arch/emips/emips/interrupt.c
--- a/sys/arch/emips/emips/interrupt.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/emips/emips/interrupt.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.5 2012/10/27 17:17:46 chs Exp $ */
+/* $NetBSD: interrupt.c,v 1.6 2016/07/11 16:18:56 matt Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.5 2012/10/27 17:17:46 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.6 2016/07/11 16:18:56 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -84,11 +84,11 @@
tlb.tlb_hi = INTERRUPT_CONTROLLER_DEFAULT_ADDRESS;
tlb.tlb_lo0 = INTERRUPT_CONTROLLER_DEFAULT_ADDRESS | 0xf02;
- tlb_write_indexed(4, &tlb);
+ tlb_write_entry(4, &tlb);
tlb.tlb_hi = TIMER_DEFAULT_ADDRESS;
tlb.tlb_lo0 = TIMER_DEFAULT_ADDRESS | 0xf02;
- tlb_write_indexed(5, &tlb);
+ tlb_write_entry(5, &tlb);
}
/*
diff -r 7564da98c692 -r c1bbff441733 sys/arch/emips/emips/xilinx_ml40x.c
--- a/sys/arch/emips/emips/xilinx_ml40x.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/emips/emips/xilinx_ml40x.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xilinx_ml40x.c,v 1.3 2014/03/24 20:06:31 christos Exp $ */
+/* $NetBSD: xilinx_ml40x.c,v 1.4 2016/07/11 16:18:56 matt Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xilinx_ml40x.c,v 1.3 2014/03/24 20:06:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xilinx_ml40x.c,v 1.4 2016/07/11 16:18:56 matt Exp $");
#define __INTR_PRIVATE
@@ -122,7 +122,7 @@
tlb.tlb_hi = USART_DEFAULT_ADDRESS;
tlb.tlb_lo0 = USART_DEFAULT_ADDRESS | 0xf02;
- tlb_write_indexed(3, &tlb);
+ tlb_write_entry(3, &tlb);
#endif
dz_ebus_cnsetup(USART_DEFAULT_ADDRESS);
diff -r 7564da98c692 -r c1bbff441733 sys/arch/emips/emips/xs_bee3.c
--- a/sys/arch/emips/emips/xs_bee3.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/emips/emips/xs_bee3.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xs_bee3.c,v 1.4 2014/03/24 20:06:31 christos Exp $ */
+/* $NetBSD: xs_bee3.c,v 1.5 2016/07/11 16:18:56 matt Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xs_bee3.c,v 1.4 2014/03/24 20:06:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xs_bee3.c,v 1.5 2016/07/11 16:18:56 matt Exp $");
#define __INTR_PRIVATE
@@ -119,7 +119,7 @@
tlb.tlb_hi = USART_DEFAULT_ADDRESS;
tlb.tlb_lo0 = USART_DEFAULT_ADDRESS | 0xf02;
- tlb_write_indexed(3, &tlb);
+ tlb_write_entry(3, &tlb);
#endif
dz_ebus_cnsetup(USART_DEFAULT_ADDRESS);
diff -r 7564da98c692 -r c1bbff441733 sys/arch/evbmips/cavium/machdep.c
--- a/sys/arch/evbmips/cavium/machdep.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/evbmips/cavium/machdep.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.5 2015/06/10 22:31:00 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.6 2016/07/11 16:18:56 matt Exp $ */
/*
* Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -114,7 +114,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.5 2015/06/10 22:31:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.6 2016/07/11 16:18:56 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -179,6 +179,8 @@
struct octeon_config octeon_configuration;
struct octeon_btinfo octeon_btinfo;
+char octeon_nmi_stack[PAGE_SIZE] __section(".data1") __aligned(PAGE_SIZE);
+
/*
* Do all the stuff that locore normally does before calling main().
*/
@@ -192,7 +194,7 @@
mach_init_bss();
KASSERT(MIPS_XKPHYS_P(arg3));
- btinfo_paddr = mips64_ld_a64(arg3 + OCTEON_BTINFO_PADDR_OFFSET);
+ btinfo_paddr = mips3_ld(arg3 + OCTEON_BTINFO_PADDR_OFFSET);
/* Should be in first 256MB segment */
KASSERT(btinfo_paddr < 256 * 1024 * 1024);
@@ -235,6 +237,18 @@
boothowto = RB_AUTOBOOT;
boothowto |= AB_VERBOSE;
+#if 0
+ curcpu()->ci_nmi_stack = octeon_nmi_stack + sizeof(octeon_nmi_stack) - sizeof(struct kernframe);
+ *(uint64_t *)MIPS_PHYS_TO_KSEG0(0x800) = (intptr_t)octeon_reset_vector;
+ const uint64_t wdog_reg = MIPS_PHYS_TO_XKPHYS_UNCACHED(CIU_WDOG0);
+ uint64_t wdog = mips3_ld(wdog_reg);
+ wdog &= ~(CIU_WDOGX_MODE|CIU_WDOGX_LEN);
+ wdog |= __SHIFTIN(3, CIU_WDOGX_MODE);
+ wdog |= CIU_WDOGX_LEN; // max period
+ mips64_sd_a64(wdog_reg, wdog);
+ printf("Watchdog enabled!\n");
+#endif
+
#if defined(DDB)
if (boothowto & RB_KDB)
Debugger();
diff -r 7564da98c692 -r c1bbff441733 sys/arch/evbmips/gdium/machdep.c
--- a/sys/arch/evbmips/gdium/machdep.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/evbmips/gdium/machdep.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.18 2016/02/01 17:37:39 christos Exp $ */
+/* $NetBSD: machdep.c,v 1.19 2016/07/11 16:18:56 matt Exp $ */
/*
* Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.18 2016/02/01 17:37:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.19 2016/07/11 16:18:56 matt Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -255,7 +255,7 @@
/*
* Disable the 2nd PCI window since we don't need it.
*/
- mips3_sd((uint64_t *)MIPS_PHYS_TO_KSEG1(BONITO_REGBASE + 0x158), 0xe);
+ mips3_sd(MIPS_PHYS_TO_KSEG1(BONITO_REGBASE + 0x158), 0xe);
pci_conf_write(&gc->gc_pc, pci_make_tag(&gc->gc_pc, 0, 0, 0), 18, 0);
/*
diff -r 7564da98c692 -r c1bbff441733 sys/arch/evbmips/malta/machdep.c
--- a/sys/arch/evbmips/malta/machdep.c Mon Jul 11 16:15:35 2016 +0000
+++ b/sys/arch/evbmips/malta/machdep.c Mon Jul 11 16:18:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.44 2015/06/01 22:55:12 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.45 2016/07/11 16:18:56 matt Exp $ */
Home |
Main Index |
Thread Index |
Old Index