source: rtems/c/src/lib/libbsp/powerpc/shared/motorola/motorola.c @ e7f95e8

4.115
Last change on this file since e7f95e8 was e7f95e8, checked in by Joel Sherrill <joel.sherrill@…>, on 07/20/11 at 16:39:31

2011-07-20 Till Straumann <strauman@…>

PR 1837/bsps

  • shared/motorola/motorola.c, shared/motorola/motorola.h: Add MVME2400 board with 750 CPU to list of supported Motorola boards.
  • Property mode set to 100644
File size: 14.2 KB
Line 
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 the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#include <bsp.h>
16#include <bsp/motorola.h>
17#include <rtems/bspIo.h>
18#include <libcpu/io.h>
19#include <string.h>
20#include <libcpu/cpuIdent.h>
21
22/*
23** Board-specific table that maps interrupt names to onboard PCI
24** peripherals as well as local PCI busses.  This table is used at
25** bspstart() to configure the interrupt name & pin for all devices that
26** do not have it already specified.  If the device is already
27** configured, we leave it alone but sanity check & print a warning if
28** we don't know about the pin/line the card gives us.
29**
30** bus = the bus number of the slot/device in question
31**
32** slot :
33**
34**   If slot != -1, it indicates a device on the given bus in that slot
35**   is to use one of the listed interrupt names given an interrupt pin.
36**
37**   If slot == -1, it means devices on this bus can occupy any slot-
38**   and for pci, this means the particular interrupt pin that the
39**   device signals is therefore dependent on the particular slot.  To
40**   work from the slot to the interrupt pin, the swizzle table is used.
41**   Once the bus and interrupt pin is known, the correct interrupt name
42**   can be pulled from the table.  The swizzle table relates the
43**   interrupt pin from the device to the particular interrupt
44**   controller interrupt pin- so it is quite reasonable for a device on
45**   bus 1 signalling interrupt pin 1 to show up at the interrupt
46**   controller as pin 4- this is why the int pin field varies for
47**   bridged pci busses.
48**
49**
50** opts = bitmap of options that control the configuration of this
51** slot/bus.
52**
53** pin_routes[] = array of pin & vectors that may serve this slot;
54**
55**      pin = the pin # which delivers an interrupt on this route, A=1,
56**      B=2, C=3, D=4
57**
58**      int_name[4] = an array of up to 4 bsp-specific interrupt name
59**      that can be used by this route.  Unused entries should be -1.
60**      The array is of primary use for slots that can be vectored thru
61**      multiple interrupt lines over the interrupt pin supplied by the
62**      record.  If more than one entry is present, the most preferable
63**      should supplied first.
64**
65*/
66
67#define NULL_PINMAP     {-1,{-1,-1,-1,-1}}
68#define NULL_INTMAP     {-1,-1,-1,{}}
69
70#ifdef qemu
71static struct _int_map qemu_prep_intmap[] = {
72    { 0, -1, PCI_FIXUP_OPT_OVERRIDE_NAME,
73                    { { 1, { 9, -1, -1, -1}},
74                  { 2, {11, -1  -1, -1}},
75                  NULL_PINMAP }},
76        NULL_INTMAP
77};
78#endif
79
80static struct _int_map mcp750_intmap[] = {
81
82   { 0, 16, 0, {{1,  {5, 19,-1,-1}}, /* pmc slot */
83                NULL_PINMAP}},
84
85   { 0, 14, 0, {{1,  {10,18,-1,-1}}, /* onboard ethernet */
86                NULL_PINMAP}},
87
88   { 1, -1, 0, {{1,  {24,-1,-1,-1}},
89                {2,  {25,-1,-1,-1}},
90                {3,  {26,-1,-1,-1}},
91                {4,  {27,-1,-1,-1}},
92                NULL_PINMAP}},
93
94   NULL_INTMAP };
95
96static struct _int_map mtx603_intmap[] = {
97
98   {0, 14, 0, {{1, {10,16,-1,-1}},  /* onboard ethernet */
99               NULL_PINMAP}},
100
101   {0, 12, 0, {{1, {14,18,-1,-1}},  /* onboard scsi */
102               NULL_PINMAP}},
103
104   {0, 16, 0, {{1, {25,-1,-1,-1}},  /* pci/pmc slot 1 */
105               {2, {26,-1,-1,-1}},
106               {3, {27,-1,-1,-1}},
107               {4, {28,-1,-1,-1}},
108               NULL_PINMAP}},
109
110   {0, 17, 0, {{1, {26,-1,-1,-1}},  /* pci/pmc slot 2 */
111               {2, {27,-1,-1,-1}},
112               {3, {28,-1,-1,-1}},
113               {4, {25,-1,-1,-1}},
114               NULL_PINMAP}},
115
116   {0, 18, 0, {{1, {27,-1,-1,-1}},  /* pci slot 3 */
117               {2, {28,-1,-1,-1}},
118               {3, {25,-1,-1,-1}},
119               {4, {26,-1,-1,-1}},
120               NULL_PINMAP}},
121
122   NULL_INTMAP };
123
124static struct _int_map mvme23xx_intmap[] = {
125/* Raven Hostbridge; has int_pin == 0
126   {0,  0, 0, {{0, {-1,-1,-1,-1}},
127               NULL_PINMAP}},
128*/
129
130/* Winbond PCI/ISA 83c553; has int_pin == 0
131   {0, 11, 0, {{0, {-1,-1,-1,-1}},
132               NULL_PINMAP}},
133*/
134
135#if 0 /* Leave as ISA interrupts for now */
136   {0, 13, PCI_FIXUP_OPT_OVERRIDE_NAME,
137                        {{1, {11,21,-1,-1,-1}},  /* Universe  ISA/PCI */
138                        /* strictly speaking, a non-multi function device
139                         * must only use pin A
140                         */
141                         {2, {22,-1,-1,-1,-1}},  /* Universe          */
142                         {3, {23,-1,-1,-1,-1}},  /* Universe          */
143                         {4, {24,-1,-1,-1,-1}},  /* Universe          */
144             NULL_PINMAP}},
145
146   {0, 14, PCI_FIXUP_OPT_OVERRIDE_NAME,
147                        {{1, {10,18,-1,-1}},  /* DEC Tulip enet (ISA/PCI)  */
148             NULL_PINMAP}},
149#endif
150
151   {0, 16, PCI_FIXUP_OPT_OVERRIDE_NAME,
152                        {{1, {25,-1,-1,-1}},  /* pci/pmc slot 1   */
153             {2, {26,-1,-1,-1}},
154             {3, {27,-1,-1,-1}},
155             {4, {28,-1,-1,-1}},
156             NULL_PINMAP}},
157
158   {0, 17, PCI_FIXUP_OPT_OVERRIDE_NAME,
159                        {{1, {28,-1,-1,-1}},  /* pci/pmc slot 2   */ /* orig: 0xf */
160             {2, {25,-1,-1,-1}},
161             {3, {26,-1,-1,-1}},
162             {4, {27,-1,-1,-1}},
163             NULL_PINMAP}},
164
165   NULL_INTMAP };
166
167static struct _int_map mvme24xx_intmap[] = {
168/* Raven Hostbridge; has int_pin == 0
169   {0,  0, 0, {{0, {-1,-1,-1,-1}},
170               NULL_PINMAP}},
171*/
172
173/* Winbond PCI/ISA 83c553; has int_pin == 0
174   {0, 11, 0, {{0, {-1,-1,-1,-1}},
175               NULL_PINMAP}},
176*/
177
178   {0, 13, PCI_FIXUP_OPT_OVERRIDE_NAME,
179                        {{1, {11,21,-1,-1}},  /* Universe  ISA/PCI */
180                        /* strictly speaking, a non-multi function device
181                         * must only use pin A
182                         */
183                         {2, {22,-1,-1,-1}},  /* Universe          */
184                         {3, {23,-1,-1,-1}},  /* Universe          */
185                         {4, {24,-1,-1,-1}},  /* Universe          */
186             NULL_PINMAP}},
187
188   {0, 14, PCI_FIXUP_OPT_OVERRIDE_NAME,
189                        {{1, {10,18,-1,-1}},  /* DEC Tulip enet (ISA/PCI)  */
190             NULL_PINMAP}},
191   {0, 16, PCI_FIXUP_OPT_OVERRIDE_NAME,
192            {{1, {25,-1,-1,-1}},  /* pci/pmc slot 1   */
193             {2, {26,-1,-1,-1}},
194             {3, {27,-1,-1,-1}},
195             {4, {28,-1,-1,-1}},
196             NULL_PINMAP}},
197
198   {0, 17, PCI_FIXUP_OPT_OVERRIDE_NAME,
199            {{1, {28,-1,-1,-1}},  /* pci/pmc slot 2   */ /* orig: 0xf */
200             {2, {25,-1,-1,-1}},
201             {3, {26,-1,-1,-1}},
202             {4, {27,-1,-1,-1}},
203             NULL_PINMAP}},
204   NULL_INTMAP };
205
206static struct _int_map mvme27xx_intmap[] = {
207/* Raven Hostbridge; has int_pin == 0 */
208   {0,  0, 0, {{0, {-1,-1,-1,-1}},
209               NULL_PINMAP}},
210
211
212/* Winbond PCI/ISA 83c553; has int_pin == 0 */
213   {0, 11, 0, {{0, {-1,-1,-1,-1}},
214               NULL_PINMAP}},
215
216   {0, 13, PCI_FIXUP_OPT_OVERRIDE_NAME,
217                        {{1, {11,21,-1,-1}},  /* Universe  ISA/PCI */
218                        /* strictly speaking, a non-multi function device
219                         * must only use pin A
220                         */
221                         {2, {22,-1,-1,-1}},  /* Universe          */
222                         {3, {23,-1,-1,-1}},  /* Universe          */
223                         {4, {24,-1,-1,-1}},  /* Universe          */
224             NULL_PINMAP}},
225
226   {0, 14, PCI_FIXUP_OPT_OVERRIDE_NAME,
227                        {{1, {10,18,-1,-1}},  /* DEC Tulip enet (ISA/PCI)  */
228             NULL_PINMAP}},
229   {0, 16, PCI_FIXUP_OPT_OVERRIDE_NAME,
230            {{1, {25,-1,-1,-1}},  /* pci/pmc slot 1   */
231             {2, {26,-1,-1,-1}},
232             {3, {27,-1,-1,-1}},
233             {4, {28,-1,-1,-1}},
234             NULL_PINMAP}},
235
236   {0, 17, PCI_FIXUP_OPT_OVERRIDE_NAME,
237            {{1, {28,-1,-1,-1}},  /* pci/pmc slot 2   */ /* orig: 0xf */
238             {2, {25,-1,-1,-1}},
239             {3, {26,-1,-1,-1}},
240             {4, {27,-1,-1,-1}},
241             NULL_PINMAP}},
242   NULL_INTMAP };
243
244static struct _int_map mvme2100_intmap[] = {
245   {0, 0, 0, {{1, {16,-1,-1,-1}}, /* something shows up in slot 0 and OpenPIC  */
246                                  /* 0 is unused.  This hushes the init code.  */
247               NULL_PINMAP}},
248
249   {0, 13, 0, {{1, {23,-1,-1,-1}},  /* Universe Lint[0-3]; not quite legal     */
250               {2, {24,-1,-1,-1}},  /* since the universe is a single-function */
251               {3, {25,-1,-1,-1}},  /* device. We leave it for info purposes   */
252               {4, {26,-1,-1,-1}},
253               NULL_PINMAP}},
254
255   {0, 14, 0, {{1, {17,-1,-1,-1}},  /* onboard ethernet */
256               NULL_PINMAP}},
257
258   {0, 16, PCI_FIXUP_OPT_OVERRIDE_NAME,
259              {{1, {18,-1,-1,-1}},  /* PMC slot; all pins are routed to 18     */
260               {2, {18,-1,-1,-1}},  /* I give the OVERRIDE option since I had  */
261               {3, {18,-1,-1,-1}},  /* problems with devices behind a bridge   */
262               {4, {18,-1,-1,-1}},  /* on a PMC card reading irq line 0...     */
263               NULL_PINMAP}},
264
265   /* FIXME: I don't know how MIP works or what it is; these probably won't work */
266
267   {0, -1, PCI_FIXUP_OPT_OVERRIDE_NAME,
268              {{1, {23,-1,-1,-1}},  /* PCI INT[A-D] expansion */
269               {2, {24,-1,-1,-1}},
270               {3, {25,-1,-1,-1}},
271               {4, {26,-1,-1,-1}},
272               NULL_PINMAP}},
273
274   NULL_INTMAP };
275
276/*
277 * This table represents the standard PCI swizzle defined in the
278 * PCI bus specification.  Table taken from Linux 2.4.18, prep_pci.c,
279 * the values in this table are interrupt_pin values (1 based).
280 */
281static unsigned char prep_pci_intpins[4][4] =
282{
283        { 1, 2, 3, 4 },  /* Buses 0, 4, 8, ... */
284        { 2, 3, 4, 1 },  /* Buses 1, 5, 9, ... */
285        { 3, 4, 1, 2 },  /* Buses 2, 6, 10 ... */
286        { 4, 1, 2, 3 },  /* Buses 3, 7, 11 ... */
287};
288
289static int prep_pci_swizzle(int slot, int pin)
290{
291   return prep_pci_intpins[ slot % 4 ][ pin-1 ];
292}
293
294typedef struct {
295  /*
296   * 0x100 mask assumes for Raven and Hawk boards
297   * that the level/edge are set.
298   * 0x200 if this board has a Hawk chip.
299   */
300      int               cpu_type;
301      int               base_type;
302      ppc_cpu_id_t      proc_type;
303      const char        *name;
304
305      struct _int_map   *intmap;
306      int               (*swizzler)(int, int);
307} mot_info_t;
308
309/* NOTE: When adding boards here the 'motorolaBoard' enums MUST be
310 *       updated accordingly!
311 */
312static const mot_info_t mot_boards[] = {
313  {0x0E0, 0xF9, PPC_604,     "MVME 2400", mvme24xx_intmap,prep_pci_swizzle},
314  {0x3E0, 0x00, PPC_750,     "MVME 2400 (PPC 750)", mvme24xx_intmap,prep_pci_swizzle},
315  {0x010, 0x00, PPC_UNKNOWN, "Genesis", NULL, NULL},
316  {0x020, 0x00, PPC_UNKNOWN, "Powerstack (Series E)", NULL, NULL},
317  {0x040, 0x00, PPC_UNKNOWN, "Blackhawk (Powerstack)", NULL, NULL},
318  {0x050, 0x00, PPC_UNKNOWN, "Omaha (PowerStack II Pro3000)", NULL, NULL},
319  {0x060, 0x00, PPC_UNKNOWN, "Utah (Powerstack II Pro4000)", NULL, NULL},
320  {0x0A0, 0x00, PPC_UNKNOWN, "Powerstack (Series EX)", NULL, NULL},
321#ifdef qemu
322  {0x1E0, 0xE0, PPC_UNKNOWN, "QEMU", qemu_prep_intmap, prep_pci_swizzle},
323#else
324  {0x1E0, 0xE0, PPC_UNKNOWN, "Mesquite cPCI (MCP750)", mcp750_intmap, prep_pci_swizzle},
325#endif
326  {0x1E0, 0xE1, PPC_UNKNOWN, "Sitka cPCI (MCPN750)", mcp750_intmap, prep_pci_swizzle},
327  {0x1E0, 0xE2, PPC_UNKNOWN, "Mesquite cPCI (MCP750) w/ HAC", mcp750_intmap, prep_pci_swizzle},
328  {0x1E0, 0xF6, PPC_UNKNOWN, "MTX Plus", NULL, NULL},
329  {0x1E0, 0xF7, PPC_UNKNOWN, "MTX w/o Parallel Port", mtx603_intmap, prep_pci_swizzle},
330  {0x1E0, 0xF8, PPC_UNKNOWN, "MTX w/ Parallel Port", mtx603_intmap, prep_pci_swizzle},
331  {0x1E0, 0xF9, PPC_604,     "MVME 2300", mvme23xx_intmap, prep_pci_swizzle},
332  {0x1E0, 0xFA, PPC_UNKNOWN, "MVME 2300SC/2600", mvme23xx_intmap, prep_pci_swizzle},
333  {0x1E0, 0xFB, PPC_UNKNOWN, "MVME 2600 with MVME712M", NULL, NULL},
334  {0x1E0, 0xFC, PPC_750,     "MVME 2600/2700 with MVME761", mvme27xx_intmap, prep_pci_swizzle},
335  {0x1E0, 0xFD, PPC_UNKNOWN, "MVME 3600 with MVME712M", NULL, NULL},
336  {0x1E0, 0xFE, PPC_UNKNOWN, "MVME 3600 with MVME761", NULL, NULL},
337  {0x1E0, 0xFF, PPC_UNKNOWN, "MVME 1600-001 or 1600-011", NULL, NULL},
338  {0x000, 0x00, PPC_UNKNOWN, ""},   /* end of probeable values for automatic scan */
339  {0x000, 0x00, PPC_UNKNOWN, "MVME 2100", mvme2100_intmap, prep_pci_swizzle},
340};
341
342prep_t currentPrepType;
343motorolaBoard currentBoard;
344
345prep_t checkPrepBoardType(RESIDUAL *res)
346{
347  prep_t PREP_type;
348  /* figure out what kind of prep workstation we are */
349  if ( res->ResidualLength != 0 ) {
350    if ( !strncmp((char*)res->VitalProductData.PrintableModel,"IBM",3) )
351      PREP_type = PREP_IBM;
352    else if (!strncmp((char*)res->VitalProductData.PrintableModel,
353                      "Radstone",8)){
354      PREP_type = PREP_Radstone;
355    }
356    else
357      PREP_type = PREP_Motorola;
358  }
359  else /* assume motorola if no residual (netboot?) */ {
360    PREP_type = PREP_Motorola;
361  }
362  currentPrepType = PREP_type;
363  return PREP_type;
364}
365
366motorolaBoard getMotorolaBoard(void)
367{
368/*
369 *  At least the MVME2100 does not have the CPU Type and Base Type Registers,
370 *  so it cannot be probed.
371 *
372 *  NOTE: Every path must set currentBoard.
373 */
374#if defined(mvme2100)
375  currentBoard = (motorolaBoard) MVME_2100;
376#else
377  unsigned char  cpu_type;
378  unsigned char  base_mod;
379  ppc_cpu_id_t   proc_type;
380  int            entry;
381  int            mot_entry = -1;
382
383  cpu_type  = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
384  base_mod  = inb(MOTOROLA_BASETYPE_REG);
385  proc_type = get_ppc_cpu_type ();
386
387  for (entry = 0; mot_boards[entry].cpu_type != 0; entry++) {
388    if ((mot_boards[entry].cpu_type & 0xff) != cpu_type)
389      continue;
390
391    if ((mot_boards[entry].proc_type != PPC_UNKNOWN) &&
392        (mot_boards[entry].proc_type != proc_type))
393      /*
394       * IMD: processor type does not match
395       * (here we distinguish a MVME2300 and a MVME2400)
396       */
397      continue;
398
399    if (mot_boards[entry].base_type != base_mod)
400      continue;
401    else {
402      mot_entry = entry;
403      break;
404    }
405  }
406  if (mot_entry == -1) {
407    printk("Unknown motorola board Please update libbsp/powerpc/shared/motorola/motorola.c\n");
408    printk("cpu_type = %x\n", (unsigned) cpu_type);
409    printk("base_mod = %x\n", (unsigned) base_mod);
410    currentBoard = MOTOROLA_UNKNOWN;
411    return currentBoard;
412  }
413  currentBoard = (motorolaBoard) mot_entry;
414#endif
415  return currentBoard;
416}
417
418const char* motorolaBoardToString(motorolaBoard board)
419{
420  if (board == MOTOROLA_UNKNOWN) return "Unknown motorola board";
421  return (mot_boards[board].name);
422}
423
424const struct _int_map *motorolaIntMap(motorolaBoard board)
425{
426  if (board == MOTOROLA_UNKNOWN) return NULL;
427  /* printk( "IntMap board %d 0x%08x\n", board, mot_boards[board].intmap ); */
428  return mot_boards[board].intmap;
429}
430
431const void *motorolaIntSwizzle(motorolaBoard board)
432{
433  if (board == MOTOROLA_UNKNOWN) return NULL;
434  return (void *)mot_boards[board].swizzler;
435}
Note: See TracBrowser for help on using the repository browser.