mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Added new display and reboot code.
svn path=/trunk/; revision=691
This commit is contained in:
parent
8578ba8ac6
commit
1d4d689bf2
6 changed files with 236 additions and 32 deletions
|
@ -12,6 +12,11 @@
|
|||
#ifndef __INCLUDE_INTERNAL_HAL_DDK_H
|
||||
#define __INCLUDE_INTERNAL_HAL_DDK_H
|
||||
|
||||
/* HalReturnToFirmware */
|
||||
#define FIRMWARE_HALT 1
|
||||
#define FIRMWARE_REBOOT 3
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
DEVICE_DESCRIPTION_VERSION,
|
||||
|
@ -54,6 +59,9 @@ typedef struct _DEVICE_DESCRIPTION
|
|||
ULONG DmaPort;
|
||||
} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
|
||||
|
||||
typedef BOOLEAN STDCALL (*RESET_DISPLAY_ROUTINE)(ULONG SizeX, ULONG SizeY);
|
||||
|
||||
VOID HalAcquireDisplayOwnership(RESET_DISPLAY_ROUTINE ResetRoutine);
|
||||
PVOID HalAllocateCommonBuffer(PADAPTER_OBJECT AdapterObject,
|
||||
ULONG Length,
|
||||
PPHYSICAL_ADDRESS LogicalAddress,
|
||||
|
@ -95,8 +103,15 @@ ULONG HalGetInterruptVector(INTERFACE_TYPE InterfaceType,
|
|||
ULONG BusInterruptVector,
|
||||
PKIRQL Irql,
|
||||
PKAFFINITY Affinity);
|
||||
BOOLEAN HalMakeBeep(ULONG Frequency);
|
||||
VOID HalQueryDisplayParameters(PULONG DispSizeX,
|
||||
PULONG DispSizeY,
|
||||
PULONG CursorPosX,
|
||||
PULONG CursorPosY);
|
||||
VOID HalQueryRealTimeClock(PTIME_FIELDS pTime);
|
||||
VOID HalQuerySystemInformation(VOID);
|
||||
ULONG HalReadDmaCounter(PADAPTER_OBJECT AdapterObject);
|
||||
VOID HalReturnToFirmware(ULONG Action);
|
||||
ULONG HalSetBusData(BUS_DATA_TYPE BusDataType,
|
||||
ULONG BusNumber,
|
||||
ULONG SlotNumber,
|
||||
|
@ -108,12 +123,12 @@ ULONG HalSetBusDataByOffset(BUS_DATA_TYPE BusDataType,
|
|||
PVOID Buffer,
|
||||
ULONG Offset,
|
||||
ULONG Length);
|
||||
VOID HalSetDisplayParameters(ULONG CursorPosX,
|
||||
ULONG CursorPosY);
|
||||
BOOLEAN HalTranslateBusAddress(INTERFACE_TYPE InterfaceType,
|
||||
ULONG BusNumber,
|
||||
PHYSICAL_ADDRESS BusAddress,
|
||||
PULONG AddressSpace,
|
||||
PPHYSICAL_ADDRESS TranslatedAddress);
|
||||
BOOLEAN HalMakeBeep(ULONG Frequency);
|
||||
VOID HalQueryRealTimeClock(PTIME_FIELDS pTime);
|
||||
|
||||
#endif /* __INCLUDE_INTERNAL_HAL_DDK_H */
|
||||
|
|
|
@ -68,4 +68,10 @@ VOID Hal_bios32_probe(VOID);
|
|||
BOOLEAN Hal_bios32_is_service_present(ULONG service);
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Initializes the text mode display (blue screen)
|
||||
*/
|
||||
VOID HalInitializeDisplay (VOID);
|
||||
|
||||
|
||||
#endif /* __INTERNAL_HAL_HAL_H */
|
||||
|
|
|
@ -24,38 +24,41 @@ NTSTATUS STDCALL NtSetSystemPowerState(VOID)
|
|||
}
|
||||
|
||||
|
||||
static void kb_wait(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<10000; i++)
|
||||
{
|
||||
if ((inb_p(0x64) & 0x02) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtShutdownSystem (
|
||||
IN SHUTDOWN_ACTION Action
|
||||
IN SHUTDOWN_ACTION Action
|
||||
)
|
||||
/*
|
||||
* FIXME: Does a reboot only
|
||||
*/
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (i=0; i<100; i++)
|
||||
{
|
||||
kb_wait();
|
||||
for (j=0; j<500; j++);
|
||||
outb(0xfe, 0x64);
|
||||
for (j=0; j<500; j++);
|
||||
}
|
||||
}
|
||||
if (Action > ShutdownPowerOff)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
/* FIXME: notify all registered drivers (MJ_SHUTDOWN) */
|
||||
|
||||
/* FIXME: notify configuration manager (Registry) */
|
||||
|
||||
/* FIXME: notify memory manager */
|
||||
|
||||
/* FIXME: notify all file system drivers (MJ_SHUTDOWN) */
|
||||
|
||||
if (Action == ShutdownNoReboot)
|
||||
{
|
||||
#if 0
|
||||
/* Switch off */
|
||||
HalReturnToFirmware (FIRMWARE_OFF);
|
||||
#endif
|
||||
}
|
||||
else if (Action == ShutdownReboot)
|
||||
{
|
||||
HalReturnToFirmware (FIRMWARE_REBOOT);
|
||||
}
|
||||
else
|
||||
{
|
||||
HalReturnToFirmware (FIRMWARE_HALT);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
|
|
110
reactos/ntoskrnl/hal/x86/display.c
Normal file
110
reactos/ntoskrnl/hal/x86/display.c
Normal file
|
@ -0,0 +1,110 @@
|
|||
/* $Id: display.c,v 1.1 1999/10/11 20:50:32 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/hal/x86/display.c
|
||||
* PURPOSE: Text mode display functions (blue screen)
|
||||
* PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
||||
* UPDATE HISTORY:
|
||||
* Created 08/10/99
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/hal.h>
|
||||
|
||||
|
||||
/* VARIABLES ****************************************************************/
|
||||
|
||||
static ULONG CursorX = 0; /* Cursor Position */
|
||||
static ULONG CursorY = 0;
|
||||
static ULONG SizeX = 80; /* Display size */
|
||||
static ULONG SizeY = 50;
|
||||
|
||||
static BOOLEAN DisplayInitialized = FALSE;
|
||||
static BOOLEAN HalOwnsDisplay = TRUE;
|
||||
|
||||
static BYTE *VideoBuffer = NULL;
|
||||
|
||||
static RESET_DISPLAY_ROUTINE ResetRoutine = NULL;
|
||||
|
||||
|
||||
/* STATIC FUNCTIONS *********************************************************/
|
||||
|
||||
static VOID
|
||||
HalClearDisplay (VOID)
|
||||
{
|
||||
WORD *ptr = (WORD*)VideoBuffer;
|
||||
ULONG i;
|
||||
|
||||
for (i=0; i < SizeX*SizeY; i++, ptr++)
|
||||
*ptr = 0x1720;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* PRIVATE FUNCTIONS ********************************************************/
|
||||
|
||||
VOID
|
||||
HalInitializeDisplay (VOID)
|
||||
{
|
||||
if (DisplayInitialized == FALSE)
|
||||
{
|
||||
DisplayInitialized = TRUE;
|
||||
|
||||
VideoBuffer = (BYTE *)(0xd0000000 + 0xb8000);
|
||||
// VideoBuffer = HalMapPhysicalMemory (0xb8000, 2);
|
||||
|
||||
HalClearDisplay ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* PUBLIC FUNCTIONS *********************************************************/
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
HalAcquireDisplayOwnership (RESET_DISPLAY_ROUTINE ResetDisplay)
|
||||
{
|
||||
HalOwnsDisplay = FALSE;
|
||||
ResetRoutine = ResetDisplay;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
HalDisplayString (VOID)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
HalQueryDisplayParameters (PULONG DispSizeX,
|
||||
PULONG DispSizeY,
|
||||
PULONG CursorPosX,
|
||||
PULONG CursorPosY)
|
||||
{
|
||||
if (DispSizeX)
|
||||
*DispSizeX = SizeX;
|
||||
if (DispSizeY)
|
||||
*DispSizeY = SizeY;
|
||||
if (CursorPosX)
|
||||
*CursorPosX = CursorX;
|
||||
if (CursorPosY)
|
||||
*CursorPosY = CursorY;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
HalSetDisplayParameters (ULONG CursorPosX,
|
||||
ULONG CursorPosY)
|
||||
{
|
||||
CursorX = (CursorPosX < SizeX) ? CursorPosX : SizeX - 1;
|
||||
CursorY = (CursorPosY < SizeY) ? CursorPosY : SizeY - 1;
|
||||
}
|
||||
|
||||
/* EOF */
|
69
reactos/ntoskrnl/hal/x86/reboot.c
Normal file
69
reactos/ntoskrnl/hal/x86/reboot.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* $Id: reboot.c,v 1.1 1999/10/11 20:50:33 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/hal/x86/reboot.c
|
||||
* PURPOSE: Reboot functions.
|
||||
* PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
||||
* UPDATE HISTORY:
|
||||
* Created 11/10/99
|
||||
*/
|
||||
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/hal.h>
|
||||
#include <internal/i386/io.h>
|
||||
|
||||
|
||||
static VOID
|
||||
HalReboot (VOID)
|
||||
{
|
||||
char data;
|
||||
BYTE *mem;
|
||||
|
||||
/* enable warm reboot */
|
||||
mem = (BYTE *)(0xd0000000 + 0x0000);
|
||||
// mem = HalMapPhysicalMemory (0, 1);
|
||||
mem[0x472] = 0x34;
|
||||
mem[0x473] = 0x12;
|
||||
|
||||
/* disable interrupts */
|
||||
__asm__("cli\n");
|
||||
|
||||
/* disable periodic interrupt (RTC) */
|
||||
outb_p (0x70, 0x0b);
|
||||
data = inb_p (0x71);
|
||||
outb_p (0x71, data & 0xbf);
|
||||
|
||||
/* */
|
||||
outb_p (0x70, 0x0a);
|
||||
data = inb_p (0x71);
|
||||
outb_p (0x71, (data & 0xf0) | 0x06);
|
||||
|
||||
/* */
|
||||
outb_p (0x70, 0x15);
|
||||
|
||||
/* generate RESET signal via keyboard controller */
|
||||
outb_p (0x64, 0xfe);
|
||||
|
||||
/* stop the processor */
|
||||
__asm__("hlt\n");
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
HalReturnToFirmware (ULONG Action)
|
||||
{
|
||||
if (Action == FIRMWARE_HALT)
|
||||
{
|
||||
DbgPrint ("HalReturnToFirmware called!\n");
|
||||
DbgBreakPoint ();
|
||||
}
|
||||
else if (Action == FIRMWARE_REBOOT)
|
||||
{
|
||||
// HalVideoReboot();
|
||||
HalReboot ();
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -2,5 +2,6 @@ HAL_OBJECTS = hal/x86/head.o hal/x86/irq.o hal/x86/exp.o hal/x86/isa.o \
|
|||
hal/x86/pci.o hal/x86/irqhand.o hal/x86/page.o hal/x86/halinit.o \
|
||||
hal/x86/irql.o hal/x86/bios32.o hal/x86/thread.o hal/x86/spinlock.o \
|
||||
hal/x86/printk.o hal/x86/mp.o hal/x86/dma.o hal/x86/bus.o hal/x86/mbr.o \
|
||||
hal/x86/sysinfo.o hal/x86/time.o hal/x86/usercall.o hal/x86/beep.o
|
||||
hal/x86/sysinfo.o hal/x86/time.o hal/x86/usercall.o hal/x86/beep.o \
|
||||
hal/x86/display.o hal/x86/reboot.o
|
||||
|
||||
|
|
Loading…
Reference in a new issue