ReactOS 0.4.16-dev-2284-g3529151
pc98hw.c
Go to the documentation of this file.
1/*
2 * PROJECT: FreeLoader
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Hardware detection routines for NEC PC-98 series
5 * COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
6 */
7
8/* INCLUDES *******************************************************************/
9
10#include <freeldr.h>
11#include <cportlib/cportlib.h>
12#include <drivers/pc98/pit.h>
13#include <drivers/pc98/fdc.h>
14
15#include <debug.h>
17
18/* Used for BIOS disks pre-enumeration performed when detecting the boot devices in InitializeBootDevices() */
20
22
24
25/* GLOBALS ********************************************************************/
26
27#define MILLISEC 10
28#define PRECISION 8
29#define HZ 100
30
31static unsigned int delay_count = 1;
32
34GetHarddiskIdentifier(UCHAR DriveNumber);
35
36/* FUNCTIONS ******************************************************************/
37
38static VOID
40{
41 register volatile unsigned int i;
42 for (i = 0; i < Loops; i++);
43}
44
46{
47 ULONGLONG LoopCount = ((ULONGLONG)delay_count * (ULONGLONG)Microseconds) / 1000ULL;
49}
50
51static VOID
53{
54 ULONG CurrentCount;
55 ULONG PreviousCount = ~0;
56 LONG Delta;
57
58 CurrentCount = Read8253Timer(PitChannel0);
59
60 do
61 {
62 PreviousCount = CurrentCount;
63 CurrentCount = Read8253Timer(PitChannel0);
64 Delta = CurrentCount - PreviousCount;
65 }
66 while (Delta < 300);
67}
68
69VOID
71{
72 ULONG i;
73 ULONG calib_bit;
74 ULONG CurCount;
75 TIMER_CONTROL_PORT_REGISTER TimerControl;
78
79 /* Initialize timer interrupt with MILLISECOND ms interval */
80 TimerControl.BcdMode = FALSE;
81 TimerControl.OperatingMode = PitOperatingMode2;
82 TimerControl.AccessMode = PitAccessModeLowHigh;
83 TimerControl.Channel = PitChannel0;
84 Write8253Timer(TimerControl, Count);
85
86 /* Stage 1: Coarse calibration */
87
88 delay_count = 1;
89
90 do
91 {
92 /* Next delay count to try */
93 delay_count <<= 1;
94
96
97 /* Do the delay */
99
100 CurCount = Read8253Timer(PitChannel0);
101 }
102 while (CurCount > Count / 2);
103
104 /* Get bottom value for delay */
105 delay_count >>= 1;
106
107 /* Stage 2: Fine calibration */
108
109 /* Which bit are we going to test */
110 calib_bit = delay_count;
111
112 for (i = 0; i < PRECISION; i++)
113 {
114 /* Next bit to calibrate */
115 calib_bit >>= 1;
116
117 /* If we have done all bits, stop */
118 if (!calib_bit)
119 break;
120
121 /* Set the bit in delay_count */
122 delay_count |= calib_bit;
123
125
126 /* Do the delay */
128
129 CurCount = Read8253Timer(PitChannel0);
130
131 /* If a tick has passed, turn the calibrated bit back off */
132 if (CurCount <= Count / 2)
133 delay_count &= ~calib_bit;
134 }
135
136 /* We're finished: Do the finishing touches */
137
138 /* Calculate delay_count for 1ms */
139 delay_count /= (MILLISEC / 2);
140}
141
142static UCHAR
143GetFloppyType(UCHAR FloppyNumber)
144{
145 /* FIXME */
146 return 5;
147}
148
149static VOID
151{
152 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
153 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
154 PCM_FLOPPY_DEVICE_DATA FloppyData;
155 CHAR Identifier[20];
156 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
157 ULONG Size;
158 UCHAR FloppyNumber;
159 UCHAR FloppyType;
160 ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880};
161
162 for (FloppyNumber = 0; FloppyNumber < Pc98GetFloppyCount(); FloppyNumber++)
163 {
164 FloppyType = GetFloppyType(FloppyNumber);
165
166 if ((FloppyType > 5) || (FloppyType == 0))
167 continue;
168
169 /* TODO: Properly detect */
170
171 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "FLOPPY%d", FloppyNumber + 1);
172
173 /* Set 'Configuration Data' value */
174 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) + sizeof(*FloppyData);
175 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
176 if (PartialResourceList == NULL)
177 {
178 ERR("Failed to allocate resource descriptor! Ignoring remaining floppy peripherals. (FloppyNumber = %u, FloppyCount = %u)\n",
179 FloppyNumber, Pc98GetFloppyCount());
180 return;
181 }
182 RtlZeroMemory(PartialResourceList, Size);
183 PartialResourceList->Version = 1;
184 PartialResourceList->Revision = 1;
185 PartialResourceList->Count = 1;
186
187 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
188 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
190 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(*FloppyData);
191
192 /* FIXME: Don't use default parameters for 1.44 MB floppy */
193 FloppyData = (PCM_FLOPPY_DEVICE_DATA)(PartialDescriptor + 1);
194 FloppyData->Version = 2;
195 FloppyData->Revision = 0;
196 FloppyData->MaxDensity = MaxDensity[FloppyType];
197 FloppyData->MountDensity = 0;
198 FloppyData->StepRateHeadUnloadTime = 175;
199 FloppyData->HeadLoadTime = 2;
200 FloppyData->MotorOffTime = 37;
201 FloppyData->SectorLengthCode = 2;
202 FloppyData->SectorPerTrack = 18;
203 FloppyData->ReadWriteGapLength = 27;
204 FloppyData->DataTransferLength = 255;
205 FloppyData->FormatGapLength = 108;
206 FloppyData->FormatFillCharacter = 0xF6;
207 FloppyData->HeadSettleTime = 15;
208 FloppyData->MotorSettleTime = 8;
209 FloppyData->MaximumTrackValue = (FloppyType == 1) ? 39 : 79;
210 FloppyData->DataTransferRate = 0;
211
212 FldrCreateComponentKey(ControllerKey,
215 Input | Output,
216 FloppyNumber,
217 0xFFFFFFFF,
219 PartialResourceList,
220 Size,
221 &PeripheralKey);
222 }
223}
224
227{
228 PCONFIGURATION_COMPONENT_DATA ControllerKey;
229 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
230 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
231 ULONG Size;
232 ULONG FloppyCount;
233 UCHAR i;
234 UCHAR Index = 0;
235
236 FloppyCount = Pc98GetFloppyCount();
237
238 /* Always create a BIOS disk controller, no matter if we have floppy drives or not */
239 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[7]);
240 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
241 if (PartialResourceList == NULL)
242 {
243 ERR("Failed to allocate resource descriptor\n");
244 return NULL;
245 }
246 RtlZeroMemory(PartialResourceList, Size);
247 PartialResourceList->Version = 1;
248 PartialResourceList->Revision = 1;
249 PartialResourceList->Count = 7;
250
251 /* Set I/O ports */
252 for (i = 0; i < 3; i++)
253 {
254 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
255 PartialDescriptor->Type = CmResourceTypePort;
257 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
258 PartialDescriptor->u.Port.Start.LowPart = 0x90 + i * 2;
259 PartialDescriptor->u.Port.Start.HighPart = 0;
260 PartialDescriptor->u.Port.Length = 1;
261 }
262 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
263 PartialDescriptor->Type = CmResourceTypePort;
265 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
266 PartialDescriptor->u.Port.Start.LowPart = 0xBE;
267 PartialDescriptor->u.Port.Start.HighPart = 0;
268 PartialDescriptor->u.Port.Length = 1;
269
270 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
271 PartialDescriptor->Type = CmResourceTypePort;
273 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
274 PartialDescriptor->u.Port.Start.LowPart = 0x4BE;
275 PartialDescriptor->u.Port.Start.HighPart = 0;
276 PartialDescriptor->u.Port.Length = 1;
277
278 /* Set Interrupt */
279 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
280 PartialDescriptor->Type = CmResourceTypeInterrupt;
282 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
283 PartialDescriptor->u.Interrupt.Level = 11;
284 PartialDescriptor->u.Interrupt.Vector = 11;
285 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
286
287 /* Set DMA channel */
288 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
289 PartialDescriptor->Type = CmResourceTypeDma;
291 PartialDescriptor->Flags = 0;
292 PartialDescriptor->u.Dma.Channel = 2;
293 PartialDescriptor->u.Dma.Port = 0;
294
295 /* Create floppy disk controller */
299 Output | Input,
300 0,
301 0xFFFFFFFF,
302 NULL,
303 PartialResourceList,
304 Size,
305 &ControllerKey);
306
307 if (FloppyCount)
308 DetectBiosFloppyPeripheral(ControllerKey);
309
310 return ControllerKey;
311}
312
315{
316 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
318 GEOMETRY Geometry;
319 ULONG Size;
320
321 *pSize = 0;
322
323 /* Set 'Configuration Data' value */
324 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) + sizeof(*DiskGeometry);
325 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
326 if (PartialResourceList == NULL)
327 {
328 ERR("Failed to allocate resource descriptor\n");
329 return NULL;
330 }
331 RtlZeroMemory(PartialResourceList, Size);
332 PartialResourceList->Version = 1;
333 PartialResourceList->Revision = 1;
334 PartialResourceList->Count = 1;
335 PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
336// PartialResourceList->PartialDescriptors[0].ShareDisposition =
337// PartialResourceList->PartialDescriptors[0].Flags =
338 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
339 sizeof(*DiskGeometry);
340
341 /* Get the disk geometry. Extended geometry isn't supported by hardware. */
342 DiskGeometry = (PCM_DISK_GEOMETRY_DEVICE_DATA)&PartialResourceList->PartialDescriptors[1];
343 if (Pc98DiskGetDriveGeometry(DriveNumber, &Geometry))
344 {
345 DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
346 DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
347 DiskGeometry->SectorsPerTrack = Geometry.SectorsPerTrack;
348 DiskGeometry->NumberOfHeads = Geometry.Heads;
349 }
350 else
351 {
352 TRACE("Reading disk geometry failed\n");
353 FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
354 return NULL;
355 }
356 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
357 DriveNumber,
358 DiskGeometry->NumberOfCylinders,
359 DiskGeometry->NumberOfHeads,
360 DiskGeometry->SectorsPerTrack,
361 DiskGeometry->BytesPerSector);
362
363 *pSize = Size;
364 return PartialResourceList;
365}
366
367VOID
371{
372 PCONFIGURATION_COMPONENT_DATA ControllerKey, DiskKey;
373 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
374 PCM_INT13_DRIVE_PARAMETER Int13Drives;
375 GEOMETRY Geometry;
376 UCHAR DiskCount, DriveNumber;
377 USHORT i;
378 ULONG Size;
379
380 /* The pre-enumeration of the BIOS disks was already done in InitializeBootDevices() */
381 DiskCount = PcBiosDiskCount;
382
383 /* Use the floppy disk controller as our controller */
384 ControllerKey = DetectBiosFloppyController(BusKey);
385 if (!ControllerKey)
386 {
387 ERR("Failed to detect BIOS disk controller\n");
388 return;
389 }
390
391 /* Set 'Configuration Data' value */
392 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) +
393 sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
394 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
395 if (PartialResourceList == NULL)
396 {
397 ERR("Failed to allocate resource descriptor\n");
398 return;
399 }
400 RtlZeroMemory(PartialResourceList, Size);
401 PartialResourceList->Version = 1;
402 PartialResourceList->Revision = 1;
403 PartialResourceList->Count = 1;
404
405 PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
406 PartialResourceList->PartialDescriptors[0].ShareDisposition = 0;
407 PartialResourceList->PartialDescriptors[0].Flags = 0;
408 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
409 sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
410
411 /* Get harddisk Int13 geometry data */
412 Int13Drives = (PCM_INT13_DRIVE_PARAMETER)&PartialResourceList->PartialDescriptors[1];
413 for (i = 0; i < DiskCount; i++)
414 {
415 DriveNumber = 0x80 + i;
416
417 if (Pc98DiskGetDriveGeometry(DriveNumber, &Geometry))
418 {
419 Int13Drives[i].DriveSelect = DriveNumber;
420 Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
421 Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.SectorsPerTrack;
422 Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
423 Int13Drives[i].NumberDrives = DiskCount;
424
425 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
426 DriveNumber,
427 Geometry.Cylinders - 1,
428 Geometry.Heads - 1,
429 Geometry.SectorsPerTrack,
430 Geometry.BytesPerSector);
431 }
432 }
433
434 /* Update the 'System' key's configuration data with BIOS INT13h information */
435 FldrSetConfigurationData(SystemKey, PartialResourceList, Size);
436
437 /* Create and fill subkey for each harddisk */
438 for (i = 0; i < DiskCount; i++)
439 {
441
442 DriveNumber = 0x80 + i;
443
444 /* Get disk values */
445 PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size);
446 Identifier = GetHarddiskIdentifier(DriveNumber);
447
448 /* Create disk key */
449 FldrCreateComponentKey(ControllerKey,
452 Output | Input,
453 i,
454 0xFFFFFFFF,
456 PartialResourceList,
457 Size,
458 &DiskKey);
459 }
460}
461
462static VOID
464{
465 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
466 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
467 ULONG Size;
468
469 /* TODO: Properly detect */
470
471 /* Set 'Configuration Data' value */
472 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
473 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
474 if (PartialResourceList == NULL)
475 {
476 ERR("Failed to allocate resource descriptor\n");
477 return;
478 }
479 RtlZeroMemory(PartialResourceList, Size);
480 PartialResourceList->Version = 1;
481 PartialResourceList->Revision = 1;
482 PartialResourceList->Count = 0;
483
484 /* Create 'PointerPeripheral' key */
485 FldrCreateComponentKey(ControllerKey,
488 Input,
489 0,
490 0xFFFFFFFF,
491 "NEC PC-9800 BUS MOUSE",
492 PartialResourceList,
493 Size,
494 &PeripheralKey);
495}
496
497static VOID
499{
500 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
501 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
502 PCONFIGURATION_COMPONENT_DATA ControllerKey;
503 ULONG Size;
504 UCHAR i;
505 UCHAR Index = 0;
506
507 /* Set 'Configuration Data' value */
508 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[HiResoMachine ? 7 : 6]);
509 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
510 if (PartialResourceList == NULL)
511 {
512 ERR("Failed to allocate resource descriptor\n");
513 return;
514 }
515 RtlZeroMemory(PartialResourceList, Size);
516 PartialResourceList->Version = 1;
517 PartialResourceList->Revision = 1;
518 PartialResourceList->Count = (HiResoMachine ? 7 : 6);
519
520 /* Set I/O ports */
521 for (i = 0; i < 4; i++)
522 {
523 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
524 PartialDescriptor->Type = CmResourceTypePort;
526 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
527 PartialDescriptor->u.Port.Start.LowPart = (HiResoMachine ? 0x61 : 0x7FD9) + i * 2;
528 PartialDescriptor->u.Port.Start.HighPart = 0;
529 PartialDescriptor->u.Port.Length = 1;
530 }
531 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
532 PartialDescriptor->Type = CmResourceTypePort;
534 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
535 PartialDescriptor->u.Port.Start.LowPart = (HiResoMachine ? 0x869 : 0xBFDB);
536 PartialDescriptor->u.Port.Start.HighPart = 0;
537 PartialDescriptor->u.Port.Length = 1;
538 if (HiResoMachine)
539 {
540 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
541 PartialDescriptor->Type = CmResourceTypePort;
543 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
544 PartialDescriptor->u.Port.Start.LowPart = 0x98D7;
545 PartialDescriptor->u.Port.Start.HighPart = 0;
546 PartialDescriptor->u.Port.Length = 1;
547 }
548
549 /* Set Interrupt */
550 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
551 PartialDescriptor->Type = CmResourceTypeInterrupt;
553 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
554 PartialDescriptor->u.Interrupt.Level = 13;
555 PartialDescriptor->u.Interrupt.Vector = 13;
556 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
557
558 /* Create controller key */
562 Input,
563 0,
564 0xFFFFFFFF,
565 NULL,
566 PartialResourceList,
567 Size,
568 &ControllerKey);
569
570 DetectPointerPeripheral(ControllerKey);
571}
572
573static VOID
575{
576 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
577 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
578 PCM_KEYBOARD_DEVICE_DATA KeyboardData;
579 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
581 ULONG Size;
582 REGS Regs;
583 UCHAR KeyboardType = ((*(PUCHAR)MEM_KEYB_TYPE & 0x40) >> 5) |
584 ((*(PUCHAR)MEM_KEYB_TYPE & 0x08) >> 3);
585
586 /* TODO: Properly detect */
587
588 /* Set 'Configuration Data' value */
589 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) + sizeof(*KeyboardData);
590 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
591 if (PartialResourceList == NULL)
592 {
593 ERR("Failed to allocate resource descriptor\n");
594 return;
595 }
596 RtlZeroMemory(PartialResourceList, Size);
597 PartialResourceList->Version = 1;
598 PartialResourceList->Revision = 1;
599 PartialResourceList->Count = 1;
600
601 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
602 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
604 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(*KeyboardData);
605
606 /* Int 18h AH=02h
607 * KEYBOARD - GET SHIFT FLAGS
608 *
609 * Return:
610 * AL - shift flags
611 */
612 Regs.b.ah = 0x02;
613 Int386(0x18, &Regs, &Regs);
614
615 KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
616 KeyboardData->Version = 1;
617 KeyboardData->Revision = 1;
618 KeyboardData->Type = 7;
619 KeyboardData->Subtype = 1;
620 KeyboardData->KeyboardFlags = (Regs.b.al & 0x08) |
621 ((Regs.b.al & 0x02) << 6) |
622 ((Regs.b.al & 0x10) << 2) |
623 ((Regs.b.al & 0x01) << 1);
624
625 if (KeyboardType == 0)
626 Identifier = "PC98_NmodeKEY";
627 else if (KeyboardType == 2)
628 Identifier = "PC98_106KEY";
629 else
630 Identifier = "PC98_LaptopKEY";
631
632 /* Create controller key */
633 FldrCreateComponentKey(ControllerKey,
637 0,
638 0xFFFFFFFF,
640 PartialResourceList,
641 Size,
642 &PeripheralKey);
643}
644
645static VOID
647{
648 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
649 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
650 PCONFIGURATION_COMPONENT_DATA ControllerKey;
651 ULONG Size;
652 UCHAR i;
653
654 if (!CpDoesPortExist((PUCHAR)0x41))
655 return;
656
657 /* Set 'Configuration Data' value */
658 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[3]);
659 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
660 if (PartialResourceList == NULL)
661 {
662 ERR("Failed to allocate resource descriptor\n");
663 return;
664 }
665 RtlZeroMemory(PartialResourceList, Size);
666 PartialResourceList->Version = 1;
667 PartialResourceList->Revision = 1;
668 PartialResourceList->Count = 3;
669
670 /* Set I/O ports */
671 for (i = 0; i < 2; i++)
672 {
673 PartialDescriptor = &PartialResourceList->PartialDescriptors[i];
674 PartialDescriptor->Type = CmResourceTypePort;
676 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
677 PartialDescriptor->u.Port.Start.LowPart = 0x41 + i * 2;
678 PartialDescriptor->u.Port.Start.HighPart = 0;
679 PartialDescriptor->u.Port.Length = 1;
680 }
681
682 /* Set Interrupt */
683 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
684 PartialDescriptor->Type = CmResourceTypeInterrupt;
686 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
687 PartialDescriptor->u.Interrupt.Level = 1;
688 PartialDescriptor->u.Interrupt.Vector = 1;
689 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
690
691 /* Create controller key */
696 0,
697 0xFFFFFFFF,
698 NULL,
699 PartialResourceList,
700 Size,
701 &ControllerKey);
702
703 DetectKeyboardPeripheral(ControllerKey);
704}
705
706static VOID
708{
709 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
710 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
711 PCONFIGURATION_COMPONENT_DATA ControllerKey;
712 ULONG Size;
713 UCHAR i;
714 UCHAR Index = 0;
715
716 /* TODO: Properly detect */
717
718 /* Set 'Configuration Data' value */
719 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[8]);
720 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
721 if (PartialResourceList == NULL)
722 {
723 ERR("Failed to allocate resource descriptor\n");
724 return;
725 }
726 RtlZeroMemory(PartialResourceList, Size);
727 PartialResourceList->Version = 1;
728 PartialResourceList->Revision = 1;
729 PartialResourceList->Count = 8;
730
731 /* Set I/O ports */
732 for (i = 0; i < 4; i++)
733 {
734 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
735 PartialDescriptor->Type = CmResourceTypePort;
737 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
738 PartialDescriptor->u.Port.Start.LowPart = 0x40 + i * 2;
739 PartialDescriptor->u.Port.Start.HighPart = 0;
740 PartialDescriptor->u.Port.Length = 3;
741 }
742
743 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
744 PartialDescriptor->Type = CmResourceTypePort;
746 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
747 PartialDescriptor->u.Port.Start.LowPart = 0x140;
748 PartialDescriptor->u.Port.Start.HighPart = 0;
749 PartialDescriptor->u.Port.Length = 3;
750
751 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
752 PartialDescriptor->Type = CmResourceTypePort;
754 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
755 PartialDescriptor->u.Port.Start.LowPart = 0x149;
756 PartialDescriptor->u.Port.Start.HighPart = 0;
757 PartialDescriptor->u.Port.Length = 1;
758
759 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
760 PartialDescriptor->Type = CmResourceTypePort;
762 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
763 PartialDescriptor->u.Port.Start.LowPart = 0x14B;
764 PartialDescriptor->u.Port.Start.HighPart = 0;
765 PartialDescriptor->u.Port.Length = 4;
766
767 /* Set Interrupt */
768 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
769 PartialDescriptor->Type = CmResourceTypeInterrupt;
771 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
772 PartialDescriptor->u.Interrupt.Level = 14;
773 PartialDescriptor->u.Interrupt.Vector = 14;
774 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
775
776 /* Create controller key */
780 Output,
781 0,
782 0xFFFFFFFF,
783 "PARALLEL1",
784 PartialResourceList,
785 Size,
786 &ControllerKey);
787}
788
789static VOID
791{
792 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
793 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
794 PCM_SERIAL_DEVICE_DATA SerialDeviceData;
795 PCONFIGURATION_COMPONENT_DATA ControllerKey;
796 CHAR Identifier[80];
797 ULONG Size;
798 UCHAR Index;
799 ULONG ControllerNumber = 0;
800
801 if (CpDoesPortExist((PUCHAR)0x30))
802 {
803 UCHAR FifoStatus;
805 UCHAR i;
806
807 FifoStatus = READ_PORT_UCHAR((PUCHAR)0x136) & 0x40;
809 HasFifo = ((READ_PORT_UCHAR((PUCHAR)0x136) & 0x40) != FifoStatus);
810
811 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%d", ControllerNumber + 1);
812
813 /* Set 'Configuration Data' value */
814 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[HasFifo ? 11 : 4]) +
815 sizeof(*SerialDeviceData);
816 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
817 if (PartialResourceList == NULL)
818 {
819 ERR("Failed to allocate resource descriptor\n");
820 return;
821 }
822 RtlZeroMemory(PartialResourceList, Size);
823 PartialResourceList->Version = 1;
824 PartialResourceList->Revision = 1;
825 PartialResourceList->Count = (HasFifo ? 11 : 4);
826
827 Index = 0;
828
829 /* Set I/O ports */
830 for (i = 0; i < 2; i++)
831 {
832 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
833 PartialDescriptor->Type = CmResourceTypePort;
835 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
836 PartialDescriptor->u.Port.Start.LowPart = 0x30 + i * 2;
837 PartialDescriptor->u.Port.Start.HighPart = 0;
838 PartialDescriptor->u.Port.Length = 1;
839 }
840 if (HasFifo)
841 {
842 for (i = 0; i < 7; i++)
843 {
844 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
845 PartialDescriptor->Type = CmResourceTypePort;
847 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
848 PartialDescriptor->u.Port.Start.LowPart = 0x130 + i * 2;
849 PartialDescriptor->u.Port.Start.HighPart = 0;
850 PartialDescriptor->u.Port.Length = 1;
851 }
852 }
853
854 /* Set Interrupt */
855 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
856 PartialDescriptor->Type = CmResourceTypeInterrupt;
858 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
859 PartialDescriptor->u.Interrupt.Level = 4;
860 PartialDescriptor->u.Interrupt.Vector = 4;
861 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
862
863 /* Set serial data (device specific) */
864 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
865 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
867 PartialDescriptor->Flags = 0;
868 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(*SerialDeviceData);
869
870 SerialDeviceData = (PCM_SERIAL_DEVICE_DATA)(PartialDescriptor + 1);
871 SerialDeviceData->BaudClock = (*(PUCHAR)MEM_BIOS_FLAG1 & SYSTEM_CLOCK_8MHZ_FLAG) ?
873
874 /* Create controller key */
879 ControllerNumber,
880 0xFFFFFFFF,
882 PartialResourceList,
883 Size,
884 &ControllerKey);
885 ++ControllerNumber;
886 }
887
888 if (CpDoesPortExist((PUCHAR)0x238))
889 {
890 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%d", ControllerNumber + 1);
891
892 /* Set 'Configuration Data' value */
893 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[3]) + sizeof(*SerialDeviceData);
894 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
895 if (PartialResourceList == NULL)
896 {
897 ERR("Failed to allocate resource descriptor\n");
898 return;
899 }
900 RtlZeroMemory(PartialResourceList, Size);
901 PartialResourceList->Version = 1;
902 PartialResourceList->Revision = 1;
903 PartialResourceList->Count = 3;
904
905 Index = 0;
906
907 /* Set I/O ports */
908 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
909 PartialDescriptor->Type = CmResourceTypePort;
911 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
912 PartialDescriptor->u.Port.Start.LowPart = 0x238;
913 PartialDescriptor->u.Port.Start.HighPart = 0;
914 PartialDescriptor->u.Port.Length = 8;
915
916 /* Set Interrupt */
917 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
918 PartialDescriptor->Type = CmResourceTypeInterrupt;
920 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
921 PartialDescriptor->u.Interrupt.Level = 5;
922 PartialDescriptor->u.Interrupt.Vector = 5;
923 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
924
925 /* Set serial data (device specific) */
926 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
927 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
929 PartialDescriptor->Flags = 0;
930 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(*SerialDeviceData);
931
932 SerialDeviceData = (PCM_SERIAL_DEVICE_DATA)(PartialDescriptor + 1);
933 SerialDeviceData->BaudClock = 1843200;
934
935 /* Create controller key */
940 ControllerNumber,
941 0xFFFFFFFF,
943 PartialResourceList,
944 Size,
945 &ControllerKey);
946 ++ControllerNumber;
947 }
948}
949
950static VOID
952{
953 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
955 ULONG Size;
956
957 /* Set 'Configuration Data' value */
958 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
959 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
960 if (PartialResourceList == NULL)
961 {
962 ERR("Failed to allocate resource descriptor\n");
963 return;
964 }
965 RtlZeroMemory(PartialResourceList, Size);
966 PartialResourceList->Version = 1;
967 PartialResourceList->Revision = 1;
968 PartialResourceList->Count = 0;
969
970 /* Create bus key */
971 FldrCreateComponentKey(SystemKey,
974 0,
975 0,
976 0xFFFFFFFF,
977 "ISA",
978 PartialResourceList,
979 Size,
980 &BusKey);
981
982 /* Increment bus number */
983 (*BusNumber)++;
984
985 /* Detect C-bus/BIOS devices */
986 DetectBiosDisks(SystemKey, BusKey);
987 DetectSerialPorts(BusKey);
988 DetectParallelPorts(BusKey);
991
992 /* FIXME: Detect more C-bus devices */
993}
994
995static VOID
997{
998 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1000 ULONG Size;
1001
1002 if (!((*(PUCHAR)MEM_BIOS_FLAG5) & NESA_BUS_FLAG))
1003 return;
1004
1005 /* Set 'Configuration Data' value */
1006 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
1007 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1008 if (PartialResourceList == NULL)
1009 {
1010 ERR("Failed to allocate resource descriptor\n");
1011 return;
1012 }
1013 RtlZeroMemory(PartialResourceList, Size);
1014 PartialResourceList->Version = 1;
1015 PartialResourceList->Revision = 1;
1016 PartialResourceList->Count = 0;
1017
1018 /* Create bus key */
1019 FldrCreateComponentKey(SystemKey,
1022 0,
1023 0,
1024 0xFFFFFFFF,
1025 "EISA",
1026 PartialResourceList,
1027 Size,
1028 &BusKey);
1029
1030 /* Increment bus number */
1031 (*BusNumber)++;
1032}
1033
1034// FIXME: Copied from machpc.c
1035static VOID
1037{
1038 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1042 ULONG x;
1043 ULONG NodeSize = 0;
1044 ULONG NodeCount = 0;
1046 ULONG FoundNodeCount;
1047 int i;
1048 ULONG PnpBufferSize;
1049 ULONG PnpBufferSizeLimit;
1050 ULONG Size;
1051 char* Ptr;
1052
1054 if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
1055 {
1056 TRACE("PnP-BIOS not supported\n");
1057 return;
1058 }
1059
1060 TRACE("PnP-BIOS supported\n");
1061 TRACE("Signature '%c%c%c%c'\n",
1062 InstData->Signature[0], InstData->Signature[1],
1063 InstData->Signature[2], InstData->Signature[3]);
1064
1065 x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
1066 if (x == 0x82)
1067 {
1068 TRACE("PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
1069 return;
1070 }
1071
1072 NodeCount &= 0xFF; // needed since some fscked up BIOSes return wrong info (e.g. Mac Virtual PC)
1073 // e.g. look: https://web.archive.org/web/20080329010332/http://my.execpc.com/~geezer/osd/pnp/pnp16.c
1074 if (x != 0 || NodeSize == 0 || NodeCount == 0)
1075 {
1076 ERR("PnP-BIOS failed to enumerate device nodes\n");
1077 return;
1078 }
1079 TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
1080 TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
1081
1082 /* Set 'Configuration Data' value */
1083 PnpBufferSizeLimit = sizeof(*InstData) + (NodeSize * NodeCount);
1084 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) + PnpBufferSizeLimit;
1085 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1086 if (PartialResourceList == NULL)
1087 {
1088 ERR("Failed to allocate resource descriptor\n");
1089 return;
1090 }
1091
1092 /* Initialize resource descriptor */
1093 RtlZeroMemory(PartialResourceList, Size);
1094 PartialResourceList->Version = 1;
1095 PartialResourceList->Revision = 1;
1096 PartialResourceList->Count = 1;
1097 PartialResourceList->PartialDescriptors[0].Type =
1099 PartialResourceList->PartialDescriptors[0].ShareDisposition =
1101
1102 /* Set installation check data */
1103 Ptr = (char*)&PartialResourceList->PartialDescriptors[1];
1104 RtlCopyMemory(Ptr, InstData, sizeof(*InstData));
1105 Ptr += sizeof(*InstData);
1106 PnpBufferSize = sizeof(*InstData);
1107
1108 /* Copy device nodes */
1109 FoundNodeCount = 0;
1110 for (i = 0; i < 0xFF; i++)
1111 {
1112 NodeNumber = (UCHAR)i;
1113
1115 if (x == 0)
1116 {
1118
1119 TRACE("Node: %u Size %u (0x%x)\n",
1120 DeviceNode->Node,
1121 DeviceNode->Size,
1122 DeviceNode->Size);
1123
1124 if (PnpBufferSize + DeviceNode->Size > PnpBufferSizeLimit)
1125 {
1126 ERR("Buffer too small! Ignoring remaining device nodes. (i = %d)\n", i);
1127 break;
1128 }
1129
1131
1132 Ptr += DeviceNode->Size;
1133 PnpBufferSize += DeviceNode->Size;
1134
1135 FoundNodeCount++;
1136 if (FoundNodeCount >= NodeCount)
1137 break;
1138 }
1139 }
1140
1141 /* Set real data size */
1142 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
1143 PnpBufferSize;
1144 Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) + PnpBufferSize;
1145
1146 TRACE("Real buffer size: %u\n", PnpBufferSize);
1147 TRACE("Resource size: %u\n", Size);
1148
1149 /* Create component key */
1150 FldrCreateComponentKey(SystemKey,
1153 0,
1154 0,
1155 0xFFFFFFFF,
1156 "PNP BIOS",
1157 PartialResourceList,
1158 Size,
1159 &BusKey);
1160
1161 (*BusNumber)++;
1162}
1163
1167{
1169 ULONG BusNumber = 0;
1170
1171 TRACE("DetectHardware()\n");
1172
1173 /* Create the 'System' key */
1174 FldrCreateSystemKey(&SystemKey, "NEC PC-98");
1175
1178
1179 /* Detect buses */
1180 DetectPciBios(SystemKey, &BusNumber);
1181 DetectApmBios(SystemKey, &BusNumber);
1182 DetectPnpBios(SystemKey, &BusNumber);
1183 DetectNesaBios(SystemKey, &BusNumber);
1184 DetectCBusBios(SystemKey, &BusNumber);
1185 DetectAcpiBios(SystemKey, &BusNumber);
1186 // TODO: Detect more buses
1187
1188 // TODO: Collect the ROM blocks and append their
1189 // CM_ROM_BLOCK data into the 'System' key's configuration data.
1190
1191 TRACE("DetectHardware() Done\n");
1192 return SystemKey;
1193}
1194
1195UCHAR
1197{
1198 USHORT DiskEquipment = *(PUSHORT)MEM_DISK_EQUIP & ~(*(PUCHAR)MEM_RDISK_EQUIP);
1199 UCHAR DiskMask;
1200 UCHAR FloppyCount = 0;
1201
1202 for (DiskMask = 0x01; DiskMask != 0; DiskMask <<= 1)
1203 {
1204 if (FIRSTBYTE(DiskEquipment) & DiskMask)
1205 ++FloppyCount;
1206 }
1207
1208 for (DiskMask = 0x10; DiskMask != 0; DiskMask <<= 1)
1209 {
1210 if (SECONDBYTE(DiskEquipment) & DiskMask)
1211 ++FloppyCount;
1212 }
1213
1214 return FloppyCount;
1215}
1216
1218{
1221}
1222
1223// FIXME: 1) Copied from pchw.c 2) Should be done inside MachInit.
1224VOID
1226{
1227 INT CpuInformation[4] = {-1};
1228 ULONG NumberOfIds;
1229
1230 /* Check if the processor first supports ID 1 */
1231 __cpuid(CpuInformation, 0);
1232
1233 NumberOfIds = CpuInformation[0];
1234
1235 if (NumberOfIds == 0)
1236 {
1238 __FILE__,
1239 __LINE__,
1240 "ReactOS requires the CPUID instruction to return "
1241 "more than one supported ID.\n\n");
1242 }
1243
1244 /* NumberOfIds will be greater than 1 if the processor is new enough */
1245 if (NumberOfIds == 1)
1246 {
1247 INT ProcessorFamily;
1248
1249 /* Get information */
1250 __cpuid(CpuInformation, 1);
1251
1252 ProcessorFamily = (CpuInformation[0] >> 8) & 0xF;
1253
1254 /* If it's Family 4 or lower, bugcheck */
1255 if (ProcessorFamily < 5)
1256 {
1258 __FILE__,
1259 __LINE__,
1260 "Processor is too old (family %u < 5)\n"
1261 "ReactOS requires a Pentium-level processor or newer.",
1262 ProcessorFamily);
1263 }
1264 }
1265}
@ DeviceNode
Definition: Node.h:9
unsigned char BOOLEAN
Definition: actypes.h:127
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
VOID FldrSetConfigurationData(_Inout_ PCONFIGURATION_COMPONENT_DATA ComponentData, _In_ PCM_PARTIAL_RESOURCE_LIST ResourceList, _In_ ULONG Size)
Definition: archwsup.c:124
@ Identifier
Definition: asmpp.cpp:95
@ DiskController
Definition: arcname.c:68
#define ERR(fmt,...)
Definition: precomp.h:57
DECLSPEC_NORETURN VOID FrLdrBugCheckWithMessage(ULONG BugCode, PCHAR File, ULONG Line, PSTR Format,...)
Definition: debug.c:29
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwacpi.c:59
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:174
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)
PCM_PARTIAL_RESOURCE_LIST(* GET_HARDDISK_CONFIG_DATA)(UCHAR DriveNumber, ULONG *pSize)
Definition: hardware.h:68
ULONG_PTR __cdecl PnpBiosSupported(VOID)
@ MISSING_HARDWARE_REQUIREMENTS
Definition: debug.h:146
#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
BOOLEAN HasFifo
Definition: cport_pc98.c:28
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:224
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define __cdecl
Definition: corecrt.h:121
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3330
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
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
@ PitChannel0
Definition: halhw.h:102
@ PitAccessModeLowHigh
Definition: halhw.h:97
@ PitOperatingMode2
Definition: halhw.h:84
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwapm.c:46
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
if(dx< 0)
Definition: linetemp.h:194
#define MEM_KEYB_TYPE
Definition: machpc98.h:27
#define MEM_RDISK_EQUIP
Definition: machpc98.h:33
#define MEM_DISK_EQUIP
Definition: machpc98.h:41
#define MEM_BIOS_FLAG5
Definition: machpc98.h:21
#define SYSTEM_CLOCK_8MHZ_FLAG
Definition: machpc98.h:38
#define NESA_BUS_FLAG
Definition: machpc98.h:22
#define MEM_BIOS_FLAG1
Definition: machpc98.h:35
#define for
Definition: utility.h:88
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define _In_opt_
Definition: no_sal2.h:212
int Count
Definition: noreturn.cpp:7
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
BOOLEAN Pc98DiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pc98disk.c:883
VOID FrLdrCheckCpuCompatibility(VOID)
Definition: pc98hw.c:1225
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:1036
static VOID DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:150
#define MILLISEC
Definition: pc98hw.c:27
static VOID WaitFor8253Wraparound(VOID)
Definition: pc98hw.c:52
VOID HalpCalibrateStallExecution(VOID)
Definition: pc98hw.c:70
static VOID DetectPointerController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:498
static UCHAR GetFloppyType(UCHAR FloppyNumber)
Definition: pc98hw.c:143
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:368
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pc98hw.c:23
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1217
PCONFIGURATION_COMPONENT_DATA Pc98HwDetect(_In_opt_ PCSTR Options)
Definition: pc98hw.c:1165
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: pc98hw.c:39
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:226
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:646
#define HZ
Definition: pc98hw.c:29
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pc98hw.c:45
static VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:790
#define PRECISION
Definition: pc98hw.c:28
static VOID DetectNesaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:996
static PCM_PARTIAL_RESOURCE_LIST Pc98GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: pc98hw.c:314
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
Definition: hwdisk.c:254
static VOID DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:574
static unsigned int delay_count
Definition: pc98hw.c:31
UCHAR Pc98GetFloppyCount(VOID)
Definition: pc98hw.c:1196
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:707
UCHAR PcBiosDiskCount
Definition: hwdisk.c:47
static VOID DetectPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:463
BOOLEAN HiResoMachine
Definition: machpc98.c:17
static VOID DetectCBusBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:951
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
int __cdecl Int386(int ivec, REGS *in, REGS *out)
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
struct _CM_PNP_BIOS_INSTALLATION_CHECK * PCM_PNP_BIOS_INSTALLATION_CHECK
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
#define CmResourceTypeDma
Definition: restypes.h:107
#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
@ DiskPeripheral
Definition: arc.h:138
@ KeyboardPeripheral
Definition: arc.h:145
@ FloppyDiskPeripheral
Definition: arc.h:139
@ KeyboardController
Definition: arc.h:135
@ PointerPeripheral
Definition: arc.h:144
@ ConsoleOut
Definition: arc.h:92
@ ConsoleIn
Definition: arc.h:91
@ Input
Definition: arc.h:93
@ Output
Definition: arc.h:94
#define FDC1_IO_BASE
Definition: fdc.h:10
#define FDC2_IO_BASE
Definition: fdc.h:11
#define FDC_o_CONTROL
Definition: fdc.h:22
FORCEINLINE ULONG Read8253Timer(TIMER_CHANNELS TimerChannel)
Definition: pit.h:77
#define TIMER_FREQUENCY_1
Definition: pit.h:16
FORCEINLINE VOID Write8253Timer(TIMER_CONTROL_PORT_REGISTER TimerControl, USHORT Count)
Definition: pit.h:90
#define TIMER_FREQUENCY_2
Definition: pit.h:17
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char al
Definition: pcbios.h:133
unsigned char ah
Definition: pcbios.h:134
UCHAR StepRateHeadUnloadTime
Definition: cmtypes.h:489
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@382::@391 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@382 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@382::@388 Dma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@382::@384 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@382::@385 Interrupt
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
Definition: disk.h:26
ULONG BytesPerSector
Number of bytes per sector.
Definition: disk.h:30
ULONG Cylinders
Number of cylinders on the disk.
Definition: disk.h:27
ULONG SectorsPerTrack
Number of sectors per track.
Definition: disk.h:29
ULONG Heads
Number of heads on the disk.
Definition: disk.h:28
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int32_t INT
Definition: typedefs.h:58
uint16_t * PUSHORT
Definition: typedefs.h:56
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
char * PCHAR
Definition: typedefs.h:51
#define TAG_HW_RESOURCE_LIST
Definition: uefidisk.c:15
Definition: pcbios.h:161
BYTEREGS b
Definition: pcbios.h:165
_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
struct _CM_INT13_DRIVE_PARAMETER * PCM_INT13_DRIVE_PARAMETER
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
struct _CM_KEYBOARD_DEVICE_DATA * PCM_KEYBOARD_DEVICE_DATA
struct _CM_DISK_GEOMETRY_DEVICE_DATA * PCM_DISK_GEOMETRY_DEVICE_DATA
struct _CM_INT13_DRIVE_PARAMETER CM_INT13_DRIVE_PARAMETER
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareUndetermined
Definition: cmtypes.h:240
struct _CM_FLOPPY_DEVICE_DATA * PCM_FLOPPY_DEVICE_DATA
_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
#define SECONDBYTE(VALUE)
Definition: rtlfuncs.h:807
#define FIRSTBYTE(VALUE)
Definition: rtlfuncs.h:806
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175