ReactOS 0.4.15-dev-5666-gc548b97
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 */
175 sizeof(CM_FLOPPY_DEVICE_DATA);
176 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
177 if (PartialResourceList == NULL)
178 {
179 ERR("Failed to allocate resource descriptor! Ignoring remaining floppy peripherals. (FloppyNumber = %u, FloppyCount = %u)\n",
180 FloppyNumber, Pc98GetFloppyCount());
181 return;
182 }
183 RtlZeroMemory(PartialResourceList, Size);
184 PartialResourceList->Version = 1;
185 PartialResourceList->Revision = 1;
186 PartialResourceList->Count = 1;
187
188 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
189 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
191 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_FLOPPY_DEVICE_DATA);
192
193 /* FIXME: Don't use default parameters for 1.44 MB floppy */
194 FloppyData = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
195 FloppyData->Version = 2;
196 FloppyData->Revision = 0;
197 FloppyData->MaxDensity = MaxDensity[FloppyType];
198 FloppyData->MountDensity = 0;
199 FloppyData->StepRateHeadUnloadTime = 175;
200 FloppyData->HeadLoadTime = 2;
201 FloppyData->MotorOffTime = 37;
202 FloppyData->SectorLengthCode = 2;
203 FloppyData->SectorPerTrack = 18;
204 FloppyData->ReadWriteGapLength = 27;
205 FloppyData->DataTransferLength = 255;
206 FloppyData->FormatGapLength = 108;
207 FloppyData->FormatFillCharacter = 0xF6;
208 FloppyData->HeadSettleTime = 15;
209 FloppyData->MotorSettleTime = 8;
210 FloppyData->MaximumTrackValue = (FloppyType == 1) ? 39 : 79;
211 FloppyData->DataTransferRate = 0;
212
213 FldrCreateComponentKey(ControllerKey,
215 FloppyDiskPeripheral,
216 Input | Output,
217 FloppyNumber,
218 0xFFFFFFFF,
220 PartialResourceList,
221 Size,
222 &PeripheralKey);
223 TRACE("Created key: FloppyDiskPeripheral\\%d\n", FloppyNumber);
224 }
225}
226
229{
230 PCONFIGURATION_COMPONENT_DATA ControllerKey;
231 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
232 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
233 ULONG Size;
234 ULONG FloppyCount;
235 UCHAR i;
236 UCHAR Index = 0;
237
238 FloppyCount = Pc98GetFloppyCount();
239
240 /* Always create a BIOS disk controller, no matter if we have floppy drives or not */
243 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
244 if (PartialResourceList == NULL)
245 {
246 ERR("Failed to allocate resource descriptor\n");
247 return NULL;
248 }
249 RtlZeroMemory(PartialResourceList, Size);
250 PartialResourceList->Version = 1;
251 PartialResourceList->Revision = 1;
252 PartialResourceList->Count = 7;
253
254 /* Set I/O ports */
255 for (i = 0; i < 3; i++)
256 {
257 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
258 PartialDescriptor->Type = CmResourceTypePort;
260 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
261 PartialDescriptor->u.Port.Start.LowPart = 0x90 + i * 2;
262 PartialDescriptor->u.Port.Start.HighPart = 0;
263 PartialDescriptor->u.Port.Length = 1;
264 }
265 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
266 PartialDescriptor->Type = CmResourceTypePort;
268 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
269 PartialDescriptor->u.Port.Start.LowPart = 0xBE;
270 PartialDescriptor->u.Port.Start.HighPart = 0;
271 PartialDescriptor->u.Port.Length = 1;
272
273 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
274 PartialDescriptor->Type = CmResourceTypePort;
276 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
277 PartialDescriptor->u.Port.Start.LowPart = 0x4BE;
278 PartialDescriptor->u.Port.Start.HighPart = 0;
279 PartialDescriptor->u.Port.Length = 1;
280
281 /* Set Interrupt */
282 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
283 PartialDescriptor->Type = CmResourceTypeInterrupt;
285 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
286 PartialDescriptor->u.Interrupt.Level = 11;
287 PartialDescriptor->u.Interrupt.Vector = 11;
288 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
289
290 /* Set DMA channel */
291 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
292 PartialDescriptor->Type = CmResourceTypeDma;
294 PartialDescriptor->Flags = 0;
295 PartialDescriptor->u.Dma.Channel = 2;
296 PartialDescriptor->u.Dma.Port = 0;
297
298 /* Create floppy disk controller */
302 Output | Input,
303 0,
304 0xFFFFFFFF,
305 NULL,
306 PartialResourceList,
307 Size,
308 &ControllerKey);
309 TRACE("Created key: DiskController\\0\n");
310
311 if (FloppyCount)
312 DetectBiosFloppyPeripheral(ControllerKey);
313
314 return ControllerKey;
315}
316
319{
320 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
322 GEOMETRY Geometry;
323 ULONG Size;
324
325 *pSize = 0;
326
327 /* Set 'Configuration Data' value */
330 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
331 if (PartialResourceList == NULL)
332 {
333 ERR("Failed to allocate resource descriptor\n");
334 return NULL;
335 }
336 RtlZeroMemory(PartialResourceList, Size);
337 PartialResourceList->Version = 1;
338 PartialResourceList->Revision = 1;
339 PartialResourceList->Count = 1;
340 PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
341// PartialResourceList->PartialDescriptors[0].ShareDisposition =
342// PartialResourceList->PartialDescriptors[0].Flags =
343 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
345
346 /* Get pointer to geometry data */
347 DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
348
349 /* Get the disk geometry. Extended geometry isn't supported by hardware */
350 if (Pc98DiskGetDriveGeometry(DriveNumber, &Geometry))
351 {
352 DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
353 DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
354 DiskGeometry->SectorsPerTrack = Geometry.Sectors;
355 DiskGeometry->NumberOfHeads = Geometry.Heads;
356 }
357 else
358 {
359 TRACE("Reading disk geometry failed\n");
360 FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
361 return NULL;
362 }
363 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
364 DriveNumber,
365 DiskGeometry->NumberOfCylinders,
366 DiskGeometry->NumberOfHeads,
367 DiskGeometry->SectorsPerTrack,
368 DiskGeometry->BytesPerSector);
369
370 *pSize = Size;
371 return PartialResourceList;
372}
373
374VOID
378{
379 PCONFIGURATION_COMPONENT_DATA ControllerKey, DiskKey;
380 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
381 PCM_INT13_DRIVE_PARAMETER Int13Drives;
382 GEOMETRY Geometry;
383 UCHAR DiskCount, DriveNumber;
384 USHORT i;
385 ULONG Size;
386
387 /* The pre-enumeration of the BIOS disks was already done in InitializeBootDevices() */
388 DiskCount = PcBiosDiskCount;
389
390 /* Use the floppy disk controller as our controller */
391 ControllerKey = DetectBiosFloppyController(BusKey);
392 if (!ControllerKey)
393 {
394 ERR("Failed to detect BIOS disk controller\n");
395 return;
396 }
397
398 /* Set 'Configuration Data' value */
400 sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
401 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
402 if (PartialResourceList == NULL)
403 {
404 ERR("Failed to allocate resource descriptor\n");
405 return;
406 }
407 RtlZeroMemory(PartialResourceList, Size);
408 PartialResourceList->Version = 1;
409 PartialResourceList->Revision = 1;
410 PartialResourceList->Count = 1;
411
412 PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
413 PartialResourceList->PartialDescriptors[0].ShareDisposition = 0;
414 PartialResourceList->PartialDescriptors[0].Flags = 0;
415 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
416 sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
417
418 /* Get hard disk Int13 geometry data */
419 Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
420 for (i = 0; i < DiskCount; i++)
421 {
422 DriveNumber = 0x80 + i;
423
424 if (Pc98DiskGetDriveGeometry(DriveNumber, &Geometry))
425 {
426 Int13Drives[i].DriveSelect = DriveNumber;
427 Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
428 Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors;
429 Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
430 Int13Drives[i].NumberDrives = DiskCount;
431
432 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
433 DriveNumber,
434 Geometry.Cylinders - 1,
435 Geometry.Heads - 1,
436 Geometry.Sectors,
437 Geometry.BytesPerSector);
438 }
439 }
440
441 /* Update the 'System' key's configuration data with BIOS INT13h information */
442 FldrSetConfigurationData(SystemKey, PartialResourceList, Size);
443
444 /* Create and fill subkey for each harddisk */
445 for (i = 0; i < DiskCount; i++)
446 {
448
449 DriveNumber = 0x80 + i;
450
451 /* Get disk values */
452 PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size);
453 Identifier = GetHarddiskIdentifier(DriveNumber);
454
455 /* Create disk key */
456 FldrCreateComponentKey(ControllerKey,
458 DiskPeripheral,
459 Output | Input,
460 i,
461 0xFFFFFFFF,
463 PartialResourceList,
464 Size,
465 &DiskKey);
466 TRACE("Created key: DiskPeripheral\\%d\n", i);
467 }
468}
469
470static VOID
472{
473 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
474 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
475 ULONG Size;
476
477 /* TODO: Properly detect */
478
479 /* Set 'Configuration Data' value */
482 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
483 if (PartialResourceList == NULL)
484 {
485 ERR("Failed to allocate resource descriptor\n");
486 return;
487 }
488 RtlZeroMemory(PartialResourceList, Size);
489 PartialResourceList->Version = 1;
490 PartialResourceList->Revision = 1;
491 PartialResourceList->Count = 0;
492
493 /* Create 'PointerPeripheral' key */
494 FldrCreateComponentKey(ControllerKey,
496 PointerPeripheral,
497 Input,
498 0,
499 0xFFFFFFFF,
500 "NEC PC-9800 BUS MOUSE",
501 PartialResourceList,
502 Size,
503 &PeripheralKey);
504 TRACE("Created key: PointerPeripheral\\0\n");
505}
506
507static VOID
509{
510 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
511 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
512 PCONFIGURATION_COMPONENT_DATA ControllerKey;
513 ULONG Size;
514 UCHAR i;
515 UCHAR Index = 0;
516
517 /* Set 'Configuration Data' value */
520 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
521 if (PartialResourceList == NULL)
522 {
523 ERR("Failed to allocate resource descriptor\n");
524 return;
525 }
526 RtlZeroMemory(PartialResourceList, Size);
527 PartialResourceList->Version = 1;
528 PartialResourceList->Revision = 1;
529 PartialResourceList->Count = (HiResoMachine ? 7 : 6);
530
531 /* Set I/O ports */
532 for (i = 0; i < 4; i++)
533 {
534 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
535 PartialDescriptor->Type = CmResourceTypePort;
537 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
538 PartialDescriptor->u.Port.Start.LowPart = (HiResoMachine ? 0x61 : 0x7FD9) + i * 2;
539 PartialDescriptor->u.Port.Start.HighPart = 0;
540 PartialDescriptor->u.Port.Length = 1;
541 }
542 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
543 PartialDescriptor->Type = CmResourceTypePort;
545 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
546 PartialDescriptor->u.Port.Start.LowPart = (HiResoMachine ? 0x869 : 0xBFDB);
547 PartialDescriptor->u.Port.Start.HighPart = 0;
548 PartialDescriptor->u.Port.Length = 1;
549 if (HiResoMachine)
550 {
551 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
552 PartialDescriptor->Type = CmResourceTypePort;
554 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
555 PartialDescriptor->u.Port.Start.LowPart = 0x98D7;
556 PartialDescriptor->u.Port.Start.HighPart = 0;
557 PartialDescriptor->u.Port.Length = 1;
558 }
559
560 /* Set Interrupt */
561 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
562 PartialDescriptor->Type = CmResourceTypeInterrupt;
564 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
565 PartialDescriptor->u.Interrupt.Level = 13;
566 PartialDescriptor->u.Interrupt.Vector = 13;
567 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
568
569 /* Create controller key */
572 PointerController,
573 Input,
574 0,
575 0xFFFFFFFF,
576 NULL,
577 PartialResourceList,
578 Size,
579 &ControllerKey);
580 TRACE("Created key: PointerController\\0\n");
581
582 DetectPointerPeripheral(ControllerKey);
583}
584
585static VOID
587{
588 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
589 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
590 PCM_KEYBOARD_DEVICE_DATA KeyboardData;
591 PCONFIGURATION_COMPONENT_DATA PeripheralKey;
592 CHAR Identifier[80];
593 ULONG Size;
594 REGS Regs;
595 UCHAR KeyboardType = ((*(PUCHAR)MEM_KEYB_TYPE & 0x40) >> 5) |
596 ((*(PUCHAR)MEM_KEYB_TYPE & 0x08) >> 3);
597
598 /* TODO: Properly detect */
599
600 /* Set 'Configuration Data' value */
603 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
604 if (PartialResourceList == NULL)
605 {
606 ERR("Failed to allocate resource descriptor\n");
607 return;
608 }
609 RtlZeroMemory(PartialResourceList, Size);
610 PartialResourceList->Version = 1;
611 PartialResourceList->Revision = 1;
612 PartialResourceList->Count = 1;
613
614 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
615 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
617 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
618
619 /* Int 18h AH=02h
620 * KEYBOARD - GET SHIFT FLAGS
621 *
622 * Return:
623 * AL - shift flags
624 */
625 Regs.b.ah = 0x02;
626 Int386(0x18, &Regs, &Regs);
627
628 KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
629 KeyboardData->Version = 1;
630 KeyboardData->Revision = 1;
631 KeyboardData->Type = 7;
632 KeyboardData->Subtype = 1;
633 KeyboardData->KeyboardFlags = (Regs.b.al & 0x08) |
634 ((Regs.b.al & 0x02) << 6) |
635 ((Regs.b.al & 0x10) << 2) |
636 ((Regs.b.al & 0x01) << 1);
637
638 if (KeyboardType == 0)
639 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PC98_NmodeKEY");
640 else if (KeyboardType == 2)
641 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PC98_106KEY");
642 else
643 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PC98_LaptopKEY");
644
645 /* Create controller key */
646 FldrCreateComponentKey(ControllerKey,
648 KeyboardPeripheral,
650 0,
651 0xFFFFFFFF,
653 PartialResourceList,
654 Size,
655 &PeripheralKey);
656 TRACE("Created key: KeyboardPeripheral\\0\n");
657}
658
659static VOID
661{
662 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
663 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
664 PCONFIGURATION_COMPONENT_DATA ControllerKey;
665 ULONG Size;
666 UCHAR i;
667
668 if (!CpDoesPortExist((PUCHAR)0x41))
669 return;
670
671 /* Set 'Configuration Data' value */
674 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
675 if (PartialResourceList == NULL)
676 {
677 ERR("Failed to allocate resource descriptor\n");
678 return;
679 }
680 RtlZeroMemory(PartialResourceList, Size);
681 PartialResourceList->Version = 1;
682 PartialResourceList->Revision = 1;
683 PartialResourceList->Count = 3;
684
685 /* Set I/O ports */
686 for (i = 0; i < 2; i++)
687 {
688 PartialDescriptor = &PartialResourceList->PartialDescriptors[i];
689 PartialDescriptor->Type = CmResourceTypePort;
691 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
692 PartialDescriptor->u.Port.Start.LowPart = 0x41 + i * 2;
693 PartialDescriptor->u.Port.Start.HighPart = 0;
694 PartialDescriptor->u.Port.Length = 1;
695 }
696
697 /* Set Interrupt */
698 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
699 PartialDescriptor->Type = CmResourceTypeInterrupt;
701 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
702 PartialDescriptor->u.Interrupt.Level = 1;
703 PartialDescriptor->u.Interrupt.Vector = 1;
704 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
705
706 /* Create controller key */
709 KeyboardController,
711 0,
712 0xFFFFFFFF,
713 NULL,
714 PartialResourceList,
715 Size,
716 &ControllerKey);
717 TRACE("Created key: KeyboardController\\0\n");
718
719 DetectKeyboardPeripheral(ControllerKey);
720}
721
722static VOID
724{
725 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
726 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
727 PCONFIGURATION_COMPONENT_DATA ControllerKey;
728 ULONG Size;
729 UCHAR i;
730 UCHAR Index = 0;
731
732 /* TODO: Properly detect */
733
734 /* Set 'Configuration Data' value */
737 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
738 if (PartialResourceList == NULL)
739 {
740 ERR("Failed to allocate resource descriptor\n");
741 return;
742 }
743 RtlZeroMemory(PartialResourceList, Size);
744 PartialResourceList->Version = 1;
745 PartialResourceList->Revision = 1;
746 PartialResourceList->Count = 8;
747
748 /* Set I/O ports */
749 for (i = 0; i < 4; i++)
750 {
751 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
752 PartialDescriptor->Type = CmResourceTypePort;
754 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
755 PartialDescriptor->u.Port.Start.LowPart = 0x40 + i * 2;
756 PartialDescriptor->u.Port.Start.HighPart = 0;
757 PartialDescriptor->u.Port.Length = 3;
758 }
759
760 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
761 PartialDescriptor->Type = CmResourceTypePort;
763 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
764 PartialDescriptor->u.Port.Start.LowPart = 0x140;
765 PartialDescriptor->u.Port.Start.HighPart = 0;
766 PartialDescriptor->u.Port.Length = 3;
767
768 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
769 PartialDescriptor->Type = CmResourceTypePort;
771 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
772 PartialDescriptor->u.Port.Start.LowPart = 0x149;
773 PartialDescriptor->u.Port.Start.HighPart = 0;
774 PartialDescriptor->u.Port.Length = 1;
775
776 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
777 PartialDescriptor->Type = CmResourceTypePort;
779 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
780 PartialDescriptor->u.Port.Start.LowPart = 0x14B;
781 PartialDescriptor->u.Port.Start.HighPart = 0;
782 PartialDescriptor->u.Port.Length = 4;
783
784 /* Set Interrupt */
785 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
786 PartialDescriptor->Type = CmResourceTypeInterrupt;
788 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
789 PartialDescriptor->u.Interrupt.Level = 14;
790 PartialDescriptor->u.Interrupt.Vector = 14;
791 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
792
793 /* Create controller key */
796 ParallelController,
797 Output,
798 0,
799 0xFFFFFFFF,
800 "PARALLEL1",
801 PartialResourceList,
802 Size,
803 &ControllerKey);
804 TRACE("Created key: ParallelController\\0\n");
805}
806
807static VOID
809{
810 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
811 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
812 PCM_SERIAL_DEVICE_DATA SerialDeviceData;
813 PCONFIGURATION_COMPONENT_DATA ControllerKey;
814 CHAR Identifier[80];
815 UCHAR i;
816 ULONG Size;
817 UCHAR FifoStatus;
819 UCHAR Index = 0;
820 ULONG ControllerNumber = 0;
821
822 if (CpDoesPortExist((PUCHAR)0x30))
823 {
824 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%d", ControllerNumber + 1);
825
826 FifoStatus = READ_PORT_UCHAR((PUCHAR)0x136) & 0x40;
828 HasFifo = ((READ_PORT_UCHAR((PUCHAR)0x136) & 0x40) != FifoStatus);
829
830 /* Set 'Configuration Data' value */
832 (HasFifo ? 10 : 3) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
833 sizeof(CM_SERIAL_DEVICE_DATA);
834 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
835 if (PartialResourceList == NULL)
836 {
837 ERR("Failed to allocate resource descriptor\n");
838 return;
839 }
840 RtlZeroMemory(PartialResourceList, Size);
841 PartialResourceList->Version = 1;
842 PartialResourceList->Revision = 1;
843 PartialResourceList->Count = (HasFifo ? 11 : 4);
844
845 /* Set I/O ports */
846 for (i = 0; i < 2; i++)
847 {
848 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
849 PartialDescriptor->Type = CmResourceTypePort;
851 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
852 PartialDescriptor->u.Port.Start.LowPart = 0x30 + i * 2;
853 PartialDescriptor->u.Port.Start.HighPart = 0;
854 PartialDescriptor->u.Port.Length = 1;
855 }
856 if (HasFifo)
857 {
858 for (i = 0; i < 7; i++)
859 {
860 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
861 PartialDescriptor->Type = CmResourceTypePort;
863 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
864 PartialDescriptor->u.Port.Start.LowPart = 0x130 + i * 2;
865 PartialDescriptor->u.Port.Start.HighPart = 0;
866 PartialDescriptor->u.Port.Length = 1;
867 }
868 }
869
870 /* Set Interrupt */
871 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
872 PartialDescriptor->Type = CmResourceTypeInterrupt;
874 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
875 PartialDescriptor->u.Interrupt.Level = 4;
876 PartialDescriptor->u.Interrupt.Vector = 4;
877 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
878
879 /* Set serial data (device specific) */
880 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
881 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
883 PartialDescriptor->Flags = 0;
884 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
885
886 SerialDeviceData = (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[Index++];
887 SerialDeviceData->BaudClock = (*(PUCHAR)MEM_BIOS_FLAG1 & SYSTEM_CLOCK_8MHZ_FLAG) ?
889
890 /* Create controller key */
893 SerialController,
895 ControllerNumber,
896 0xFFFFFFFF,
898 PartialResourceList,
899 Size,
900 &ControllerKey);
901 TRACE("Created key: SerialController\\%d\n", ControllerNumber);
902
903 ++ControllerNumber;
904 }
905
906 if (CpDoesPortExist((PUCHAR)0x238))
907 {
908 Index = 0;
909
910 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%d", ControllerNumber + 1);
911
912 /* Set 'Configuration Data' value */
915 sizeof(CM_SERIAL_DEVICE_DATA);
916 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
917 if (PartialResourceList == NULL)
918 {
919 ERR("Failed to allocate resource descriptor\n");
920 return;
921 }
922 RtlZeroMemory(PartialResourceList, Size);
923 PartialResourceList->Version = 1;
924 PartialResourceList->Revision = 1;
925 PartialResourceList->Count = 3;
926
927 /* Set I/O ports */
928 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
929 PartialDescriptor->Type = CmResourceTypePort;
931 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
932 PartialDescriptor->u.Port.Start.LowPart = 0x238;
933 PartialDescriptor->u.Port.Start.HighPart = 0;
934 PartialDescriptor->u.Port.Length = 8;
935
936 /* Set Interrupt */
937 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
938 PartialDescriptor->Type = CmResourceTypeInterrupt;
940 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
941 PartialDescriptor->u.Interrupt.Level = 5;
942 PartialDescriptor->u.Interrupt.Vector = 5;
943 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
944
945 /* Set serial data (device specific) */
946 PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
947 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
949 PartialDescriptor->Flags = 0;
950 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
951
952 SerialDeviceData = (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[Index++];
953 SerialDeviceData->BaudClock = 1843200;
954
955 /* Create controller key */
958 SerialController,
960 ControllerNumber,
961 0xFFFFFFFF,
963 PartialResourceList,
964 Size,
965 &ControllerKey);
966 TRACE("Created key: SerialController\\%d\n", ControllerNumber);
967
968 ++ControllerNumber;
969 }
970}
971
972static VOID
974{
975 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
977 ULONG Size;
978
979 /* Set 'Configuration Data' value */
982 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
983 if (PartialResourceList == NULL)
984 {
985 ERR("Failed to allocate resource descriptor\n");
986 return;
987 }
988 RtlZeroMemory(PartialResourceList, Size);
989 PartialResourceList->Version = 1;
990 PartialResourceList->Revision = 1;
991 PartialResourceList->Count = 0;
992
993 /* Create bus key */
994 FldrCreateComponentKey(SystemKey,
996 MultiFunctionAdapter,
997 0x0,
998 0,
999 0xFFFFFFFF,
1000 "ISA",
1001 PartialResourceList,
1002 Size,
1003 &BusKey);
1004
1005 /* Increment bus number */
1006 (*BusNumber)++;
1007
1008 /* Detect C-bus/BIOS devices */
1009 DetectBiosDisks(SystemKey, BusKey);
1010 DetectSerialPorts(BusKey);
1011 DetectParallelPorts(BusKey);
1014
1015 /* FIXME: Detect more C-bus devices */
1016}
1017
1018static VOID
1020{
1021 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1023 ULONG Size;
1024
1025 if (!((*(PUCHAR)MEM_BIOS_FLAG5) & NESA_BUS_FLAG))
1026 return;
1027
1028 /* Set 'Configuration Data' value */
1029 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1031 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1032 if (PartialResourceList == NULL)
1033 {
1034 ERR("Failed to allocate resource descriptor\n");
1035 return;
1036 }
1037 RtlZeroMemory(PartialResourceList, Size);
1038 PartialResourceList->Version = 1;
1039 PartialResourceList->Revision = 1;
1040 PartialResourceList->Count = 0;
1041
1042 /* Create bus key */
1043 FldrCreateComponentKey(SystemKey,
1045 MultiFunctionAdapter,
1046 0x0,
1047 0,
1048 0xFFFFFFFF,
1049 "EISA",
1050 PartialResourceList,
1051 Size,
1052 &BusKey);
1053
1054 /* Increment bus number */
1055 (*BusNumber)++;
1056}
1057
1058// FIXME: Copied from machpc.c
1059static VOID
1061{
1062 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1066 ULONG x;
1067 ULONG NodeSize = 0;
1068 ULONG NodeCount = 0;
1070 ULONG FoundNodeCount;
1071 int i;
1072 ULONG PnpBufferSize;
1073 ULONG PnpBufferSizeLimit;
1074 ULONG Size;
1075 char *Ptr;
1076
1078 if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
1079 {
1080 TRACE("PnP-BIOS not supported\n");
1081 return;
1082 }
1083
1084 TRACE("PnP-BIOS supported\n");
1085 TRACE("Signature '%c%c%c%c'\n",
1086 InstData->Signature[0], InstData->Signature[1],
1087 InstData->Signature[2], InstData->Signature[3]);
1088
1089 x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
1090 if (x == 0x82)
1091 {
1092 TRACE("PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
1093 return;
1094 }
1095
1096 NodeCount &= 0xFF; // needed since some fscked up BIOSes return
1097 // wrong info (e.g. Mac Virtual PC)
1098 // e.g. look: http://my.execpc.com/~geezer/osd/pnp/pnp16.c
1099 if (x != 0 || NodeSize == 0 || NodeCount == 0)
1100 {
1101 ERR("PnP-BIOS failed to enumerate device nodes\n");
1102 return;
1103 }
1104 TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
1105 TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
1106
1107 /* Set 'Configuration Data' value */
1108 PnpBufferSizeLimit = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)
1109 + (NodeSize * NodeCount);
1110 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSizeLimit;
1111 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1112 if (PartialResourceList == NULL)
1113 {
1114 ERR("Failed to allocate resource descriptor\n");
1115 return;
1116 }
1117
1118 /* Initialize resource descriptor */
1119 RtlZeroMemory(PartialResourceList, Size);
1120 PartialResourceList->Version = 1;
1121 PartialResourceList->Revision = 1;
1122 PartialResourceList->Count = 1;
1123 PartialResourceList->PartialDescriptors[0].Type =
1125 PartialResourceList->PartialDescriptors[0].ShareDisposition =
1127
1128 /* The buffer starts after PartialResourceList->PartialDescriptors[0] */
1129 Ptr = (char *)(PartialResourceList + 1);
1130
1131 /* Set installation check data */
1134 PnpBufferSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK);
1135
1136 /* Copy device nodes */
1137 FoundNodeCount = 0;
1138 for (i = 0; i < 0xFF; i++)
1139 {
1140 NodeNumber = (UCHAR)i;
1141
1143 if (x == 0)
1144 {
1146
1147 TRACE("Node: %u Size %u (0x%x)\n",
1148 DeviceNode->Node,
1149 DeviceNode->Size,
1150 DeviceNode->Size);
1151
1152 if (PnpBufferSize + DeviceNode->Size > PnpBufferSizeLimit)
1153 {
1154 ERR("Buffer too small! Ignoring remaining device nodes. (i = %d)\n", i);
1155 break;
1156 }
1157
1159
1160 Ptr += DeviceNode->Size;
1161 PnpBufferSize += DeviceNode->Size;
1162
1163 FoundNodeCount++;
1164 if (FoundNodeCount >= NodeCount)
1165 break;
1166 }
1167 }
1168
1169 /* Set real data size */
1170 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
1171 PnpBufferSize;
1172 Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
1173
1174 TRACE("Real buffer size: %u\n", PnpBufferSize);
1175 TRACE("Resource size: %u\n", Size);
1176
1177 /* Create component key */
1178 FldrCreateComponentKey(SystemKey,
1180 MultiFunctionAdapter,
1181 0x0,
1182 0x0,
1183 0xFFFFFFFF,
1184 "PNP BIOS",
1185 PartialResourceList,
1186 Size,
1187 &BusKey);
1188
1189 (*BusNumber)++;
1190}
1191
1194{
1196 ULONG BusNumber = 0;
1197
1198 TRACE("DetectHardware()\n");
1199
1200 /* Create the 'System' key */
1201 FldrCreateSystemKey(&SystemKey);
1202 FldrSetIdentifier(SystemKey, "NEC PC-98");
1203
1206
1207 /* Detect buses */
1208 DetectPciBios(SystemKey, &BusNumber);
1209 DetectApmBios(SystemKey, &BusNumber);
1210 DetectPnpBios(SystemKey, &BusNumber);
1211 DetectNesaBios(SystemKey, &BusNumber);
1212 DetectCBusBios(SystemKey, &BusNumber);
1213 DetectAcpiBios(SystemKey, &BusNumber);
1214 // TODO: Detect more buses
1215
1216 // TODO: Collect the ROM blocks and append their
1217 // CM_ROM_BLOCK data into the 'System' key's configuration data.
1218
1219 TRACE("DetectHardware() Done\n");
1220 return SystemKey;
1221}
1222
1223UCHAR
1225{
1226 USHORT DiskEquipment = *(PUSHORT)MEM_DISK_EQUIP & ~(*(PUCHAR)MEM_RDISK_EQUIP);
1227 UCHAR DiskMask;
1228 UCHAR FloppyCount = 0;
1229
1230 for (DiskMask = 0x01; DiskMask != 0; DiskMask <<= 1)
1231 {
1232 if (FIRSTBYTE(DiskEquipment) & DiskMask)
1233 ++FloppyCount;
1234 }
1235
1236 for (DiskMask = 0x10; DiskMask != 0; DiskMask <<= 1)
1237 {
1238 if (SECONDBYTE(DiskEquipment) & DiskMask)
1239 ++FloppyCount;
1240 }
1241
1242 return FloppyCount;
1243}
1244
1246{
1249}
1250
1251// FIXME: 1) Copied from pchw.c 2) Should be done inside MachInit.
1252VOID
1254{
1255 INT CpuInformation[4] = {-1};
1256 ULONG NumberOfIds;
1257
1258 /* Check if the processor first supports ID 1 */
1259 __cpuid(CpuInformation, 0);
1260
1261 NumberOfIds = CpuInformation[0];
1262
1263 if (NumberOfIds == 0)
1264 {
1266 __FILE__,
1267 __LINE__,
1268 "ReactOS requires the CPUID instruction to return "
1269 "more than one supported ID.\n\n");
1270 }
1271
1272 /* NumberOfIds will be greater than 1 if the processor is new enough */
1273 if (NumberOfIds == 1)
1274 {
1275 INT ProcessorFamily;
1276
1277 /* Get information */
1278 __cpuid(CpuInformation, 1);
1279
1280 ProcessorFamily = (CpuInformation[0] >> 8) & 0xF;
1281
1282 /* If it's Family 4 or lower, bugcheck */
1283 if (ProcessorFamily < 5)
1284 {
1286 __FILE__,
1287 __LINE__,
1288 "Processor is too old (family %u < 5)\n"
1289 "ReactOS requires a Pentium-level processor or newer.",
1290 ProcessorFamily);
1291 }
1292 }
1293}
@ DeviceNode
Definition: Node.h:9
unsigned char BOOLEAN
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define __cdecl
Definition: accygwin.h:79
VOID NTAPI FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size)
Definition: archwsup.c:78
VOID NTAPI 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 PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
VOID NTAPI FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCHAR IdentifierString)
Definition: archwsup.c:56
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
@ Identifier
Definition: asmpp.cpp:95
@ DiskController
Definition: arcname.c:68
VOID FrLdrBugCheckWithMessage(ULONG BugCode, PCHAR File, ULONG Line, PSTR Format,...)
Definition: entry.c:23
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)
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23
PCM_PARTIAL_RESOURCE_LIST(* GET_HARDDISK_CONFIG_DATA)(UCHAR DriveNumber, ULONG *pSize)
Definition: hardware.h:57
ULONG_PTR __cdecl PnpBiosSupported(VOID)
@ MISSING_HARDWARE_REQUIREMENTS
Definition: debug.h:141
#define ERR(fmt,...)
Definition: debug.h:110
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:103
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
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
_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
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDma
Definition: hwresource.cpp:126
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
signed char * PCHAR
Definition: retypes.h:7
void * PVOID
Definition: retypes.h:9
unsigned short * PUSHORT
Definition: retypes.h:2
unsigned char * PUCHAR
Definition: retypes.h:3
unsigned int ULONG
Definition: retypes.h:1
#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 CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
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:870
VOID FrLdrCheckCpuCompatibility(VOID)
Definition: pc98hw.c:1253
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:1060
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:508
static UCHAR GetFloppyType(UCHAR FloppyNumber)
Definition: pc98hw.c:143
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:375
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pc98hw.c:23
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1245
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: pc98hw.c:39
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:228
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:660
#define HZ
Definition: pc98hw.c:29
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pc98hw.c:45
static VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:808
#define PRECISION
Definition: pc98hw.c:28
static VOID DetectNesaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:1019
static PCM_PARTIAL_RESOURCE_LIST Pc98GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: pc98hw.c:318
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
Definition: hwdisk.c:249
PCONFIGURATION_COMPONENT_DATA Pc98HwDetect(VOID)
Definition: pc98hw.c:1193
static VOID DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:586
static unsigned int delay_count
Definition: pc98hw.c:31
UCHAR Pc98GetFloppyCount(VOID)
Definition: pc98hw.c:1224
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:723
UCHAR PcBiosDiskCount
Definition: hwdisk.c:43
static VOID DetectPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:471
BOOLEAN HiResoMachine
Definition: machpc98.c:17
static VOID DetectCBusBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:973
#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_INSTALLATION_CHECK CM_PNP_BIOS_INSTALLATION_CHECK
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
@ ControllerClass
Definition: arc.h:94
@ AdapterClass
Definition: arc.h:93
@ PeripheralClass
Definition: arc.h:95
@ ConsoleOut
Definition: arc.h:83
@ ConsoleIn
Definition: arc.h:82
@ Input
Definition: arc.h:84
@ Output
Definition: arc.h:85
#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:131
unsigned char ah
Definition: pcbios.h:132
UCHAR StepRateHeadUnloadTime
Definition: cmtypes.h:489
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381::@387 Dma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381::@390 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381::@383 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381::@384 Interrupt
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
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint64_t ULONGLONG
Definition: typedefs.h:67
Definition: pcbios.h:159
BYTEREGS b
Definition: pcbios.h:163
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
static ULONG Delta
Definition: xboxvideo.c:33
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
struct _CM_INT13_DRIVE_PARAMETER CM_INT13_DRIVE_PARAMETER
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareUndetermined
Definition: cmtypes.h:240
struct _CM_FLOPPY_DEVICE_DATA CM_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:796
#define FIRSTBYTE(VALUE)
Definition: rtlfuncs.h:795
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175