Annotation of funnyos/dev/cpu.c, Revision 1.4
1.1 init 1: /*
1.4 ! init 2: * $Id: cpu.c,v 1.3 2007/10/16 17:33:40 init Exp $
1.1 init 3: */
4: #include <sys/types.h>
5: #include <sys/device.h>
6: #include <libkern/printf.h>
7:
1.3 init 8: #include <dev/cpuvar.h>
1.1 init 9:
10:
11: int cpu_attach(struct device *, uint32_t, uint8_t);
12:
13:
14: struct driver cpu_dr = {
15: sizeof(struct cpu_dd),
16: cpu_attach,
1.4 ! init 17: NULL,
1.1 init 18: NULL
19: };
20:
21: void cpu_identify(struct cpu_dd *);
22:
23: int
24: cpu_attach(struct device *self, uint32_t loc, uint8_t flags)
25: {
26: struct cpu_dd *ddp = self->dv_devdata;
27:
28: /* identify CPU */
29: cpu_identify(ddp);
30:
31:
32: printf("%s CPU at %d MHz (flags=0x%x)\n", ddp->cpu_name,
33: ddp->cpu_freq, ddp->cpu_flags);
34:
1.2 init 35: return(0);
1.1 init 36: }
37:
38:
39: void
40: cpu_identify(struct cpu_dd *ddp)
41: {
42: /*
43: * Identify given CPU using cp15 (System Control Co-Processor) register 0 (ID)
44: */
1.3 init 45: uint32_t rd;
1.1 init 46:
47: /* store cp15 ID register into rd */
48: // __asm __volatile("mrc p15 0, %0, c0, c0, 0"
49: // :"=r" (rd));
50:
51: /* parse ID; See the ARM Architecture Reference Manual for details. */
52: /* XXX */
53:
54: ddp->cpu_name = "StrongARM SA110";
55: ddp->cpu_freq = 233;
56: ddp->cpu_flags = CPU_HAVE_ICACHE | CPU_HAVE_DCACHE | CPU_HAVE_MMU;
57: }
58:
CVSweb