ReactOS 0.4.16-dev-2104-gb84fa49
machpc.c
Go to the documentation of this file.
1/*
2 * FreeLoader
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#include <freeldr.h>
20#include <cportlib/cportlib.h>
21
22#include "../ntldr/ntldropts.h"
23
24#include <debug.h>
26
27
28/* Maximum number of COM and LPT ports */
29#define MAX_COM_PORTS 4
30#define MAX_LPT_PORTS 3
31
32/* No Mouse */
33#define MOUSE_TYPE_NONE 0
34/* Microsoft Mouse with 2 buttons */
35#define MOUSE_TYPE_MICROSOFT 1
36/* Logitech Mouse with 3 buttons */
37#define MOUSE_TYPE_LOGITECH 2
38/* Microsoft Wheel Mouse (aka Z Mouse) */
39#define MOUSE_TYPE_WHEELZ 3
40/* Mouse Systems Mouse */
41#define MOUSE_TYPE_MOUSESYSTEMS 4
42
43#define INPORT_REGISTER_CONTROL 0x00
44#define INPORT_REGISTER_DATA 0x01
45#define INPORT_REGISTER_SIGNATURE 0x02
46
47#define INPORT_REG_MODE 0x07
48#define INPORT_RESET 0x80
49#define INPORT_MODE_BASE 0x10
50#define INPORT_TEST_IRQ 0x16
51#define INPORT_SIGNATURE 0xDE
52
53#define PIC1_CONTROL_PORT 0x20
54#define PIC1_DATA_PORT 0x21
55#define PIC2_CONTROL_PORT 0xA0
56#define PIC2_DATA_PORT 0xA1
57
58/* PS2 stuff */
59
60/* Controller registers. */
61#define CONTROLLER_REGISTER_STATUS 0x64
62#define CONTROLLER_REGISTER_CONTROL 0x64
63#define CONTROLLER_REGISTER_DATA 0x60
64
65/* Controller commands. */
66#define CONTROLLER_COMMAND_READ_MODE 0x20
67#define CONTROLLER_COMMAND_WRITE_MODE 0x60
68#define CONTROLLER_COMMAND_GET_VERSION 0xA1
69#define CONTROLLER_COMMAND_MOUSE_DISABLE 0xA7
70#define CONTROLLER_COMMAND_MOUSE_ENABLE 0xA8
71#define CONTROLLER_COMMAND_TEST_MOUSE 0xA9
72#define CONTROLLER_COMMAND_SELF_TEST 0xAA
73#define CONTROLLER_COMMAND_KEYBOARD_TEST 0xAB
74#define CONTROLLER_COMMAND_KEYBOARD_DISABLE 0xAD
75#define CONTROLLER_COMMAND_KEYBOARD_ENABLE 0xAE
76#define CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER 0xD3
77#define CONTROLLER_COMMAND_WRITE_MOUSE 0xD4
78
79/* Controller status */
80#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL 0x01
81#define CONTROLLER_STATUS_INPUT_BUFFER_FULL 0x02
82#define CONTROLLER_STATUS_SELF_TEST 0x04
83#define CONTROLLER_STATUS_COMMAND 0x08
84#define CONTROLLER_STATUS_UNLOCKED 0x10
85#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL 0x20
86#define CONTROLLER_STATUS_GENERAL_TIMEOUT 0x40
87#define CONTROLLER_STATUS_PARITY_ERROR 0x80
88#define AUX_STATUS_OUTPUT_BUFFER_FULL (CONTROLLER_STATUS_OUTPUT_BUFFER_FULL | \
89 CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL)
90
91/* Timeout in ms for sending to keyboard controller. */
92#define CONTROLLER_TIMEOUT 250
93
94#include <pshpack1.h>
95typedef struct _PNP_DOCK_INFO
96{
101#include <poppack.h>
102
103/* FIXME: Abstract things better so we don't need to place define here */
104#if !defined(SARCH_XBOX)
105
106VOID
108{
109 REGS BiosRegs;
110
111 /* Get address and size of the extended BIOS data area */
112 BiosRegs.d.eax = 0xC100;
113 Int386(0x15, &BiosRegs, &BiosRegs);
114 if (INT386_SUCCESS(BiosRegs))
115 {
116 *ExtendedBIOSDataArea = BiosRegs.w.es << 4;
117 *ExtendedBIOSDataSize = 1024;
118 }
119 else
120 {
121 WARN("Int 15h AH=C1h call failed\n");
124 }
125}
126
127// NOTE: Similar to machxbox.c!XboxGetHarddiskConfigurationData(),
128// but with extended geometry support.
129static
132{
133 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
135 GEOMETRY Geometry;
136 ULONG Size;
137
138 /* Initialize returned size */
139 *pSize = 0;
140
141 /* Set 'Configuration Data' value */
144 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
145 if (PartialResourceList == NULL)
146 {
147 ERR("Failed to allocate resource descriptor\n");
148 return NULL;
149 }
150
151 RtlZeroMemory(PartialResourceList, Size);
152 PartialResourceList->Version = 1;
153 PartialResourceList->Revision = 1;
154 PartialResourceList->Count = 1;
155 PartialResourceList->PartialDescriptors[0].Type =
157// PartialResourceList->PartialDescriptors[0].ShareDisposition =
158// PartialResourceList->PartialDescriptors[0].Flags =
159 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
161
162 /* Get pointer to geometry data */
163 DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
164
165 /* Get the disk geometry */
166 if (PcDiskGetDriveGeometry(DriveNumber, &Geometry))
167 {
168 DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
169 DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
170 DiskGeometry->SectorsPerTrack = Geometry.SectorsPerTrack;
171 DiskGeometry->NumberOfHeads = Geometry.Heads;
172 }
173 else
174 {
175 TRACE("Reading disk geometry failed\n");
176 FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
177 return NULL;
178 }
179 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
180 DriveNumber,
181 DiskGeometry->NumberOfCylinders,
182 DiskGeometry->NumberOfHeads,
183 DiskGeometry->SectorsPerTrack,
184 DiskGeometry->BytesPerSector);
185
186 /* Return configuration data */
187 *pSize = Size;
188 return PartialResourceList;
189}
190
191static
192VOID
195{
196 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
197 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
198 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
199 PDOCKING_STATE_INFORMATION DockingState;
200 PPNP_DOCK_INFO DockInfo;
202
204
205 /* Build full device descriptor */
208 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
209 if (PartialResourceList == NULL)
210 {
211 ERR("Failed to allocate resource descriptor\n");
212 return;
213 }
214
215 /* Initialize resource descriptor */
216 RtlZeroMemory(PartialResourceList, Size);
217 PartialResourceList->Version = 0;
218 PartialResourceList->Revision = 0;
219 PartialResourceList->Count = 1;
220
221 /* Set device specific data */
222 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
223 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
225 PartialDescriptor->Flags = 0;
226 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(DOCKING_STATE_INFORMATION);
227
228 DockingState = (PDOCKING_STATE_INFORMATION)&PartialResourceList->PartialDescriptors[1];
229 DockingState->ReturnCode = Result;
230 if (Result == 0)
231 {
232 DockInfo = (PPNP_DOCK_INFO)DiskReadBuffer;
233 DockingState->DockLocationID = DockInfo->DockLocationID;
234 DockingState->SerialNumber = DockInfo->SerialNumber;
235 DockingState->Capabilities = DockInfo->Capabilities;
236 TRACE("System docked\n");
237 TRACE("Location: 0x%08lx\n", DockInfo->DockLocationID);
238 TRACE("Serial: 0x%08lx\n", DockInfo->SerialNumber);
239 TRACE("Capabilities: 0x%04hx\n", DockInfo->Capabilities);
240 }
241
242 /* Create controller key */
246 0,
247 0,
248 0xFFFFFFFF,
249 "Docking State Information",
250 PartialResourceList,
251 Size,
252 &PeripheralKey);
253}
254
255static
256VOID
258{
259 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
263 ULONG x;
264 ULONG NodeSize = 0;
265 ULONG NodeCount = 0;
267 ULONG FoundNodeCount;
268 int i;
269 ULONG PnpBufferSize;
270 ULONG PnpBufferSizeLimit;
271 ULONG Size;
272 char *Ptr;
273
275 if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
276 {
277 TRACE("PnP-BIOS not supported\n");
278 return;
279 }
280
281 TRACE("PnP-BIOS supported\n");
282 TRACE("Signature '%c%c%c%c'\n",
283 InstData->Signature[0], InstData->Signature[1],
284 InstData->Signature[2], InstData->Signature[3]);
285
286 x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
287 if (x == 0x82)
288 {
289 TRACE("PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
290 return;
291 }
292
293 NodeCount &= 0xFF; // needed since some fscked up BIOSes return
294 // wrong info (e.g. Mac Virtual PC)
295 // e.g. look: https://web.archive.org/web/20080329010332/http://my.execpc.com/~geezer/osd/pnp/pnp16.c
296 if (x != 0 || NodeSize == 0 || NodeCount == 0)
297 {
298 ERR("PnP-BIOS failed to enumerate device nodes\n");
299 return;
300 }
301 TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
302 TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
303
304 /* Set 'Configuration Data' value */
305 PnpBufferSizeLimit = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)
306 + (NodeSize * NodeCount);
307 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSizeLimit;
308 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
309 if (PartialResourceList == NULL)
310 {
311 ERR("Failed to allocate resource descriptor\n");
312 return;
313 }
314
315 /* Initialize resource descriptor */
316 RtlZeroMemory(PartialResourceList, Size);
317 PartialResourceList->Version = 1;
318 PartialResourceList->Revision = 1;
319 PartialResourceList->Count = 1;
320 PartialResourceList->PartialDescriptors[0].Type =
322 PartialResourceList->PartialDescriptors[0].ShareDisposition =
324
325 /* The buffer starts after PartialResourceList->PartialDescriptors[0] */
326 Ptr = (char *)(PartialResourceList + 1);
327
328 /* Set installation check data */
329 memcpy (Ptr, InstData, sizeof(CM_PNP_BIOS_INSTALLATION_CHECK));
331 PnpBufferSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK);
332
333 /* Copy device nodes */
334 FoundNodeCount = 0;
335 for (i = 0; i < 0xFF; i++)
336 {
337 NodeNumber = (UCHAR)i;
338
340 if (x == 0)
341 {
343
344 TRACE("Node: %u Size %u (0x%x)\n",
345 DeviceNode->Node,
346 DeviceNode->Size,
347 DeviceNode->Size);
348
349 if (PnpBufferSize + DeviceNode->Size > PnpBufferSizeLimit)
350 {
351 ERR("Buffer too small! Ignoring remaining device nodes. (i = %d)\n", i);
352 break;
353 }
354
356
357 Ptr += DeviceNode->Size;
358 PnpBufferSize += DeviceNode->Size;
359
360 FoundNodeCount++;
361 if (FoundNodeCount >= NodeCount)
362 break;
363 }
364 }
365
366 /* Set real data size */
367 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
368 PnpBufferSize;
369 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
370
371 TRACE("Real buffer size: %u\n", PnpBufferSize);
372 TRACE("Resource size: %u\n", Size);
373
374 /* Create component key */
375 FldrCreateComponentKey(SystemKey,
378 0,
379 0,
380 0xFFFFFFFF,
381 "PNP BIOS",
382 PartialResourceList,
383 Size,
384 &BusKey);
385
386 DetectDockingStation(BusKey);
387
388 (*BusNumber)++;
389}
390
391#endif // !SARCH_XBOX
392
393static
394VOID
396 UCHAR LineControl)
397{
398 WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */
399 WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */
400 WRITE_PORT_UCHAR(Port + 1, 0); /* speed HI byte */
401 WRITE_PORT_UCHAR(Port + 3, LineControl);
402 WRITE_PORT_UCHAR(Port + 1, 0); /* set comm and DLAB to 0 */
403 WRITE_PORT_UCHAR(Port + 4, 0x09); /* DR int enable */
404 READ_PORT_UCHAR(Port + 5); /* clear error bits */
405}
406
407static
408ULONG
410{
411 CHAR Buffer[4];
412 ULONG i;
413 ULONG TimeOut;
414 UCHAR LineControl;
415
416 /* Shutdown mouse or something like that */
417 LineControl = READ_PORT_UCHAR(Port + 4);
418 WRITE_PORT_UCHAR(Port + 4, (LineControl & ~0x02) | 0x01);
420
421 /*
422 * Clear buffer
423 * Maybe there is no serial port although BIOS reported one (this
424 * is the case on Apple hardware), or the serial port is misbehaving,
425 * therefore we must give up after some time.
426 */
427 TimeOut = 200;
428 while (READ_PORT_UCHAR(Port + 5) & 0x01)
429 {
430 if (--TimeOut == 0)
431 return MOUSE_TYPE_NONE;
433 }
434
435 /*
436 * Send modem control with 'Data Terminal Ready', 'Request To Send' and
437 * 'Output Line 2' message. This enables mouse to identify.
438 */
439 WRITE_PORT_UCHAR(Port + 4, 0x0b);
440
441 /* Wait 10 milliseconds for the mouse getting ready */
443
444 /* Read first four bytes, which contains Microsoft Mouse signs */
445 TimeOut = 20;
446 for (i = 0; i < 4; i++)
447 {
448 while ((READ_PORT_UCHAR(Port + 5) & 1) == 0)
449 {
451 --TimeOut;
452 if (TimeOut == 0)
453 return MOUSE_TYPE_NONE;
454 }
456 }
457
458 TRACE("Mouse data: %x %x %x %x\n",
459 Buffer[0], Buffer[1], Buffer[2], Buffer[3]);
460
461 /* Check that four bytes for signs */
462 for (i = 0; i < 4; ++i)
463 {
464 if (Buffer[i] == 'B')
465 {
466 /* Sign for Microsoft Ballpoint */
467// DbgPrint("Microsoft Ballpoint device detected\n");
468// DbgPrint("THIS DEVICE IS NOT SUPPORTED, YET\n");
469 return MOUSE_TYPE_NONE;
470 }
471 else if (Buffer[i] == 'M')
472 {
473 /* Sign for Microsoft Mouse protocol followed by button specifier */
474 if (i == 3)
475 {
476 /* Overflow Error */
477 return MOUSE_TYPE_NONE;
478 }
479
480 switch (Buffer[i + 1])
481 {
482 case '3':
483 TRACE("Microsoft Mouse with 3-buttons detected\n");
484 return MOUSE_TYPE_LOGITECH;
485
486 case 'Z':
487 TRACE("Microsoft Wheel Mouse detected\n");
488 return MOUSE_TYPE_WHEELZ;
489
490 /* case '2': */
491 default:
492 TRACE("Microsoft Mouse with 2-buttons detected\n");
494 }
495 }
496 }
497
498 return MOUSE_TYPE_NONE;
499}
500
501static ULONG
503{
504 ULONG TimeOut;
505 ULONG i = 0;
506 char c;
507 char x;
508
509 WRITE_PORT_UCHAR(Port + 4, 0x09);
510
511 /* Wait 10 milliseconds for the mouse getting ready */
513
514 WRITE_PORT_UCHAR(Port + 4, 0x0b);
515
517
518 for (;;)
519 {
520 TimeOut = 200;
521 while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
522 {
524 --TimeOut;
525 if (TimeOut == 0)
526 {
527 return 0;
528 }
529 }
530
532 if (c == 0x08 || c == 0x28)
533 break;
534 }
535
536 Buffer[i++] = c;
537 x = c + 1;
538
539 for (;;)
540 {
541 TimeOut = 200;
542 while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
543 {
545 --TimeOut;
546 if (TimeOut == 0)
547 return 0;
548 }
550 Buffer[i++] = c;
551 if (c == x)
552 break;
553 if (i >= 256)
554 break;
555 }
556
557 return i;
558}
559
560static
561VOID
563 PUCHAR Base)
564{
565 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
566 char Buffer[256];
567 CHAR Identifier[256];
568 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
569 ULONG MouseType;
571 ULONG i;
572 ULONG j;
573 ULONG k;
574
575 TRACE("DetectSerialPointerPeripheral()\n");
576
577 Identifier[0] = 0;
578
580 MouseType = DetectSerialMouse(Base);
581
582 if (MouseType != MOUSE_TYPE_NONE)
583 {
585 TRACE( "PnP ID length: %u\n", Length);
586
587 if (Length != 0)
588 {
589 /* Convert PnP sting to ASCII */
590 if (Buffer[0] == 0x08)
591 {
592 for (i = 0; i < Length; i++)
593 Buffer[i] += 0x20;
594 }
595 Buffer[Length] = 0;
596
597 TRACE("PnP ID string: %s\n", Buffer);
598
599 /* Copy PnpId string */
600 for (i = 0; i < 7; i++)
601 {
602 Identifier[i] = Buffer[3 + i];
603 }
604 memcpy(&Identifier[7],
605 L" - ",
606 3 * sizeof(WCHAR));
607
608 /* Skip device serial number */
609 i = 10;
610 if (Buffer[i] == '\\')
611 {
612 for (j = ++i; i < Length; ++i)
613 {
614 if (Buffer[i] == '\\')
615 break;
616 }
617 if (i >= Length)
618 i -= 3;
619 }
620
621 /* Skip PnP class */
622 if (Buffer[i] == '\\')
623 {
624 for (j = ++i; i < Length; ++i)
625 {
626 if (Buffer[i] == '\\')
627 break;
628 }
629
630 if (i >= Length)
631 i -= 3;
632 }
633
634 /* Skip compatible PnP Id */
635 if (Buffer[i] == '\\')
636 {
637 for (j = ++i; i < Length; ++i)
638 {
639 if (Buffer[i] == '\\')
640 break;
641 }
642 if (Buffer[j] == '*')
643 ++j;
644 if (i >= Length)
645 i -= 3;
646 }
647
648 /* Get product description */
649 if (Buffer[i] == '\\')
650 {
651 for (j = ++i; i < Length; ++i)
652 {
653 if (Buffer[i] == ';')
654 break;
655 }
656 if (i >= Length)
657 i -= 3;
658 if (i > j + 1)
659 {
660 for (k = 0; k < i - j; k++)
661 {
662 Identifier[k + 10] = Buffer[k + j];
663 }
664 Identifier[10 + (i - j)] = 0;
665 }
666 }
667
668 TRACE("Identifier string: %s\n", Identifier);
669 }
670
671 if (Length == 0 || strlen(Identifier) < 11)
672 {
673 switch (MouseType)
674 {
676 strcpy(Identifier, "LOGITECH SERIAL MOUSE");
677 break;
678
680 strcpy(Identifier, "MICROSOFT SERIAL MOUSE WITH WHEEL");
681 break;
682
684 default:
685 strcpy(Identifier, "MICROSOFT SERIAL MOUSE");
686 break;
687 }
688 }
689
690 /* Set 'Configuration Data' value */
693 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
694 if (PartialResourceList == NULL)
695 {
696 ERR("Failed to allocate resource descriptor\n");
697 return;
698 }
699
700 RtlZeroMemory(PartialResourceList, Size);
701 PartialResourceList->Version = 1;
702 PartialResourceList->Revision = 1;
703 PartialResourceList->Count = 0;
704
705 /* Create 'PointerPeripheral' key */
706 FldrCreateComponentKey(ControllerKey,
709 Input,
710 0,
711 0xFFFFFFFF,
713 PartialResourceList,
714 Size,
715 &PeripheralKey);
716 }
717}
718
719/* FIXME: Abstract things better so we don't need to place define here */
720#if !defined(SARCH_XBOX)
721static
722ULONG
724{
725 static const ULONG PcIrq[MAX_COM_PORTS] = {4, 3, 4, 3};
726 PUSHORT BasePtr;
727
728 /*
729 * The BIOS data area 0x400 holds the address of the first valid COM port.
730 * Each COM port address is stored in a 2-byte field.
731 * Infos at: https://web.archive.org/web/20240119203029/http://www.bioscentral.com/misc/bda.htm
732 */
733 BasePtr = (PUSHORT)0x400;
734 *Irq = PcIrq[Index];
735
736 return (ULONG) *(BasePtr + Index);
737}
738#endif // !SARCH_XBOX
739
740/*
741 * Parse the serial mouse detection options.
742 * Format: /FASTDETECT
743 * or: /NOSERIALMICE=COM[0-9],[0-9],[0-9]...
744 * or: /NOSERIALMICE:COM[0-9]...
745 * If we have /FASTDETECT, then nothing can be detected.
746 */
747static
748ULONG
751{
752 PCSTR Option, c;
753 ULONG OptionLength, PortBitmap, i;
754
755 if (NtLdrGetOption(Options, "FASTDETECT"))
756 return (1 << MAX_COM_PORTS) - 1;
757
758 Option = NtLdrGetOptionEx(Options, "NOSERIALMICE=", &OptionLength);
759 if (!Option)
760 Option = NtLdrGetOptionEx(Options, "NOSERIALMICE:", &OptionLength);
761
762 if (!Option)
763 return 0;
764
765 /* Invalid port list */
766 if (OptionLength < (sizeof("NOSERIALMICE=COM9") - 1))
767 return (1 << MAX_COM_PORTS) - 1;
768
769 /* Move to the port list */
770 Option += sizeof("NOSERIALMICE=COM") - 1;
771 OptionLength -= sizeof("NOSERIALMICE=COM") - 1;
772
773 PortBitmap = 0;
774 c = Option;
775 for (i = 0; i < OptionLength; i += 2)
776 {
777 UCHAR PortNumber = *c - '0';
778
779 if (PortNumber > 0 && PortNumber <= 9)
780 PortBitmap |= 1 << (PortNumber - 1);
781
782 c += 2;
783 }
784
785 return PortBitmap;
786}
787
788VOID
792 _In_ GET_SERIAL_PORT MachGetSerialPort,
794{
795 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
796 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
797 PCM_SERIAL_DEVICE_DATA SerialDeviceData;
798 ULONG Irq;
799 ULONG Base;
800 CHAR Identifier[80];
801 ULONG ControllerNumber = 0;
802 PCONFIGURATION_COMPONENT_DATA ControllerKey;
803 ULONG i;
804 ULONG Size;
805 ULONG PortBitmap;
806
807 TRACE("DetectSerialPorts()\n");
808
810
811 for (i = 0; i < Count; i++)
812 {
813 Base = MachGetSerialPort(i, &Irq);
814 if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
815 continue;
816
817 TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
818
819 /* Set 'Identifier' value */
820 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%ld", i + 1);
821
822 /* Build full device descriptor */
825 sizeof(CM_SERIAL_DEVICE_DATA);
826 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
827 if (PartialResourceList == NULL)
828 {
829 ERR("Failed to allocate resource descriptor! Ignoring remaining serial ports. (i = %lu, Count = %lu)\n",
830 i, Count);
831 break;
832 }
833
834 /* Initialize resource descriptor */
835 RtlZeroMemory(PartialResourceList, Size);
836 PartialResourceList->Version = 1;
837 PartialResourceList->Revision = 1;
838 PartialResourceList->Count = 3;
839
840 /* Set IO Port */
841 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
842 PartialDescriptor->Type = CmResourceTypePort;
844 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
845 PartialDescriptor->u.Port.Start.LowPart = Base;
846 PartialDescriptor->u.Port.Start.HighPart = 0x0;
847 PartialDescriptor->u.Port.Length = 8;
848
849 /* Set Interrupt */
850 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
851 PartialDescriptor->Type = CmResourceTypeInterrupt;
853 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
854 PartialDescriptor->u.Interrupt.Level = Irq;
855 PartialDescriptor->u.Interrupt.Vector = Irq;
856 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
857
858 /* Set serial data (device specific) */
859 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
860 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
862 PartialDescriptor->Flags = 0;
863 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
864
865 SerialDeviceData =
866 (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
867 SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
868
869 /* Create controller key */
874 ControllerNumber,
875 0xFFFFFFFF,
877 PartialResourceList,
878 Size,
879 &ControllerKey);
880
881 if (!(PortBitmap & (1 << i)) && !Rs232PortInUse(UlongToPtr(Base)))
882 {
883 /* Detect serial mouse */
885 }
886
887 ControllerNumber++;
888 }
889}
890
891/* FIXME: Abstract things better so we don't need to place define here */
892#if !defined(SARCH_XBOX)
893
894static VOID
896{
897 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
898 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
899 ULONG Irq[MAX_LPT_PORTS] = {7, 5, (ULONG) - 1};
900 CHAR Identifier[80];
901 PCONFIGURATION_COMPONENT_DATA ControllerKey;
902 PUSHORT BasePtr;
903 ULONG Base;
904 ULONG ControllerNumber = 0;
905 ULONG i;
906 ULONG Size;
907
908 TRACE("DetectParallelPorts() called\n");
909
910 /*
911 * The BIOS data area 0x408 holds the address of the first valid LPT port.
912 * Each LPT port address is stored in a 2-byte field.
913 * Infos at: https://web.archive.org/web/20240119203029/http://www.bioscentral.com/misc/bda.htm
914 */
915 BasePtr = (PUSHORT)0x408;
916
917 for (i = 0; i < MAX_LPT_PORTS; i++, BasePtr++)
918 {
919 Base = (ULONG) * BasePtr;
920 if (Base == 0)
921 continue;
922
923 TRACE("Parallel port %u: %x\n", ControllerNumber, Base);
924
925 /* Set 'Identifier' value */
926 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PARALLEL%ld", i + 1);
927
928 /* Build full device descriptor */
930 if (Irq[i] != (ULONG) - 1)
932
933 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
934 if (PartialResourceList == NULL)
935 {
936 ERR("Failed to allocate resource descriptor! Ignoring remaining parallel ports. (i = %lu)\n", i);
937 break;
938 }
939
940 /* Initialize resource descriptor */
941 RtlZeroMemory(PartialResourceList, Size);
942 PartialResourceList->Version = 1;
943 PartialResourceList->Revision = 1;
944 PartialResourceList->Count = (Irq[i] != (ULONG) - 1) ? 2 : 1;
945
946 /* Set IO Port */
947 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
948 PartialDescriptor->Type = CmResourceTypePort;
950 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
951 PartialDescriptor->u.Port.Start.LowPart = Base;
952 PartialDescriptor->u.Port.Start.HighPart = 0x0;
953 PartialDescriptor->u.Port.Length = 3;
954
955 /* Set Interrupt */
956 if (Irq[i] != (ULONG) - 1)
957 {
958 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
959 PartialDescriptor->Type = CmResourceTypeInterrupt;
961 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
962 PartialDescriptor->u.Interrupt.Level = Irq[i];
963 PartialDescriptor->u.Interrupt.Vector = Irq[i];
964 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
965 }
966
967 /* Create controller key */
971 Output,
972 ControllerNumber,
973 0xFFFFFFFF,
975 PartialResourceList,
976 Size,
977 &ControllerKey);
978
979 ControllerNumber++;
980 }
981
982 TRACE("DetectParallelPorts() done\n");
983}
984
985// static
988{
990 UCHAR Scancode;
991 ULONG Loops;
993
994 /* Identify device */
996
997 /* Wait for reply */
998 for (Loops = 0; Loops < 100; Loops++)
999 {
1003 break;
1004 }
1005
1007 {
1008 /* PC/XT keyboard or no keyboard */
1009 Result = FALSE;
1010 }
1011
1013 if (Scancode != 0xFA)
1014 {
1015 /* No ACK received */
1016 Result = FALSE;
1017 }
1018
1020
1023 {
1024 /* Found AT keyboard */
1025 return Result;
1026 }
1027
1029 if (Scancode != 0xAB)
1030 {
1031 /* No 0xAB received */
1032 Result = FALSE;
1033 }
1034
1036
1039 {
1040 /* No byte in buffer */
1041 Result = FALSE;
1042 }
1043
1045 if (Scancode != 0x41)
1046 {
1047 /* No 0x41 received */
1048 Result = FALSE;
1049 }
1050
1051 /* Found MF-II keyboard */
1052 return Result;
1053}
1054
1055static VOID
1057{
1058 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1059 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
1060 PCM_KEYBOARD_DEVICE_DATA KeyboardData;
1061 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1062 ULONG Size;
1063 REGS Regs;
1064
1065 /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2
1066 if (DetectKeyboardDevice()) */
1067 {
1068 /* Set 'Configuration Data' value */
1069 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
1071 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1072 if (PartialResourceList == NULL)
1073 {
1074 ERR("Failed to allocate resource descriptor\n");
1075 return;
1076 }
1077
1078 /* Initialize resource descriptor */
1079 RtlZeroMemory(PartialResourceList, Size);
1080 PartialResourceList->Version = 1;
1081 PartialResourceList->Revision = 1;
1082 PartialResourceList->Count = 1;
1083
1084 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
1085 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
1086 PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
1087 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
1088
1089 /* Int 16h AH=02h
1090 * KEYBOARD - GET SHIFT FLAGS
1091 *
1092 * Return:
1093 * AL - shift flags
1094 */
1095 Regs.b.ah = 0x02;
1096 Int386(0x16, &Regs, &Regs);
1097
1098 KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
1099 KeyboardData->Version = 1;
1100 KeyboardData->Revision = 1;
1101 KeyboardData->Type = 4;
1102 KeyboardData->Subtype = 0;
1103 KeyboardData->KeyboardFlags = Regs.b.al;
1104
1105 /* Create controller key */
1106 FldrCreateComponentKey(ControllerKey,
1109 Input | ConsoleIn,
1110 0,
1111 0xFFFFFFFF,
1112 "PCAT_ENHANCED",
1113 PartialResourceList,
1114 Size,
1115 &PeripheralKey);
1116 }
1117}
1118
1119static
1120VOID
1122{
1123 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1124 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
1125 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1126 ULONG Size;
1127
1128 /* Set 'Configuration Data' value */
1129 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
1131 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1132 if (PartialResourceList == NULL)
1133 {
1134 ERR("Failed to allocate resource descriptor\n");
1135 return;
1136 }
1137
1138 /* Initialize resource descriptor */
1139 RtlZeroMemory(PartialResourceList, Size);
1140 PartialResourceList->Version = 1;
1141 PartialResourceList->Revision = 1;
1142 PartialResourceList->Count = 3;
1143
1144 /* Set Interrupt */
1145 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
1146 PartialDescriptor->Type = CmResourceTypeInterrupt;
1147 PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
1148 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1149 PartialDescriptor->u.Interrupt.Level = 1;
1150 PartialDescriptor->u.Interrupt.Vector = 1;
1151 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
1152
1153 /* Set IO Port 0x60 */
1154 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
1155 PartialDescriptor->Type = CmResourceTypePort;
1157 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1158 PartialDescriptor->u.Port.Start.LowPart = 0x60;
1159 PartialDescriptor->u.Port.Start.HighPart = 0x0;
1160 PartialDescriptor->u.Port.Length = 1;
1161
1162 /* Set IO Port 0x64 */
1163 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
1164 PartialDescriptor->Type = CmResourceTypePort;
1166 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1167 PartialDescriptor->u.Port.Start.LowPart = 0x64;
1168 PartialDescriptor->u.Port.Start.HighPart = 0x0;
1169 PartialDescriptor->u.Port.Length = 1;
1170
1171 /* Create controller key */
1175 Input | ConsoleIn,
1176 0,
1177 0xFFFFFFFF,
1178 NULL,
1179 PartialResourceList,
1180 Size,
1181 &ControllerKey);
1182
1183 DetectKeyboardPeripheral(ControllerKey);
1184}
1185
1186static
1187VOID
1189{
1190 ULONG Timeout;
1191 UCHAR Status;
1192
1194 {
1197 return;
1198
1199 /* Sleep for one millisecond */
1201 }
1202}
1203
1204static
1205BOOLEAN
1207{
1208#if 1
1209 /* Current detection is too unreliable. Just do as if
1210 * the PS/2 aux port is always present
1211 */
1212 return TRUE;
1213#else
1214 ULONG Loops;
1215 UCHAR Status;
1216
1217 /* Put the value 0x5A in the output buffer using the
1218 * "WriteAuxiliary Device Output Buffer" command (0xD3).
1219 * Poll the Status Register for a while to see if the value really turns up
1220 * in the Data Register. If the KEYBOARD_STATUS_MOUSE_OBF bit is also set
1221 * to 1 in the Status Register, we assume this controller has an
1222 * Auxiliary Port (a.k.a. Mouse Port).
1223 */
1228
1229 /* 0x5A is a random dummy value */
1231 0x5A);
1232
1233 for (Loops = 0; Loops < 10; Loops++)
1234 {
1238 break;
1239 }
1240
1242
1244#endif
1245}
1246
1247static
1248BOOLEAN
1250{
1251 UCHAR Scancode;
1252 UCHAR Status;
1253 ULONG Loops;
1255
1260
1261 /* Identify device */
1263
1264 /* Wait for reply */
1265 for (Loops = 0; Loops < 100; Loops++)
1266 {
1270 break;
1271 }
1272
1275 Result = FALSE;
1276
1278 if (Scancode != 0xFA)
1279 Result = FALSE;
1280
1282
1285 Result = FALSE;
1286
1288 if (Scancode != 0x00)
1289 Result = FALSE;
1290
1291 return Result;
1292}
1293
1294// FIXME: Missing: DetectPS2Peripheral!! (for corresponding 'PointerPeripheral')
1295
1296static
1297VOID
1299{
1300 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1301 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1302 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1303 ULONG Size;
1304
1305 if (DetectPS2AuxPort())
1306 {
1307 TRACE("Detected PS2 port\n");
1308
1309 PartialResourceList = FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST), TAG_HW_RESOURCE_LIST);
1310 if (PartialResourceList == NULL)
1311 {
1312 ERR("Failed to allocate resource descriptor\n");
1313 return;
1314 }
1315
1316 /* Initialize resource descriptor */
1317 RtlZeroMemory(PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST));
1318 PartialResourceList->Version = 1;
1319 PartialResourceList->Revision = 1;
1320 PartialResourceList->Count = 1;
1321
1322 /* Set Interrupt */
1323 PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeInterrupt;
1325 PartialResourceList->PartialDescriptors[0].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1326 PartialResourceList->PartialDescriptors[0].u.Interrupt.Level = 12;
1327 PartialResourceList->PartialDescriptors[0].u.Interrupt.Vector = 12;
1328 PartialResourceList->PartialDescriptors[0].u.Interrupt.Affinity = 0xFFFFFFFF;
1329
1330 /* Create controller key */
1334 Input,
1335 0,
1336 0xFFFFFFFF,
1337 NULL,
1338 PartialResourceList,
1340 &ControllerKey);
1341
1342 if (DetectPS2AuxDevice())
1343 {
1344 TRACE("Detected PS2 mouse\n");
1345
1346 /* Initialize resource descriptor */
1347 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1349 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1350 if (PartialResourceList == NULL)
1351 {
1352 ERR("Failed to allocate resource descriptor\n");
1353 return;
1354 }
1355
1356 RtlZeroMemory(PartialResourceList, Size);
1357 PartialResourceList->Version = 1;
1358 PartialResourceList->Revision = 1;
1359 PartialResourceList->Count = 0;
1360
1361 /* Create peripheral key */
1362 FldrCreateComponentKey(ControllerKey,
1365 Input,
1366 0,
1367 0xFFFFFFFF,
1368 "MICROSOFT PS2 MOUSE",
1369 PartialResourceList,
1370 Size,
1371 &PeripheralKey);
1372 }
1373 }
1374}
1375
1376#if defined(_M_IX86)
1377static VOID
1378CreateBusMousePeripheralKey(
1380 _In_ ULONG IoBase,
1381 _In_ ULONG Irq)
1382{
1383 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1384 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
1385 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1386 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1387 ULONG Size;
1388
1389 /* Set 'Configuration Data' value */
1390 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[2]);
1391 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1392 if (PartialResourceList == NULL)
1393 {
1394 ERR("Failed to allocate resource descriptor\n");
1395 return;
1396 }
1397
1398 /* Initialize resource descriptor */
1399 RtlZeroMemory(PartialResourceList, Size);
1400 PartialResourceList->Version = 1;
1401 PartialResourceList->Revision = 1;
1402 PartialResourceList->Count = 2;
1403
1404 /* Set IO Port */
1405 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
1406 PartialDescriptor->Type = CmResourceTypePort;
1408 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1409 PartialDescriptor->u.Port.Start.LowPart = IoBase;
1410 PartialDescriptor->u.Port.Start.HighPart = 0;
1411 PartialDescriptor->u.Port.Length = 4;
1412
1413 /* Set Interrupt */
1414 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
1415 PartialDescriptor->Type = CmResourceTypeInterrupt;
1416 PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
1417 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1418 PartialDescriptor->u.Interrupt.Level = Irq;
1419 PartialDescriptor->u.Interrupt.Vector = Irq;
1420 PartialDescriptor->u.Interrupt.Affinity = (KAFFINITY)-1;
1421
1422 /* Create controller key */
1426 Input,
1427 0,
1428 0xFFFFFFFF,
1429 NULL,
1430 PartialResourceList,
1431 Size,
1432 &ControllerKey);
1433
1434 /* Set 'Configuration Data' value */
1435 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
1436 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1437 if (PartialResourceList == NULL)
1438 {
1439 ERR("Failed to allocate resource descriptor\n");
1440 return;
1441 }
1442
1443 /* Initialize resource descriptor */
1444 RtlZeroMemory(PartialResourceList, Size);
1445 PartialResourceList->Version = 1;
1446 PartialResourceList->Revision = 1;
1447 PartialResourceList->Count = 0;
1448
1449 /* Create peripheral key */
1450 FldrCreateComponentKey(ControllerKey,
1453 Input,
1454 0,
1455 0xFFFFFFFF,
1456 "MICROSOFT INPORT MOUSE",
1457 PartialResourceList,
1458 Size,
1459 &PeripheralKey);
1460}
1461
1462extern KIDTENTRY DECLSPEC_ALIGN(4) i386Idt[32];
1463VOID __cdecl HwIrqHandler(VOID);
1464extern volatile ULONG HwIrqCount;
1465
1466static ULONG
1467DetectBusMouseTestIrq(
1468 _In_ ULONG IoBase,
1469 _In_ ULONG Irq)
1470{
1471 USHORT OldOffset, OldExtendedOffset;
1472 ULONG Vector, i;
1473
1474 HwIrqCount = 0;
1475
1476 /* Reset the device */
1479
1480 Vector = Irq + 8;
1481
1482 /* Save the old interrupt vector and replace it by ours */
1483 OldOffset = i386Idt[Vector].Offset;
1484 OldExtendedOffset = i386Idt[Vector].ExtendedOffset;
1485
1486 i386Idt[Vector].Offset = (ULONG)HwIrqHandler & 0xFFFF;
1487 i386Idt[Vector].ExtendedOffset = (ULONG)HwIrqHandler >> 16;
1488
1489 /* Enable the requested IRQ on the master PIC */
1490 WRITE_PORT_UCHAR((PUCHAR)PIC1_DATA_PORT, ~(1 << Irq));
1491
1492 _enable();
1493
1494 /* Configure the device to generate interrupts */
1495 for (i = 0; i < 15; i++)
1496 {
1499 }
1500
1501 /* Disable the device */
1503
1504 _disable();
1505
1506 i386Idt[Vector].Offset = OldOffset;
1507 i386Idt[Vector].ExtendedOffset = OldExtendedOffset;
1508
1509 return (HwIrqCount != 0) ? Irq : 0;
1510}
1511
1512static ULONG
1513DetectBusMouseIrq(
1514 _In_ ULONG IoBase)
1515{
1516 UCHAR Mask1, Mask2;
1517 ULONG Irq, Result;
1518
1519 /* Save the current interrupt mask */
1522
1523 /* Mask the interrupts on the slave PIC */
1525
1526 /* Process IRQ detection: IRQ 5, 4, 3 */
1527 for (Irq = 5; Irq >= 3; Irq--)
1528 {
1529 Result = DetectBusMouseTestIrq(IoBase, Irq);
1530 if (Result != 0)
1531 break;
1532 }
1533
1534 /* Restore the mask */
1537
1538 return Result;
1539}
1540
1541static VOID
1542DetectBusMouse(
1544{
1545 ULONG IoBase, Irq, Signature1, Signature2, Signature3;
1546
1547 /*
1548 * The bus mouse lives at one of these addresses: 0x230, 0x234, 0x238, 0x23C.
1549 * The 0x23C port is the most common I/O setting.
1550 */
1551 for (IoBase = 0x23C; IoBase >= 0x230; IoBase -= 4)
1552 {
1553 Signature1 = READ_PORT_UCHAR((PUCHAR)IoBase + INPORT_REGISTER_SIGNATURE);
1554 Signature2 = READ_PORT_UCHAR((PUCHAR)IoBase + INPORT_REGISTER_SIGNATURE);
1555 if (Signature1 == Signature2)
1556 continue;
1557 if (Signature1 != INPORT_SIGNATURE && Signature2 != INPORT_SIGNATURE)
1558 continue;
1559
1560 Signature3 = READ_PORT_UCHAR((PUCHAR)IoBase + INPORT_REGISTER_SIGNATURE);
1561 if (Signature1 != Signature3)
1562 continue;
1563
1564 Irq = DetectBusMouseIrq(IoBase);
1565 if (Irq == 0)
1566 continue;
1567
1568 CreateBusMousePeripheralKey(BusKey, IoBase, Irq);
1569 break;
1570 }
1571}
1572#endif /* _M_IX86 */
1573
1574// Implemented in pcvesa.c, returns the VESA version
1578
1579static VOID
1581{
1583 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1584 USHORT VesaVersion;
1585
1586 /* FIXME: Set 'ComponentInformation' value */
1587
1588 VesaVersion = BiosIsVesaSupported();
1589 if (VesaVersion != 0)
1590 {
1591 TRACE("VESA version %c.%c\n",
1592 (VesaVersion >> 8) + '0',
1593 (VesaVersion & 0xFF) + '0');
1594 }
1595 else
1596 {
1597 TRACE("VESA not supported\n");
1598 }
1599
1600 if (VesaVersion >= 0x0200)
1601 Identifier = "VBE Display";
1602 else
1603 Identifier = "VGA Display";
1604
1609 0,
1610 0xFFFFFFFF,
1611 Identifier,
1612 NULL,
1613 0,
1614 &ControllerKey);
1615
1616 /* FIXME: Add display peripheral (monitor) data */
1617 if (VesaVersion != 0)
1618 {
1620 {
1621 TRACE("VESA/DDC supported!\n");
1622 if (BiosVesaReadEdid())
1623 {
1624 TRACE("EDID data read successfully!\n");
1625 }
1626 }
1627 }
1628}
1629
1630static
1631VOID
1636{
1637 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1639 ULONG Size;
1640
1641 /* Set 'Configuration Data' value */
1642 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1644 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1645 if (PartialResourceList == NULL)
1646 {
1647 ERR("Failed to allocate resource descriptor\n");
1648 return;
1649 }
1650
1651 /* Initialize resource descriptor */
1652 RtlZeroMemory(PartialResourceList, Size);
1653 PartialResourceList->Version = 1;
1654 PartialResourceList->Revision = 1;
1655 PartialResourceList->Count = 0;
1656
1657 /* Create new bus key */
1658 FldrCreateComponentKey(SystemKey,
1661 0,
1662 0,
1663 0xFFFFFFFF,
1664 "ISA",
1665 PartialResourceList,
1666 Size,
1667 &BusKey);
1668
1669 /* Increment bus number */
1670 (*BusNumber)++;
1671
1672 /* Detect ISA/BIOS devices */
1673 DetectBiosDisks(SystemKey, BusKey);
1675 DetectParallelPorts(BusKey);
1677 DetectPS2Mouse(BusKey);
1678#if defined(_M_IX86)
1679 DetectBusMouse(BusKey);
1680#endif
1682
1683 /* FIXME: Detect more ISA devices */
1684}
1685
1686static
1687UCHAR
1689{
1690 UCHAR Data;
1691
1692 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x10);
1693 Data = READ_PORT_UCHAR((PUCHAR)0x71);
1694
1695 return ((Data & 0xF0) ? 1 : 0) + ((Data & 0x0F) ? 1 : 0);
1696}
1697
1701{
1703 ULONG BusNumber = 0;
1704
1705 TRACE("DetectHardware()\n");
1706
1707 /* Create the 'System' key */
1708 // TODO: Discover and set the other machine types
1709 FldrCreateSystemKey(&SystemKey, "AT/AT COMPATIBLE");
1710
1713
1714 /* Detect buses */
1715 DetectPciBios(SystemKey, &BusNumber);
1716 DetectApmBios(SystemKey, &BusNumber);
1717 DetectPnpBios(SystemKey, &BusNumber);
1718 DetectIsaBios(Options, SystemKey, &BusNumber); // TODO: Detect first EISA or MCA, before ISA
1719 DetectAcpiBios(SystemKey, &BusNumber);
1720
1721 // TODO: Collect the ROM blocks from 0xC0000 to 0xF0000 and append their
1722 // CM_ROM_BLOCK data into the 'System' key's configuration data.
1723
1724 TRACE("DetectHardware() Done\n");
1725 return SystemKey;
1726}
1727
1728VOID
1730{
1731 REGS Regs;
1732
1733 /* Select APM 1.0+ function */
1734 Regs.b.ah = 0x53;
1735
1736 /* Function 05h: CPU idle */
1737 Regs.b.al = 0x05;
1738
1739 /* Call INT 15h */
1740 Int386(0x15, &Regs, &Regs);
1741
1742 /* Check if successfull (CF set on error) */
1743 if (INT386_SUCCESS(Regs))
1744 return;
1745
1746 /*
1747 * No futher processing here.
1748 * Optionally implement HLT instruction handling.
1749 */
1750}
1751
1753 IN UCHAR BootDrive OPTIONAL,
1754 IN ULONG BootPartition OPTIONAL)
1755{
1756 REGS Regs;
1757
1758 RtlZeroMemory(&Regs, sizeof(Regs));
1759
1760 /* Set the boot drive and the boot partition */
1761 Regs.b.dl = (UCHAR)(BootDrive ? BootDrive : FrldrBootDrive);
1762 Regs.b.dh = (UCHAR)(BootPartition ? BootPartition : FrldrBootPartition);
1763
1764 /*
1765 * Don't stop the floppy drive motor when we are just booting a bootsector,
1766 * a drive, or a partition. If we were to stop the floppy motor, the BIOS
1767 * wouldn't be informed and if the next read is to a floppy then the BIOS
1768 * will still think the motor is on and this will result in a read error.
1769 */
1770 // DiskStopFloppyMotor();
1771
1772 Relocator16Boot(&Regs,
1773 /* Stack segment:pointer */
1774 0x0000, 0x7C00,
1775 /* Code segment:pointer */
1776 0x0000, 0x7C00);
1777}
1778
1779#endif // !SARCH_XBOX
1780
1781
1782/******************************************************************************/
1783
1784/* FIXME: Abstract things better so we don't need to place define here */
1785#if !defined(SARCH_XBOX)
1786VOID
1787MachInit(const char *CmdLine)
1788{
1789 /* Setup vtbl */
1790 RtlZeroMemory(&MachVtbl, sizeof(MachVtbl));
1819
1821 PcVideoInit();
1822}
1823
1824VOID
1826{
1827 /* Prepare video and turn off the floppy motor */
1830}
1831#endif
1832
1833/* EOF */
@ DeviceNode
Definition: Node.h:9
unsigned char BOOLEAN
MACHVTBL MachVtbl
Definition: arcemul.c:21
#define ExtendedBIOSDataArea
Definition: winldr.c:346
#define ExtendedBIOSDataSize
Definition: winldr.c:347
VOID FldrCreateSystemKey(_Out_ PCONFIGURATION_COMPONENT_DATA *SystemNode, _In_ PCSTR IdentifierString)
Definition: archwsup.c:135
VOID 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_ PCSTR IdentifierString, _In_ PCM_PARTIAL_RESOURCE_LIST ResourceList, _In_ ULONG Size, _Out_ PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:198
@ Identifier
Definition: asmpp.cpp:95
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwacpi.c:59
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: hwpci.c:80
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
#define DiskReadBuffer
Definition: hardware.h:33
ULONG __cdecl PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer)
ULONG __cdecl PnpBiosGetDeviceNodeCount(ULONG *NodeSize, ULONG *NodeCount)
ULONG_PTR __cdecl PnpBiosSupported(VOID)
ULONG(* GET_SERIAL_PORT)(ULONG Index, PULONG Irq)
Definition: hardware.h:80
ULONG __cdecl PnpBiosGetDockStationInformation(UCHAR *DockingStationInfo)
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: heap.c:539
PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: heap.c:533
Definition: bufpool.h:45
BOOLEAN Rs232PortInUse(PUCHAR Base)
Definition: rs232.c:140
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:224
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG_PTR KAFFINITY
Definition: compat.h:85
#define DECLSPEC_ALIGN(x)
Definition: corecrt.h:141
#define __cdecl
Definition: corecrt.h:121
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3330
static const WCHAR CmdLine[]
Definition: install.c:48
#define L(x)
Definition: resources.c:13
#define UlongToPtr(u)
Definition: config.h:106
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
Status
Definition: gdiplustypes.h:25
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
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
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
CPPORT Port[4]
Definition: headless.c:35
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwapm.c:46
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:458
#define c
Definition: ke_i.h:80
if(dx< 0)
Definition: linetemp.h:194
#define CONTROLLER_COMMAND_WRITE_MOUSE
Definition: machpc.c:77
VOID PcGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machpc.c:107
#define PIC1_DATA_PORT
Definition: machpc.c:54
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machpc.c:257
#define MOUSE_TYPE_MICROSOFT
Definition: machpc.c:35
static VOID DetectDockingStation(_Inout_ PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:193
#define MAX_LPT_PORTS
Definition: machpc.c:30
BOOLEAN BiosVesaReadEdid(VOID)
Definition: pcvesa.c:270
static VOID PS2ControllerWait(VOID)
Definition: machpc.c:1188
#define INPORT_REGISTER_DATA
Definition: machpc.c:44
#define INPORT_REGISTER_CONTROL
Definition: machpc.c:43
#define INPORT_MODE_BASE
Definition: machpc.c:49
static ULONG GetSerialMousePnpId(PUCHAR Port, char *Buffer)
Definition: machpc.c:502
static ULONG DetectSerialMouse(PUCHAR Port)
Definition: machpc.c:409
static VOID DetectIsaBios(_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA SystemKey, _Out_ ULONG *BusNumber)
Definition: machpc.c:1632
VOID MachInit(const char *CmdLine)
Definition: machpc.c:1787
#define INPORT_TEST_IRQ
Definition: machpc.c:50
static BOOLEAN DetectPS2AuxDevice(VOID)
Definition: machpc.c:1249
#define CONTROLLER_REGISTER_STATUS
Definition: machpc.c:61
#define CONTROLLER_STATUS_INPUT_BUFFER_FULL
Definition: machpc.c:81
#define MOUSE_TYPE_LOGITECH
Definition: machpc.c:37
static ULONG PcGetSerialPort(ULONG Index, PULONG Irq)
Definition: machpc.c:723
BOOLEAN DetectKeyboardDevice(VOID)
Definition: machpc.c:987
#define MAX_COM_PORTS
Definition: machpc.c:29
static UCHAR PcGetFloppyCount(VOID)
Definition: machpc.c:1688
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1121
PCONFIGURATION_COMPONENT_DATA PcHwDetect(_In_opt_ PCSTR Options)
Definition: machpc.c:1699
#define PIC2_DATA_PORT
Definition: machpc.c:56
static VOID InitializeSerialPort(PUCHAR Port, UCHAR LineControl)
Definition: machpc.c:395
#define CONTROLLER_TIMEOUT
Definition: machpc.c:92
#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL
Definition: machpc.c:85
struct _PNP_DOCK_INFO * PPNP_DOCK_INFO
VOID PcHwIdle(VOID)
Definition: machpc.c:1729
#define MOUSE_TYPE_NONE
Definition: machpc.c:33
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:80
struct _PNP_DOCK_INFO PNP_DOCK_INFO
#define CONTROLLER_REGISTER_CONTROL
Definition: machpc.c:62
VOID PcPrepareForReactOS(VOID)
Definition: machpc.c:1825
#define MOUSE_TYPE_WHEELZ
Definition: machpc.c:39
VOID __cdecl ChainLoadBiosBootSectorCode(IN UCHAR BootDrive OPTIONAL, IN ULONG BootPartition OPTIONAL)
Definition: machpc.c:1752
#define INPORT_REG_MODE
Definition: machpc.c:47
static BOOLEAN DetectPS2AuxPort(VOID)
Definition: machpc.c:1206
static VOID DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1298
static VOID DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: machpc.c:1056
static ULONG GetSerialMouseDetectionBitmap(_In_opt_ PCSTR Options)
Definition: machpc.c:749
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:895
#define INPORT_SIGNATURE
Definition: machpc.c:51
VOID DetectSerialPorts(_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA BusKey, _In_ GET_SERIAL_PORT MachGetSerialPort, _In_ ULONG Count)
Definition: machpc.c:789
#define INPORT_REGISTER_SIGNATURE
Definition: machpc.c:45
static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1580
#define CONTROLLER_COMMAND_WRITE_MOUSE_OUTPUT_BUFFER
Definition: machpc.c:76
#define INPORT_RESET
Definition: machpc.c:48
#define CONTROLLER_REGISTER_DATA
Definition: machpc.c:63
static PCM_PARTIAL_RESOURCE_LIST PcGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machpc.c:131
static VOID DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
Definition: machpc.c:562
BOOLEAN BiosIsVesaDdcSupported(VOID)
Definition: pcvesa.c:241
USHORT BiosIsVesaSupported(VOID)
Definition: pcvesa.c:160
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int k
Definition: mpi.c:3369
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2486
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
PCSTR NtLdrGetOption(IN PCSTR Options, IN PCSTR OptionName)
Definition: ntldropts.c:128
PCSTR NtLdrGetOptionEx(IN PCSTR Options, IN PCSTR OptionName, OUT PULONG OptionLength OPTIONAL)
Definition: ntldropts.c:117
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1235
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
VOID PcBeep(VOID)
Definition: pcbeep.c:34
#define INT386_SUCCESS(regs)
Definition: pcbios.h:181
int __cdecl Int386(int ivec, REGS *in, REGS *out)
DECLSPEC_NORETURN VOID __cdecl Relocator16Boot(IN REGS *In, IN USHORT StackSegment, IN USHORT StackPointer, IN USHORT CodeSegment, IN USHORT CodePointer)
struct _DOCKING_STATE_INFORMATION DOCKING_STATE_INFORMATION
struct _DOCKING_STATE_INFORMATION * PDOCKING_STATE_INFORMATION
VOID PcConsPutChar(int Ch)
Definition: pccons.c:22
BOOLEAN PcConsKbHit(VOID)
Definition: pccons.c:63
int PcConsGetCh(void)
Definition: pccons.c:84
BOOLEAN PcDiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
Definition: pcdisk.c:786
ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: pcdisk.c:856
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:826
VOID HalpCalibrateStallExecution(VOID)
Definition: pchw.c:105
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pchw.c:344
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pchw.c:45
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pchw.c:60
PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap(ULONG *MemoryMapSize)
Definition: pcmem.c:609
TIMEINFO * PcGetTime(VOID)
Definition: pcrtc.c:24
VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pcvideo.c:1161
VOID PcVideoPrepareForReactOS(VOID)
Definition: pcvideo.c:1308
BOOLEAN PcVideoIsPaletteFixed(VOID)
Definition: pcvideo.c:1261
VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pcvideo.c:1267
VOID PcVideoSync(VOID)
Definition: pcvideo.c:1285
VOID PcVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pcvideo.c:1127
VOID PcVideoInit(VOID)
Definition: pcvideo.c:1020
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pcvideo.c:1097
VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pcvideo.c:1276
VIDEODISPLAYMODE PcVideoSetDisplayMode(PCSTR DisplayModeName, BOOLEAN Init)
Definition: pcvideo.c:1045
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:1121
VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: pcvideo.c:1252
VOID PcVideoClearScreen(UCHAR Attr)
Definition: pcvideo.c:1236
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pcvideo.c:1195
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1186
unsigned short USHORT
Definition: pedump.c:61
static ULONG Timeout
Definition: ping.c:61
struct _CM_PNP_BIOS_INSTALLATION_CHECK * PCM_PNP_BIOS_INSTALLATION_CHECK
struct _CM_PNP_BIOS_INSTALLATION_CHECK CM_PNP_BIOS_INSTALLATION_CHECK
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
#define volatile
Definition: prototyp.h:117
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: restypes.h:108
#define CmResourceTypePort
Definition: restypes.h:104
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: restypes.h:117
#define CmResourceTypeInterrupt
Definition: restypes.h:105
@ ControllerClass
Definition: arc.h:103
@ AdapterClass
Definition: arc.h:102
@ PeripheralClass
Definition: arc.h:104
@ PointerController
Definition: arc.h:134
@ MultiFunctionAdapter
Definition: arc.h:125
@ SerialController
Definition: arc.h:130
@ ParallelController
Definition: arc.h:133
@ KeyboardPeripheral
Definition: arc.h:145
@ KeyboardController
Definition: arc.h:135
@ DockingInformation
Definition: arc.h:151
@ PointerPeripheral
Definition: arc.h:144
@ DisplayController
Definition: arc.h:132
@ ConsoleOut
Definition: arc.h:92
@ ConsoleIn
Definition: arc.h:91
@ Input
Definition: arc.h:93
@ Output
Definition: arc.h:94
strcpy
Definition: string.h:131
void __cdecl _disable(void)
Definition: intrin_arm.h:365
void __cdecl _enable(void)
Definition: intrin_arm.h:373
#define TRACE(s)
Definition: solgame.cpp:4
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
ULONG PortNumber
Definition: storport.c:18
unsigned char dl
Definition: pcbios.h:142
unsigned char al
Definition: pcbios.h:133
unsigned char ah
Definition: pcbios.h:134
unsigned char dh
Definition: pcbios.h:143
unsigned long eax
Definition: pcbios.h:93
unsigned short es
Definition: pcbios.h:123
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@432::@434 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@432 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@432::@441 DeviceSpecificData
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@432::@435 Interrupt
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
Definition: disk.h:26
ULONG BytesPerSector
Number of bytes per sector.
Definition: disk.h:30
ULONG Cylinders
Number of cylinders on the disk.
Definition: disk.h:27
ULONG SectorsPerTrack
Number of sectors per track.
Definition: disk.h:29
ULONG Heads
Number of heads on the disk.
Definition: disk.h:28
ULONG SerialNumber
Definition: machpc.c:98
ULONG DockLocationID
Definition: machpc.c:97
USHORT Capabilities
Definition: machpc.c:99
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
VIDEODISPLAYMODE(* VideoSetDisplayMode)(PCSTR DisplayMode, BOOLEAN Init)
Definition: machine.h:46
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
int(* ConsGetCh)(VOID)
Definition: machine.h:43
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
VOID(* Beep)(VOID)
Definition: machine.h:58
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID(* VideoSync)(VOID)
Definition: machine.h:57
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(_In_opt_ PCSTR Options)
Definition: machine.h:77
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
void * PVOID
Definition: typedefs.h:50
uint16_t * PUSHORT
Definition: typedefs.h:56
const char * PCSTR
Definition: typedefs.h:52
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define TAG_HW_RESOURCE_LIST
Definition: uefidisk.c:15
UCHAR FrldrBootDrive
Definition: uefidisk.c:47
ULONG FrldrBootPartition
Definition: uefidisk.c:48
Definition: pcbios.h:161
DWORDREGS d
Definition: pcbios.h:163
BYTEREGS b
Definition: pcbios.h:165
WORDREGS w
Definition: pcbios.h:164
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3540
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_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:409
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
struct _CM_DISK_GEOMETRY_DEVICE_DATA CM_DISK_GEOMETRY_DEVICE_DATA
struct _CM_KEYBOARD_DEVICE_DATA * PCM_KEYBOARD_DEVICE_DATA
struct _CM_KEYBOARD_DEVICE_DATA CM_KEYBOARD_DEVICE_DATA
struct _CM_SERIAL_DEVICE_DATA CM_SERIAL_DEVICE_DATA
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareUndetermined
Definition: cmtypes.h:240
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
_Out_ PUSHORT NodeNumber
Definition: iofuncs.h:2574
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175