1 | /* |
---|
2 | * cpuIdent.c -- Cpu identification code |
---|
3 | * |
---|
4 | * Copyright (C) 1999 Eric Valette. valette@crf.canon.fr |
---|
5 | * |
---|
6 | * Added MPC8260 Andy Dachs <a.dachs@sstl.co.uk> |
---|
7 | * Surrey Satellite Technology Limited |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | * |
---|
15 | */ |
---|
16 | |
---|
17 | #include <libcpu/cpuIdent.h> |
---|
18 | #include <libcpu/spr.h> |
---|
19 | #include <rtems/bspIo.h> |
---|
20 | |
---|
21 | /* |
---|
22 | * Generate inline code to read Processor Version Register |
---|
23 | */ |
---|
24 | SPR_RO(PVR) |
---|
25 | |
---|
26 | ppc_cpu_id_t current_ppc_cpu = PPC_UNKNOWN; |
---|
27 | ppc_cpu_revision_t current_ppc_revision = 0xff; |
---|
28 | |
---|
29 | char *get_ppc_cpu_type_name(ppc_cpu_id_t cpu) |
---|
30 | { |
---|
31 | switch (cpu) { |
---|
32 | case PPC_601: return "MPC601"; |
---|
33 | case PPC_5XX: return "MPC5XX"; |
---|
34 | case PPC_603: return "MPC603"; |
---|
35 | case PPC_603ev: return "MPC603ev"; |
---|
36 | case PPC_604: return "MPC604"; |
---|
37 | case PPC_750: return "MPC750"; |
---|
38 | case PPC_7400: return "MPC7400"; |
---|
39 | case PPC_7455: return "MPC7455"; |
---|
40 | case PPC_603le: return "MPC603le"; |
---|
41 | case PPC_604e: return "MPC604e"; |
---|
42 | case PPC_604r: return "MPC604r"; |
---|
43 | case PPC_620: return "MPC620"; |
---|
44 | case PPC_860: return "MPC860"; |
---|
45 | case PPC_8260: return "MPC8260"; |
---|
46 | case PPC_8245: return "MPC8245"; |
---|
47 | default: |
---|
48 | printk("Unknown CPU value of 0x%x. Please add it to " |
---|
49 | "<libcpu/powerpc/shared/include/cpuIdent.c>\n", cpu ); |
---|
50 | } |
---|
51 | return "UNKNOWN"; |
---|
52 | } |
---|
53 | |
---|
54 | ppc_cpu_id_t get_ppc_cpu_type() |
---|
55 | { |
---|
56 | unsigned int pvr = (_read_PVR() >> 16); |
---|
57 | current_ppc_cpu = (ppc_cpu_id_t) pvr; |
---|
58 | switch (pvr) { |
---|
59 | case PPC_601: |
---|
60 | case PPC_5XX: |
---|
61 | case PPC_603: |
---|
62 | case PPC_603ev: |
---|
63 | case PPC_603le: |
---|
64 | case PPC_604: |
---|
65 | case PPC_604r: |
---|
66 | case PPC_750: |
---|
67 | case PPC_7400: |
---|
68 | case PPC_7455: |
---|
69 | case PPC_604e: |
---|
70 | case PPC_620: |
---|
71 | case PPC_860: |
---|
72 | case PPC_8260: |
---|
73 | case PPC_8245: |
---|
74 | return current_ppc_cpu; |
---|
75 | default: |
---|
76 | printk("Unknown PVR value of 0x%x. Please add it to " |
---|
77 | "<libcpu/powerpc/shared/include/cpuIdent.c>\n", pvr ); |
---|
78 | return PPC_UNKNOWN; |
---|
79 | } |
---|
80 | } |
---|
81 | |
---|
82 | ppc_cpu_revision_t get_ppc_cpu_revision() |
---|
83 | { |
---|
84 | ppc_cpu_revision_t rev = (ppc_cpu_revision_t) (_read_PVR() & 0xffff); |
---|
85 | current_ppc_revision = rev; |
---|
86 | return rev; |
---|
87 | } |
---|