summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halflex/xxinithl.c
blob: 4c91ae9592b66fb670124c2c26e974ca0f181c94 (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/*++

Copyright (c) 1991  Microsoft Corporation

Module Name:

    xxinithl.c

Abstract:


    This module implements the initialization of the system dependent
    functions that define the Hardware Architecture Layer (HAL) for a
    MIPS R3000 or R4000 system.

Author:

    David N. Cutler (davec) 25-Apr-1991

Environment:

    Kernel mode only.

Revision History:

--*/

#include "halp.h"
#include "iousage.h"

//
// Constants
//

ADDRESS_USAGE
UniFlexPCIMainMemorySpace = {
    NULL, CmResourceTypeMemory, PCIUsage,
    {
        __0MB,  __1GB,       // Start=0MB; Length=1GB
        0,0
    }
};

//ADDRESS_USAGE
//UniFlexPCIReservedMemorySpace = {
//    NULL, CmResourceTypeMemory, PCIUsage,
//    {
//        __1GB + __128MB,  __2GB + __1GB - __128MB,       // Start=0MB; Length=1GB
//        0,0
//    }
//};

//ADDRESS_USAGE
//UniFlexPCIReservedIoSpace = {
//    NULL, CmResourceTypePort, PCIUsage,
//    {
//        __32MB,  ~(__32MB) + 1,       // Start=32MB; Length= 4GB - 32MB
//        0,0
//    }
//};

//
// Type Declarations
//

typedef
VOID
(*PGET_PLATFORM_PARAMETER_BLOCK) (
    OUT PLATFORM_PARAMETER_BLOCK **PlatformParameterBlock
    );

//
// Global Veriables
//

KAFFINITY                     HalpActiveProcessors;
ULONG                         HalpBusType                     = UNIFLEX_MACHINE_TYPE_EISA;
ULONG                         HalpMapBufferSize;
PHYSICAL_ADDRESS              HalpMapBufferPhysicalAddress;
PLATFORM_PARAMETER_BLOCK      *HalpPlatformParameterBlock     = NULL;
PLATFORM_SPECIFIC_EXTENSION   *HalpPlatformSpecificExtension  = NULL;


VOID HalpGetPlatformParameterBlock(VOID)

/*++

Routine Description:

    This function gets the PlatformParameterBlock data structure from the
    firmware.  If the PlatformParameterBlock is not available, then the
    system is halted.

Arguments:

    None.

Return Value:

    None.

--*/

{
    PSYSTEM_PARAMETER_BLOCK SystemParameterBlock = SYSTEM_BLOCK;
    PGET_PLATFORM_PARAMETER_BLOCK PrivateGetPlatformParameterBlock;

    //
    // Get Platform Parameter Block from Firmware
    //

    if ((SystemParameterBlock->VendorVectorLength / 4) >= 37) {
        PrivateGetPlatformParameterBlock = *(PGET_PLATFORM_PARAMETER_BLOCK *)((ULONG)(SystemParameterBlock->VendorVector) + 37*4);
        PrivateGetPlatformParameterBlock(&HalpPlatformParameterBlock);
        HalpPlatformSpecificExtension = (PLATFORM_SPECIFIC_EXTENSION *)(HalpPlatformParameterBlock->PlatformSpecificExtension);
    } else {

        //
        // HALT system.  No platform parameter block available.
        //

        for(;;);
    }
}

BOOLEAN
HalInitSystem (
    IN ULONG Phase,
    IN PLOADER_PARAMETER_BLOCK LoaderBlock
    )

/*++

Routine Description:

    This function initializes the Hardware Architecture Layer (HAL) for a
    MIPS R3000 or R4000 system.

Arguments:

    Phase - Supplies the initialization phase (zero or one).

    LoaderBlock - Supplies a pointer to a loader parameter block.

Return Value:

    A value of TRUE is returned is the initialization was successfully
    complete. Otherwise a value of FALSE is returend.

--*/
{
    PKPRCB                        Prcb;
    ULONG                         BuildType = 0;

    Prcb = KeGetCurrentPrcb();
    if (Phase == 0) {

        //
        // Phase 0 initialization.
        //

        //
        // Verify that the processor block major version number conform
        // to the system that is being loaded.
        //

        if (Prcb->MajorVersion != PRCB_MAJOR_VERSION) {
            KeBugCheck(MISMATCHED_HAL);
        }

        //
        // Set the active processor affinity mask.
        //

        HalpActiveProcessors = 1 << Prcb->Number;

        //
        // Set the DMA I/O Coherency to not coherent.  This means that the instruction
        // cache is not coherent with DMA, and the data cache is not coherent with DMA
        // on either reads or writes.
        //

        KeSetDmaIoCoherency(0);

        //
        // Set the time increment value.
        //

        HalpCurrentTimeIncrement = MAXIMUM_INCREMENT;
        HalpNextTimeIncrement = MAXIMUM_INCREMENT;
        HalpNextIntervalCount = 0;
        KeSetTimeIncrement(MAXIMUM_INCREMENT, MINIMUM_INCREMENT);

        //
        // Fill in handlers for APIs which this HAL supports
        //

        HalQuerySystemInformation = HaliQuerySystemInformation;
        HalSetSystemInformation   = HaliSetSystemInformation;
        HalRegisterBusHandler     = HaliRegisterBusHandler;
        HalHandlerForBus          = HaliHandlerForBus;
        HalHandlerForConfigSpace  = HaliHandlerForConfigSpace;

        //
        // Get Platform Parameter Block from Firmware
        //

        HalpGetPlatformParameterBlock();

        //
        // Do platform specific initialization.
        //

        HalpInitSystem(Phase,LoaderBlock);

        //
        // Initialize interrupts.
        //

        HalpInitializeInterrupts();

        //
        // Register HAL Reserved Address Spaces
        //

//        HalpRegisterAddressUsage (&UniFlexPCIMainMemorySpace);
//        HalpRegisterAddressUsage (&UniFlexPCIReservedMemorySpace);
//        HalpRegisterAddressUsage (&UniFlexPCIReservedIoSpace);

        return TRUE;

    } else {

        //
        // Phase 1 initialization.
        //

        //
        // Do platform specific initialization.
        //

        HalpInitSystem(Phase,LoaderBlock);

        return TRUE;
    }
}


VOID
HalInitializeProcessor (
    IN ULONG Number
    )

/*++

Routine Description:

    This function is called early in the initialization of the kernel
    to perform platform dependent initialization for each processor
    before the HAL Is fully functional.

    N.B. When this routine is called, the PCR is present but is not
         fully initialized.

Arguments:

    Number - Supplies the number of the processor to initialize.

Return Value:

    None.

--*/

{
    return;
}

VOID
HalpVerifyPrcbVersion ()
{

}