Changeset 116
- Timestamp:
- Mar 26, 2010 1:01:39 PM (3 years ago)
- Location:
- trunk/filo
- Files:
-
- 3 edited
-
drivers/ide_new.c (modified) (7 diffs)
-
drivers/ide_new.h (modified) (1 diff)
-
fs/blockdev.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/filo/drivers/ide_new.c
r103 r116 4 4 * Copyright (C) 2004 Jens Axboe <axboe@suse.de> 5 5 * Copyright (C) 2005 Stefan Reinauer <stepan@openbios.org> 6 * Copyright (C) 2009 coresystems GmbH6 * Copyright (C) 2009-2010 coresystems GmbH 7 7 * 8 8 * Credit goes to Hale Landis for his excellent ata demo software … … 165 165 stat = ob_ide_pio_readb(drive, IDEREG_STATUS); 166 166 167 printf("ob_ide_error drive<%d>: %s:\n", drive->nr, msg); 168 printf(" cmd=%x, stat=%x", chan->ata_cmd.command, stat); 167 debug("ob_ide_error "); 168 printf("drive<%d>: %s:\n", drive->nr, msg); 169 debug(" cmd=%x, stat=%x", chan->ata_cmd.command, stat); 169 170 170 171 if ((stat & (BUSY_STAT | ERR_STAT)) == ERR_STAT) { 171 172 err = ob_ide_pio_readb(drive, IDEREG_ERROR); 172 printf(", err=%x", err);173 } 174 printf("\n");173 debug(", err=%x", err); 174 } 175 debug("\n"); 175 176 176 177 /* … … 184 185 old_cdb = cmd->old_cdb; 185 186 186 printf(" atapi opcode=%02x", old_cdb);187 debug(" atapi opcode=%02x", old_cdb); 187 188 } else { 188 189 int i; 189 190 190 printf(" cdb: ");191 debug(" cdb: "); 191 192 for (i = 0; i < sizeof(cmd->cdb); i++) 192 printf("%02x ", cmd->cdb[i]);193 debug("%02x ", cmd->cdb[i]); 193 194 } 194 195 if (cmd->sense_valid) 195 printf(", sense: %02x/%02x/%02x", cmd->sense.sense_key, cmd->sense.asc, cmd->sense.ascq);196 debug(", sense: %02x/%02x/%02x", cmd->sense.sense_key, cmd->sense.asc, cmd->sense.ascq); 196 197 else 197 printf(", no sense");198 printf("\n");198 debug(", no sense"); 199 debug("\n"); 199 200 } 200 201 } … … 568 569 * ... except 'medium not present' 569 570 */ 570 if (cmd->sense.asc == 0x3a) 571 break; 572 573 udelay(1000000); 571 if (cmd->sense.asc == 0x3a) { 572 /* 'medium not present' is not an error */ 573 ret = 0; 574 /* force reevaluation */ 575 drive->channel->present = 0; 576 break; 577 } 578 579 mdelay(1000); 574 580 } while (retries--); 575 581 … … 614 620 struct atapi_command *cmd = &drive->channel->atapi_cmd; 615 621 struct atapi_capacity cap; 622 int i; 616 623 617 624 /* 618 625 * Test Unit Ready is like a ping 619 */ 626 * But wait a bit, as the drive might take a while 627 */ 628 i = 30; 629 while (i-- != 0) { 630 memset(cmd, 0, sizeof(*cmd)); 631 cmd->cdb[0] = ATAPI_TUR; 632 633 if (!ob_ide_atapi_packet(drive,cmd)) break; 634 635 /* Give the drive some time to breathe */ 636 mdelay(500); 637 } 638 620 639 memset(cmd, 0, sizeof(*cmd)); 621 640 cmd->cdb[0] = ATAPI_TUR; … … 672 691 673 692 if (ob_ide_atapi_drive_ready(drive)) 674 return 1;693 return RETURN_NO_MEDIUM; 675 694 676 695 if (drive->bs == 2048) { … … 1150 1169 continue; 1151 1170 1152 if (val == 0xac8f104c) { 1171 // skip TI bridges on Rocky (ac8f) and Getac (803b) 1172 // There must be a better way to do this... 1173 if (val == 0xac8f104c || val == 0x803b104c) { 1153 1174 debug("Skipping TI bridge\n"); 1154 1175 continue; -
trunk/filo/drivers/ide_new.h
r103 r116 4 4 #include <arch/io.h> 5 5 #include "hdreg.h" 6 7 /* 8 * Return values 9 */ 10 11 #define RETURN_OK 0x00 12 #define RETURN_ERROR 0x01 13 #define RETURN_NO_MEDIUM 0x02 6 14 7 15 /* -
trunk/filo/fs/blockdev.c
r103 r116 395 395 { 396 396 int count = (NUM_CACHE-hash>8)?8:(NUM_CACHE-hash); 397 if (ide_read_blocks(dev_drive, sector, count, buf) != 0) 397 int ret; 398 ret = ide_read_blocks(dev_drive, sector, count, buf); 399 if (ret == 2) 400 goto nomedium; 401 if (ret != 0) 398 402 goto readerr; 399 403 while (--count>0) { … … 440 444 printf("Disk read error dev=%d drive=%d sector=%lu\n", 441 445 dev_type, dev_drive, sector); 446 flush_cache(); 447 dev_name[0] = '\0'; /* force re-open the device next time */ 448 return 0; 449 nomedium: 450 printf("No disk in drive.\n"); 451 flush_cache(); 442 452 dev_name[0] = '\0'; /* force re-open the device next time */ 443 453 return 0;
Note: See TracChangeset
for help on using the changeset viewer.
