ReactOS  0.4.15-dev-1389-g828d5fa
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 __cdecl ChainLoadBiosBootSectorCode (IN UCHAR BootDrive OPTIONAL, IN ULONG BootPartition OPTIONAL)
 
VOID MachInit (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 pcvesa.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:112
unsigned short cx
Definition: pcbios.h:107
unsigned short es
Definition: pcbios.h:115
unsigned char ah
Definition: pcbios.h:126
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:128
BYTEREGS b
Definition: pcbios.h:157
unsigned char al
Definition: pcbios.h:125
unsigned short ax
Definition: pcbios.h:105
Definition: pcbios.h:152
unsigned short di
Definition: pcbios.h:111
WORDREGS w
Definition: pcbios.h:156

Referenced by DetectDisplayController().

◆ BiosIsVesaSupported()

USHORT BiosIsVesaSupported ( VOID  )

Definition at line 160 of file pcvesa.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: pcvesa.c:47
#define BIOSCALLBUFFER
Definition: x86common.h:12
#define WARN(fmt,...)
Definition: debug.h:112
ULONG ProductRevisionStringPtr
Definition: pcvesa.c:46
unsigned short es
Definition: pcbios.h:115
unsigned char ah
Definition: pcbios.h:126
int __cdecl Int386(int ivec, REGS *in, REGS *out)
ULONG OemNamePtr
Definition: pcvesa.c:32
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
UCHAR Signature[4]
Definition: pcvesa.c:28
ULONG Capabilities
Definition: pcvesa.c:34
#define TRACE(s)
Definition: solgame.cpp:4
ULONG ProductNamePtr
Definition: pcvesa.c:45
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
struct VESA_SVGA_INFO * PVESA_SVGA_INFO
BYTEREGS b
Definition: pcbios.h:157
unsigned char al
Definition: pcbios.h:125
#define ERR(fmt,...)
Definition: debug.h:110
unsigned short ax
Definition: pcbios.h:105
USHORT VesaVersion
Definition: pcvesa.c:31
Definition: pcbios.h:152
USHORT OemSoftwareVersion
Definition: pcvesa.c:43
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
USHORT TotalVideoMemory
Definition: pcvesa.c:37
ULONG VendorNamePtr
Definition: pcvesa.c:44
unsigned short di
Definition: pcbios.h:111
WORDREGS w
Definition: pcbios.h:156

Referenced by DetectDisplayController().

◆ BiosVesaReadEdid()

BOOLEAN BiosVesaReadEdid ( VOID  )

Definition at line 272 of file pcvesa.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:108
#define BIOSCALLBUFFER
Definition: x86common.h:12
#define WARN(fmt,...)
Definition: debug.h:112
unsigned short cx
Definition: pcbios.h:107
unsigned short es
Definition: pcbios.h:115
unsigned char ah
Definition: pcbios.h:126
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define FALSE
Definition: types.h:117
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:128
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
BYTEREGS b
Definition: pcbios.h:157
unsigned char al
Definition: pcbios.h:125
unsigned short ax
Definition: pcbios.h:105
Definition: pcbios.h:152
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
unsigned short di
Definition: pcbios.h:111
WORDREGS w
Definition: pcbios.h:156

Referenced by DetectDisplayController().

◆ ChainLoadBiosBootSectorCode()

VOID __cdecl ChainLoadBiosBootSectorCode ( IN UCHAR BootDrive  OPTIONAL,
IN ULONG BootPartition  OPTIONAL 
)

Definition at line 1420 of file machpc.c.

1423 {
1424  REGS Regs;
1425 
1426  RtlZeroMemory(&Regs, sizeof(Regs));
1427 
1428  /* Set the boot drive and the boot partition */
1429  Regs.b.dl = (UCHAR)(BootDrive ? BootDrive : FrldrBootDrive);
1430  Regs.b.dh = (UCHAR)(BootPartition ? BootPartition : FrldrBootPartition);
1431 
1432  /*
1433  * Don't stop the floppy drive motor when we are just booting a bootsector,
1434  * a drive, or a partition. If we were to stop the floppy motor, the BIOS
1435  * wouldn't be informed and if the next read is to a floppy then the BIOS
1436  * will still think the motor is on and this will result in a read error.
1437  */
1438  // DiskStopFloppyMotor();
1439 
1440  Relocator16Boot(&Regs,
1441  /* Stack segment:pointer */
1442  0x0000, 0x7C00,
1443  /* Code segment:pointer */
1444  0x0000, 0x7C00);
1445 }
unsigned char dh
Definition: pcbios.h:135
unsigned char dl
Definition: pcbios.h:134
ULONG FrldrBootPartition
unsigned char UCHAR
Definition: xmlstorage.h:181
BYTEREGS b
Definition: pcbios.h:157
UCHAR FrldrBootDrive
VOID __cdecl Relocator16Boot(IN REGS *In, IN USHORT StackSegment, IN USHORT StackPointer, IN USHORT CodeSegment, IN USHORT CodePointer)
Definition: pcbios.h:152
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectDisplayController()

static VOID DetectDisplayController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 1245 of file machpc.c.

1246 {
1247  CHAR Buffer[80];
1248  PCONFIGURATION_COMPONENT_DATA ControllerKey;
1249  USHORT VesaVersion;
1250 
1251  /* FIXME: Set 'ComponentInformation' value */
1252 
1253  VesaVersion = BiosIsVesaSupported();
1254  if (VesaVersion != 0)
1255  {
1256  TRACE("VESA version %c.%c\n",
1257  (VesaVersion >> 8) + '0',
1258  (VesaVersion & 0xFF) + '0');
1259  }
1260  else
1261  {
1262  TRACE("VESA not supported\n");
1263  }
1264 
1265  if (VesaVersion >= 0x0200)
1266  {
1267  strcpy(Buffer, "VBE Display");
1268  }
1269  else
1270  {
1271  strcpy(Buffer, "VGA Display");
1272  }
1273 
1274  FldrCreateComponentKey(BusKey,
1276  DisplayController,
1277  0x0,
1278  0x0,
1279  0xFFFFFFFF,
1280  Buffer,
1281  NULL,
1282  0,
1283  &ControllerKey);
1284  TRACE("Created key: DisplayController\\0\n");
1285 
1286  /* FIXME: Add display peripheral (monitor) data */
1287  if (VesaVersion != 0)
1288  {
1289  if (BiosIsVesaDdcSupported())
1290  {
1291  TRACE("VESA/DDC supported!\n");
1292  if (BiosVesaReadEdid())
1293  {
1294  TRACE("EDID data read successfully!\n");
1295 
1296  }
1297  }
1298  }
1299 }
GLint x0
Definition: linetemp.h:95
char CHAR
Definition: xmlstorage.h:175
BOOLEAN BiosIsVesaDdcSupported(VOID)
Definition: pcvesa.c:242
Definition: bufpool.h:45
BOOLEAN BiosVesaReadEdid(VOID)
Definition: pcvesa.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
#define NULL
Definition: types.h:112
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
USHORT BiosIsVesaSupported(VOID)
Definition: pcvesa.c:160

Referenced by DetectIsaBios().

◆ DetectIsaBios()

static VOID DetectIsaBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 1303 of file machpc.c.

1304 {
1305  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1307  ULONG Size;
1308 
1309  /* Set 'Configuration Data' value */
1310  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1312  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1313  if (PartialResourceList == NULL)
1314  {
1315  ERR("Failed to allocate resource descriptor\n");
1316  return;
1317  }
1318 
1319  /* Initialize resource descriptor */
1320  memset(PartialResourceList, 0, Size);
1321  PartialResourceList->Version = 1;
1322  PartialResourceList->Revision = 1;
1323  PartialResourceList->Count = 0;
1324 
1325  /* Create new bus key */
1326  FldrCreateComponentKey(SystemKey,
1327  AdapterClass,
1328  MultiFunctionAdapter,
1329  0x0,
1330  0x0,
1331  0xFFFFFFFF,
1332  "ISA",
1333  PartialResourceList,
1334  Size,
1335  &BusKey);
1336 
1337  /* Increment bus number */
1338  (*BusNumber)++;
1339 
1340  /* Detect ISA/BIOS devices */
1341  DetectBiosDisks(SystemKey, BusKey);
1343  DetectParallelPorts(BusKey);
1344  DetectKeyboardController(BusKey);
1345  DetectPS2Mouse(BusKey);
1346  DetectDisplayController(BusKey);
1347 
1348  /* FIXME: Detect more ISA devices */
1349 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pchw.c:344
GLint x0
Definition: linetemp.h:95
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey, GET_SERIAL_PORT MachGetSerialPort, ULONG Count)
Definition: machpc.c:659
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:981
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:754
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
static VOID DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1159
#define MAX_COM_PORTS
Definition: machpc.c:27
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:110
ULONG PcGetSerialPort(ULONG Index, PULONG Irq)
Definition: machpc.c:642
#define NULL
Definition: types.h:112
static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1245
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 981 of file machpc.c.

982 {
983  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
984  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
985  PCONFIGURATION_COMPONENT_DATA ControllerKey;
986  ULONG Size;
987 
988  /* Set 'Configuration Data' value */
989  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
990  2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
991  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
992  if (PartialResourceList == NULL)
993  {
994  ERR("Failed to allocate resource descriptor\n");
995  return;
996  }
997 
998  /* Initialize resource descriptor */
999  memset(PartialResourceList, 0, Size);
1000  PartialResourceList->Version = 1;
1001  PartialResourceList->Revision = 1;
1002  PartialResourceList->Count = 3;
1003 
1004  /* Set Interrupt */
1005  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
1006  PartialDescriptor->Type = CmResourceTypeInterrupt;
1007  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
1008  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1009  PartialDescriptor->u.Interrupt.Level = 1;
1010  PartialDescriptor->u.Interrupt.Vector = 1;
1011  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
1012 
1013  /* Set IO Port 0x60 */
1014  PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
1015  PartialDescriptor->Type = CmResourceTypePort;
1016  PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1017  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1018  PartialDescriptor->u.Port.Start.LowPart = 0x60;
1019  PartialDescriptor->u.Port.Start.HighPart = 0x0;
1020  PartialDescriptor->u.Port.Length = 1;
1021 
1022  /* Set IO Port 0x64 */
1023  PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
1024  PartialDescriptor->Type = CmResourceTypePort;
1025  PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1026  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1027  PartialDescriptor->u.Port.Start.LowPart = 0x64;
1028  PartialDescriptor->u.Port.Start.HighPart = 0x0;
1029  PartialDescriptor->u.Port.Length = 1;
1030 
1031  /* Create controller key */
1032  FldrCreateComponentKey(BusKey,
1034  KeyboardController,
1035  Input | ConsoleIn,
1036  0x0,
1037  0xFFFFFFFF,
1038  NULL,
1039  PartialResourceList,
1040  Size,
1041  &ControllerKey);
1042  TRACE("Created key: KeyboardController\\0\n");
1043 
1044  DetectKeyboardPeripheral(ControllerKey);
1045 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@388 Interrupt
Definition: arc.h:82
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@387 Port
#define CmResourceTypePort
Definition: hwresource.cpp:123
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 u
#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
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:110
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define NULL
Definition: types.h:112
#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:915
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 846 of file machpc.c.

847 {
848  UCHAR Status;
849  UCHAR Scancode;
850  ULONG Loops;
851  BOOLEAN Result = TRUE;
852 
853  /* Identify device */
855 
856  /* Wait for reply */
857  for (Loops = 0; Loops < 100; Loops++)
858  {
862  break;
863  }
864 
866  {
867  /* PC/XT keyboard or no keyboard */
868  Result = FALSE;
869  }
870 
872  if (Scancode != 0xFA)
873  {
874  /* No ACK received */
875  Result = FALSE;
876  }
877 
879 
882  {
883  /* Found AT keyboard */
884  return Result;
885  }
886 
888  if (Scancode != 0xAB)
889  {
890  /* No 0xAB received */
891  Result = FALSE;
892  }
893 
895 
898  {
899  /* No byte in buffer */
900  Result = FALSE;
901  }
902 
904  if (Scancode != 0x41)
905  {
906  /* No 0x41 received */
907  Result = FALSE;
908  }
909 
910  /* Found MF-II keyboard */
911  return Result;
912 }
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pchw.c:60
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:64
#define FALSE
Definition: types.h:117
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
Status
Definition: gdiplustypes.h:24
#define CONTROLLER_REGISTER_DATA
Definition: machpc.c:47
unsigned char UCHAR
Definition: xmlstorage.h:181
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
unsigned int ULONG
Definition: retypes.h:1
#define CONTROLLER_REGISTER_STATUS
Definition: machpc.c:45

◆ DetectKeyboardPeripheral()

static VOID DetectKeyboardPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey)
static

Definition at line 915 of file machpc.c.

916 {
917  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
918  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
919  PCM_KEYBOARD_DEVICE_DATA KeyboardData;
920  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
921  ULONG Size;
922  REGS Regs;
923 
924  /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2
925  if (DetectKeyboardDevice()) */
926  {
927  /* Set 'Configuration Data' value */
928  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
929  sizeof(CM_KEYBOARD_DEVICE_DATA);
930  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
931  if (PartialResourceList == NULL)
932  {
933  ERR("Failed to allocate resource descriptor\n");
934  return;
935  }
936 
937  /* Initialize resource descriptor */
938  memset(PartialResourceList, 0, Size);
939  PartialResourceList->Version = 1;
940  PartialResourceList->Revision = 1;
941  PartialResourceList->Count = 1;
942 
943  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
944  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
945  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
946  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
947 
948  /* Int 16h AH=02h
949  * KEYBOARD - GET SHIFT FLAGS
950  *
951  * Return:
952  * AL - shift flags
953  */
954  Regs.b.ah = 0x02;
955  Int386(0x16, &Regs, &Regs);
956 
957  KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
958  KeyboardData->Version = 1;
959  KeyboardData->Revision = 1;
960  KeyboardData->Type = 4;
961  KeyboardData->Subtype = 0;
962  KeyboardData->KeyboardFlags = Regs.b.al;
963 
964  /* Create controller key */
965  FldrCreateComponentKey(ControllerKey,
967  KeyboardPeripheral,
968  Input | ConsoleIn,
969  0x0,
970  0xFFFFFFFF,
971  "PCAT_ENHANCED",
972  PartialResourceList,
973  Size,
974  &PeripheralKey);
975  TRACE("Created key: KeyboardPeripheral\\0\n");
976  }
977 }
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
unsigned char ah
Definition: pcbios.h:126
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@394 DeviceSpecificData
int __cdecl Int386(int ivec, REGS *in, REGS *out)
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 u
#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
BYTEREGS b
Definition: pcbios.h:157
unsigned char al
Definition: pcbios.h:125
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:110
struct _CM_KEYBOARD_DEVICE_DATA CM_KEYBOARD_DEVICE_DATA
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
Definition: pcbios.h:152
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 754 of file machpc.c.

755 {
756  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
757  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
758  ULONG Irq[MAX_LPT_PORTS] = {7, 5, (ULONG) - 1};
759  CHAR Buffer[80];
760  PCONFIGURATION_COMPONENT_DATA ControllerKey;
761  PUSHORT BasePtr;
762  ULONG Base;
763  ULONG ControllerNumber = 0;
764  ULONG i;
765  ULONG Size;
766 
767  TRACE("DetectParallelPorts() called\n");
768 
769  /*
770  * The BIOS data area 0x408 holds the address of the first valid LPT port.
771  * Each LPT port address is stored in a 2-byte field.
772  * Infos at: http://www.bioscentral.com/misc/bda.htm
773  */
774  BasePtr = (PUSHORT)0x408;
775 
776  for (i = 0; i < MAX_LPT_PORTS; i++, BasePtr++)
777  {
778  Base = (ULONG) * BasePtr;
779  if (Base == 0)
780  continue;
781 
782  TRACE("Parallel port %u: %x\n", ControllerNumber, Base);
783 
784  /* Set 'Identifier' value */
785  sprintf(Buffer, "PARALLEL%ld", i + 1);
786 
787  /* Build full device descriptor */
788  Size = sizeof(CM_PARTIAL_RESOURCE_LIST);
789  if (Irq[i] != (ULONG) - 1)
791 
792  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
793  if (PartialResourceList == NULL)
794  {
795  ERR("Failed to allocate resource descriptor\n");
796  continue;
797  }
798  memset(PartialResourceList, 0, Size);
799 
800  /* Initialize resource descriptor */
801  PartialResourceList->Version = 1;
802  PartialResourceList->Revision = 1;
803  PartialResourceList->Count = (Irq[i] != (ULONG) - 1) ? 2 : 1;
804 
805  /* Set IO Port */
806  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
807  PartialDescriptor->Type = CmResourceTypePort;
809  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
810  PartialDescriptor->u.Port.Start.LowPart = Base;
811  PartialDescriptor->u.Port.Start.HighPart = 0x0;
812  PartialDescriptor->u.Port.Length = 3;
813 
814  /* Set Interrupt */
815  if (Irq[i] != (ULONG) - 1)
816  {
817  PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
818  PartialDescriptor->Type = CmResourceTypeInterrupt;
819  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
820  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
821  PartialDescriptor->u.Interrupt.Level = Irq[i];
822  PartialDescriptor->u.Interrupt.Vector = Irq[i];
823  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
824  }
825 
826  /* Create controller key */
827  FldrCreateComponentKey(BusKey,
829  ParallelController,
830  Output,
831  ControllerNumber,
832  0xFFFFFFFF,
833  Buffer,
834  PartialResourceList,
835  Size,
836  &ControllerKey);
837 
838  ControllerNumber++;
839  }
840 
841  TRACE("DetectParallelPorts() done\n");
842 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define MAX_LPT_PORTS
Definition: machpc.c:28
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@388 Interrupt
char CHAR
Definition: xmlstorage.h:175
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2373
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@387 Port
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define sprintf(buf, format,...)
Definition: sprintf.c:55
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 u
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
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:110
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 CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define NULL
Definition: types.h:112
#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 182 of file machpc.c.

183 {
184  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
188  ULONG x;
189  ULONG NodeSize = 0;
190  ULONG NodeCount = 0;
192  ULONG FoundNodeCount;
193  int i;
194  ULONG PnpBufferSize;
195  ULONG PnpBufferSizeLimit;
196  ULONG Size;
197  char *Ptr;
198 
200  if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
201  {
202  TRACE("PnP-BIOS not supported\n");
203  return;
204  }
205 
206  TRACE("PnP-BIOS supported\n");
207  TRACE("Signature '%c%c%c%c'\n",
208  InstData->Signature[0], InstData->Signature[1],
209  InstData->Signature[2], InstData->Signature[3]);
210 
211  x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
212  if (x == 0x82)
213  {
214  TRACE("PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
215  return;
216  }
217 
218  NodeCount &= 0xFF; // needed since some fscked up BIOSes return
219  // wrong info (e.g. Mac Virtual PC)
220  // e.g. look: http://my.execpc.com/~geezer/osd/pnp/pnp16.c
221  if (x != 0 || NodeSize == 0 || NodeCount == 0)
222  {
223  ERR("PnP-BIOS failed to enumerate device nodes\n");
224  return;
225  }
226  TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
227  TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
228 
229  /* Set 'Configuration Data' value */
230  PnpBufferSizeLimit = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)
231  + (NodeSize * NodeCount);
232  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSizeLimit;
233  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
234  if (PartialResourceList == NULL)
235  {
236  ERR("Failed to allocate resource descriptor\n");
237  return;
238  }
239  memset(PartialResourceList, 0, Size);
240 
241  /* Initialize resource descriptor */
242  PartialResourceList->Version = 1;
243  PartialResourceList->Revision = 1;
244  PartialResourceList->Count = 1;
245  PartialResourceList->PartialDescriptors[0].Type =
247  PartialResourceList->PartialDescriptors[0].ShareDisposition =
249 
250  /* The buffer starts after PartialResourceList->PartialDescriptors[0] */
251  Ptr = (char *)(PartialResourceList + 1);
252 
253  /* Set installation check data */
254  memcpy (Ptr, InstData, sizeof(CM_PNP_BIOS_INSTALLATION_CHECK));
256  PnpBufferSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK);
257 
258  /* Copy device nodes */
259  FoundNodeCount = 0;
260  for (i = 0; i < 0xFF; i++)
261  {
262  NodeNumber = (UCHAR)i;
263 
265  if (x == 0)
266  {
268 
269  TRACE("Node: %u Size %u (0x%x)\n",
270  DeviceNode->Node,
271  DeviceNode->Size,
272  DeviceNode->Size);
273 
274  if (PnpBufferSize + DeviceNode->Size > PnpBufferSizeLimit)
275  {
276  ERR("Buffer too small! Ignoring remaining device nodes.\n");
277  break;
278  }
279 
280  memcpy(Ptr, DeviceNode, DeviceNode->Size);
281 
282  Ptr += DeviceNode->Size;
283  PnpBufferSize += DeviceNode->Size;
284 
285  FoundNodeCount++;
286  if (FoundNodeCount >= NodeCount)
287  break;
288  }
289  }
290 
291  /* Set real data size */
292  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
293  PnpBufferSize;
294  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
295 
296  TRACE("Real buffer size: %u\n", PnpBufferSize);
297  TRACE("Resource size: %u\n", Size);
298 
299  /* Create component key */
300  FldrCreateComponentKey(SystemKey,
301  AdapterClass,
302  MultiFunctionAdapter,
303  0x0,
304  0x0,
305  0xFFFFFFFF,
306  "PNP BIOS",
307  PartialResourceList,
308  Size,
309  &BusKey);
310 
311  (*BusNumber)++;
312 }
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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@394 DeviceSpecificData
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
_Out_ PUSHORT NodeNumber
Definition: iofuncs.h:2570
ULONG __cdecl PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer)
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 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
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
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:110
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
ULONG_PTR __cdecl PnpBiosSupported(VOID)
#define NULL
Definition: types.h:112
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 1110 of file machpc.c.

1111 {
1112  UCHAR Scancode;
1113  UCHAR Status;
1114  ULONG Loops;
1115  BOOLEAN Result = TRUE;
1116 
1121 
1122  /* Identify device */
1124 
1125  /* Wait for reply */
1126  for (Loops = 0; Loops < 100; Loops++)
1127  {
1128  StallExecutionProcessor(10000);
1131  break;
1132  }
1133 
1136  Result = FALSE;
1137 
1139  if (Scancode != 0xFA)
1140  Result = FALSE;
1141 
1142  StallExecutionProcessor(10000);
1143 
1146  Result = FALSE;
1147 
1149  if (Scancode != 0x00)
1150  Result = FALSE;
1151 
1152  return Result;
1153 }
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pchw.c:60
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:64
#define FALSE
Definition: types.h:117
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
Status
Definition: gdiplustypes.h:24
#define CONTROLLER_COMMAND_WRITE_MOUSE
Definition: machpc.c:61
static VOID PS2ControllerWait(VOID)
Definition: machpc.c:1049
#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
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
unsigned int ULONG
Definition: retypes.h:1
#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 1067 of file machpc.c.

1068 {
1069 #if 1
1070  /* Current detection is too unreliable. Just do as if
1071  * the PS/2 aux port is always present
1072  */
1073  return TRUE;
1074 #else
1075  ULONG Loops;
1076  UCHAR Status;
1077 
1078  /* Put the value 0x5A in the output buffer using the
1079  * "WriteAuxiliary Device Output Buffer" command (0xD3).
1080  * Poll the Status Register for a while to see if the value really turns up
1081  * in the Data Register. If the KEYBOARD_STATUS_MOUSE_OBF bit is also set
1082  * to 1 in the Status Register, we assume this controller has an
1083  * Auxiliary Port (a.k.a. Mouse Port).
1084  */
1089 
1090  /* 0x5A is a random dummy value */
1092  0x5A);
1093 
1094  for (Loops = 0; Loops < 10; Loops++)
1095  {
1096  StallExecutionProcessor(10000);
1099  break;
1100  }
1101 
1103 
1105 #endif
1106 }
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pchw.c:60
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:64
Status
Definition: gdiplustypes.h:24
static VOID PS2ControllerWait(VOID)
Definition: machpc.c:1049
#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
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER
Definition: machpc.c:60
unsigned int ULONG
Definition: retypes.h:1
#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 1159 of file machpc.c.

1160 {
1161  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1162  PCONFIGURATION_COMPONENT_DATA ControllerKey;
1163  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1164  ULONG Size;
1165 
1166  if (DetectPS2AuxPort())
1167  {
1168  TRACE("Detected PS2 port\n");
1169 
1170  PartialResourceList = FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST), TAG_HW_RESOURCE_LIST);
1171  if (PartialResourceList == NULL)
1172  {
1173  ERR("Failed to allocate resource descriptor\n");
1174  return;
1175  }
1176  memset(PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
1177 
1178  /* Initialize resource descriptor */
1179  PartialResourceList->Version = 1;
1180  PartialResourceList->Revision = 1;
1181  PartialResourceList->Count = 1;
1182 
1183  /* Set Interrupt */
1184  PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeInterrupt;
1186  PartialResourceList->PartialDescriptors[0].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1187  PartialResourceList->PartialDescriptors[0].u.Interrupt.Level = 12;
1188  PartialResourceList->PartialDescriptors[0].u.Interrupt.Vector = 12;
1189  PartialResourceList->PartialDescriptors[0].u.Interrupt.Affinity = 0xFFFFFFFF;
1190 
1191  /* Create controller key */
1192  FldrCreateComponentKey(BusKey,
1194  PointerController,
1195  Input,
1196  0x0,
1197  0xFFFFFFFF,
1198  NULL,
1199  PartialResourceList,
1200  sizeof(CM_PARTIAL_RESOURCE_LIST),
1201  &ControllerKey);
1202  TRACE("Created key: PointerController\\0\n");
1203 
1204  if (DetectPS2AuxDevice())
1205  {
1206  TRACE("Detected PS2 mouse\n");
1207 
1208  /* Initialize resource descriptor */
1209  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1211  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1212  if (PartialResourceList == NULL)
1213  {
1214  ERR("Failed to allocate resource descriptor\n");
1215  return;
1216  }
1217  memset(PartialResourceList, 0, Size);
1218  PartialResourceList->Version = 1;
1219  PartialResourceList->Revision = 1;
1220  PartialResourceList->Count = 0;
1221 
1222  /* Create peripheral key */
1223  FldrCreateComponentKey(ControllerKey,
1225  PointerPeripheral,
1226  Input,
1227  0x0,
1228  0xFFFFFFFF,
1229  "MICROSOFT PS2 MOUSE",
1230  PartialResourceList,
1231  Size,
1232  &PeripheralKey);
1233  TRACE("Created key: PointerPeripheral\\0\n");
1234  }
1235  }
1236 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@388 Interrupt
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
static BOOLEAN DetectPS2AuxDevice(VOID)
Definition: machpc.c:1110
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 u
static BOOLEAN DetectPS2AuxPort(VOID)
Definition: machpc.c:1067
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
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:110
#define NULL
Definition: types.h:112
#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 330 of file machpc.c.

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

Referenced by DetectSerialPointerPeripheral().

◆ DetectSerialPointerPeripheral()

static VOID DetectSerialPointerPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey,
PUCHAR  Base 
)
static

Definition at line 483 of file machpc.c.

485 {
486  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
487  char Buffer[256];
488  CHAR Identifier[256];
489  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
490  ULONG MouseType;
491  ULONG Size, Length;
492  ULONG i;
493  ULONG j;
494  ULONG k;
495 
496  TRACE("DetectSerialPointerPeripheral()\n");
497 
498  Identifier[0] = 0;
499 
501  MouseType = DetectSerialMouse(Base);
502 
503  if (MouseType != MOUSE_TYPE_NONE)
504  {
506  TRACE( "PnP ID length: %u\n", Length);
507 
508  if (Length != 0)
509  {
510  /* Convert PnP sting to ASCII */
511  if (Buffer[0] == 0x08)
512  {
513  for (i = 0; i < Length; i++)
514  Buffer[i] += 0x20;
515  }
516  Buffer[Length] = 0;
517 
518  TRACE("PnP ID string: %s\n", Buffer);
519 
520  /* Copy PnpId string */
521  for (i = 0; i < 7; i++)
522  {
523  Identifier[i] = Buffer[3 + i];
524  }
525  memcpy(&Identifier[7],
526  L" - ",
527  3 * sizeof(WCHAR));
528 
529  /* Skip device serial number */
530  i = 10;
531  if (Buffer[i] == '\\')
532  {
533  for (j = ++i; i < Length; ++i)
534  {
535  if (Buffer[i] == '\\')
536  break;
537  }
538  if (i >= Length)
539  i -= 3;
540  }
541 
542  /* Skip PnP class */
543  if (Buffer[i] == '\\')
544  {
545  for (j = ++i; i < Length; ++i)
546  {
547  if (Buffer[i] == '\\')
548  break;
549  }
550 
551  if (i >= Length)
552  i -= 3;
553  }
554 
555  /* Skip compatible PnP Id */
556  if (Buffer[i] == '\\')
557  {
558  for (j = ++i; i < Length; ++i)
559  {
560  if (Buffer[i] == '\\')
561  break;
562  }
563  if (Buffer[j] == '*')
564  ++j;
565  if (i >= Length)
566  i -= 3;
567  }
568 
569  /* Get product description */
570  if (Buffer[i] == '\\')
571  {
572  for (j = ++i; i < Length; ++i)
573  {
574  if (Buffer[i] == ';')
575  break;
576  }
577  if (i >= Length)
578  i -= 3;
579  if (i > j + 1)
580  {
581  for (k = 0; k < i - j; k++)
582  {
583  Identifier[k + 10] = Buffer[k + j];
584  }
585  Identifier[10 + (i - j)] = 0;
586  }
587  }
588 
589  TRACE("Identifier string: %s\n", Identifier);
590  }
591 
592  if (Length == 0 || strlen(Identifier) < 11)
593  {
594  switch (MouseType)
595  {
596  case MOUSE_TYPE_LOGITECH:
597  strcpy(Identifier, "LOGITECH SERIAL MOUSE");
598  break;
599 
600  case MOUSE_TYPE_WHEELZ:
601  strcpy(Identifier, "MICROSOFT SERIAL MOUSE WITH WHEEL");
602  break;
603 
605  default:
606  strcpy(Identifier, "MICROSOFT SERIAL MOUSE");
607  break;
608  }
609  }
610 
611  /* Set 'Configuration Data' value */
612  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
614  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
615  if (PartialResourceList == NULL)
616  {
617  ERR("Failed to allocate resource descriptor\n");
618  return;
619  }
620  memset(PartialResourceList, 0, Size);
621  PartialResourceList->Version = 1;
622  PartialResourceList->Revision = 1;
623  PartialResourceList->Count = 0;
624 
625  /* Create 'PointerPeripheral' key */
626  FldrCreateComponentKey(ControllerKey,
628  PointerPeripheral,
629  Input,
630  0x0,
631  0xFFFFFFFF,
632  Identifier,
633  PartialResourceList,
634  Size,
635  &PeripheralKey);
636 
637  TRACE("Created key: PointerPeripheral\\0\n");
638  }
639 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:2373
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
static ULONG GetSerialMousePnpId(PUCHAR Port, char *Buffer)
Definition: machpc.c:423
#define MOUSE_TYPE_MICROSOFT
Definition: machpc.c:33
static ULONG DetectSerialMouse(PUCHAR Port)
Definition: machpc.c:330
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
static VOID InitializeSerialPort(PUCHAR Port, UCHAR LineControl)
Definition: machpc.c:316
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
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:110
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 NULL
Definition: types.h:112
#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 659 of file machpc.c.

660 {
661  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
662  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
663  PCM_SERIAL_DEVICE_DATA SerialDeviceData;
664  ULONG Irq;
665  ULONG Base;
666  CHAR Buffer[80];
667  ULONG ControllerNumber = 0;
668  PCONFIGURATION_COMPONENT_DATA ControllerKey;
669  ULONG i;
670  ULONG Size;
671 
672  TRACE("DetectSerialPorts()\n");
673 
674  for (i = 0; i < Count; i++)
675  {
676  Base = MachGetSerialPort(i, &Irq);
677  if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
678  continue;
679 
680  TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
681 
682  /* Set 'Identifier' value */
683  sprintf(Buffer, "COM%ld", i + 1);
684 
685  /* Build full device descriptor */
686  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
687  2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
688  sizeof(CM_SERIAL_DEVICE_DATA);
689  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
690  if (PartialResourceList == NULL)
691  {
692  ERR("Failed to allocate resource descriptor\n");
693  continue;
694  }
695  memset(PartialResourceList, 0, Size);
696 
697  /* Initialize resource descriptor */
698  PartialResourceList->Version = 1;
699  PartialResourceList->Revision = 1;
700  PartialResourceList->Count = 3;
701 
702  /* Set IO Port */
703  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
704  PartialDescriptor->Type = CmResourceTypePort;
706  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
707  PartialDescriptor->u.Port.Start.LowPart = Base;
708  PartialDescriptor->u.Port.Start.HighPart = 0x0;
709  PartialDescriptor->u.Port.Length = 8;
710 
711  /* Set Interrupt */
712  PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
713  PartialDescriptor->Type = CmResourceTypeInterrupt;
714  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
715  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
716  PartialDescriptor->u.Interrupt.Level = Irq;
717  PartialDescriptor->u.Interrupt.Vector = Irq;
718  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
719 
720  /* Set serial data (device specific) */
721  PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
722  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
723  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
724  PartialDescriptor->Flags = 0;
725  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
726 
727  SerialDeviceData =
728  (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
729  SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
730 
731  /* Create controller key */
732  FldrCreateComponentKey(BusKey,
734  SerialController,
736  ControllerNumber,
737  0xFFFFFFFF,
738  Buffer,
739  PartialResourceList,
740  Size,
741  &ControllerKey);
742 
744  {
745  /* Detect serial mouse */
747  }
748 
749  ControllerNumber++;
750  }
751 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@388 Interrupt
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:2373
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@394 DeviceSpecificData
static VOID DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
Definition: machpc.c:483
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@387 Port
BOOLEAN Rs232PortInUse(PUCHAR Base)
Definition: rs232.c:140
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:227
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 u
Definition: bufpool.h:45
#define UlongToPtr(u)
Definition: config.h:106
int Count
Definition: noreturn.cpp:7
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
Definition: arc.h:85
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:110
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 CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
Definition: arc.h:83
#define NULL
Definition: types.h:112
#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 423 of file machpc.c.

424 {
425  ULONG TimeOut;
426  ULONG i = 0;
427  char c;
428  char x;
429 
430  WRITE_PORT_UCHAR(Port + 4, 0x09);
431 
432  /* Wait 10 milliseconds for the mouse getting ready */
434 
435  WRITE_PORT_UCHAR(Port + 4, 0x0b);
436 
438 
439  for (;;)
440  {
441  TimeOut = 200;
442  while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
443  {
445  --TimeOut;
446  if (TimeOut == 0)
447  {
448  return 0;
449  }
450  }
451 
453  if (c == 0x08 || c == 0x28)
454  break;
455  }
456 
457  Buffer[i++] = c;
458  x = c + 1;
459 
460  for (;;)
461  {
462  TimeOut = 200;
463  while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
464  {
466  --TimeOut;
467  if (TimeOut == 0)
468  return 0;
469  }
471  Buffer[i++] = c;
472  if (c == x)
473  break;
474  if (i >= 256)
475  break;
476  }
477 
478  return i;
479 }
CPPORT Port[4]
Definition: headless.c:34
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pchw.c:60
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Definition: bufpool.h:45
const GLubyte * c
Definition: glext.h:8905
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
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 c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1

Referenced by DetectSerialPointerPeripheral().

◆ InitializeSerialPort()

static VOID InitializeSerialPort ( PUCHAR  Port,
UCHAR  LineControl 
)
static

Definition at line 316 of file machpc.c.

318 {
319  WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */
320  WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */
321  WRITE_PORT_UCHAR(Port + 1, 0); /* speed HI byte */
322  WRITE_PORT_UCHAR(Port + 3, LineControl);
323  WRITE_PORT_UCHAR(Port + 1, 0); /* set comm and DLAB to 0 */
324  WRITE_PORT_UCHAR(Port + 4, 0x09); /* DR int enable */
325  READ_PORT_UCHAR(Port + 5); /* clear error bits */
326 }
CPPORT Port[4]
Definition: headless.c:34
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21

Referenced by DetectSerialPointerPeripheral().

◆ MachInit()

VOID MachInit ( const char CmdLine)

Definition at line 1452 of file machpc.c.

1453 {
1454  memset(&MachVtbl, 0, sizeof(MACHVTBL));
1455 
1456  /* Setup vtbl */
1473  MachVtbl.Beep = PcBeep;
1485 
1487 }
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID PcVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pcvideo.c:976
VOID PcVideoSync(VOID)
Definition: pcvideo.c:1138
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:827
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:470
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1035
VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pcvideo.c:1010
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:1089
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:798
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:599
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
BOOLEAN PcDiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
Definition: pcdisk.c:758
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
Definition: pcvideo.c:888
BOOLEAN PcConsKbHit(VOID)
Definition: pccons.c:69
BOOLEAN PcVideoIsPaletteFixed(VOID)
Definition: pcvideo.c:1114
VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pcvideo.c:1120
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID)
Definition: machpc.c:1367
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:1105
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pcvideo.c:946
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 PcBeep(VOID)
Definition: pcbeep.c:34
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID HalpCalibrateStallExecution(VOID)
Definition: pchw.c:105
VOID PcHwIdle(VOID)
Definition: machpc.c:1397
static UCHAR PcGetFloppyCount(VOID)
Definition: machpc.c:1355
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pcvideo.c:1048
VOID(* VideoSync)(VOID)
Definition: machine.h:57
VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pcvideo.c:1129
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
#define memset(x, y, z)
Definition: compat.h:39
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:970
int PcConsGetCh(void)
Definition: pccons.c:90
VOID PcPrepareForReactOS(VOID)
Definition: machpc.c:1490
VOID PcConsPutChar(int Ch)
Definition: pccons.c:28
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51

◆ 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:112
unsigned long eax
Definition: pcbios.h:85
unsigned short es
Definition: pcbios.h:115
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define INT386_SUCCESS(regs)
Definition: pcbios.h:173
#define ExtendedBIOSDataArea
Definition: winldr.c:420
DWORDREGS d
Definition: pcbios.h:155
Definition: pcbios.h:152
WORDREGS w
Definition: pcbios.h:156

Referenced by MachInit().

◆ PcGetFloppyCount()

static UCHAR PcGetFloppyCount ( VOID  )
static

Definition at line 1355 of file machpc.c.

1356 {
1357  UCHAR Data;
1358 
1359  WRITE_PORT_UCHAR((PUCHAR)0x70, 0x10);
1360  Data = READ_PORT_UCHAR((PUCHAR)0x71);
1361 
1362  return ((Data & 0xF0) ? 1 : 0) + ((Data & 0x0F) ? 1 : 0);
1363 }
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
unsigned char * PUCHAR
Definition: retypes.h:3
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
unsigned char UCHAR
Definition: xmlstorage.h:181
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21

Referenced by MachInit().

◆ 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 #if 0 // This is somehow replaced by what PcDiskGetDriveGeometry() does internally.
143  ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
144  if (DiskGetExtendedDriveParameters(DriveNumber, &ExtGeometry, ExtGeometry.Size))
145  {
146  DiskGeometry->BytesPerSector = ExtGeometry.BytesPerSector;
147  DiskGeometry->NumberOfCylinders = ExtGeometry.Cylinders;
148  DiskGeometry->SectorsPerTrack = ExtGeometry.SectorsPerTrack;
149  DiskGeometry->NumberOfHeads = ExtGeometry.Heads;
150  }
151  else
152 #endif
153  if (PcDiskGetDriveGeometry(DriveNumber, &Geometry))
154  {
155  DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
156  DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
157  DiskGeometry->SectorsPerTrack = Geometry.Sectors;
158  DiskGeometry->NumberOfHeads = Geometry.Heads;
159  }
160  else
161  {
162  TRACE("Reading disk geometry failed\n");
163  FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
164  return NULL;
165  }
166  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
167  DriveNumber,
168  DiskGeometry->NumberOfCylinders,
169  DiskGeometry->NumberOfHeads,
170  DiskGeometry->SectorsPerTrack,
171  DiskGeometry->BytesPerSector);
172 
173  //
174  // Return configuration data
175  //
176  *pSize = Size;
177  return PartialResourceList;
178 }
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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385::@394 DeviceSpecificData
uint32_t ULONG_PTR
Definition: typedefs.h:65
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@385 u
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:798
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
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define ERR(fmt,...)
Definition: debug.h:110
ULONG BytesPerSector
Definition: disk.h:29
static BOOLEAN DiskGetExtendedDriveParameters(IN UCHAR DriveNumber, IN PPC_DISK_DRIVE DiskDrive, OUT PVOID Buffer, IN USHORT BufferSize)
Definition: pcdisk.c:294
Definition: disk.h:24
#define NULL
Definition: types.h:112
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 642 of file machpc.c.

643 {
644  static const ULONG PcIrq[MAX_COM_PORTS] = {4, 3, 4, 3};
645  PUSHORT BasePtr;
646 
647  /*
648  * The BIOS data area 0x400 holds the address of the first valid COM port.
649  * Each COM port address is stored in a 2-byte field.
650  * Infos at: http://www.bioscentral.com/misc/bda.htm
651  */
652  BasePtr = (PUSHORT)0x400;
653  *Irq = PcIrq[Index];
654 
655  return (ULONG) *(BasePtr + Index);
656 }
_In_ WDFCOLLECTION _In_ ULONG Index
#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 1367 of file machpc.c.

1368 {
1370  ULONG BusNumber = 0;
1371 
1372  TRACE("DetectHardware()\n");
1373 
1374  /* Create the 'System' key */
1375  FldrCreateSystemKey(&SystemKey);
1376  // TODO: Discover and set the other machine types
1377  FldrSetIdentifier(SystemKey, "AT/AT COMPATIBLE");
1378 
1381 
1382  /* Detect buses */
1383  DetectPciBios(SystemKey, &BusNumber);
1384  DetectApmBios(SystemKey, &BusNumber);
1385  DetectPnpBios(SystemKey, &BusNumber);
1386  DetectIsaBios(SystemKey, &BusNumber); // TODO: Detect first EISA or MCA, before ISA
1387  DetectAcpiBios(SystemKey, &BusNumber);
1388 
1389  // TODO: Collect the ROM blocks from 0xC0000 to 0xF0000 and append their
1390  // CM_ROM_BLOCK data into the 'System' key's configuration data.
1391 
1392  TRACE("DetectHardware() Done\n");
1393  return SystemKey;
1394 }
VOID NTAPI FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCHAR IdentifierString)
Definition: archwsup.c:56
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
static PCM_PARTIAL_RESOURCE_LIST PcGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machpc.c:104
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pchw.c:45
_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:182
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:1303
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:46

Referenced by MachInit().

◆ PcHwIdle()

VOID PcHwIdle ( VOID  )

Definition at line 1397 of file machpc.c.

1398 {
1399  REGS Regs;
1400 
1401  /* Select APM 1.0+ function */
1402  Regs.b.ah = 0x53;
1403 
1404  /* Function 05h: CPU idle */
1405  Regs.b.al = 0x05;
1406 
1407  /* Call INT 15h */
1408  Int386(0x15, &Regs, &Regs);
1409 
1410  /* Check if successfull (CF set on error) */
1411  if (INT386_SUCCESS(Regs))
1412  return;
1413 
1414  /*
1415  * No futher processing here.
1416  * Optionally implement HLT instruction handling.
1417  */
1418 }
unsigned char ah
Definition: pcbios.h:126
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define INT386_SUCCESS(regs)
Definition: pcbios.h:173
BYTEREGS b
Definition: pcbios.h:157
unsigned char al
Definition: pcbios.h:125
Definition: pcbios.h:152

Referenced by MachInit().

◆ PcPrepareForReactOS()

VOID PcPrepareForReactOS ( VOID  )

Definition at line 1490 of file machpc.c.

1491 {
1492  /* On PC, prepare video and turn off the floppy motor */
1495 }
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1244
VOID PcVideoPrepareForReactOS(VOID)
Definition: pcvideo.c:1161

Referenced by MachInit().

◆ PS2ControllerWait()

static VOID PS2ControllerWait ( VOID  )
static

Definition at line 1049 of file machpc.c.

1050 {
1051  ULONG Timeout;
1052  UCHAR Status;
1053 
1054  for (Timeout = 0; Timeout < CONTROLLER_TIMEOUT; Timeout++)
1055  {
1058  return;
1059 
1060  /* Sleep for one millisecond */
1062  }
1063 }
#define CONTROLLER_STATUS_INPUT_BUFFER_FULL
Definition: machpc.c:65
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pchw.c:60
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define CONTROLLER_TIMEOUT
Definition: machpc.c:76
unsigned char * PUCHAR
Definition: retypes.h:3
Status
Definition: gdiplustypes.h:24
unsigned char UCHAR
Definition: xmlstorage.h:181
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().