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

4.104.114.84.95
Last change on this file since f05b2ac was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 7.7 KB
RevLine 
[acc25ee]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
[e831de8]10 *  http://www.rtems.com/license/LICENSE.
[acc25ee]11 *
12 *  $Id$
13 */
14
[7657233d]15#include <bsp/motorola.h>
16#include <rtems/bspIo.h>
17#include <libcpu/io.h>
18#include <string.h>
[acc25ee]19
[3a3e0b0e]20/*
21** Board-specific table that maps interrupt names to onboard pci
22** peripherals as well as local pci busses.  This table is used at
23** bspstart() to configure the interrupt name & pin for all devices that
24** do not have it already specified.  If the device is already
25** configured, we leave it alone but sanity check & print a warning if
26** we don't know about the pin/line the card gives us.
27**
28** bus = the bus number of the slot/device in question
29**
30** slot :
31**
32**   If slot != -1, it indicates a device on the given bus in that slot
33**   is to use one of the listed interrupt names given an interrupt pin.
34**
35**   If slot == -1, it means devices on this bus can occupy any slot-
36**   and for pci, this means the particular interrupt pin that the
37**   device signals is therefore dependent on the particular slot.  To
38**   work from the slot to the interrupt pin, the swizzle table is used.
39**   Once the bus and interrupt pin is known, the correct interrupt name
40**   can be pulled from the table.  The swizzle table relates the
41**   interrupt pin from the device to the particular interrupt
42**   controller interrupt pin- so it is quite reasonable for a device on
43**   bus 1 signalling interrupt pin 1 to show up at the interrupt
44**   controller as pin 4- this is why the int pin field varies for
45**   bridged pci busses.
46**
47**
48** opts = bitmap of options that control the configuration of this
49** slot/bus.
50**
51** pin_routes[] = array of pin & vectors that may serve this slot;
52**
53**      pin = the pin # which delivers an interrupt on this route, A=1,
54**      B=2, C=3, D=4
55**
56**      int_name[4] = an array of up to 4 bsp-specific interrupt name
57**      that can be used by this route.  Unused entries should be -1.
58**      The array is of primary use for slots that can be vectored thru
59**      multiple interrupt lines over the interrupt pin supplied by the
60**      record.  If more than one entry is present, the most preferable
61**      should supplied first.
[6128a4a]62**
[3a3e0b0e]63*/
64
65#define NULL_PINMAP     {-1,{-1,-1,-1,-1}}
66#define NULL_INTMAP     {-1,-1,-1,{}}
67
[6128a4a]68static struct _int_map mcp750_intmap[] = {
[3a3e0b0e]69
70   { 0, 16, 0, {{1,  {5, 19,-1,-1}}, /* pmc slot */
71                NULL_PINMAP}},
72
73   { 0, 14, 0, {{1,  {10,18,-1,-1}}, /* onboard ethernet */
74                NULL_PINMAP}},
75
76   { 1, -1, 0, {{1,  {24,-1,-1,-1}},
77                {2,  {25,-1,-1,-1}},
78                {3,  {26,-1,-1,-1}},
79                {4,  {27,-1,-1,-1}},
80                NULL_PINMAP}},
81
82   NULL_INTMAP };
83
84static struct _int_map mtx603_intmap[] = {
85
86   {0, 14, 0, {{1, {10,16,-1,-1}},  /* onboard ethernet */
87               NULL_PINMAP}},
88
89   {0, 12, 0, {{1, {14,18,-1,-1}},  /* onboard scsi */
90               NULL_PINMAP}},
91
92   {0, 16, 0, {{1, {25,-1,-1,-1}},  /* pci/pmc slot 1 */
93               {2, {26,-1,-1,-1}},
94               {3, {27,-1,-1,-1}},
95               {4, {28,-1,-1,-1}},
96               NULL_PINMAP}},
97
98   {0, 17, 0, {{1, {26,-1,-1,-1}},  /* pci/pmc slot 2 */
99               {2, {27,-1,-1,-1}},
100               {3, {28,-1,-1,-1}},
101               {4, {25,-1,-1,-1}},
102               NULL_PINMAP}},
103
104   {0, 18, 0, {{1, {27,-1,-1,-1}},  /* pci slot 3 */
105               {2, {28,-1,-1,-1}},
106               {3, {25,-1,-1,-1}},
107               {4, {26,-1,-1,-1}},
108               NULL_PINMAP}},
109
110   NULL_INTMAP };
111
112/*
113 * This table represents the standard PCI swizzle defined in the
114 * PCI bus specification.  Table taken from Linux 2.4.18, prep_pci.c,
115 * the values in this table are interrupt_pin values (1 based).
116 */
117static unsigned char prep_pci_intpins[4][4] =
118{
119        { 1, 2, 3, 4 },  /* Buses 0, 4, 8, ... */
120        { 2, 3, 4, 1 },  /* Buses 1, 5, 9, ... */
121        { 3, 4, 1, 2 },  /* Buses 2, 6, 10 ... */
122        { 4, 1, 2, 3 },  /* Buses 3, 7, 11 ... */
123};
124
125static int prep_pci_swizzle(int slot, int pin)
126{
127   return prep_pci_intpins[ slot % 4 ][ pin-1 ];
128}
129
[acc25ee]130typedef struct {
131  /*
132   * 0x100 mask assumes for Raven and Hawk boards
133   * that the level/edge are set.
134   * 0x200 if this board has a Hawk chip.
135   */
[3a3e0b0e]136      int               cpu_type;
137      int               base_type;
138      const char        *name;
139
140      struct _int_map   *intmap;
141      int               (*swizzler)(int, int);
[acc25ee]142} mot_info_t;
143
144static const mot_info_t mot_boards[] = {
[3a3e0b0e]145  {0x300, 0x00, "MVME 2400", NULL, NULL},
146  {0x010, 0x00, "Genesis", NULL, NULL},
147  {0x020, 0x00, "Powerstack (Series E)", NULL, NULL},
148  {0x040, 0x00, "Blackhawk (Powerstack)", NULL, NULL},
149  {0x050, 0x00, "Omaha (PowerStack II Pro3000)", NULL, NULL},
150  {0x060, 0x00, "Utah (Powerstack II Pro4000)", NULL, NULL},
151  {0x0A0, 0x00, "Powerstack (Series EX)", NULL, NULL},
152  {0x1E0, 0xE0, "Mesquite cPCI (MCP750)", mcp750_intmap, prep_pci_swizzle},
153  {0x1E0, 0xE1, "Sitka cPCI (MCPN750)", mcp750_intmap, prep_pci_swizzle},
154  {0x1E0, 0xE2, "Mesquite cPCI (MCP750) w/ HAC", mcp750_intmap, prep_pci_swizzle},
155  {0x1E0, 0xF6, "MTX Plus", NULL, NULL},
156  {0x1E0, 0xF7, "MTX w/o Parallel Port", mtx603_intmap, prep_pci_swizzle},
157  {0x1E0, 0xF8, "MTX w/ Parallel Port", mtx603_intmap, prep_pci_swizzle},
158  {0x1E0, 0xF9, "MVME 2300", NULL, NULL},
159  {0x1E0, 0xFA, "MVME 2300SC/2600", NULL, NULL},
160  {0x1E0, 0xFB, "MVME 2600 with MVME712M", NULL, NULL},
161  {0x1E0, 0xFC, "MVME 2600/2700 with MVME761", NULL, NULL},
162  {0x1E0, 0xFD, "MVME 3600 with MVME712M", NULL, NULL},
163  {0x1E0, 0xFE, "MVME 3600 with MVME761", NULL, NULL},
164  {0x1E0, 0xFF, "MVME 1600-001 or 1600-011", NULL, NULL},
[acc25ee]165  {0x000, 0x00, ""}
166};
167
168prep_t currentPrepType;
169motorolaBoard           currentBoard;
170prep_t checkPrepBoardType(RESIDUAL *res)
171{
172  prep_t PREP_type;
173  /* figure out what kind of prep workstation we are */
174  if ( res->ResidualLength != 0 ) {
175    if ( !strncmp(res->VitalProductData.PrintableModel,"IBM",3) )
176      PREP_type = PREP_IBM;
177    else if (!strncmp(res->VitalProductData.PrintableModel,
178                      "Radstone",8)){
179      PREP_type = PREP_Radstone;
180    }
181    else
182      PREP_type = PREP_Motorola;
183  }
184  else /* assume motorola if no residual (netboot?) */ {
185    PREP_type = PREP_Motorola;
186  }
187  currentPrepType = PREP_type;
188  return PREP_type;
189}
190
191motorolaBoard   getMotorolaBoard()
192{
193  unsigned char  cpu_type;
194  unsigned char  base_mod;
195  int            entry;
196  int            mot_entry = -1;
197
198  cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
199  base_mod = inb(MOTOROLA_BASETYPE_REG);
200
201  for (entry = 0; mot_boards[entry].cpu_type != 0; entry++) {
202    if ((mot_boards[entry].cpu_type & 0xff) != cpu_type)
203      continue;
[6128a4a]204
[acc25ee]205    if (mot_boards[entry].base_type == 0) {
206      mot_entry = entry;
207      break;
208    }
[6128a4a]209
[acc25ee]210    if (mot_boards[entry].base_type != base_mod)
211      continue;
212    else{
213      mot_entry = entry;
214      break;
215    }
216  }
217  if (mot_entry == -1) {
[30a1617]218    printk("Unknown motorola board Please update libbsp/powerpc/shared/motorola/motorola.c\n");
[acc25ee]219    printk("cpu_type = %x\n", (unsigned) cpu_type);
220    printk("base_mod = %x\n", (unsigned) base_mod);
221    currentBoard = MOTOROLA_UNKNOWN;
222    return currentBoard;
223  }
224  currentBoard = (motorolaBoard) mot_entry;
225  return currentBoard;
226}
227
228const char* motorolaBoardToString(motorolaBoard board)
229{
230  if (board == MOTOROLA_UNKNOWN) return "Unknown motorola board";
231  return (mot_boards[board].name);
232}
233
[3a3e0b0e]234const struct _int_map *motorolaIntMap(motorolaBoard board)
235{
236  if (board == MOTOROLA_UNKNOWN) return NULL;
237  return mot_boards[board].intmap;
238}
239
240const void *motorolaIntSwizzle(motorolaBoard board)
241{
242  if (board == MOTOROLA_UNKNOWN) return NULL;
243  return (void *)mot_boards[board].swizzler;
244}
Note: See TracBrowser for help on using the repository browser.