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 | |
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')
-rw-r--r-- | include/linux/ata.h | 102 | ||||
-rw-r--r-- | include/linux/libata.h | 102 |
2 files changed, 102 insertions, 102 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index ee0bd9524055..f63fb1afc5cc 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -446,22 +446,6 @@ enum { | |||
446 | SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */ | 446 | SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */ |
447 | SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */ | 447 | SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */ |
448 | SERR_DEV_XCHG = (1 << 26), /* device exchanged */ | 448 | SERR_DEV_XCHG = (1 << 26), /* device exchanged */ |
449 | |||
450 | /* struct ata_taskfile flags */ | ||
451 | ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */ | ||
452 | ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ | ||
453 | ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ | ||
454 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ | ||
455 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ | ||
456 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ | ||
457 | ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ | ||
458 | |||
459 | /* protocol flags */ | ||
460 | ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */ | ||
461 | ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */ | ||
462 | ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA, | ||
463 | ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */ | ||
464 | ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */ | ||
465 | }; | 449 | }; |
466 | 450 | ||
467 | enum ata_tf_protocols { | 451 | enum ata_tf_protocols { |
@@ -488,83 +472,6 @@ struct ata_bmdma_prd { | |||
488 | __le32 flags_len; | 472 | __le32 flags_len; |
489 | }; | 473 | }; |
490 | 474 | ||
491 | struct ata_taskfile { | ||
492 | unsigned long flags; /* ATA_TFLAG_xxx */ | ||
493 | u8 protocol; /* ATA_PROT_xxx */ | ||
494 | |||
495 | u8 ctl; /* control reg */ | ||
496 | |||
497 | u8 hob_feature; /* additional data */ | ||
498 | u8 hob_nsect; /* to support LBA48 */ | ||
499 | u8 hob_lbal; | ||
500 | u8 hob_lbam; | ||
501 | u8 hob_lbah; | ||
502 | |||
503 | u8 feature; | ||
504 | u8 nsect; | ||
505 | u8 lbal; | ||
506 | u8 lbam; | ||
507 | u8 lbah; | ||
508 | |||
509 | u8 device; | ||
510 | |||
511 | u8 command; /* IO operation */ | ||
512 | }; | ||
513 | |||
514 | /* | ||
515 | * protocol tests | ||
516 | */ | ||
517 | static inline unsigned int ata_prot_flags(u8 prot) | ||
518 | { | ||
519 | switch (prot) { | ||
520 | case ATA_PROT_NODATA: | ||
521 | return 0; | ||
522 | case ATA_PROT_PIO: | ||
523 | return ATA_PROT_FLAG_PIO; | ||
524 | case ATA_PROT_DMA: | ||
525 | return ATA_PROT_FLAG_DMA; | ||
526 | case ATA_PROT_NCQ: | ||
527 | return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ; | ||
528 | case ATAPI_PROT_NODATA: | ||
529 | return ATA_PROT_FLAG_ATAPI; | ||
530 | case ATAPI_PROT_PIO: | ||
531 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO; | ||
532 | case ATAPI_PROT_DMA: | ||
533 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA; | ||
534 | } | ||
535 | return 0; | ||
536 | } | ||
537 | |||
538 | static inline int ata_is_atapi(u8 prot) | ||
539 | { | ||
540 | return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI; | ||
541 | } | ||
542 | |||
543 | static inline int ata_is_nodata(u8 prot) | ||
544 | { | ||
545 | return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA); | ||
546 | } | ||
547 | |||
548 | static inline int ata_is_pio(u8 prot) | ||
549 | { | ||
550 | return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO; | ||
551 | } | ||
552 | |||
553 | static inline int ata_is_dma(u8 prot) | ||
554 | { | ||
555 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA; | ||
556 | } | ||
557 | |||
558 | static inline int ata_is_ncq(u8 prot) | ||
559 | { | ||
560 | return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ; | ||
561 | } | ||
562 | |||
563 | static inline int ata_is_data(u8 prot) | ||
564 | { | ||
565 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA; | ||
566 | } | ||
567 | |||
568 | /* | 475 | /* |
569 | * id tests | 476 | * id tests |
570 | */ | 477 | */ |
@@ -1060,15 +967,6 @@ static inline unsigned ata_set_lba_range_entries(void *_buffer, | |||
1060 | return used_bytes; | 967 | return used_bytes; |
1061 | } | 968 | } |
1062 | 969 | ||
1063 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | ||
1064 | { | ||
1065 | return (tf->command == ATA_CMD_READ_MULTI) || | ||
1066 | (tf->command == ATA_CMD_WRITE_MULTI) || | ||
1067 | (tf->command == ATA_CMD_READ_MULTI_EXT) || | ||
1068 | (tf->command == ATA_CMD_WRITE_MULTI_EXT) || | ||
1069 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); | ||
1070 | } | ||
1071 | |||
1072 | static inline bool ata_ok(u8 status) | 970 | static inline bool ata_ok(u8 status) |
1073 | { | 971 | { |
1074 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) | 972 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) |
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 | { |