Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm clean up cpufuncs of CPU_PJ4B.
details: https://anonhg.NetBSD.org/src/rev/1b0172ca6b55
branches: trunk
changeset: 337464:1b0172ca6b55
user: hsuenaga <hsuenaga%NetBSD.org@localhost>
date: Wed Apr 15 10:52:18 2015 +0000
description:
clean up cpufuncs of CPU_PJ4B.
PJ4B is a ARMv7 compatible CPU, so most of cpufuncs are just redundant.
we need funcs for:
- Marvell specific registers
- workaround of errata
- and Marvell specific L2 cache maintainance
if I/O coherency fabric is enabled(option AURORA_IO_CACHE_COHERENCY),
probaly we don't need to maintain L2 cache by software.
diffstat:
sys/arch/arm/arm/cpufunc.c | 62 ++++++---
sys/arch/arm/arm/cpufunc_asm_pj4b.S | 212 +++++-----------------------------
sys/arch/arm/include/cpufunc_proto.h | 24 +---
3 files changed, 76 insertions(+), 222 deletions(-)
diffs (truncated from 390 to 300 lines):
diff -r 79f146c9d17e -r 1b0172ca6b55 sys/arch/arm/arm/cpufunc.c
--- a/sys/arch/arm/arm/cpufunc.c Wed Apr 15 10:40:36 2015 +0000
+++ b/sys/arch/arm/arm/cpufunc.c Wed Apr 15 10:52:18 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.c,v 1.151 2015/02/25 13:52:42 joerg Exp $ */
+/* $NetBSD: cpufunc.c,v 1.152 2015/04/15 10:52:18 hsuenaga Exp $ */
/*
* arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.151 2015/02/25 13:52:42 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.152 2015/04/15 10:52:18 hsuenaga Exp $");
#include "opt_compat_netbsd.h"
#include "opt_cpuoptions.h"
@@ -88,6 +88,16 @@
#include <arm/xscale/xscalereg.h>
#endif
+#if defined(CPU_PJ4B)
+#include "opt_cputypes.h"
+#include "opt_mvsoc.h"
+#include <machine/bus_defs.h>
+#if defined(ARMADAXP)
+#include <arm/marvell/armadaxpreg.h>
+#include <arm/marvell/armadaxpvar.h>
+#endif
+#endif
+
#if defined(PERFCTRS)
struct arm_pmc_funcs *arm_pmc;
#endif
@@ -1342,57 +1352,63 @@
/* CPU functions */
.cf_id = cpufunc_id,
- .cf_cpwait = pj4b_drain_writebuf,
+ .cf_cpwait = armv7_drain_writebuf,
/* MMU functions */
.cf_control = cpufunc_control,
.cf_domains = cpufunc_domains,
- .cf_setttb = pj4b_setttb,
+ .cf_setttb = armv7_setttb,
.cf_faultstatus = cpufunc_faultstatus,
.cf_faultaddress = cpufunc_faultaddress,
/* TLB functions */
- .cf_tlb_flushID = pj4b_tlb_flushID,
- .cf_tlb_flushID_SE = pj4b_tlb_flushID_SE,
- .cf_tlb_flushI = pj4b_tlb_flushID,
- .cf_tlb_flushI_SE = pj4b_tlb_flushID_SE,
- .cf_tlb_flushD = pj4b_tlb_flushID,
- .cf_tlb_flushD_SE = pj4b_tlb_flushID_SE,
+ .cf_tlb_flushID = armv7_tlb_flushID,
+ .cf_tlb_flushID_SE = armv7_tlb_flushID_SE,
+ .cf_tlb_flushI = armv7_tlb_flushID,
+ .cf_tlb_flushI_SE = armv7_tlb_flushID_SE,
+ .cf_tlb_flushD = armv7_tlb_flushID,
+ .cf_tlb_flushD_SE = armv7_tlb_flushID_SE,
/* Cache operations */
.cf_icache_sync_all = armv7_idcache_wbinv_all,
- .cf_icache_sync_range = pj4b_icache_sync_range,
+ .cf_icache_sync_range = armv7_icache_sync_range,
.cf_dcache_wbinv_all = armv7_dcache_wbinv_all,
- .cf_dcache_wbinv_range = pj4b_dcache_wbinv_range,
- .cf_dcache_inv_range = pj4b_dcache_inv_range,
- .cf_dcache_wb_range = pj4b_dcache_wb_range,
-
+ .cf_dcache_wbinv_range = armv7_dcache_wbinv_range,
+ .cf_dcache_inv_range = armv7_dcache_inv_range,
+ .cf_dcache_wb_range = armv7_dcache_wb_range,
+
+#if !defined(AURORA_IO_CACHE_COHERENCY) && defined(ARMADAXP)
+ .cf_sdcache_wbinv_range = armadaxp_sdcache_wbinv_range,
+ .cf_sdcache_inv_range = armadaxp_sdcache_inv_range,
+ .cf_sdcache_wb_range = armadaxp_sdcache_wb_range,
+#else
.cf_sdcache_wbinv_range = (void *)cpufunc_nullop,
.cf_sdcache_inv_range = (void *)cpufunc_nullop,
.cf_sdcache_wb_range = (void *)cpufunc_nullop,
+#endif
.cf_idcache_wbinv_all = armv7_idcache_wbinv_all,
- .cf_idcache_wbinv_range = pj4b_idcache_wbinv_range,
+ .cf_idcache_wbinv_range = armv7_idcache_wbinv_range,
/* Other functions */
- .cf_flush_prefetchbuf = pj4b_drain_readbuf,
- .cf_drain_writebuf = pj4b_drain_writebuf,
- .cf_flush_brnchtgt_C = pj4b_flush_brnchtgt_all,
- .cf_flush_brnchtgt_E = pj4b_flush_brnchtgt_va,
-
- .cf_sleep = (void *)cpufunc_nullop,
+ .cf_flush_prefetchbuf = cpufunc_nullop,
+ .cf_drain_writebuf = armv7_drain_writebuf,
+ .cf_flush_brnchtgt_C = cpufunc_nullop,
+ .cf_flush_brnchtgt_E = (void *)cpufunc_nullop,
+
+ .cf_sleep = pj4b_cpu_sleep,
/* Soft functions */
.cf_dataabt_fixup = cpufunc_null_fixup,
.cf_prefetchabt_fixup = cpufunc_null_fixup,
- .cf_context_switch = pj4b_context_switch,
+ .cf_context_switch = armv7_context_switch,
.cf_setup = pj4bv7_setup
};
diff -r 79f146c9d17e -r 1b0172ca6b55 sys/arch/arm/arm/cpufunc_asm_pj4b.S
--- a/sys/arch/arm/arm/cpufunc_asm_pj4b.S Wed Apr 15 10:40:36 2015 +0000
+++ b/sys/arch/arm/arm/cpufunc_asm_pj4b.S Wed Apr 15 10:52:18 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc_asm_pj4b.S,v 1.6 2015/03/26 08:50:42 hsuenaga Exp $ */
+/* $NetBSD: cpufunc_asm_pj4b.S,v 1.7 2015/04/15 10:52:18 hsuenaga Exp $ */
/*******************************************************************************
Copyright (C) Marvell International Ltd. and its affiliates
@@ -41,189 +41,49 @@
#include <arm/asm.h>
#include <arm/locore.h>
-#define TTB_RGN_OC_WB (3 << 3)
-#define TTB_IRGN_WB ((1 << 0) | (1 << 6))
-
-/* PTWs cacheable, inner WB not shareable, outer WB not shareable */
-#define TTB_FLAGS_UP (TTB_IRGN_WB | TTB_RGN_OC_WB)
-
.Lpj4b_cache_line_size:
.word _C_LABEL(arm_dcache_align)
-ENTRY(pj4b_setttb)
- /* Cache synchronization is not required as this core has PIPT caches */
- dsb
-#if defined(L2CACHE_ENABLE) && defined(AURORA_L2_PT_WALK)
- orr r2, r0, #TTB_FLAGS_UP
-#else
- bic r2, r0, #0x18
-#endif
- mcr p15, 0, r2, c2, c0, 0 /* load TTBR0 */
-#ifdef ARM_MMU_EXTENDED
- cmp r1, #0
- mcreq p15, 0, r2, c2, c0, 1 /* load TTBR1 */
-#else
- mov r0, #0
- mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */
-#endif
- isb
- dsb
- RET
-END(pj4b_setttb)
-
-ENTRY(pj4b_tlb_flushID)
- mcr p15, 0, r0, c8, c7, 0 /* flush I+D tlb */
- dsb
- RET
-END(pj4b_tlb_flushID)
-
-ENTRY(pj4b_tlb_flushID_SE)
- bfc r0, #0, #12 @ always KERNEL_PID (i.e. 0)
- mcr p15, 0, r0, c8, c7, 1 @flush I+D tlb single entry
-#if PAGE_SIZE == 2 * L2_S_SIZE
- add r0, r0, L2_S_SIZE
- mcr p15, 0, r0, c8, c7, 1 @flush I+D tlb single entry
-#endif
- dsb
- RET
-END(pj4b_tlb_flushID_SE)
-
-ENTRY(pj4b_icache_sync_range)
- ldr ip, .Lpj4b_cache_line_size
- ldr ip, [ip]
- sub r1, r1, #1 /* Don't overrun */
- sub r3, ip, #1
- and r2, r0, r3
- add r1, r1, r2
- bic r0, r0, r3
-1:
- mcr p15, 0, r0, c7, c5, 1 /* Invalidate I cache SE with VA */
- mcr p15, 0, r0, c7, c14, 1 /* Clean and invalidate D cache SE with VA */
- add r0, r0, ip
- subs r1, r1, ip
- bpl 1b
- isb /* instruction synchronization barrier */
- dsb
- RET
-END(pj4b_icache_sync_range)
-
-ENTRY(pj4b_dcache_inv_range)
- ldr ip, .Lpj4b_cache_line_size
- ldr ip, [ip]
- sub r1, r1, #1 /* Don't overrun */
- sub r3, ip, #1
- and r2, r0, r3
- add r1, r1, r2
- bic r0, r0, r3
-1:
- mcr p15, 0, r0, c7, c6, 1
- add r0, r0, ip
- subs r1, r1, ip
- bpl 1b
+ENTRY(pj4b_cpu_sleep)
dsb
- RET
-END(pj4b_dcache_inv_range)
-
-ENTRY(pj4b_idcache_wbinv_range)
- ldr ip, .Lpj4b_cache_line_size
- ldr ip, [ip]
- sub r1, r1, #1 /* Don't overrun */
- sub r3, ip, #1
- and r2, r0, r3
- add r1, r1, r2
- bic r0, r0, r3
-1:
- mcr p15, 0, r0, c7, c5, 1
- mcr p15, 0, r0, c7, c14, 1 /* L2C clean and invalidate entry */
- add r0, r0, ip
- subs r1, r1, ip
- bpl 1b
- dsb
- RET
-END(pj4b_idcache_wbinv_range)
-
-ENTRY(pj4b_dcache_wbinv_range)
- ldr ip, .Lpj4b_cache_line_size
- ldr ip, [ip]
- sub r1, r1, #1 /* Don't overrun */
- sub r3, ip, #1
- and r2, r0, r3
- add r1, r1, r2
- bic r0, r0, r3
-1:
- mcr p15, 0, r0, c7, c14, 1
- add r0, r0, ip
- subs r1, r1, ip
- bpl 1b
- dsb
- RET
-END(pj4b_dcache_wbinv_range)
-
-ENTRY(pj4b_dcache_wb_range)
- ldr ip, .Lpj4b_cache_line_size
- ldr ip, [ip]
- sub r1, r1, #1 /* Don't overrun */
- sub r3, ip, #1
- and r2, r0, r3
- add r1, r1, r2
- bic r0, r0, r3
-1:
- mcr p15, 0, r0, c7, c14, 1 /* Clean and invalidate D cache SE with VA */
- add r0, r0, ip
- subs r1, r1, ip
- bpl 1b
- dsb
- RET
-END(pj4b_dcache_wb_range)
-
-ENTRY(pj4b_drain_readbuf)
- isb
- RET
-END(pj4b_drain_readbuf)
-
-ENTRY(pj4b_drain_writebuf)
- dsb
- RET
-END(pj4b_drain_writebuf)
-
-ENTRY(pj4b_flush_brnchtgt_all)
- mcr p15, 0, r0, c7, c5, 6 /* flush entrie branch target cache */
- RET
-END(pj4b_flush_brnchtgt_all)
-
-ENTRY(pj4b_flush_brnchtgt_va)
- mcr p15, 0, r0, c7, c5, 7 /* flush branch target cache by VA */
- RET
-END(pj4b_flush_brnchtgt_va)
-
-ENTRY(pj4b_context_switch)
- dsb
-#if defined(L2CACHE_ENABLE) && defined(AURORA_L2_PT_WALK)
- orr r2, r0, #TTB_FLAGS_UP
-#else
- bic r2, r0, #0x18
-#endif
- mcr p15, 0, r2, c2, c0, 0 @set the new TTBR0
-#ifdef ARM_MMU_EXTENDED
- cmp r1, #0
- mcreq p15, 0, r2, c2, c0, 1 @set the new TTBR1
Home |
Main Index |
Thread Index |
Old Index