Finally make cpufuncs work properly on acorn26, since something seems to be
using it. This entailed adding support for ARM2 and ARM2as, and allowing for getting CPU IDs other than from CP15, since ARM2(as) doesn't have CP15.
This commit is contained in:
parent
65c9a0b32e
commit
5dbe04b416
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpu.c,v 1.22 2007/03/04 05:59:03 christos Exp $ */
|
||||
/* $NetBSD: cpu.c,v 1.23 2007/03/04 14:47:18 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 Ben Harris
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.22 2007/03/04 05:59:03 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.23 2007/03/04 14:47:18 bjh21 Exp $");
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
@ -62,8 +62,6 @@ static void cpu_arm3_setup(struct device *, int);
|
||||
#endif
|
||||
static void cpu_delay_calibrate(struct device *);
|
||||
|
||||
register_t cpu_type;
|
||||
|
||||
struct cpu_softc {
|
||||
struct device sc_dev;
|
||||
};
|
||||
@ -92,9 +90,9 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
the_cpu = (struct cpu_softc *)self;
|
||||
printf(": ");
|
||||
cpu_type = cpu_identify();
|
||||
cputype = cpu_identify();
|
||||
supported = 0;
|
||||
switch (cpu_type) {
|
||||
switch (cputype) {
|
||||
case CPU_ID_ARM2:
|
||||
printf("ARM2");
|
||||
#ifdef CPU_ARM2
|
||||
@ -110,17 +108,18 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
|
||||
#endif
|
||||
break;
|
||||
case CPU_ID_ARM3:
|
||||
printf("ARM3 (rev. %d)", cpu_type & CPU_ID_REVISION_MASK);
|
||||
printf("ARM3 (rev. %d)", cputype & CPU_ID_REVISION_MASK);
|
||||
#ifdef CPU_ARM3
|
||||
supported = 1;
|
||||
cpu_arm3_setup(self, device_cfdata(self)->cf_flags);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printf("Unknown type, ID=0x%08x", cpu_type);
|
||||
printf("Unknown type, ID=0x%08x", cputype);
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
set_cpufuncs();
|
||||
if (!supported)
|
||||
printf("%s: WARNING: CPU type not supported by kernel\n",
|
||||
self->dv_xname);
|
||||
@ -286,7 +285,7 @@ cpu_cache_flush(void)
|
||||
|
||||
#ifdef CPU_ARM3
|
||||
#if defined(CPU_ARM2) || defined(CPU_ARM250)
|
||||
if ((cpu_type & CPU_ID_CPU_MASK) == CPU_ID_ARM3)
|
||||
if ((cputype & CPU_ID_CPU_MASK) == CPU_ID_ARM3)
|
||||
#endif
|
||||
ARM3_WRITE(ARM3_CP15_FLUSH, 0);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpufunc.c,v 1.78 2007/01/06 00:50:54 christos Exp $ */
|
||||
/* $NetBSD: cpufunc.c,v 1.79 2007/03/04 14:47:18 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* arm7tdmi support code Copyright (c) 2001 John Fremlin
|
||||
@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.78 2007/01/06 00:50:54 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.79 2007/03/04 14:47:18 bjh21 Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_cpuoptions.h"
|
||||
@ -106,6 +106,122 @@ int arm_dcache_align_mask;
|
||||
/* 1 == use cpu_sleep(), 0 == don't */
|
||||
int cpu_do_powersave;
|
||||
|
||||
#ifdef CPU_ARM2
|
||||
struct cpu_functions arm2_cpufuncs = {
|
||||
/* CPU functions */
|
||||
|
||||
arm2_id, /* id */
|
||||
cpufunc_nullop, /* cpwait */
|
||||
|
||||
/* MMU functions */
|
||||
|
||||
(void *)cpufunc_nullop, /* control */
|
||||
NULL, /* domain */
|
||||
NULL, /* setttb */
|
||||
NULL, /* faultstatus */
|
||||
NULL, /* faultaddress */
|
||||
|
||||
/* TLB functions */
|
||||
|
||||
cpufunc_nullop, /* tlb_flushID */
|
||||
(void *)cpufunc_nullop, /* tlb_flushID_SE */
|
||||
cpufunc_nullop, /* tlb_flushI */
|
||||
(void *)cpufunc_nullop, /* tlb_flushI_SE */
|
||||
cpufunc_nullop, /* tlb_flushD */
|
||||
(void *)cpufunc_nullop, /* tlb_flushD_SE */
|
||||
|
||||
/* Cache operations */
|
||||
|
||||
cpufunc_nullop, /* icache_sync_all */
|
||||
(void *) cpufunc_nullop, /* icache_sync_range */
|
||||
|
||||
arm3_cache_flush, /* dcache_wbinv_all */
|
||||
(void *)cpufunc_nullop, /* dcache_wbinv_range */
|
||||
(void *)cpufunc_nullop, /* dcache_inv_range */
|
||||
(void *)cpufunc_nullop, /* dcache_wb_range */
|
||||
|
||||
cpufunc_nullop, /* idcache_wbinv_all */
|
||||
(void *)cpufunc_nullop, /* idcache_wbinv_range */
|
||||
|
||||
/* Other functions */
|
||||
|
||||
cpufunc_nullop, /* flush_prefetchbuf */
|
||||
cpufunc_nullop, /* drain_writebuf */
|
||||
cpufunc_nullop, /* flush_brnchtgt_C */
|
||||
(void *)cpufunc_nullop, /* flush_brnchtgt_E */
|
||||
|
||||
(void *)cpufunc_nullop, /* sleep */
|
||||
|
||||
/* Soft functions */
|
||||
|
||||
early_abort_fixup, /* dataabt_fixup */
|
||||
cpufunc_null_fixup, /* prefetchabt_fixup */
|
||||
|
||||
NULL, /* context_switch */
|
||||
|
||||
(void *)cpufunc_nullop /* cpu setup */
|
||||
|
||||
};
|
||||
#endif /* CPU_ARM2 */
|
||||
|
||||
#ifdef CPU_ARM250
|
||||
struct cpu_functions arm250_cpufuncs = {
|
||||
/* CPU functions */
|
||||
|
||||
arm250_id, /* id */
|
||||
cpufunc_nullop, /* cpwait */
|
||||
|
||||
/* MMU functions */
|
||||
|
||||
(void *)cpufunc_nullop, /* control */
|
||||
NULL, /* domain */
|
||||
NULL, /* setttb */
|
||||
NULL, /* faultstatus */
|
||||
NULL, /* faultaddress */
|
||||
|
||||
/* TLB functions */
|
||||
|
||||
cpufunc_nullop, /* tlb_flushID */
|
||||
(void *)cpufunc_nullop, /* tlb_flushID_SE */
|
||||
cpufunc_nullop, /* tlb_flushI */
|
||||
(void *)cpufunc_nullop, /* tlb_flushI_SE */
|
||||
cpufunc_nullop, /* tlb_flushD */
|
||||
(void *)cpufunc_nullop, /* tlb_flushD_SE */
|
||||
|
||||
/* Cache operations */
|
||||
|
||||
cpufunc_nullop, /* icache_sync_all */
|
||||
(void *) cpufunc_nullop, /* icache_sync_range */
|
||||
|
||||
arm3_cache_flush, /* dcache_wbinv_all */
|
||||
(void *)cpufunc_nullop, /* dcache_wbinv_range */
|
||||
(void *)cpufunc_nullop, /* dcache_inv_range */
|
||||
(void *)cpufunc_nullop, /* dcache_wb_range */
|
||||
|
||||
cpufunc_nullop, /* idcache_wbinv_all */
|
||||
(void *)cpufunc_nullop, /* idcache_wbinv_range */
|
||||
|
||||
/* Other functions */
|
||||
|
||||
cpufunc_nullop, /* flush_prefetchbuf */
|
||||
cpufunc_nullop, /* drain_writebuf */
|
||||
cpufunc_nullop, /* flush_brnchtgt_C */
|
||||
(void *)cpufunc_nullop, /* flush_brnchtgt_E */
|
||||
|
||||
(void *)cpufunc_nullop, /* sleep */
|
||||
|
||||
/* Soft functions */
|
||||
|
||||
early_abort_fixup, /* dataabt_fixup */
|
||||
cpufunc_null_fixup, /* prefetchabt_fixup */
|
||||
|
||||
NULL, /* context_switch */
|
||||
|
||||
(void *)cpufunc_nullop /* cpu setup */
|
||||
|
||||
};
|
||||
#endif /* CPU_ARM250 */
|
||||
|
||||
#ifdef CPU_ARM3
|
||||
struct cpu_functions arm3_cpufuncs = {
|
||||
/* CPU functions */
|
||||
@ -897,7 +1013,7 @@ get_cachetype_cp15()
|
||||
* reserved ID register is encountered, the System Control
|
||||
* processor returns the value of the main ID register.
|
||||
*/
|
||||
if (ctype == cpufunc_id())
|
||||
if (ctype == cpu_id())
|
||||
goto out;
|
||||
|
||||
if ((ctype & CPU_CT_S) == 0)
|
||||
@ -991,7 +1107,7 @@ static void
|
||||
get_cachetype_table()
|
||||
{
|
||||
int i;
|
||||
u_int32_t cpuid = cpufunc_id();
|
||||
u_int32_t cpuid = cpu_id();
|
||||
|
||||
for (i = 0; cachetab[i].ct_cpuid != 0; i++) {
|
||||
if (cachetab[i].ct_cpuid == (cpuid & CPU_ID_CPU_MASK)) {
|
||||
@ -1021,14 +1137,32 @@ get_cachetype_table()
|
||||
int
|
||||
set_cpufuncs()
|
||||
{
|
||||
cputype = cpufunc_id();
|
||||
cputype &= CPU_ID_CPU_MASK;
|
||||
|
||||
if (cputype != 0) {
|
||||
cputype = cpufunc_id();
|
||||
cputype &= CPU_ID_CPU_MASK;
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: cpu_do_powersave defaults to off. If we encounter a
|
||||
* CPU type where we want to use it by default, then we set it.
|
||||
*/
|
||||
|
||||
#ifdef CPU_ARM2
|
||||
if (cputype == CPU_ID_ARM2) {
|
||||
cpufuncs = arm2_cpufuncs;
|
||||
cpu_reset_needs_v4_MMU_disable = 0;
|
||||
get_cachetype_table();
|
||||
return 0;
|
||||
}
|
||||
#endif /* CPU_ARM2 */
|
||||
#ifdef CPU_ARM250
|
||||
if (cputype == CPU_ID_ARM250) {
|
||||
cpufuncs = arm250_cpufuncs;
|
||||
cpu_reset_needs_v4_MMU_disable = 0;
|
||||
get_cachetype_table();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef CPU_ARM3
|
||||
if ((cputype & CPU_ID_IMPLEMENTOR_MASK) == CPU_ID_ARM_LTD &&
|
||||
(cputype & 0x00000f00) == 0x00000300) {
|
||||
@ -1322,6 +1456,22 @@ set_cpufuncs()
|
||||
return(ARCHITECTURE_NOT_PRESENT);
|
||||
}
|
||||
|
||||
#ifdef CPU_ARM2
|
||||
u_int arm2_id(void)
|
||||
{
|
||||
|
||||
return CPU_ID_ARM2;
|
||||
}
|
||||
#endif /* CPU_ARM2 */
|
||||
|
||||
#ifdef CPU_ARM250
|
||||
u_int arm250_id(void)
|
||||
{
|
||||
|
||||
return CPU_ID_ARM250;
|
||||
}
|
||||
#endif /* CPU_ARM250 */
|
||||
|
||||
/*
|
||||
* Fixup routines for data and prefetch aborts.
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpufunc.h,v 1.39 2007/03/04 13:42:51 bjh21 Exp $ */
|
||||
/* $NetBSD: cpufunc.h,v 1.40 2007/03/04 14:47:18 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
||||
@ -197,6 +197,7 @@ extern u_int cputype;
|
||||
#define cpu_setup(a) cpufuncs.cf_setup(a)
|
||||
|
||||
int set_cpufuncs (void);
|
||||
int set_cpufuncs_id (u_int);
|
||||
#define ARCHITECTURE_NOT_PRESENT 1 /* known but not configured */
|
||||
#define ARCHITECTURE_NOT_SUPPORTED 2 /* not known */
|
||||
|
||||
@ -210,6 +211,14 @@ void cpufunc_domains (u_int);
|
||||
u_int cpufunc_faultstatus (void);
|
||||
u_int cpufunc_faultaddress (void);
|
||||
|
||||
#ifdef CPU_ARM2
|
||||
u_int arm2_id (void);
|
||||
#endif /* CPU_ARM2 */
|
||||
|
||||
#ifdef CPU_ARM250
|
||||
u_int arm250_id (void);
|
||||
#endif
|
||||
|
||||
#ifdef CPU_ARM3
|
||||
u_int arm3_control (u_int, u_int);
|
||||
void arm3_cache_flush (void);
|
||||
|
Loading…
Reference in New Issue
Block a user