source: rtems/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.h @ 3c6fe2e

4.104.114.9
Last change on this file since 3c6fe2e was 3c6fe2e, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Jul 14, 2008 at 8:46:06 AM

added haleakala BSP contributed by Michael Hamel

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[f054b51]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
[21e1c44]11 *  http://www.rtems.com/license/LICENSE.
[f054b51]12 *
13 *  $Id$
14 */
15
[a859df85]16#ifndef _LIBCPU_CPUIDENT_H
17#define _LIBCPU_CPUIDENT_H
[f054b51]18
[25a92bc1]19#include <stdbool.h>
20
[f054b51]21#ifndef ASM
22typedef enum
23{
24  PPC_601 = 0x1,
[9c4a30e2]25  PPC_5XX = 0x2,
[f054b51]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,
[d49389a]33  PPC_7400 = 0xC,
[73cdeb6]34  PPC_405  = 0x2001,
[3c6fe2e]35  PPC_405EX = 0x1291,   /* + 405EXr */
36  PPC_405GP = 0x4011,   /* + 405CR */
37  PPC_405GPr = 0x5091,
38  PPC_405EZ = 0x4151,
39  PPC_405EP = 0x5121,
[83d7232]40  PPC_7455 = 0x8001, /* Kate Feng */
[408bb71]41  PPC_7457 = 0x8002,
[f054b51]42  PPC_620 = 0x16,
43  PPC_860 = 0x50,
44  PPC_821 = PPC_860,
[9c4a30e2]45  PPC_823 = PPC_860,
[f054b51]46  PPC_8260 = 0x81,
[a84392d]47  PPC_8240 = PPC_8260,
48  PPC_8245 = 0x8081,
[e955b06]49  PPC_8540 = 0x8020,
[56c4cae]50  PPC_603le = 0x8082, /* 603le core, in MGT5100 and MPC5200 */
[f610e83f]51  PPC_e300c1  = 0x8083, /* e300c1  core, in MPC83xx*/
52  PPC_e300c2  = 0x8084, /* e300c2  core */
53  PPC_e300c3  = 0x8085, /* e300c3  core */
[25a92bc1]54  PPC_e200z6 = 0x8115,
[faed5fa]55  PPC_PSIM = 0xfffe,  /* GDB PowerPC simulator -- fake version */
[a84392d]56  PPC_UNKNOWN = 0xffff
[f054b51]57} ppc_cpu_id_t;
58
[e955b06]59/* Bitfield of for identifying features or groups of cpu flavors.
60 * DO NOT USE DIRECTLY (as implementation may change)
61 * only use the 'ppc_is_xxx() / ppc_has_xxx()' macros/inlines
62 * below.
63 */
64
65typedef struct { 
66        unsigned has_altivec            : 1;
67        unsigned has_fpu                        : 1;
68        unsigned has_hw_ptbl_lkup       : 1;
[4be2812f]69#define PPC_BOOKE_405   1       /* almost like booke but with some significant differences */
70#define PPC_BOOKE_STD   2
71#define PPC_BOOKE_E500  3       /* bookE with extensions */
72        unsigned is_bookE                       : 2;
[e955b06]73        unsigned has_16byte_clne        : 1;
74        unsigned is_60x             : 1;
75        unsigned has_8_bats                     : 1;
76        unsigned has_epic           : 1;
[76a5a3cc]77        unsigned has_shadowed_gprs  : 1;
[25a92bc1]78        unsigned has_ivpr_and_ivor  : 1;
[e955b06]79} ppc_feature_t;
80
81extern ppc_feature_t   current_ppc_features;
[bfc9b023]82extern ppc_cpu_id_t current_ppc_cpu;
83
84typedef unsigned short ppc_cpu_revision_t;
85
86extern ppc_cpu_id_t get_ppc_cpu_type ();
87extern char *get_ppc_cpu_type_name(ppc_cpu_id_t cpu);
88extern ppc_cpu_revision_t get_ppc_cpu_revision ();
89extern ppc_cpu_revision_t current_ppc_revision;
[e955b06]90
91/* PUBLIC ACCESS ROUTINES */
92#define _PPC_FEAT_DECL(x) \
[25a92bc1]93static inline unsigned ppc_cpu_##x() { \
[bfc9b023]94  if ( PPC_UNKNOWN == current_ppc_cpu ) \
95    get_ppc_cpu_type(); \
96  return current_ppc_features.x; \
97}
[e955b06]98
99_PPC_FEAT_DECL(has_altivec)
100/* has_fpu not implemented yet */
101_PPC_FEAT_DECL(has_hw_ptbl_lkup)
102_PPC_FEAT_DECL(is_bookE)
103_PPC_FEAT_DECL(is_60x)
104_PPC_FEAT_DECL(has_8_bats)
105_PPC_FEAT_DECL(has_epic)
[76a5a3cc]106_PPC_FEAT_DECL(has_shadowed_gprs)
[25a92bc1]107_PPC_FEAT_DECL(has_ivpr_and_ivor)
108
109static inline bool ppc_cpu_is_e300()
110{
111        if (current_ppc_cpu == PPC_UNKNOWN) {
112                get_ppc_cpu_type();
113        }
114        return current_ppc_cpu == PPC_e300c1
115                || current_ppc_cpu == PPC_e300c2
116                || current_ppc_cpu == PPC_e300c3;
117}
[e955b06]118
119#undef _PPC_FEAT_DECL
[f054b51]120#endif /* ASM */
121
122#endif
Note: See TracBrowser for help on using the repository browser.