ReactOS  0.4.15-dev-1070-ge1a01de
hardware.h File Reference

Go to the source code of this file.

Macros

#define CONFIG_CMD(bus, dev_fn, where)   (0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
 
#define TAG_HW_RESOURCE_LIST   'lRwH'
 
#define TAG_HW_DISK_CONTEXT   'cDwH'
 

Typedefs

typedef PCM_PARTIAL_RESOURCE_LIST(* GET_HARDDISK_CONFIG_DATA) (UCHAR DriveNumber, ULONG *pSize)
 
typedef BOOLEAN(* FIND_PCI_BIOS) (PPCI_REGISTRY_INFO BusData)
 
typedef ULONG(* GET_SERIAL_PORT) (ULONG Index, PULONG Irq)
 

Functions

VOID StallExecutionProcessor (ULONG Microseconds)
 
VOID HalpCalibrateStallExecution (VOID)
 
VOID DetectBiosDisks (PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
 
VOID DetectAcpiBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
VOID DetectApmBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
VOID DetectPciBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
ULONG_PTR __cdecl PnpBiosSupported (VOID)
 
ULONG __cdecl PnpBiosGetDeviceNodeCount (ULONG *NodeSize, ULONG *NodeCount)
 
ULONG __cdecl PnpBiosGetDeviceNode (UCHAR *NodeId, UCHAR *NodeBuffer)
 
USHORT __cdecl PxeCallApi (USHORT Segment, USHORT Offset, USHORT Service, VOID *Parameter)
 

Variables

GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
 
FIND_PCI_BIOS FindPciBios
 

Macro Definition Documentation

◆ CONFIG_CMD

#define CONFIG_CMD (   bus,
  dev_fn,
  where 
)    (0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))

Definition at line 23 of file hardware.h.

◆ TAG_HW_DISK_CONTEXT

#define TAG_HW_DISK_CONTEXT   'cDwH'

Definition at line 27 of file hardware.h.

◆ TAG_HW_RESOURCE_LIST

#define TAG_HW_RESOURCE_LIST   'lRwH'

Definition at line 26 of file hardware.h.

Typedef Documentation

◆ FIND_PCI_BIOS

typedef BOOLEAN(* FIND_PCI_BIOS) (PPCI_REGISTRY_INFO BusData)

Definition at line 43 of file hardware.h.

◆ GET_HARDDISK_CONFIG_DATA

typedef PCM_PARTIAL_RESOURCE_LIST(* GET_HARDDISK_CONFIG_DATA) (UCHAR DriveNumber, ULONG *pSize)

Definition at line 37 of file hardware.h.

◆ GET_SERIAL_PORT

typedef ULONG(* GET_SERIAL_PORT) (ULONG Index, PULONG Irq)

Definition at line 49 of file hardware.h.

Function Documentation

◆ DetectAcpiBios()

VOID DetectAcpiBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)

Definition at line 54 of file hwacpi.c.

55 {
57  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
58  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
59  PRSDP_DESCRIPTOR Rsdp;
60  PACPI_BIOS_DATA AcpiBiosData;
62 
63  Rsdp = FindAcpiBios();
64 
65  if (Rsdp)
66  {
67  /* Set up the flag in the loader block */
68  AcpiPresent = TRUE;
69 
70  /* Calculate the table size */
72  sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP);
73 
74  /* Set 'Configuration Data' value */
75  PartialResourceList =
78 
79  if (PartialResourceList == NULL)
80  {
81  ERR("Failed to allocate resource descriptor\n");
82  return;
83  }
84 
85  memset(PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
86  PartialResourceList->Version = 0;
87  PartialResourceList->Revision = 0;
88  PartialResourceList->Count = 1;
89 
90  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
91  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
92  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
93  PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize;
94 
95  /* Fill the table */
96  AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
97 
98  if (Rsdp->revision > 0)
99  {
100  TRACE("ACPI >1.0, using XSDT address\n");
101  AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
102  }
103  else
104  {
105  TRACE("ACPI 1.0, using RSDT address\n");
106  AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
107  }
108 
109  AcpiBiosData->Count = PcBiosMapCount;
110  memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap,
111  PcBiosMapCount * sizeof(BIOS_MEMORY_MAP));
112 
113  TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
114  TableSize);
115 
116  /* Create new bus key */
117  FldrCreateComponentKey(SystemKey,
118  AdapterClass,
119  MultiFunctionAdapter,
120  0x0,
121  0x0,
122  0xFFFFFFFF,
123  "ACPI BIOS",
124  PartialResourceList,
126  &BiosKey);
127 
128  /* Increment bus number */
129  (*BusNumber)++;
130  }
131 }
UCHAR revision
Definition: winldr.h:25
PHYSICAL_ADDRESS RSDTAddress
Definition: pcbios.h:77
ULONGLONG xsdt_physical_address
Definition: winldr.h:28
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
BOOLEAN AcpiPresent
Definition: hwacpi.c:26
GLint x0
Definition: linetemp.h:95
struct _ACPI_BIOS_DATA * PACPI_BIOS_DATA
#define TRUE
Definition: types.h:120
ULONGLONG Count
Definition: pcbios.h:78
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
BIOS_MEMORY_MAP PcBiosMemoryMap[MAX_BIOS_DESCRIPTORS]
Definition: pcmem.c:37
if(!(yy_init))
Definition: macro.lex.yy.c:714
static PRSDP_DESCRIPTOR FindAcpiBios(VOID)
Definition: hwacpi.c:29
BIOS_MEMORY_MAP MemoryMap[1]
Definition: pcbios.h:79
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384::@393 DeviceSpecificData
ULONG LowPart
Definition: typedefs.h:106
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
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
#define ERR(fmt,...)
Definition: debug.h:110
ULONG rsdt_physical_address
Definition: winldr.h:26
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4306
unsigned int ULONG
Definition: retypes.h:1
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384 u
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG PcBiosMapCount
Definition: pcmem.c:38

Referenced by Pc98HwDetect(), and PcHwDetect().

◆ DetectApmBios()

VOID DetectApmBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)

Definition at line 46 of file hwapm.c.

47 {
49  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
50  ULONG Size;
51 
52  if (!FindApmBios())
53  return;
54 
55  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
57 
58  /* Set 'Configuration Data' value */
59  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
60  if (PartialResourceList == NULL)
61  {
62  ERR("Failed to allocate resource descriptor\n");
63  return;
64  }
65  RtlZeroMemory(PartialResourceList, Size);
66  PartialResourceList->Version = 0;
67  PartialResourceList->Revision = 0;
68  PartialResourceList->Count = 0;
69 
70  /* FIXME: Add configuration data */
71 
72  /* Create new bus key */
73  FldrCreateComponentKey(SystemKey,
75  MultiFunctionAdapter,
76  0x0,
77  0,
78  0xFFFFFFFF,
79  "APM",
80  PartialResourceList,
81  Size,
82  &BiosKey);
83 
84  /* Increment bus number */
85  (*BusNumber)++;
86 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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
#define ERR(fmt,...)
Definition: debug.h:110
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
static BOOLEAN FindApmBios(VOID)
Definition: hwapm.c:14
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by Pc98HwDetect(), and PcHwDetect().

◆ DetectBiosDisks()

VOID DetectBiosDisks ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
PCONFIGURATION_COMPONENT_DATA  BusKey 
)

Definition at line 344 of file pchw.c.

346 {
347  PCONFIGURATION_COMPONENT_DATA ControllerKey, DiskKey;
348  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
349  PCM_INT13_DRIVE_PARAMETER Int13Drives;
350  GEOMETRY Geometry;
351  UCHAR DiskCount, DriveNumber;
352  USHORT i;
353  ULONG Size;
354 
355  /* The pre-enumeration of the BIOS disks was already done in InitializeBootDevices() */
356  DiskCount = PcBiosDiskCount;
357 
358  /* Use the floppy disk controller as our controller */
359  ControllerKey = DetectBiosFloppyController(BusKey);
360  if (!ControllerKey)
361  {
362  ERR("Failed to detect BIOS disk controller\n");
363  return;
364  }
365 
366  /* Allocate resource descriptor */
367  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
368  sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
369  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
370  if (PartialResourceList == NULL)
371  {
372  ERR("Failed to allocate resource descriptor\n");
373  return;
374  }
375 
376  /* Initialize resource descriptor */
377  memset(PartialResourceList, 0, Size);
378  PartialResourceList->Version = 1;
379  PartialResourceList->Revision = 1;
380  PartialResourceList->Count = 1;
381  PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
382  PartialResourceList->PartialDescriptors[0].ShareDisposition = 0;
383  PartialResourceList->PartialDescriptors[0].Flags = 0;
384  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
385  sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
386 
387  /* Get harddisk Int13 geometry data */
388  Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
389  for (i = 0; i < DiskCount; i++)
390  {
391  DriveNumber = 0x80 + i;
392 
393  if (MachDiskGetDriveGeometry(DriveNumber, &Geometry))
394  {
395  Int13Drives[i].DriveSelect = DriveNumber;
396  Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
397  Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors;
398  Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
399  Int13Drives[i].NumberDrives = DiskCount;
400 
401  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
402  DriveNumber,
403  Geometry.Cylinders - 1,
404  Geometry.Heads - 1,
405  Geometry.Sectors,
406  Geometry.BytesPerSector);
407  }
408  }
409 
410  /* Update the 'System' key's configuration data with BIOS INT13h information */
411  FldrSetConfigurationData(SystemKey, PartialResourceList, Size);
412 
413  /* Create and fill subkey for each harddisk */
414  for (i = 0; i < DiskCount; i++)
415  {
416  PCHAR Identifier;
417 
418  DriveNumber = 0x80 + i;
419 
420  /* Get disk values */
421  PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size);
422  Identifier = GetHarddiskIdentifier(DriveNumber);
423 
424  /* Create disk key */
425  FldrCreateComponentKey(ControllerKey,
427  DiskPeripheral,
428  Output | Input,
429  i,
430  0xFFFFFFFF,
431  Identifier,
432  PartialResourceList,
433  Size,
434  &DiskKey);
435  }
436 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
signed char * PCHAR
Definition: retypes.h:7
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
struct _CM_INT13_DRIVE_PARAMETER CM_INT13_DRIVE_PARAMETER
ULONG Cylinders
Definition: disk.h:26
Definition: arc.h:84
uint32_t ULONG_PTR
Definition: typedefs.h:65
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
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pchw.c:271
UCHAR PcBiosDiskCount
Definition: hwdisk.c:43
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pchw.c:45
#define MachDiskGetDriveGeometry(Drive, Geom)
Definition: machine.h:128
ULONG Sectors
Definition: disk.h:28
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
unsigned char UCHAR
Definition: xmlstorage.h:181
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384::@393 DeviceSpecificData
Definition: arc.h:85
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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
#define ERR(fmt,...)
Definition: debug.h:110
ULONG BytesPerSector
Definition: disk.h:29
unsigned short USHORT
Definition: pedump.c:61
Definition: disk.h:24
unsigned int ULONG
Definition: retypes.h:1
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
Definition: hwdisk.c:249
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384 u
#define memset(x, y, z)
Definition: compat.h:39
VOID NTAPI FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size)
Definition: archwsup.c:78
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26
ULONG Heads
Definition: disk.h:27

Referenced by DetectCBusBios(), and DetectIsaBios().

◆ DetectPciBios()

VOID DetectPciBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)

Definition at line 176 of file hwpci.c.

177 {
178  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
179  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
180  PCI_REGISTRY_INFO BusData;
182  ULONG Size;
184  ULONG i;
185 
186  /* Report the PCI BIOS */
187  if (FindPciBios(&BusData))
188  {
189  /* Set 'Configuration Data' value */
190  Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
191  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
192  if (PartialResourceList == NULL)
193  {
194  ERR("Failed to allocate resource descriptor\n");
195  return;
196  }
197 
198  /* Initialize resource descriptor */
199  memset(PartialResourceList, 0, Size);
200 
201  /* Create new bus key */
202  FldrCreateComponentKey(SystemKey,
203  AdapterClass,
204  MultiFunctionAdapter,
205  0x0,
206  0x0,
207  0xFFFFFFFF,
208  "PCI BIOS",
209  PartialResourceList,
210  Size,
211  &BiosKey);
212 
213  /* Increment bus number */
214  (*BusNumber)++;
215 
216  DetectPciIrqRoutingTable(BiosKey);
217 
218  /* Report PCI buses */
219  for (i = 0; i < (ULONG)BusData.NoBuses; i++)
220  {
221  /* Check if this is the first bus */
222  if (i == 0)
223  {
224  /* Set 'Configuration Data' value */
226  PartialDescriptors) +
228  sizeof(PCI_REGISTRY_INFO);
229  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
230  if (!PartialResourceList)
231  {
232  ERR("Failed to allocate resource descriptor\n");
233  return;
234  }
235 
236  /* Initialize resource descriptor */
237  memset(PartialResourceList, 0, Size);
238  PartialResourceList->Version = 1;
239  PartialResourceList->Revision = 1;
240  PartialResourceList->Count = 1;
241  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
242  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
243  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
244  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(PCI_REGISTRY_INFO);
245  memcpy(&PartialResourceList->PartialDescriptors[1],
246  &BusData,
247  sizeof(PCI_REGISTRY_INFO));
248  }
249  else
250  {
251  /* Set 'Configuration Data' value */
253  PartialDescriptors);
254  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
255  if (!PartialResourceList)
256  {
257  ERR("Failed to allocate resource descriptor\n");
258  return;
259  }
260 
261  /* Initialize resource descriptor */
262  memset(PartialResourceList, 0, Size);
263  }
264 
265  /* Create the bus key */
266  FldrCreateComponentKey(SystemKey,
267  AdapterClass,
268  MultiFunctionAdapter,
269  0x0,
270  0x0,
271  0xFFFFFFFF,
272  "PCI",
273  PartialResourceList,
274  Size,
275  &BusKey);
276 
277  /* Increment bus number */
278  (*BusNumber)++;
279  }
280  }
281 }
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
GLint x0
Definition: linetemp.h:95
struct _PCI_REGISTRY_INFO PCI_REGISTRY_INFO
static VOID DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: hwpci.c:117
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
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
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384::@393 DeviceSpecificData
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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
#define ERR(fmt,...)
Definition: debug.h:110
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
UCHAR NoBuses
Definition: pci.h:109
unsigned int ULONG
Definition: retypes.h:1
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384 u
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by Pc98HwDetect(), PcHwDetect(), and XboxHwDetect().

◆ HalpCalibrateStallExecution()

VOID HalpCalibrateStallExecution ( VOID  )

Definition at line 105 of file pchw.c.

106 {
107  ULONG i;
108  ULONG calib_bit;
109  ULONG CurCount;
110 
111  /* Initialise timer interrupt with MILLISECOND ms interval */
112  WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
113  WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
114  WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
115 
116  /* Stage 1: Coarse calibration */
117 
118  delay_count = 1;
119 
120  do
121  {
122  /* Next delay count to try */
123  delay_count <<= 1;
124 
126 
127  /* Do the delay */
129 
130  CurCount = Read8254Timer();
131  }
132  while (CurCount > LATCH / 2);
133 
134  /* Get bottom value for delay */
135  delay_count >>= 1;
136 
137  /* Stage 2: Fine calibration */
138 
139  /* Which bit are we going to test */
140  calib_bit = delay_count;
141 
142  for (i = 0; i < PRECISION; i++)
143  {
144  /* Next bit to calibrate */
145  calib_bit >>= 1;
146 
147  /* If we have done all bits, stop */
148  if (!calib_bit) break;
149 
150  /* Set the bit in delay_count */
151  delay_count |= calib_bit;
152 
154 
155  /* Do the delay */
157 
158  CurCount = Read8254Timer();
159  /* If a tick has passed, turn the calibrated bit back off */
160  if (CurCount <= LATCH / 2)
161  delay_count &= ~calib_bit;
162  }
163 
164  /* We're finished: Do the finishing touches */
165 
166  /* Calculate delay_count for 1ms */
167  delay_count /= (MILLISEC / 2);
168 }
unsigned char * PUCHAR
Definition: retypes.h:3
static ULONG Read8254Timer(VOID)
Definition: pchw.c:68
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
static VOID WaitFor8254Wraparound(VOID)
Definition: pchw.c:81
#define LATCH
Definition: pchw.c:37
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20
#define PRECISION
Definition: pchw.c:28
#define MILLISEC
Definition: pchw.c:27
static unsigned int delay_count
Definition: pchw.c:39
unsigned int ULONG
Definition: retypes.h:1
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: pchw.c:54

◆ PnpBiosGetDeviceNode()

ULONG __cdecl PnpBiosGetDeviceNode ( UCHAR NodeId,
UCHAR NodeBuffer 
)

Referenced by DetectPnpBios().

◆ PnpBiosGetDeviceNodeCount()

ULONG __cdecl PnpBiosGetDeviceNodeCount ( ULONG NodeSize,
ULONG NodeCount 
)

Referenced by DetectPnpBios().

◆ PnpBiosSupported()

ULONG_PTR __cdecl PnpBiosSupported ( VOID  )

Referenced by DetectPnpBios().

◆ PxeCallApi()

USHORT __cdecl PxeCallApi ( USHORT  Segment,
USHORT  Offset,
USHORT  Service,
VOID Parameter 
)

◆ StallExecutionProcessor()

VOID StallExecutionProcessor ( ULONG  Microseconds)

Definition at line 60 of file pchw.c.

61 {
62  ULONGLONG LoopCount = ((ULONGLONG)delay_count * (ULONGLONG)Microseconds) / 1000ULL;
63  __StallExecutionProcessor((ULONG)LoopCount);
64 }
#define ULL(a, b)
Definition: format_msg.c:27
uint64_t ULONGLONG
Definition: typedefs.h:67
static unsigned int delay_count
Definition: pchw.c:39
unsigned int ULONG
Definition: retypes.h:1
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: pchw.c:54

Variable Documentation

◆ FindPciBios

FIND_PCI_BIOS FindPciBios

Definition at line 26 of file hwpci.c.

Referenced by DetectPciBios(), Pc98HwDetect(), PcHwDetect(), and XboxHwDetect().

◆ GetHarddiskConfigurationData

GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData

Definition at line 45 of file pchw.c.

Referenced by DetectBiosDisks(), Pc98HwDetect(), PcHwDetect(), and XboxHwDetect().