ReactOS 0.4.16-dev-122-g325d74c
reboot.c File Reference
#include "halxbox.h"
Include dependency graph for reboot.c:

Go to the source code of this file.

Functions

static VOID SMBusWriteByte (_In_ UCHAR Address, _In_ UCHAR Register, _In_ UCHAR Data)
 
static DECLSPEC_NORETURN VOID HalpXboxPowerAction (_In_ UCHAR Action)
 
DECLSPEC_NORETURN VOID HalpReboot (VOID)
 
VOID NTAPI HalReturnToFirmware (_In_ FIRMWARE_REENTRY Action)
 

Function Documentation

◆ HalpReboot()

DECLSPEC_NORETURN VOID HalpReboot ( VOID  )

Definition at line 83 of file reboot.c.

84{
86}
static DECLSPEC_NORETURN VOID HalpXboxPowerAction(_In_ UCHAR Action)
Definition: reboot.c:67
#define SMC_REG_POWER_RESET
Definition: halxbox.h:33

◆ HalpXboxPowerAction()

static DECLSPEC_NORETURN VOID HalpXboxPowerAction ( _In_ UCHAR  Action)
static

Definition at line 67 of file reboot.c.

69{
70 /* Disable interrupts */
71 _disable();
72
73 /* Send the command */
75
76 /* Halt the CPU */
77 __halt();
79}
static VOID SMBusWriteByte(_In_ UCHAR Address, _In_ UCHAR Register, _In_ UCHAR Data)
Definition: reboot.c:21
#define SMB_DEVICE_SMC_PIC16LC
Definition: halxbox.h:30
#define SMC_REG_POWER
Definition: halxbox.h:32
void __cdecl _disable(void)
Definition: intrin_arm.h:365
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1714
#define UNREACHABLE
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Referenced by HalpReboot(), and HalReturnToFirmware().

◆ HalReturnToFirmware()

VOID NTAPI HalReturnToFirmware ( _In_ FIRMWARE_REENTRY  Action)

Definition at line 96 of file reboot.c.

98{
99 /* Check what kind of action this is */
100 switch (Action)
101 {
102 /* All recognized actions: call the internal power function */
103 case HalHaltRoutine:
105 {
107 }
109 {
111 }
112 case HalRebootRoutine:
113 {
115 }
116
117 /* Anything else */
118 default:
119 {
120 /* Print message and break */
121 DbgPrint("HalReturnToFirmware(%d) called!\n", Action);
123 }
124 }
125}
#define DbgPrint
Definition: hal.h:12
#define SMC_REG_POWER_CYCLE
Definition: halxbox.h:34
#define SMC_REG_POWER_SHUTDOWN
Definition: halxbox.h:35
NTSYSAPI void WINAPI DbgBreakPoint(void)
@ HalRestartRoutine
Definition: haltypes.h:36
@ HalHaltRoutine
Definition: haltypes.h:34
@ HalPowerDownRoutine
Definition: haltypes.h:35
@ HalRebootRoutine
Definition: haltypes.h:37

◆ SMBusWriteByte()

static VOID SMBusWriteByte ( _In_ UCHAR  Address,
_In_ UCHAR  Register,
_In_ UCHAR  Data 
)
static

Definition at line 21 of file reboot.c.

25{
26 INT Retries = 50;
27
28 /* Wait while bus is busy with any master traffic */
30 {
31 NOTHING;
32 }
33
34 while (Retries--)
35 {
36 UCHAR b;
37
40
42
43 /* Clear down all preexisting errors */
45
46 /* Let I2C SMBus know we're sending a single byte here */
48
49 b = 0;
50
51 while (!(b & 0x36))
52 {
54 }
55
56 if (b & 0x10)
57 {
58 return;
59 }
60
62 }
63}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
USHORT NTAPI READ_PORT_USHORT(IN PUSHORT Port)
Definition: portio.c:63
#define SMB_HOST_COMMAND
Definition: halxbox.h:28
#define SMB_GLOBAL_ENABLE
Definition: halxbox.h:25
#define SMB_GLOBAL_STATUS
Definition: halxbox.h:24
#define SMB_HOST_ADDRESS
Definition: halxbox.h:26
#define SMB_HOST_DATA
Definition: halxbox.h:27
#define NOTHING
Definition: input_list.c:10
#define b
Definition: ke_i.h:79
#define KeStallExecutionProcessor(MicroSeconds)
Definition: precomp.h:27
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
static WCHAR Address[46]
Definition: ping.c:68
int32_t INT
Definition: typedefs.h:58
uint16_t * PUSHORT
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by HalpXboxPowerAction().