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

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

1.1     ! init        1: /*
        !             2:  * $Id: cpu.c,v 1.1.1.1 2007/10/12 08:40:38 init Exp $
        !             3:  */
        !             4: #include <sys/types.h>
        !             5: #include <sys/device.h>
        !             6: #include <sys/mem.h>
        !             7: #include <libkern/printf.h>
        !             8:
        !             9: #include <sys/cpu.h>
        !            10:
        !            11:
        !            12: int    cpu_attach(struct device *, uint32_t, uint8_t);
        !            13:
        !            14:
        !            15: struct driver cpu_dr = {
        !            16:        sizeof(struct cpu_dd),
        !            17:        cpu_attach,
        !            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:
        !            35:        return(-1);
        !            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:         */
        !            45: //     uint32_t rd;
        !            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