diff options
author | Alan <alan@lxorguk.ukuu.org.uk> | 2007-02-20 13:01:59 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-25 15:41:40 -0500 |
commit | 10305f0f8e642590c69674d08bd22accef610aed (patch) | |
tree | 81caa503dd092150229f63efbb2f59ad924a8bc7 | |
parent | 098cdff3d40286f87062c17cd07e98ca7ad94184 (diff) |
Add id_to_dma_mode function for printing DMA modes
Also export dev_disable as this is needed by drivers doing slave decode
filtering, which will follow shortly
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/libata-core.c | 44 | ||||
-rw-r--r-- | include/linux/libata.h | 2 |
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 | |||
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 | ||
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, | |||
788 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 788 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
789 | unsigned int n_elem); | 789 | unsigned int n_elem); |
790 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); | 790 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); |
791 | extern void ata_dev_disable(struct ata_device *adev); | ||
791 | extern void ata_id_string(const u16 *id, unsigned char *s, | 792 | extern void ata_id_string(const u16 *id, unsigned char *s, |
792 | unsigned int ofs, unsigned int len); | 793 | unsigned int ofs, unsigned int len); |
793 | extern void ata_id_c_string(const u16 *id, unsigned char *s, | 794 | extern 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); |
796 | extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown); | ||
795 | extern unsigned long ata_device_blacklisted(const struct ata_device *dev); | 797 | extern unsigned long ata_device_blacklisted(const struct ata_device *dev); |
796 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 798 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
797 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); | 799 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); |