4.104.114.84.95
Line | |
---|
1 | /* |
---|
2 | * cpuIdent.c -- Cpu identification code |
---|
3 | * |
---|
4 | * Copyright (C) 1999 Eric Valette. valette@crf.canon.fr |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in found in the file LICENSE in this distribution or at |
---|
8 | * http://www.OARcorp.com/rtems/license.html. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | * |
---|
12 | */ |
---|
13 | |
---|
14 | #include <libcpu/spr.h> |
---|
15 | #include <bspIo.h> |
---|
16 | |
---|
17 | /* |
---|
18 | * Generate inline code to read Processor Version Register |
---|
19 | */ |
---|
20 | SPR_RO(PVR) |
---|
21 | |
---|
22 | ppc_cpu_id_t current_ppc_cpu = PPC_UNKNOWN; |
---|
23 | ppc_cpu_revision_t current_ppc_revision = 0xff; |
---|
24 | |
---|
25 | ppc_cpu_id_t get_ppc_cpu_type() |
---|
26 | { |
---|
27 | unsigned int pvr = (_read_PVR() >> 16); |
---|
28 | |
---|
29 | current_ppc_cpu = (ppc_cpu_id_t) pvr; |
---|
30 | switch (pvr) { |
---|
31 | case PPC_601: |
---|
32 | case PPC_603: |
---|
33 | case PPC_603ev: |
---|
34 | case PPC_604: |
---|
35 | case PPC_750: |
---|
36 | case PPC_604e: |
---|
37 | case PPC_604r: |
---|
38 | case PPC_620: |
---|
39 | case PPC_860: |
---|
40 | current_ppc_cpu = (ppc_cpu_id_t) pvr; |
---|
41 | return current_ppc_cpu; |
---|
42 | default: |
---|
43 | printk("Unknown PVR value of 0x%x. Please add it to <libcpu/powerpc/shared/cpu.h>\n", pvr ); |
---|
44 | return PPC_UNKNOWN; |
---|
45 | } |
---|
46 | |
---|
47 | } |
---|
48 | ppc_cpu_revision_t get_ppc_cpu_revision() |
---|
49 | { |
---|
50 | ppc_cpu_revision_t rev = (ppc_cpu_revision_t) (_read_PVR() & 0xffff); |
---|
51 | current_ppc_revision = rev; |
---|
52 | return rev; |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.