Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions iop/dev9/atad/src/ps2atad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,15 +1222,22 @@ static int ata_init_devices(ata_devinfo_t *devinfo)
u32 total_sectors_nonlba48, total_sectors_lba48;

/* Probe devices */
for (i = 0; i < 2; i++) {
if (!ata_dvrp_workaround) {
for (i = 0; i < 2; i++) {
if ((res = sceAtaSoftReset()) != 0)
return res;

ata_device_select(i);
if (ata_hwport->r_control & 0xff)
ata_device_probe(&devinfo[i]);
else
devinfo[i].exists = 0;
}
} else {
if ((res = sceAtaSoftReset()) != 0)
return res;

ata_device_select(i);
if (ata_hwport->r_control & 0xff)
ata_device_probe(&devinfo[i]);
else
devinfo[i].exists = 0;
ata_device_probe(&devinfo[0]);
}

if (!devinfo[0].exists) {
Expand All @@ -1239,6 +1246,16 @@ static int ata_init_devices(ata_devinfo_t *devinfo)
return ATA_RES_ERR_NODEV; // Returns 0 in v1.04.
}

if (ata_dvrp_workaround) {
/* If there is a device 1, grab it's info too. */
if ((res = ata_device_select(1)) != 0)
return res;
if (ata_hwport->r_control & 0xff)
ata_device_probe(&devinfo[1]);
else
devinfo[1].exists = 0;
}

#ifdef ATA_USE_DEV9
ata_pio_mode(0); // PIO mode is set here, in late ATAD versions.
#endif
Expand Down
Loading