Author: arty
Date: Mon Jan 15 13:00:47 2007
New Revision: 25464
URL:
http://svn.reactos.org/svn/reactos?rev=25464&view=rev
Log:
Corresponding checkpoint for HAL.
Some hacks are still in here.
Not much is implemented yet.
Just getting the basics going.
Modified:
branches/powerpc/reactos/hal/hal.rbuild
branches/powerpc/reactos/hal/halppc/generic/bus.c
branches/powerpc/reactos/hal/halppc/generic/display.c
branches/powerpc/reactos/hal/halppc/generic/halinit.c
branches/powerpc/reactos/hal/halppc/generic/irql.c
branches/powerpc/reactos/hal/halppc/generic/processor.c
branches/powerpc/reactos/hal/halppc/generic/timer.c
branches/powerpc/reactos/hal/halppc/up/halup.rbuild
Modified: branches/powerpc/reactos/hal/hal.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/hal.rbuild?…
==============================================================================
--- branches/powerpc/reactos/hal/hal.rbuild (original)
+++ branches/powerpc/reactos/hal/hal.rbuild Mon Jan 15 13:00:47 2007
@@ -5,4 +5,7 @@
<directory name="halx86">
<xi:include href="halx86/directory.rbuild" />
</directory>
+<directory name="halppc">
+ <xi:include href="halppc/directory.rbuild" />
+</directory>
</group>
Modified: branches/powerpc/reactos/hal/halppc/generic/bus.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/halppc/gene…
==============================================================================
--- branches/powerpc/reactos/hal/halppc/generic/bus.c (original)
+++ branches/powerpc/reactos/hal/halppc/generic/bus.c Mon Jan 15 13:00:47 2007
@@ -138,9 +138,9 @@
InitializeListHead(&HalpBusHandlerList);
/* Initialize hal dispatch tables */
+#if 0
HalQuerySystemInformation = HalpQuerySystemInformation;
-#if 0
HalSetSystemInformation = HalpSetSystemInformation;
HalQueryBusSlots = HalpQueryBusSlots;
Modified: branches/powerpc/reactos/hal/halppc/generic/display.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/halppc/gene…
==============================================================================
--- branches/powerpc/reactos/hal/halppc/generic/display.c (original)
+++ branches/powerpc/reactos/hal/halppc/generic/display.c Mon Jan 15 13:00:47 2007
@@ -123,10 +123,11 @@
#include <hal.h>
#include <ppcboot.h>
+#include <ppcdebug.h>
+
#define NDEBUG
#include <debug.h>
-#include "font.h"
boot_infos_t PpcEarlybootInfo;
BOOLEAN PPCGetEEBit();
@@ -146,6 +147,7 @@
extern UCHAR XboxFont8x16[];
extern void SetPhys( ULONG Addr, ULONG Data );
+extern ULONG GetPhys( ULONG Addr );
extern void SetPhysByte( ULONG Addr, ULONG Data );
/* PRIVATE FUNCTIONS *********************************************************/
@@ -155,7 +157,7 @@
{
ULONG i;
ULONG deviceSize =
- PpcEarlybootInfo.dispDeviceRowBytes * PpcEarlybootInfo.dispDeviceDepth *
+ PpcEarlybootInfo.dispDeviceRowBytes *
PpcEarlybootInfo.dispDeviceRect[3];
for(i = 0; i < deviceSize; i += sizeof(int) )
SetPhys(GraphVideoBuffer + i, CharAttribute);
@@ -170,34 +172,43 @@
VOID STATIC
HalScrollDisplay (VOID)
{
- PULONG Dest = (PULONG)GraphVideoBuffer,
- Src = (PULONG)(GraphVideoBuffer + (16 * PpcEarlybootInfo.dispDeviceRowBytes));
- PULONG End = (PULONG)
+ ULONG i, deviceSize =
+ PpcEarlybootInfo.dispDeviceRowBytes *
+ PpcEarlybootInfo.dispDeviceRect[3];
+ ULONG Dest = (ULONG)GraphVideoBuffer,
+ Src = (ULONG)(GraphVideoBuffer + (16 * PpcEarlybootInfo.dispDeviceRowBytes));
+ ULONG End = (ULONG)
GraphVideoBuffer +
- (PpcEarlybootInfo.dispDeviceRowBytes * PpcEarlybootInfo.dispDeviceDepth *
- PpcEarlybootInfo.dispDeviceRect[3]);
+ (PpcEarlybootInfo.dispDeviceRowBytes *
+ (PpcEarlybootInfo.dispDeviceRect[3]-16));
- for( ; Src < End; Src += sizeof(int) )
+ while( Src < End )
{
- *Dest++ = *Src++;
- }
+ SetPhys((ULONG)Dest, GetPhys(Src));
+ Src += 4; Dest += 4;
+ }
+
+ /* Clear the bottom row */
+ for(i = End; i < deviceSize; i += sizeof(int) )
+ SetPhys(GraphVideoBuffer + i, 1);
}
VOID STATIC FASTCALL
HalPutCharacter (CHAR Character)
{
int i,j,k;
- PCHAR Dest = (PCHAR)
+ ULONG Dest =
(GraphVideoBuffer +
(16 * PpcEarlybootInfo.dispDeviceRowBytes * CursorY) +
- ((PpcEarlybootInfo.dispDeviceDepth / 8) * CursorX));
+ (8 * (PpcEarlybootInfo.dispDeviceDepth / 8) * CursorX)), RowDest;
+ UCHAR ByteToPlace;
for( i = 0; i < 16; i++ ) {
+ RowDest = Dest;
for( j = 0; j < 8; j++ ) {
- for( k = 0; k < PpcEarlybootInfo.dispDeviceDepth / 8; k++ ) {
- SetPhysByte
- ((ULONG)(Dest + (j * PpcEarlybootInfo.dispDeviceDepth) + k),
- ((1 << j) & (XboxFont8x16[(16 * Character) + i]) ? 0xff : 1));
+ ByteToPlace = ((128 >> j) & (XboxFont8x16[(16 * Character) + i])) ? 0xff :
1;
+ for( k = 0; k < PpcEarlybootInfo.dispDeviceDepth / 8; k++, RowDest++ ) {
+ SetPhysByte(RowDest, ByteToPlace);
}
}
Dest += PpcEarlybootInfo.dispDeviceRowBytes;
@@ -214,15 +225,7 @@
* InitParameters = Parameters setup by the boot loader
*/
{
- __asm__("mr 20, %0\n\t"
- "mr 21, %0\n\t"
- "nop" :
- :
- "r" (DisplayInitialized),
- "r" (&GraphVideoBuffer) :
- "r20", "r21");
-
- if (! DisplayInitialized)
+ if (! DisplayInitialized)
{
boot_infos_t *XBootInfo = (boot_infos_t *)LoaderBlock->ArchExtra;
GraphVideoBuffer = (ULONG)XBootInfo->dispDeviceBase;
@@ -231,6 +234,9 @@
/* Set cursor position */
CursorX = 0;
CursorY = 0;
+
+ SizeX = XBootInfo->dispDeviceRowBytes / XBootInfo->dispDeviceDepth;
+ SizeY = XBootInfo->dispDeviceRect[3] / 16;
HalClearDisplay(1);
@@ -283,7 +289,7 @@
*/
{
PCH pch;
- static KSPIN_LOCK Lock;
+ //static KSPIN_LOCK Lock;
KIRQL OldIrql;
BOOLEAN InterruptsEnabled = PPCGetEEBit();
@@ -296,7 +302,7 @@
pch = String;
OldIrql = KfRaiseIrql(HIGH_LEVEL);
- KiAcquireSpinLock(&Lock);
+ //KiAcquireSpinLock(&Lock);
_disable();
@@ -331,14 +337,14 @@
HalScrollDisplay ();
CursorY = SizeY - 1;
}
-
+
pch++;
}
-
+
if(InterruptsEnabled)
_enable();
- KiReleaseSpinLock(&Lock);
+ //KiReleaseSpinLock(&Lock);
KfLowerIrql(OldIrql);
}
Modified: branches/powerpc/reactos/hal/halppc/generic/halinit.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/halppc/gene…
==============================================================================
--- branches/powerpc/reactos/hal/halppc/generic/halinit.c (original)
+++ branches/powerpc/reactos/hal/halppc/generic/halinit.c Mon Jan 15 13:00:47 2007
@@ -37,6 +37,7 @@
{
if (BootPhase == 0)
{
+ HalInitializeDisplay
((PROS_LOADER_PARAMETER_BLOCK)(LoaderBlock->u.PowerPC.BootInfo));
RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
HalpInitPhase0((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
}
@@ -46,7 +47,6 @@
//HalpInitPhase1();
/* Initialize display and make the screen black */
- HalInitializeDisplay ((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
HalpInitBusHandlers();
HalpInitDma();
Modified: branches/powerpc/reactos/hal/halppc/generic/irql.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/halppc/gene…
==============================================================================
--- branches/powerpc/reactos/hal/halppc/generic/irql.c (original)
+++ branches/powerpc/reactos/hal/halppc/generic/irql.c Mon Jan 15 13:00:47 2007
@@ -57,6 +57,7 @@
VOID STDCALL
KiInterruptDispatch2 (ULONG Irq, KIRQL old_level);
+BOOLEAN PPCGetEEBit();
/* FUNCTIONS ****************************************************************/
@@ -73,26 +74,7 @@
VOID NTAPI HalpInitPICs(VOID)
{
memset(HalpPendingInterruptCount, 0, sizeof(HalpPendingInterruptCount));
-
- /* Initialization sequence */
- WRITE_PORT_UCHAR((PUCHAR)0x20, 0x11);
- WRITE_PORT_UCHAR((PUCHAR)0xa0, 0x11);
- /* Start of hardware irqs (0x24) */
- WRITE_PORT_UCHAR((PUCHAR)0x21, IRQ_BASE);
- WRITE_PORT_UCHAR((PUCHAR)0xa1, IRQ_BASE + 8);
- /* 8259-1 is master */
- WRITE_PORT_UCHAR((PUCHAR)0x21, 0x4);
- /* 8259-2 is slave */
- WRITE_PORT_UCHAR((PUCHAR)0xa1, 0x2);
- /* 8086 mode */
- WRITE_PORT_UCHAR((PUCHAR)0x21, 0x1);
- WRITE_PORT_UCHAR((PUCHAR)0xa1, 0x1);
- /* Enable interrupts */
- WRITE_PORT_UCHAR((PUCHAR)0x21, pic_mask.master);
- WRITE_PORT_UCHAR((PUCHAR)0xa1, pic_mask.slave);
-
- /* We can now enable interrupts */
- Ki386EnableInterrupts();
+ _enable();
}
VOID HalpEndSystemInterrupt(KIRQL Irql)
@@ -100,7 +82,7 @@
* FUNCTION: Enable all irqs with higher priority.
*/
{
- ULONG flags;
+ BOOLEAN InterruptsEnabled = PPCGetEEBit();
const USHORT mask[] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -110,15 +92,15 @@
};
/* Interrupts should be disable while enabling irqs of both pics */
- Ki386SaveFlags(flags);
- Ki386DisableInterrupts();
+ _disable();
pic_mask_intr.both &= mask[Irql];
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)(pic_mask.master|pic_mask_intr.master));
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)(pic_mask.slave|pic_mask_intr.slave));
/* restore flags */
- Ki386RestoreFlags(flags);
+ if(InterruptsEnabled)
+ _enable();
}
VOID STATIC
Modified: branches/powerpc/reactos/hal/halppc/generic/processor.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/halppc/gene…
==============================================================================
--- branches/powerpc/reactos/hal/halppc/generic/processor.c (original)
+++ branches/powerpc/reactos/hal/halppc/generic/processor.c Mon Jan 15 13:00:47 2007
@@ -20,13 +20,15 @@
/* FUNCTIONS *****************************************************************/
+#define INITIAL_STALL_COUNT 0x10000
+
VOID STDCALL
HalInitializeProcessor(ULONG ProcessorNumber,
PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- DPRINT("HalInitializeProcessor(%lu %p)\n", ProcessorNumber, LoaderBlock);
- /* Set default IDR */
- KeGetPcr()->IDR = 0xFFFFFFFB;
+ DPRINT("HalInitializeProcessor(%lu %p)\n", ProcessorNumber, LoaderBlock);
+ /* Do this a bit earlier for the purpose of getting gossip from the kernel */
+ HalInitializeDisplay
((PROS_LOADER_PARAMETER_BLOCK)(LoaderBlock->u.PowerPC.BootInfo));
KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
}
Modified: branches/powerpc/reactos/hal/halppc/generic/timer.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/halppc/gene…
==============================================================================
--- branches/powerpc/reactos/hal/halppc/generic/timer.c (original)
+++ branches/powerpc/reactos/hal/halppc/generic/timer.c Mon Jan 15 13:00:47 2007
@@ -79,7 +79,7 @@
/* FUNCTIONS **************************************************************/
-static BOOLEAN PPCGetEEBit()
+BOOLEAN PPCGetEEBit()
{
ULONG Msr;
__asm__("mfmsr %0" : "=r" (Msr));
Modified: branches/powerpc/reactos/hal/halppc/up/halup.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/halppc/up/h…
==============================================================================
--- branches/powerpc/reactos/hal/halppc/up/halup.rbuild (original)
+++ branches/powerpc/reactos/hal/halppc/up/halup.rbuild Mon Jan 15 13:00:47 2007
@@ -7,6 +7,8 @@
<define name="__USE_W32API" />
<define name="_NTHAL_" />
<library>halppc_generic</library>
+ <library>string</library>
+ <library>ntoskrnl</library>
<file>halinit_up.c</file>
<file>halup.rc</file>
</module>