mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 23:33:24 +08:00
[FREELDR:ARCH] Fix minor bugs; condense XboxDiskInit() a bit (#8732)
- `AtaInit()` returns the number of detected ATA devices. Therefore, when iterating over them, go from index 0 to the count _minus_ 1, in `Pc98InitializeBootDevices()` and in `XboxDiskInit()`. - Initialize `DiskDrive->Type` to `DRIVE_TYPE_HDD` for detected SCSI hard-disk drives in `pc98disk.c!InitScsiDrive()`. - Rearrange `XboxDiskInit()` and reduce its indentation level.
This commit is contained in:
@@ -397,6 +397,7 @@ InitScsiDrive(
|
||||
DiskDrive->Geometry.Heads = RegsOut.b.dh;
|
||||
DiskDrive->Geometry.SectorsPerTrack = RegsOut.b.dl;
|
||||
DiskDrive->Geometry.BytesPerSector = RegsOut.w.bx;
|
||||
DiskDrive->Type = DRIVE_TYPE_HDD;
|
||||
}
|
||||
/* Other devices */
|
||||
else if (ScsiParameters != 0)
|
||||
@@ -675,7 +676,7 @@ Pc98InitializeBootDevices(VOID)
|
||||
* that cannot boot from a CD-ROM and has LBA limitations.
|
||||
*/
|
||||
AtaInit(&IdeDetectedCount);
|
||||
for (i = 0; i <= IdeDetectedCount; i++)
|
||||
for (i = 0; i < IdeDetectedCount; i++)
|
||||
{
|
||||
DiskDrive = &Pc98DiskDrive[BiosHardDriveDriveNumber];
|
||||
if (InitIdeDrive(DiskDrive, i))
|
||||
|
||||
@@ -42,31 +42,28 @@ static
|
||||
VOID
|
||||
XboxDiskInit(VOID)
|
||||
{
|
||||
UCHAR DetectedCount;
|
||||
UCHAR UnitNumber;
|
||||
PDEVICE_UNIT DeviceUnit = NULL;
|
||||
UCHAR DetectedCount, UnitNumber;
|
||||
|
||||
ASSERT(!AtaInitialized);
|
||||
|
||||
AtaInitialized = TRUE;
|
||||
|
||||
/* Find first HDD and CD */
|
||||
AtaInit(&DetectedCount);
|
||||
for (UnitNumber = 0; UnitNumber <= DetectedCount; UnitNumber++)
|
||||
for (UnitNumber = 0; UnitNumber < DetectedCount; UnitNumber++)
|
||||
{
|
||||
DeviceUnit = AtaGetDevice(UnitNumber);
|
||||
if (DeviceUnit)
|
||||
PDEVICE_UNIT DeviceUnit = AtaGetDevice(UnitNumber);
|
||||
if (!DeviceUnit)
|
||||
continue;
|
||||
|
||||
if (DeviceUnit->Flags & ATA_DEVICE_ATAPI)
|
||||
{
|
||||
if (DeviceUnit->Flags & ATA_DEVICE_ATAPI)
|
||||
{
|
||||
if (!CdDrive)
|
||||
CdDrive = DeviceUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!HardDrive)
|
||||
HardDrive = DeviceUnit;
|
||||
}
|
||||
if (!CdDrive)
|
||||
CdDrive = DeviceUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!HardDrive)
|
||||
HardDrive = DeviceUnit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user