- New ARM HAL after 2 nights in the company of a madman.

- Many fixes, more implemented routines, support for ARMv7.
- Some Linux code, marked as GPL, from ARM Ltd in cache.s. All OS use this code.

svn path=/trunk/; revision=45518
This commit is contained in:
evb 2010-02-09 02:26:28 +00:00
parent 62cb7586f3
commit 8e6d54f4b8
32 changed files with 2240 additions and 1597 deletions

View file

@ -46,7 +46,7 @@
@ stdcall HalGetEnvironmentVariable(str long str)
@ fastcall -arch=arm HalGetInterruptSource()
@ stdcall HalGetInterruptVector(long long long long ptr ptr)
@ stdcall HalHandleNMI(ptr)
@ stdcall -arch=i386 HalHandleNMI(ptr)
@ stdcall HalInitSystem(long ptr)
@ stdcall HalInitializeProcessor(long ptr)
@ stdcall HalMakeBeep(long)

View file

@ -1,9 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../tools/rbuild/project.dtd">
<group xmlns:xi="http://www.w3.org/2001/XInclude">
<directory name="halx86">
<xi:include href="halx86/directory.rbuild" />
</directory>
<if property="ARCH" value="i386">
<directory name="halx86">
<xi:include href="halx86/directory.rbuild" />
</directory>
</if>
<if property="ARCH" value="powerpc">
<directory name="halppc">

View file

@ -1,10 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../tools/rbuild/project.dtd">
<!DOCTYPE group SYSTEM "../tools/rbuild/project.dtd">
<group xmlns:xi="http://www.w3.org/2001/XInclude">
<directory name="generic">
<xi:include href="generic/generic.rbuild" />
</directory>
<directory name="up">
<xi:include href="up/halup.rbuild" />
</directory>
<xi:include href="hal_generic.rbuild" />
<if property="SARCH" value="versatile">
<xi:include href="versa/halup.rbuild" />
</if>
</group>

View file

@ -0,0 +1,26 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/beep.c
* PURPOSE: Speaker support (beeping)
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
BOOLEAN
NTAPI
HalMakeBeep(IN ULONG Frequency)
{
UNIMPLEMENTED;
return FALSE;
}

View file

@ -0,0 +1,151 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/bus.c
* PURPOSE: Bus Support Routines
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
/* PRIVATE FUNCTIONS **********************************************************/
/* PUBLIC FUNCTIONS ***********************************************************/
/*
* @unimplemented
*/
NTSTATUS
NTAPI
HalAdjustResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST *ResourceList)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
NTSTATUS
NTAPI
HalAssignSlotResources(IN PUNICODE_STRING RegistryPath,
IN PUNICODE_STRING DriverClassName,
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT DeviceObject,
IN INTERFACE_TYPE BusType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN OUT PCM_RESOURCE_LIST *AllocatedResources)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
ULONG
NTAPI
HalGetBusData(IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Length)
{
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/*
* @unimplemented
*/
ULONG
NTAPI
HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Offset,
IN ULONG Length)
{
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/*
* @unimplemented
*/
ULONG
NTAPI
HalGetInterruptVector(IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN ULONG BusInterruptLevel,
IN ULONG BusInterruptVector,
OUT PKIRQL Irql,
OUT PKAFFINITY Affinity)
{
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/*
* @unimplemented
*/
ULONG
NTAPI
HalSetBusData(IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Length)
{
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/*
* @unimplemented
*/
ULONG
NTAPI
HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Offset,
IN ULONG Length)
{
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/*
* @unimplemented
*/
BOOLEAN
NTAPI
HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN PHYSICAL_ADDRESS BusAddress,
IN OUT PULONG AddressSpace,
OUT PPHYSICAL_ADDRESS TranslatedAddress)
{
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/* EOF */

View file

@ -0,0 +1,57 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: GPL - See COPYING in the top level directory
* FILE: hal/halarm/generic/cache.s
* PURPOSE: Implements cache clean, invalidate routines for ARM machines
* PROGRAMMERS: Copyright (C) 2005 ARM Ltd.
*/
.title "ARM HAL Cache Routines"
.include "ntoskrnl/include/internal/arm/kxarm.h"
.include "ntoskrnl/include/internal/arm/ksarm.h"
NESTED_ENTRY v7_flush_dcache_all
PROLOG_END v7_flush_dcache_all
mrc p15, 1, r0, c0, c0, 1 // read clidr
ands r3, r0, #0x7000000 // extract loc from clidr
mov r3, r3, lsr #23 // left align loc bit field
beq finished // if loc is 0, then no need to clean
mov r10, #0 // start clean at cache level 0
loop1:
add r2, r10, r10, lsr #1 // work out 3x current cache level
mov r1, r0, lsr r2 // extract cache type bits from clidr
and r1, r1, #7 // mask of the bits for current cache only
cmp r1, #2 // see what cache we have at this level
blt skip // skip if no cache, or just i-cache
mcr p15, 2, r10, c0, c0, 0 // select current cache level in cssr
isb // isb to sych the new cssr&csidr
mrc p15, 1, r1, c0, c0, 0 // read the new csidr
and r2, r1, #7 // extract the length of the cache lines
add r2, r2, #4 // add 4 (line length offset)
ldr r4, =0x3ff
ands r4, r4, r1, lsr #3 // find maximum number on the way size
clz r5, r4 // find bit position of way size increment
ldr r7, =0x7fff
ands r7, r7, r1, lsr #13 // extract max number of the index size
loop2:
mov r9, r4 // create working copy of max way size
loop3:
orr r11, r10, r9, lsl r5 // factor way and cache number into r11
orr r11, r11, r7, lsl r2 // factor index number into r11
mcr p15, 0, r11, c7, c14, 2 // clean & invalidate by set/way
subs r9, r9, #1 // decrement the way
bge loop3
subs r7, r7, #1 // decrement the index
bge loop2
skip:
add r10, r10, #2 // increment cache number
cmp r3, r10
bgt loop1
finished:
mov r10, #0 // swith back to cache level 0
mcr p15, 2, r10, c0, c0, 0 // select current cache level in cssr
isb
mov pc, lr
ENTRY_END v7_flush_dcache_all

View file

@ -0,0 +1,64 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/display.c
* PURPOSE: Screen Display Routines, now useless since NT 5.1+
* PROGRAMMERS: ReactOS Portable Systems Group
*/
#include <hal.h>
#define NDEBUG
#include <debug.h>
#include <ndk/inbvfuncs.h>
/* PUBLIC FUNCTIONS ***********************************************************/
/*
* @implemented
*/
VOID
NTAPI
HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
{
/* Stub since Windows XP implemented Inbv */
return;
}
/*
* @implemented
*/
VOID
NTAPI
HalDisplayString(IN PCH String)
{
/* Call the Inbv driver */
InbvDisplayString(String);
}
/*
* @implemented
*/
VOID
NTAPI
HalQueryDisplayParameters(OUT PULONG DispSizeX,
OUT PULONG DispSizeY,
OUT PULONG CursorPosX,
OUT PULONG CursorPosY)
{
/* Stub since Windows XP implemented Inbv */
return;
}
/*
* @implemented
*/
VOID
NTAPI
HalSetDisplayParameters(IN ULONG CursorPosX,
IN ULONG CursorPosY)
{
/* Stub since Windows XP implemented Inbv */
return;
}
/* EOF */

View file

@ -0,0 +1,188 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/dma.c
* PURPOSE: DMA Support
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ******************************************************************/
/*
* @unimplemented
*/
PADAPTER_OBJECT
NTAPI
HalGetAdapter(IN PDEVICE_DESCRIPTION DeviceDescription,
OUT PULONG NumberOfMapRegisters)
{
UNIMPLEMENTED;
while (TRUE);
return NULL;
}
/*
* @unimplemented
*/
VOID
NTAPI
HalPutDmaAdapter(IN PADAPTER_OBJECT AdapterObject)
{
UNIMPLEMENTED;
while (TRUE);
}
/*
* @unimplemented
*/
PVOID
NTAPI
HalAllocateCommonBuffer(IN PADAPTER_OBJECT AdapterObject,
IN ULONG Length,
IN PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled)
{
UNIMPLEMENTED;
while (TRUE);
return NULL;
}
/*
* @unimplemented
*/
VOID
NTAPI
HalFreeCommonBuffer(IN PADAPTER_OBJECT AdapterObject,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled)
{
UNIMPLEMENTED;
while (TRUE);
}
/*
* @unimplemented
*/
ULONG
NTAPI
HalReadDmaCounter(IN PADAPTER_OBJECT AdapterObject)
{
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/*
* @unimplemented
*/
NTSTATUS
NTAPI
HalAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject,
IN PWAIT_CONTEXT_BLOCK WaitContextBlock,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
VOID
NTAPI
IoFreeAdapterChannel(IN PADAPTER_OBJECT AdapterObject)
{
UNIMPLEMENTED;
while (TRUE);
}
/*
* @unimplemented
*/
VOID
NTAPI
IoFreeMapRegisters(IN PADAPTER_OBJECT AdapterObject,
IN PVOID MapRegisterBase,
IN ULONG NumberOfMapRegisters)
{
UNIMPLEMENTED;
while (TRUE);
}
/*
* @unimplemented
*/
BOOLEAN
NTAPI
IoFlushAdapterBuffers(IN PADAPTER_OBJECT AdapterObject,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN ULONG Length,
IN BOOLEAN WriteToDevice)
{
UNIMPLEMENTED;
while (TRUE);
return FALSE;
}
/*
* @unimplemented
*/
PHYSICAL_ADDRESS
NTAPI
IoMapTransfer(IN PADAPTER_OBJECT AdapterObject,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice)
{
PHYSICAL_ADDRESS Address;
UNIMPLEMENTED;
while (TRUE);
Address.QuadPart = 0;
return Address;
}
/*
* @unimplemented
*/
BOOLEAN
NTAPI
HalFlushCommonBuffer(IN PADAPTER_OBJECT AdapterObject,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress)
{
UNIMPLEMENTED;
while (TRUE);
return FALSE;
}
/*
* @unimplemented
*/
PVOID
NTAPI
HalAllocateCrashDumpRegisters(IN PADAPTER_OBJECT AdapterObject,
IN OUT PULONG NumberOfMapRegisters)
{
UNIMPLEMENTED;
while (TRUE);
return NULL;
}
/* EOF */

View file

@ -0,0 +1,75 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/drive.c
* PURPOSE: HAL Stubs for Disk I/O Routines
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
VOID
NTAPI
HalpAssignDriveLetters(IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
IN PSTRING NtDeviceName,
OUT PUCHAR NtSystemPath,
OUT PSTRING NtSystemPathString)
{
/* Call the kernel */
IoAssignDriveLetters(LoaderBlock,
NtDeviceName,
NtSystemPath,
NtSystemPathString);
}
NTSTATUS
NTAPI
HalpReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN BOOLEAN ReturnRecognizedPartitions,
IN OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
{
/* Call the kernel */
return IoReadPartitionTable(DeviceObject,
SectorSize,
ReturnRecognizedPartitions,
PartitionBuffer);
}
NTSTATUS
NTAPI
HalpWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG SectorsPerTrack,
IN ULONG NumberOfHeads,
IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
{
/* Call the kernel */
return IoWritePartitionTable(DeviceObject,
SectorSize,
SectorsPerTrack,
NumberOfHeads,
PartitionBuffer);
}
NTSTATUS
NTAPI
HalpSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG PartitionNumber,
IN ULONG PartitionType)
{
/* Call the kernel */
return IoSetPartitionInformation(DeviceObject,
SectorSize,
PartitionNumber,
PartitionType);
}
/* EOF */

View file

@ -0,0 +1,46 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/fmutex.c
* PURPOSE: Fast Mutex Support
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
#undef ExAcquireFastMutex
#undef ExReleaseFastMutex
#undef ExTryToAcquireFastMutex
/* FUNCTIONS ******************************************************************/
VOID
FASTCALL
ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
{
UNIMPLEMENTED;
while (TRUE);
}
VOID
FASTCALL
ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
{
UNIMPLEMENTED;
while (TRUE);
}
BOOLEAN
FASTCALL
ExTryToAcquireFastMutex(IN PFAST_MUTEX FastMutex)
{
UNIMPLEMENTED;
while (TRUE);
return TRUE;
}
/* EOF */

View file

@ -1,9 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="halarm_generic" type="objectlibrary">
<include base="halarm_generic">../include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHAL_" />
<file>hal.c</file>
<pch>../include/hal.h</pch>
</module>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,182 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/halinit.c
* PURPOSE: HAL Entrypoint and Initialization
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
/* PRIVATE FUNCTIONS **********************************************************/
VOID
NTAPI
HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PCHAR CommandLine;
/* Make sure we have a loader block and command line */
if ((LoaderBlock) && (LoaderBlock->LoadOptions))
{
/* Read the command line */
CommandLine = LoaderBlock->LoadOptions;
/* Check for initial breakpoint */
if (strstr(CommandLine, "BREAK")) DbgBreakPoint();
}
}
/* FUNCTIONS ******************************************************************/
/*
* @implemented
*/
BOOLEAN
NTAPI
HalInitSystem(IN ULONG BootPhase,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PKPRCB Prcb = KeGetCurrentPrcb();
/* Check the boot phase */
if (!BootPhase)
{
/* Get command-line parameters */
HalpGetParameters(LoaderBlock);
/* Checked HAL requires checked kernel */
#if DBG
if (!(Prcb->BuildType & PRCB_BUILD_DEBUG))
{
/* No match, bugcheck */
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 1, 0);
}
#else
/* Release build requires release HAL */
if (Prcb->BuildType & PRCB_BUILD_DEBUG)
{
/* No match, bugcheck */
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
}
#endif
#ifdef CONFIG_SMP
/* SMP HAL requires SMP kernel */
if (Prcb->BuildType & PRCB_BUILD_UNIPROCESSOR)
{
/* No match, bugcheck */
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
}
#endif
/* Validate the PRCB */
if (Prcb->MajorVersion != PRCB_MAJOR_VERSION)
{
/* Validation failed, bugcheck */
KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0);
}
/* Initialize interrupts */
HalpInitializeInterrupts();
/* Force initial PIC state */
KfRaiseIrql(KeGetCurrentIrql());
/* Fill out the dispatch tables */
//HalQuerySystemInformation = NULL; // FIXME: TODO;
//HalSetSystemInformation = NULL; // FIXME: TODO;
//HalInitPnpDriver = NULL; // FIXME: TODO
//HalGetDmaAdapter = NULL; // FIXME: TODO;
//HalGetInterruptTranslator = NULL; // FIXME: TODO
//HalResetDisplay = NULL; // FIXME: TODO;
//HalHaltSystem = NULL; // FIXME: TODO;
/* Setup I/O space */
//HalpDefaultIoSpace.Next = HalpAddressUsageList;
//HalpAddressUsageList = &HalpDefaultIoSpace;
/* Setup busy waiting */
//HalpCalibrateStallExecution();
/* Initialize the clock */
HalpInitializeClock();
/* Setup time increments to 10ms and 1ms */
HalpCurrentTimeIncrement = 100000;
HalpNextTimeIncrement = 100000;
HalpNextIntervalCount = 0;
KeSetTimeIncrement(100000, 10000);
/*
* We could be rebooting with a pending profile interrupt,
* so clear it here before interrupts are enabled
*/
HalStopProfileInterrupt(ProfileTime);
/* Do some HAL-specific initialization */
HalpInitPhase0(LoaderBlock);
}
else if (BootPhase == 1)
{
/* Enable timer interrupt */
HalpEnableInterruptHandler(IDT_DEVICE,
0,
PRIMARY_VECTOR_BASE,
CLOCK2_LEVEL,
HalpClockInterrupt,
Latched);
#if 0
/* Enable IRQ 8 */
HalpEnableInterruptHandler(IDT_DEVICE,
0,
PRIMARY_VECTOR_BASE + 8,
PROFILE_LEVEL,
HalpProfileInterrupt,
Latched);
#endif
/* Initialize DMA. NT does this in Phase 0 */
//HalpInitDma();
/* Do some HAL-specific initialization */
HalpInitPhase1();
}
/* All done, return */
return TRUE;
}
#include <internal/kd.h>
ULONG
DbgPrintEarly(const char *fmt, ...)
{
va_list args;
unsigned int i;
char Buffer[1024];
PCHAR String = Buffer;
va_start(args, fmt);
i = vsprintf(Buffer, fmt, args);
va_end(args);
/* Output the message */
while (*String != 0)
{
if (*String == '\n')
{
KdPortPutByteEx(NULL, '\r');
}
KdPortPutByteEx(NULL, *String);
String++;
}
return STATUS_SUCCESS;
}
/* EOF */

View file

@ -0,0 +1,47 @@
/*
* PROJECT: ReactOS Hardware Abstraction Layer (HAL)
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/misc.c
* PURPOSE: Misc functions to move
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
/* FUNCTIONS ******************************************************************/
/*
* @implemented
*/
UCHAR
FASTCALL
HalSystemVectorDispatchEntry(IN ULONG Vector,
OUT PKINTERRUPT_ROUTINE **FlatDispatch,
OUT PKINTERRUPT_ROUTINE *NoConnection)
{
/* Not implemented */
UNIMPLEMENTED;
while (TRUE);
return 0;
}
/*
* @implemented
*/
VOID
NTAPI
KeFlushWriteBuffer(VOID)
{
/* Not implemented */
UNIMPLEMENTED;
while (TRUE);
return;
}
/* EOF */

View file

@ -0,0 +1,342 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/pic.c
* PURPOSE: HAL PIC Management and Control Code
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
#undef KeGetCurrentIrql
/* GLOBALS ********************************************************************/
ULONG HalpIrqlTable[HIGH_LEVEL + 1] =
{
0xFFFFFFFF, // IRQL 0 PASSIVE_LEVEL
0xFFFFFFFD, // IRQL 1 APC_LEVEL
0xFFFFFFF9, // IRQL 2 DISPATCH_LEVEL
0xFFFFFFD9, // IRQL 3
0xFFFFFF99, // IRQL 4
0xFFFFFF19, // IRQL 5
0xFFFFFE19, // IRQL 6
0xFFFFFC19, // IRQL 7
0xFFFFF819, // IRQL 8
0xFFFFF019, // IRQL 9
0xFFFFE019, // IRQL 10
0xFFFFC019, // IRQL 11
0xFFFF8019, // IRQL 12
0xFFFF0019, // IRQL 13
0xFFFE0019, // IRQL 14
0xFFFC0019, // IRQL 15
0xFFF80019, // IRQL 16
0xFFF00019, // IRQL 17
0xFFE00019, // IRQL 18
0xFFC00019, // IRQL 19
0xFF800019, // IRQL 20
0xFF000019, // IRQL 21
0xFE000019, // IRQL 22
0xFC000019, // IRQL 23
0xF0000019, // IRQL 24
0x80000019, // IRQL 25
0x19, // IRQL 26
0x18, // IRQL 27 PROFILE_LEVEL
0x10, // IRQL 28 CLOCK2_LEVEL
0x00, // IRQL 29 IPI_LEVEL
0x00, // IRQL 30 POWER_LEVEL
0x00, // IRQL 31 HIGH_LEVEL
};
UCHAR HalpMaskTable[HIGH_LEVEL + 1] =
{
PROFILE_LEVEL, // INT 0 WATCHDOG
APC_LEVEL, // INT 1 SOFTWARE INTERRUPT
DISPATCH_LEVEL,// INT 2 COMM RX
IPI_LEVEL, // INT 3 COMM TX
CLOCK2_LEVEL, // INT 4 TIMER 0
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
26,
26
};
/* FUNCTIONS ******************************************************************/
VOID
HalpInitializeInterrupts(VOID)
{
PKIPCR Pcr = (PKIPCR)KeGetPcr();
/* Fill out the IRQL mappings */
RtlCopyMemory(Pcr->IrqlTable, HalpIrqlTable, sizeof(Pcr->IrqlTable));
RtlCopyMemory(Pcr->IrqlMask, HalpMaskTable, sizeof(Pcr->IrqlMask));
}
/* IRQL MANAGEMENT ************************************************************/
/*
* @implemented
*/
ULONG
HalGetInterruptSource(VOID)
{
ULONG InterruptStatus;
/* Get the interrupt status, and return the highest bit set */
InterruptStatus = READ_REGISTER_ULONG(VIC_INT_STATUS);
return 31 - _clz(InterruptStatus);
}
/*
* @implemented
*/
KIRQL
NTAPI
KeGetCurrentIrql(VOID)
{
/* Return the IRQL */
return KeGetPcr()->Irql;
}
/*
* @implemented
*/
KIRQL
NTAPI
KeRaiseIrqlToDpcLevel(VOID)
{
PKPCR Pcr = KeGetPcr();
KIRQL CurrentIrql;
/* Save and update IRQL */
CurrentIrql = Pcr->Irql;
Pcr->Irql = DISPATCH_LEVEL;
#ifdef IRQL_DEBUG
/* Validate correct raise */
if (CurrentIrql > DISPATCH_LEVEL) KeBugCheck(IRQL_NOT_GREATER_OR_EQUAL);
#endif
/* Return the previous value */
return CurrentIrql;
}
/*
* @implemented
*/
KIRQL
NTAPI
KeRaiseIrqlToSynchLevel(VOID)
{
PKPCR Pcr = KeGetPcr();
KIRQL CurrentIrql;
/* Save and update IRQL */
CurrentIrql = Pcr->Irql;
Pcr->Irql = SYNCH_LEVEL;
#ifdef IRQL_DEBUG
/* Validate correct raise */
if (CurrentIrql > SYNCH_LEVEL)
{
/* Crash system */
KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
CurrentIrql,
SYNCH_LEVEL,
0,
1);
}
#endif
/* Return the previous value */
return CurrentIrql;
}
/*
* @implemented
*/
KIRQL
FASTCALL
KfRaiseIrql(IN KIRQL NewIrql)
{
ARM_STATUS_REGISTER Flags;
PKIPCR Pcr = (PKIPCR)KeGetPcr();
KIRQL CurrentIrql;
ULONG InterruptMask;
/* Disable interrupts */
Flags = KeArmStatusRegisterGet();
_disable();
/* Read current IRQL */
CurrentIrql = Pcr->Irql;
#ifdef IRQL_DEBUG
/* Validate correct raise */
if (CurrentIrql > NewIrql)
{
/* Crash system */
Pcr->Irql = PASSIVE_LEVEL;
KeBugCheck(IRQL_NOT_GREATER_OR_EQUAL);
}
#endif
/* Clear interrupts associated to the old IRQL */
WRITE_REGISTER_ULONG(VIC_INT_CLEAR, 0xFFFFFFFF);
/* Set the new interrupt mask */
InterruptMask = Pcr->IrqlTable[NewIrql];
WRITE_REGISTER_ULONG(VIC_INT_ENABLE, InterruptMask);
/* Set new IRQL */
Pcr->Irql = NewIrql;
/* Restore interrupt state */
if (!Flags.IrqDisable) _enable();
/* Return old IRQL */
return CurrentIrql;
}
/*
* @implemented
*/
VOID
FASTCALL
KfLowerIrql(IN KIRQL NewIrql)
{
ARM_STATUS_REGISTER Flags;
PKIPCR Pcr = (PKIPCR)KeGetPcr();
ULONG InterruptMask;
/* Disableinterrupts */
Flags = KeArmStatusRegisterGet();
_disable();
#ifdef IRQL_DEBUG
/* Validate correct lower */
if (OldIrql > Pcr->Irql)
{
/* Crash system */
Pcr->Irql = HIGH_LEVEL;
KeBugCheck(IRQL_NOT_LESS_OR_EQUAL);
}
#endif
/* Clear interrupts associated to the old IRQL */
WRITE_REGISTER_ULONG(VIC_INT_CLEAR, 0xFFFFFFFF);
/* Set the new interrupt mask */
InterruptMask = Pcr->IrqlTable[NewIrql];
WRITE_REGISTER_ULONG(VIC_INT_ENABLE, InterruptMask);
/* Save the new IRQL and restore interrupt state */
Pcr->Irql = NewIrql;
if (!Flags.IrqDisable) _enable();
}
/* SOFTWARE INTERRUPTS ********************************************************/
/*
* @implemented
*/
VOID
FASTCALL
HalRequestSoftwareInterrupt(IN KIRQL Irql)
{
/* Force a software interrupt */
WRITE_REGISTER_ULONG(VIC_SOFT_INT, 1 << Irql);
}
/*
* @implemented
*/
VOID
FASTCALL
HalClearSoftwareInterrupt(IN KIRQL Irql)
{
/* Clear software interrupt */
WRITE_REGISTER_ULONG(VIC_SOFT_INT_CLEAR, 1 << Irql);
}
/* SYSTEM INTERRUPTS **********************************************************/
/*
* @implemented
*/
BOOLEAN
NTAPI
HalEnableSystemInterrupt(IN UCHAR Vector,
IN KIRQL Irql,
IN KINTERRUPT_MODE InterruptMode)
{
UNIMPLEMENTED;
while (TRUE);
return FALSE;
}
/*
* @implemented
*/
VOID
NTAPI
HalDisableSystemInterrupt(IN UCHAR Vector,
IN KIRQL Irql)
{
UNIMPLEMENTED;
while (TRUE);
}
/*
* @implemented
*/
BOOLEAN
NTAPI
HalBeginSystemInterrupt(IN KIRQL Irql,
IN UCHAR Vector,
OUT PKIRQL OldIrql)
{
UNIMPLEMENTED;
while (TRUE);
return FALSE;
}
/*
* @implemented
*/
VOID
NTAPI
HalEndSystemInterrupt(IN KIRQL OldIrql,
IN PKTRAP_FRAME TrapFrame)
{
UNIMPLEMENTED;
while (TRUE);
}
/* EOF */

View file

@ -0,0 +1,129 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/portio.c
* PURPOSE: I/O Functions for access to ports
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
#undef READ_PORT_UCHAR
#undef READ_PORT_USHORT
#undef READ_PORT_ULONG
#undef WRITE_PORT_UCHAR
#undef WRITE_PORT_USHORT
#undef WRITE_PORT_ULONG
/* FUNCTIONS ******************************************************************/
VOID
NTAPI
READ_PORT_BUFFER_UCHAR(IN PUCHAR Port,
OUT PUCHAR Buffer,
IN ULONG Count)
{
UNIMPLEMENTED;
while (TRUE);
}
VOID
NTAPI
READ_PORT_BUFFER_USHORT(IN PUSHORT Port,
OUT PUSHORT Buffer,
IN ULONG Count)
{
UNIMPLEMENTED;
while (TRUE);
}
VOID
NTAPI
READ_PORT_BUFFER_ULONG(IN PULONG Port,
OUT PULONG Buffer,
IN ULONG Count)
{
UNIMPLEMENTED;
while (TRUE);
}
UCHAR
NTAPI
READ_PORT_UCHAR(IN PUCHAR Port)
{
return READ_REGISTER_UCHAR(Port);
}
USHORT
NTAPI
READ_PORT_USHORT(IN PUSHORT Port)
{
return READ_REGISTER_USHORT(Port);
}
ULONG
NTAPI
READ_PORT_ULONG(IN PULONG Port)
{
return READ_REGISTER_ULONG(Port);
}
VOID
NTAPI
WRITE_PORT_BUFFER_UCHAR(IN PUCHAR Port,
IN PUCHAR Buffer,
IN ULONG Count)
{
UNIMPLEMENTED;
while (TRUE);
}
VOID
NTAPI
WRITE_PORT_BUFFER_USHORT(IN PUSHORT Port,
IN PUSHORT Buffer,
IN ULONG Count)
{
UNIMPLEMENTED;
while (TRUE);
}
VOID
NTAPI
WRITE_PORT_BUFFER_ULONG(IN PULONG Port,
IN PULONG Buffer,
IN ULONG Count)
{
UNIMPLEMENTED;
while (TRUE);
}
VOID
NTAPI
WRITE_PORT_UCHAR(IN PUCHAR Port,
IN UCHAR Value)
{
WRITE_REGISTER_UCHAR(Port, Value);
}
VOID
NTAPI
WRITE_PORT_USHORT(IN PUSHORT Port,
IN USHORT Value)
{
WRITE_REGISTER_USHORT(Port, Value);
}
VOID
NTAPI
WRITE_PORT_ULONG(IN PULONG Port,
IN ULONG Value)
{
WRITE_REGISTER_ULONG(Port, Value);
}
/* EOF */

View file

@ -0,0 +1,141 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/processor.c
* PURPOSE: HAL Processor Routines
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
LONG HalpActiveProcessors;
KAFFINITY HalpDefaultInterruptAffinity;
BOOLEAN HalpProcessorIdentified;
BOOLEAN HalpTestCleanSupported;
/* PRIVATE FUNCTIONS **********************************************************/
VOID
HalpIdentifyProcessor(VOID)
{
ARM_ID_CODE_REGISTER IdRegister;
/* Don't do it again */
HalpProcessorIdentified = TRUE;
// fixfix: Use Pcr->ProcessorId
/* Read the ID Code */
IdRegister = KeArmIdCodeRegisterGet();
/* Architecture "6" CPUs support test-and-clean (926EJ-S and 1026EJ-S) */
HalpTestCleanSupported = (IdRegister.Architecture == 6);
}
/* FUNCTIONS ******************************************************************/
/*
* @implemented
*/
VOID
NTAPI
HalInitializeProcessor(IN ULONG ProcessorNumber,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
/* Do nothing */
return;
}
/*
* @implemented
*/
BOOLEAN
NTAPI
HalAllProcessorsStarted(VOID)
{
/* Do nothing */
return TRUE;
}
/*
* @implemented
*/
BOOLEAN
NTAPI
HalStartNextProcessor(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PKPROCESSOR_STATE ProcessorState)
{
/* Ready to start */
return FALSE;
}
/*
* @implemented
*/
VOID
NTAPI
HalProcessorIdle(VOID)
{
/* Enable interrupts and halt the processor */
_enable();
UNIMPLEMENTED;
while (TRUE);
}
/*
* @implemented
*/
VOID
NTAPI
HalRequestIpi(KAFFINITY TargetProcessors)
{
/* Not implemented on UP */
UNIMPLEMENTED;
while (TRUE);
}
/*
* @implemented
*/
VOID
HalSweepDcache(VOID)
{
/*
* We get called very early on, before HalInitSystem or any of the Hal*
* processor routines, so we need to figure out what CPU we're on.
*/
if (!HalpProcessorIdentified) HalpIdentifyProcessor();
/*
* Check if we can do it the ARMv5TE-J way
*/
if (HalpTestCleanSupported)
{
/* Test, clean, flush D-Cache */
__asm__ __volatile__ ("1: mrc p15, 0, pc, c7, c14, 3; bne 1b");
}
else
{
/* We need to do it it by set/way. For now always call ARMv7 function */
//extern VOID v7_flush_dcache_all(VOID);
//v7_flush_dcache_all();
}
}
/*
* @implemented
*/
VOID
HalSweepIcache(VOID)
{
/* All ARM cores support the same Icache flush command */
KeArmFlushIcache();
}
/* EOF */

View file

@ -0,0 +1,50 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/profil.c
* PURPOSE: System Profiling
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ******************************************************************/
/*
* @unimplemented
*/
VOID
NTAPI
HalStopProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
{
UNIMPLEMENTED;
return;
}
/*
* @unimplemented
*/
VOID
NTAPI
HalStartProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
{
UNIMPLEMENTED;
return;
}
/*
* @unimplemented
*/
ULONG_PTR
NTAPI
HalSetProfileInterval(IN ULONG_PTR Interval)
{
UNIMPLEMENTED;
return Interval;
}
/* EOF */

View file

@ -0,0 +1,43 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/reboot.c
* PURPOSE: Reboot Function
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* PUBLIC FUNCTIONS **********************************************************/
/*
* @implemented
*/
VOID
NTAPI
HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
{
/* Check what kind of action this is */
switch (Action)
{
/* All recognized actions */
case HalHaltRoutine:
case HalRebootRoutine:
/* Acquire the display */
InbvAcquireDisplayOwnership();
/* Anything else */
default:
/* Print message and break */
DbgPrint("HalReturnToFirmware called!\n");
DbgBreakPoint();
}
}
/* EOF */

View file

@ -0,0 +1,79 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/rtc.c
* PURPOSE: Real Time Clock and Environment Variable Support
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ******************************************************************/
#define RTC_DATA (PVOID)0x101E8000
/*
* @implemented
*/
BOOLEAN
NTAPI
HalQueryRealTimeClock(IN PTIME_FIELDS Time)
{
LARGE_INTEGER LargeTime;
ULONG Seconds;
/* Query the RTC value */
Seconds = READ_REGISTER_ULONG(RTC_DATA);
/* Convert to time */
RtlSecondsSince1970ToTime(Seconds, &LargeTime);
/* Convert to time-fields */
RtlTimeToTimeFields(&LargeTime, Time);
return TRUE;
}
/*
* @unimplemented
*/
BOOLEAN
NTAPI
HalSetRealTimeClock(IN PTIME_FIELDS Time)
{
UNIMPLEMENTED;
while (TRUE);
return TRUE;
}
/*
* @unimplemented
*/
ARC_STATUS
NTAPI
HalSetEnvironmentVariable(IN PCH Name,
IN PCH Value)
{
UNIMPLEMENTED;
while (TRUE);
return ESUCCESS;
}
/*
* @unimplemented
*/
ARC_STATUS
NTAPI
HalGetEnvironmentVariable(IN PCH Name,
IN USHORT ValueLength,
IN PCH Value)
{
UNIMPLEMENTED;
while (TRUE);
return ENOENT;
}
/* EOF */

View file

@ -0,0 +1,202 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/spinlock.c
* PURPOSE: SpinLock Routines
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
#undef KeAcquireSpinLock
#undef KeReleaseSpinLock
#undef KeRaiseIrql
#undef KeLowerIrql
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
VOID
NTAPI
KeRaiseIrql(KIRQL NewIrql,
PKIRQL OldIrql)
{
/* Call the fastcall function */
*OldIrql = KfRaiseIrql(NewIrql);
}
/*
* @implemented
*/
VOID
NTAPI
KeLowerIrql(KIRQL NewIrql)
{
/* Call the fastcall function */
KfLowerIrql(NewIrql);
}
/*
* @implemented
*/
VOID
NTAPI
KeAcquireSpinLock(PKSPIN_LOCK SpinLock,
PKIRQL OldIrql)
{
/* Call the fastcall function */
*OldIrql = KfAcquireSpinLock(SpinLock);
}
/*
* @implemented
*/
KIRQL
FASTCALL
KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock)
{
/* Simply raise to dispatch */
return KfRaiseIrql(DISPATCH_LEVEL);
}
/*
* @implemented
*/
VOID
NTAPI
KeReleaseSpinLock(PKSPIN_LOCK SpinLock,
KIRQL NewIrql)
{
/* Call the fastcall function */
KfReleaseSpinLock(SpinLock, NewIrql);
}
/*
* @implemented
*/
KIRQL
FASTCALL
KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
{
/* Simply raise to dispatch */
return KfRaiseIrql(DISPATCH_LEVEL);
}
/*
* @implemented
*/
VOID
FASTCALL
KfReleaseSpinLock(PKSPIN_LOCK SpinLock,
KIRQL OldIrql)
{
/* Simply lower IRQL back */
KeLowerIrql(OldIrql);
}
/*
* @implemented
*/
KIRQL
FASTCALL
KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
{
/* Simply raise to dispatch */
return KfRaiseIrql(DISPATCH_LEVEL);
}
/*
* @implemented
*/
KIRQL
FASTCALL
KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
{
/* Simply raise to dispatch */
return KfRaiseIrql(DISPATCH_LEVEL);
}
/*
* @implemented
*/
VOID
FASTCALL
KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock,
IN PKLOCK_QUEUE_HANDLE LockHandle)
{
/* Simply raise to dispatch */
LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
}
/*
* @implemented
*/
VOID
FASTCALL
KeAcquireInStackQueuedSpinLockRaiseToSynch(IN PKSPIN_LOCK SpinLock,
IN PKLOCK_QUEUE_HANDLE LockHandle)
{
/* Simply raise to dispatch */
LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
}
/*
* @implemented
*/
VOID
FASTCALL
KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
IN KIRQL OldIrql)
{
/* Simply lower IRQL back */
KfLowerIrql(OldIrql);
}
/*
* @implemented
*/
VOID
FASTCALL
KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
{
/* Simply lower IRQL back */
KfLowerIrql(LockHandle->OldIrql);
}
/*
* @implemented
*/
BOOLEAN
FASTCALL
KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
IN PKIRQL OldIrql)
{
/* Simply raise to synch */
KeRaiseIrql(SYNCH_LEVEL, OldIrql);
/* Always return true on UP Machines */
return TRUE;
}
/*
* @implemented
*/
LOGICAL
FASTCALL
KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
OUT PKIRQL OldIrql)
{
/* Simply raise to dispatch */
KeRaiseIrql(DISPATCH_LEVEL, OldIrql);
/* Always return true on UP Machines */
return TRUE;
}
/* EOF */

View file

@ -0,0 +1,40 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/spinlock.c
* PURPOSE: HAL Information Routines
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ******************************************************************/
NTSTATUS
NTAPI
HaliQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass,
IN ULONG BufferSize,
IN OUT PVOID Buffer,
OUT PULONG ReturnedLength)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
HaliSetSystemInformation(IN HAL_SET_INFORMATION_CLASS InformationClass,
IN ULONG BufferSize,
IN OUT PVOID Buffer)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1,149 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/timer.c
* PURPOSE: Timer Routines
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
VOID
FASTCALL
KeUpdateSystemTime(
IN PKTRAP_FRAME TrapFrame,
IN ULONG Increment,
IN KIRQL OldIrql
);
/* GLOBALS ********************************************************************/
ULONG HalpCurrentTimeIncrement, HalpNextTimeIncrement, HalpNextIntervalCount;
/* PRIVATE FUNCTIONS **********************************************************/
VOID
HalpClockInterrupt(VOID)
{
/* Clear the interrupt */
ASSERT(KeGetCurrentIrql() == CLOCK2_LEVEL);
WRITE_REGISTER_ULONG(TIMER0_INT_CLEAR, 1);
/* FIXME: Update HAL Perf counters */
/* FIXME: Check if someone changed the clockrate */
/* Call the kernel */
KeUpdateSystemTime(KeGetCurrentThread()->TrapFrame,
HalpCurrentTimeIncrement,
CLOCK2_LEVEL);
}
VOID
HalpStallInterrupt(VOID)
{
/* Clear the interrupt */
WRITE_REGISTER_ULONG(TIMER0_INT_CLEAR, 1);
}
VOID
HalpInitializeClock(VOID)
{
PKIPCR Pcr = (PKIPCR)KeGetPcr();
ULONG ClockInterval;
SP804_CONTROL_REGISTER ControlRegister;
/* Setup the clock and profile interrupt */
Pcr->InterruptRoutine[CLOCK2_LEVEL] = HalpStallInterrupt;
/*
* Configure the interval to 10ms
* (INTERVAL (10ms) * TIMCLKfreq (1MHz))
* --------------------------------------- == 10^4
* (TIMCLKENXdiv (1) * PRESCALEdiv (1))
*/
ClockInterval = 0x2710;
/* Configure the timer */
ControlRegister.AsUlong = 0;
ControlRegister.Wide = TRUE;
ControlRegister.Periodic = TRUE;
ControlRegister.Interrupt = TRUE;
ControlRegister.Enabled = TRUE;
/* Enable the timer */
WRITE_REGISTER_ULONG(TIMER0_LOAD, ClockInterval);
WRITE_REGISTER_ULONG(TIMER0_CONTROL, ControlRegister.AsUlong);
}
/* PUBLIC FUNCTIONS ***********************************************************/
/*
* @implemented
*/
VOID
NTAPI
HalCalibratePerformanceCounter(IN volatile PLONG Count,
IN ULONGLONG NewCount)
{
UNIMPLEMENTED;
while (TRUE);
}
/*
* @implemented
*/
ULONG
NTAPI
HalSetTimeIncrement(IN ULONG Increment)
{
UNIMPLEMENTED;
while (TRUE);
return Increment;
}
/*
* @implemented
*/
VOID
NTAPI
KeStallExecutionProcessor(IN ULONG Microseconds)
{
SP804_CONTROL_REGISTER ControlRegister;
/* Enable the timer */
WRITE_REGISTER_ULONG(TIMER1_LOAD, Microseconds);
/* Configure the timer */
ControlRegister.AsUlong = 0;
ControlRegister.OneShot = TRUE;
ControlRegister.Wide = TRUE;
ControlRegister.Periodic = TRUE;
ControlRegister.Enabled = TRUE;
WRITE_REGISTER_ULONG(TIMER1_CONTROL, ControlRegister.AsUlong);
/* Now we will loop until the timer reached 0 */
while (READ_REGISTER_ULONG(TIMER1_VALUE));
}
/*
* @implemented
*/
LARGE_INTEGER
NTAPI
KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
{
LARGE_INTEGER Value;
UNIMPLEMENTED;
while (TRUE);
Value.QuadPart = 0;
return Value;
}
/* EOF */

View file

@ -0,0 +1,76 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/generic/usage.c
* PURPOSE: Resource Usage Management Routines
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
PUCHAR KdComPortInUse;
IDTUsageFlags HalpIDTUsageFlags[256];
IDTUsage HalpIDTUsage[256];
/* PRIVATE FUNCTIONS **********************************************************/
VOID
NTAPI
HalpReportResourceUsage(IN PUNICODE_STRING HalName,
IN INTERFACE_TYPE InterfaceType)
{
DbgPrint("%wZ has been initialized\n", HalName);
}
VOID
NTAPI
HalpRegisterVector(IN UCHAR Flags,
IN ULONG BusVector,
IN ULONG SystemVector,
IN KIRQL Irql)
{
/* Save the vector flags */
HalpIDTUsageFlags[SystemVector].Flags = Flags;
/* Save the vector data */
HalpIDTUsage[SystemVector].Irql = Irql;
HalpIDTUsage[SystemVector].BusReleativeVector = BusVector;
}
VOID
NTAPI
HalpEnableInterruptHandler(IN UCHAR Flags,
IN ULONG BusVector,
IN ULONG SystemVector,
IN KIRQL Irql,
IN PVOID Handler,
IN KINTERRUPT_MODE Mode)
{
/* Register the routine */
((PKIPCR)KeGetPcr())->InterruptRoutine[Irql] = Handler;
}
/* PUBLIC FUNCTIONS ***********************************************************/
/*
* @unimplemented
*/
VOID
NTAPI
HalReportResourceUsage(VOID)
{
UNICODE_STRING HalString;
/* Build HAL usage */
RtlInitUnicodeString(&HalString, L"ARM Versatile HAL");
HalpReportResourceUsage(&HalString, Internal);
}
/* EOF */

View file

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../tools/rbuild/project.dtd">
<group xmlns:xi="http://www.w3.org/2001/XInclude">
<module name="hal" type="kernelmodedll" entrypoint="HalInitSystem@8" installbase="system32" installname="hal.dll">
<importlibrary base="hal" definition="../hal.pspec" />
<bootstrap installbase="$(CDOUTPUT)" />
<include>include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHAL_" />
<library>hal_generic</library>
<library>ntoskrnl</library>
<directory name="versa">
<file>halinit_up.c</file>
<file>halup.rc</file>
</directory>
</module>
</group>

View file

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="hal_generic" type="objectlibrary">
<include>include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHAL_" />
<directory name="generic">
<file>beep.c</file>
<file>bus.c</file>
<file>cache.S</file>
<file>dma.c</file>
<file>drive.c</file>
<file>display.c</file>
<file>fmutex.c</file>
<file>halinit.c</file>
<file>misc.c</file>
<file>pic.c</file>
<file>portio.c</file>
<file>processor.c</file>
<file>profil.c</file>
<file>reboot.c</file>
<file>rtc.c</file>
<file>spinlock.c</file>
<file>sysinfo.c</file>
<file>timer.c</file>
<file>usage.c</file>
</directory>
<directory name="include">
<pch>hal.h</pch>
</directory>
</module>
</group>

View file

@ -9,6 +9,7 @@
/* INCLUDES ******************************************************************/
/* C Headers */
#define DbgPrint DbgPrintEarly
#include <stdio.h>
/* WDK HAL Compilation hack */
@ -22,6 +23,7 @@
/* IFS/DDK/NDK Headers */
#include <ntifs.h>
#include <ioaccess.h>
#include <bugcodes.h>
#include <ntdddisk.h>
#include <arc/arc.h>
@ -29,6 +31,7 @@
#include <kefuncs.h>
#include <intrin.h>
#include <halfuncs.h>
#include <inbvfuncs.h>
#include <iofuncs.h>
#include <ldrtypes.h>
#include <obfuncs.h>

View file

@ -14,4 +14,49 @@
#include <peripherals/pl190.h>
#include <peripherals/sp804.h>
#define PRIMARY_VECTOR_BASE 0x00
/* Usage flags */
#define IDT_REGISTERED 0x01
#define IDT_LATCHED 0x02
#define IDT_INTERNAL 0x11
#define IDT_DEVICE 0x21
typedef struct _IDTUsageFlags
{
UCHAR Flags;
} IDTUsageFlags;
typedef struct
{
KIRQL Irql;
UCHAR BusReleativeVector;
} IDTUsage;
VOID
NTAPI
HalpRegisterVector(IN UCHAR Flags,
IN ULONG BusVector,
IN ULONG SystemVector,
IN KIRQL Irql);
VOID
NTAPI
HalpEnableInterruptHandler(IN UCHAR Flags,
IN ULONG BusVector,
IN ULONG SystemVector,
IN KIRQL Irql,
IN PVOID Handler,
IN KINTERRUPT_MODE Mode);
VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
VOID HalpInitPhase1(VOID);
VOID HalpInitializeInterrupts(VOID);
VOID HalpInitializeClock(VOID);
VOID HalpClockInterrupt(VOID);
VOID HalpProfileInterrupt(VOID);
extern ULONG HalpCurrentTimeIncrement, HalpNextTimeIncrement, HalpNextIntervalCount;
#endif /* __INTERNAL_HAL_HAL_H */

View file

@ -1,32 +0,0 @@
/* $Id: halinit_up.c 24964 2006-11-29 08:28:20Z ion $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/hal/x86/halinit.c
* PURPOSE: Initalize the x86 hal
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* 11/06/98: Created
*/
/* INCLUDES *****************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ***************************************************************/
VOID
HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
}
VOID
HalpInitPhase1(VOID)
{
}
/* EOF */

View file

@ -0,0 +1,31 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halarm/versa/halinit_up.c
* PURPOSE: Versatile Board-Specific HAL Initialization
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
/* PRIVATE FUNCTIONS **********************************************************/
VOID
HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
}
VOID
HalpInitPhase1(VOID)
{
}
/* EOF */

View file

@ -1,13 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="hal" type="kernelmodedll" entrypoint="HalInitSystem" installbase="system32" installname="hal.dll">
<importlibrary base="hal" definition="../../hal.pspec" />
<importlibrary base="hal" definition="../hal.pspec" />
<bootstrap installbase="$(CDOUTPUT)" nameoncd="hal.dll" />
<include base="halarm_generic">../include</include>
<include base="hal">include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHAL_" />
<library>halarm_generic</library>
<library>hal_generic</library>
<library>ntoskrnl</library>
<file>halinit_up.c</file>
<file>halup.rc</file>
<library>kdcom</library>
<directory name="versa">
<file>halinit_up.c</file>
<file>halup.rc</file>
</directory>
</module>