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