version 1.1, 2007/10/16 09:41:04 |
version 1.5, 2007/11/12 13:10:19 |
|
|
*/ |
*/ |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/device.h> |
#include <sys/device.h> |
#include <sys/mem.h> |
|
#include <libkern/printf.h> |
#include <libkern/printf.h> |
|
|
#include <sys/cpu.h> |
#include <dev/cpuvar.h> |
|
|
|
|
int cpu_attach(struct device *, uint32_t, uint8_t); |
int cpu_attach(struct device *, uint32_t, uint8_t); |
|
|
struct driver cpu_dr = { |
struct driver cpu_dr = { |
sizeof(struct cpu_dd), |
sizeof(struct cpu_dd), |
cpu_attach, |
cpu_attach, |
|
NULL, |
NULL |
NULL |
}; |
}; |
|
|
void cpu_identify(struct cpu_dd *); |
|
|
|
int |
int |
cpu_attach(struct device *self, uint32_t loc, uint8_t flags) |
cpu_attach(struct device *self, uint32_t loc, uint8_t flags) |
{ |
{ |
struct cpu_dd *ddp = self->dv_devdata; |
printf("ARM CPU\n"); |
|
|
/* identify CPU */ |
return(0); |
cpu_identify(ddp); |
|
|
|
|
|
printf("%s CPU at %d MHz (flags=0x%x)\n", ddp->cpu_name, |
|
ddp->cpu_freq, ddp->cpu_flags); |
|
|
|
return(-1); |
|
} |
} |
|
|
|
|
void |
|
cpu_identify(struct cpu_dd *ddp) |
|
{ |
|
/* |
|
* Identify given CPU using cp15 (System Control Co-Processor) register 0 (ID) |
|
*/ |
|
// uint32_t rd; |
|
|
|
/* store cp15 ID register into rd */ |
|
// __asm __volatile("mrc p15 0, %0, c0, c0, 0" |
|
// :"=r" (rd)); |
|
|
|
/* parse ID; See the ARM Architecture Reference Manual for details. */ |
|
/* XXX */ |
|
|
|
ddp->cpu_name = "StrongARM SA110"; |
|
ddp->cpu_freq = 233; |
|
ddp->cpu_flags = CPU_HAVE_ICACHE | CPU_HAVE_DCACHE | CPU_HAVE_MMU; |
|
} |
|
|
|