diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2013-06-30 16:01:32 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-07-16 07:46:56 -0400 |
commit | dc34e7e1a701134c2639dc7af78dc91055616477 (patch) | |
tree | ec38a800ee44f717feaead5906cfb75477f68bf7 /include/linux/libata.h | |
parent | ad81f0545ef01ea651886dddac4bef6cec930092 (diff) |
libata: move 'struct ata_taskfile' and friends from ata.h to libata.h
Move 'struct ata_taskfile', ata_prot_flags() and their friends from
<linux/ata.h> to <linux/libata.h>. They were misplaced from the beginning, as
<linux/ata.h> should cover ATA/ATAPI and related standards only -- to which the
aforementioned structure and function have only remote relation.
I would have moved 'enum ata_tf_protocols' closely related to 'struct
ata_taskfile' but it unfortunately gets used by 'drivers/ide/ide-ioctls.c'...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 4ea55bb45deb..283d66bc603c 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -138,6 +138,22 @@ enum { | |||
138 | ATA_SHT_THIS_ID = -1, | 138 | ATA_SHT_THIS_ID = -1, |
139 | ATA_SHT_USE_CLUSTERING = 1, | 139 | ATA_SHT_USE_CLUSTERING = 1, |
140 | 140 | ||
141 | /* struct ata_taskfile flags */ | ||
142 | ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */ | ||
143 | ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ | ||
144 | ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ | ||
145 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ | ||
146 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ | ||
147 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ | ||
148 | ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ | ||
149 | |||
150 | /* protocol flags */ | ||
151 | ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */ | ||
152 | ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */ | ||
153 | ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA, | ||
154 | ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */ | ||
155 | ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */ | ||
156 | |||
141 | /* struct ata_device stuff */ | 157 | /* struct ata_device stuff */ |
142 | ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */ | 158 | ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */ |
143 | ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ | 159 | ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ |
@@ -518,6 +534,29 @@ enum sw_activity { | |||
518 | BLINK_OFF, | 534 | BLINK_OFF, |
519 | }; | 535 | }; |
520 | 536 | ||
537 | struct ata_taskfile { | ||
538 | unsigned long flags; /* ATA_TFLAG_xxx */ | ||
539 | u8 protocol; /* ATA_PROT_xxx */ | ||
540 | |||
541 | u8 ctl; /* control reg */ | ||
542 | |||
543 | u8 hob_feature; /* additional data */ | ||
544 | u8 hob_nsect; /* to support LBA48 */ | ||
545 | u8 hob_lbal; | ||
546 | u8 hob_lbam; | ||
547 | u8 hob_lbah; | ||
548 | |||
549 | u8 feature; | ||
550 | u8 nsect; | ||
551 | u8 lbal; | ||
552 | u8 lbam; | ||
553 | u8 lbah; | ||
554 | |||
555 | u8 device; | ||
556 | |||
557 | u8 command; /* IO operation */ | ||
558 | }; | ||
559 | |||
521 | #ifdef CONFIG_ATA_SFF | 560 | #ifdef CONFIG_ATA_SFF |
522 | struct ata_ioports { | 561 | struct ata_ioports { |
523 | void __iomem *cmd_addr; | 562 | void __iomem *cmd_addr; |
@@ -959,6 +998,69 @@ extern const unsigned long sata_deb_timing_long[]; | |||
959 | extern struct ata_port_operations ata_dummy_port_ops; | 998 | extern struct ata_port_operations ata_dummy_port_ops; |
960 | extern const struct ata_port_info ata_dummy_port_info; | 999 | extern const struct ata_port_info ata_dummy_port_info; |
961 | 1000 | ||
1001 | /* | ||
1002 | * protocol tests | ||
1003 | */ | ||
1004 | static inline unsigned int ata_prot_flags(u8 prot) | ||
1005 | { | ||
1006 | switch (prot) { | ||
1007 | case ATA_PROT_NODATA: | ||
1008 | return 0; | ||
1009 | case ATA_PROT_PIO: | ||
1010 | return ATA_PROT_FLAG_PIO; | ||
1011 | case ATA_PROT_DMA: | ||
1012 | return ATA_PROT_FLAG_DMA; | ||
1013 | case ATA_PROT_NCQ: | ||
1014 | return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ; | ||
1015 | case ATAPI_PROT_NODATA: | ||
1016 | return ATA_PROT_FLAG_ATAPI; | ||
1017 | case ATAPI_PROT_PIO: | ||
1018 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO; | ||
1019 | case ATAPI_PROT_DMA: | ||
1020 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA; | ||
1021 | } | ||
1022 | return 0; | ||
1023 | } | ||
1024 | |||
1025 | static inline int ata_is_atapi(u8 prot) | ||
1026 | { | ||
1027 | return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI; | ||
1028 | } | ||
1029 | |||
1030 | static inline int ata_is_nodata(u8 prot) | ||
1031 | { | ||
1032 | return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA); | ||
1033 | } | ||
1034 | |||
1035 | static inline int ata_is_pio(u8 prot) | ||
1036 | { | ||
1037 | return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO; | ||
1038 | } | ||
1039 | |||
1040 | static inline int ata_is_dma(u8 prot) | ||
1041 | { | ||
1042 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA; | ||
1043 | } | ||
1044 | |||
1045 | static inline int ata_is_ncq(u8 prot) | ||
1046 | { | ||
1047 | return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ; | ||
1048 | } | ||
1049 | |||
1050 | static inline int ata_is_data(u8 prot) | ||
1051 | { | ||
1052 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA; | ||
1053 | } | ||
1054 | |||
1055 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | ||
1056 | { | ||
1057 | return (tf->command == ATA_CMD_READ_MULTI) || | ||
1058 | (tf->command == ATA_CMD_WRITE_MULTI) || | ||
1059 | (tf->command == ATA_CMD_READ_MULTI_EXT) || | ||
1060 | (tf->command == ATA_CMD_WRITE_MULTI_EXT) || | ||
1061 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); | ||
1062 | } | ||
1063 | |||
962 | static inline const unsigned long * | 1064 | static inline const unsigned long * |
963 | sata_ehc_deb_timing(struct ata_eh_context *ehc) | 1065 | sata_ehc_deb_timing(struct ata_eh_context *ehc) |
964 | { | 1066 | { |