diff options
-rw-r--r-- | drivers/ata/libata-core.c | 33 | ||||
-rw-r--r-- | include/linux/libata.h | 10 |
2 files changed, 29 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 | */ |
457 | static unsigned int ata_pack_xfermask(unsigned int pio_mask, | 457 | unsigned 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 | */ |
476 | static void ata_unpack_xfermask(unsigned int xfer_mask, | 475 | void 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 | */ |
512 | static u8 ata_xfer_mask2mode(unsigned int xfer_mask) | 509 | u8 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 | */ |
535 | static unsigned int ata_xfer_mode2mask(u8 xfer_mode) | 532 | unsigned 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 | */ |
557 | static int ata_xfer_mode2shift(unsigned int xfer_mode) | 554 | int 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 | */ |
581 | static const char *ata_mode_string(unsigned int xfer_mask) | 578 | const 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 | */ |
1471 | static unsigned int ata_id_xfermask(const u16 *id) | 1468 | unsigned 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 | ||
2858 | static const struct ata_timing *ata_timing_find_mode(unsigned short speed) | 2855 | const 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); | |||
7590 | EXPORT_SYMBOL_GPL(sata_print_link_status); | 7587 | EXPORT_SYMBOL_GPL(sata_print_link_status); |
7591 | EXPORT_SYMBOL_GPL(ata_tf_to_fis); | 7588 | EXPORT_SYMBOL_GPL(ata_tf_to_fis); |
7592 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); | 7589 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); |
7590 | EXPORT_SYMBOL_GPL(ata_pack_xfermask); | ||
7591 | EXPORT_SYMBOL_GPL(ata_unpack_xfermask); | ||
7592 | EXPORT_SYMBOL_GPL(ata_xfer_mask2mode); | ||
7593 | EXPORT_SYMBOL_GPL(ata_xfer_mode2mask); | ||
7594 | EXPORT_SYMBOL_GPL(ata_xfer_mode2shift); | ||
7595 | EXPORT_SYMBOL_GPL(ata_mode_string); | ||
7596 | EXPORT_SYMBOL_GPL(ata_id_xfermask); | ||
7593 | EXPORT_SYMBOL_GPL(ata_check_status); | 7597 | EXPORT_SYMBOL_GPL(ata_check_status); |
7594 | EXPORT_SYMBOL_GPL(ata_altstatus); | 7598 | EXPORT_SYMBOL_GPL(ata_altstatus); |
7595 | EXPORT_SYMBOL_GPL(ata_exec_command); | 7599 | EXPORT_SYMBOL_GPL(ata_exec_command); |
@@ -7655,6 +7659,7 @@ EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); | |||
7655 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 7659 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
7656 | 7660 | ||
7657 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); | 7661 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); |
7662 | EXPORT_SYMBOL_GPL(ata_timing_find_mode); | ||
7658 | EXPORT_SYMBOL_GPL(ata_timing_compute); | 7663 | EXPORT_SYMBOL_GPL(ata_timing_compute); |
7659 | EXPORT_SYMBOL_GPL(ata_timing_merge); | 7664 | EXPORT_SYMBOL_GPL(ata_timing_merge); |
7660 | 7665 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 131fb6625e14..083dd77b120d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -851,6 +851,15 @@ extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | |||
851 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, | 851 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
852 | u8 pmp, int is_cmd, u8 *fis); | 852 | u8 pmp, int is_cmd, u8 *fis); |
853 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); | 853 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); |
854 | extern unsigned int ata_pack_xfermask(unsigned int pio_mask, | ||
855 | unsigned int mwdma_mask, unsigned int udma_mask); | ||
856 | extern void ata_unpack_xfermask(unsigned int xfer_mask, unsigned int *pio_mask, | ||
857 | unsigned int *mwdma_mask, unsigned int *udma_mask); | ||
858 | extern u8 ata_xfer_mask2mode(unsigned int xfer_mask); | ||
859 | extern unsigned int ata_xfer_mode2mask(u8 xfer_mode); | ||
860 | extern int ata_xfer_mode2shift(unsigned int xfer_mode); | ||
861 | extern const char *ata_mode_string(unsigned int xfer_mask); | ||
862 | extern unsigned int ata_id_xfermask(const u16 *id); | ||
854 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); | 863 | extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); |
855 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); | 864 | extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); |
856 | extern u8 ata_check_status(struct ata_port *ap); | 865 | extern u8 ata_check_status(struct ata_port *ap); |
@@ -920,6 +929,7 @@ extern int ata_cable_unknown(struct ata_port *ap); | |||
920 | */ | 929 | */ |
921 | 930 | ||
922 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); | 931 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); |
932 | extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); | ||
923 | extern int ata_timing_compute(struct ata_device *, unsigned short, | 933 | extern int ata_timing_compute(struct ata_device *, unsigned short, |
924 | struct ata_timing *, int, int); | 934 | struct ata_timing *, int, int); |
925 | extern void ata_timing_merge(const struct ata_timing *, | 935 | extern void ata_timing_merge(const struct ata_timing *, |