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