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