aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-11-27 05:43:39 -0500
committerJeff Garzik <jeff@garzik.org>2008-01-23 05:24:11 -0500
commit6357357cae7794dcb89cace758108dec612e7ed5 (patch)
tree6fc39d16ff795f34b4f8a987966fd5195b1d9039 /drivers/ata
parentf8ab6d8e15a9b978f79aee794c263014c2959dfc (diff)
libata: export xfermode / PATA timing related functions
Export the following xfermode related functions. * ata_pack_xfermask() * ata_unpack_xfermask() * ata_xfer_mask2mode() * ata_xfer_mode2mask() * ata_xfer_mode2shift() * ata_mode_string() * ata_id_xfermask() * ata_timing_find_mode() These functions will be used later by LLD updates. While at it, change unsigned short @speed to u8 @xfer_mode in ata_timing_find_mode() for consistency. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 124b6f111cc3..a2f2ff864b37 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -454,9 +454,8 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
454 * RETURNS: 454 * RETURNS:
455 * Packed xfer_mask. 455 * Packed xfer_mask.
456 */ 456 */
457static unsigned int ata_pack_xfermask(unsigned int pio_mask, 457unsigned int ata_pack_xfermask(unsigned int pio_mask,
458 unsigned int mwdma_mask, 458 unsigned int mwdma_mask, unsigned int udma_mask)
459 unsigned int udma_mask)
460{ 459{
461 return ((pio_mask << ATA_SHIFT_PIO) & ATA_MASK_PIO) | 460 return ((pio_mask << ATA_SHIFT_PIO) & ATA_MASK_PIO) |
462 ((mwdma_mask << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA) | 461 ((mwdma_mask << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA) |
@@ -473,10 +472,8 @@ static unsigned int ata_pack_xfermask(unsigned int pio_mask,
473 * Unpack @xfer_mask into @pio_mask, @mwdma_mask and @udma_mask. 472 * Unpack @xfer_mask into @pio_mask, @mwdma_mask and @udma_mask.
474 * Any NULL distination masks will be ignored. 473 * Any NULL distination masks will be ignored.
475 */ 474 */
476static void ata_unpack_xfermask(unsigned int xfer_mask, 475void ata_unpack_xfermask(unsigned int xfer_mask, unsigned int *pio_mask,
477 unsigned int *pio_mask, 476 unsigned int *mwdma_mask, unsigned int *udma_mask)
478 unsigned int *mwdma_mask,
479 unsigned int *udma_mask)
480{ 477{
481 if (pio_mask) 478 if (pio_mask)
482 *pio_mask = (xfer_mask & ATA_MASK_PIO) >> ATA_SHIFT_PIO; 479 *pio_mask = (xfer_mask & ATA_MASK_PIO) >> ATA_SHIFT_PIO;
@@ -509,7 +506,7 @@ static const struct ata_xfer_ent {
509 * RETURNS: 506 * RETURNS:
510 * Matching XFER_* value, 0 if no match found. 507 * Matching XFER_* value, 0 if no match found.
511 */ 508 */
512static u8 ata_xfer_mask2mode(unsigned int xfer_mask) 509u8 ata_xfer_mask2mode(unsigned int xfer_mask)
513{ 510{
514 int highbit = fls(xfer_mask) - 1; 511 int highbit = fls(xfer_mask) - 1;
515 const struct ata_xfer_ent *ent; 512 const struct ata_xfer_ent *ent;
@@ -532,7 +529,7 @@ static u8 ata_xfer_mask2mode(unsigned int xfer_mask)
532 * RETURNS: 529 * RETURNS:
533 * Matching xfer_mask, 0 if no match found. 530 * Matching xfer_mask, 0 if no match found.
534 */ 531 */
535static unsigned int ata_xfer_mode2mask(u8 xfer_mode) 532unsigned int ata_xfer_mode2mask(u8 xfer_mode)
536{ 533{
537 const struct ata_xfer_ent *ent; 534 const struct ata_xfer_ent *ent;
538 535
@@ -554,7 +551,7 @@ static unsigned int ata_xfer_mode2mask(u8 xfer_mode)
554 * RETURNS: 551 * RETURNS:
555 * Matching xfer_shift, -1 if no match found. 552 * Matching xfer_shift, -1 if no match found.
556 */ 553 */
557static int ata_xfer_mode2shift(unsigned int xfer_mode) 554int ata_xfer_mode2shift(unsigned int xfer_mode)
558{ 555{
559 const struct ata_xfer_ent *ent; 556 const struct ata_xfer_ent *ent;
560 557
@@ -578,7 +575,7 @@ static int ata_xfer_mode2shift(unsigned int xfer_mode)
578 * Constant C string representing highest speed listed in 575 * Constant C string representing highest speed listed in
579 * @mode_mask, or the constant C string "<n/a>". 576 * @mode_mask, or the constant C string "<n/a>".
580 */ 577 */
581static const char *ata_mode_string(unsigned int xfer_mask) 578const char *ata_mode_string(unsigned int xfer_mask)
582{ 579{
583 static const char * const xfer_mode_str[] = { 580 static const char * const xfer_mode_str[] = {
584 "PIO0", 581 "PIO0",
@@ -1468,7 +1465,7 @@ static inline void ata_dump_id(const u16 *id)
1468 * RETURNS: 1465 * RETURNS:
1469 * Computed xfermask 1466 * Computed xfermask
1470 */ 1467 */
1471static unsigned int ata_id_xfermask(const u16 *id) 1468unsigned int ata_id_xfermask(const u16 *id)
1472{ 1469{
1473 unsigned int pio_mask, mwdma_mask, udma_mask; 1470 unsigned int pio_mask, mwdma_mask, udma_mask;
1474 1471
@@ -2855,11 +2852,11 @@ void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
2855 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma); 2852 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma);
2856} 2853}
2857 2854
2858static const struct ata_timing *ata_timing_find_mode(unsigned short speed) 2855const struct ata_timing *ata_timing_find_mode(u8 xfer_mode)
2859{ 2856{
2860 const struct ata_timing *t; 2857 const struct ata_timing *t;
2861 2858
2862 for (t = ata_timing; t->mode != speed; t++) 2859 for (t = ata_timing; t->mode != xfer_mode; t++)
2863 if (t->mode == 0xFF) 2860 if (t->mode == 0xFF)
2864 return NULL; 2861 return NULL;
2865 return t; 2862 return t;
@@ -7590,6 +7587,13 @@ EXPORT_SYMBOL_GPL(ata_std_dev_select);
7590EXPORT_SYMBOL_GPL(sata_print_link_status); 7587EXPORT_SYMBOL_GPL(sata_print_link_status);
7591EXPORT_SYMBOL_GPL(ata_tf_to_fis); 7588EXPORT_SYMBOL_GPL(ata_tf_to_fis);
7592EXPORT_SYMBOL_GPL(ata_tf_from_fis); 7589EXPORT_SYMBOL_GPL(ata_tf_from_fis);
7590EXPORT_SYMBOL_GPL(ata_pack_xfermask);
7591EXPORT_SYMBOL_GPL(ata_unpack_xfermask);
7592EXPORT_SYMBOL_GPL(ata_xfer_mask2mode);
7593EXPORT_SYMBOL_GPL(ata_xfer_mode2mask);
7594EXPORT_SYMBOL_GPL(ata_xfer_mode2shift);
7595EXPORT_SYMBOL_GPL(ata_mode_string);
7596EXPORT_SYMBOL_GPL(ata_id_xfermask);
7593EXPORT_SYMBOL_GPL(ata_check_status); 7597EXPORT_SYMBOL_GPL(ata_check_status);
7594EXPORT_SYMBOL_GPL(ata_altstatus); 7598EXPORT_SYMBOL_GPL(ata_altstatus);
7595EXPORT_SYMBOL_GPL(ata_exec_command); 7599EXPORT_SYMBOL_GPL(ata_exec_command);
@@ -7655,6 +7659,7 @@ EXPORT_SYMBOL_GPL(ata_id_to_dma_mode);
7655EXPORT_SYMBOL_GPL(ata_scsi_simulate); 7659EXPORT_SYMBOL_GPL(ata_scsi_simulate);
7656 7660
7657EXPORT_SYMBOL_GPL(ata_pio_need_iordy); 7661EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
7662EXPORT_SYMBOL_GPL(ata_timing_find_mode);
7658EXPORT_SYMBOL_GPL(ata_timing_compute); 7663EXPORT_SYMBOL_GPL(ata_timing_compute);
7659EXPORT_SYMBOL_GPL(ata_timing_merge); 7664EXPORT_SYMBOL_GPL(ata_timing_merge);
7660 7665