aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c44
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
841void 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);
6276EXPORT_SYMBOL_GPL(ata_bmdma_error_handler); 6318EXPORT_SYMBOL_GPL(ata_bmdma_error_handler);
6277EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); 6319EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd);
6278EXPORT_SYMBOL_GPL(ata_port_probe); 6320EXPORT_SYMBOL_GPL(ata_port_probe);
6321EXPORT_SYMBOL_GPL(ata_dev_disable);
6279EXPORT_SYMBOL_GPL(sata_set_spd); 6322EXPORT_SYMBOL_GPL(sata_set_spd);
6280EXPORT_SYMBOL_GPL(sata_phy_debounce); 6323EXPORT_SYMBOL_GPL(sata_phy_debounce);
6281EXPORT_SYMBOL_GPL(sata_phy_resume); 6324EXPORT_SYMBOL_GPL(sata_phy_resume);
@@ -6310,6 +6353,7 @@ EXPORT_SYMBOL_GPL(ata_host_suspend);
6310EXPORT_SYMBOL_GPL(ata_host_resume); 6353EXPORT_SYMBOL_GPL(ata_host_resume);
6311EXPORT_SYMBOL_GPL(ata_id_string); 6354EXPORT_SYMBOL_GPL(ata_id_string);
6312EXPORT_SYMBOL_GPL(ata_id_c_string); 6355EXPORT_SYMBOL_GPL(ata_id_c_string);
6356EXPORT_SYMBOL_GPL(ata_id_to_dma_mode);
6313EXPORT_SYMBOL_GPL(ata_device_blacklisted); 6357EXPORT_SYMBOL_GPL(ata_device_blacklisted);
6314EXPORT_SYMBOL_GPL(ata_scsi_simulate); 6358EXPORT_SYMBOL_GPL(ata_scsi_simulate);
6315 6359