ReactOS  0.4.15-dev-3439-g2693a26
hardware.h File Reference

Go to the source code of this file.

Classes

struct  _PCI_TYPE1_CFG_BITS
 

Macros

#define TAG_HW_RESOURCE_LIST   'lRwH'
 
#define TAG_HW_DISK_CONTEXT   'cDwH'
 
#define PCI_TYPE1_ADDRESS_PORT   (PULONG)0xCF8
 
#define PCI_TYPE1_DATA_PORT   0xCFC
 

Typedefs

typedef struct _PCI_TYPE1_CFG_BITS PCI_TYPE1_CFG_BITS
 
typedef struct _PCI_TYPE1_CFG_BITSPPCI_TYPE1_CFG_BITS
 
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

◆ PCI_TYPE1_ADDRESS_PORT

#define PCI_TYPE1_ADDRESS_PORT   (PULONG)0xCF8

Definition at line 33 of file hardware.h.

◆ PCI_TYPE1_DATA_PORT

#define PCI_TYPE1_DATA_PORT   0xCFC

Definition at line 34 of file hardware.h.

◆ TAG_HW_DISK_CONTEXT

#define TAG_HW_DISK_CONTEXT   'cDwH'

Definition at line 24 of file hardware.h.

◆ TAG_HW_RESOURCE_LIST

#define TAG_HW_RESOURCE_LIST   'lRwH'

Definition at line 23 of file hardware.h.

Typedef Documentation

◆ FIND_PCI_BIOS

typedef BOOLEAN(* FIND_PCI_BIOS) (PPCI_REGISTRY_INFO BusData)

Definition at line 63 of file hardware.h.

◆ GET_HARDDISK_CONFIG_DATA

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

Definition at line 57 of file hardware.h.

◆ GET_SERIAL_PORT

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

Definition at line 69 of file hardware.h.

◆ PCI_TYPE1_CFG_BITS

◆ PPCI_TYPE1_CFG_BITS

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  if (PartialResourceList == NULL)
79  {
80  ERR("Failed to allocate resource descriptor\n");
81  return;
82  }
83 
84  RtlZeroMemory(PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
85  PartialResourceList->Version = 0;
86  PartialResourceList->Revision = 0;
87  PartialResourceList->Count = 1;
88 
89  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
90  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
91  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
92  PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize;
93 
94  /* Fill the table */
95  AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
96 
97  if (Rsdp->revision > 0)
98  {
99  TRACE("ACPI >1.0, using XSDT address\n");
100  AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
101  }
102  else
103  {
104  TRACE("ACPI 1.0, using RSDT address\n");
105  AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
106  }
107 
108  AcpiBiosData->Count = PcBiosMapCount;
109  memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap,
110  PcBiosMapCount * sizeof(BIOS_MEMORY_MAP));
111 
112  TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
113  TableSize);
114 
115  /* Create new bus key */
116  FldrCreateComponentKey(SystemKey,
117  AdapterClass,
118  MultiFunctionAdapter,
119  0x0,
120  0x0,
121  0xFFFFFFFF,
122  "ACPI BIOS",
123  PartialResourceList,
125  &BiosKey);
126 
127  /* Increment bus number */
128  (*BusNumber)++;
129  }
130 }
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
if(dx==0 &&dy==0)
Definition: linetemp.h:174
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
ULONGLONG Count
Definition: pcbios.h:78
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
BIOS_MEMORY_MAP PcBiosMemoryMap[MAX_BIOS_DESCRIPTORS]
Definition: pcmem.c:37
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
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
#define NULL
Definition: types.h:112
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4327
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23
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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
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 NULL
Definition: types.h:112
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:23

Referenced by Pc98HwDetect(), and PcHwDetect().

◆ DetectBiosDisks()

VOID DetectBiosDisks ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
PCONFIGURATION_COMPONENT_DATA  BusKey 
)

Definition at line 345 of file pchw.c.

347 {
348  PCONFIGURATION_COMPONENT_DATA ControllerKey, DiskKey;
349  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
350  PCM_INT13_DRIVE_PARAMETER Int13Drives;
351  GEOMETRY Geometry;
352  UCHAR DiskCount, DriveNumber;
353  USHORT i;
354  ULONG Size;
355 
356  /* The pre-enumeration of the BIOS disks was already done in InitializeBootDevices() */
357  DiskCount = PcBiosDiskCount;
358 
359  /* Use the floppy disk controller as our controller */
360  ControllerKey = DetectBiosFloppyController(BusKey);
361  if (!ControllerKey)
362  {
363  ERR("Failed to detect BIOS disk controller\n");
364  return;
365  }
366 
367  /* Allocate resource descriptor */
368  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
369  sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
370  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
371  if (PartialResourceList == NULL)
372  {
373  ERR("Failed to allocate resource descriptor\n");
374  return;
375  }
376 
377  /* Initialize resource descriptor */
378  RtlZeroMemory(PartialResourceList, Size);
379  PartialResourceList->Version = 1;
380  PartialResourceList->Revision = 1;
381  PartialResourceList->Count = 1;
382  PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
383  PartialResourceList->PartialDescriptors[0].ShareDisposition = 0;
384  PartialResourceList->PartialDescriptors[0].Flags = 0;
385  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
386  sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
387 
388  /* Get harddisk Int13 geometry data */
389  Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
390  for (i = 0; i < DiskCount; i++)
391  {
392  DriveNumber = 0x80 + i;
393 
394  if (MachDiskGetDriveGeometry(DriveNumber, &Geometry))
395  {
396  Int13Drives[i].DriveSelect = DriveNumber;
397  Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
398  Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors;
399  Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
400  Int13Drives[i].NumberDrives = DiskCount;
401 
402  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
403  DriveNumber,
404  Geometry.Cylinders - 1,
405  Geometry.Heads - 1,
406  Geometry.Sectors,
407  Geometry.BytesPerSector);
408  }
409  }
410 
411  /* Update the 'System' key's configuration data with BIOS INT13h information */
412  FldrSetConfigurationData(SystemKey, PartialResourceList, Size);
413 
414  /* Create and fill subkey for each harddisk */
415  for (i = 0; i < DiskCount; i++)
416  {
417  PCHAR Identifier;
418 
419  DriveNumber = 0x80 + i;
420 
421  /* Get disk values */
422  PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size);
423  Identifier = GetHarddiskIdentifier(DriveNumber);
424 
425  /* Create disk key */
426  FldrCreateComponentKey(ControllerKey,
428  DiskPeripheral,
429  Output | Input,
430  i,
431  0xFFFFFFFF,
432  Identifier,
433  PartialResourceList,
434  Size,
435  &DiskKey);
436  }
437 }
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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pchw.c:272
UCHAR PcBiosDiskCount
Definition: hwdisk.c:43
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:174
unsigned char UCHAR
Definition: xmlstorage.h:181
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
Definition: arc.h:85
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
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
unsigned short USHORT
Definition: pedump.c:61
Definition: disk.h:24
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
Definition: hwdisk.c:249
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:23
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  RtlZeroMemory(PartialResourceList, 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! Ignoring remaining PCI buses. (i = %lu, NoBuses = %lu)\n",
233  i, (ULONG)BusData.NoBuses);
234  return;
235  }
236 
237  /* Initialize resource descriptor */
238  RtlZeroMemory(PartialResourceList, Size);
239  PartialResourceList->Version = 1;
240  PartialResourceList->Revision = 1;
241  PartialResourceList->Count = 1;
242  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
243  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
244  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
245  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(PCI_REGISTRY_INFO);
246  memcpy(&PartialResourceList->PartialDescriptors[1],
247  &BusData,
248  sizeof(PCI_REGISTRY_INFO));
249  }
250  else
251  {
252  /* Set 'Configuration Data' value */
254  PartialDescriptors);
255  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
256  if (!PartialResourceList)
257  {
258  ERR("Failed to allocate resource descriptor! Ignoring remaining PCI buses. (i = %lu, NoBuses = %lu)\n",
259  i, (ULONG)BusData.NoBuses);
260  return;
261  }
262 
263  /* Initialize resource descriptor */
264  RtlZeroMemory(PartialResourceList, Size);
265  }
266 
267  /* Create the bus key */
268  FldrCreateComponentKey(SystemKey,
269  AdapterClass,
270  MultiFunctionAdapter,
271  0x0,
272  0x0,
273  0xFFFFFFFF,
274  "PCI",
275  PartialResourceList,
276  Size,
277  &BusKey);
278 
279  /* Increment bus number */
280  (*BusNumber)++;
281  }
282  }
283 }
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
GLint x0
Definition: linetemp.h:95
struct _PCI_REGISTRY_INFO PCI_REGISTRY_INFO
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
static VOID DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: hwpci.c:117
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#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
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
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112
UCHAR NoBuses
Definition: pci.h:109
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

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
static VOID WaitFor8254Wraparound(VOID)
Definition: pchw.c:81
#define LATCH
Definition: pchw.c:37
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define PRECISION
Definition: pchw.c:28
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
#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)

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().