From 2341768d92be6f4e8acc917902e0c8edf63932fe Mon Sep 17 00:00:00 2001 From: briggs Date: Thu, 24 Jan 2002 04:23:18 +0000 Subject: [PATCH] Two changes for XScale: 1) Add defparam XSCALE_CCLKCFG to define a parameter for the CCLKCFG register. Default it to '9' on the IQ80310. 2) Add a sleep call to the xscale CPU function vector (replacing the nullop) which should drop the CPU into "idle" mode when cpu_switch finds nothing on the run queues. --- sys/arch/arm/arm/cpufunc.c | 16 +++++++++++++--- sys/arch/arm/arm/cpufunc_asm_xscale.S | 14 +++++++++++++- sys/arch/arm/conf/files.arm | 4 +++- sys/arch/arm/include/cpufunc.h | 4 +++- sys/arch/evbarm/conf/std.iq80310 | 3 ++- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/sys/arch/arm/arm/cpufunc.c b/sys/arch/arm/arm/cpufunc.c index 2c731a515180..5e926ebcc016 100644 --- a/sys/arch/arm/arm/cpufunc.c +++ b/sys/arch/arm/arm/cpufunc.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.c,v 1.25 2002/01/23 21:03:07 thorpej Exp $ */ +/* $NetBSD: cpufunc.c,v 1.26 2002/01/24 04:23:19 briggs Exp $ */ /* * arm7tdmi support code Copyright (c) 2001 John Fremlin @@ -47,6 +47,7 @@ #include "opt_compat_netbsd.h" #include "opt_cputypes.h" +#include "opt_cpuoptions.h" #include "opt_pmap_debug.h" #include @@ -627,7 +628,7 @@ struct cpu_functions xscale_cpufuncs = { cpufunc_nullop, /* flush_brnchtgt_C */ (void *)cpufunc_nullop, /* flush_brnchtgt_E */ - (void *)cpufunc_nullop, /* sleep */ + xscale_cpu_sleep, /* sleep */ /* Soft functions */ @@ -695,7 +696,7 @@ struct cpu_functions xscale_writethrough_cpufuncs = { cpufunc_nullop, /* flush_brnchtgt_C */ (void *)cpufunc_nullop, /* flush_brnchtgt_E */ - (void *)cpufunc_nullop, /* sleep */ + xscale_cpu_sleep, /* sleep */ /* Soft functions */ @@ -887,6 +888,15 @@ set_cpufuncs() : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| PMNC_CC_IF)); +#ifdef XSCALE_CCLKCFG + /* + * Crank CCLKCFG to maximum legal value. + */ + __asm __volatile ("mcr p14, 0, %0, c6, c0, 0" + : + : "r" (XSCALE_CCLKCFG)); +#endif + /* * XXX Disable ECC in the Bus Controller Unit; we * don't really support it, yet. Clear any pending diff --git a/sys/arch/arm/arm/cpufunc_asm_xscale.S b/sys/arch/arm/arm/cpufunc_asm_xscale.S index f043dec9ff94..a41ef64ab721 100644 --- a/sys/arch/arm/arm/cpufunc_asm_xscale.S +++ b/sys/arch/arm/arm/cpufunc_asm_xscale.S @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc_asm_xscale.S,v 1.7 2001/11/26 22:26:45 thorpej Exp $ */ +/* $NetBSD: cpufunc_asm_xscale.S,v 1.8 2002/01/24 04:23:19 briggs Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -515,3 +515,15 @@ ENTRY(xscale_context_switch) CPWAIT(r0) mov pc, lr + +/* + * xscale_cpusleep + * + * This is called when there is nothing on any of the run queues. + * We go into IDLE mode so that any IRQ or FIQ will awaken us. + */ +ENTRY(xscale_cpu_sleep) + mov r0, #0x1 + mcr p14, 0, r0, c7, c0, 0 + + mov pc, lr diff --git a/sys/arch/arm/conf/files.arm b/sys/arch/arm/conf/files.arm index eba3fa5cc660..af98a20e68e4 100644 --- a/sys/arch/arm/conf/files.arm +++ b/sys/arch/arm/conf/files.arm @@ -1,4 +1,4 @@ -# $NetBSD: files.arm,v 1.52 2002/01/17 17:26:04 bjh21 Exp $ +# $NetBSD: files.arm,v 1.53 2002/01/24 04:23:19 briggs Exp $ # temporary define to allow easy moving to ../arch/arm/arm32 defflag ARM32 @@ -8,6 +8,8 @@ defflag opt_cputypes.h CPU_ARM2 CPU_ARM250 CPU_ARM3 defflag opt_cputypes.h CPU_ARM6 CPU_ARM7 CPU_ARM7TDMI CPU_ARM8 CPU_ARM9 CPU_SA110 CPU_SA1100 CPU_SA1110 CPU_XSCALE +defparam opt_cpuoptions.h XSCALE_CCLKCFG + # Floating point emulator defflag ARMFPE diff --git a/sys/arch/arm/include/cpufunc.h b/sys/arch/arm/include/cpufunc.h index c0ba5c89a684..0e864bd8e104 100644 --- a/sys/arch/arm/include/cpufunc.h +++ b/sys/arch/arm/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.15 2001/12/20 01:20:23 thorpej Exp $ */ +/* $NetBSD: cpufunc.h,v 1.16 2002/01/24 04:23:19 briggs Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe. @@ -311,6 +311,8 @@ void sa110_setup __P((char *string)); #ifdef CPU_XSCALE void xscale_cpwait __P((void)); +void xscale_cpu_sleep __P((int mode)); + u_int xscale_control __P((u_int clear, u_int bic)); void xscale_setttb __P((u_int ttb)); diff --git a/sys/arch/evbarm/conf/std.iq80310 b/sys/arch/evbarm/conf/std.iq80310 index 261e43e946ff..347c40360955 100644 --- a/sys/arch/evbarm/conf/std.iq80310 +++ b/sys/arch/evbarm/conf/std.iq80310 @@ -1,4 +1,4 @@ -# $NetBSD: std.iq80310,v 1.9 2001/11/24 00:11:00 thorpej Exp $ +# $NetBSD: std.iq80310,v 1.10 2002/01/24 04:23:18 briggs Exp $ # # standard NetBSD/evbarm for IQ80310 options @@ -10,6 +10,7 @@ include "arch/evbarm/conf/files.iq80310" options EXEC_ELF32 options EXEC_AOUT options EXEC_SCRIPT +options XSCALE_CCLKCFG=9 # To support easy transit to ../arch/arm/arm32 options ARM32