Search by Tags

IOCTL HAL REBOOT

 

Article updated at 13 Feb 2019
Compare with Revision




Using this IOCTL, you can reboot the system.

Please note, the following SoCs support only cold boot:

  • VF50
  • VF61
  • i.MX6
  • i.MX7

Definitions

# define FILE_DEVICE_HAL				0x101
# define METHOD_BUFFERED				0x0
# define FILE_ANY_ACCESS				0x0
# define CTL_CODE( DeviceType, Function, Method, Access ) (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
# define IOCTL_HAL_REBOOT			CTL_CODE(FILE_DEVICE_HAL,  15,      METHOD_BUFFERED, FILE_ANY_ACCESS)
 
BOOL KernelIoControl(DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned);

Sample

// To force a Cold Boot: let the 2nd function parameter point to a value 0
//                       *lpInBuf = 0;
// To force a Warm Boot: let the 2nd function parameter be NULL
//                       lpInBuf = 0;
if(coldBoot)
{ 
    DWORD zero=0;
    KernelIoControl(IOCTL_HAL_REBOOT, &zero, 4, NULL, 0, NULL);
}
else
{
    KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
}