Skip to content

Commit ff7c5f9

Browse files
authored
Merge pull request #858 from pcm720/atad-probe-fix
ATAD: fix device probing for slave device
2 parents f388f51 + ab3c5a8 commit ff7c5f9

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

iop/dev9/atad/src/ps2atad.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,24 +1221,24 @@ static int ata_init_devices(ata_devinfo_t *devinfo)
12211221
int i, res;
12221222
u32 total_sectors_nonlba48, total_sectors_lba48;
12231223

1224-
if ((res = sceAtaSoftReset()) != 0)
1225-
return res;
1224+
/* Probe devices */
1225+
for (i = 0; i < 2; i++) {
1226+
if ((res = sceAtaSoftReset()) != 0)
1227+
return res;
1228+
1229+
ata_device_select(i);
1230+
if (ata_hwport->r_control & 0xff)
1231+
ata_device_probe(&devinfo[i]);
1232+
else
1233+
devinfo[i].exists = 0;
1234+
}
12261235

1227-
ata_device_probe(&devinfo[0]);
12281236
if (!devinfo[0].exists) {
12291237
M_PRINTF("Error: Unable to detect HDD 0.\n");
12301238
devinfo[1].exists = 0;
12311239
return ATA_RES_ERR_NODEV; // Returns 0 in v1.04.
12321240
}
12331241

1234-
/* If there is a device 1, grab it's info too. */
1235-
if ((res = ata_device_select(1)) != 0)
1236-
return res;
1237-
if (ata_hwport->r_control & 0xff)
1238-
ata_device_probe(&devinfo[1]);
1239-
else
1240-
devinfo[1].exists = 0;
1241-
12421242
#ifdef ATA_USE_DEV9
12431243
ata_pio_mode(0); // PIO mode is set here, in late ATAD versions.
12441244
#endif

0 commit comments

Comments
 (0)