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];
215 FloppyDiskPeripheral,
223 TRACE(
"Created key: FloppyDiskPeripheral\\%d\n", FloppyNumber);
244 if (PartialResourceList ==
NULL)
246 ERR(
"Failed to allocate resource descriptor\n");
250 PartialResourceList->
Version = 1;
252 PartialResourceList->
Count = 7;
255 for (
i = 0;
i < 3;
i++)
261 PartialDescriptor->
u.
Port.Start.LowPart = 0x90 +
i * 2;
262 PartialDescriptor->
u.
Port.Start.HighPart = 0;
263 PartialDescriptor->
u.
Port.Length = 1;
269 PartialDescriptor->
u.
Port.Start.LowPart = 0xBE;
270 PartialDescriptor->
u.
Port.Start.HighPart = 0;
271 PartialDescriptor->
u.
Port.Length = 1;
277 PartialDescriptor->
u.
Port.Start.LowPart = 0x4BE;
278 PartialDescriptor->
u.
Port.Start.HighPart = 0;
279 PartialDescriptor->
u.
Port.Length = 1;
288 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
294 PartialDescriptor->
Flags = 0;
295 PartialDescriptor->
u.
Dma.Channel = 2;
296 PartialDescriptor->
u.
Dma.Port = 0;
309 TRACE(
"Created key: DiskController\\0\n");
314 return ControllerKey;
331 if (PartialResourceList ==
NULL)
333 ERR(
"Failed to allocate resource descriptor\n");
337 PartialResourceList->
Version = 1;
339 PartialResourceList->
Count = 1;
359 TRACE(
"Reading disk geometry failed\n");
363 TRACE(
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
371 return PartialResourceList;
383 UCHAR DiskCount, DriveNumber;
394 ERR(
"Failed to detect BIOS disk controller\n");
402 if (PartialResourceList ==
NULL)
404 ERR(
"Failed to allocate resource descriptor\n");
408 PartialResourceList->
Version = 1;
410 PartialResourceList->
Count = 1;
420 for (
i = 0;
i < DiskCount;
i++)
422 DriveNumber = 0x80 +
i;
432 TRACE(
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
445 for (
i = 0;
i < DiskCount;
i++)
449 DriveNumber = 0x80 +
i;
466 TRACE(
"Created key: DiskPeripheral\\%d\n",
i);
483 if (PartialResourceList ==
NULL)
485 ERR(
"Failed to allocate resource descriptor\n");
489 PartialResourceList->
Version = 1;
491 PartialResourceList->
Count = 0;
500 "NEC PC-9800 BUS MOUSE",
504 TRACE(
"Created key: PointerPeripheral\\0\n");
521 if (PartialResourceList ==
NULL)
523 ERR(
"Failed to allocate resource descriptor\n");
527 PartialResourceList->
Version = 1;
532 for (
i = 0;
i < 4;
i++)
539 PartialDescriptor->
u.
Port.Start.HighPart = 0;
540 PartialDescriptor->
u.
Port.Length = 1;
547 PartialDescriptor->
u.
Port.Start.HighPart = 0;
548 PartialDescriptor->
u.
Port.Length = 1;
555 PartialDescriptor->
u.
Port.Start.LowPart = 0x98D7;
556 PartialDescriptor->
u.
Port.Start.HighPart = 0;
557 PartialDescriptor->
u.
Port.Length = 1;
567 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
580 TRACE(
"Created key: PointerController\\0\n");
604 if (PartialResourceList ==
NULL)
606 ERR(
"Failed to allocate resource descriptor\n");
610 PartialResourceList->
Version = 1;
612 PartialResourceList->
Count = 1;
626 Int386(0x18, &Regs, &Regs);
631 KeyboardData->
Type = 7;
634 ((Regs.
b.
al & 0x02) << 6) |
635 ((Regs.
b.
al & 0x10) << 2) |
636 ((Regs.
b.
al & 0x01) << 1);
638 if (KeyboardType == 0)
640 else if (KeyboardType == 2)
656 TRACE(
"Created key: KeyboardPeripheral\\0\n");
675 if (PartialResourceList ==
NULL)
677 ERR(
"Failed to allocate resource descriptor\n");
681 PartialResourceList->
Version = 1;
683 PartialResourceList->
Count = 3;
686 for (
i = 0;
i < 2;
i++)
692 PartialDescriptor->
u.
Port.Start.LowPart = 0x41 +
i * 2;
693 PartialDescriptor->
u.
Port.Start.HighPart = 0;
694 PartialDescriptor->
u.
Port.Length = 1;
704 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
717 TRACE(
"Created key: KeyboardController\\0\n");
738 if (PartialResourceList ==
NULL)
740 ERR(
"Failed to allocate resource descriptor\n");
744 PartialResourceList->
Version = 1;
746 PartialResourceList->
Count = 8;
749 for (
i = 0;
i < 4;
i++)
755 PartialDescriptor->
u.
Port.Start.LowPart = 0x40 +
i * 2;
756 PartialDescriptor->
u.
Port.Start.HighPart = 0;
757 PartialDescriptor->
u.
Port.Length = 3;
764 PartialDescriptor->
u.
Port.Start.LowPart = 0x140;
765 PartialDescriptor->
u.
Port.Start.HighPart = 0;
766 PartialDescriptor->
u.
Port.Length = 3;
772 PartialDescriptor->
u.
Port.Start.LowPart = 0x149;
773 PartialDescriptor->
u.
Port.Start.HighPart = 0;
774 PartialDescriptor->
u.
Port.Length = 1;
780 PartialDescriptor->
u.
Port.Start.LowPart = 0x14B;
781 PartialDescriptor->
u.
Port.Start.HighPart = 0;
782 PartialDescriptor->
u.
Port.Length = 4;
791 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
804 TRACE(
"Created key: ParallelController\\0\n");
820 ULONG ControllerNumber = 0;
835 if (PartialResourceList ==
NULL)
837 ERR(
"Failed to allocate resource descriptor\n");
841 PartialResourceList->
Version = 1;
846 for (
i = 0;
i < 2;
i++)
852 PartialDescriptor->
u.
Port.Start.LowPart = 0x30 +
i * 2;
853 PartialDescriptor->
u.
Port.Start.HighPart = 0;
854 PartialDescriptor->
u.
Port.Length = 1;
858 for (
i = 0;
i < 7;
i++)
864 PartialDescriptor->
u.
Port.Start.LowPart = 0x130 +
i * 2;
865 PartialDescriptor->
u.
Port.Start.HighPart = 0;
866 PartialDescriptor->
u.
Port.Length = 1;
877 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
883 PartialDescriptor->
Flags = 0;
901 TRACE(
"Created key: SerialController\\%d\n", ControllerNumber);
917 if (PartialResourceList ==
NULL)
919 ERR(
"Failed to allocate resource descriptor\n");
923 PartialResourceList->
Version = 1;
925 PartialResourceList->
Count = 3;
932 PartialDescriptor->
u.
Port.Start.LowPart = 0x238;
933 PartialDescriptor->
u.
Port.Start.HighPart = 0;
934 PartialDescriptor->
u.
Port.Length = 8;
943 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
949 PartialDescriptor->
Flags = 0;
966 TRACE(
"Created key: SerialController\\%d\n", ControllerNumber);
983 if (PartialResourceList ==
NULL)
985 ERR(
"Failed to allocate resource descriptor\n");
989 PartialResourceList->
Version = 1;
991 PartialResourceList->
Count = 0;
996 MultiFunctionAdapter,
1001 PartialResourceList,
1032 if (PartialResourceList ==
NULL)
1034 ERR(
"Failed to allocate resource descriptor\n");
1038 PartialResourceList->
Version = 1;
1040 PartialResourceList->
Count = 0;
1045 MultiFunctionAdapter,
1050 PartialResourceList,
1068 ULONG NodeCount = 0;
1070 ULONG FoundNodeCount;
1072 ULONG PnpBufferSize;
1073 ULONG PnpBufferSizeLimit;
1080 TRACE(
"PnP-BIOS not supported\n");
1084 TRACE(
"PnP-BIOS supported\n");
1085 TRACE(
"Signature '%c%c%c%c'\n",
1092 TRACE(
"PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
1099 if (
x != 0 || NodeSize == 0 || NodeCount == 0)
1101 ERR(
"PnP-BIOS failed to enumerate device nodes\n");
1104 TRACE(
"MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
1105 TRACE(
"Estimated buffer size %u\n", NodeSize * NodeCount);
1109 + (NodeSize * NodeCount);
1112 if (PartialResourceList ==
NULL)
1114 ERR(
"Failed to allocate resource descriptor\n");
1120 PartialResourceList->
Version = 1;
1122 PartialResourceList->
Count = 1;
1129 Ptr = (
char *)(PartialResourceList + 1);
1138 for (
i = 0;
i < 0xFF;
i++)
1147 TRACE(
"Node: %u Size %u (0x%x)\n",
1152 if (PnpBufferSize +
DeviceNode->Size > PnpBufferSizeLimit)
1154 ERR(
"Buffer too small! Ignoring remaining device nodes. (i = %d)\n",
i);
1164 if (FoundNodeCount >= NodeCount)
1174 TRACE(
"Real buffer size: %u\n", PnpBufferSize);
1180 MultiFunctionAdapter,
1185 PartialResourceList,
1198 TRACE(
"DetectHardware()\n");
1219 TRACE(
"DetectHardware() Done\n");
1228 UCHAR FloppyCount = 0;
1230 for (DiskMask = 0x01; DiskMask != 0; DiskMask <<= 1)
1232 if (
FIRSTBYTE(DiskEquipment) & DiskMask)
1236 for (DiskMask = 0x10; DiskMask != 0; DiskMask <<= 1)
1255 INT CpuInformation[4] = {-1};
1261 NumberOfIds = CpuInformation[0];
1263 if (NumberOfIds == 0)
1268 "ReactOS requires the CPUID instruction to return " 1269 "more than one supported ID.\n\n");
1273 if (NumberOfIds == 1)
1275 INT ProcessorFamily;
1280 ProcessorFamily = (CpuInformation[0] >> 8) & 0xF;
1283 if (ProcessorFamily < 5)
1288 "Processor is too old (family %u < 5)\n" 1289 "ReactOS requires a Pentium-level processor or newer.",
VOID NTAPI FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCHAR IdentifierString)
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
struct _CM_INT13_DRIVE_PARAMETER CM_INT13_DRIVE_PARAMETER
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
static PCM_PARTIAL_RESOURCE_LIST Pc98GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
#define READ_PORT_UCHAR(p)
static VOID DetectCBusBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
static VOID __StallExecutionProcessor(ULONG Loops)
struct _CM_PNP_BIOS_INSTALLATION_CHECK * PCM_PNP_BIOS_INSTALLATION_CHECK
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
struct _CM_SERIAL_DEVICE_DATA CM_SERIAL_DEVICE_DATA
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
UCHAR Pc98GetFloppyCount(VOID)
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378::@387 DeviceSpecificData
static VOID WaitFor8253Wraparound(VOID)
IN PVOID IN PVOID IN USHORT IN USHORT Size
VOID FrLdrCheckCpuCompatibility(VOID)
FORCEINLINE VOID Write8253Timer(TIMER_CONTROL_PORT_REGISTER TimerControl, USHORT Count)
GLint GLint GLint GLint GLint x
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
static VOID DetectPointerController(PCONFIGURATION_COMPONENT_DATA BusKey)
int __cdecl Int386(int ivec, REGS *in, REGS *out)
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
ULONG __cdecl PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer)
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
static UCHAR GetFloppyType(UCHAR FloppyNumber)
FIND_PCI_BIOS FindPciBios
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378::@380 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378::@384 Dma
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
VOID StallExecutionProcessor(ULONG Microseconds)
PCONFIGURATION_COMPONENT_DATA Pc98HwDetect(VOID)
ULONG __cdecl PnpBiosGetDeviceNodeCount(ULONG *NodeSize, ULONG *NodeCount)
PCM_PARTIAL_RESOURCE_LIST(* GET_HARDDISK_CONFIG_DATA)(UCHAR DriveNumber, ULONG *pSize)
struct _CM_PNP_BIOS_INSTALLATION_CHECK CM_PNP_BIOS_INSTALLATION_CHECK
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
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)
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
VOID __cdecl DiskStopFloppyMotor(VOID)
_In_ WDFCOLLECTION _In_ ULONG Index
DBG_DEFAULT_CHANNEL(HWDETECT)
static VOID DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
FORCEINLINE ULONG Read8253Timer(TIMER_CHANNELS TimerChannel)
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
static VOID DetectPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
#define WRITE_PORT_UCHAR(p, d)
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
UCHAR FormatFillCharacter
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
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)
#define TIMER_FREQUENCY_1
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378::@381 Interrupt
UCHAR StepRateHeadUnloadTime
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
struct _CM_FLOPPY_DEVICE_DATA CM_FLOPPY_DEVICE_DATA
#define SYSTEM_CLOCK_8MHZ_FLAG
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 FrLdrBugCheckWithMessage(ULONG BugCode, PCHAR File, ULONG Line, PSTR Format,...)
static VOID DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
#define CM_RESOURCE_PORT_IO
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData)
struct _CM_KEYBOARD_DEVICE_DATA CM_KEYBOARD_DEVICE_DATA
ULONG_PTR __cdecl PnpBiosSupported(VOID)
#define CmResourceTypeInterrupt
static VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
#define CM_RESOURCE_INTERRUPT_LATCHED
#define RtlZeroMemory(Destination, Length)
static VOID DetectNesaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
#define RtlCopyMemory(Destination, Source, Length)
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
struct _CM_KEYBOARD_DEVICE_DATA * PCM_KEYBOARD_DEVICE_DATA
VOID HalpCalibrateStallExecution(VOID)
VOID NTAPI FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size)
struct _CM_DISK_GEOMETRY_DEVICE_DATA CM_DISK_GEOMETRY_DEVICE_DATA
#define TAG_HW_RESOURCE_LIST
#define CmResourceTypeDma
#define TIMER_FREQUENCY_2
#define SECONDBYTE(VALUE)
static unsigned int delay_count
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)