aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r--drivers/ide/ide-lib.c55
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
33static const char *udma_str[] =
34 { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44",
35 "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" };
36static const char *mwdma_str[] =
37 { "MWDMA0", "MWDMA1", "MWDMA2" };
38static const char *swdma_str[] =
39 { "SWDMA0", "SWDMA1", "SWDMA2" };
40static 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
42char *ide_xfer_verbose (u8 xfer_rate) 51const 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
69EXPORT_SYMBOL(ide_xfer_verbose); 72EXPORT_SYMBOL(ide_xfer_verbose);