diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-12-12 17:31:58 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-12-12 17:31:58 -0500 |
commit | 3ab7efe8e2cbcca2d401b43cfcc2fa9a7dac2299 (patch) | |
tree | 7ddbb4d5fdae6f61d23ef0ba2a43aaca23bd2195 /drivers/ide/ide-lib.c | |
parent | e11b9035a47da66fcd4bafd3a5f6b14f51ca667e (diff) |
ide: DMA reporting and validity checking fixes (take 3)
* ide_xfer_verbose() fixups:
- beautify returned mode names
- fix PIO5 reporting
- make it return 'const char *'
* Change printk() level from KERN_DEBUG to KERN_INFO in ide_find_dma_mode().
* Add ide_id_dma_bug() helper based on ide_dma_verbose() to check for invalid
DMA info in identify block.
* Use ide_id_dma_bug() in ide_tune_dma() and ide_driveid_update().
As a result DMA won't be tuned or will be disabled after tuning if device
reports inconsistent info about enabled DMA mode (ide_dma_verbose() does the
same checks while the IDE device is probed by ide-{cd,disk} device driver).
* Remove no longer needed ide_dma_verbose().
This patch should fix the following problem with out-of-sync IDE messages
reported by Nick Warne:
hdd: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache<7>hdd:
skipping word 93 validity check
, UDMA(66)
and later debugged by Mark Lord to be caused by:
ide_dma_verbose()
printk( ... "2048kB Cache");
eighty_ninty_three()
printk(KERN_DEBUG "%s: skipping word 93 validity check\n");
ide_dma_verbose()
printk(", UDMA(66)"
Please note that as a result ide-{cd,disk} device drivers won't report the
DMA speed used but this is intended since now DMA mode being used is always
reported by IDE core code.
v2:
* fixes suggested by Randy:
- use KERN_CONT for printk()-s in ide-{cd,disk}.c
- don't remove argument name from ide_xfer_verbose() declaration
v3:
* Remove incorrect check for (id->field_valid & 1) from ide_id_dma_bug()
(spotted by Sergei).
* "XFER SLOW" -> "PIO SLOW" in ide_xfer_verbose() (suggested by Sergei).
* Fix ide_find_dma_mode() to report the correct mode ('mode' after being
limited by 'req_mode').
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Nick Warne <nick@ukfsn.org>
Cc: Mark Lord <lkml@rtr.ca>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r-- | drivers/ide/ide-lib.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 1609b8604f56..062d3bcb2471 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -29,41 +29,44 @@ | |||
29 | * Add common non I/O op stuff here. Make sure it has proper | 29 | * Add common non I/O op stuff here. Make sure it has proper |
30 | * kernel-doc function headers or your patch will be rejected | 30 | * kernel-doc function headers or your patch will be rejected |
31 | */ | 31 | */ |
32 | 32 | ||
33 | static const char *udma_str[] = | ||
34 | { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44", | ||
35 | "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" }; | ||
36 | static const char *mwdma_str[] = | ||
37 | { "MWDMA0", "MWDMA1", "MWDMA2" }; | ||
38 | static const char *swdma_str[] = | ||
39 | { "SWDMA0", "SWDMA1", "SWDMA2" }; | ||
40 | static const char *pio_str[] = | ||
41 | { "PIO0", "PIO1", "PIO2", "PIO3", "PIO4", "PIO5" }; | ||
33 | 42 | ||
34 | /** | 43 | /** |
35 | * ide_xfer_verbose - return IDE mode names | 44 | * ide_xfer_verbose - return IDE mode names |
36 | * @xfer_rate: rate to name | 45 | * @mode: transfer mode |
37 | * | 46 | * |
38 | * Returns a constant string giving the name of the mode | 47 | * Returns a constant string giving the name of the mode |
39 | * requested. | 48 | * requested. |
40 | */ | 49 | */ |
41 | 50 | ||
42 | char *ide_xfer_verbose (u8 xfer_rate) | 51 | const char *ide_xfer_verbose(u8 mode) |
43 | { | 52 | { |
44 | switch(xfer_rate) { | 53 | const char *s; |
45 | case XFER_UDMA_7: return("UDMA 7"); | 54 | u8 i = mode & 0xf; |
46 | case XFER_UDMA_6: return("UDMA 6"); | 55 | |
47 | case XFER_UDMA_5: return("UDMA 5"); | 56 | if (mode >= XFER_UDMA_0 && mode <= XFER_UDMA_7) |
48 | case XFER_UDMA_4: return("UDMA 4"); | 57 | s = udma_str[i]; |
49 | case XFER_UDMA_3: return("UDMA 3"); | 58 | else if (mode >= XFER_MW_DMA_0 && mode <= XFER_MW_DMA_2) |
50 | case XFER_UDMA_2: return("UDMA 2"); | 59 | s = mwdma_str[i]; |
51 | case XFER_UDMA_1: return("UDMA 1"); | 60 | else if (mode >= XFER_SW_DMA_0 && mode <= XFER_SW_DMA_2) |
52 | case XFER_UDMA_0: return("UDMA 0"); | 61 | s = swdma_str[i]; |
53 | case XFER_MW_DMA_2: return("MW DMA 2"); | 62 | else if (mode >= XFER_PIO_0 && mode <= XFER_PIO_5) |
54 | case XFER_MW_DMA_1: return("MW DMA 1"); | 63 | s = pio_str[i & 0x7]; |
55 | case XFER_MW_DMA_0: return("MW DMA 0"); | 64 | else if (mode == XFER_PIO_SLOW) |
56 | case XFER_SW_DMA_2: return("SW DMA 2"); | 65 | s = "PIO SLOW"; |
57 | case XFER_SW_DMA_1: return("SW DMA 1"); | 66 | else |
58 | case XFER_SW_DMA_0: return("SW DMA 0"); | 67 | s = "XFER ERROR"; |
59 | case XFER_PIO_4: return("PIO 4"); | 68 | |
60 | case XFER_PIO_3: return("PIO 3"); | 69 | return s; |
61 | case XFER_PIO_2: return("PIO 2"); | ||
62 | case XFER_PIO_1: return("PIO 1"); | ||
63 | case XFER_PIO_0: return("PIO 0"); | ||
64 | case XFER_PIO_SLOW: return("PIO SLOW"); | ||
65 | default: return("XFER ERROR"); | ||
66 | } | ||
67 | } | 70 | } |
68 | 71 | ||
69 | EXPORT_SYMBOL(ide_xfer_verbose); | 72 | EXPORT_SYMBOL(ide_xfer_verbose); |