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