From: Erik M. <er...@us...> - 2004-07-30 14:51:32
|
Update of /cvsroot/blob/blob/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23959 Modified Files: ide.c Log Message: - LBA addresses only have 28 valid bits, so & with 0x0f instead of 0xff - remove bogus lba &= 0x0fffffff - minor readability fixes for the lba adressing - when things go wrong, also print the error code so you can figure out what went really wrong (yeah, I've been reading too much T13 documents lately. check out www.t13.org -- erik) Index: ide.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/ide.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ide.c 10 May 2002 15:33:39 -0000 1.7 +++ ide.c 30 Jul 2004 14:51:23 -0000 1.8 @@ -361,16 +361,14 @@ port = drive->ide_port; reg = drive->ide_reg; - lba &= 0x0fffffff; - hd_drive = 0; hd_cmd[1] = 0; hd_cmd[2] = 1; /* # sectors */ - hd_cmd[3] = lba&0xff; - hd_cmd[4] = (lba>>8)&0xff; + hd_cmd[3] = (lba )&0xff; + hd_cmd[4] = (lba>> 8)&0xff; hd_cmd[5] = (lba>>16)&0xff; - hd_cmd[6] = (lba>>24)&0xff; + hd_cmd[6] = (lba>>24)&0x0f; /* sectors only have 28 bits */ hd_cmd[6] |= ((hd_drive&1) << 4) | 0xe0; hd_busy_wait(port); @@ -393,7 +391,7 @@ drive->last_status = status = port[7]; if (status & ERROR) { - printf("hd_read_lba: read status: %2x\n", status); + printf("hd_read_lba: read status: %02x %02x\n", status, port[1]); printf("hd_read_lba: lba=%08x\n", lba&0x0fffffff ); for (i = 1; i < 7; i++) { |