1 | /* motorola.h |
---|
2 | * |
---|
3 | * This include file describe the data structure and the functions implemented |
---|
4 | * by rtems to identify motorola boards. |
---|
5 | * |
---|
6 | * CopyRight (C) 1999 valette@crf.canon.fr |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in found in the file LICENSE in this distribution or at |
---|
10 | * http://www.OARcorp.com/rtems/license.html. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | |
---|
16 | #include <bsp/motorola.h> |
---|
17 | #include <libcpu/io.h> |
---|
18 | |
---|
19 | typedef struct { |
---|
20 | /* |
---|
21 | * 0x100 mask assumes for Raven and Hawk boards |
---|
22 | * that the level/edge are set. |
---|
23 | * 0x200 if this board has a Hawk chip. |
---|
24 | */ |
---|
25 | int cpu_type; |
---|
26 | int base_type; |
---|
27 | const char *name; |
---|
28 | } mot_info_t; |
---|
29 | |
---|
30 | |
---|
31 | static const mot_info_t mot_boards[] = { |
---|
32 | {0x300, 0x00, "MVME 2400"}, |
---|
33 | {0x010, 0x00, "Genesis"}, |
---|
34 | {0x020, 0x00, "Powerstack (Series E)"}, |
---|
35 | {0x040, 0x00, "Blackhawk (Powerstack)"}, |
---|
36 | {0x050, 0x00, "Omaha (PowerStack II Pro3000)"}, |
---|
37 | {0x060, 0x00, "Utah (Powerstack II Pro4000)"}, |
---|
38 | {0x0A0, 0x00, "Powerstack (Series EX)"}, |
---|
39 | {0x1E0, 0xE0, "Mesquite cPCI (MCP750)"}, |
---|
40 | {0x1E0, 0xE1, "Sitka cPCI (MCPN750)"}, |
---|
41 | {0x1E0, 0xE2, "Mesquite cPCI (MCP750) w/ HAC"}, |
---|
42 | {0x1E0, 0xF6, "MTX Plus"}, |
---|
43 | {0x1E0, 0xF7, "MTX wo/ Parallel Port"}, |
---|
44 | {0x1E0, 0xF8, "MTX w/ Parallel Port"}, |
---|
45 | {0x1E0, 0xF9, "MVME 2300"}, |
---|
46 | {0x1E0, 0xFA, "MVME 2300SC/2600"}, |
---|
47 | {0x1E0, 0xFB, "MVME 2600 with MVME712M"}, |
---|
48 | {0x1E0, 0xFC, "MVME 2600/2700 with MVME761"}, |
---|
49 | {0x1E0, 0xFD, "MVME 3600 with MVME712M"}, |
---|
50 | {0x1E0, 0xFE, "MVME 3600 with MVME761"}, |
---|
51 | {0x1E0, 0xFF, "MVME 1600-001 or 1600-011"}, |
---|
52 | {0x000, 0x00, ""} |
---|
53 | }; |
---|
54 | |
---|
55 | prep_t currentPrepType; |
---|
56 | motorolaBoard currentBoard; |
---|
57 | prep_t checkPrepBoardType(RESIDUAL *res) |
---|
58 | { |
---|
59 | prep_t PREP_type; |
---|
60 | /* figure out what kind of prep workstation we are */ |
---|
61 | if ( res->ResidualLength != 0 ) { |
---|
62 | if ( !strncmp(res->VitalProductData.PrintableModel,"IBM",3) ) |
---|
63 | PREP_type = PREP_IBM; |
---|
64 | else if (!strncmp(res->VitalProductData.PrintableModel, |
---|
65 | "Radstone",8)){ |
---|
66 | PREP_type = PREP_Radstone; |
---|
67 | } |
---|
68 | else |
---|
69 | PREP_type = PREP_Motorola; |
---|
70 | } |
---|
71 | else /* assume motorola if no residual (netboot?) */ { |
---|
72 | PREP_type = PREP_Motorola; |
---|
73 | } |
---|
74 | currentPrepType = PREP_type; |
---|
75 | return PREP_type; |
---|
76 | } |
---|
77 | |
---|
78 | motorolaBoard getMotorolaBoard() |
---|
79 | { |
---|
80 | unsigned char cpu_type; |
---|
81 | unsigned char base_mod; |
---|
82 | int entry; |
---|
83 | int mot_entry = -1; |
---|
84 | |
---|
85 | cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0; |
---|
86 | base_mod = inb(MOTOROLA_BASETYPE_REG); |
---|
87 | |
---|
88 | for (entry = 0; mot_boards[entry].cpu_type != 0; entry++) { |
---|
89 | if ((mot_boards[entry].cpu_type & 0xff) != cpu_type) |
---|
90 | continue; |
---|
91 | |
---|
92 | if (mot_boards[entry].base_type == 0) { |
---|
93 | mot_entry = entry; |
---|
94 | break; |
---|
95 | } |
---|
96 | |
---|
97 | if (mot_boards[entry].base_type != base_mod) |
---|
98 | continue; |
---|
99 | else{ |
---|
100 | mot_entry = entry; |
---|
101 | break; |
---|
102 | } |
---|
103 | } |
---|
104 | if (mot_entry == -1) { |
---|
105 | printk("Unkwon motorola board Please update libbsp/powerpc/shared/motorola/motorola.c\n"); |
---|
106 | printk("cpu_type = %x\n", (unsigned) cpu_type); |
---|
107 | printk("base_mod = %x\n", (unsigned) base_mod); |
---|
108 | currentBoard = MOTOROLA_UNKNOWN; |
---|
109 | return currentBoard; |
---|
110 | } |
---|
111 | currentBoard = (motorolaBoard) mot_entry; |
---|
112 | return currentBoard; |
---|
113 | } |
---|
114 | |
---|
115 | const char* motorolaBoardToString(motorolaBoard board) |
---|
116 | { |
---|
117 | if (board == MOTOROLA_UNKNOWN) return "Unknown motorola board"; |
---|
118 | return (mot_boards[board].name); |
---|
119 | } |
---|
120 | |
---|