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

4.104.114.84.95
Last change on this file since d49389a was d49389a, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 20, 2003 at 10:07:22 PM

2003-02-20 Till Straumann <strauman@…>

PR 349/bsps

  • mpc6xx/exceptions/raw_exception.c, mpc6xx/mmu/bat.c, mpc6xx/mmu/pte121.c, shared/include/cpuIdent.c, shared/include/cpuIdent.h, shared/src/Makefile.am, shared/src/stack.c, shared/src/stackTrace.h, powerpc/registers.h:
    • undo improper 'fix' who broke mpc604r identification
    • fix: 7400 identification PVR value was wrong
    • enhance 'setdbat()' to switch OFF a given BAT if called with 0 size
    • fix: page table support bugfix
    • enhancement: provide routines to take and print stack trace snapshots
    • add definitions for HID1 and DABR SPRs
  • Property mode set to 100644
File size: 1.9 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.OARcorp.com/rtems/license.html.
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_603:               return "MPC603";
34    case PPC_603ev:             return "MPC603ev";
35    case PPC_604:               return "MPC604";
36    case PPC_750:               return "MPC750";
37    case PPC_7400:              return "MPC7400";
38    case PPC_604e:              return "MPC604e";
39    case PPC_604r:              return "MPC604r";
40    case PPC_620:               return "MPC620";
41    case PPC_860:               return "MPC860";
42    case PPC_8260:              return "MPC8260";
43    default:
44      printk("Unknown CPU value of 0x%x. Please add it to <libcpu/powerpc/shared/cpu.h>\n", cpu );
45  }
46  return "UNKNOWN";
47}
48
49ppc_cpu_id_t get_ppc_cpu_type()
50{
51  unsigned int pvr = (_read_PVR() >> 16);
52  current_ppc_cpu = (ppc_cpu_id_t) pvr;
53  switch (pvr) {
54    case PPC_601:
55    case PPC_603:
56    case PPC_603ev:
57    case PPC_604:
58    /* case PPC_604r: */
59    case PPC_750:
60    case PPC_7400:
61    case PPC_604e:
62    case PPC_620:
63    case PPC_860:
64    case PPC_8260:
65      return current_ppc_cpu;
66    default:
67      printk("Unknown PVR value of 0x%x. Please add it to <libcpu/powerpc/shared/cpu.h>\n", pvr );
68    return PPC_UNKNOWN;
69  }
70}
71
72ppc_cpu_revision_t get_ppc_cpu_revision()
73{
74  ppc_cpu_revision_t rev = (ppc_cpu_revision_t) (_read_PVR() & 0xffff);
75  current_ppc_revision = rev;
76  return rev;
77}
Note: See TracBrowser for help on using the repository browser.