- u64 sectors;
- if (*(u16*)&buffer[83*2] & (1 << 10)) // word 83 - lba48 support
- sectors = *(u64*)&buffer[100*2]; // word 100-103
- else
- sectors = *(u32*)&buffer[60*2]; // word 60 and word 61
-
- SET_EBDA(ata.devices[driveid].device, ATA_DEVICE_HD);
- SET_EBDA(ata.devices[driveid].removable, removable);
- SET_EBDA(ata.devices[driveid].mode, mode);
- SET_EBDA(ata.devices[driveid].blksize, blksize);
- SET_EBDA(ata.devices[driveid].pchs.heads, heads);
- SET_EBDA(ata.devices[driveid].pchs.cylinders, cylinders);
- SET_EBDA(ata.devices[driveid].pchs.spt, spt);
- SET_EBDA(ata.devices[driveid].sectors, sectors);
-
- // Setup disk geometry translation.
- setup_translation(driveid);
-
- // fill hdidmap
- u8 hdcount = GET_EBDA(ata.hdcount);
- SET_EBDA(ata.idmap[0][hdcount], driveid);
- SET_EBDA(ata.hdcount, ++hdcount);
-
- // Fill "fdpt" structure.
- fill_fdpt(driveid);
-
- // Report drive info to user.
- u64 sizeinmb = GET_EBDA(ata.devices[driveid].sectors) >> 11;
- report_model(driveid, buffer);
- u8 version = get_ata_version(buffer);
- if (sizeinmb < (1 << 16))
- printf(" ATA-%d Hard-Disk (%u MBytes)\n", version, (u32)sizeinmb);
- else
- printf(" ATA-%d Hard-Disk (%u GBytes)\n", version
- , (u32)(sizeinmb >> 10));
+ u16 resetresult = buffer[93];
+ dprintf(6, "ata_detect resetresult=%04x\n", resetresult);
+ if (!slave && (resetresult & 0xdf61) == 0x4041)
+ // resetresult looks valid and device 0 is responding to
+ // device 1 requests - device 1 must not be present - skip
+ // detection.
+ break;
+ }