mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
[HAL][MINIHAL] Minor cleanup in reboot.c files (#5359)
And remove pic/processor.c from minihal compilation.
This commit is contained in:
parent
50d78f04e3
commit
9ba1849a97
6 changed files with 71 additions and 44 deletions
|
@ -9,35 +9,41 @@
|
|||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* PUBLIC FUNCTIONS **********************************************************/
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
|
||||
HalReturnToFirmware(
|
||||
_In_ FIRMWARE_REENTRY Action)
|
||||
{
|
||||
/* Check what kind of action this is */
|
||||
switch (Action)
|
||||
{
|
||||
/* All recognized actions */
|
||||
case HalHaltRoutine:
|
||||
case HalPowerDownRoutine:
|
||||
case HalRestartRoutine:
|
||||
case HalRebootRoutine:
|
||||
|
||||
{
|
||||
/* Acquire the display */
|
||||
InbvAcquireDisplayOwnership();
|
||||
// TODO: Reboot
|
||||
}
|
||||
|
||||
/* Anything else */
|
||||
default:
|
||||
|
||||
{
|
||||
/* Print message and break */
|
||||
DbgPrint("HalReturnToFirmware called!\n");
|
||||
DbgBreakPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _MINIHAL_
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -10,21 +10,18 @@
|
|||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
static VOID
|
||||
HalpWriteResetCommand(VOID)
|
||||
{
|
||||
/* Generate RESET signal via keyboard controller */
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x64, 0xFE);
|
||||
};
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
NTAPI
|
||||
HalpReboot(VOID)
|
||||
{
|
||||
PHYSICAL_ADDRESS PhysicalAddress;
|
||||
|
@ -69,39 +66,45 @@ HalpReboot(VOID)
|
|||
|
||||
/* Halt the CPU */
|
||||
__halt();
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
||||
/* PUBLIC FUNCTIONS **********************************************************/
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
|
||||
HalReturnToFirmware(
|
||||
_In_ FIRMWARE_REENTRY Action)
|
||||
{
|
||||
/* Check what kind of action this is */
|
||||
switch (Action)
|
||||
{
|
||||
/* All recognized actions */
|
||||
case HalHaltRoutine:
|
||||
case HalPowerDownRoutine:
|
||||
case HalRestartRoutine:
|
||||
case HalRebootRoutine:
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
{
|
||||
/* Acquire the display */
|
||||
InbvAcquireDisplayOwnership();
|
||||
#endif
|
||||
|
||||
/* Call the internal reboot function */
|
||||
HalpReboot();
|
||||
}
|
||||
|
||||
/* Anything else */
|
||||
default:
|
||||
|
||||
{
|
||||
/* Print message and break */
|
||||
DbgPrint("HalReturnToFirmware called!\n");
|
||||
DbgBreakPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _MINIHAL_
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -14,7 +14,6 @@ list(APPEND MINI_HAL_SOURCE
|
|||
../generic/timer.c
|
||||
../generic/usage.c
|
||||
../pic/pic.c
|
||||
../pic/processor.c
|
||||
../include/hal.h
|
||||
halinit.c)
|
||||
|
||||
|
|
|
@ -9,24 +9,22 @@
|
|||
|
||||
#include <hal.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
||||
static VOID
|
||||
DECLSPEC_NORETURN
|
||||
NTAPI
|
||||
#ifndef _MINIHAL_
|
||||
static DECLSPEC_NORETURN
|
||||
VOID
|
||||
HalpFreezeSystem(VOID)
|
||||
{
|
||||
HaliHaltSystem();
|
||||
|
||||
while (TRUE)
|
||||
NOTHING;
|
||||
/* Disable interrupts and halt the CPU */
|
||||
_disable();
|
||||
__halt();
|
||||
UNREACHABLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
NTAPI
|
||||
HalpReboot(VOID)
|
||||
{
|
||||
/* Disable interrupts */
|
||||
|
@ -42,10 +40,12 @@ HalpReboot(VOID)
|
|||
|
||||
/* Halt the CPU */
|
||||
__halt();
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
||||
/* PUBLIC FUNCTIONS **********************************************************/
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
VOID
|
||||
NTAPI
|
||||
HalReturnToFirmware(
|
||||
|
@ -53,23 +53,30 @@ HalReturnToFirmware(
|
|||
{
|
||||
switch (Action)
|
||||
{
|
||||
/* All recognized actions */
|
||||
case HalHaltRoutine:
|
||||
case HalPowerDownRoutine:
|
||||
HalpFreezeSystem();
|
||||
|
||||
case HalHaltRoutine:
|
||||
case HalRestartRoutine:
|
||||
case HalRebootRoutine:
|
||||
#ifndef _MINIHAL_
|
||||
{
|
||||
/* Acquire the display */
|
||||
InbvAcquireDisplayOwnership();
|
||||
#endif
|
||||
|
||||
/* Call the internal reboot function */
|
||||
HalpReboot();
|
||||
}
|
||||
|
||||
/* Anything else */
|
||||
default:
|
||||
{
|
||||
/* Print message and break */
|
||||
DbgPrint("HalReturnToFirmware called!\n");
|
||||
DbgBreakPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _MINIHAL_
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -27,7 +27,6 @@ HaliHaltSystem(VOID)
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
|
|
@ -15,14 +15,13 @@
|
|||
|
||||
#include "halxbox.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
SMBusWriteByte(UCHAR Address, UCHAR Register, UCHAR Data)
|
||||
static VOID
|
||||
SMBusWriteByte(
|
||||
_In_ UCHAR Address,
|
||||
_In_ UCHAR Register,
|
||||
_In_ UCHAR Data)
|
||||
{
|
||||
INT Retries = 50;
|
||||
|
||||
|
@ -63,35 +62,47 @@ SMBusWriteByte(UCHAR Address, UCHAR Register, UCHAR Data)
|
|||
}
|
||||
}
|
||||
|
||||
static DECLSPEC_NORETURN
|
||||
VOID
|
||||
DECLSPEC_NORETURN
|
||||
NTAPI
|
||||
HalpXboxPowerAction(IN UCHAR Action)
|
||||
HalpXboxPowerAction(
|
||||
_In_ UCHAR Action)
|
||||
{
|
||||
/* Disable interrupts */
|
||||
_disable();
|
||||
|
||||
/* Send the command */
|
||||
SMBusWriteByte(SMB_DEVICE_SMC_PIC16LC, SMC_REG_POWER, Action);
|
||||
|
||||
/* Halt the CPU */
|
||||
__halt();
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
||||
while (TRUE); /* 'noreturn' function */
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
HalpReboot(VOID)
|
||||
{
|
||||
HalpXboxPowerAction(SMC_REG_POWER_RESET);
|
||||
}
|
||||
|
||||
/* PUBLIC FUNCTIONS **********************************************************/
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
|
||||
HalReturnToFirmware(
|
||||
_In_ FIRMWARE_REENTRY Action)
|
||||
{
|
||||
/* Check what kind of action this is */
|
||||
switch (Action)
|
||||
{
|
||||
/* All recognized actions */
|
||||
/* All recognized actions: call the internal power function */
|
||||
case HalHaltRoutine:
|
||||
case HalPowerDownRoutine:
|
||||
{
|
||||
/* Call the internal power function */
|
||||
HalpXboxPowerAction(SMC_REG_POWER_SHUTDOWN);
|
||||
}
|
||||
case HalRestartRoutine:
|
||||
|
@ -102,6 +113,7 @@ HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
|
|||
{
|
||||
HalpXboxPowerAction(SMC_REG_POWER_RESET);
|
||||
}
|
||||
|
||||
/* Anything else */
|
||||
default:
|
||||
{
|
||||
|
@ -111,5 +123,6 @@ HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // _MINIHAL_
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue