1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * PROJECT: ReactOS Kernel 3*c2c66affSColin Finck * LICENSE: BSD - See COPYING.ARM in the top level directory 4*c2c66affSColin Finck * FILE: ntoskrnl/include/internal/hdl.h 5*c2c66affSColin Finck * PURPOSE: Internal header for the Configuration Manager 6*c2c66affSColin Finck * PROGRAMMERS: ReactOS Portable Systems Group 7*c2c66affSColin Finck */ 8*c2c66affSColin Finck #define _HDL_ 9*c2c66affSColin Finck #include <cportlib/cportlib.h> 10*c2c66affSColin Finck #include <ndk/extypes.h> 11*c2c66affSColin Finck 12*c2c66affSColin Finck // 13*c2c66affSColin Finck // Define this if you want debugging support 14*c2c66affSColin Finck // 15*c2c66affSColin Finck #define _HDL_DEBUG_ 0x00 16*c2c66affSColin Finck 17*c2c66affSColin Finck // 18*c2c66affSColin Finck // These define the Debug Masks Supported 19*c2c66affSColin Finck // 20*c2c66affSColin Finck #define HDL_XXX_DEBUG 0x01 21*c2c66affSColin Finck 22*c2c66affSColin Finck // 23*c2c66affSColin Finck // Debug/Tracing support 24*c2c66affSColin Finck // 25*c2c66affSColin Finck #if _HDL_DEBUG_ 26*c2c66affSColin Finck #ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented 27*c2c66affSColin Finck #define HDLTRACE DbgPrintEx 28*c2c66affSColin Finck #else 29*c2c66affSColin Finck #define HDLTRACE(x, ...) \ 30*c2c66affSColin Finck if (x & HdlpTraceLevel) DbgPrint(__VA_ARGS__) 31*c2c66affSColin Finck #endif 32*c2c66affSColin Finck #else 33*c2c66affSColin Finck #define HDLTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) 34*c2c66affSColin Finck #endif 35*c2c66affSColin Finck 36*c2c66affSColin Finck // 37*c2c66affSColin Finck // Well-known messages that Io and Pnp post to the kernel log 38*c2c66affSColin Finck // 39*c2c66affSColin Finck typedef enum _HEADLESS_LOG_MESSAGE 40*c2c66affSColin Finck { 41*c2c66affSColin Finck HeadlessLogDriverLoad = 1, 42*c2c66affSColin Finck HeadlessLogDriverSuccess, 43*c2c66affSColin Finck HeadlessLogDriverFailed, 44*c2c66affSColin Finck HeadlessLogEventFailed, 45*c2c66affSColin Finck HeadlessLogObjectFailed, 46*c2c66affSColin Finck HeadlessLogDirectoryFailed, 47*c2c66affSColin Finck HeadlessLogPnpFailed, 48*c2c66affSColin Finck HeadlessLogPnpFailed2, 49*c2c66affSColin Finck HeadlessLogBootDriversFailed, 50*c2c66affSColin Finck HeadlessLogNtdllFailed, 51*c2c66affSColin Finck HeadlessLogSystemDriversFailed, 52*c2c66affSColin Finck HeadlessLogReassignSystemRootFailed, 53*c2c66affSColin Finck HeadlessLogProtectSystemRootFailed, 54*c2c66affSColin Finck HeadlessLogConvertSystemRootFailed, 55*c2c66affSColin Finck HeadlessLogConvertDeviceNameFailed, 56*c2c66affSColin Finck HeadlessLogGroupOrderListFailed, 57*c2c66affSColin Finck HeadlessLogGroupTableFailed 58*c2c66affSColin Finck // 59*c2c66affSColin Finck // There are more, but not applicable to ReactOS, I believe 60*c2c66affSColin Finck // 61*c2c66affSColin Finck } HEADLESS_LOG_MESSAGE; 62*c2c66affSColin Finck 63*c2c66affSColin Finck // 64*c2c66affSColin Finck // Headless Log Entry 65*c2c66affSColin Finck // 66*c2c66affSColin Finck typedef struct _HEADLESS_LOG_ENTRY 67*c2c66affSColin Finck { 68*c2c66affSColin Finck SYSTEM_TIMEOFDAY_INFORMATION TimeOfEntry; 69*c2c66affSColin Finck PWCHAR String; 70*c2c66affSColin Finck } HEADLESS_LOG_ENTRY, *PHEADLESS_LOG_ENTRY; 71*c2c66affSColin Finck 72*c2c66affSColin Finck // 73*c2c66affSColin Finck // Headless Bugcheck Information 74*c2c66affSColin Finck // 75*c2c66affSColin Finck typedef struct _HEADLESS_CMD_SET_BLUE_SCREEN_DATA 76*c2c66affSColin Finck { 77*c2c66affSColin Finck ULONG ValueIndex; 78*c2c66affSColin Finck UCHAR Data[ANYSIZE_ARRAY]; 79*c2c66affSColin Finck } HEADLESS_CMD_SET_BLUE_SCREEN_DATA, *PHEADLESS_CMD_SET_BLUE_SCREEN_DATA; 80*c2c66affSColin Finck 81*c2c66affSColin Finck // 82*c2c66affSColin Finck // Headless Control Structure, mostly for !SAC 83*c2c66affSColin Finck // 84*c2c66affSColin Finck typedef struct _HEADLESS_GLOBALS 85*c2c66affSColin Finck { 86*c2c66affSColin Finck KSPIN_LOCK SpinLock; 87*c2c66affSColin Finck HANDLE PageLockHandle; 88*c2c66affSColin Finck PHEADLESS_LOG_ENTRY LogEntries; 89*c2c66affSColin Finck PUCHAR TmpBuffer; 90*c2c66affSColin Finck PUCHAR InputBuffer; 91*c2c66affSColin Finck PHEADLESS_CMD_SET_BLUE_SCREEN_DATA BlueScreenData; 92*c2c66affSColin Finck union 93*c2c66affSColin Finck { 94*c2c66affSColin Finck struct 95*c2c66affSColin Finck { 96*c2c66affSColin Finck ULONG TerminalEnabled:1; 97*c2c66affSColin Finck ULONG InBugCheck:1; 98*c2c66affSColin Finck ULONG NewLogEntryAdded:1; 99*c2c66affSColin Finck ULONG UsedBiosSettings:1; 100*c2c66affSColin Finck ULONG InputProcessing:1; 101*c2c66affSColin Finck ULONG InputLineDone:1; 102*c2c66affSColin Finck ULONG ProcessingCmd:1; 103*c2c66affSColin Finck ULONG TerminalParity:1; 104*c2c66affSColin Finck ULONG TerminalStopBits:1; 105*c2c66affSColin Finck ULONG TerminalPortNumber:3; 106*c2c66affSColin Finck ULONG IsNonLegacyDevice:1; 107*c2c66affSColin Finck }; 108*c2c66affSColin Finck ULONG AllFlags; 109*c2c66affSColin Finck }; 110*c2c66affSColin Finck ULONG TerminalBaudRate; 111*c2c66affSColin Finck ULONG TerminalPort; 112*c2c66affSColin Finck PUCHAR TerminalPortAddress; 113*c2c66affSColin Finck LARGE_INTEGER DelayTime; 114*c2c66affSColin Finck ULONG MicroSecondsDelayTime; 115*c2c66affSColin Finck UCHAR TerminalType; 116*c2c66affSColin Finck SIZE_T InputBufferIndex; 117*c2c66affSColin Finck USHORT LogEntryLast; 118*c2c66affSColin Finck USHORT LogEntryStart; 119*c2c66affSColin Finck GUID SystemGUID; 120*c2c66affSColin Finck BOOLEAN IsMMIODevice; 121*c2c66affSColin Finck BOOLEAN IsLastCharCR; 122*c2c66affSColin Finck } HEADLESS_GLOBALS, *PHEADLESS_GLOBALS; 123*c2c66affSColin Finck 124*c2c66affSColin Finck // 125*c2c66affSColin Finck // FIXME: A public header in the NDK? Ask Alex 126*c2c66affSColin Finck // 127*c2c66affSColin Finck typedef enum _HEADLESS_CMD 128*c2c66affSColin Finck { 129*c2c66affSColin Finck HeadlessCmdEnableTerminal = 1, 130*c2c66affSColin Finck HeadlessCmdCheckForReboot, 131*c2c66affSColin Finck HeadlessCmdPutString, 132*c2c66affSColin Finck HeadlessCmdClearDisplay, 133*c2c66affSColin Finck HeadlessCmdClearToEndOfDisplay, 134*c2c66affSColin Finck HeadlessCmdClearToEndOfLine, 135*c2c66affSColin Finck HeadlessCmdDisplayAttributesOff, 136*c2c66affSColin Finck HeadlessCmdDisplayInverseVideo, 137*c2c66affSColin Finck HeadlessCmdSetColor, 138*c2c66affSColin Finck HeadlessCmdPositionCursor, 139*c2c66affSColin Finck HeadlessCmdTerminalPoll, 140*c2c66affSColin Finck HeadlessCmdGetByte, 141*c2c66affSColin Finck HeadlessCmdGetLine, 142*c2c66affSColin Finck HeadlessCmdStartBugCheck, 143*c2c66affSColin Finck HeadlessCmdDoBugCheckProcessing, 144*c2c66affSColin Finck HeadlessCmdQueryInformation, 145*c2c66affSColin Finck HeadlessCmdAddLogEntry, 146*c2c66affSColin Finck HeadlessCmdDisplayLog, 147*c2c66affSColin Finck HeadlessCmdSetBlueScreenData, 148*c2c66affSColin Finck HeadlessCmdSendBlueScreenData, 149*c2c66affSColin Finck HeadlessCmdQueryGUID, 150*c2c66affSColin Finck HeadlessCmdPutData 151*c2c66affSColin Finck } HEADLESS_CMD, *PHEADLESS_CMD; 152*c2c66affSColin Finck 153*c2c66affSColin Finck typedef enum _HEADLESS_TERM_PORT_TYPE 154*c2c66affSColin Finck { 155*c2c66affSColin Finck HeadlessUndefinedPortType = 0, 156*c2c66affSColin Finck HeadlessSerialPort 157*c2c66affSColin Finck } HEADLESS_TERM_PORT_TYPE, *PHEADLESS_TERM_PORT_TYPE; 158*c2c66affSColin Finck 159*c2c66affSColin Finck typedef enum _HEADLESS_TERM_SERIAL_PORT 160*c2c66affSColin Finck { 161*c2c66affSColin Finck SerialPortUndefined = 0, 162*c2c66affSColin Finck ComPort1, 163*c2c66affSColin Finck ComPort2, 164*c2c66affSColin Finck ComPort3, 165*c2c66affSColin Finck ComPort4 166*c2c66affSColin Finck } HEADLESS_TERM_SERIAL_PORT, *PHEADLESS_TERM_SERIAL_PORT; 167*c2c66affSColin Finck 168*c2c66affSColin Finck typedef struct _HEADLESS_RSP_QUERY_INFO 169*c2c66affSColin Finck { 170*c2c66affSColin Finck HEADLESS_TERM_PORT_TYPE PortType; 171*c2c66affSColin Finck union 172*c2c66affSColin Finck { 173*c2c66affSColin Finck struct 174*c2c66affSColin Finck { 175*c2c66affSColin Finck BOOLEAN TerminalAttached; 176*c2c66affSColin Finck BOOLEAN UsedBiosSettings; 177*c2c66affSColin Finck HEADLESS_TERM_SERIAL_PORT TerminalPort; 178*c2c66affSColin Finck PUCHAR TerminalPortBaseAddress; 179*c2c66affSColin Finck ULONG TerminalBaudRate; 180*c2c66affSColin Finck UCHAR TerminalType; 181*c2c66affSColin Finck } Serial; 182*c2c66affSColin Finck }; 183*c2c66affSColin Finck } HEADLESS_RSP_QUERY_INFO, *PHEADLESS_RSP_QUERY_INFO; 184*c2c66affSColin Finck 185*c2c66affSColin Finck typedef struct _HEADLESS_CMD_ENABLE_TERMINAL 186*c2c66affSColin Finck { 187*c2c66affSColin Finck BOOLEAN Enable; 188*c2c66affSColin Finck } HEADLESS_CMD_ENABLE_TERMINAL, *PHEADLESS_CMD_ENABLE_TERMINAL; 189*c2c66affSColin Finck 190*c2c66affSColin Finck typedef struct _HEADLESS_CMD_PUT_STRING 191*c2c66affSColin Finck { 192*c2c66affSColin Finck UCHAR String[1]; 193*c2c66affSColin Finck } HEADLESS_CMD_PUT_STRING, *PHEADLESS_CMD_PUT_STRING; 194*c2c66affSColin Finck 195*c2c66affSColin Finck typedef struct _HEADLESS_CMD_SET_COLOR 196*c2c66affSColin Finck { 197*c2c66affSColin Finck ULONG TextColor; 198*c2c66affSColin Finck ULONG BkgdColor; 199*c2c66affSColin Finck } HEADLESS_CMD_SET_COLOR, *PHEADLESS_CMD_SET_COLOR; 200*c2c66affSColin Finck 201*c2c66affSColin Finck typedef struct _HEADLESS_CMD_POSITION_CURSOR 202*c2c66affSColin Finck { 203*c2c66affSColin Finck ULONG CursorCol; 204*c2c66affSColin Finck ULONG CursorRow; 205*c2c66affSColin Finck } HEADLESS_CMD_POSITION_CURSOR, *PHEADLESS_CMD_POSITION_CURSOR; 206*c2c66affSColin Finck 207*c2c66affSColin Finck typedef struct _HEADLESS_RSP_GET_BYTE 208*c2c66affSColin Finck { 209*c2c66affSColin Finck UCHAR Value; 210*c2c66affSColin Finck } HEADLESS_RSP_GET_BYTE, *PHEADLESS_RSP_GET_BYTE; 211*c2c66affSColin Finck 212*c2c66affSColin Finck NTSTATUS 213*c2c66affSColin Finck NTAPI 214*c2c66affSColin Finck HeadlessDispatch( 215*c2c66affSColin Finck IN HEADLESS_CMD Command, 216*c2c66affSColin Finck IN PVOID InputBuffer, 217*c2c66affSColin Finck IN SIZE_T InputBufferSize, 218*c2c66affSColin Finck OUT PVOID OutputBuffer, 219*c2c66affSColin Finck OUT PSIZE_T OutputBufferSize 220*c2c66affSColin Finck ); 221*c2c66affSColin Finck 222*c2c66affSColin Finck // 223*c2c66affSColin Finck // Global variables accessible from all of Hdl 224*c2c66affSColin Finck // 225*c2c66affSColin Finck extern PHEADLESS_GLOBALS HeadlessGlobals; 226*c2c66affSColin Finck 227*c2c66affSColin Finck // 228*c2c66affSColin Finck // Inlined functions 229*c2c66affSColin Finck // 230*c2c66affSColin Finck //#include "hdl_x.h" 231