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))
176 if (PartialResourceList ==
NULL)
178 ERR(
"Failed to allocate resource descriptor! Ignoring remaining floppy peripherals. (FloppyNumber = %u, FloppyCount = %u)\n",
183 PartialResourceList->
Version = 1;
185 PartialResourceList->
Count = 1;
196 FloppyData->
MaxDensity = MaxDensity[FloppyType];
241 if (PartialResourceList ==
NULL)
243 ERR(
"Failed to allocate resource descriptor\n");
247 PartialResourceList->
Version = 1;
249 PartialResourceList->
Count = 7;
252 for (
i = 0;
i < 3;
i++)
258 PartialDescriptor->
u.
Port.Start.LowPart = 0x90 +
i * 2;
259 PartialDescriptor->
u.
Port.Start.HighPart = 0;
260 PartialDescriptor->
u.
Port.Length = 1;
266 PartialDescriptor->
u.
Port.Start.LowPart = 0xBE;
267 PartialDescriptor->
u.
Port.Start.HighPart = 0;
268 PartialDescriptor->
u.
Port.Length = 1;
274 PartialDescriptor->
u.
Port.Start.LowPart = 0x4BE;
275 PartialDescriptor->
u.
Port.Start.HighPart = 0;
276 PartialDescriptor->
u.
Port.Length = 1;
285 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
291 PartialDescriptor->
Flags = 0;
292 PartialDescriptor->
u.
Dma.Channel = 2;
293 PartialDescriptor->
u.
Dma.Port = 0;
310 return ControllerKey;
326 if (PartialResourceList ==
NULL)
328 ERR(
"Failed to allocate resource descriptor\n");
332 PartialResourceList->
Version = 1;
334 PartialResourceList->
Count = 1;
339 sizeof(*DiskGeometry);
352 TRACE(
"Reading disk geometry failed\n");
356 TRACE(
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
364 return PartialResourceList;
376 UCHAR DiskCount, DriveNumber;
387 ERR(
"Failed to detect BIOS disk controller\n");
395 if (PartialResourceList ==
NULL)
397 ERR(
"Failed to allocate resource descriptor\n");
401 PartialResourceList->
Version = 1;
403 PartialResourceList->
Count = 1;
413 for (
i = 0;
i < DiskCount;
i++)
415 DriveNumber = 0x80 +
i;
425 TRACE(
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
438 for (
i = 0;
i < DiskCount;
i++)
442 DriveNumber = 0x80 +
i;
474 if (PartialResourceList ==
NULL)
476 ERR(
"Failed to allocate resource descriptor\n");
480 PartialResourceList->
Version = 1;
482 PartialResourceList->
Count = 0;
491 "NEC PC-9800 BUS MOUSE",
510 if (PartialResourceList ==
NULL)
512 ERR(
"Failed to allocate resource descriptor\n");
516 PartialResourceList->
Version = 1;
521 for (
i = 0;
i < 4;
i++)
528 PartialDescriptor->
u.
Port.Start.HighPart = 0;
529 PartialDescriptor->
u.
Port.Length = 1;
536 PartialDescriptor->
u.
Port.Start.HighPart = 0;
537 PartialDescriptor->
u.
Port.Length = 1;
544 PartialDescriptor->
u.
Port.Start.LowPart = 0x98D7;
545 PartialDescriptor->
u.
Port.Start.HighPart = 0;
546 PartialDescriptor->
u.
Port.Length = 1;
556 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
591 if (PartialResourceList ==
NULL)
593 ERR(
"Failed to allocate resource descriptor\n");
597 PartialResourceList->
Version = 1;
599 PartialResourceList->
Count = 1;
613 Int386(0x18, &Regs, &Regs);
618 KeyboardData->
Type = 7;
621 ((Regs.
b.
al & 0x02) << 6) |
622 ((Regs.
b.
al & 0x10) << 2) |
623 ((Regs.
b.
al & 0x01) << 1);
625 if (KeyboardType == 0)
627 else if (KeyboardType == 2)
660 if (PartialResourceList ==
NULL)
662 ERR(
"Failed to allocate resource descriptor\n");
666 PartialResourceList->
Version = 1;
668 PartialResourceList->
Count = 3;
671 for (
i = 0;
i < 2;
i++)
677 PartialDescriptor->
u.
Port.Start.LowPart = 0x41 +
i * 2;
678 PartialDescriptor->
u.
Port.Start.HighPart = 0;
679 PartialDescriptor->
u.
Port.Length = 1;
689 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
721 if (PartialResourceList ==
NULL)
723 ERR(
"Failed to allocate resource descriptor\n");
727 PartialResourceList->
Version = 1;
729 PartialResourceList->
Count = 8;
732 for (
i = 0;
i < 4;
i++)
738 PartialDescriptor->
u.
Port.Start.LowPart = 0x40 +
i * 2;
739 PartialDescriptor->
u.
Port.Start.HighPart = 0;
740 PartialDescriptor->
u.
Port.Length = 3;
747 PartialDescriptor->
u.
Port.Start.LowPart = 0x140;
748 PartialDescriptor->
u.
Port.Start.HighPart = 0;
749 PartialDescriptor->
u.
Port.Length = 3;
755 PartialDescriptor->
u.
Port.Start.LowPart = 0x149;
756 PartialDescriptor->
u.
Port.Start.HighPart = 0;
757 PartialDescriptor->
u.
Port.Length = 1;
763 PartialDescriptor->
u.
Port.Start.LowPart = 0x14B;
764 PartialDescriptor->
u.
Port.Start.HighPart = 0;
765 PartialDescriptor->
u.
Port.Length = 4;
774 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
799 ULONG ControllerNumber = 0;
815 sizeof(*SerialDeviceData);
817 if (PartialResourceList ==
NULL)
819 ERR(
"Failed to allocate resource descriptor\n");
823 PartialResourceList->
Version = 1;
830 for (
i = 0;
i < 2;
i++)
836 PartialDescriptor->
u.
Port.Start.LowPart = 0x30 +
i * 2;
837 PartialDescriptor->
u.
Port.Start.HighPart = 0;
838 PartialDescriptor->
u.
Port.Length = 1;
842 for (
i = 0;
i < 7;
i++)
848 PartialDescriptor->
u.
Port.Start.LowPart = 0x130 +
i * 2;
849 PartialDescriptor->
u.
Port.Start.HighPart = 0;
850 PartialDescriptor->
u.
Port.Length = 1;
861 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
867 PartialDescriptor->
Flags = 0;
895 if (PartialResourceList ==
NULL)
897 ERR(
"Failed to allocate resource descriptor\n");
901 PartialResourceList->
Version = 1;
903 PartialResourceList->
Count = 3;
912 PartialDescriptor->
u.
Port.Start.LowPart = 0x238;
913 PartialDescriptor->
u.
Port.Start.HighPart = 0;
914 PartialDescriptor->
u.
Port.Length = 8;
923 PartialDescriptor->
u.
Interrupt.Affinity = 0xFFFFFFFF;
929 PartialDescriptor->
Flags = 0;
960 if (PartialResourceList ==
NULL)
962 ERR(
"Failed to allocate resource descriptor\n");
966 PartialResourceList->
Version = 1;
968 PartialResourceList->
Count = 0;
1008 if (PartialResourceList ==
NULL)
1010 ERR(
"Failed to allocate resource descriptor\n");
1014 PartialResourceList->
Version = 1;
1016 PartialResourceList->
Count = 0;
1026 PartialResourceList,
1044 ULONG NodeCount = 0;
1046 ULONG FoundNodeCount;
1048 ULONG PnpBufferSize;
1049 ULONG PnpBufferSizeLimit;
1056 TRACE(
"PnP-BIOS not supported\n");
1060 TRACE(
"PnP-BIOS supported\n");
1061 TRACE(
"Signature '%c%c%c%c'\n",
1068 TRACE(
"PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
1074 if (
x != 0 || NodeSize == 0 || NodeCount == 0)
1076 ERR(
"PnP-BIOS failed to enumerate device nodes\n");
1079 TRACE(
"MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
1080 TRACE(
"Estimated buffer size %u\n", NodeSize * NodeCount);
1083 PnpBufferSizeLimit =
sizeof(*InstData) + (NodeSize * NodeCount);
1086 if (PartialResourceList ==
NULL)
1088 ERR(
"Failed to allocate resource descriptor\n");
1094 PartialResourceList->
Version = 1;
1096 PartialResourceList->
Count = 1;
1105 Ptr +=
sizeof(*InstData);
1106 PnpBufferSize =
sizeof(*InstData);
1110 for (
i = 0;
i < 0xFF;
i++)
1119 TRACE(
"Node: %u Size %u (0x%x)\n",
1124 if (PnpBufferSize +
DeviceNode->Size > PnpBufferSizeLimit)
1126 ERR(
"Buffer too small! Ignoring remaining device nodes. (i = %d)\n",
i);
1136 if (FoundNodeCount >= NodeCount)
1146 TRACE(
"Real buffer size: %u\n", PnpBufferSize);
1157 PartialResourceList,
1171 TRACE(
"DetectHardware()\n");
1191 TRACE(
"DetectHardware() Done\n");
1200 UCHAR FloppyCount = 0;
1202 for (DiskMask = 0x01; DiskMask != 0; DiskMask <<= 1)
1204 if (
FIRSTBYTE(DiskEquipment) & DiskMask)
1208 for (DiskMask = 0x10; DiskMask != 0; DiskMask <<= 1)
1227 INT CpuInformation[4] = {-1};
1233 NumberOfIds = CpuInformation[0];
1235 if (NumberOfIds == 0)
1240 "ReactOS requires the CPUID instruction to return "
1241 "more than one supported ID.\n\n");
1245 if (NumberOfIds == 1)
1247 INT ProcessorFamily;
1252 ProcessorFamily = (CpuInformation[0] >> 8) & 0xF;
1255 if (ProcessorFamily < 5)
1260 "Processor is too old (family %u < 5)\n"
1261 "ReactOS requires a Pentium-level processor or newer.",
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)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
_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)
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
#define SYSTEM_CLOCK_8MHZ_FLAG
#define CM_RESOURCE_PORT_IO
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_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
#define CmResourceTypeDma
#define CmResourceTypeDeviceSpecific
#define CmResourceTypePort
#define CM_RESOURCE_INTERRUPT_LATCHED
#define CmResourceTypeInterrupt
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::@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]
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 FIELD_OFFSET(t, f)
#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_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
@ CmResourceShareUndetermined
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
#define SECONDBYTE(VALUE)