ReactOS  0.4.15-dev-3446-g30010a5
pc98hw.c File Reference
#include <freeldr.h>
#include <cportlib/cportlib.h>
#include <drivers/pc98/pit.h>
#include <drivers/pc98/fdc.h>
#include <debug.h>
Include dependency graph for pc98hw.c:

Go to the source code of this file.

Macros

#define MILLISEC   10
 
#define PRECISION   8
 
#define HZ   100
 

Functions

 DBG_DEFAULT_CHANNEL (HWDETECT)
 
PCHAR GetHarddiskIdentifier (UCHAR DriveNumber)
 
static VOID __StallExecutionProcessor (ULONG Loops)
 
VOID StallExecutionProcessor (ULONG Microseconds)
 
static VOID WaitFor8253Wraparound (VOID)
 
VOID HalpCalibrateStallExecution (VOID)
 
static UCHAR GetFloppyType (UCHAR FloppyNumber)
 
static VOID DetectBiosFloppyPeripheral (PCONFIGURATION_COMPONENT_DATA ControllerKey)
 
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static PCM_PARTIAL_RESOURCE_LIST Pc98GetHarddiskConfigurationData (UCHAR DriveNumber, ULONG *pSize)
 
VOID DetectBiosDisks (PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID DetectPointerPeripheral (PCONFIGURATION_COMPONENT_DATA ControllerKey)
 
static VOID DetectPointerController (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID DetectKeyboardPeripheral (PCONFIGURATION_COMPONENT_DATA ControllerKey)
 
static VOID DetectKeyboardController (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID DetectParallelPorts (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID DetectSerialPorts (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID DetectCBusBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
static VOID DetectNesaBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
static VOID DetectPnpBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
PCONFIGURATION_COMPONENT_DATA Pc98HwDetect (VOID)
 
UCHAR Pc98GetFloppyCount (VOID)
 
VOID __cdecl DiskStopFloppyMotor (VOID)
 
VOID FrLdrCheckCpuCompatibility (VOID)
 

Variables

UCHAR PcBiosDiskCount
 
BOOLEAN HiResoMachine
 
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData = NULL
 
static unsigned int delay_count = 1
 

Macro Definition Documentation

◆ HZ

#define HZ   100

Definition at line 29 of file pc98hw.c.

◆ MILLISEC

#define MILLISEC   10

Definition at line 27 of file pc98hw.c.

◆ PRECISION

#define PRECISION   8

Definition at line 28 of file pc98hw.c.

Function Documentation

◆ __StallExecutionProcessor()

static VOID __StallExecutionProcessor ( ULONG  Loops)
static

Definition at line 39 of file pc98hw.c.

40 {
41  register volatile unsigned int i;
42  for (i = 0; i < Loops; i++);
43 }
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

Referenced by HalpCalibrateStallExecution(), and StallExecutionProcessor().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectBiosDisks()

VOID DetectBiosDisks ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
PCONFIGURATION_COMPONENT_DATA  BusKey 
)

Definition at line 375 of file pc98hw.c.

378 {
379  PCONFIGURATION_COMPONENT_DATA ControllerKey, DiskKey;
380  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
381  PCM_INT13_DRIVE_PARAMETER Int13Drives;
382  GEOMETRY Geometry;
383  UCHAR DiskCount, DriveNumber;
384  USHORT i;
385  ULONG Size;
386 
387  /* The pre-enumeration of the BIOS disks was already done in InitializeBootDevices() */
388  DiskCount = PcBiosDiskCount;
389 
390  /* Use the floppy disk controller as our controller */
391  ControllerKey = DetectBiosFloppyController(BusKey);
392  if (!ControllerKey)
393  {
394  ERR("Failed to detect BIOS disk controller\n");
395  return;
396  }
397 
398  /* Set 'Configuration Data' value */
399  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
400  sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
401  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
402  if (PartialResourceList == NULL)
403  {
404  ERR("Failed to allocate resource descriptor\n");
405  return;
406  }
407  RtlZeroMemory(PartialResourceList, Size);
408  PartialResourceList->Version = 1;
409  PartialResourceList->Revision = 1;
410  PartialResourceList->Count = 1;
411 
412  PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
413  PartialResourceList->PartialDescriptors[0].ShareDisposition = 0;
414  PartialResourceList->PartialDescriptors[0].Flags = 0;
415  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
416  sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
417 
418  /* Get hard disk Int13 geometry data */
419  Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
420  for (i = 0; i < DiskCount; i++)
421  {
422  DriveNumber = 0x80 + i;
423 
424  if (Pc98DiskGetDriveGeometry(DriveNumber, &Geometry))
425  {
426  Int13Drives[i].DriveSelect = DriveNumber;
427  Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
428  Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors;
429  Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
430  Int13Drives[i].NumberDrives = DiskCount;
431 
432  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
433  DriveNumber,
434  Geometry.Cylinders - 1,
435  Geometry.Heads - 1,
436  Geometry.Sectors,
437  Geometry.BytesPerSector);
438  }
439  }
440 
441  /* Update the 'System' key's configuration data with BIOS INT13h information */
442  FldrSetConfigurationData(SystemKey, PartialResourceList, Size);
443 
444  /* Create and fill subkey for each harddisk */
445  for (i = 0; i < DiskCount; i++)
446  {
447  PCHAR Identifier;
448 
449  DriveNumber = 0x80 + i;
450 
451  /* Get disk values */
452  PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size);
453  Identifier = GetHarddiskIdentifier(DriveNumber);
454 
455  /* Create disk key */
456  FldrCreateComponentKey(ControllerKey,
458  DiskPeripheral,
459  Output | Input,
460  i,
461  0xFFFFFFFF,
462  Identifier,
463  PartialResourceList,
464  Size,
465  &DiskKey);
466  TRACE("Created key: DiskPeripheral\\%d\n", i);
467  }
468 }
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
static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:228
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
UCHAR PcBiosDiskCount
Definition: hwdisk.c:43
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pc98hw.c:23
void * PVOID
Definition: retypes.h:9
BOOLEAN Pc98DiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pc98disk.c:870
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
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
Definition: hwdisk.c:249
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
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().

◆ DetectBiosFloppyController()

static PCONFIGURATION_COMPONENT_DATA DetectBiosFloppyController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 228 of file pc98hw.c.

229 {
230  PCONFIGURATION_COMPONENT_DATA ControllerKey;
231  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
232  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
233  ULONG Size;
234  ULONG FloppyCount;
235  UCHAR i;
236  UCHAR Index = 0;
237 
238  FloppyCount = Pc98GetFloppyCount();
239 
240  /* Always create a BIOS disk controller, no matter if we have floppy drives or not */
241  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
242  6 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
243  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
244  if (PartialResourceList == NULL)
245  {
246  ERR("Failed to allocate resource descriptor\n");
247  return NULL;
248  }
249  RtlZeroMemory(PartialResourceList, Size);
250  PartialResourceList->Version = 1;
251  PartialResourceList->Revision = 1;
252  PartialResourceList->Count = 7;
253 
254  /* Set I/O ports */
255  for (i = 0; i < 3; i++)
256  {
257  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
258  PartialDescriptor->Type = CmResourceTypePort;
260  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
261  PartialDescriptor->u.Port.Start.LowPart = 0x90 + i * 2;
262  PartialDescriptor->u.Port.Start.HighPart = 0;
263  PartialDescriptor->u.Port.Length = 1;
264  }
265  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
266  PartialDescriptor->Type = CmResourceTypePort;
268  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
269  PartialDescriptor->u.Port.Start.LowPart = 0xBE;
270  PartialDescriptor->u.Port.Start.HighPart = 0;
271  PartialDescriptor->u.Port.Length = 1;
272 
273  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
274  PartialDescriptor->Type = CmResourceTypePort;
276  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
277  PartialDescriptor->u.Port.Start.LowPart = 0x4BE;
278  PartialDescriptor->u.Port.Start.HighPart = 0;
279  PartialDescriptor->u.Port.Length = 1;
280 
281  /* Set Interrupt */
282  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
283  PartialDescriptor->Type = CmResourceTypeInterrupt;
284  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
285  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
286  PartialDescriptor->u.Interrupt.Level = 11;
287  PartialDescriptor->u.Interrupt.Vector = 11;
288  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
289 
290  /* Set DMA channel */
291  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
292  PartialDescriptor->Type = CmResourceTypeDma;
293  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
294  PartialDescriptor->Flags = 0;
295  PartialDescriptor->u.Dma.Channel = 2;
296  PartialDescriptor->u.Dma.Port = 0;
297 
298  /* Create floppy disk controller */
299  FldrCreateComponentKey(BusKey,
302  Output | Input,
303  0,
304  0xFFFFFFFF,
305  NULL,
306  PartialResourceList,
307  Size,
308  &ControllerKey);
309  TRACE("Created key: DiskController\\0\n");
310 
311  if (FloppyCount)
312  DetectBiosFloppyPeripheral(ControllerKey);
313 
314  return ControllerKey;
315 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
Definition: arc.h:84
UCHAR Pc98GetFloppyCount(VOID)
Definition: pc98hw.c:1224
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define CmResourceTypePort
Definition: hwresource.cpp:123
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@382 Dma
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
_In_ WDFCOLLECTION _In_ ULONG Index
static VOID DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:150
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
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@378 Port
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 CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@379 Interrupt
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23
#define CmResourceTypeDma
Definition: hwresource.cpp:126

Referenced by DetectBiosDisks().

◆ DetectBiosFloppyPeripheral()

static VOID DetectBiosFloppyPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey)
static

Definition at line 150 of file pc98hw.c.

151 {
152  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
153  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
154  PCM_FLOPPY_DEVICE_DATA FloppyData;
155  CHAR Identifier[20];
156  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
157  ULONG Size;
158  UCHAR FloppyNumber;
159  UCHAR FloppyType;
160  ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880};
161 
162  for (FloppyNumber = 0; FloppyNumber < Pc98GetFloppyCount(); FloppyNumber++)
163  {
164  FloppyType = GetFloppyType(FloppyNumber);
165 
166  if ((FloppyType > 5) || (FloppyType == 0))
167  continue;
168 
169  /* TODO: Properly detect */
170 
171  RtlStringCbPrintfA(Identifier, sizeof(Identifier), "FLOPPY%d", FloppyNumber + 1);
172 
173  /* Set 'Configuration Data' value */
174  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
175  sizeof(CM_FLOPPY_DEVICE_DATA);
176  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
177  if (PartialResourceList == NULL)
178  {
179  ERR("Failed to allocate resource descriptor! Ignoring remaining floppy peripherals. (FloppyNumber = %u, FloppyCount = %u)\n",
180  FloppyNumber, Pc98GetFloppyCount());
181  return;
182  }
183  RtlZeroMemory(PartialResourceList, Size);
184  PartialResourceList->Version = 1;
185  PartialResourceList->Revision = 1;
186  PartialResourceList->Count = 1;
187 
188  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
189  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
190  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
191  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_FLOPPY_DEVICE_DATA);
192 
193  /* FIXME: Don't use default parameters for 1.44 MB floppy */
194  FloppyData = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
195  FloppyData->Version = 2;
196  FloppyData->Revision = 0;
197  FloppyData->MaxDensity = MaxDensity[FloppyType];
198  FloppyData->MountDensity = 0;
199  FloppyData->StepRateHeadUnloadTime = 175;
200  FloppyData->HeadLoadTime = 2;
201  FloppyData->MotorOffTime = 37;
202  FloppyData->SectorLengthCode = 2;
203  FloppyData->SectorPerTrack = 18;
204  FloppyData->ReadWriteGapLength = 27;
205  FloppyData->DataTransferLength = 255;
206  FloppyData->FormatGapLength = 108;
207  FloppyData->FormatFillCharacter = 0xF6;
208  FloppyData->HeadSettleTime = 15;
209  FloppyData->MotorSettleTime = 8;
210  FloppyData->MaximumTrackValue = (FloppyType == 1) ? 39 : 79;
211  FloppyData->DataTransferRate = 0;
212 
213  FldrCreateComponentKey(ControllerKey,
215  FloppyDiskPeripheral,
216  Input | Output,
217  FloppyNumber,
218  0xFFFFFFFF,
219  Identifier,
220  PartialResourceList,
221  Size,
222  &PeripheralKey);
223  TRACE("Created key: FloppyDiskPeripheral\\%d\n", FloppyNumber);
224  }
225 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
char CHAR
Definition: xmlstorage.h:175
Definition: arc.h:84
UCHAR Pc98GetFloppyCount(VOID)
Definition: pc98hw.c:1224
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 UCHAR GetFloppyType(UCHAR FloppyNumber)
Definition: pc98hw.c:143
void * PVOID
Definition: retypes.h:9
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
#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
UCHAR StepRateHeadUnloadTime
Definition: cmtypes.h:489
struct _CM_FLOPPY_DEVICE_DATA CM_FLOPPY_DEVICE_DATA
#define NULL
Definition: types.h:112
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 DetectBiosFloppyController().

◆ DetectCBusBios()

static VOID DetectCBusBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 973 of file pc98hw.c.

974 {
975  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
977  ULONG Size;
978 
979  /* Set 'Configuration Data' value */
980  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
982  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
983  if (PartialResourceList == NULL)
984  {
985  ERR("Failed to allocate resource descriptor\n");
986  return;
987  }
988  RtlZeroMemory(PartialResourceList, Size);
989  PartialResourceList->Version = 1;
990  PartialResourceList->Revision = 1;
991  PartialResourceList->Count = 0;
992 
993  /* Create bus key */
994  FldrCreateComponentKey(SystemKey,
995  AdapterClass,
996  MultiFunctionAdapter,
997  0x0,
998  0,
999  0xFFFFFFFF,
1000  "ISA",
1001  PartialResourceList,
1002  Size,
1003  &BusKey);
1004 
1005  /* Increment bus number */
1006  (*BusNumber)++;
1007 
1008  /* Detect C-bus/BIOS devices */
1009  DetectBiosDisks(SystemKey, BusKey);
1010  DetectSerialPorts(BusKey);
1011  DetectParallelPorts(BusKey);
1012  DetectKeyboardController(BusKey);
1013  DetectPointerController(BusKey);
1014 
1015  /* FIXME: Detect more C-bus devices */
1016 }
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
static VOID DetectPointerController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:508
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:375
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
static VOID DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:660
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
static VOID DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:723
#define NULL
Definition: types.h:112
static VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pc98hw.c:808
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().

◆ DetectKeyboardController()

static VOID DetectKeyboardController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 660 of file pc98hw.c.

661 {
662  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
663  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
664  PCONFIGURATION_COMPONENT_DATA ControllerKey;
665  ULONG Size;
666  UCHAR i;
667 
668  if (!CpDoesPortExist((PUCHAR)0x41))
669  return;
670 
671  /* Set 'Configuration Data' value */
672  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
673  2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
674  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
675  if (PartialResourceList == NULL)
676  {
677  ERR("Failed to allocate resource descriptor\n");
678  return;
679  }
680  RtlZeroMemory(PartialResourceList, Size);
681  PartialResourceList->Version = 1;
682  PartialResourceList->Revision = 1;
683  PartialResourceList->Count = 3;
684 
685  /* Set I/O ports */
686  for (i = 0; i < 2; i++)
687  {
688  PartialDescriptor = &PartialResourceList->PartialDescriptors[i];
689  PartialDescriptor->Type = CmResourceTypePort;
691  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
692  PartialDescriptor->u.Port.Start.LowPart = 0x41 + i * 2;
693  PartialDescriptor->u.Port.Start.HighPart = 0;
694  PartialDescriptor->u.Port.Length = 1;
695  }
696 
697  /* Set Interrupt */
698  PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
699  PartialDescriptor->Type = CmResourceTypeInterrupt;
700  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
701  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
702  PartialDescriptor->u.Interrupt.Level = 1;
703  PartialDescriptor->u.Interrupt.Vector = 1;
704  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
705 
706  /* Create controller key */
707  FldrCreateComponentKey(BusKey,
709  KeyboardController,
710  Input | ConsoleIn,
711  0,
712  0xFFFFFFFF,
713  NULL,
714  PartialResourceList,
715  Size,
716  &ControllerKey);
717  TRACE("Created key: KeyboardController\\0\n");
718 
719  DetectKeyboardPeripheral(ControllerKey);
720 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
unsigned char * PUCHAR
Definition: retypes.h:3
Definition: arc.h:82
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define CmResourceTypePort
Definition: hwresource.cpp:123
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:227
#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
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
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@378 Port
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 DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:586
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@379 Interrupt
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

Referenced by DetectCBusBios().

◆ DetectKeyboardPeripheral()

static VOID DetectKeyboardPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey)
static

Definition at line 586 of file pc98hw.c.

587 {
588  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
589  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
590  PCM_KEYBOARD_DEVICE_DATA KeyboardData;
591  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
592  CHAR Identifier[80];
593  ULONG Size;
594  REGS Regs;
595  UCHAR KeyboardType = ((*(PUCHAR)MEM_KEYB_TYPE & 0x40) >> 5) |
596  ((*(PUCHAR)MEM_KEYB_TYPE & 0x08) >> 3);
597 
598  /* TODO: Properly detect */
599 
600  /* Set 'Configuration Data' value */
601  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
602  sizeof(CM_KEYBOARD_DEVICE_DATA);
603  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
604  if (PartialResourceList == NULL)
605  {
606  ERR("Failed to allocate resource descriptor\n");
607  return;
608  }
609  RtlZeroMemory(PartialResourceList, Size);
610  PartialResourceList->Version = 1;
611  PartialResourceList->Revision = 1;
612  PartialResourceList->Count = 1;
613 
614  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
615  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
616  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
617  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
618 
619  /* Int 18h AH=02h
620  * KEYBOARD - GET SHIFT FLAGS
621  *
622  * Return:
623  * AL - shift flags
624  */
625  Regs.b.ah = 0x02;
626  Int386(0x18, &Regs, &Regs);
627 
628  KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
629  KeyboardData->Version = 1;
630  KeyboardData->Revision = 1;
631  KeyboardData->Type = 7;
632  KeyboardData->Subtype = 1;
633  KeyboardData->KeyboardFlags = (Regs.b.al & 0x08) |
634  ((Regs.b.al & 0x02) << 6) |
635  ((Regs.b.al & 0x10) << 2) |
636  ((Regs.b.al & 0x01) << 1);
637 
638  if (KeyboardType == 0)
639  RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PC98_NmodeKEY");
640  else if (KeyboardType == 2)
641  RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PC98_106KEY");
642  else
643  RtlStringCbPrintfA(Identifier, sizeof(Identifier), "PC98_LaptopKEY");
644 
645  /* Create controller key */
646  FldrCreateComponentKey(ControllerKey,
648  KeyboardPeripheral,
649  Input | ConsoleIn,
650  0,
651  0xFFFFFFFF,
652  Identifier,
653  PartialResourceList,
654  Size,
655  &PeripheralKey);
656  TRACE("Created key: KeyboardPeripheral\\0\n");
657 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
unsigned char * PUCHAR
Definition: retypes.h:3
Definition: arc.h:82
char CHAR
Definition: xmlstorage.h:175
Definition: arc.h:84
unsigned char ah
Definition: pcbios.h:126
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define MEM_KEYB_TYPE
Definition: machpc98.h:27
int __cdecl Int386(int ivec, REGS *in, REGS *out)
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
#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
BYTEREGS b
Definition: pcbios.h:157
unsigned char al
Definition: pcbios.h:125
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
struct _CM_KEYBOARD_DEVICE_DATA CM_KEYBOARD_DEVICE_DATA
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
Definition: pcbios.h:152
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
struct _CM_KEYBOARD_DEVICE_DATA * PCM_KEYBOARD_DEVICE_DATA
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

Referenced by DetectKeyboardController().

◆ DetectNesaBios()

static VOID DetectNesaBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 1019 of file pc98hw.c.

1020 {
1021  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1023  ULONG Size;
1024 
1025  if (!((*(PUCHAR)MEM_BIOS_FLAG5) & NESA_BUS_FLAG))
1026  return;
1027 
1028  /* Set 'Configuration Data' value */
1029  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
1031  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1032  if (PartialResourceList == NULL)
1033  {
1034  ERR("Failed to allocate resource descriptor\n");
1035  return;
1036  }
1037  RtlZeroMemory(PartialResourceList, Size);
1038  PartialResourceList->Version = 1;
1039  PartialResourceList->Revision = 1;
1040  PartialResourceList->Count = 0;
1041 
1042  /* Create bus key */
1043  FldrCreateComponentKey(SystemKey,
1044  AdapterClass,
1045  MultiFunctionAdapter,
1046  0x0,
1047  0,
1048  0xFFFFFFFF,
1049  "EISA",
1050  PartialResourceList,
1051  Size,
1052  &BusKey);
1053 
1054  /* Increment bus number */
1055  (*BusNumber)++;
1056 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
unsigned char * PUCHAR
Definition: retypes.h:3
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define MEM_BIOS_FLAG5
Definition: machpc98.h:21
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
#define NESA_BUS_FLAG
Definition: machpc98.h:22
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

Referenced by Pc98HwDetect().

◆ DetectParallelPorts()

static VOID DetectParallelPorts ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 723 of file pc98hw.c.

724 {
725  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
726  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
727  PCONFIGURATION_COMPONENT_DATA ControllerKey;
728  ULONG Size;
729  UCHAR i;
730  UCHAR Index = 0;
731 
732  /* TODO: Properly detect */
733 
734  /* Set 'Configuration Data' value */
735  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
736  7 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
737  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
738  if (PartialResourceList == NULL)
739  {
740  ERR("Failed to allocate resource descriptor\n");
741  return;
742  }
743  RtlZeroMemory(PartialResourceList, Size);
744  PartialResourceList->Version = 1;
745  PartialResourceList->Revision = 1;
746  PartialResourceList->Count = 8;
747 
748  /* Set I/O ports */
749  for (i = 0; i < 4; i++)
750  {
751  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
752  PartialDescriptor->Type = CmResourceTypePort;
754  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
755  PartialDescriptor->u.Port.Start.LowPart = 0x40 + i * 2;
756  PartialDescriptor->u.Port.Start.HighPart = 0;
757  PartialDescriptor->u.Port.Length = 3;
758  }
759 
760  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
761  PartialDescriptor->Type = CmResourceTypePort;
763  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
764  PartialDescriptor->u.Port.Start.LowPart = 0x140;
765  PartialDescriptor->u.Port.Start.HighPart = 0;
766  PartialDescriptor->u.Port.Length = 3;
767 
768  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
769  PartialDescriptor->Type = CmResourceTypePort;
771  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
772  PartialDescriptor->u.Port.Start.LowPart = 0x149;
773  PartialDescriptor->u.Port.Start.HighPart = 0;
774  PartialDescriptor->u.Port.Length = 1;
775 
776  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
777  PartialDescriptor->Type = CmResourceTypePort;
779  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
780  PartialDescriptor->u.Port.Start.LowPart = 0x14B;
781  PartialDescriptor->u.Port.Start.HighPart = 0;
782  PartialDescriptor->u.Port.Length = 4;
783 
784  /* Set Interrupt */
785  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
786  PartialDescriptor->Type = CmResourceTypeInterrupt;
787  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
788  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
789  PartialDescriptor->u.Interrupt.Level = 14;
790  PartialDescriptor->u.Interrupt.Vector = 14;
791  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
792 
793  /* Create controller key */
794  FldrCreateComponentKey(BusKey,
796  ParallelController,
797  Output,
798  0,
799  0xFFFFFFFF,
800  "PARALLEL1",
801  PartialResourceList,
802  Size,
803  &ControllerKey);
804  TRACE("Created key: ParallelController\\0\n");
805 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define CmResourceTypePort
Definition: hwresource.cpp:123
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
_In_ WDFCOLLECTION _In_ ULONG Index
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
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@378 Port
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 CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@379 Interrupt
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

Referenced by DetectCBusBios().

◆ DetectPnpBios()

static VOID DetectPnpBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 1060 of file pc98hw.c.

1061 {
1062  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
1066  ULONG x;
1067  ULONG NodeSize = 0;
1068  ULONG NodeCount = 0;
1069  UCHAR NodeNumber;
1070  ULONG FoundNodeCount;
1071  int i;
1072  ULONG PnpBufferSize;
1073  ULONG PnpBufferSizeLimit;
1074  ULONG Size;
1075  char *Ptr;
1076 
1078  if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
1079  {
1080  TRACE("PnP-BIOS not supported\n");
1081  return;
1082  }
1083 
1084  TRACE("PnP-BIOS supported\n");
1085  TRACE("Signature '%c%c%c%c'\n",
1086  InstData->Signature[0], InstData->Signature[1],
1087  InstData->Signature[2], InstData->Signature[3]);
1088 
1089  x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
1090  if (x == 0x82)
1091  {
1092  TRACE("PnP-BIOS function 'Get Number of System Device Nodes' not supported\n");
1093  return;
1094  }
1095 
1096  NodeCount &= 0xFF; // needed since some fscked up BIOSes return
1097  // wrong info (e.g. Mac Virtual PC)
1098  // e.g. look: http://my.execpc.com/~geezer/osd/pnp/pnp16.c
1099  if (x != 0 || NodeSize == 0 || NodeCount == 0)
1100  {
1101  ERR("PnP-BIOS failed to enumerate device nodes\n");
1102  return;
1103  }
1104  TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
1105  TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
1106 
1107  /* Set 'Configuration Data' value */
1108  PnpBufferSizeLimit = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)
1109  + (NodeSize * NodeCount);
1110  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSizeLimit;
1111  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
1112  if (PartialResourceList == NULL)
1113  {
1114  ERR("Failed to allocate resource descriptor\n");
1115  return;
1116  }
1117 
1118  /* Initialize resource descriptor */
1119  RtlZeroMemory(PartialResourceList, Size);
1120  PartialResourceList->Version = 1;
1121  PartialResourceList->Revision = 1;
1122  PartialResourceList->Count = 1;
1123  PartialResourceList->PartialDescriptors[0].Type =
1125  PartialResourceList->PartialDescriptors[0].ShareDisposition =
1127 
1128  /* The buffer starts after PartialResourceList->PartialDescriptors[0] */
1129  Ptr = (char *)(PartialResourceList + 1);
1130 
1131  /* Set installation check data */
1132  RtlCopyMemory(Ptr, InstData, sizeof(CM_PNP_BIOS_INSTALLATION_CHECK));
1134  PnpBufferSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK);
1135 
1136  /* Copy device nodes */
1137  FoundNodeCount = 0;
1138  for (i = 0; i < 0xFF; i++)
1139  {
1140  NodeNumber = (UCHAR)i;
1141 
1143  if (x == 0)
1144  {
1146 
1147  TRACE("Node: %u Size %u (0x%x)\n",
1148  DeviceNode->Node,
1149  DeviceNode->Size,
1150  DeviceNode->Size);
1151 
1152  if (PnpBufferSize + DeviceNode->Size > PnpBufferSizeLimit)
1153  {
1154  ERR("Buffer too small! Ignoring remaining device nodes. (i = %d)\n", i);
1155  break;
1156  }
1157 
1159 
1160  Ptr += DeviceNode->Size;
1161  PnpBufferSize += DeviceNode->Size;
1162 
1163  FoundNodeCount++;
1164  if (FoundNodeCount >= NodeCount)
1165  break;
1166  }
1167  }
1168 
1169  /* Set real data size */
1170  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
1171  PnpBufferSize;
1172  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
1173 
1174  TRACE("Real buffer size: %u\n", PnpBufferSize);
1175  TRACE("Resource size: %u\n", Size);
1176 
1177  /* Create component key */
1178  FldrCreateComponentKey(SystemKey,
1179  AdapterClass,
1180  MultiFunctionAdapter,
1181  0x0,
1182  0x0,
1183  0xFFFFFFFF,
1184  "PNP BIOS",
1185  PartialResourceList,
1186  Size,
1187  &BusKey);
1188 
1189  (*BusNumber)++;
1190 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
GLint x0
Definition: linetemp.h:95
#define DiskReadBuffer
Definition: hardware.h:33
struct _CM_PNP_BIOS_INSTALLATION_CHECK * PCM_PNP_BIOS_INSTALLATION_CHECK
char CHAR
Definition: xmlstorage.h:175
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
_Out_ PUSHORT NodeNumber
Definition: iofuncs.h:2574
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
ULONG __cdecl PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer)
ULONG __cdecl PnpBiosGetDeviceNodeCount(ULONG *NodeSize, ULONG *NodeCount)
struct _CM_PNP_BIOS_INSTALLATION_CHECK CM_PNP_BIOS_INSTALLATION_CHECK
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
#define TRACE(s)
Definition: solgame.cpp:4
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
Definition: Node.h:9
unsigned char UCHAR
Definition: xmlstorage.h:181
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
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
ULONG_PTR __cdecl PnpBiosSupported(VOID)
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

Referenced by Pc98HwDetect().

◆ DetectPointerController()

static VOID DetectPointerController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 508 of file pc98hw.c.

509 {
510  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
511  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
512  PCONFIGURATION_COMPONENT_DATA ControllerKey;
513  ULONG Size;
514  UCHAR i;
515  UCHAR Index = 0;
516 
517  /* Set 'Configuration Data' value */
518  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
519  (HiResoMachine ? 6 : 5) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
520  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
521  if (PartialResourceList == NULL)
522  {
523  ERR("Failed to allocate resource descriptor\n");
524  return;
525  }
526  RtlZeroMemory(PartialResourceList, Size);
527  PartialResourceList->Version = 1;
528  PartialResourceList->Revision = 1;
529  PartialResourceList->Count = (HiResoMachine ? 7 : 6);
530 
531  /* Set I/O ports */
532  for (i = 0; i < 4; i++)
533  {
534  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
535  PartialDescriptor->Type = CmResourceTypePort;
537  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
538  PartialDescriptor->u.Port.Start.LowPart = (HiResoMachine ? 0x61 : 0x7FD9) + i * 2;
539  PartialDescriptor->u.Port.Start.HighPart = 0;
540  PartialDescriptor->u.Port.Length = 1;
541  }
542  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
543  PartialDescriptor->Type = CmResourceTypePort;
545  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
546  PartialDescriptor->u.Port.Start.LowPart = (HiResoMachine ? 0x869 : 0xBFDB);
547  PartialDescriptor->u.Port.Start.HighPart = 0;
548  PartialDescriptor->u.Port.Length = 1;
549  if (HiResoMachine)
550  {
551  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
552  PartialDescriptor->Type = CmResourceTypePort;
554  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
555  PartialDescriptor->u.Port.Start.LowPart = 0x98D7;
556  PartialDescriptor->u.Port.Start.HighPart = 0;
557  PartialDescriptor->u.Port.Length = 1;
558  }
559 
560  /* Set Interrupt */
561  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
562  PartialDescriptor->Type = CmResourceTypeInterrupt;
563  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
564  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
565  PartialDescriptor->u.Interrupt.Level = 13;
566  PartialDescriptor->u.Interrupt.Vector = 13;
567  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
568 
569  /* Create controller key */
570  FldrCreateComponentKey(BusKey,
572  PointerController,
573  Input,
574  0,
575  0xFFFFFFFF,
576  NULL,
577  PartialResourceList,
578  Size,
579  &ControllerKey);
580  TRACE("Created key: PointerController\\0\n");
581 
582  DetectPointerPeripheral(ControllerKey);
583 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
Definition: hwresource.cpp:123
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
_In_ WDFCOLLECTION _In_ ULONG Index
static VOID DetectPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Definition: pc98hw.c:471
unsigned char UCHAR
Definition: xmlstorage.h:181
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
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
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@378 Port
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 CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@379 Interrupt
BOOLEAN HiResoMachine
Definition: machpc98.c:17
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

Referenced by DetectCBusBios().

◆ DetectPointerPeripheral()

static VOID DetectPointerPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey)
static

Definition at line 471 of file pc98hw.c.

472 {
473  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
474  PCONFIGURATION_COMPONENT_DATA PeripheralKey;
475  ULONG Size;
476 
477  /* TODO: Properly detect */
478 
479  /* Set 'Configuration Data' value */
480  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
482  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
483  if (PartialResourceList == NULL)
484  {
485  ERR("Failed to allocate resource descriptor\n");
486  return;
487  }
488  RtlZeroMemory(PartialResourceList, Size);
489  PartialResourceList->Version = 1;
490  PartialResourceList->Revision = 1;
491  PartialResourceList->Count = 0;
492 
493  /* Create 'PointerPeripheral' key */
494  FldrCreateComponentKey(ControllerKey,
496  PointerPeripheral,
497  Input,
498  0,
499  0xFFFFFFFF,
500  "NEC PC-9800 BUS MOUSE",
501  PartialResourceList,
502  Size,
503  &PeripheralKey);
504  TRACE("Created key: PointerPeripheral\\0\n");
505 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define TRACE(s)
Definition: solgame.cpp:4
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
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23

Referenced by DetectPointerController().

◆ DetectSerialPorts()

static VOID DetectSerialPorts ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 808 of file pc98hw.c.

809 {
810  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
811  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
812  PCM_SERIAL_DEVICE_DATA SerialDeviceData;
813  PCONFIGURATION_COMPONENT_DATA ControllerKey;
814  CHAR Identifier[80];
815  UCHAR i;
816  ULONG Size;
817  UCHAR FifoStatus;
819  UCHAR Index = 0;
820  ULONG ControllerNumber = 0;
821 
822  if (CpDoesPortExist((PUCHAR)0x30))
823  {
824  RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%d", ControllerNumber + 1);
825 
826  FifoStatus = READ_PORT_UCHAR((PUCHAR)0x136) & 0x40;
828  HasFifo = ((READ_PORT_UCHAR((PUCHAR)0x136) & 0x40) != FifoStatus);
829 
830  /* Set 'Configuration Data' value */
831  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
832  (HasFifo ? 10 : 3) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
833  sizeof(CM_SERIAL_DEVICE_DATA);
834  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
835  if (PartialResourceList == NULL)
836  {
837  ERR("Failed to allocate resource descriptor\n");
838  return;
839  }
840  RtlZeroMemory(PartialResourceList, Size);
841  PartialResourceList->Version = 1;
842  PartialResourceList->Revision = 1;
843  PartialResourceList->Count = (HasFifo ? 11 : 4);
844 
845  /* Set I/O ports */
846  for (i = 0; i < 2; i++)
847  {
848  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
849  PartialDescriptor->Type = CmResourceTypePort;
851  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
852  PartialDescriptor->u.Port.Start.LowPart = 0x30 + i * 2;
853  PartialDescriptor->u.Port.Start.HighPart = 0;
854  PartialDescriptor->u.Port.Length = 1;
855  }
856  if (HasFifo)
857  {
858  for (i = 0; i < 7; i++)
859  {
860  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
861  PartialDescriptor->Type = CmResourceTypePort;
863  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
864  PartialDescriptor->u.Port.Start.LowPart = 0x130 + i * 2;
865  PartialDescriptor->u.Port.Start.HighPart = 0;
866  PartialDescriptor->u.Port.Length = 1;
867  }
868  }
869 
870  /* Set Interrupt */
871  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
872  PartialDescriptor->Type = CmResourceTypeInterrupt;
873  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
874  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
875  PartialDescriptor->u.Interrupt.Level = 4;
876  PartialDescriptor->u.Interrupt.Vector = 4;
877  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
878 
879  /* Set serial data (device specific) */
880  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
881  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
882  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
883  PartialDescriptor->Flags = 0;
884  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
885 
886  SerialDeviceData = (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[Index++];
887  SerialDeviceData->BaudClock = (*(PUCHAR)MEM_BIOS_FLAG1 & SYSTEM_CLOCK_8MHZ_FLAG) ?
889 
890  /* Create controller key */
891  FldrCreateComponentKey(BusKey,
893  SerialController,
895  ControllerNumber,
896  0xFFFFFFFF,
897  Identifier,
898  PartialResourceList,
899  Size,
900  &ControllerKey);
901  TRACE("Created key: SerialController\\%d\n", ControllerNumber);
902 
903  ++ControllerNumber;
904  }
905 
906  if (CpDoesPortExist((PUCHAR)0x238))
907  {
908  Index = 0;
909 
910  RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%d", ControllerNumber + 1);
911 
912  /* Set 'Configuration Data' value */
913  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
914  2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
915  sizeof(CM_SERIAL_DEVICE_DATA);
916  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
917  if (PartialResourceList == NULL)
918  {
919  ERR("Failed to allocate resource descriptor\n");
920  return;
921  }
922  RtlZeroMemory(PartialResourceList, Size);
923  PartialResourceList->Version = 1;
924  PartialResourceList->Revision = 1;
925  PartialResourceList->Count = 3;
926 
927  /* Set I/O ports */
928  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
929  PartialDescriptor->Type = CmResourceTypePort;
931  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
932  PartialDescriptor->u.Port.Start.LowPart = 0x238;
933  PartialDescriptor->u.Port.Start.HighPart = 0;
934  PartialDescriptor->u.Port.Length = 8;
935 
936  /* Set Interrupt */
937  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
938  PartialDescriptor->Type = CmResourceTypeInterrupt;
939  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
940  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
941  PartialDescriptor->u.Interrupt.Level = 5;
942  PartialDescriptor->u.Interrupt.Vector = 5;
943  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
944 
945  /* Set serial data (device specific) */
946  PartialDescriptor = &PartialResourceList->PartialDescriptors[Index++];
947  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
948  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
949  PartialDescriptor->Flags = 0;
950  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
951 
952  SerialDeviceData = (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[Index++];
953  SerialDeviceData->BaudClock = 1843200;
954 
955  /* Create controller key */
956  FldrCreateComponentKey(BusKey,
958  SerialController,
960  ControllerNumber,
961  0xFFFFFFFF,
962  Identifier,
963  PartialResourceList,
964  Size,
965  &ControllerKey);
966  TRACE("Created key: SerialController\\%d\n", ControllerNumber);
967 
968  ++ControllerNumber;
969  }
970 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define MEM_BIOS_FLAG1
Definition: machpc98.h:35
unsigned char * PUCHAR
Definition: retypes.h:3
BOOLEAN HasFifo
Definition: cport_pc98.c:32
Definition: arc.h:82
char CHAR
Definition: xmlstorage.h:175
struct _CM_SERIAL_DEVICE_DATA CM_SERIAL_DEVICE_DATA
Definition: arc.h:84
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
Definition: hwresource.cpp:123
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:227
unsigned char BOOLEAN
VOID StallExecutionProcessor(ULONG Microseconds)
Definition: pc98hw.c:45
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
_In_ WDFCOLLECTION _In_ ULONG Index
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
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 TIMER_FREQUENCY_1
Definition: pit.h:16
#define ERR(fmt,...)
Definition: debug.h:110
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@378 Port
#define SYSTEM_CLOCK_8MHZ_FLAG
Definition: machpc98.h:38
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 CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
Definition: arc.h:83
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@379 Interrupt
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23
#define TIMER_FREQUENCY_2
Definition: pit.h:17

Referenced by DetectCBusBios().

◆ DiskStopFloppyMotor()

VOID __cdecl DiskStopFloppyMotor ( VOID  )

Definition at line 1245 of file pc98hw.c.

1246 {
1249 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define FDC2_IO_BASE
Definition: fdc.h:11
#define FDC1_IO_BASE
Definition: fdc.h:10
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define FDC_o_CONTROL
Definition: fdc.h:22

Referenced by Pc98PrepareForReactOS(), PcPrepareForReactOS(), and XboxPrepareForReactOS().

◆ FrLdrCheckCpuCompatibility()

VOID FrLdrCheckCpuCompatibility ( VOID  )

Definition at line 1253 of file pc98hw.c.

1254 {
1255  INT CpuInformation[4] = {-1};
1256  ULONG NumberOfIds;
1257 
1258  /* Check if the processor first supports ID 1 */
1259  __cpuid(CpuInformation, 0);
1260 
1261  NumberOfIds = CpuInformation[0];
1262 
1263  if (NumberOfIds == 0)
1264  {
1266  __FILE__,
1267  __LINE__,
1268  "ReactOS requires the CPUID instruction to return "
1269  "more than one supported ID.\n\n");
1270  }
1271 
1272  /* NumberOfIds will be greater than 1 if the processor is new enough */
1273  if (NumberOfIds == 1)
1274  {
1275  INT ProcessorFamily;
1276 
1277  /* Get information */
1278  __cpuid(CpuInformation, 1);
1279 
1280  ProcessorFamily = (CpuInformation[0] >> 8) & 0xF;
1281 
1282  /* If it's Family 4 or lower, bugcheck */
1283  if (ProcessorFamily < 5)
1284  {
1286  __FILE__,
1287  __LINE__,
1288  "Processor is too old (family %u < 5)\n"
1289  "ReactOS requires a Pentium-level processor or newer.",
1290  ProcessorFamily);
1291  }
1292  }
1293 }
int32_t INT
Definition: typedefs.h:58
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
VOID FrLdrBugCheckWithMessage(ULONG BugCode, PCHAR File, ULONG Line, PSTR Format,...)
Definition: entry.c:23
unsigned int ULONG
Definition: retypes.h:1

◆ GetFloppyType()

static UCHAR GetFloppyType ( UCHAR  FloppyNumber)
static

Definition at line 143 of file pc98hw.c.

144 {
145  /* FIXME */
146  return 5;
147 }

Referenced by DetectBiosFloppyPeripheral().

◆ GetHarddiskIdentifier()

PCHAR GetHarddiskIdentifier ( UCHAR  DriveNumber)

Definition at line 249 of file hwdisk.c.

250 {
251  return PcDiskIdentifier[DriveNumber - 0x80];
252 }
static CHAR PcDiskIdentifier[32][20]
Definition: hwdisk.c:44

Referenced by DetectBiosDisks().

◆ HalpCalibrateStallExecution()

VOID HalpCalibrateStallExecution ( VOID  )

Definition at line 70 of file pc98hw.c.

71 {
72  ULONG i;
73  ULONG calib_bit;
74  ULONG CurCount;
75  TIMER_CONTROL_PORT_REGISTER TimerControl;
78 
79  /* Initialize timer interrupt with MILLISECOND ms interval */
80  TimerControl.BcdMode = FALSE;
81  TimerControl.OperatingMode = PitOperatingMode2;
82  TimerControl.AccessMode = PitAccessModeLowHigh;
83  TimerControl.Channel = PitChannel0;
84  Write8253Timer(TimerControl, Count);
85 
86  /* Stage 1: Coarse calibration */
87 
88  delay_count = 1;
89 
90  do
91  {
92  /* Next delay count to try */
93  delay_count <<= 1;
94 
96 
97  /* Do the delay */
99 
100  CurCount = Read8253Timer(PitChannel0);
101  }
102  while (CurCount > Count / 2);
103 
104  /* Get bottom value for delay */
105  delay_count >>= 1;
106 
107  /* Stage 2: Fine calibration */
108 
109  /* Which bit are we going to test */
110  calib_bit = delay_count;
111 
112  for (i = 0; i < PRECISION; i++)
113  {
114  /* Next bit to calibrate */
115  calib_bit >>= 1;
116 
117  /* If we have done all bits, stop */
118  if (!calib_bit)
119  break;
120 
121  /* Set the bit in delay_count */
122  delay_count |= calib_bit;
123 
125 
126  /* Do the delay */
128 
129  CurCount = Read8253Timer(PitChannel0);
130 
131  /* If a tick has passed, turn the calibrated bit back off */
132  if (CurCount <= Count / 2)
133  delay_count &= ~calib_bit;
134  }
135 
136  /* We're finished: Do the finishing touches */
137 
138  /* Calculate delay_count for 1ms */
139  delay_count /= (MILLISEC / 2);
140 }
#define HZ
Definition: pc98hw.c:29
#define MEM_BIOS_FLAG1
Definition: machpc98.h:35
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: pc98hw.c:39
unsigned char * PUCHAR
Definition: retypes.h:3
static VOID WaitFor8253Wraparound(VOID)
Definition: pc98hw.c:52
FORCEINLINE VOID Write8253Timer(TIMER_CONTROL_PORT_REGISTER TimerControl, USHORT Count)
Definition: pit.h:90
#define PRECISION
Definition: pc98hw.c:28
#define FALSE
Definition: types.h:117
int Count
Definition: noreturn.cpp:7
FORCEINLINE ULONG Read8253Timer(TIMER_CHANNELS TimerChannel)
Definition: pit.h:77
#define TIMER_FREQUENCY_1
Definition: pit.h:16
#define SYSTEM_CLOCK_8MHZ_FLAG
Definition: machpc98.h:38
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
unsigned int ULONG
Definition: retypes.h:1
#define MILLISEC
Definition: pc98hw.c:27
#define TIMER_FREQUENCY_2
Definition: pit.h:17
static unsigned int delay_count
Definition: pc98hw.c:31

◆ Pc98GetFloppyCount()

UCHAR Pc98GetFloppyCount ( VOID  )

Definition at line 1224 of file pc98hw.c.

1225 {
1226  USHORT DiskEquipment = *(PUSHORT)MEM_DISK_EQUIP & ~(*(PUCHAR)MEM_RDISK_EQUIP);
1227  UCHAR DiskMask;
1228  UCHAR FloppyCount = 0;
1229 
1230  for (DiskMask = 0x01; DiskMask != 0; DiskMask <<= 1)
1231  {
1232  if (FIRSTBYTE(DiskEquipment) & DiskMask)
1233  ++FloppyCount;
1234  }
1235 
1236  for (DiskMask = 0x10; DiskMask != 0; DiskMask <<= 1)
1237  {
1238  if (SECONDBYTE(DiskEquipment) & DiskMask)
1239  ++FloppyCount;
1240  }
1241 
1242  return FloppyCount;
1243 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define FIRSTBYTE(VALUE)
Definition: rtlfuncs.h:795
#define MEM_RDISK_EQUIP
Definition: machpc98.h:33
#define MEM_DISK_EQUIP
Definition: machpc98.h:41
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned short USHORT
Definition: pedump.c:61
unsigned short * PUSHORT
Definition: retypes.h:2
#define SECONDBYTE(VALUE)
Definition: rtlfuncs.h:796

Referenced by DetectBiosFloppyController(), DetectBiosFloppyPeripheral(), and MachInit().

◆ Pc98GetHarddiskConfigurationData()

static PCM_PARTIAL_RESOURCE_LIST Pc98GetHarddiskConfigurationData ( UCHAR  DriveNumber,
ULONG pSize 
)
static

Definition at line 318 of file pc98hw.c.

319 {
320  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
321  PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
322  GEOMETRY Geometry;
323  ULONG Size;
324 
325  *pSize = 0;
326 
327  /* Set 'Configuration Data' value */
328  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
330  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
331  if (PartialResourceList == NULL)
332  {
333  ERR("Failed to allocate resource descriptor\n");
334  return NULL;
335  }
336  RtlZeroMemory(PartialResourceList, Size);
337  PartialResourceList->Version = 1;
338  PartialResourceList->Revision = 1;
339  PartialResourceList->Count = 1;
340  PartialResourceList->PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
341 // PartialResourceList->PartialDescriptors[0].ShareDisposition =
342 // PartialResourceList->PartialDescriptors[0].Flags =
343  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
345 
346  /* Get pointer to geometry data */
347  DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
348 
349  /* Get the disk geometry. Extended geometry isn't supported by hardware */
350  if (Pc98DiskGetDriveGeometry(DriveNumber, &Geometry))
351  {
352  DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
353  DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
354  DiskGeometry->SectorsPerTrack = Geometry.Sectors;
355  DiskGeometry->NumberOfHeads = Geometry.Heads;
356  }
357  else
358  {
359  TRACE("Reading disk geometry failed\n");
360  FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
361  return NULL;
362  }
363  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
364  DriveNumber,
365  DiskGeometry->NumberOfCylinders,
366  DiskGeometry->NumberOfHeads,
367  DiskGeometry->SectorsPerTrack,
368  DiskGeometry->BytesPerSector);
369 
370  *pSize = Size;
371  return PartialResourceList;
372 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
ULONG Cylinders
Definition: disk.h:26
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
void * PVOID
Definition: retypes.h:9
BOOLEAN Pc98DiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pc98disk.c:870
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
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define ERR(fmt,...)
Definition: debug.h:110
ULONG BytesPerSector
Definition: disk.h:29
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
struct _CM_DISK_GEOMETRY_DEVICE_DATA CM_DISK_GEOMETRY_DEVICE_DATA
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23
ULONG Heads
Definition: disk.h:27

Referenced by Pc98HwDetect().

◆ Pc98HwDetect()

PCONFIGURATION_COMPONENT_DATA Pc98HwDetect ( VOID  )

Definition at line 1193 of file pc98hw.c.

1194 {
1196  ULONG BusNumber = 0;
1197 
1198  TRACE("DetectHardware()\n");
1199 
1200  /* Create the 'System' key */
1201  FldrCreateSystemKey(&SystemKey);
1202  FldrSetIdentifier(SystemKey, "NEC PC-98");
1203 
1206 
1207  /* Detect buses */
1208  DetectPciBios(SystemKey, &BusNumber);
1209  DetectApmBios(SystemKey, &BusNumber);
1210  DetectPnpBios(SystemKey, &BusNumber);
1211  DetectNesaBios(SystemKey, &BusNumber);
1212  DetectCBusBios(SystemKey, &BusNumber);
1213  DetectAcpiBios(SystemKey, &BusNumber);
1214  // TODO: Detect more buses
1215 
1216  // TODO: Collect the ROM blocks and append their
1217  // CM_ROM_BLOCK data into the 'System' key's configuration data.
1218 
1219  TRACE("DetectHardware() Done\n");
1220  return SystemKey;
1221 }
VOID NTAPI FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCHAR IdentifierString)
Definition: archwsup.c:56
static PCM_PARTIAL_RESOURCE_LIST Pc98GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: pc98hw.c:318
static VOID DetectCBusBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:973
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:1060
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pc98hw.c:23
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define TRACE(s)
Definition: solgame.cpp:4
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwacpi.c:54
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: hwpci.c:80
unsigned int ULONG
Definition: retypes.h:1
static VOID DetectNesaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: pc98hw.c:1019
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwapm.c:46

Referenced by MachInit().

◆ StallExecutionProcessor()

VOID StallExecutionProcessor ( ULONG  Microseconds)

Definition at line 45 of file pc98hw.c.

46 {
47  ULONGLONG LoopCount = ((ULONGLONG)delay_count * (ULONGLONG)Microseconds) / 1000ULL;
48  __StallExecutionProcessor((ULONG)LoopCount);
49 }
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: pc98hw.c:39
#define ULL(a, b)
Definition: format_msg.c:27
uint64_t ULONGLONG
Definition: typedefs.h:67
unsigned int ULONG
Definition: retypes.h:1
static unsigned int delay_count
Definition: pc98hw.c:31

Referenced by DetectSerialPorts().

◆ WaitFor8253Wraparound()

static VOID WaitFor8253Wraparound ( VOID  )
static

Definition at line 52 of file pc98hw.c.

53 {
54  ULONG CurrentCount;
55  ULONG PreviousCount = ~0;
56  LONG Delta;
57 
58  CurrentCount = Read8253Timer(PitChannel0);
59 
60  do
61  {
62  PreviousCount = CurrentCount;
63  CurrentCount = Read8253Timer(PitChannel0);
64  Delta = CurrentCount - PreviousCount;
65  }
66  while (Delta < 300);
67 }
long LONG
Definition: pedump.c:60
FORCEINLINE ULONG Read8253Timer(TIMER_CHANNELS TimerChannel)
Definition: pit.h:77
static ULONG Delta
Definition: xboxvideo.c:33
unsigned int ULONG
Definition: retypes.h:1

Referenced by HalpCalibrateStallExecution().

Variable Documentation

◆ delay_count

unsigned int delay_count = 1
static

Definition at line 31 of file pc98hw.c.

Referenced by HalpCalibrateStallExecution(), and StallExecutionProcessor().

◆ GetHarddiskConfigurationData

GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData = NULL

Definition at line 23 of file pc98hw.c.

Referenced by DetectBiosDisks(), and Pc98HwDetect().

◆ HiResoMachine

BOOLEAN HiResoMachine

Definition at line 17 of file machpc98.c.

Referenced by DetectPointerController().

◆ PcBiosDiskCount

UCHAR PcBiosDiskCount

Definition at line 43 of file hwdisk.c.

Referenced by DetectBiosDisks(), and EnumerateHarddisks().