- Fixed counting the number of available harddisks for broken BIOSes.

- Enable/disable the display of read error messages.

svn path=/trunk/; revision=4661
This commit is contained in:
Eric Kohl 2003-05-10 09:25:35 +00:00
parent 8e23b88b00
commit 7f6db59b55
3 changed files with 43 additions and 18 deletions

View file

@ -342,6 +342,10 @@ DetectPnpBios(HKEY SystemKey, U32 *BusNumber)
DeviceNode->Node,
DeviceNode->Size,
DeviceNode->Size));
// printf("Node: %u Size %u (0x%x)\n",
// DeviceNode->Node,
// DeviceNode->Size,
// DeviceNode->Size);
memcpy (Ptr,
DeviceNode,
@ -548,11 +552,13 @@ DetectBiosDisks(HKEY SystemKey,
S32 Error;
/* Count the number of visible drives */
DiskReportError(FALSE);
DiskCount = 0;
while (DiskGetDriveParameters(0x80 + DiskCount, &Geometry))
while (DiskReadLogicalSectors(0x80 + DiskCount, 0ULL, 1, (PVOID)DISKREADBUFFER))
{
DiskCount++;
}
DiskReportError(TRUE);
DbgPrint((DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "": "s"));
@ -711,13 +717,15 @@ DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
/* Detect ISA/BIOS devices */
DetectBiosDisks(SystemKey, BusKey);
// DetectBiosFloppyDisks(SystemKey, BusKey);
#if 0
DetectBiosFloppyDisks(SystemKey, BusKey);
// DetectBiosSerialPorts
// DetectBiosParallelPorts
DetectBiosSerialPorts();
DetectBiosParallelPorts();
// DetectBiosKeyboard
// DetectBiosMouse
DetectBiosKeyboard();
DetectBiosMouse();
#endif
/* FIXME: Detect more ISA devices */
}
@ -744,23 +752,29 @@ DetectHardware(VOID)
return;
}
// DetectSystemData ();
DetectCPUs (SystemKey);
#if 0
DetectSystemData();
#endif
DetectCPUs(SystemKey);
/* Detect buses */
// DetectPciBios (&BusNumber);
// DetectApmBios (&BusNumber);
DetectPnpBios (SystemKey, &BusNumber);
DetectIsaBios (SystemKey, &BusNumber);
// DetectAcpiBios (&BusNumber);
#if 0
DetectPciBios(&BusNumber);
DetectApmBios(&BusNumber);
#endif
DetectPnpBios(SystemKey, &BusNumber);
DetectIsaBios(SystemKey, &BusNumber);
#if 0
DetectAcpiBios(&BusNumber);
#endif
DbgPrint((DPRINT_HWDETECT, "DetectHardware() Done\n"));
DbgPrint ((DPRINT_HWDETECT, "DetectHardware() Done\n"));
// printf ("*** System stopped ***\n");
// for (;;);
#if 0
printf("*** System stopped ***\n");
for (;;);
#endif
}
/* EOF */

View file

@ -28,14 +28,24 @@
#undef UNIMPLEMENTED
#define UNIMPLEMENTED BugCheck((DPRINT_WARNING, "Unimplemented\n"));
static BOOL bReportError = TRUE;
/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////////
VOID DiskReportError (BOOL bError)
{
bReportError = bError;
}
VOID DiskError(PUCHAR ErrorString, U32 ErrorCode)
{
UCHAR ErrorCodeString[200];
if (bReportError == FALSE)
return;
sprintf(ErrorCodeString, "%s\n\nError Code: 0x%x\nError: %s", ErrorString, ErrorCode, DiskGetErrorCodeString(ErrorCode));
DbgPrint((DPRINT_DISK, "%s\n", ErrorCodeString));

View file

@ -123,6 +123,7 @@ BOOL DiskGetExtendedDriveParameters(U32 DriveNumber, PVOID Buffer, U16 BufferSiz
// FreeLoader Disk Functions
//
///////////////////////////////////////////////////////////////////////////////////////
VOID DiskReportError (BOOL bError);
VOID DiskError(PUCHAR ErrorString, U32 ErrorCode);
PUCHAR DiskGetErrorCodeString(U32 ErrorCode);
BOOL DiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry);