diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-12-02 14:58:38 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-12-02 14:58:38 +0000 |
commit | 3a9605429c62e495318c255aab2aaf9d19656350 (patch) | |
tree | d59b839e7e3bea8ba4bd557500ff59908bbd167c /c/src/lib/libcpu | |
parent | Merged of mcp750 and mvme2307 BSP by Eric Valette <valette@crf.canon.fr>. (diff) | |
download | rtems-3a9605429c62e495318c255aab2aaf9d19656350.tar.bz2 |
Merged of mcp750 and mvme2307 BSP by Eric Valette <valette@crf.canon.fr>.
As part of this effort, the mpc750 libcpu code is now shared with the
ppc6xx.
Diffstat (limited to 'c/src/lib/libcpu')
-rw-r--r-- | c/src/lib/libcpu/powerpc/shared/cpuIdent.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/powerpc/shared/cpuIdent.c b/c/src/lib/libcpu/powerpc/shared/cpuIdent.c new file mode 100644 index 0000000000..0bc058acfe --- /dev/null +++ b/c/src/lib/libcpu/powerpc/shared/cpuIdent.c @@ -0,0 +1,53 @@ +/* + * cpuIdent.c -- Cpu identification code + * + * Copyright (C) 1999 Eric Valette. valette@crf.canon.fr + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + * + */ + +#include <libcpu/spr.h> + +/* + * Generate inline code to read Processor Version Register + */ +SPR_RO(PVR) + +ppc_cpu_id_t current_ppc_cpu = PPC_UNKNOWN; +ppc_cpu_revision_t current_ppc_revision = 0xff; + +ppc_cpu_id_t get_ppc_cpu_type() +{ + unsigned int pvr = (_read_PVR() >> 16) ; + + current_ppc_cpu = (ppc_cpu_id_t) pvr; + switch (pvr) { + case PPC_601 : + case PPC_603 : + case PPC_604 : + case PPC_603e : + case PPC_603ev: + case PPC_750 : + case PPC_604e : + case PPC_604r : + case PPC_620 : + case PPC_860 : + current_ppc_cpu = (ppc_cpu_id_t) pvr; + return current_ppc_cpu; + default : + printk("Unknown PVR value. Please add it to <libcpu/powerpc/shared/cpu.h> \n"); + return PPC_UNKNOWN; + } + +} +ppc_cpu_revision_t get_ppc_cpu_revision() +{ + ppc_cpu_revision_t rev = (ppc_cpu_revision_t) (_read_PVR() & 0xffff); + current_ppc_revision = rev; + return rev; +} |