diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index d3b4e25074c1..9825a90d4169 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -824,6 +824,48 @@ static u64 ata_id_n_sectors(const u16 *id) | |||
824 | } | 824 | } |
825 | 825 | ||
826 | /** | 826 | /** |
827 | * ata_id_to_dma_mode - Identify DMA mode from id block | ||
828 | * @dev: device to identify | ||
829 | * @mode: mode to assume if we cannot tell | ||
830 | * | ||
831 | * Set up the timing values for the device based upon the identify | ||
832 | * reported values for the DMA mode. This function is used by drivers | ||
833 | * which rely upon firmware configured modes, but wish to report the | ||
834 | * mode correctly when possible. | ||
835 | * | ||
836 | * In addition we emit similarly formatted messages to the default | ||
837 | * ata_dev_set_mode handler, in order to provide consistency of | ||
838 | * presentation. | ||
839 | */ | ||
840 | |||
841 | void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown) | ||
842 | { | ||
843 | unsigned int mask; | ||
844 | u8 mode; | ||
845 | |||
846 | /* Pack the DMA modes */ | ||
847 | mask = ((dev->id[63] >> 8) << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA; | ||
848 | if (dev->id[53] & 0x04) | ||
849 | mask |= ((dev->id[88] >> 8) << ATA_SHIFT_UDMA) & ATA_MASK_UDMA; | ||
850 | |||
851 | /* Select the mode in use */ | ||
852 | mode = ata_xfer_mask2mode(mask); | ||
853 | |||
854 | if (mode != 0) { | ||
855 | ata_dev_printk(dev, KERN_INFO, "configured for %s\n", | ||
856 | ata_mode_string(mask)); | ||
857 | } else { | ||
858 | /* SWDMA perhaps ? */ | ||
859 | mode = unknown; | ||
860 | ata_dev_printk(dev, KERN_INFO, "configured for DMA\n"); | ||
861 | } | ||
862 | |||
863 | /* Configure the device reporting */ | ||
864 | dev->xfer_mode = mode; | ||
865 | dev->xfer_shift = ata_xfer_mode2shift(mode); | ||
866 | } | ||
867 | |||
868 | /** | ||
827 | * ata_noop_dev_select - Select device 0/1 on ATA bus | 869 | * ata_noop_dev_select - Select device 0/1 on ATA bus |
828 | * @ap: ATA channel to manipulate | 870 | * @ap: ATA channel to manipulate |
829 | * @device: ATA device (numbered from zero) to select | 871 | * @device: ATA device (numbered from zero) to select |
@@ -6276,6 +6318,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma_drive_eh); | |||
6276 | EXPORT_SYMBOL_GPL(ata_bmdma_error_handler); | 6318 | EXPORT_SYMBOL_GPL(ata_bmdma_error_handler); |
6277 | EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); | 6319 | EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); |
6278 | EXPORT_SYMBOL_GPL(ata_port_probe); | 6320 | EXPORT_SYMBOL_GPL(ata_port_probe); |
6321 | EXPORT_SYMBOL_GPL(ata_dev_disable); | ||
6279 | EXPORT_SYMBOL_GPL(sata_set_spd); | 6322 | EXPORT_SYMBOL_GPL(sata_set_spd); |
6280 | EXPORT_SYMBOL_GPL(sata_phy_debounce); | 6323 | EXPORT_SYMBOL_GPL(sata_phy_debounce); |
6281 | EXPORT_SYMBOL_GPL(sata_phy_resume); | 6324 | EXPORT_SYMBOL_GPL(sata_phy_resume); |
@@ -6310,6 +6353,7 @@ EXPORT_SYMBOL_GPL(ata_host_suspend); | |||
6310 | EXPORT_SYMBOL_GPL(ata_host_resume); | 6353 | EXPORT_SYMBOL_GPL(ata_host_resume); |
6311 | EXPORT_SYMBOL_GPL(ata_id_string); | 6354 | EXPORT_SYMBOL_GPL(ata_id_string); |
6312 | EXPORT_SYMBOL_GPL(ata_id_c_string); | 6355 | EXPORT_SYMBOL_GPL(ata_id_c_string); |
6356 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); | ||
6313 | EXPORT_SYMBOL_GPL(ata_device_blacklisted); | 6357 | EXPORT_SYMBOL_GPL(ata_device_blacklisted); |
6314 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 6358 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
6315 | 6359 | ||