summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/shared/motorola/motorola.c
blob: 9b7057e849af0db41624b1383474441f60f05ee6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* motorola.h
 *
 *  This include file describe the data structure and the functions implemented
 *  by rtems to identify motorola boards.
 *
 *  CopyRight (C) 1999 valette@crf.canon.fr
 *
 *  The license and distribution terms for this file may be
 *  found in found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *  $Id$
 */


#include <bsp/motorola.h>
#include <rtems/bspIo.h>
#include <libcpu/io.h>
#include <string.h>

typedef struct {
  /*
   * 0x100 mask assumes for Raven and Hawk boards
   * that the level/edge are set.
   * 0x200 if this board has a Hawk chip.
   */
  int		cpu_type;
  int		base_type;
  const char	*name;
} mot_info_t;


static const mot_info_t mot_boards[] = {
  {0x300, 0x00, "MVME 2400"},
  {0x010, 0x00, "Genesis"},
  {0x020, 0x00, "Powerstack (Series E)"},
  {0x040, 0x00, "Blackhawk (Powerstack)"},
  {0x050, 0x00, "Omaha (PowerStack II Pro3000)"},
  {0x060, 0x00, "Utah (Powerstack II Pro4000)"},
  {0x0A0, 0x00, "Powerstack (Series EX)"},
  {0x1E0, 0xE0, "Mesquite cPCI (MCP750)"},
  {0x1E0, 0xE1, "Sitka cPCI (MCPN750)"},
  {0x1E0, 0xE2, "Mesquite cPCI (MCP750) w/ HAC"},
  {0x1E0, 0xF6, "MTX Plus"},
  {0x1E0, 0xF7, "MTX wo/ Parallel Port"},
  {0x1E0, 0xF8, "MTX w/ Parallel Port"},
  {0x1E0, 0xF9, "MVME 2300"},
  {0x1E0, 0xFA, "MVME 2300SC/2600"},
  {0x1E0, 0xFB, "MVME 2600 with MVME712M"},
  {0x1E0, 0xFC, "MVME 2600/2700 with MVME761"},
  {0x1E0, 0xFD, "MVME 3600 with MVME712M"},
  {0x1E0, 0xFE, "MVME 3600 with MVME761"},
  {0x1E0, 0xFF, "MVME 1600-001 or 1600-011"},
  {0x000, 0x00, ""}
};

prep_t currentPrepType;
motorolaBoard		currentBoard;
prep_t checkPrepBoardType(RESIDUAL *res)
{
  prep_t PREP_type;
  /* figure out what kind of prep workstation we are */
  if ( res->ResidualLength != 0 ) {
    if ( !strncmp(res->VitalProductData.PrintableModel,"IBM",3) )
      PREP_type = PREP_IBM;
    else if (!strncmp(res->VitalProductData.PrintableModel,
		      "Radstone",8)){
      PREP_type = PREP_Radstone;
    }
    else
      PREP_type = PREP_Motorola;
  }
  else /* assume motorola if no residual (netboot?) */ {
    PREP_type = PREP_Motorola;
  }
  currentPrepType = PREP_type;
  return PREP_type;
}

motorolaBoard	getMotorolaBoard()
{
  unsigned char  cpu_type;
  unsigned char  base_mod;
  int	       	 entry;
  int	       	 mot_entry = -1;

  cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
  base_mod = inb(MOTOROLA_BASETYPE_REG);

  for (entry = 0; mot_boards[entry].cpu_type != 0; entry++) {
    if ((mot_boards[entry].cpu_type & 0xff) != cpu_type)
      continue;
      
    if (mot_boards[entry].base_type == 0) {
      mot_entry = entry;
      break;
    }
      
    if (mot_boards[entry].base_type != base_mod)
      continue;
    else{
      mot_entry = entry;
      break;
    }
  }
  if (mot_entry == -1) {
    printk("Unknown motorola board Please update libbsp/powerpc/shared/motorola/motorola.c\n");
    printk("cpu_type = %x\n", (unsigned) cpu_type);
    printk("base_mod = %x\n", (unsigned) base_mod);
    currentBoard = MOTOROLA_UNKNOWN;
    return currentBoard;
  }
  currentBoard = (motorolaBoard) mot_entry;
  return currentBoard;
}

const char* motorolaBoardToString(motorolaBoard board)
{
  if (board == MOTOROLA_UNKNOWN) return "Unknown motorola board";
  return (mot_boards[board].name);
}