summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halast/i386/astebini.c
blob: 5984377d3712d5cf597cf3bb923b566b86deeaff (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*++

Copyright (c) 1992  AST Research Inc.

Module Name:

    astebini.c

Abstract:

    Initialization code for AST Manhattan system.

Author:

    Bob Beard (v-bobb) 24-Jul-1992

Environment:

    Kernel mode only.

Revision History:

--*/

#ifndef _NTOS_
#include "nthal.h"
#endif

#include "halp.h"
#include "astebiii.h"
#include "astdisp.h"

VOID DisplPanel(ULONG x);

extern PVOID BiosPtr;

// *** temporary way to do MMIOTable & EbiMemory
#define MAX_EBI_SLOTS 32L
VOID* EBI2_MMIOTable[MAX_EBI_SLOTS];
#define MAX_EBI_MEMORY 1024L
static UCHAR EbiMemory[MAX_EBI_MEMORY];

//
// EBI Revision
//

revisionCode EBI2_revision;

//
// Number of good processors in the system
//

ULONG EBI2_ProcCnt;
ULONG MpCount;              // zero based version for HalStartNextProcessor

//
// EBI_II function offset table
//

extern EBI_II EBI2_CallTab;


BOOLEAN
ASTInitEBI2()
/*++

Routine Description:
    Initialize the AST EBI II environment. Only called if an AST machine
    with EBI II capability. Gets table of EBI II call addresses in ebi_call_table.
    Sets up EBI2_MMIOTable (EBI II Memory Mapped I/O Table).

Arguments:
    none.

Return Value:
    True if EBI II successfully initialized. False otherwise.

--*/
{

ULONG i;
//ULONG *Alias = (ULONG *)&EBI2_CallTab;
//ebi_iiSig *Sig = (ebi_iiSig*)((ULONG)BiosPtr + EBI_II_SIGNATURE);
//ULONG *OffTab;
IOInfoTable IOInfo[MAX_EBI_SLOTS];
dWord NumSlots;
ULONG Pages;
procConfigData ConfigData;
ULONG ProcCount;

//*** v-quangp: This table is already build at astdetct.c **
//
// Build the EBI II offset table
//
//
//  OffTab =(ULONG *) ((ULONG)BiosPtr + (REAL_TO_LIN(Sig->seg,Sig->off) -
//                REAL_TO_LIN(BIOS_SEG, 0)));
//  for( i = 0; i < ( sizeof( offsetTable ) / sizeof( ULONG )); i++ )
//        Alias[i] = OffTab[i] + (ULONG)BiosPtr;
//
//
// Get the number of "slots" (logical address spaces)
//

EBI2_CallTab.GetNumSlots( &NumSlots );
if (NumSlots > MAX_EBI_SLOTS)
 { DisplPanel(HALSlotProblem); return(FALSE); }

//
// Get the Memory Mapped I/O Information
//

if ( (EBI2_CallTab.GetMMIOTable( IOInfo )))
  { DisplPanel(HALMMIOProblem);  return(FALSE); }

for( i = 0; i < NumSlots; i++ )
  if( IOInfo[i].length ) {

//
// Allocate some memory for EBI II
//

     if ( IOInfo[i].flags & ALLOCATE_RAM )
       { if (IOInfo[i].length > MAX_EBI_MEMORY)
           { DisplPanel(HALMemoryProblem); return(FALSE); }
         EBI2_MMIOTable[i] = EbiMemory;
       }

//
// Allocate a virtual address spanning the memory mapped I/O range
// for a given slot.
//

     else {
       Pages = IOInfo[i].length / PAGE_SIZE;
       if ( IOInfo[i].length % PAGE_SIZE )
        Pages++;
       EBI2_MMIOTable[i] = HalpMapPhysicalMemory( (PVOID)IOInfo[i].address.low, Pages );
       if ( EBI2_MMIOTable[i] == NULL )
         { DisplPanel(HALPhysicalAllocProblem); return(FALSE); }
     }
  }

//
// Initialize EBI II
//

 if ( (EBI2_CallTab.InitEBI)( EBI2_MMIOTable ) )
     { DisplPanel(HALEBIInitProblem); return(FALSE); }

//
// Put NT on the front panel display
//

 EBI2_CallTab.SetPanelAlphaNum( EBI2_MMIOTable, " NT ");

//
// Find out the number of good processors
//

 if ( (EBI2_CallTab.GetNumProcs)( EBI2_MMIOTable, &ProcCount ) )
     { DisplPanel(HALEBIGetProcProblem); return(FALSE); }

 EBI2_ProcCnt = ProcCount;
 for (i=0; i<ProcCount; i++)
  if ( (EBI2_CallTab.GetProcConf)( EBI2_MMIOTable, i, &ConfigData ) )
     EBI2_ProcCnt--;

 if (EBI2_ProcCnt == 0)
     { DisplPanel(HALEBINoProcsProblem); return(FALSE); }

 MpCount = EBI2_ProcCnt - 1;

//
// Turn on the front panel cpu activity bar graph in histogram mode
//

 EBI2_CallTab.SetPanelProcGraphMode(  EBI2_MMIOTable, 0 );

//
// Get EBI2 Revision
//

if ( (EBI2_CallTab.GetRevision( EBI2_MMIOTable, &EBI2_revision )))
  { DisplPanel(HALGetRevisionProblem);  return(FALSE); }


 return(TRUE);
}