source: rtems/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.h @ 9ec91233

4.104.114.9
Last change on this file since 9ec91233 was 25a92bc1, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Jul 11, 2008 at 10:02:12 AM

adapted powerpc exception code

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * Copyright (C) 1999  Eric Valette (valette@crf.canon.fr)
3 *                     Canon Centre Recherche France.
4 *
5 *  Added MPC8260 Andy Dachs <a.dachs@sstl.co.uk>
6 *  Surrey Satellite Technology Limited
7 *
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#ifndef _LIBCPU_CPUIDENT_H
17#define _LIBCPU_CPUIDENT_H
18
19#include <stdbool.h>
20
21#ifndef ASM
22typedef enum
23{
24  PPC_601 = 0x1,
25  PPC_5XX = 0x2,
26  PPC_603 = 0x3,
27  PPC_604 = 0x4,
28  PPC_603e = 0x6,
29  PPC_603ev = 0x7,
30  PPC_750 = 0x8,
31  PPC_604e = 0x9,
32  PPC_604r = 0xA,
33  PPC_7400 = 0xC,
34  PPC_405  = 0x2001,
35  PPC_7455 = 0x8001, /* Kate Feng */
36  PPC_7457 = 0x8002,
37  PPC_620 = 0x16,
38  PPC_860 = 0x50,
39  PPC_821 = PPC_860,
40  PPC_823 = PPC_860,
41  PPC_8260 = 0x81,
42  PPC_8240 = PPC_8260,
43  PPC_8245 = 0x8081,
44  PPC_8540 = 0x8020,
45  PPC_603le = 0x8082, /* 603le core, in MGT5100 and MPC5200 */
46  PPC_e300c1  = 0x8083, /* e300c1  core, in MPC83xx*/
47  PPC_e300c2  = 0x8084, /* e300c2  core */
48  PPC_e300c3  = 0x8085, /* e300c3  core */
49  PPC_e200z6 = 0x8115,
50  PPC_PSIM = 0xfffe,  /* GDB PowerPC simulator -- fake version */
51  PPC_UNKNOWN = 0xffff
52} ppc_cpu_id_t;
53
54/* Bitfield of for identifying features or groups of cpu flavors.
55 * DO NOT USE DIRECTLY (as implementation may change)
56 * only use the 'ppc_is_xxx() / ppc_has_xxx()' macros/inlines
57 * below.
58 */
59
60typedef struct { 
61        unsigned has_altivec            : 1;
62        unsigned has_fpu                        : 1;
63        unsigned has_hw_ptbl_lkup       : 1;
64#define PPC_BOOKE_405   1       /* almost like booke but with some significant differences */
65#define PPC_BOOKE_STD   2
66#define PPC_BOOKE_E500  3       /* bookE with extensions */
67        unsigned is_bookE                       : 2;
68        unsigned has_16byte_clne        : 1;
69        unsigned is_60x             : 1;
70        unsigned has_8_bats                     : 1;
71        unsigned has_epic           : 1;
72        unsigned has_shadowed_gprs  : 1;
73        unsigned has_ivpr_and_ivor  : 1;
74} ppc_feature_t;
75
76extern ppc_feature_t   current_ppc_features;
77extern ppc_cpu_id_t current_ppc_cpu;
78
79typedef unsigned short ppc_cpu_revision_t;
80
81extern ppc_cpu_id_t get_ppc_cpu_type ();
82extern char *get_ppc_cpu_type_name(ppc_cpu_id_t cpu);
83extern ppc_cpu_revision_t get_ppc_cpu_revision ();
84extern ppc_cpu_revision_t current_ppc_revision;
85
86/* PUBLIC ACCESS ROUTINES */
87#define _PPC_FEAT_DECL(x) \
88static inline unsigned ppc_cpu_##x() { \
89  if ( PPC_UNKNOWN == current_ppc_cpu ) \
90    get_ppc_cpu_type(); \
91  return current_ppc_features.x; \
92}
93
94_PPC_FEAT_DECL(has_altivec)
95/* has_fpu not implemented yet */
96_PPC_FEAT_DECL(has_hw_ptbl_lkup)
97_PPC_FEAT_DECL(is_bookE)
98_PPC_FEAT_DECL(is_60x)
99_PPC_FEAT_DECL(has_8_bats)
100_PPC_FEAT_DECL(has_epic)
101_PPC_FEAT_DECL(has_shadowed_gprs)
102_PPC_FEAT_DECL(has_ivpr_and_ivor)
103
104static inline bool ppc_cpu_is_e300()
105{
106        if (current_ppc_cpu == PPC_UNKNOWN) {
107                get_ppc_cpu_type();
108        }
109        return current_ppc_cpu == PPC_e300c1
110                || current_ppc_cpu == PPC_e300c2
111                || current_ppc_cpu == PPC_e300c3;
112}
113
114#undef _PPC_FEAT_DECL
115#endif /* ASM */
116
117#endif
Note: See TracBrowser for help on using the repository browser.