aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-core.c44
-rw-r--r--include/linux/libata.h2
2 files changed, 46 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
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1f2099de0511..045fb3a72d59 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -788,10 +788,12 @@ extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
788extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 788extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
789 unsigned int n_elem); 789 unsigned int n_elem);
790extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 790extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
791extern void ata_dev_disable(struct ata_device *adev);
791extern void ata_id_string(const u16 *id, unsigned char *s, 792extern void ata_id_string(const u16 *id, unsigned char *s,
792 unsigned int ofs, unsigned int len); 793 unsigned int ofs, unsigned int len);
793extern void ata_id_c_string(const u16 *id, unsigned char *s, 794extern void ata_id_c_string(const u16 *id, unsigned char *s,
794 unsigned int ofs, unsigned int len); 795 unsigned int ofs, unsigned int len);
796extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown);
795extern unsigned long ata_device_blacklisted(const struct ata_device *dev); 797extern unsigned long ata_device_blacklisted(const struct ata_device *dev);
796extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 798extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
797extern void ata_bmdma_start (struct ata_queued_cmd *qc); 799extern void ata_bmdma_start (struct ata_queued_cmd *qc);