aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r--include/linux/ata.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 81d9adeb819e..4c3f50070033 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -30,6 +30,7 @@
30#define __LINUX_ATA_H__ 30#define __LINUX_ATA_H__
31 31
32#include <linux/types.h> 32#include <linux/types.h>
33#include <asm/byteorder.h>
33 34
34/* defines only for the constants which don't work well as enums */ 35/* defines only for the constants which don't work well as enums */
35#define ATA_DMA_BOUNDARY 0xffffUL 36#define ATA_DMA_BOUNDARY 0xffffUL
@@ -781,6 +782,26 @@ static inline int atapi_id_dmadir(const u16 *dev_id)
781 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); 782 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
782} 783}
783 784
785static inline void ata_id_to_hd_driveid(u16 *id)
786{
787#ifdef __BIG_ENDIAN
788 /* accessed in struct hd_driveid as 8-bit values */
789 id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]);
790 id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]);
791 id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]);
792 id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]);
793 id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]);
794
795 /* as 32-bit values */
796 *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
797 *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG);
798
799 /* as 64-bit value */
800 *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] =
801 ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
802#endif
803}
804
784static inline int is_multi_taskfile(struct ata_taskfile *tf) 805static inline int is_multi_taskfile(struct ata_taskfile *tf)
785{ 806{
786 return (tf->command == ATA_CMD_READ_MULTI) || 807 return (tf->command == ATA_CMD_READ_MULTI) ||