[BACK]Return to cpu.c CVS log [TXT][DIR] Up to [local] / funnyos / dev

Annotation of funnyos/dev/cpu.c, Revision 1.3

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

CVSweb