41 register volatile unsigned int i;
42 for (
i = 0;
i < Loops;
i++);
55 ULONG PreviousCount = ~0;
62 PreviousCount = CurrentCount;
64 Delta = CurrentCount - PreviousCount;
102 while (CurCount >
Count / 2);
132 if (CurCount <=
Count / 2)
160 ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880};
166 if ((FloppyType > 5) || (FloppyType == 0))
177 if (PartialResourceList ==
NULL)
179 ERR(
"Failed to allocate resource descriptor! Ignoring remaining floppy peripherals. (FloppyNumber = %u, FloppyCount = %u)\n",
184 PartialResourceList->
Version = 1;
186 PartialResourceList->
Count = 1;
197 FloppyData->
MaxDensity = MaxDensity[FloppyType];
243 if (PartialResourceList ==
NULL)
245 ERR(
"Failed to allocate resource descriptor\n");
249 PartialResourceList->
Version = 1;
251 PartialResourceList->
Count = 7;
254 for (
i = 0;
i < 3;
i++)
260 PartialDescriptor->
u.
Port.Start.LowPart = 0x90 +
i * 2;
261 PartialDescriptor->
u.
Port.Start.HighPart = 0;
262 PartialDescriptor->
u.
Port.Length = 1;
268 PartialDescriptor->
u.
Port.Start.LowPart = 0xBE;
269 PartialDescriptor->
u.
Port.Start.HighPart = 0;
270 PartialDescriptor->
u.
Port.Length = 1;
276 PartialDescriptor->
u.
Port.Start.LowPart = 0x4BE;
277 PartialDescriptor->
u.
Port.Start.HighPart = 0;
278 PartialDescriptor->
u.
Port.Length = 1;
287 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
293 PartialDescriptor->
Flags = 0;
294 PartialDescriptor->
u.
Dma.Channel = 2;
295 PartialDescriptor->
u.
Dma.Port = 0;
312 return ControllerKey;
329 if (PartialResourceList ==
NULL)
331 ERR(
"Failed to allocate resource descriptor\n");
335 PartialResourceList->
Version = 1;
337 PartialResourceList->
Count = 1;
357 TRACE(
"Reading disk geometry failed\n");
361 TRACE(
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
369 return PartialResourceList;
381 UCHAR DiskCount, DriveNumber;
392 ERR(
"Failed to detect BIOS disk controller\n");
400 if (PartialResourceList ==
NULL)
402 ERR(
"Failed to allocate resource descriptor\n");
406 PartialResourceList->
Version = 1;
408 PartialResourceList->
Count = 1;
418 for (
i = 0;
i < DiskCount;
i++)
420 DriveNumber = 0x80 +
i;
430 TRACE(
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
443 for (
i = 0;
i < DiskCount;
i++)
447 DriveNumber = 0x80 +
i;
480 if (PartialResourceList ==
NULL)
482 ERR(
"Failed to allocate resource descriptor\n");
486 PartialResourceList->
Version = 1;
488 PartialResourceList->
Count = 0;
497 "NEC PC-9800 BUS MOUSE",
517 if (PartialResourceList ==
NULL)
519 ERR(
"Failed to allocate resource descriptor\n");
523 PartialResourceList->
Version = 1;
528 for (
i = 0;
i < 4;
i++)
535 PartialDescriptor->
u.
Port.Start.HighPart = 0;
536 PartialDescriptor->
u.
Port.Length = 1;
543 PartialDescriptor->
u.
Port.Start.HighPart = 0;
544 PartialDescriptor->
u.
Port.Length = 1;
551 PartialDescriptor->
u.
Port.Start.LowPart = 0x98D7;
552 PartialDescriptor->
u.
Port.Start.HighPart = 0;
553 PartialDescriptor->
u.
Port.Length = 1;
563 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
599 if (PartialResourceList ==
NULL)
601 ERR(
"Failed to allocate resource descriptor\n");
605 PartialResourceList->
Version = 1;
607 PartialResourceList->
Count = 1;
621 Int386(0x18, &Regs, &Regs);
626 KeyboardData->
Type = 7;
629 ((Regs.
b.
al & 0x02) << 6) |
630 ((Regs.
b.
al & 0x10) << 2) |
631 ((Regs.
b.
al & 0x01) << 1);
633 if (KeyboardType == 0)
635 else if (KeyboardType == 2)
669 if (PartialResourceList ==
NULL)
671 ERR(
"Failed to allocate resource descriptor\n");
675 PartialResourceList->
Version = 1;
677 PartialResourceList->
Count = 3;
680 for (
i = 0;
i < 2;
i++)
686 PartialDescriptor->
u.
Port.Start.LowPart = 0x41 +
i * 2;
687 PartialDescriptor->
u.
Port.Start.HighPart = 0;
688 PartialDescriptor->
u.
Port.Length = 1;
698 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
731 if (PartialResourceList ==
NULL)
733 ERR(
"Failed to allocate resource descriptor\n");
737 PartialResourceList->
Version = 1;
739 PartialResourceList->
Count = 8;
742 for (
i = 0;
i < 4;
i++)
748 PartialDescriptor->
u.
Port.Start.LowPart = 0x40 +
i * 2;
749 PartialDescriptor->
u.
Port.Start.HighPart = 0;
750 PartialDescriptor->
u.
Port.Length = 3;
757 PartialDescriptor->
u.
Port.Start.LowPart = 0x140;
758 PartialDescriptor->
u.
Port.Start.HighPart = 0;
759 PartialDescriptor->
u.
Port.Length = 3;
765 PartialDescriptor->
u.
Port.Start.LowPart = 0x149;
766 PartialDescriptor->
u.
Port.Start.HighPart = 0;
767 PartialDescriptor->
u.
Port.Length = 1;
773 PartialDescriptor->
u.
Port.Start.LowPart = 0x14B;
774 PartialDescriptor->
u.
Port.Start.HighPart = 0;
775 PartialDescriptor->
u.
Port.Length = 4;
784 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
812 ULONG ControllerNumber = 0;
827 if (PartialResourceList ==
NULL)
829 ERR(
"Failed to allocate resource descriptor\n");
833 PartialResourceList->
Version = 1;
838 for (
i = 0;
i < 2;
i++)
844 PartialDescriptor->
u.
Port.Start.LowPart = 0x30 +
i * 2;
845 PartialDescriptor->
u.
Port.Start.HighPart = 0;
846 PartialDescriptor->
u.
Port.Length = 1;
850 for (
i = 0;
i < 7;
i++)
856 PartialDescriptor->
u.
Port.Start.LowPart = 0x130 +
i * 2;
857 PartialDescriptor->
u.
Port.Start.HighPart = 0;
858 PartialDescriptor->
u.
Port.Length = 1;
869 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
875 PartialDescriptor->
Flags = 0;
908 if (PartialResourceList ==
NULL)
910 ERR(
"Failed to allocate resource descriptor\n");
914 PartialResourceList->
Version = 1;
916 PartialResourceList->
Count = 3;
923 PartialDescriptor->
u.
Port.Start.LowPart = 0x238;
924 PartialDescriptor->
u.
Port.Start.HighPart = 0;
925 PartialDescriptor->
u.
Port.Length = 8;
934 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
940 PartialDescriptor->
Flags = 0;
973 if (PartialResourceList ==
NULL)
975 ERR(
"Failed to allocate resource descriptor\n");
979 PartialResourceList->
Version = 1;
981 PartialResourceList->
Count = 0;
1022 if (PartialResourceList ==
NULL)
1024 ERR(
"Failed to allocate resource descriptor\n");
1028 PartialResourceList->
Version = 1;
1030 PartialResourceList->
Count = 0;
1040 PartialResourceList,
1058 ULONG NodeCount = 0;
1060 ULONG FoundNodeCount;
1062 ULONG PnpBufferSize;
1063 ULONG PnpBufferSizeLimit;
1070 TRACE(
"PnP-BIOS not supported\n");
1074 TRACE(
"PnP-BIOS supported\n");
1075 TRACE(
"Signature '%c%c%c%c'\n",
1082 TRACE(
"PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
1089 if (
x != 0 || NodeSize == 0 || NodeCount == 0)
1091 ERR(
"PnP-BIOS failed to enumerate device nodes\n");
1094 TRACE(
"MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
1095 TRACE(
"Estimated buffer size %u\n", NodeSize * NodeCount);
1099 + (NodeSize * NodeCount);
1102 if (PartialResourceList ==
NULL)
1104 ERR(
"Failed to allocate resource descriptor\n");
1110 PartialResourceList->
Version = 1;
1112 PartialResourceList->
Count = 1;
1119 Ptr = (
char *)(PartialResourceList + 1);
1128 for (
i = 0;
i < 0xFF;
i++)
1137 TRACE(
"Node: %u Size %u (0x%x)\n",
1142 if (PnpBufferSize +
DeviceNode->Size > PnpBufferSizeLimit)
1144 ERR(
"Buffer too small! Ignoring remaining device nodes. (i = %d)\n",
i);
1154 if (FoundNodeCount >= NodeCount)
1164 TRACE(
"Real buffer size: %u\n", PnpBufferSize);
1175 PartialResourceList,
1189 TRACE(
"DetectHardware()\n");
1209 TRACE(
"DetectHardware() Done\n");
1218 UCHAR FloppyCount = 0;
1220 for (DiskMask = 0x01; DiskMask != 0; DiskMask <<= 1)
1222 if (
FIRSTBYTE(DiskEquipment) & DiskMask)
1226 for (DiskMask = 0x10; DiskMask != 0; DiskMask <<= 1)
1245 INT CpuInformation[4] = {-1};
1251 NumberOfIds = CpuInformation[0];
1253 if (NumberOfIds == 0)
1258 "ReactOS requires the CPUID instruction to return "
1259 "more than one supported ID.\n\n");
1263 if (NumberOfIds == 1)
1265 INT ProcessorFamily;
1270 ProcessorFamily = (CpuInformation[0] >> 8) & 0xF;
1273 if (ProcessorFamily < 5)
1278 "Processor is too old (family %u < 5)\n"
1279 "ReactOS requires a Pentium-level processor or newer.",
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
VOID FldrCreateSystemKey(_Out_ PCONFIGURATION_COMPONENT_DATA *SystemNode, _In_ PCSTR IdentifierString)
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)
VOID FldrSetConfigurationData(_Inout_ PCONFIGURATION_COMPONENT_DATA ComponentData, _In_ PCM_PARTIAL_RESOURCE_LIST ResourceList, _In_ ULONG Size)
DECLSPEC_NORETURN VOID FrLdrBugCheckWithMessage(ULONG BugCode, PCHAR File, ULONG Line, PSTR Format,...)
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData)
FIND_PCI_BIOS FindPciBios
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)
ULONG_PTR __cdecl PnpBiosSupported(VOID)
@ MISSING_HARDWARE_REQUIREMENTS
#define DBG_DEFAULT_CHANNEL(ch)
VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
GLint GLint GLint GLint GLint x
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
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDma
#define CmResourceTypeDeviceSpecific
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
#define CmResourceTypeInterrupt
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
#define SYSTEM_CLOCK_8MHZ_FLAG
#define CM_RESOURCE_PORT_IO
#define CM_RESOURCE_INTERRUPT_LATCHED
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
BOOLEAN Pc98DiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
VOID FrLdrCheckCpuCompatibility(VOID)
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
static VOID DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
static VOID WaitFor8253Wraparound(VOID)
VOID HalpCalibrateStallExecution(VOID)
static VOID DetectPointerController(PCONFIGURATION_COMPONENT_DATA BusKey)
static UCHAR GetFloppyType(UCHAR FloppyNumber)
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
VOID __cdecl DiskStopFloppyMotor(VOID)
PCONFIGURATION_COMPONENT_DATA Pc98HwDetect(_In_opt_ PCSTR Options)
static VOID __StallExecutionProcessor(ULONG Loops)
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
VOID StallExecutionProcessor(ULONG Microseconds)
static VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
static VOID DetectNesaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
static PCM_PARTIAL_RESOURCE_LIST Pc98GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
static VOID DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
static unsigned int delay_count
UCHAR Pc98GetFloppyCount(VOID)
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
static VOID DetectPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
static VOID DetectCBusBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
#define READ_PORT_UCHAR(p)
#define WRITE_PORT_UCHAR(p, d)
int __cdecl Int386(int ivec, REGS *in, REGS *out)
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
FORCEINLINE ULONG Read8253Timer(TIMER_CHANNELS TimerChannel)
#define TIMER_FREQUENCY_1
FORCEINLINE VOID Write8253Timer(TIMER_CONTROL_PORT_REGISTER TimerControl, USHORT Count)
#define TIMER_FREQUENCY_2
UCHAR StepRateHeadUnloadTime
UCHAR FormatFillCharacter
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@416::@418 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@416::@419 Interrupt
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@416::@425 DeviceSpecificData
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@416::@422 Dma
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@416 u
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
ULONG BytesPerSector
Number of bytes per sector.
ULONG Cylinders
Number of cylinders on the disk.
ULONG SectorsPerTrack
Number of sectors per track.
ULONG Heads
Number of heads on the disk.
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define TAG_HW_RESOURCE_LIST
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
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
@ CmResourceShareUndetermined
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
#define SECONDBYTE(VALUE)