ReactOS 0.4.16-dev-340-g0540c21
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
95VOID
97{
98 REGS BiosRegs;
99
100 /* Get address and size of the extended BIOS data area */
101 BiosRegs.d.eax = 0xC100;
102 Int386(0x15, &BiosRegs, &BiosRegs);
103 if (INT386_SUCCESS(BiosRegs))
104 {
105 *ExtendedBIOSDataArea = BiosRegs.w.es << 4;
106 *ExtendedBIOSDataSize = 1024;
107 }
108 else
109 {
110 WARN("Int 15h AH=C1h call failed\n");
113 }
114}
115
116// NOTE: Similar to machxbox.c!XboxGetHarddiskConfigurationData(),
117// but with extended geometry support.
118static
121{
122 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
124 GEOMETRY Geometry;
125 ULONG Size;
126
127 /* Initialize returned size */
128 *pSize = 0;
129
130 /* Set 'Configuration Data' value */
133 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
134 if (PartialResourceList == NULL)
135 {
136 ERR("Failed to allocate resource descriptor\n");
137 return NULL;
138 }
139
140 RtlZeroMemory(PartialResourceList, Size);
141 PartialResourceList->Version = 1;
142 PartialResourceList->Revision = 1;
143 PartialResourceList->Count = 1;
144 PartialResourceList->PartialDescriptors[0].Type =
146// PartialResourceList->PartialDescriptors[0].ShareDisposition =
147// PartialResourceList->PartialDescriptors[0].Flags =
148 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
150
151 /* Get pointer to geometry data */
152 DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
153
154 /* Get the disk geometry */
155 if (PcDiskGetDriveGeometry(DriveNumber, &Geometry))
156 {
157 DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
158 DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
159 DiskGeometry->SectorsPerTrack = Geometry.SectorsPerTrack;
160 DiskGeometry->NumberOfHeads = Geometry.Heads;
161 }
162 else
163 {
164 TRACE("Reading disk geometry failed\n");
165 FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
166 return NULL;
167 }
168 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
169 DriveNumber,
170 DiskGeometry->NumberOfCylinders,
171 DiskGeometry->NumberOfHeads,
172 DiskGeometry->SectorsPerTrack,
173 DiskGeometry->BytesPerSector);
174
175 /* Return configuration data */
176 *pSize = Size;
177 return PartialResourceList;
178}
179
180static
181VOID
184{
185 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
186 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
187 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
188 PDOCKING_STATE_INFORMATION DockingState;
190
192
193 /* Build full device descriptor */
196 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
197 if (PartialResourceList == NULL)
198 {
199 ERR("Failed to allocate resource descriptor\n");
200 return;
201 }
202
203 /* Initialize resource descriptor */
204 RtlZeroMemory(PartialResourceList, Size);
205 PartialResourceList->Version = 0;
206 PartialResourceList->Revision = 0;
207 PartialResourceList->Count = 1;
208
209 /* Set device specific data */
210 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
211 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
213 PartialDescriptor->Flags = 0;
214 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(DOCKING_STATE_INFORMATION);
215
216 DockingState = (PDOCKING_STATE_INFORMATION)&PartialResourceList->PartialDescriptors[1];
217 DockingState->ReturnCode = Result;
218 if (Result == 0)
219 {
220 /* FIXME: Add more device specific data */
221 ERR("FIXME: System docked\n");
222 }
223
224 /* Create controller key */
228 0,
229 0,
230 0xFFFFFFFF,
231 "Docking State Information",
232 PartialResourceList,
233 Size,
234 &PeripheralKey);
235}
236
237static
238VOID
240{
241 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
245 ULONG x;
246 ULONG NodeSize = 0;
247 ULONG NodeCount = 0;
249 ULONG FoundNodeCount;
250 int i;
251 ULONG PnpBufferSize;
252 ULONG PnpBufferSizeLimit;
253 ULONG Size;
254 char *Ptr;
255
257 if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
258 {
259 TRACE("PnP-BIOS not supported\n");
260 return;
261 }
262
263 TRACE("PnP-BIOS supported\n");
264 TRACE("Signature '%c%c%c%c'\n",
265 InstData->Signature[0], InstData->Signature[1],
266 InstData->Signature[2], InstData->Signature[3]);
267
268 x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
269 if (x == 0x82)
270 {
271 TRACE("PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
272 return;
273 }
274
275 NodeCount &= 0xFF; // needed since some fscked up BIOSes return
276 // wrong info (e.g. Mac Virtual PC)
277 // e.g. look: http://my.execpc.com/~geezer/osd/pnp/pnp16.c
278 if (x != 0 || NodeSize == 0 || NodeCount == 0)
279 {
280 ERR("PnP-BIOS failed to enumerate device nodes\n");
281 return;
282 }
283 TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
284 TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
285
286 /* Set 'Configuration Data' value */
287 PnpBufferSizeLimit = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)
288 + (NodeSize * NodeCount);
289 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSizeLimit;
290 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
291 if (PartialResourceList == NULL)
292 {
293 ERR("Failed to allocate resource descriptor\n");
294 return;
295 }
296
297 /* Initialize resource descriptor */
298 RtlZeroMemory(PartialResourceList, Size);
299 PartialResourceList->Version = 1;
300 PartialResourceList->Revision = 1;
301 PartialResourceList->Count = 1;
302 PartialResourceList->PartialDescriptors[0].Type =
304 PartialResourceList->PartialDescriptors[0].ShareDisposition =
306
307 /* The buffer starts after PartialResourceList->PartialDescriptors[0] */
308 Ptr = (char *)(PartialResourceList + 1);
309
310 /* Set installation check data */
311 memcpy (Ptr, InstData, sizeof(CM_PNP_BIOS_INSTALLATION_CHECK));
313 PnpBufferSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK);
314
315 /* Copy device nodes */
316 FoundNodeCount = 0;
317 for (i = 0; i < 0xFF; i++)
318 {
319 NodeNumber = (UCHAR)i;
320
322 if (x == 0)
323 {
325
326 TRACE("Node: %u Size %u (0x%x)\n",
327 DeviceNode->Node,
328 DeviceNode->Size,
329 DeviceNode->Size);
330
331 if (PnpBufferSize + DeviceNode->Size > PnpBufferSizeLimit)
332 {
333 ERR("Buffer too small! Ignoring remaining device nodes. (i = %d)\n", i);
334 break;
335 }
336
338
339 Ptr += DeviceNode->Size;
340 PnpBufferSize += DeviceNode->Size;
341
342 FoundNodeCount++;
343 if (FoundNodeCount >= NodeCount)
344 break;
345 }
346 }
347
348 /* Set real data size */
349 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
350 PnpBufferSize;
351 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
352
353 TRACE("Real buffer size: %u\n", PnpBufferSize);
354 TRACE("Resource size: %u\n", Size);
355
356 /* Create component key */
357 FldrCreateComponentKey(SystemKey,
360 0,
361 0,
362 0xFFFFFFFF,
363 "PNP BIOS",
364 PartialResourceList,
365 Size,
366 &BusKey);
367
368 DetectDockingStation(BusKey);
369
370 (*BusNumber)++;
371}
372
373static
374VOID
376 UCHAR LineControl)
377{
378 WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */
379 WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */
380 WRITE_PORT_UCHAR(Port + 1, 0); /* speed HI byte */
381 WRITE_PORT_UCHAR(Port + 3, LineControl);
382 WRITE_PORT_UCHAR(Port + 1, 0); /* set comm and DLAB to 0 */
383 WRITE_PORT_UCHAR(Port + 4, 0x09); /* DR int enable */
384 READ_PORT_UCHAR(Port + 5); /* clear error bits */
385}
386
387static
388ULONG
390{
391 CHAR Buffer[4];
392 ULONG i;
393 ULONG TimeOut;
394 UCHAR LineControl;
395
396 /* Shutdown mouse or something like that */
397 LineControl = READ_PORT_UCHAR(Port + 4);
398 WRITE_PORT_UCHAR(Port + 4, (LineControl & ~0x02) | 0x01);
400
401 /*
402 * Clear buffer
403 * Maybe there is no serial port although BIOS reported one (this
404 * is the case on Apple hardware), or the serial port is misbehaving,
405 * therefore we must give up after some time.
406 */
407 TimeOut = 200;
408 while (READ_PORT_UCHAR(Port + 5) & 0x01)
409 {
410 if (--TimeOut == 0)
411 return MOUSE_TYPE_NONE;
413 }
414
415 /*
416 * Send modem control with 'Data Terminal Ready', 'Request To Send' and
417 * 'Output Line 2' message. This enables mouse to identify.
418 */
419 WRITE_PORT_UCHAR(Port + 4, 0x0b);
420
421 /* Wait 10 milliseconds for the mouse getting ready */
423
424 /* Read first four bytes, which contains Microsoft Mouse signs */
425 TimeOut = 20;
426 for (i = 0; i < 4; i++)
427 {
428 while ((READ_PORT_UCHAR(Port + 5) & 1) == 0)
429 {
431 --TimeOut;
432 if (TimeOut == 0)
433 return MOUSE_TYPE_NONE;
434 }
436 }
437
438 TRACE("Mouse data: %x %x %x %x\n",
439 Buffer[0], Buffer[1], Buffer[2], Buffer[3]);
440
441 /* Check that four bytes for signs */
442 for (i = 0; i < 4; ++i)
443 {
444 if (Buffer[i] == 'B')
445 {
446 /* Sign for Microsoft Ballpoint */
447// DbgPrint("Microsoft Ballpoint device detected\n");
448// DbgPrint("THIS DEVICE IS NOT SUPPORTED, YET\n");
449 return MOUSE_TYPE_NONE;
450 }
451 else if (Buffer[i] == 'M')
452 {
453 /* Sign for Microsoft Mouse protocol followed by button specifier */
454 if (i == 3)
455 {
456 /* Overflow Error */
457 return MOUSE_TYPE_NONE;
458 }
459
460 switch (Buffer[i + 1])
461 {
462 case '3':
463 TRACE("Microsoft Mouse with 3-buttons detected\n");
464 return MOUSE_TYPE_LOGITECH;
465
466 case 'Z':
467 TRACE("Microsoft Wheel Mouse detected\n");
468 return MOUSE_TYPE_WHEELZ;
469
470 /* case '2': */
471 default:
472 TRACE("Microsoft Mouse with 2-buttons detected\n");
474 }
475 }
476 }
477
478 return MOUSE_TYPE_NONE;
479}
480
481static ULONG
483{
484 ULONG TimeOut;
485 ULONG i = 0;
486 char c;
487 char x;
488
489 WRITE_PORT_UCHAR(Port + 4, 0x09);
490
491 /* Wait 10 milliseconds for the mouse getting ready */
493
494 WRITE_PORT_UCHAR(Port + 4, 0x0b);
495
497
498 for (;;)
499 {
500 TimeOut = 200;
501 while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
502 {
504 --TimeOut;
505 if (TimeOut == 0)
506 {
507 return 0;
508 }
509 }
510
512 if (c == 0x08 || c == 0x28)
513 break;
514 }
515
516 Buffer[i++] = c;
517 x = c + 1;
518
519 for (;;)
520 {
521 TimeOut = 200;
522 while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
523 {
525 --TimeOut;
526 if (TimeOut == 0)
527 return 0;
528 }
530 Buffer[i++] = c;
531 if (c == x)
532 break;
533 if (i >= 256)
534 break;
535 }
536
537 return i;
538}
539
540static
541VOID
543 PUCHAR Base)
544{
545 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
546 char Buffer[256];
547 CHAR Identifier[256];
548 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
549 ULONG MouseType;
551 ULONG i;
552 ULONG j;
553 ULONG k;
554
555 TRACE("DetectSerialPointerPeripheral()\n");
556
557 Identifier[0] = 0;
558
560 MouseType = DetectSerialMouse(Base);
561
562 if (MouseType != MOUSE_TYPE_NONE)
563 {
565 TRACE( "PnP ID length: %u\n", Length);
566
567 if (Length != 0)
568 {
569 /* Convert PnP sting to ASCII */
570 if (Buffer[0] == 0x08)
571 {
572 for (i = 0; i < Length; i++)
573 Buffer[i] += 0x20;
574 }
575 Buffer[Length] = 0;
576
577 TRACE("PnP ID string: %s\n", Buffer);
578
579 /* Copy PnpId string */
580 for (i = 0; i < 7; i++)
581 {
582 Identifier[i] = Buffer[3 + i];
583 }
584 memcpy(&Identifier[7],
585 L" - ",
586 3 * sizeof(WCHAR));
587
588 /* Skip device serial number */
589 i = 10;
590 if (Buffer[i] == '\\')
591 {
592 for (j = ++i; i < Length; ++i)
593 {
594 if (Buffer[i] == '\\')
595 break;
596 }
597 if (i >= Length)
598 i -= 3;
599 }
600
601 /* Skip PnP class */
602 if (Buffer[i] == '\\')
603 {
604 for (j = ++i; i < Length; ++i)
605 {
606 if (Buffer[i] == '\\')
607 break;
608 }
609
610 if (i >= Length)
611 i -= 3;
612 }
613
614 /* Skip compatible PnP Id */
615 if (Buffer[i] == '\\')
616 {
617 for (j = ++i; i < Length; ++i)
618 {
619 if (Buffer[i] == '\\')
620 break;
621 }
622 if (Buffer[j] == '*')
623 ++j;
624 if (i >= Length)
625 i -= 3;
626 }
627
628 /* Get product description */
629 if (Buffer[i] == '\\')
630 {
631 for (j = ++i; i < Length; ++i)
632 {
633 if (Buffer[i] == ';')
634 break;
635 }
636 if (i >= Length)
637 i -= 3;
638 if (i > j + 1)
639 {
640 for (k = 0; k < i - j; k++)
641 {
642 Identifier[k + 10] = Buffer[k + j];
643 }
644 Identifier[10 + (i - j)] = 0;
645 }
646 }
647
648 TRACE("Identifier string: %s\n", Identifier);
649 }
650
651 if (Length == 0 || strlen(Identifier) < 11)
652 {
653 switch (MouseType)
654 {
656 strcpy(Identifier, "LOGITECH SERIAL MOUSE");
657 break;
658
660 strcpy(Identifier, "MICROSOFT SERIAL MOUSE WITH WHEEL");
661 break;
662
664 default:
665 strcpy(Identifier, "MICROSOFT SERIAL MOUSE");
666 break;
667 }
668 }
669
670 /* Set 'Configuration Data' value */
673 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
674 if (PartialResourceList == NULL)
675 {
676 ERR("Failed to allocate resource descriptor\n");
677 return;
678 }
679
680 RtlZeroMemory(PartialResourceList, Size);
681 PartialResourceList->Version = 1;
682 PartialResourceList->Revision = 1;
683 PartialResourceList->Count = 0;
684
685 /* Create 'PointerPeripheral' key */
686 FldrCreateComponentKey(ControllerKey,
689 Input,
690 0,
691 0xFFFFFFFF,
693 PartialResourceList,
694 Size,
695 &PeripheralKey);
696 }
697}
698
699static
700ULONG
702{
703 static const ULONG PcIrq[MAX_COM_PORTS] = {4, 3, 4, 3};
704 PUSHORT BasePtr;
705
706 /*
707 * The BIOS data area 0x400 holds the address of the first valid COM port.
708 * Each COM port address is stored in a 2-byte field.
709 * Infos at: http://www.bioscentral.com/misc/bda.htm
710 */
711 BasePtr = (PUSHORT)0x400;
712 *Irq = PcIrq[Index];
713
714 return (ULONG) *(BasePtr + Index);
715}
716
717/*
718 * Parse the serial mouse detection options.
719 * Format: /FASTDETECT
720 * or: /NOSERIALMICE=COM[0-9],[0-9],[0-9]...
721 * or: /NOSERIALMICE:COM[0-9]...
722 * If we have /FASTDETECT, then nothing can be detected.
723 */
724static
725ULONG
728{
729 PCSTR Option, c;
730 ULONG OptionLength, PortBitmap, i;
731
732 if (NtLdrGetOption(Options, "FASTDETECT"))
733 return (1 << MAX_COM_PORTS) - 1;
734
735 Option = NtLdrGetOptionEx(Options, "NOSERIALMICE=", &OptionLength);
736 if (!Option)
737 Option = NtLdrGetOptionEx(Options, "NOSERIALMICE:", &OptionLength);
738
739 if (!Option)
740 return 0;
741
742 /* Invalid port list */
743 if (OptionLength < (sizeof("NOSERIALMICE=COM9") - 1))
744 return (1 << MAX_COM_PORTS) - 1;
745
746 /* Move to the port list */
747 Option += sizeof("NOSERIALMICE=COM") - 1;
748 OptionLength -= sizeof("NOSERIALMICE=COM") - 1;
749
750 PortBitmap = 0;
751 c = Option;
752 for (i = 0; i < OptionLength; i += 2)
753 {
754 UCHAR PortNumber = *c - '0';
755
756 if (PortNumber > 0 && PortNumber <= 9)
757 PortBitmap |= 1 << (PortNumber - 1);
758
759 c += 2;
760 }
761
762 return PortBitmap;
763}
764
765VOID
769 _In_ GET_SERIAL_PORT MachGetSerialPort,
771{
772 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
773 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
774 PCM_SERIAL_DEVICE_DATA SerialDeviceData;
775 ULONG Irq;
776 ULONG Base;
777 CHAR Identifier[80];
778 ULONG ControllerNumber = 0;
779 PCONFIGURATION_COMPONENT_DATA ControllerKey;
780 ULONG i;
781 ULONG Size;
782 ULONG PortBitmap;
783
784 TRACE("DetectSerialPorts()\n");
785
787
788 for (i = 0; i < Count; i++)
789 {
790 Base = MachGetSerialPort(i, &Irq);
791 if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
792 continue;
793
794 TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
795
796 /* Set 'Identifier' value */
797 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%ld", i + 1);
798
799 /* Build full device descriptor */
802 sizeof(CM_SERIAL_DEVICE_DATA);
803 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
804 if (PartialResourceList == NULL)
805 {
806 ERR("Failed to allocate resource descriptor! Ignoring remaining serial ports. (i = %lu, Count = %lu)\n",
807 i, Count);
808 break;
809 }
810
811 /* Initialize resource descriptor */
812 RtlZeroMemory(PartialResourceList, Size);
813 PartialResourceList->Version = 1;
814 PartialResourceList->Revision = 1;
815 PartialResourceList->Count = 3;
816
817 /* Set IO Port */
818 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
819 PartialDescriptor->Type = CmResourceTypePort;
821 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
822 PartialDescriptor->u.Port.Start.LowPart = Base;
823 PartialDescriptor->u.Port.Start.HighPart = 0x0;
824 PartialDescriptor->u.Port.Length = 8;
825
826 /* Set Interrupt */
827 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
828 PartialDescriptor->Type = CmResourceTypeInterrupt;
830 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
831 PartialDescriptor->u.Interrupt.Level = Irq;
832 PartialDescriptor->u.Interrupt.Vector = Irq;
833 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
834
835 /* Set serial data (device specific) */
836 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
837 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
839 PartialDescriptor->Flags = 0;
840 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
841
842 SerialDeviceData =
843 (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
844 SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
845
846 /* Create controller key */
851 ControllerNumber,
852 0xFFFFFFFF,
854 PartialResourceList,
855 Size,
856 &ControllerKey);
857
858 if (!(PortBitmap & (1 << i)) && !Rs232PortInUse(UlongToPtr(Base)))
859 {
860 /* Detect serial mouse */
862 }
863
864 ControllerNumber++;
865 }
866}
867
868static VOID
870{
871 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
872 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
873 ULONG Irq[MAX_LPT_PORTS] = {7, 5, (ULONG) - 1};
874 CHAR Identifier[80];
875 PCONFIGURATION_COMPONENT_DATA ControllerKey;
876 PUSHORT BasePtr;
877 ULONG Base;
878 ULONG ControllerNumber = 0;
879 ULONG i;
880 ULONG Size;
881
882 TRACE("DetectParallelPorts() called\n");
883
884 /*
885 * The BIOS data area 0x408 holds the address of the first valid LPT port.
886 * Each LPT port address is stored in a 2-byte field.
887 * Infos at: http://www.bioscentral.com/misc/bda.htm
888 */
889 BasePtr = (PUSHORT)0x408;
890
891 for (i = 0; i < MAX_LPT_PORTS; i++, BasePtr++)
892 {
893 Base = (ULONG) * BasePtr;
894 if (Base == 0)
895 continue;
896
897 TRACE("Parallel port %u: %x\n", ControllerNumber, Base);
898
899 /* Set 'Identifier' value */
900 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PARALLEL%ld", i + 1);
901
902 /* Build full device descriptor */
904 if (Irq[i] != (ULONG) - 1)
906
907 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
908 if (PartialResourceList == NULL)
909 {
910 ERR("Failed to allocate resource descriptor! Ignoring remaining parallel ports. (i = %lu)\n", i);
911 break;
912 }
913
914 /* Initialize resource descriptor */
915 RtlZeroMemory(PartialResourceList, Size);
916 PartialResourceList->Version = 1;
917 PartialResourceList->Revision = 1;
918 PartialResourceList->Count = (Irq[i] != (ULONG) - 1) ? 2 : 1;
919
920 /* Set IO Port */
921 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
922 PartialDescriptor->Type = CmResourceTypePort;
924 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
925 PartialDescriptor->u.Port.Start.LowPart = Base;
926 PartialDescriptor->u.Port.Start.HighPart = 0x0;
927 PartialDescriptor->u.Port.Length = 3;
928
929 /* Set Interrupt */
930 if (Irq[i] != (ULONG) - 1)
931 {
932 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
933 PartialDescriptor->Type = CmResourceTypeInterrupt;
935 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
936 PartialDescriptor->u.Interrupt.Level = Irq[i];
937 PartialDescriptor->u.Interrupt.Vector = Irq[i];
938 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
939 }
940
941 /* Create controller key */
945 Output,
946 ControllerNumber,
947 0xFFFFFFFF,
949 PartialResourceList,
950 Size,
951 &ControllerKey);
952
953 ControllerNumber++;
954 }
955
956 TRACE("DetectParallelPorts() done\n");
957}
958
959// static
962{
964 UCHAR Scancode;
965 ULONG Loops;
967
968 /* Identify device */
970
971 /* Wait for reply */
972 for (Loops = 0; Loops < 100; Loops++)
973 {
977 break;
978 }
979
981 {
982 /* PC/XT keyboard or no keyboard */
983 Result = FALSE;
984 }
985
987 if (Scancode != 0xFA)
988 {
989 /* No ACK received */
990 Result = FALSE;
991 }
992
994
997 {
998 /* Found AT keyboard */
999 return Result;
1000 }
1001
1003 if (Scancode != 0xAB)
1004 {
1005 /* No 0xAB received */
1006 Result = FALSE;
1007 }
1008
1010
1013 {
1014 /* No byte in buffer */
1015 Result = FALSE;
1016 }
1017
1019 if (Scancode != 0x41)
1020 {
1021 /* No 0x41 received */
1022 Result = FALSE;
1023 }
1024
1025 /* Found MF-II keyboard */
1026 return Result;
1027}
1028
1029static VOID
1031{
1032 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1033 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
1034 PCM_KEYBOARD_DEVICE_DATA KeyboardData;
1035 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1036 ULONG Size;
1037 REGS Regs;
1038
1039 /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2
1040 if (DetectKeyboardDevice()) */
1041 {
1042 /* Set 'Configuration Data' value */
1043 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
1045 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1046 if (PartialResourceList == NULL)
1047 {
1048 ERR("Failed to allocate resource descriptor\n");
1049 return;
1050 }
1051
1052 /* Initialize resource descriptor */
1053 RtlZeroMemory(PartialResourceList, Size);
1054 PartialResourceList->Version = 1;
1055 PartialResourceList->Revision = 1;
1056 PartialResourceList->Count = 1;
1057
1058 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
1059 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
1060 PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
1061 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
1062
1063 /* Int 16h AH=02h
1064 * KEYBOARD - GET SHIFT FLAGS
1065 *
1066 * Return:
1067 * AL - shift flags
1068 */
1069 Regs.b.ah = 0x02;
1070 Int386(0x16, &Regs, &Regs);
1071
1072 KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
1073 KeyboardData->Version = 1;
1074 KeyboardData->Revision = 1;
1075 KeyboardData->Type = 4;
1076 KeyboardData->Subtype = 0;
1077 KeyboardData->KeyboardFlags = Regs.b.al;
1078
1079 /* Create controller key */
1080 FldrCreateComponentKey(ControllerKey,
1083 Input | ConsoleIn,
1084 0,
1085 0xFFFFFFFF,
1086 "PCAT_ENHANCED",
1087 PartialResourceList,
1088 Size,
1089 &PeripheralKey);
1090 }
1091}
1092
1093static
1094VOID
1096{
1097 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1098 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
1099 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1100 ULONG Size;
1101
1102 /* Set 'Configuration Data' value */
1103 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
1105 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1106 if (PartialResourceList == NULL)
1107 {
1108 ERR("Failed to allocate resource descriptor\n");
1109 return;
1110 }
1111
1112 /* Initialize resource descriptor */
1113 RtlZeroMemory(PartialResourceList, Size);
1114 PartialResourceList->Version = 1;
1115 PartialResourceList->Revision = 1;
1116 PartialResourceList->Count = 3;
1117
1118 /* Set Interrupt */
1119 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
1120 PartialDescriptor->Type = CmResourceTypeInterrupt;
1121 PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
1122 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1123 PartialDescriptor->u.Interrupt.Level = 1;
1124 PartialDescriptor->u.Interrupt.Vector = 1;
1125 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
1126
1127 /* Set IO Port 0x60 */
1128 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
1129 PartialDescriptor->Type = CmResourceTypePort;
1131 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1132 PartialDescriptor->u.Port.Start.LowPart = 0x60;
1133 PartialDescriptor->u.Port.Start.HighPart = 0x0;
1134 PartialDescriptor->u.Port.Length = 1;
1135
1136 /* Set IO Port 0x64 */
1137 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
1138 PartialDescriptor->Type = CmResourceTypePort;
1140 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1141 PartialDescriptor->u.Port.Start.LowPart = 0x64;
1142 PartialDescriptor->u.Port.Start.HighPart = 0x0;
1143 PartialDescriptor->u.Port.Length = 1;
1144
1145 /* Create controller key */
1149 Input | ConsoleIn,
1150 0,
1151 0xFFFFFFFF,
1152 NULL,
1153 PartialResourceList,
1154 Size,
1155 &ControllerKey);
1156
1157 DetectKeyboardPeripheral(ControllerKey);
1158}
1159
1160static
1161VOID
1163{
1164 ULONG Timeout;
1165 UCHAR Status;
1166
1168 {
1171 return;
1172
1173 /* Sleep for one millisecond */
1175 }
1176}
1177
1178static
1179BOOLEAN
1181{
1182#if 1
1183 /* Current detection is too unreliable. Just do as if
1184 * the PS/2 aux port is always present
1185 */
1186 return TRUE;
1187#else
1188 ULONG Loops;
1189 UCHAR Status;
1190
1191 /* Put the value 0x5A in the output buffer using the
1192 * "WriteAuxiliary Device Output Buffer" command (0xD3).
1193 * Poll the Status Register for a while to see if the value really turns up
1194 * in the Data Register. If the KEYBOARD_STATUS_MOUSE_OBF bit is also set
1195 * to 1 in the Status Register, we assume this controller has an
1196 * Auxiliary Port (a.k.a. Mouse Port).
1197 */
1202
1203 /* 0x5A is a random dummy value */
1205 0x5A);
1206
1207 for (Loops = 0; Loops < 10; Loops++)
1208 {
1212 break;
1213 }
1214
1216
1218#endif
1219}
1220
1221static
1222BOOLEAN
1224{
1225 UCHAR Scancode;
1226 UCHAR Status;
1227 ULONG Loops;
1229
1234
1235 /* Identify device */
1237
1238 /* Wait for reply */
1239 for (Loops = 0; Loops < 100; Loops++)
1240 {
1244 break;
1245 }
1246
1249 Result = FALSE;
1250
1252 if (Scancode != 0xFA)
1253 Result = FALSE;
1254
1256
1259 Result = FALSE;
1260
1262 if (Scancode != 0x00)
1263 Result = FALSE;
1264
1265 return Result;
1266}
1267
1268// FIXME: Missing: DetectPS2Peripheral!! (for corresponding 'PointerPeripheral')
1269
1270static
1271VOID
1273{
1274 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1275 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1276 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1277 ULONG Size;
1278
1279 if (DetectPS2AuxPort())
1280 {
1281 TRACE("Detected PS2 port\n");
1282
1283 PartialResourceList = FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST), TAG_HW_RESOURCE_LIST);
1284 if (PartialResourceList == NULL)
1285 {
1286 ERR("Failed to allocate resource descriptor\n");
1287 return;
1288 }
1289
1290 /* Initialize resource descriptor */
1291 RtlZeroMemory(PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST));
1292 PartialResourceList->Version = 1;
1293 PartialResourceList->Revision = 1;
1294 PartialResourceList->Count = 1;
1295
1296 /* Set Interrupt */
1297 PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeInterrupt;
1299 PartialResourceList->PartialDescriptors[0].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1300 PartialResourceList->PartialDescriptors[0].u.Interrupt.Level = 12;
1301 PartialResourceList->PartialDescriptors[0].u.Interrupt.Vector = 12;
1302 PartialResourceList->PartialDescriptors[0].u.Interrupt.Affinity = 0xFFFFFFFF;
1303
1304 /* Create controller key */
1308 Input,
1309 0,
1310 0xFFFFFFFF,
1311 NULL,
1312 PartialResourceList,
1314 &ControllerKey);
1315
1316 if (DetectPS2AuxDevice())
1317 {
1318 TRACE("Detected PS2 mouse\n");
1319
1320 /* Initialize resource descriptor */
1321 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1323 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1324 if (PartialResourceList == NULL)
1325 {
1326 ERR("Failed to allocate resource descriptor\n");
1327 return;
1328 }
1329
1330 RtlZeroMemory(PartialResourceList, Size);
1331 PartialResourceList->Version = 1;
1332 PartialResourceList->Revision = 1;
1333 PartialResourceList->Count = 0;
1334
1335 /* Create peripheral key */
1336 FldrCreateComponentKey(ControllerKey,
1339 Input,
1340 0,
1341 0xFFFFFFFF,
1342 "MICROSOFT PS2 MOUSE",
1343 PartialResourceList,
1344 Size,
1345 &PeripheralKey);
1346 }
1347 }
1348}
1349
1350#if defined(_M_IX86)
1351static VOID
1352CreateBusMousePeripheralKey(
1354 _In_ ULONG IoBase,
1355 _In_ ULONG Irq)
1356{
1357 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1358 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
1359 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1360 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
1361 ULONG Size;
1362
1363 /* Set 'Configuration Data' value */
1364 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[2]);
1365 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1366 if (PartialResourceList == NULL)
1367 {
1368 ERR("Failed to allocate resource descriptor\n");
1369 return;
1370 }
1371
1372 /* Initialize resource descriptor */
1373 RtlZeroMemory(PartialResourceList, Size);
1374 PartialResourceList->Version = 1;
1375 PartialResourceList->Revision = 1;
1376 PartialResourceList->Count = 2;
1377
1378 /* Set IO Port */
1379 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
1380 PartialDescriptor->Type = CmResourceTypePort;
1382 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
1383 PartialDescriptor->u.Port.Start.LowPart = IoBase;
1384 PartialDescriptor->u.Port.Start.HighPart = 0;
1385 PartialDescriptor->u.Port.Length = 4;
1386
1387 /* Set Interrupt */
1388 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
1389 PartialDescriptor->Type = CmResourceTypeInterrupt;
1390 PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
1391 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
1392 PartialDescriptor->u.Interrupt.Level = Irq;
1393 PartialDescriptor->u.Interrupt.Vector = Irq;
1394 PartialDescriptor->u.Interrupt.Affinity = (KAFFINITY)-1;
1395
1396 /* Create controller key */
1400 Input,
1401 0,
1402 0xFFFFFFFF,
1403 NULL,
1404 PartialResourceList,
1405 Size,
1406 &ControllerKey);
1407
1408 /* Set 'Configuration Data' value */
1409 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
1410 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1411 if (PartialResourceList == NULL)
1412 {
1413 ERR("Failed to allocate resource descriptor\n");
1414 return;
1415 }
1416
1417 /* Initialize resource descriptor */
1418 RtlZeroMemory(PartialResourceList, Size);
1419 PartialResourceList->Version = 1;
1420 PartialResourceList->Revision = 1;
1421 PartialResourceList->Count = 0;
1422
1423 /* Create peripheral key */
1424 FldrCreateComponentKey(ControllerKey,
1427 Input,
1428 0,
1429 0xFFFFFFFF,
1430 "MICROSOFT INPORT MOUSE",
1431 PartialResourceList,
1432 Size,
1433 &PeripheralKey);
1434}
1435
1436extern KIDTENTRY DECLSPEC_ALIGN(4) i386Idt[32];
1437VOID __cdecl HwIrqHandler(VOID);
1438extern volatile ULONG HwIrqCount;
1439
1440static ULONG
1441DetectBusMouseTestIrq(
1442 _In_ ULONG IoBase,
1443 _In_ ULONG Irq)
1444{
1445 USHORT OldOffset, OldExtendedOffset;
1446 ULONG Vector, i;
1447
1448 HwIrqCount = 0;
1449
1450 /* Reset the device */
1453
1454 Vector = Irq + 8;
1455
1456 /* Save the old interrupt vector and replace it by ours */
1457 OldOffset = i386Idt[Vector].Offset;
1458 OldExtendedOffset = i386Idt[Vector].ExtendedOffset;
1459
1460 i386Idt[Vector].Offset = (ULONG)HwIrqHandler & 0xFFFF;
1461 i386Idt[Vector].ExtendedOffset = (ULONG)HwIrqHandler >> 16;
1462
1463 /* Enable the requested IRQ on the master PIC */
1464 WRITE_PORT_UCHAR((PUCHAR)PIC1_DATA_PORT, ~(1 << Irq));
1465
1466 _enable();
1467
1468 /* Configure the device to generate interrupts */
1469 for (i = 0; i < 15; i++)
1470 {
1473 }
1474
1475 /* Disable the device */
1477
1478 _disable();
1479
1480 i386Idt[Vector].Offset = OldOffset;
1481 i386Idt[Vector].ExtendedOffset = OldExtendedOffset;
1482
1483 return (HwIrqCount != 0) ? Irq : 0;
1484}
1485
1486static ULONG
1487DetectBusMouseIrq(
1488 _In_ ULONG IoBase)
1489{
1490 UCHAR Mask1, Mask2;
1491 ULONG Irq, Result;
1492
1493 /* Save the current interrupt mask */
1496
1497 /* Mask the interrupts on the slave PIC */
1499
1500 /* Process IRQ detection: IRQ 5, 4, 3 */
1501 for (Irq = 5; Irq >= 3; Irq--)
1502 {
1503 Result = DetectBusMouseTestIrq(IoBase, Irq);
1504 if (Result != 0)
1505 break;
1506 }
1507
1508 /* Restore the mask */
1511
1512 return Result;
1513}
1514
1515static VOID
1516DetectBusMouse(
1518{
1519 ULONG IoBase, Irq, Signature1, Signature2, Signature3;
1520
1521 /*
1522 * The bus mouse lives at one of these addresses: 0x230, 0x234, 0x238, 0x23C.
1523 * The 0x23C port is the most common I/O setting.
1524 */
1525 for (IoBase = 0x23C; IoBase >= 0x230; IoBase -= 4)
1526 {
1527 Signature1 = READ_PORT_UCHAR((PUCHAR)IoBase + INPORT_REGISTER_SIGNATURE);
1528 Signature2 = READ_PORT_UCHAR((PUCHAR)IoBase + INPORT_REGISTER_SIGNATURE);
1529 if (Signature1 == Signature2)
1530 continue;
1531 if (Signature1 != INPORT_SIGNATURE && Signature2 != INPORT_SIGNATURE)
1532 continue;
1533
1534 Signature3 = READ_PORT_UCHAR((PUCHAR)IoBase + INPORT_REGISTER_SIGNATURE);
1535 if (Signature1 != Signature3)
1536 continue;
1537
1538 Irq = DetectBusMouseIrq(IoBase);
1539 if (Irq == 0)
1540 continue;
1541
1542 CreateBusMousePeripheralKey(BusKey, IoBase, Irq);
1543 break;
1544 }
1545}
1546#endif /* _M_IX86 */
1547
1548// Implemented in pcvesa.c, returns the VESA version
1552
1553static VOID
1555{
1557 PCONFIGURATION_COMPONENT_DATA ControllerKey;
1558 USHORT VesaVersion;
1559
1560 /* FIXME: Set 'ComponentInformation' value */
1561
1562 VesaVersion = BiosIsVesaSupported();
1563 if (VesaVersion != 0)
1564 {
1565 TRACE("VESA version %c.%c\n",
1566 (VesaVersion >> 8) + '0',
1567 (VesaVersion & 0xFF) + '0');
1568 }
1569 else
1570 {
1571 TRACE("VESA not supported\n");
1572 }
1573
1574 if (VesaVersion >= 0x0200)
1575 Identifier = "VBE Display";
1576 else
1577 Identifier = "VGA Display";
1578
1583 0,
1584 0xFFFFFFFF,
1585 Identifier,
1586 NULL,
1587 0,
1588 &ControllerKey);
1589
1590 /* FIXME: Add display peripheral (monitor) data */
1591 if (VesaVersion != 0)
1592 {
1594 {
1595 TRACE("VESA/DDC supported!\n");
1596 if (BiosVesaReadEdid())
1597 {
1598 TRACE("EDID data read successfully!\n");
1599 }
1600 }
1601 }
1602}
1603
1604static
1605VOID
1610{
1611 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1613 ULONG Size;
1614
1615 /* Set 'Configuration Data' value */
1616 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1618 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1619 if (PartialResourceList == NULL)
1620 {
1621 ERR("Failed to allocate resource descriptor\n");
1622 return;
1623 }
1624
1625 /* Initialize resource descriptor */
1626 RtlZeroMemory(PartialResourceList, Size);
1627 PartialResourceList->Version = 1;
1628 PartialResourceList->Revision = 1;
1629 PartialResourceList->Count = 0;
1630
1631 /* Create new bus key */
1632 FldrCreateComponentKey(SystemKey,
1635 0,
1636 0,
1637 0xFFFFFFFF,
1638 "ISA",
1639 PartialResourceList,
1640 Size,
1641 &BusKey);
1642
1643 /* Increment bus number */
1644 (*BusNumber)++;
1645
1646 /* Detect ISA/BIOS devices */
1647 DetectBiosDisks(SystemKey, BusKey);
1649 DetectParallelPorts(BusKey);
1651 DetectPS2Mouse(BusKey);
1652#if defined(_M_IX86)
1653 DetectBusMouse(BusKey);
1654#endif
1656
1657 /* FIXME: Detect more ISA devices */
1658}
1659
1660/* FIXME: Abstract things better so we don't need to place define here */
1661#if !defined(SARCH_XBOX)
1662static
1663UCHAR
1665{
1666 UCHAR Data;
1667
1668 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x10);
1669 Data = READ_PORT_UCHAR((PUCHAR)0x71);
1670
1671 return ((Data & 0xF0) ? 1 : 0) + ((Data & 0x0F) ? 1 : 0);
1672}
1673#endif
1674
1678{
1680 ULONG BusNumber = 0;
1681
1682 TRACE("DetectHardware()\n");
1683
1684 /* Create the 'System' key */
1685 // TODO: Discover and set the other machine types
1686 FldrCreateSystemKey(&SystemKey, "AT/AT COMPATIBLE");
1687
1690
1691 /* Detect buses */
1692 DetectPciBios(SystemKey, &BusNumber);
1693 DetectApmBios(SystemKey, &BusNumber);
1694 DetectPnpBios(SystemKey, &BusNumber);
1695 DetectIsaBios(Options, SystemKey, &BusNumber); // TODO: Detect first EISA or MCA, before ISA
1696 DetectAcpiBios(SystemKey, &BusNumber);
1697
1698 // TODO: Collect the ROM blocks from 0xC0000 to 0xF0000 and append their
1699 // CM_ROM_BLOCK data into the 'System' key's configuration data.
1700
1701 TRACE("DetectHardware() Done\n");
1702 return SystemKey;
1703}
1704
1705VOID
1707{
1708 REGS Regs;
1709
1710 /* Select APM 1.0+ function */
1711 Regs.b.ah = 0x53;
1712
1713 /* Function 05h: CPU idle */
1714 Regs.b.al = 0x05;
1715
1716 /* Call INT 15h */
1717 Int386(0x15, &Regs, &Regs);
1718
1719 /* Check if successfull (CF set on error) */
1720 if (INT386_SUCCESS(Regs))
1721 return;
1722
1723 /*
1724 * No futher processing here.
1725 * Optionally implement HLT instruction handling.
1726 */
1727}
1728
1730 IN UCHAR BootDrive OPTIONAL,
1731 IN ULONG BootPartition OPTIONAL)
1732{
1733 REGS Regs;
1734
1735 RtlZeroMemory(&Regs, sizeof(Regs));
1736
1737 /* Set the boot drive and the boot partition */
1738 Regs.b.dl = (UCHAR)(BootDrive ? BootDrive : FrldrBootDrive);
1739 Regs.b.dh = (UCHAR)(BootPartition ? BootPartition : FrldrBootPartition);
1740
1741 /*
1742 * Don't stop the floppy drive motor when we are just booting a bootsector,
1743 * a drive, or a partition. If we were to stop the floppy motor, the BIOS
1744 * wouldn't be informed and if the next read is to a floppy then the BIOS
1745 * will still think the motor is on and this will result in a read error.
1746 */
1747 // DiskStopFloppyMotor();
1748
1749 Relocator16Boot(&Regs,
1750 /* Stack segment:pointer */
1751 0x0000, 0x7C00,
1752 /* Code segment:pointer */
1753 0x0000, 0x7C00);
1754}
1755
1756/******************************************************************************/
1757
1758/* FIXME: Abstract things better so we don't need to place define here */
1759#if !defined(SARCH_XBOX)
1760VOID
1761MachInit(const char *CmdLine)
1762{
1763 /* Setup vtbl */
1764 RtlZeroMemory(&MachVtbl, sizeof(MachVtbl));
1793
1795}
1796
1797VOID
1799{
1800 /* On PC, prepare video and turn off the floppy motor */
1803}
1804#endif
1805
1806/* EOF */
@ DeviceNode
Definition: Node.h:9
unsigned char BOOLEAN
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define __cdecl
Definition: accygwin.h:79
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:54
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:69
ULONG __cdecl PnpBiosGetDockStationInformation(UCHAR *DockingStationInfo)
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
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
static const WCHAR CmdLine[]
Definition: install.c:48
#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:473
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
void __cdecl _disable(void)
Definition: intrin_arm.h:365
void __cdecl _enable(void)
Definition: intrin_arm.h:373
#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:96
#define PIC1_DATA_PORT
Definition: machpc.c:54
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machpc.c:239
#define MOUSE_TYPE_MICROSOFT
Definition: machpc.c:35
static VOID DetectDockingStation(_Inout_ PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:182
#define MAX_LPT_PORTS
Definition: machpc.c:30
BOOLEAN BiosVesaReadEdid(VOID)
Definition: pcvesa.c:272
static VOID PS2ControllerWait(VOID)
Definition: machpc.c:1162
#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:482
static ULONG DetectSerialMouse(PUCHAR Port)
Definition: machpc.c:389
static VOID DetectIsaBios(_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA SystemKey, _Out_ ULONG *BusNumber)
Definition: machpc.c:1606
VOID MachInit(const char *CmdLine)
Definition: machpc.c:1761
#define INPORT_TEST_IRQ
Definition: machpc.c:50
static BOOLEAN DetectPS2AuxDevice(VOID)
Definition: machpc.c:1223
#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:701
BOOLEAN DetectKeyboardDevice(VOID)
Definition: machpc.c:961
#define MAX_COM_PORTS
Definition: machpc.c:29
static UCHAR PcGetFloppyCount(VOID)
Definition: machpc.c:1664
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1095
PCONFIGURATION_COMPONENT_DATA PcHwDetect(_In_opt_ PCSTR Options)
Definition: machpc.c:1676
#define PIC2_DATA_PORT
Definition: machpc.c:56
static VOID InitializeSerialPort(PUCHAR Port, UCHAR LineControl)
Definition: machpc.c:375
#define CONTROLLER_TIMEOUT
Definition: machpc.c:92
#define CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL
Definition: machpc.c:85
VOID PcHwIdle(VOID)
Definition: machpc.c:1706
#define MOUSE_TYPE_NONE
Definition: machpc.c:33
#define CONTROLLER_STATUS_OUTPUT_BUFFER_FULL
Definition: machpc.c:80
#define CONTROLLER_REGISTER_CONTROL
Definition: machpc.c:62
VOID PcPrepareForReactOS(VOID)
Definition: machpc.c:1798
#define MOUSE_TYPE_WHEELZ
Definition: machpc.c:39
VOID __cdecl ChainLoadBiosBootSectorCode(IN UCHAR BootDrive OPTIONAL, IN ULONG BootPartition OPTIONAL)
Definition: machpc.c:1729
#define INPORT_REG_MODE
Definition: machpc.c:47
static BOOLEAN DetectPS2AuxPort(VOID)
Definition: machpc.c:1180
static VOID DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1272
static VOID DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: machpc.c:1030
static ULONG GetSerialMouseDetectionBitmap(_In_opt_ PCSTR Options)
Definition: machpc.c:726
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:869
#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:766
#define INPORT_REGISTER_SIGNATURE
Definition: machpc.c:45
static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machpc.c:1554
#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:120
static VOID DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
Definition: machpc.c:542
BOOLEAN BiosIsVesaDdcSupported(VOID)
Definition: pcvesa.c:242
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
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2451
#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
#define DECLSPEC_ALIGN(x)
Definition: ntbasedef.h:259
_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
#define L(x)
Definition: ntvdm.h:50
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:179
int __cdecl Int386(int ivec, REGS *in, REGS *out)
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:28
BOOLEAN PcConsKbHit(VOID)
Definition: pccons.c:69
int PcConsGetCh(void)
Definition: pccons.c:90
BOOLEAN PcDiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
Definition: pcdisk.c:745
ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: pcdisk.c:815
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:785
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:599
TIMEINFO * PcGetTime(VOID)
Definition: pcrtc.c:24
VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pcvideo.c:1010
VOID PcVideoPrepareForReactOS(VOID)
Definition: pcvideo.c:1161
BOOLEAN PcVideoIsPaletteFixed(VOID)
Definition: pcvideo.c:1114
VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pcvideo.c:1120
VOID PcVideoSync(VOID)
Definition: pcvideo.c:1138
VOID PcVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pcvideo.c:976
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pcvideo.c:946
VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pcvideo.c:1129
VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
Definition: pcvideo.c:888
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:970
VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: pcvideo.c:1105
VOID PcVideoClearScreen(UCHAR Attr)
Definition: pcvideo.c:1089
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pcvideo.c:1048
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1035
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
@ ControllerClass
Definition: arc.h:94
@ AdapterClass
Definition: arc.h:93
@ PeripheralClass
Definition: arc.h:95
@ PointerController
Definition: arc.h:125
@ MultiFunctionAdapter
Definition: arc.h:116
@ SerialController
Definition: arc.h:121
@ ParallelController
Definition: arc.h:124
@ KeyboardPeripheral
Definition: arc.h:136
@ KeyboardController
Definition: arc.h:126
@ DockingInformation
Definition: arc.h:142
@ PointerPeripheral
Definition: arc.h:135
@ DisplayController
Definition: arc.h:123
@ ConsoleOut
Definition: arc.h:83
@ ConsoleIn
Definition: arc.h:82
@ Input
Definition: arc.h:84
@ Output
Definition: arc.h:85
#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:140
unsigned char al
Definition: pcbios.h:131
unsigned char ah
Definition: pcbios.h:132
unsigned char dh
Definition: pcbios.h:141
unsigned long eax
Definition: pcbios.h:91
unsigned short es
Definition: pcbios.h:121
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@392::@401 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@392 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@392::@394 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@392::@395 Interrupt
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
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
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
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
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
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:159
DWORDREGS d
Definition: pcbios.h:161
BYTEREGS b
Definition: pcbios.h:163
WORDREGS w
Definition: pcbios.h:162
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_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