253 lines
4.6 KiB
C
253 lines
4.6 KiB
C
/*++
|
||
|
||
Copyright (c) 1991-1994 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"
|
||
|
||
|
||
//
|
||
// Put all code for HAL initialization in the INIT section. It will be
|
||
// deallocated by memory management when phase 1 initialization is
|
||
// completed.
|
||
//
|
||
|
||
#if defined(ALLOC_PRAGMA)
|
||
|
||
#pragma alloc_text(INIT, HalInitSystem)
|
||
#pragma alloc_text(INIT, HalInitializeProcessor)
|
||
#pragma alloc_text(INIT, HalStartNextProcessor)
|
||
|
||
#endif
|
||
|
||
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;
|
||
|
||
//
|
||
// Initialize the HAL components based on the phase of initialization
|
||
// and the processor number.
|
||
//
|
||
|
||
Prcb = PCR->Prcb;
|
||
if ((Phase == 0) || (Prcb->Number != 0)) {
|
||
|
||
//
|
||
// Phase 0 initialization.
|
||
//
|
||
// N.B. Phase 0 initialization is executed on all processors.
|
||
//
|
||
// Set the number of process id's and TB entries.
|
||
//
|
||
|
||
**((PULONG *)(&KeNumberProcessIds)) = 256;
|
||
**((PULONG *)(&KeNumberTbEntries)) = 48;
|
||
|
||
//
|
||
// Set the time increment value.
|
||
//
|
||
|
||
HalpCurrentTimeIncrement = MAXIMUM_INCREMENT;
|
||
HalpNextTimeIncrement = MAXIMUM_INCREMENT;
|
||
HalpNextIntervalCount = 0;
|
||
KeSetTimeIncrement(MAXIMUM_INCREMENT, MINIMUM_INCREMENT);
|
||
|
||
//
|
||
// Set address of cache error routine.
|
||
//
|
||
|
||
KeSetCacheErrorRoutine(HalpCacheErrorRoutine);
|
||
|
||
//
|
||
// Map the fixed TB entries and initiakize the display.
|
||
//
|
||
|
||
HalpMapFixedTbEntries();
|
||
HalpInitializeDisplay0(LoaderBlock);
|
||
|
||
//
|
||
// Allocate map register memory.
|
||
//
|
||
|
||
HalpAllocateMapRegisters(LoaderBlock);
|
||
|
||
//
|
||
// Verify that the procressor block major version number conforms
|
||
// to the system that is being loaded.
|
||
//
|
||
|
||
if (Prcb->MajorVersion != PRCB_MAJOR_VERSION) {
|
||
KeBugCheck(MISMATCHED_HAL);
|
||
}
|
||
|
||
//
|
||
// Initialize interrupts
|
||
//
|
||
//
|
||
|
||
HalpInitializeInterrupts();
|
||
return TRUE;
|
||
|
||
} else {
|
||
|
||
//
|
||
// Phase 1 initialization.
|
||
//
|
||
// N.B. Phase 1 initialization is only executed on processor 0.
|
||
//
|
||
// Complete initialization of the display adapter.
|
||
//
|
||
|
||
if (HalpInitializeDisplay1(LoaderBlock) == FALSE) {
|
||
return FALSE;
|
||
} else {
|
||
|
||
//
|
||
// Map I/O space, calibrate the stall execution scale factor,
|
||
// and create DMA data structures.
|
||
//
|
||
|
||
HalpMapIoSpace();
|
||
HalpCalibrateStall();
|
||
HalpCreateDmaStructures();
|
||
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;
|
||
}
|
||
|
||
BOOLEAN
|
||
HalStartNextProcessor (
|
||
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||
IN PKPROCESSOR_STATE ProcessorState
|
||
)
|
||
|
||
/*++
|
||
|
||
Routine Description:
|
||
|
||
This function is called to start the next processor.
|
||
|
||
Arguments:
|
||
|
||
LoaderBlock - Supplies a pointer to the loader parameter block.
|
||
|
||
ProcessorState - Supplies a pointer to the processor state to be
|
||
used to start the processor.
|
||
|
||
Return Value:
|
||
|
||
If a processor is successfully started, then a value of TRUE is
|
||
returned. Otherwise a value of FALSE is returned.
|
||
|
||
--*/
|
||
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
VOID
|
||
HalpVerifyPrcbVersion(
|
||
VOID
|
||
)
|
||
|
||
/*++
|
||
|
||
Routine Description:
|
||
|
||
This function ?
|
||
|
||
Arguments:
|
||
|
||
None.
|
||
|
||
|
||
Return Value:
|
||
|
||
None.
|
||
|
||
--*/
|
||
|
||
{
|
||
|
||
return;
|
||
}
|