Skip to content

Commit

Permalink
Changed checking of ATA type if drive does not respond properly to ID…
Browse files Browse the repository at this point in the history
…E status.
  • Loading branch information
tombee committed Oct 17, 2010
1 parent 0efedd1 commit fb6b1db
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions arch-ia32/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,24 @@ static void __init ata_init(void)
}
}

if(err != 0) {
/* TODO: Check type somehow? */
ide_write(&channels[i], ATA_REG_COMMAND,
ATA_CMD_IDENTIFY_PACKET);
if(err) {
/* ATA type is not IDE, let's check if it's
* ATAPI
*/
uint8_t lba1 =
ide_read(&channels[i], ATA_REG_LBA1);
uint8_t lba2 =
ide_read(&channels[i], ATA_REG_LBA2);

if(lba1 == 0x14 && lba2 == 0xEB) {
/* Drive is ATAPI */
ide_write(&channels[i], ATA_REG_COMMAND,
ATA_CMD_IDENTIFY_PACKET);
}
else {
/* Unknown drive type */
continue;
}
}

cur_drv = kmalloc(sizeof(struct identity));
Expand Down

0 comments on commit fb6b1db

Please sign in to comment.