source: rtems/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.c @ c5f64d2

4.104.114.84.95
Last change on this file since c5f64d2 was 408bb71, checked in by Till Straumann <strauman@…>, on 11/02/05 at 23:24:48

2005-11-02 straumanatslacdotstanford.edu

  • ChangeLog?, configure.ac, mpc6xx/exceptions/raw_exception.c, shared/include/cpuIdent.c, shared/include/cpuIdent.h: recognize mpc7457 CPU; added definitions for high bats (#4..7) on 7450 CPUs
  • Property mode set to 100644
File size: 2.2 KB
Line 
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 */
24SPR_RO(PVR)
25
26ppc_cpu_id_t current_ppc_cpu = PPC_UNKNOWN;
27ppc_cpu_revision_t current_ppc_revision = 0xff;
28
29char *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_7457:      return "MPC7457";
41    case PPC_603le:             return "MPC603le";
42    case PPC_604e:              return "MPC604e";
43    case PPC_604r:              return "MPC604r";
44    case PPC_620:               return "MPC620";
45    case PPC_860:               return "MPC860";
46    case PPC_8260:              return "MPC8260";
47    case PPC_8245:              return "MPC8245";
48    default:
49      printk("Unknown CPU value of 0x%x. Please add it to "
50             "<libcpu/powerpc/shared/include/cpuIdent.c>\n", cpu );
51  }
52  return "UNKNOWN";
53}
54
55ppc_cpu_id_t get_ppc_cpu_type()
56{
57  unsigned int pvr = (_read_PVR() >> 16);
58  current_ppc_cpu = (ppc_cpu_id_t) pvr;
59  switch (pvr) {
60    case PPC_601:
61    case PPC_5XX:
62    case PPC_603:
63    case PPC_603ev:
64    case PPC_603le:
65    case PPC_604:
66    case PPC_604r:
67    case PPC_750:
68    case PPC_7400:
69    case PPC_7455:
70        case PPC_7457:
71    case PPC_604e:
72    case PPC_620:
73    case PPC_860:
74    case PPC_8260:
75    case PPC_8245:
76      return current_ppc_cpu;
77    default:
78      printk("Unknown PVR value of 0x%x. Please add it to "
79             "<libcpu/powerpc/shared/include/cpuIdent.c>\n", pvr );
80    return PPC_UNKNOWN;
81  }
82}
83
84ppc_cpu_revision_t get_ppc_cpu_revision()
85{
86  ppc_cpu_revision_t rev = (ppc_cpu_revision_t) (_read_PVR() & 0xffff);
87  current_ppc_revision = rev;
88  return rev;
89}
Note: See TracBrowser for help on using the repository browser.