ReactOS  0.4.14-dev-49-gfb4591c
machpc.c File Reference
#include <freeldr.h>
#include <cportlib/cportlib.h>
#include <debug.h>
Include dependency graph for machpc.c:

Go to the source code of this file.

Macros

#define MAX_COM_PORTS   4
 
#define MAX_LPT_PORTS   3
 
#define MOUSE_TYPE_NONE   0
 
#define MOUSE_TYPE_MICROSOFT   1
 
#define MOUSE_TYPE_LOGITECH   2
 
#define MOUSE_TYPE_WHEELZ   3
 
#define MOUSE_TYPE_MOUSESYSTEMS   4
 
#define CONTROLLER_REGISTER_STATUS   0x64
 
#define CONTROLLER_REGISTER_CONTROL   0x64
 
#define CONTROLLER_REGISTER_DATA   0x60
 
#define CONTROLLER_COMMAND_READ_MODE   0x20
 
#define CONTROLLER_COMMAND_WRITE_MODE   0x60
 
#define CONTROLLER_COMMAND_GET_VERSION   0xA1
 
#define CONTROLLER_COMMAND_MOUSE_DISABLE   0xA7
 
#define CONTROLLER_COMMAND_MOUSE_ENABLE   0xA8
 
#define CONTROLLER_COMMAND_TEST_MOUSE   0xA9
 
#define CONTROLLER_COMMAND_SELF_TEST   0xAA
 
#define CONTROLLER_COMMAND_KEYBOARD_TEST   0xAB
 
#define CONTROLLER_COMMAND_KEYBOARD_DISABLE   0xAD
 
#define CONTROLLER_COMMAND_KEYBOARD_ENABLE   0xAE
 
#define CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER   0xD3
 
#define CONTROLLER_COMMAND_WRITE_MOUSE   0xD4
 
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL   0x01
 
#define CONTROLLER_STATUS_INPUT_BUFFER_FULL   0x02
 
#define CONTROLLER_STATUS_SELF_TEST   0x04
 
#define CONTROLLER_STATUS_COMMAND   0x08
 
#define CONTROLLER_STATUS_UNLOCKED   0x10
 
#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL   0x20
 
#define CONTROLLER_STATUS_GENERAL_TIMEOUT   0x40
 
#define CONTROLLER_STATUS_PARITY_ERROR   0x80
 
#define AUX_STATUS_OUTPUT_BUFFER_FULL
 
#define CONTROLLER_TIMEOUT   250
 

Functions

 DBG_DEFAULT_CHANNEL (HWDETECT)
 
VOID PcGetExtendedBIOSData (PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
 
static PCM_PARTIAL_RESOURCE_LIST PcGetHarddiskConfigurationData (UCHAR DriveNumber, ULONG *pSize)
 
static VOID DetectPnpBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
static VOID InitializeSerialPort (PUCHAR Port, UCHAR LineControl)
 
static ULONG DetectSerialMouse (PUCHAR Port)
 
static ULONG GetSerialMousePnpId (PUCHAR Port, char *Buffer)
 
static VOID DetectSerialPointerPeripheral (PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
 
ULONG PcGetSerialPort (ULONG Index, PULONG Irq)
 
VOID DetectSerialPorts (PCONFIGURATION_COMPONENT_DATA BusKey, GET_SERIAL_PORT MachGetSerialPort, ULONG Count)
 
static VOID DetectParallelPorts (PCONFIGURATION_COMPONENT_DATA BusKey)
 
BOOLEAN DetectKeyboardDevice (VOID)
 
static VOID DetectKeyboardPeripheral (PCONFIGURATION_COMPONENT_DATA ControllerKey)
 
static VOID DetectKeyboardController (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID PS2ControllerWait (VOID)
 
static BOOLEAN DetectPS2AuxPort (VOID)
 
static BOOLEAN DetectPS2AuxDevice (VOID)
 
static VOID DetectPS2Mouse (PCONFIGURATION_COMPONENT_DATA BusKey)
 
USHORT BiosIsVesaSupported (VOID)
 
BOOLEAN BiosIsVesaDdcSupported (VOID)
 
BOOLEAN BiosVesaReadEdid (VOID)
 
static VOID DetectDisplayController (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID DetectIsaBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
static UCHAR PcGetFloppyCount (VOID)
 
PCONFIGURATION_COMPONENT_DATA PcHwDetect (VOID)
 
VOID PcHwIdle (VOID)
 
VOID PcMachInit (const char *CmdLine)
 
VOID PcPrepareForReactOS (VOID)
 

Macro Definition Documentation

◆ AUX_STATUS_OUTPUT_BUFFER_FULL

#define AUX_STATUS_OUTPUT_BUFFER_FULL
Value:
CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL)
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:64

Definition at line 72 of file machpc.c.

◆ CONTROLLER_COMMAND_GET_VERSION

#define CONTROLLER_COMMAND_GET_VERSION   0xA1

Definition at line 52 of file machpc.c.

◆ CONTROLLER_COMMAND_KEYBOARD_DISABLE

#define CONTROLLER_COMMAND_KEYBOARD_DISABLE   0xAD

Definition at line 58 of file machpc.c.

◆ CONTROLLER_COMMAND_KEYBOARD_ENABLE

#define CONTROLLER_COMMAND_KEYBOARD_ENABLE   0xAE

Definition at line 59 of file machpc.c.

◆ CONTROLLER_COMMAND_KEYBOARD_TEST

#define CONTROLLER_COMMAND_KEYBOARD_TEST   0xAB

Definition at line 57 of file machpc.c.

◆ CONTROLLER_COMMAND_MOUSE_DISABLE

#define CONTROLLER_COMMAND_MOUSE_DISABLE   0xA7

Definition at line 53 of file machpc.c.

◆ CONTROLLER_COMMAND_MOUSE_ENABLE

#define CONTROLLER_COMMAND_MOUSE_ENABLE   0xA8

Definition at line 54 of file machpc.c.

◆ CONTROLLER_COMMAND_READ_MODE

#define CONTROLLER_COMMAND_READ_MODE   0x20

Definition at line 50 of file machpc.c.

◆ CONTROLLER_COMMAND_SELF_TEST

#define CONTROLLER_COMMAND_SELF_TEST   0xAA

Definition at line 56 of file machpc.c.

◆ CONTROLLER_COMMAND_TEST_MOUSE

#define CONTROLLER_COMMAND_TEST_MOUSE   0xA9

Definition at line 55 of file machpc.c.

◆ CONTROLLER_COMMAND_WRITE_MODE

#define CONTROLLER_COMMAND_WRITE_MODE   0x60

Definition at line 51 of file machpc.c.

◆ CONTROLLER_COMMAND_WRITE_MOUSE

#define CONTROLLER_COMMAND_WRITE_MOUSE   0xD4

Definition at line 61 of file machpc.c.

◆ CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER

#define CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER   0xD3

Definition at line 60 of file machpc.c.

◆ CONTROLLER_REGISTER_CONTROL

#define CONTROLLER_REGISTER_CONTROL   0x64

Definition at line 46 of file machpc.c.

◆ CONTROLLER_REGISTER_DATA

#define CONTROLLER_REGISTER_DATA   0x60

Definition at line 47 of file machpc.c.

◆ CONTROLLER_REGISTER_STATUS

#define CONTROLLER_REGISTER_STATUS   0x64

Definition at line 45 of file machpc.c.

◆ CONTROLLER_STATUS_COMMAND

#define CONTROLLER_STATUS_COMMAND   0x08

Definition at line 67 of file machpc.c.

◆ CONTROLLER_STATUS_GENERAL_TIMEOUT

#define CONTROLLER_STATUS_GENERAL_TIMEOUT   0x40

Definition at line 70 of file machpc.c.

◆ CONTROLLER_STATUS_INPUT_BUFFER_FULL

#define CONTROLLER_STATUS_INPUT_BUFFER_FULL   0x02

Definition at line 65 of file machpc.c.

◆ CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL

#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL   0x20

Definition at line 69 of file machpc.c.

◆ CONTROLLER_STATUS_OUTPUT_BUFFER_FULL

#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL   0x01

Definition at line 64 of file machpc.c.

◆ CONTROLLER_STATUS_PARITY_ERROR

#define CONTROLLER_STATUS_PARITY_ERROR   0x80

Definition at line 71 of file machpc.c.

◆ CONTROLLER_STATUS_SELF_TEST

#define CONTROLLER_STATUS_SELF_TEST   0x04

Definition at line 66 of file machpc.c.

◆ CONTROLLER_STATUS_UNLOCKED

#define CONTROLLER_STATUS_UNLOCKED   0x10

Definition at line 68 of file machpc.c.

◆ CONTROLLER_TIMEOUT

#define CONTROLLER_TIMEOUT   250

Definition at line 76 of file machpc.c.

◆ MAX_COM_PORTS

#define MAX_COM_PORTS   4

Definition at line 27 of file machpc.c.

◆ MAX_LPT_PORTS

#define MAX_LPT_PORTS   3

Definition at line 28 of file machpc.c.

◆ MOUSE_TYPE_LOGITECH

#define MOUSE_TYPE_LOGITECH   2

Definition at line 35 of file machpc.c.

◆ MOUSE_TYPE_MICROSOFT

#define MOUSE_TYPE_MICROSOFT   1

Definition at line 33 of file machpc.c.

◆ MOUSE_TYPE_MOUSESYSTEMS

#define MOUSE_TYPE_MOUSESYSTEMS   4

Definition at line 39 of file machpc.c.

◆ MOUSE_TYPE_NONE

#define MOUSE_TYPE_NONE   0

Definition at line 31 of file machpc.c.

◆ MOUSE_TYPE_WHEELZ

#define MOUSE_TYPE_WHEELZ   3

Definition at line 37 of file machpc.c.

Function Documentation

◆ BiosIsVesaDdcSupported()

BOOLEAN BiosIsVesaDdcSupported ( VOID  )

Definition at line 242 of file i386vid.c.

243 {
244  REGS Regs;
245 
246  TRACE("BiosIsVesaDdcSupported()\n");
247 
248  Regs.w.ax = 0x4F15;
249  Regs.b.bl = 0;
250  Regs.w.cx = 0;
251  Regs.w.es = 0;
252  Regs.w.di = 0;
253  Int386(0x10, &Regs, &Regs);
254 
255  TRACE("AL = 0x%x\n", Regs.b.al);
256  TRACE("AH = 0x%x\n", Regs.b.ah);
257 
258  TRACE("BL = 0x%x\n", Regs.b.bl);
259 
260  if (Regs.w.ax != 0x004F)
261  {
262  WARN("VBE/DDC Installation check function not supported (AL=0x%x) or failed (AH=0x%x)\n",
263  Regs.b.al, Regs.b.ah);
264  return FALSE;
265  }
266 
267  return (Regs.b.ah == 0);
268 }
#define WARN(fmt,...)
Definition: debug.h:111
unsigned short cx
Definition: pcbios.h:101
unsigned short es
Definition: pcbios.h:109
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:122
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
unsigned short ax
Definition: pcbios.h:99
Definition: pcbios.h:146
unsigned short di
Definition: pcbios.h:105
WORDREGS w
Definition: pcbios.h:150

Referenced by DetectDisplayController().

◆ BiosIsVesaSupported()

USHORT BiosIsVesaSupported ( VOID  )

Definition at line 160 of file i386vid.c.

161 {
162  REGS Regs;
164  //USHORT* VideoModes;
165  //USHORT Index;
166 
167  TRACE("BiosIsVesaSupported()\n");
168 
169  RtlZeroMemory(SvgaInfo, sizeof(VESA_SVGA_INFO));
170 
171  // Make sure we receive version 2.0 info
172  SvgaInfo->Signature[0] = 'V';
173  SvgaInfo->Signature[1] = 'B';
174  SvgaInfo->Signature[2] = 'E';
175  SvgaInfo->Signature[3] = '2';
176 
177  // Int 10h AX=4F00h
178  // VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION
179  //
180  // AX = 4F00h
181  // ES:DI -> buffer for SuperVGA information (see #00077)
182  // Return:
183  // AL = 4Fh if function supported
184  // AH = status
185  // 00h successful
186  // ES:DI buffer filled
187  // 01h failed
188  // ---VBE v2.0---
189  // 02h function not supported by current hardware configuration
190  // 03h function invalid in current video mode
191  //
192  // Determine whether VESA BIOS extensions are present and the
193  // capabilities supported by the display adapter
194  //
195  // Installation check;VESA SuperVGA
196  Regs.w.ax = 0x4F00;
197  Regs.w.es = BIOSCALLBUFSEGMENT;
198  Regs.w.di = BIOSCALLBUFOFFSET;
199  Int386(0x10, &Regs, &Regs);
200 
201  TRACE("AL = 0x%x\n", Regs.b.al);
202  TRACE("AH = 0x%x\n", Regs.b.ah);
203 
204  if (Regs.w.ax != 0x004F)
205  {
206  WARN("VBE Get SuperVGA information function not supported (AL=0x%x) or failed (AH=0x%x)\n",
207  Regs.b.al, Regs.b.ah);
208  return 0x0000;
209  }
210 
211  TRACE("Supported.\n");
212  TRACE("SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]);
213  TRACE("SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF));
214  TRACE("SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr);
215  TRACE("SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities);
216  TRACE("SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64);
217  TRACE("---VBE v2.0 ---\n");
218  TRACE("SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10));
219  TRACE("SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr);
220  TRACE("SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr);
221  TRACE("SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr);
222  TRACE("SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version);
223 
224  if (SvgaInfo->Signature[0] != 'V' ||
225  SvgaInfo->Signature[1] != 'E' ||
226  SvgaInfo->Signature[2] != 'S' ||
227  SvgaInfo->Signature[3] != 'A')
228  {
229  ERR("Bad signature in VESA information (%c%c%c%c)\n",
230  SvgaInfo->Signature[0],
231  SvgaInfo->Signature[1],
232  SvgaInfo->Signature[2],
233  SvgaInfo->Signature[3]);
234  return 0x0000;
235  }
236 
237  return SvgaInfo->VesaVersion;
238 }
USHORT VBE_AF_Version
Definition: i386vid.c:47
#define BIOSCALLBUFFER
Definition: x86common.h:12
#define WARN(fmt,...)
Definition: debug.h:111
ULONG ProductRevisionStringPtr
Definition: i386vid.c:46
unsigned short es
Definition: pcbios.h:109
unsigned char ah
Definition: pcbios.h:120
struct VESA_SVGA_INFO * PVESA_SVGA_INFO
int __cdecl Int386(int ivec, REGS *in, REGS *out)
ULONG OemNamePtr
Definition: i386vid.c:32
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
UCHAR Signature[4]
Definition: i386vid.c:28
ULONG Capabilities
Definition: i386vid.c:34
#define TRACE(s)
Definition: solgame.cpp:4
ULONG ProductNamePtr
Definition: i386vid.c:45
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
#define ERR(fmt,...)
Definition: debug.h:109
unsigned short ax
Definition: pcbios.h:99
USHORT VesaVersion
Definition: i386vid.c:31
Definition: pcbios.h:146
USHORT OemSoftwareVersion
Definition: i386vid.c:43
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
USHORT TotalVideoMemory
Definition: i386vid.c:37
ULONG VendorNamePtr
Definition: i386vid.c:44
unsigned short di
Definition: pcbios.h:105
WORDREGS w
Definition: pcbios.h:150

Referenced by DetectDisplayController().

◆ BiosVesaReadEdid()

BOOLEAN BiosVesaReadEdid ( VOID  )

Definition at line 272 of file i386vid.c.

273 {
274  REGS Regs;
275 
276  TRACE("BiosVesaReadEdid()\n");
277 
279 
280  Regs.w.ax = 0x4F15;
281  Regs.b.bl = 1;
282  Regs.w.cx = 0;
283  Regs.w.dx = 0;
284  Regs.w.es = BIOSCALLBUFSEGMENT;
285  Regs.w.di = BIOSCALLBUFOFFSET;
286  Int386(0x10, &Regs, &Regs);
287 
288  TRACE("AL = 0x%x\n", Regs.b.al);
289  TRACE("AH = 0x%x\n", Regs.b.ah);
290 
291  if (Regs.w.ax != 0x004F)
292  {
293  WARN("VBE/DDC Read EDID function not supported (AL=0x%x) or failed (AH=0x%x)\n",
294  Regs.b.al, Regs.b.ah);
295  return FALSE;
296  }
297 
298  return (Regs.b.ah == 0);
299 }
unsigned short dx
Definition: pcbios.h:102
#define BIOSCALLBUFFER
Definition: x86common.h:12
#define WARN(fmt,...)
Definition: debug.h:111
unsigned short cx
Definition: pcbios.h:101
unsigned short es
Definition: pcbios.h:109
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:122
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
unsigned short ax
Definition: pcbios.h:99
Definition: pcbios.h:146
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
unsigned short di
Definition: pcbios.h:105
WORDREGS w
Definition: pcbios.h:150

Referenced by DetectDisplayController().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectDisplayController()

static VOID DetectDisplayController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 1232 of file machpc.c.

1233 {
1234  CHAR Buffer[80];
1235  PCONFIGURATION_COMPONENT_DATA ControllerKey;
1236  USHORT VesaVersion;
1237 
1238  /* FIXME: Set 'ComponentInformation' value */
1239 
1240  VesaVersion = BiosIsVesaSupported();
1241  if (VesaVersion != 0)
1242  {
1243  TRACE("VESA version %c.%c\n",
1244  (VesaVersion >> 8) + '0',
1245  (VesaVersion & 0xFF) + '0');
1246  }
1247  else
1248  {
1249  TRACE("VESA not supported\n");
1250  }
1251 
1252  if (VesaVersion >= 0x0200)
1253  {
1254  strcpy(Buffer, "VBE Display");
1255  }
1256  else
1257  {
1258  strcpy(Buffer, "VGA Display");
1259  }
1260 
1261  FldrCreateComponentKey(BusKey,
1263  DisplayController,
1264  0x0,
1265  0x0,
1266  0xFFFFFFFF,
1267  Buffer,
1268  NULL,
1269  0,
1270  &ControllerKey);
1271  TRACE("Created key: DisplayController\\0\n");
1272 
1273  /* FIXME: Add display peripheral (monitor) data */
1274  if (VesaVersion != 0)
1275  {
1276  if (BiosIsVesaDdcSupported())
1277  {
1278  TRACE("VESA/DDC supported!\n");
1279  if (BiosVesaReadEdid())
1280  {
1281  TRACE("EDID data read successfully!\n");
1282 
1283  }
1284  }
1285  }
1286 }
GLint x0
Definition: linetemp.h:95
char CHAR
Definition: xmlstorage.h:175
BOOLEAN BiosIsVesaDdcSupported(VOID)
Definition: i386vid.c:242
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
BOOLEAN BiosVesaReadEdid(VOID)
Definition: i386vid.c:272
#define TRACE(s)
Definition: solgame.cpp:4
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
unsigned short USHORT
Definition: pedump.c:61
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
USHORT BiosIsVesaSupported(VOID)
Definition: i386vid.c:160

Referenced by DetectIsaBios().

◆ DetectIsaBios()

static VOID DetectIsaBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 1290 of file machpc.c.

1291 {
1292  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1294  ULONG Size;
1295 
1296  /* Set 'Configuration Data' value */
1297  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1299  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1300  if (PartialResourceList == NULL)
1301  {
1302  ERR("Failed to allocate resource descriptor\n");
1303  return;
1304  }
1305 
1306  /* Initialize resource descriptor */
1307  memset(PartialResourceList, 0, Size);
1308  PartialResourceList->Version = 1;
1309  PartialResourceList->Revision = 1;
1310  PartialResourceList->Count = 0;
1311 
1312  /* Create new bus key */
1313  FldrCreateComponentKey(SystemKey,
1314  AdapterClass,
1315  MultiFunctionAdapter,
1316  0x0,
1317  0x0,
1318  0xFFFFFFFF,
1319  "ISA",
1320  PartialResourceList,
1321  Size,
1322  &BusKey);
1323 
1324  /* Increment bus number */
1325  (*BusNumber)++;
1326 
1327  /* Detect ISA/BIOS devices */
1328  DetectBiosDisks(SystemKey, BusKey);
1330  DetectParallelPorts(BusKey);
1331  DetectKeyboardController(BusKey);
1332  DetectPS2Mouse(BusKey);
1333  DetectDisplayController(BusKey);
1334 
1335  /* FIXME: Detect more ISA devices */
1336 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey, GET_SERIAL_PORT MachGetSerialPort, ULONG Count)
Definition: machpc.c:656
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:968
smooth NULL
Definition: ftsmooth.c:416
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:751
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: hardware.c:339
static VOID DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1146
#define MAX_COM_PORTS
Definition: machpc.c:27
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
ULONG PcGetSerialPort(ULONG Index, PULONG Irq)
Definition: machpc.c:639
static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1232
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by PcHwDetect().

◆ DetectKeyboardController()

static VOID DetectKeyboardController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 968 of file machpc.c.

969 {
970  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
971  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
972  PCONFIGURATION_COMPONENT_DATA ControllerKey;
973  ULONG Size;
974 
975  /* Set 'Configuration Data' value */
976  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
977  2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
978  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
979  if (PartialResourceList == NULL)
980  {
981  ERR("Failed to allocate resource descriptor\n");
982  return;
983  }
984 
985  /* Initialize resource descriptor */
986  memset(PartialResourceList, 0, Size);
987  PartialResourceList->Version = 1;
988  PartialResourceList->Revision = 1;
989  PartialResourceList->Count = 3;
990 
991  /* Set Interrupt */
992  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
993  PartialDescriptor->Type = CmResourceTypeInterrupt;
994  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
995  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
996  PartialDescriptor->u.Interrupt.Level = 1;
997  PartialDescriptor->u.Interrupt.Vector = 1;
998  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
999 
1000  /* Set IO Port 0x60 */
1001  PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
1002  PartialDescriptor->Type = CmResourceTypePort;
1003  PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1004  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1005  PartialDescriptor->u.Port.Start.LowPart = 0x60;
1006  PartialDescriptor->u.Port.Start.HighPart = 0x0;
1007  PartialDescriptor->u.Port.Length = 1;
1008 
1009  /* Set IO Port 0x64 */
1010  PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
1011  PartialDescriptor->Type = CmResourceTypePort;
1012  PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1013  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1014  PartialDescriptor->u.Port.Start.LowPart = 0x64;
1015  PartialDescriptor->u.Port.Start.HighPart = 0x0;
1016  PartialDescriptor->u.Port.Length = 1;
1017 
1018  /* Create controller key */
1019  FldrCreateComponentKey(BusKey,
1021  KeyboardController,
1022  Input | ConsoleIn,
1023  0x0,
1024  0xFFFFFFFF,
1025  NULL,
1026  PartialResourceList,
1027  Size,
1028  &ControllerKey);
1029  TRACE("Created key: KeyboardController\\0\n");
1030 
1031  DetectKeyboardPeripheral(ControllerKey);
1032 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
Definition: arc.h:82
Definition: arc.h:84
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@374 Interrupt
#define CmResourceTypePort
Definition: hwresource.cpp:123
smooth NULL
Definition: ftsmooth.c:416
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@373 Port
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
static VOID DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: machpc.c:912
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectIsaBios().

◆ DetectKeyboardDevice()

BOOLEAN DetectKeyboardDevice ( VOID  )

Definition at line 843 of file machpc.c.

844 {
845  UCHAR Status;
846  UCHAR Scancode;
847  ULONG Loops;
848  BOOLEAN Result = TRUE;
849 
850  /* Identify device */
852 
853  /* Wait for reply */
854  for (Loops = 0; Loops < 100; Loops++)
855  {
859  break;
860  }
861 
863  {
864  /* PC/XT keyboard or no keyboard */
865  Result = FALSE;
866  }
867 
869  if (Scancode != 0xFA)
870  {
871  /* No ACK received */
872  Result = FALSE;
873  }
874 
876 
879  {
880  /* Found AT keyboard */
881  return Result;
882  }
883 
885  if (Scancode != 0xAB)
886  {
887  /* No 0xAB received */
888  Result = FALSE;
889  }
890 
892 
895  {
896  /* No byte in buffer */
897  Result = FALSE;
898  }
899 
901  if (Scancode != 0x41)
902  {
903  /* No 0x41 received */
904  Result = FALSE;
905  }
906 
907  /* Found MF-II keyboard */
908  return Result;
909 }
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:64
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: hardware.c:55
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define CONTROLLER_REGISTER_DATA
Definition: machpc.c:47
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
#define CONTROLLER_REGISTER_STATUS
Definition: machpc.c:45

◆ DetectKeyboardPeripheral()

static VOID DetectKeyboardPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey)
static

Definition at line 912 of file machpc.c.

913 {
914  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
915  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
916  PCM_KEYBOARD_DEVICE_DATA KeyboardData;
917  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
918  ULONG Size;
919 
920  /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2
921  if (DetectKeyboardDevice()) */
922  {
923  /* Set 'Configuration Data' value */
924  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
925  sizeof(CM_KEYBOARD_DEVICE_DATA);
926  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
927  if (PartialResourceList == NULL)
928  {
929  ERR("Failed to allocate resource descriptor\n");
930  return;
931  }
932 
933  /* Initialize resource descriptor */
934  memset(PartialResourceList, 0, Size);
935  PartialResourceList->Version = 1;
936  PartialResourceList->Revision = 1;
937  PartialResourceList->Count = 1;
938 
939  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
940  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
941  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
942  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
943 
944  KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
945  KeyboardData->Version = 1;
946  KeyboardData->Revision = 1;
947  KeyboardData->Type = 4;
948  KeyboardData->Subtype = 0;
949  KeyboardData->KeyboardFlags = 0x20;
950 
951  /* Create controller key */
952  FldrCreateComponentKey(ControllerKey,
954  KeyboardPeripheral,
955  Input | ConsoleIn,
956  0x0,
957  0xFFFFFFFF,
958  "PCAT_ENHANCED",
959  PartialResourceList,
960  Size,
961  &PeripheralKey);
962  TRACE("Created key: KeyboardPeripheral\\0\n");
963  }
964 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
GLint x0
Definition: linetemp.h:95
Definition: arc.h:82
Definition: arc.h:84
smooth NULL
Definition: ftsmooth.c:416
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@380 DeviceSpecificData
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
struct _CM_KEYBOARD_DEVICE_DATA CM_KEYBOARD_DEVICE_DATA
unsigned int ULONG
Definition: retypes.h:1
struct _CM_KEYBOARD_DEVICE_DATA * PCM_KEYBOARD_DEVICE_DATA
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectKeyboardController().

◆ DetectParallelPorts()

static VOID DetectParallelPorts ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 751 of file machpc.c.

752 {
753  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
754  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
755  ULONG Irq[MAX_LPT_PORTS] = {7, 5, (ULONG) - 1};
756  CHAR Buffer[80];
757  PCONFIGURATION_COMPONENT_DATA ControllerKey;
758  PUSHORT BasePtr;
759  ULONG Base;
760  ULONG ControllerNumber = 0;
761  ULONG i;
762  ULONG Size;
763 
764  TRACE("DetectParallelPorts() called\n");
765 
766  /*
767  * The BIOS data area 0x408 holds the address of the first valid LPT port.
768  * Each LPT port address is stored in a 2-byte field.
769  * Infos at: http://www.bioscentral.com/misc/bda.htm
770  */
771  BasePtr = (PUSHORT)0x408;
772 
773  for (i = 0; i < MAX_LPT_PORTS; i++, BasePtr++)
774  {
775  Base = (ULONG) * BasePtr;
776  if (Base == 0)
777  continue;
778 
779  TRACE("Parallel port %u: %x\n", ControllerNumber, Base);
780 
781  /* Set 'Identifier' value */
782  sprintf(Buffer, "PARALLEL%ld", i + 1);
783 
784  /* Build full device descriptor */
785  Size = sizeof(CM_PARTIAL_RESOURCE_LIST);
786  if (Irq[i] != (ULONG) - 1)
788 
789  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
790  if (PartialResourceList == NULL)
791  {
792  ERR("Failed to allocate resource descriptor\n");
793  continue;
794  }
795  memset(PartialResourceList, 0, Size);
796 
797  /* Initialize resource descriptor */
798  PartialResourceList->Version = 1;
799  PartialResourceList->Revision = 1;
800  PartialResourceList->Count = (Irq[i] != (ULONG) - 1) ? 2 : 1;
801 
802  /* Set IO Port */
803  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
804  PartialDescriptor->Type = CmResourceTypePort;
806  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
807  PartialDescriptor->u.Port.Start.LowPart = Base;
808  PartialDescriptor->u.Port.Start.HighPart = 0x0;
809  PartialDescriptor->u.Port.Length = 3;
810 
811  /* Set Interrupt */
812  if (Irq[i] != (ULONG) - 1)
813  {
814  PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
815  PartialDescriptor->Type = CmResourceTypeInterrupt;
816  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
817  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
818  PartialDescriptor->u.Interrupt.Level = Irq[i];
819  PartialDescriptor->u.Interrupt.Vector = Irq[i];
820  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
821  }
822 
823  /* Create controller key */
824  FldrCreateComponentKey(BusKey,
826  ParallelController,
827  Output,
828  ControllerNumber,
829  0xFFFFFFFF,
830  Buffer,
831  PartialResourceList,
832  Size,
833  &ControllerKey);
834 
835  ControllerNumber++;
836  }
837 
838  TRACE("DetectParallelPorts() done\n");
839 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define MAX_LPT_PORTS
Definition: machpc.c:28
char CHAR
Definition: xmlstorage.h:175
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2343
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@374 Interrupt
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@373 Port
Definition: bufpool.h:45
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
Definition: arc.h:85
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
unsigned short * PUSHORT
Definition: retypes.h:2
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectIsaBios().

◆ DetectPnpBios()

static VOID DetectPnpBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 179 of file machpc.c.

180 {
181  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
185  ULONG x;
186  ULONG NodeSize = 0;
187  ULONG NodeCount = 0;
189  ULONG FoundNodeCount;
190  int i;
191  ULONG PnpBufferSize;
192  ULONG PnpBufferSizeLimit;
193  ULONG Size;
194  char *Ptr;
195 
197  if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
198  {
199  TRACE("PnP-BIOS not supported\n");
200  return;
201  }
202 
203  TRACE("PnP-BIOS supported\n");
204  TRACE("Signature '%c%c%c%c'\n",
205  InstData->Signature[0], InstData->Signature[1],
206  InstData->Signature[2], InstData->Signature[3]);
207 
208  x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
209  if (x == 0x82)
210  {
211  TRACE("PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
212  return;
213  }
214 
215  NodeCount &= 0xFF; // needed since some fscked up BIOSes return
216  // wrong info (e.g. Mac Virtual PC)
217  // e.g. look: http://my.execpc.com/~geezer/osd/pnp/pnp16.c
218  if (x != 0 || NodeSize == 0 || NodeCount == 0)
219  {
220  ERR("PnP-BIOS failed to enumerate device nodes\n");
221  return;
222  }
223  TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
224  TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
225 
226  /* Set 'Configuration Data' value */
227  PnpBufferSizeLimit = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)
228  + (NodeSize * NodeCount);
229  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSizeLimit;
230  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
231  if (PartialResourceList == NULL)
232  {
233  ERR("Failed to allocate resource descriptor\n");
234  return;
235  }
236  memset(PartialResourceList, 0, Size);
237 
238  /* Initialize resource descriptor */
239  PartialResourceList->Version = 1;
240  PartialResourceList->Revision = 1;
241  PartialResourceList->Count = 1;
242  PartialResourceList->PartialDescriptors[0].Type =
244  PartialResourceList->PartialDescriptors[0].ShareDisposition =
246 
247  /* The buffer starts after PartialResourceList->PartialDescriptors[0] */
248  Ptr = (char *)(PartialResourceList + 1);
249 
250  /* Set installation check data */
251  memcpy (Ptr, InstData, sizeof(CM_PNP_BIOS_INSTALLATION_CHECK));
253  PnpBufferSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK);
254 
255  /* Copy device nodes */
256  FoundNodeCount = 0;
257  for (i = 0; i < 0xFF; i++)
258  {
259  NodeNumber = (UCHAR)i;
260 
262  if (x == 0)
263  {
265 
266  TRACE("Node: %u Size %u (0x%x)\n",
267  DeviceNode->Node,
268  DeviceNode->Size,
269  DeviceNode->Size);
270 
271  if (PnpBufferSize + DeviceNode->Size > PnpBufferSizeLimit)
272  {
273  ERR("Buffer too small! Ignoring remaining device nodes.\n");
274  break;
275  }
276 
277  memcpy(Ptr, DeviceNode, DeviceNode->Size);
278 
279  Ptr += DeviceNode->Size;
280  PnpBufferSize += DeviceNode->Size;
281 
282  FoundNodeCount++;
283  if (FoundNodeCount >= NodeCount)
284  break;
285  }
286  }
287 
288  /* Set real data size */
289  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
290  PnpBufferSize;
291  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
292 
293  TRACE("Real buffer size: %u\n", PnpBufferSize);
294  TRACE("Resource size: %u\n", Size);
295 
296  /* Create component key */
297  FldrCreateComponentKey(SystemKey,
298  AdapterClass,
299  MultiFunctionAdapter,
300  0x0,
301  0x0,
302  0xFFFFFFFF,
303  "PNP BIOS",
304  PartialResourceList,
305  Size,
306  &BusKey);
307 
308  (*BusNumber)++;
309 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
GLint x0
Definition: linetemp.h:95
#define DiskReadBuffer
Definition: hardware.h:33
struct _CM_PNP_BIOS_INSTALLATION_CHECK * PCM_PNP_BIOS_INSTALLATION_CHECK
char CHAR
Definition: xmlstorage.h:175
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
_Out_ PUSHORT NodeNumber
Definition: iofuncs.h:2567
ULONG __cdecl PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
ULONG __cdecl PnpBiosGetDeviceNodeCount(ULONG *NodeSize, ULONG *NodeCount)
struct _CM_PNP_BIOS_INSTALLATION_CHECK CM_PNP_BIOS_INSTALLATION_CHECK
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
Definition: Node.h:9
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@380 DeviceSpecificData
unsigned char UCHAR
Definition: xmlstorage.h:181
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
ULONG_PTR __cdecl PnpBiosSupported(VOID)
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by PcHwDetect().

◆ DetectPS2AuxDevice()

static BOOLEAN DetectPS2AuxDevice ( VOID  )
static

Definition at line 1097 of file machpc.c.

1098 {
1099  UCHAR Scancode;
1100  UCHAR Status;
1101  ULONG Loops;
1102  BOOLEAN Result = TRUE;
1103 
1108 
1109  /* Identify device */
1111 
1112  /* Wait for reply */
1113  for (Loops = 0; Loops < 100; Loops++)
1114  {
1115  StallExecutionProcessor(10000);
1118  break;
1119  }
1120 
1123  Result = FALSE;
1124 
1126  if (Scancode != 0xFA)
1127  Result = FALSE;
1128 
1129  StallExecutionProcessor(10000);
1130 
1133  Result = FALSE;
1134 
1136  if (Scancode != 0x00)
1137  Result = FALSE;
1138 
1139  return Result;
1140 }
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:64
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: hardware.c:55
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define CONTROLLER_COMMAND_WRITE_MOUSE
Definition: machpc.c:61
static VOID PS2ControllerWait(VOID)
Definition: machpc.c:1036
#define CONTROLLER_REGISTER_DATA
Definition: machpc.c:47
#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL
Definition: machpc.c:69
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
#define CONTROLLER_REGISTER_STATUS
Definition: machpc.c:45
#define CONTROLLER_REGISTER_CONTROL
Definition: machpc.c:46

Referenced by DetectPS2Mouse().

◆ DetectPS2AuxPort()

static BOOLEAN DetectPS2AuxPort ( VOID  )
static

Definition at line 1054 of file machpc.c.

1055 {
1056 #if 1
1057  /* Current detection is too unreliable. Just do as if
1058  * the PS/2 aux port is always present
1059  */
1060  return TRUE;
1061 #else
1062  ULONG Loops;
1063  UCHAR Status;
1064 
1065  /* Put the value 0x5A in the output buffer using the
1066  * "WriteAuxiliary Device Output Buffer" command (0xD3).
1067  * Poll the Status Register for a while to see if the value really turns up
1068  * in the Data Register. If the KEYBOARD_STATUS_MOUSE_OBF bit is also set
1069  * to 1 in the Status Register, we assume this controller has an
1070  * Auxiliary Port (a.k.a. Mouse Port).
1071  */
1076 
1077  /* 0x5A is a random dummy value */
1079  0x5A);
1080 
1081  for (Loops = 0; Loops < 10; Loops++)
1082  {
1083  StallExecutionProcessor(10000);
1086  break;
1087  }
1088 
1090 
1092 #endif
1093 }
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:64
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: hardware.c:55
static VOID PS2ControllerWait(VOID)
Definition: machpc.c:1036
#define CONTROLLER_REGISTER_DATA
Definition: machpc.c:47
#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL
Definition: machpc.c:69
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
#define CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER
Definition: machpc.c:60
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
#define CONTROLLER_REGISTER_STATUS
Definition: machpc.c:45
#define CONTROLLER_REGISTER_CONTROL
Definition: machpc.c:46

Referenced by DetectPS2Mouse().

◆ DetectPS2Mouse()

static VOID DetectPS2Mouse ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 1146 of file machpc.c.

1147 {
1148  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1149  PCONFIGURATION_COMPONENT_DATA ControllerKey;
1150  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1151  ULONG Size;
1152 
1153  if (DetectPS2AuxPort())
1154  {
1155  TRACE("Detected PS2 port\n");
1156 
1157  PartialResourceList = FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST), TAG_HW_RESOURCE_LIST);
1158  if (PartialResourceList == NULL)
1159  {
1160  ERR("Failed to allocate resource descriptor\n");
1161  return;
1162  }
1163  memset(PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
1164 
1165  /* Initialize resource descriptor */
1166  PartialResourceList->Version = 1;
1167  PartialResourceList->Revision = 1;
1168  PartialResourceList->Count = 1;
1169 
1170  /* Set Interrupt */
1171  PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeInterrupt;
1173  PartialResourceList->PartialDescriptors[0].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1174  PartialResourceList->PartialDescriptors[0].u.Interrupt.Level = 12;
1175  PartialResourceList->PartialDescriptors[0].u.Interrupt.Vector = 12;
1176  PartialResourceList->PartialDescriptors[0].u.Interrupt.Affinity = 0xFFFFFFFF;
1177 
1178  /* Create controller key */
1179  FldrCreateComponentKey(BusKey,
1181  PointerController,
1182  Input,
1183  0x0,
1184  0xFFFFFFFF,
1185  NULL,
1186  PartialResourceList,
1187  sizeof(CM_PARTIAL_RESOURCE_LIST),
1188  &ControllerKey);
1189  TRACE("Created key: PointerController\\0\n");
1190 
1191  if (DetectPS2AuxDevice())
1192  {
1193  TRACE("Detected PS2 mouse\n");
1194 
1195  /* Initialize resource descriptor */
1196  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1198  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1199  if (PartialResourceList == NULL)
1200  {
1201  ERR("Failed to allocate resource descriptor\n");
1202  return;
1203  }
1204  memset(PartialResourceList, 0, Size);
1205  PartialResourceList->Version = 1;
1206  PartialResourceList->Revision = 1;
1207  PartialResourceList->Count = 0;
1208 
1209  /* Create peripheral key */
1210  FldrCreateComponentKey(ControllerKey,
1212  PointerPeripheral,
1213  Input,
1214  0x0,
1215  0xFFFFFFFF,
1216  "MICROSOFT PS2 MOUSE",
1217  PartialResourceList,
1218  Size,
1219  &PeripheralKey);
1220  TRACE("Created key: PointerPeripheral\\0\n");
1221  }
1222  }
1223 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
Definition: arc.h:84
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@374 Interrupt
static BOOLEAN DetectPS2AuxDevice(VOID)
Definition: machpc.c:1097
static BOOLEAN DetectPS2AuxPort(VOID)
Definition: machpc.c:1054
smooth NULL
Definition: ftsmooth.c:416
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectIsaBios().

◆ DetectSerialMouse()

static ULONG DetectSerialMouse ( PUCHAR  Port)
static

Definition at line 327 of file machpc.c.

328 {
329  CHAR Buffer[4];
330  ULONG i;
331  ULONG TimeOut;
332  UCHAR LineControl;
333 
334  /* Shutdown mouse or something like that */
335  LineControl = READ_PORT_UCHAR(Port + 4);
336  WRITE_PORT_UCHAR(Port + 4, (LineControl & ~0x02) | 0x01);
337  StallExecutionProcessor(100000);
338 
339  /*
340  * Clear buffer
341  * Maybe there is no serial port although BIOS reported one (this
342  * is the case on Apple hardware), or the serial port is misbehaving,
343  * therefore we must give up after some time.
344  */
345  TimeOut = 200;
346  while (READ_PORT_UCHAR(Port + 5) & 0x01)
347  {
348  if (--TimeOut == 0)
349  return MOUSE_TYPE_NONE;
351  }
352 
353  /*
354  * Send modem control with 'Data Terminal Ready', 'Request To Send' and
355  * 'Output Line 2' message. This enables mouse to identify.
356  */
357  WRITE_PORT_UCHAR(Port + 4, 0x0b);
358 
359  /* Wait 10 milliseconds for the mouse getting ready */
361 
362  /* Read first four bytes, which contains Microsoft Mouse signs */
363  TimeOut = 20;
364  for (i = 0; i < 4; i++)
365  {
366  while ((READ_PORT_UCHAR(Port + 5) & 1) == 0)
367  {
369  --TimeOut;
370  if (TimeOut == 0)
371  return MOUSE_TYPE_NONE;
372  }
374  }
375 
376  TRACE("Mouse data: %x %x %x %x\n",
377  Buffer[0], Buffer[1], Buffer[2], Buffer[3]);
378 
379  /* Check that four bytes for signs */
380  for (i = 0; i < 4; ++i)
381  {
382  if (Buffer[i] == 'B')
383  {
384  /* Sign for Microsoft Ballpoint */
385 // DbgPrint("Microsoft Ballpoint device detected\n");
386 // DbgPrint("THIS DEVICE IS NOT SUPPORTED, YET\n");
387  return MOUSE_TYPE_NONE;
388  }
389  else if (Buffer[i] == 'M')
390  {
391  /* Sign for Microsoft Mouse protocol followed by button specifier */
392  if (i == 3)
393  {
394  /* Overflow Error */
395  return MOUSE_TYPE_NONE;
396  }
397 
398  switch (Buffer[i + 1])
399  {
400  case '3':
401  TRACE("Microsoft Mouse with 3-buttons detected\n");
402  return MOUSE_TYPE_LOGITECH;
403 
404  case 'Z':
405  TRACE("Microsoft Wheel Mouse detected\n");
406  return MOUSE_TYPE_WHEELZ;
407 
408  /* case '2': */
409  default:
410  TRACE("Microsoft Mouse with 2-buttons detected\n");
411  return MOUSE_TYPE_MICROSOFT;
412  }
413  }
414  }
415 
416  return MOUSE_TYPE_NONE;
417 }
CPPORT Port[4]
Definition: headless.c:34
char CHAR
Definition: xmlstorage.h:175
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MOUSE_TYPE_MICROSOFT
Definition: machpc.c:33
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: hardware.c:55
Definition: bufpool.h:45
#define MOUSE_TYPE_NONE
Definition: machpc.c:31
#define TRACE(s)
Definition: solgame.cpp:4
#define MOUSE_TYPE_WHEELZ
Definition: machpc.c:37
unsigned char UCHAR
Definition: xmlstorage.h:181
#define MOUSE_TYPE_LOGITECH
Definition: machpc.c:35
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by DetectSerialPointerPeripheral().

◆ DetectSerialPointerPeripheral()

static VOID DetectSerialPointerPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey,
PUCHAR  Base 
)
static

Definition at line 480 of file machpc.c.

482 {
483  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
484  char Buffer[256];
485  CHAR Identifier[256];
486  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
487  ULONG MouseType;
488  ULONG Size, Length;
489  ULONG i;
490  ULONG j;
491  ULONG k;
492 
493  TRACE("DetectSerialPointerPeripheral()\n");
494 
495  Identifier[0] = 0;
496 
498  MouseType = DetectSerialMouse(Base);
499 
500  if (MouseType != MOUSE_TYPE_NONE)
501  {
503  TRACE( "PnP ID length: %u\n", Length);
504 
505  if (Length != 0)
506  {
507  /* Convert PnP sting to ASCII */
508  if (Buffer[0] == 0x08)
509  {
510  for (i = 0; i < Length; i++)
511  Buffer[i] += 0x20;
512  }
513  Buffer[Length] = 0;
514 
515  TRACE("PnP ID string: %s\n", Buffer);
516 
517  /* Copy PnpId string */
518  for (i = 0; i < 7; i++)
519  {
520  Identifier[i] = Buffer[3 + i];
521  }
522  memcpy(&Identifier[7],
523  L" - ",
524  3 * sizeof(WCHAR));
525 
526  /* Skip device serial number */
527  i = 10;
528  if (Buffer[i] == '\\')
529  {
530  for (j = ++i; i < Length; ++i)
531  {
532  if (Buffer[i] == '\\')
533  break;
534  }
535  if (i >= Length)
536  i -= 3;
537  }
538 
539  /* Skip PnP class */
540  if (Buffer[i] == '\\')
541  {
542  for (j = ++i; i < Length; ++i)
543  {
544  if (Buffer[i] == '\\')
545  break;
546  }
547 
548  if (i >= Length)
549  i -= 3;
550  }
551 
552  /* Skip compatible PnP Id */
553  if (Buffer[i] == '\\')
554  {
555  for (j = ++i; i < Length; ++i)
556  {
557  if (Buffer[i] == '\\')
558  break;
559  }
560  if (Buffer[j] == '*')
561  ++j;
562  if (i >= Length)
563  i -= 3;
564  }
565 
566  /* Get product description */
567  if (Buffer[i] == '\\')
568  {
569  for (j = ++i; i < Length; ++i)
570  {
571  if (Buffer[i] == ';')
572  break;
573  }
574  if (i >= Length)
575  i -= 3;
576  if (i > j + 1)
577  {
578  for (k = 0; k < i - j; k++)
579  {
580  Identifier[k + 10] = Buffer[k + j];
581  }
582  Identifier[10 + (i - j)] = 0;
583  }
584  }
585 
586  TRACE("Identifier string: %s\n", Identifier);
587  }
588 
589  if (Length == 0 || strlen(Identifier) < 11)
590  {
591  switch (MouseType)
592  {
593  case MOUSE_TYPE_LOGITECH:
594  strcpy(Identifier, "LOGITECH SERIAL MOUSE");
595  break;
596 
597  case MOUSE_TYPE_WHEELZ:
598  strcpy(Identifier, "MICROSOFT SERIAL MOUSE WITH WHEEL");
599  break;
600 
602  default:
603  strcpy(Identifier, "MICROSOFT SERIAL MOUSE");
604  break;
605  }
606  }
607 
608  /* Set 'Configuration Data' value */
609  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
611  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
612  if (PartialResourceList == NULL)
613  {
614  ERR("Failed to allocate resource descriptor\n");
615  return;
616  }
617  memset(PartialResourceList, 0, Size);
618  PartialResourceList->Version = 1;
619  PartialResourceList->Revision = 1;
620  PartialResourceList->Count = 0;
621 
622  /* Create 'PointerPeripheral' key */
623  FldrCreateComponentKey(ControllerKey,
625  PointerPeripheral,
626  Input,
627  0x0,
628  0xFFFFFFFF,
629  Identifier,
630  PartialResourceList,
631  Size,
632  &PeripheralKey);
633 
634  TRACE("Created key: PointerPeripheral\\0\n");
635  }
636 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2343
Definition: arc.h:84
static ULONG GetSerialMousePnpId(PUCHAR Port, char *Buffer)
Definition: machpc.c:420
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MOUSE_TYPE_MICROSOFT
Definition: machpc.c:33
static ULONG DetectSerialMouse(PUCHAR Port)
Definition: machpc.c:327
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define MOUSE_TYPE_NONE
Definition: machpc.c:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
#define MOUSE_TYPE_WHEELZ
Definition: machpc.c:37
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static VOID InitializeSerialPort(PUCHAR Port, UCHAR LineControl)
Definition: machpc.c:313
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
#define MOUSE_TYPE_LOGITECH
Definition: machpc.c:35
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
int k
Definition: mpi.c:3369
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectSerialPorts().

◆ DetectSerialPorts()

VOID DetectSerialPorts ( PCONFIGURATION_COMPONENT_DATA  BusKey,
GET_SERIAL_PORT  MachGetSerialPort,
ULONG  Count 
)

Definition at line 656 of file machpc.c.

657 {
658  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
659  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
660  PCM_SERIAL_DEVICE_DATA SerialDeviceData;
661  ULONG Irq;
662  ULONG Base;
663  CHAR Buffer[80];
664  ULONG ControllerNumber = 0;
665  PCONFIGURATION_COMPONENT_DATA ControllerKey;
666  ULONG i;
667  ULONG Size;
668 
669  TRACE("DetectSerialPorts()\n");
670 
671  for (i = 0; i < Count; i++)
672  {
673  Base = MachGetSerialPort(i, &Irq);
674  if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
675  continue;
676 
677  TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
678 
679  /* Set 'Identifier' value */
680  sprintf(Buffer, "COM%ld", i + 1);
681 
682  /* Build full device descriptor */
683  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
684  2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
685  sizeof(CM_SERIAL_DEVICE_DATA);
686  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
687  if (PartialResourceList == NULL)
688  {
689  ERR("Failed to allocate resource descriptor\n");
690  continue;
691  }
692  memset(PartialResourceList, 0, Size);
693 
694  /* Initialize resource descriptor */
695  PartialResourceList->Version = 1;
696  PartialResourceList->Revision = 1;
697  PartialResourceList->Count = 3;
698 
699  /* Set IO Port */
700  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
701  PartialDescriptor->Type = CmResourceTypePort;
703  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
704  PartialDescriptor->u.Port.Start.LowPart = Base;
705  PartialDescriptor->u.Port.Start.HighPart = 0x0;
706  PartialDescriptor->u.Port.Length = 7;
707 
708  /* Set Interrupt */
709  PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
710  PartialDescriptor->Type = CmResourceTypeInterrupt;
711  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
712  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
713  PartialDescriptor->u.Interrupt.Level = Irq;
714  PartialDescriptor->u.Interrupt.Vector = Irq;
715  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
716 
717  /* Set serial data (device specific) */
718  PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
719  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
720  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
721  PartialDescriptor->Flags = 0;
722  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
723 
724  SerialDeviceData =
725  (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
726  SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
727 
728  /* Create controller key */
729  FldrCreateComponentKey(BusKey,
731  SerialController,
733  ControllerNumber,
734  0xFFFFFFFF,
735  Buffer,
736  PartialResourceList,
737  Size,
738  &ControllerKey);
739 
741  {
742  /* Detect serial mouse */
744  }
745 
746  ControllerNumber++;
747  }
748 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
Definition: arc.h:82
char CHAR
Definition: xmlstorage.h:175
struct _CM_SERIAL_DEVICE_DATA CM_SERIAL_DEVICE_DATA
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2343
Definition: arc.h:84
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@374 Interrupt
static VOID DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
Definition: machpc.c:480
BOOLEAN Rs232PortInUse(PUCHAR Base)
Definition: rs232.c:132
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:227
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@373 Port
Definition: bufpool.h:45
#define UlongToPtr(u)
Definition: config.h:106
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@380 DeviceSpecificData
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
Definition: arc.h:85
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, IN PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
Definition: arc.h:83
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectIsaBios().

◆ GetSerialMousePnpId()

static ULONG GetSerialMousePnpId ( PUCHAR  Port,
char Buffer 
)
static

Definition at line 420 of file machpc.c.

421 {
422  ULONG TimeOut;
423  ULONG i = 0;
424  char c;
425  char x;
426 
427  WRITE_PORT_UCHAR(Port + 4, 0x09);
428 
429  /* Wait 10 milliseconds for the mouse getting ready */
431 
432  WRITE_PORT_UCHAR(Port + 4, 0x0b);
433 
435 
436  for (;;)
437  {
438  TimeOut = 200;
439  while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
440  {
442  --TimeOut;
443  if (TimeOut == 0)
444  {
445  return 0;
446  }
447  }
448 
450  if (c == 0x08 || c == 0x28)
451  break;
452  }
453 
454  Buffer[i++] = c;
455  x = c + 1;
456 
457  for (;;)
458  {
459  TimeOut = 200;
460  while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
461  {
463  --TimeOut;
464  if (TimeOut == 0)
465  return 0;
466  }
468  Buffer[i++] = c;
469  if (c == x)
470  break;
471  if (i >= 256)
472  break;
473  }
474 
475  return i;
476 }
CPPORT Port[4]
Definition: headless.c:34
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: hardware.c:55
Definition: bufpool.h:45
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by DetectSerialPointerPeripheral().

◆ InitializeSerialPort()

static VOID InitializeSerialPort ( PUCHAR  Port,
UCHAR  LineControl 
)
static

Definition at line 313 of file machpc.c.

315 {
316  WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */
317  WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */
318  WRITE_PORT_UCHAR(Port + 1, 0); /* speed HI byte */
319  WRITE_PORT_UCHAR(Port + 3, LineControl);
320  WRITE_PORT_UCHAR(Port + 1, 0); /* set comm and DLAB to 0 */
321  WRITE_PORT_UCHAR(Port + 4, 0x09); /* DR int enable */
322  READ_PORT_UCHAR(Port + 5); /* clear error bits */
323 }
CPPORT Port[4]
Definition: headless.c:34
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by DetectSerialPointerPeripheral().

◆ PcGetExtendedBIOSData()

VOID PcGetExtendedBIOSData ( PULONG  ExtendedBIOSDataArea,
PULONG  ExtendedBIOSDataSize 
)

Definition at line 80 of file machpc.c.

81 {
82  REGS BiosRegs;
83 
84  /* Get address and size of the extended BIOS data area */
85  BiosRegs.d.eax = 0xC100;
86  Int386(0x15, &BiosRegs, &BiosRegs);
87  if (INT386_SUCCESS(BiosRegs))
88  {
89  *ExtendedBIOSDataArea = BiosRegs.w.es << 4;
90  *ExtendedBIOSDataSize = 1024;
91  }
92  else
93  {
94  WARN("Int 15h AH=C1h call failed\n");
97  }
98 }
#define ExtendedBIOSDataSize
Definition: winldr.c:421
#define WARN(fmt,...)
Definition: debug.h:111
unsigned long eax
Definition: pcbios.h:79
unsigned short es
Definition: pcbios.h:109
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
#define ExtendedBIOSDataArea
Definition: winldr.c:420
DWORDREGS d
Definition: pcbios.h:149
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

Referenced by PcMachInit().

◆ PcGetFloppyCount()

static UCHAR PcGetFloppyCount ( VOID  )
static

Definition at line 1340 of file machpc.c.

1341 {
1342  UCHAR Data;
1343 
1344  WRITE_PORT_UCHAR((PUCHAR)0x70, 0x10);
1345  Data = READ_PORT_UCHAR((PUCHAR)0x71);
1346 
1347  return ((Data & 0xF0) ? 1 : 0) + ((Data & 0x0F) ? 1 : 0);
1348 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
unsigned char UCHAR
Definition: xmlstorage.h:181
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by PcMachInit().

◆ PcGetHarddiskConfigurationData()

static PCM_PARTIAL_RESOURCE_LIST PcGetHarddiskConfigurationData ( UCHAR  DriveNumber,
ULONG pSize 
)
static

Definition at line 104 of file machpc.c.

105 {
106  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
107  PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
108  EXTENDED_GEOMETRY ExtGeometry;
109  GEOMETRY Geometry;
110  ULONG Size;
111 
112  //
113  // Initialize returned size
114  //
115  *pSize = 0;
116 
117  /* Set 'Configuration Data' value */
118  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
120  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
121  if (PartialResourceList == NULL)
122  {
123  ERR("Failed to allocate resource descriptor\n");
124  return NULL;
125  }
126 
127  memset(PartialResourceList, 0, Size);
128  PartialResourceList->Version = 1;
129  PartialResourceList->Revision = 1;
130  PartialResourceList->Count = 1;
131  PartialResourceList->PartialDescriptors[0].Type =
133 // PartialResourceList->PartialDescriptors[0].ShareDisposition =
134 // PartialResourceList->PartialDescriptors[0].Flags =
135  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
137 
138  /* Get pointer to geometry data */
139  DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
140 
141  /* Get the disk geometry */
142  ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
143  if (DiskGetExtendedDriveParameters(DriveNumber, &ExtGeometry, ExtGeometry.Size))
144  {
145  DiskGeometry->BytesPerSector = ExtGeometry.BytesPerSector;
146  DiskGeometry->NumberOfCylinders = ExtGeometry.Cylinders;
147  DiskGeometry->SectorsPerTrack = ExtGeometry.SectorsPerTrack;
148  DiskGeometry->NumberOfHeads = ExtGeometry.Heads;
149  }
150  else if (PcDiskGetDriveGeometry(DriveNumber, &Geometry))
151  {
152  DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
153  DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
154  DiskGeometry->SectorsPerTrack = Geometry.Sectors;
155  DiskGeometry->NumberOfHeads = Geometry.Heads;
156  }
157  else
158  {
159  TRACE("Reading disk geometry failed\n");
160  FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
161  return NULL;
162  }
163  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
164  DriveNumber,
165  DiskGeometry->NumberOfCylinders,
166  DiskGeometry->NumberOfHeads,
167  DiskGeometry->SectorsPerTrack,
168  DiskGeometry->BytesPerSector);
169 
170  //
171  // Return configuration data
172  //
173  *pSize = Size;
174  return PartialResourceList;
175 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:170
ULONG Cylinders
Definition: disk.h:26
ULONG Cylinders
Definition: disk.h:41
uint32_t ULONG_PTR
Definition: typedefs.h:63
ULONG SectorsPerTrack
Definition: disk.h:43
BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize)
Definition: pcdisk.c:493
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:566
smooth NULL
Definition: ftsmooth.c:416
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
void * PVOID
Definition: retypes.h:9
ULONG Sectors
Definition: disk.h:28
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@380 DeviceSpecificData
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
USHORT Size
Definition: disk.h:39
#define ERR(fmt,...)
Definition: debug.h:109
ULONG BytesPerSector
Definition: disk.h:29
USHORT BytesPerSector
Definition: disk.h:45
ULONG Heads
Definition: disk.h:42
Definition: disk.h:24
struct _EXTENDED_GEOMETRY EXTENDED_GEOMETRY
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
struct _CM_DISK_GEOMETRY_DEVICE_DATA CM_DISK_GEOMETRY_DEVICE_DATA
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26
ULONG Heads
Definition: disk.h:27

Referenced by PcHwDetect().

◆ PcGetSerialPort()

ULONG PcGetSerialPort ( ULONG  Index,
PULONG  Irq 
)

Definition at line 639 of file machpc.c.

640 {
641  static const ULONG PcIrq[MAX_COM_PORTS] = {4, 3, 4, 3};
642  PUSHORT BasePtr;
643 
644  /*
645  * The BIOS data area 0x400 holds the address of the first valid COM port.
646  * Each COM port address is stored in a 2-byte field.
647  * Infos at: http://www.bioscentral.com/misc/bda.htm
648  */
649  BasePtr = (PUSHORT)0x400;
650  *Irq = PcIrq[Index];
651 
652  return (ULONG) *(BasePtr + Index);
653 }
static const UCHAR Index[8]
Definition: usbohci.c:18
#define MAX_COM_PORTS
Definition: machpc.c:27
unsigned int ULONG
Definition: retypes.h:1
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by DetectIsaBios().

◆ PcHwDetect()

Definition at line 1351 of file machpc.c.

1352 {
1354  ULONG BusNumber = 0;
1355 
1356  TRACE("DetectHardware()\n");
1357 
1358  /* Create the 'System' key */
1359  FldrCreateSystemKey(&SystemKey);
1360  // TODO: Discover and set the machine type as the Component->Identifier
1361 
1364 
1365  /* Detect buses */
1366  DetectPciBios(SystemKey, &BusNumber);
1367  DetectApmBios(SystemKey, &BusNumber);
1368  DetectPnpBios(SystemKey, &BusNumber);
1369  DetectIsaBios(SystemKey, &BusNumber); // TODO: Detect first EISA or MCA, before ISA
1370  DetectAcpiBios(SystemKey, &BusNumber);
1371 
1372  // TODO: Collect the ROM blocks from 0xC0000 to 0xF0000 and append their
1373  // CM_ROM_BLOCK data into the 'System' key's configuration data.
1374 
1375  TRACE("DetectHardware() Done\n");
1376  return SystemKey;
1377 }
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: hardware.c:40
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
static PCM_PARTIAL_RESOURCE_LIST PcGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machpc.c:104
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define TRACE(s)
Definition: solgame.cpp:4
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machpc.c:179
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwacpi.c:54
static VOID DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machpc.c:1290
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: hwpci.c:80
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwapm.c:57

Referenced by PcMachInit().

◆ PcHwIdle()

VOID PcHwIdle ( VOID  )

Definition at line 1380 of file machpc.c.

1381 {
1382  REGS Regs;
1383 
1384  /* Select APM 1.0+ function */
1385  Regs.b.ah = 0x53;
1386 
1387  /* Function 05h: CPU idle */
1388  Regs.b.al = 0x05;
1389 
1390  /* Call INT 15h */
1391  Int386(0x15, &Regs, &Regs);
1392 
1393  /* Check if successfull (CF set on error) */
1394  if (INT386_SUCCESS(Regs))
1395  return;
1396 
1397  /*
1398  * No futher processing here.
1399  * Optionally implement HLT instruction handling.
1400  */
1401 }
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
Definition: pcbios.h:146

Referenced by PcMachInit().

◆ PcMachInit()

VOID PcMachInit ( const char CmdLine)

Definition at line 1407 of file machpc.c.

1408 {
1409  /* Setup vtbl */
1426  MachVtbl.Beep = PcBeep;
1438 }
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID PcVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pcvideo.c:974
VOID PcVideoSync(VOID)
Definition: pcvideo.c:1136
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:77
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: pcdisk.c:626
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:468
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1033
VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pcvideo.c:1008
VOID PcGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machpc.c:80
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
VOID PcVideoClearScreen(UCHAR Attr)
Definition: pcvideo.c:1087
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:566
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap(ULONG *MemoryMapSize)
Definition: pcmem.c:594
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: pcdisk.c:456
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
Definition: pcvideo.c:886
BOOLEAN PcConsKbHit(VOID)
Definition: pccons.c:69
BOOLEAN PcVideoIsPaletteFixed(VOID)
Definition: pcvideo.c:1112
VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pcvideo.c:1118
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID)
Definition: machpc.c:1351
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: pcvideo.c:1103
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
VOID PcBeep(VOID)
Definition: i386rtl.c:25
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pcvideo.c:944
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
int(* ConsGetCh)(VOID)
Definition: machine.h:43
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
MACHVTBL MachVtbl
Definition: arcemul.c:21
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID PcHwIdle(VOID)
Definition: machpc.c:1380
static UCHAR PcGetFloppyCount(VOID)
Definition: machpc.c:1340
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pcvideo.c:1046
VOID(* VideoSync)(VOID)
Definition: machine.h:57
VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pcvideo.c:1127
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
TIMEINFO * PcGetTime(VOID)
Definition: pcrtc.c:24
VOID(* Beep)(VOID)
Definition: machine.h:58
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:968
int PcConsGetCh(void)
Definition: pccons.c:90
VOID PcPrepareForReactOS(VOID)
Definition: machpc.c:1441
VOID PcConsPutChar(int Ch)
Definition: pccons.c:28
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51

Referenced by MachInit().

◆ PcPrepareForReactOS()

VOID PcPrepareForReactOS ( VOID  )

Definition at line 1441 of file machpc.c.

1442 {
1443  /* On PC, prepare video and turn off the floppy motor */
1445  DiskStopFloppyMotor();
1446 }
VOID PcVideoPrepareForReactOS(VOID)
Definition: pcvideo.c:1159

Referenced by PcMachInit().

◆ PS2ControllerWait()

static VOID PS2ControllerWait ( VOID  )
static

Definition at line 1036 of file machpc.c.

1037 {
1038  ULONG Timeout;
1039  UCHAR Status;
1040 
1041  for (Timeout = 0; Timeout < CONTROLLER_TIMEOUT; Timeout++)
1042  {
1045  return;
1046 
1047  /* Sleep for one millisecond */
1049  }
1050 }
#define CONTROLLER_STATUS_INPUT_BUFFER_FULL
Definition: machpc.c:65
#define CONTROLLER_TIMEOUT
Definition: machpc.c:76
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: hardware.c:55
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
static ULONG Timeout
Definition: ping.c:61
unsigned int ULONG
Definition: retypes.h:1
#define CONTROLLER_REGISTER_STATUS
Definition: machpc.c:45

Referenced by DetectPS2AuxDevice(), and DetectPS2AuxPort().