aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-lib.c95
1 files changed, 54 insertions, 41 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 1932119dfa00..7913ad5d4979 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -43,7 +43,6 @@ const char *ide_xfer_verbose(u8 mode)
43 43
44 return s; 44 return s;
45} 45}
46
47EXPORT_SYMBOL(ide_xfer_verbose); 46EXPORT_SYMBOL(ide_xfer_verbose);
48 47
49/** 48/**
@@ -87,7 +86,7 @@ static u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
87 * This is used by most chipset support modules when "auto-tuning". 86 * This is used by most chipset support modules when "auto-tuning".
88 */ 87 */
89 88
90u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) 89u8 ide_get_best_pio_mode(ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
91{ 90{
92 u16 *id = drive->id; 91 u16 *id = drive->id;
93 int pio_mode = -1, overridden = 0; 92 int pio_mode = -1, overridden = 0;
@@ -131,7 +130,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
131 130
132 return pio_mode; 131 return pio_mode;
133} 132}
134
135EXPORT_SYMBOL_GPL(ide_get_best_pio_mode); 133EXPORT_SYMBOL_GPL(ide_get_best_pio_mode);
136 134
137/* req_pio == "255" for auto-tune */ 135/* req_pio == "255" for auto-tune */
@@ -162,7 +160,6 @@ void ide_set_pio(ide_drive_t *drive, u8 req_pio)
162 160
163 (void)ide_set_pio_mode(drive, XFER_PIO_0 + pio); 161 (void)ide_set_pio_mode(drive, XFER_PIO_0 + pio);
164} 162}
165
166EXPORT_SYMBOL_GPL(ide_set_pio); 163EXPORT_SYMBOL_GPL(ide_set_pio);
167 164
168/** 165/**
@@ -173,7 +170,7 @@ EXPORT_SYMBOL_GPL(ide_set_pio);
173 * Enable or disable bounce buffering for the device. Drives move 170 * Enable or disable bounce buffering for the device. Drives move
174 * between PIO and DMA and that changes the rules we need. 171 * between PIO and DMA and that changes the rules we need.
175 */ 172 */
176 173
177void ide_toggle_bounce(ide_drive_t *drive, int on) 174void ide_toggle_bounce(ide_drive_t *drive, int on)
178{ 175{
179 u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ 176 u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */
@@ -243,14 +240,13 @@ int ide_set_dma_mode(ide_drive_t *drive, const u8 mode)
243 return ide_config_drive_speed(drive, mode); 240 return ide_config_drive_speed(drive, mode);
244 } 241 }
245} 242}
246
247EXPORT_SYMBOL_GPL(ide_set_dma_mode); 243EXPORT_SYMBOL_GPL(ide_set_dma_mode);
248 244
249/** 245/**
250 * ide_set_xfer_rate - set transfer rate 246 * ide_set_xfer_rate - set transfer rate
251 * @drive: drive to set 247 * @drive: drive to set
252 * @rate: speed to attempt to set 248 * @rate: speed to attempt to set
253 * 249 *
254 * General helper for setting the speed of an IDE device. This 250 * General helper for setting the speed of an IDE device. This
255 * function knows about user enforced limits from the configuration 251 * function knows about user enforced limits from the configuration
256 * which ->set_pio_mode/->set_dma_mode does not. 252 * which ->set_pio_mode/->set_dma_mode does not.
@@ -286,7 +282,7 @@ static void ide_dump_opcode(ide_drive_t *drive)
286 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) 282 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
287 task = rq->special; 283 task = rq->special;
288 284
289 printk("ide: failed opcode was: "); 285 printk(KERN_ERR "ide: failed opcode was: ");
290 if (task == NULL) 286 if (task == NULL)
291 printk(KERN_CONT "unknown\n"); 287 printk(KERN_CONT "unknown\n");
292 else 288 else
@@ -324,44 +320,55 @@ static void ide_dump_sector(ide_drive_t *drive)
324 drive->hwif->tp_ops->tf_read(drive, &task); 320 drive->hwif->tp_ops->tf_read(drive, &task);
325 321
326 if (lba48 || (tf->device & ATA_LBA)) 322 if (lba48 || (tf->device & ATA_LBA))
327 printk(", LBAsect=%llu", 323 printk(KERN_CONT ", LBAsect=%llu",
328 (unsigned long long)ide_get_lba_addr(tf, lba48)); 324 (unsigned long long)ide_get_lba_addr(tf, lba48));
329 else 325 else
330 printk(", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam, 326 printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam,
331 tf->device & 0xf, tf->lbal); 327 tf->device & 0xf, tf->lbal);
332} 328}
333 329
334static void ide_dump_ata_error(ide_drive_t *drive, u8 err) 330static void ide_dump_ata_error(ide_drive_t *drive, u8 err)
335{ 331{
336 printk("{ "); 332 printk(KERN_ERR "{ ");
337 if (err & ATA_ABORTED) printk("DriveStatusError "); 333 if (err & ATA_ABORTED)
334 printk(KERN_CONT "DriveStatusError ");
338 if (err & ATA_ICRC) 335 if (err & ATA_ICRC)
339 printk((err & ATA_ABORTED) ? "BadCRC " : "BadSector "); 336 printk(KERN_CONT "%s",
340 if (err & ATA_UNC) printk("UncorrectableError "); 337 (err & ATA_ABORTED) ? "BadCRC " : "BadSector ");
341 if (err & ATA_IDNF) printk("SectorIdNotFound "); 338 if (err & ATA_UNC)
342 if (err & ATA_TRK0NF) printk("TrackZeroNotFound "); 339 printk(KERN_CONT "UncorrectableError ");
343 if (err & ATA_AMNF) printk("AddrMarkNotFound "); 340 if (err & ATA_IDNF)
344 printk("}"); 341 printk(KERN_CONT "SectorIdNotFound ");
342 if (err & ATA_TRK0NF)
343 printk(KERN_CONT "TrackZeroNotFound ");
344 if (err & ATA_AMNF)
345 printk(KERN_CONT "AddrMarkNotFound ");
346 printk(KERN_CONT "}");
345 if ((err & (ATA_BBK | ATA_ABORTED)) == ATA_BBK || 347 if ((err & (ATA_BBK | ATA_ABORTED)) == ATA_BBK ||
346 (err & (ATA_UNC | ATA_IDNF | ATA_AMNF))) { 348 (err & (ATA_UNC | ATA_IDNF | ATA_AMNF))) {
347 ide_dump_sector(drive); 349 ide_dump_sector(drive);
348 if (HWGROUP(drive) && HWGROUP(drive)->rq) 350 if (HWGROUP(drive) && HWGROUP(drive)->rq)
349 printk(", sector=%llu", 351 printk(KERN_CONT ", sector=%llu",
350 (unsigned long long)HWGROUP(drive)->rq->sector); 352 (unsigned long long)HWGROUP(drive)->rq->sector);
351 } 353 }
352 printk("\n"); 354 printk(KERN_CONT "\n");
353} 355}
354 356
355static void ide_dump_atapi_error(ide_drive_t *drive, u8 err) 357static void ide_dump_atapi_error(ide_drive_t *drive, u8 err)
356{ 358{
357 printk("{ "); 359 printk(KERN_ERR "{ ");
358 if (err & ATAPI_ILI) printk("IllegalLengthIndication "); 360 if (err & ATAPI_ILI)
359 if (err & ATAPI_EOM) printk("EndOfMedia "); 361 printk(KERN_CONT "IllegalLengthIndication ");
360 if (err & ATA_ABORTED) printk("AbortedCommand "); 362 if (err & ATAPI_EOM)
361 if (err & ATA_MCR) printk("MediaChangeRequested "); 363 printk(KERN_CONT "EndOfMedia ");
362 if (err & ATAPI_LFS) printk("LastFailedSense=0x%02x ", 364 if (err & ATA_ABORTED)
363 (err & ATAPI_LFS) >> 4); 365 printk(KERN_CONT "AbortedCommand ");
364 printk("}\n"); 366 if (err & ATA_MCR)
367 printk(KERN_CONT "MediaChangeRequested ");
368 if (err & ATAPI_LFS)
369 printk(KERN_CONT "LastFailedSense=0x%02x ",
370 (err & ATAPI_LFS) >> 4);
371 printk(KERN_CONT "}\n");
365} 372}
366 373
367/** 374/**
@@ -381,22 +388,29 @@ u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat)
381 u8 err = 0; 388 u8 err = 0;
382 389
383 local_irq_save(flags); 390 local_irq_save(flags);
384 printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); 391 printk(KERN_ERR "%s: %s: status=0x%02x { ", drive->name, msg, stat);
385 if (stat & ATA_BUSY) 392 if (stat & ATA_BUSY)
386 printk("Busy "); 393 printk(KERN_CONT "Busy ");
387 else { 394 else {
388 if (stat & ATA_DRDY) printk("DriveReady "); 395 if (stat & ATA_DRDY)
389 if (stat & ATA_DF) printk("DeviceFault "); 396 printk(KERN_CONT "DriveReady ");
390 if (stat & ATA_DSC) printk("SeekComplete "); 397 if (stat & ATA_DF)
391 if (stat & ATA_DRQ) printk("DataRequest "); 398 printk(KERN_CONT "DeviceFault ");
392 if (stat & ATA_CORR) printk("CorrectedError "); 399 if (stat & ATA_DSC)
393 if (stat & ATA_IDX) printk("Index "); 400 printk(KERN_CONT "SeekComplete ");
394 if (stat & ATA_ERR) printk("Error "); 401 if (stat & ATA_DRQ)
402 printk(KERN_CONT "DataRequest ");
403 if (stat & ATA_CORR)
404 printk(KERN_CONT "CorrectedError ");
405 if (stat & ATA_IDX)
406 printk(KERN_CONT "Index ");
407 if (stat & ATA_ERR)
408 printk(KERN_CONT "Error ");
395 } 409 }
396 printk("}\n"); 410 printk(KERN_CONT "}\n");
397 if ((stat & (ATA_BUSY | ATA_ERR)) == ATA_ERR) { 411 if ((stat & (ATA_BUSY | ATA_ERR)) == ATA_ERR) {
398 err = ide_read_error(drive); 412 err = ide_read_error(drive);
399 printk("%s: %s: error=0x%02x ", drive->name, msg, err); 413 printk(KERN_ERR "%s: %s: error=0x%02x ", drive->name, msg, err);
400 if (drive->media == ide_disk) 414 if (drive->media == ide_disk)
401 ide_dump_ata_error(drive, err); 415 ide_dump_ata_error(drive, err);
402 else 416 else
@@ -406,5 +420,4 @@ u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat)
406 local_irq_restore(flags); 420 local_irq_restore(flags);
407 return err; 421 return err;
408} 422}
409
410EXPORT_SYMBOL(ide_dump_status); 423EXPORT_SYMBOL(ide_dump_status);