diff options
| author | Eric Paris <eparis@redhat.com> | 2013-11-22 18:57:08 -0500 |
|---|---|---|
| committer | Eric Paris <eparis@redhat.com> | 2013-11-22 18:57:54 -0500 |
| commit | fc582aef7dcc27a7120cf232c1e76c569c7b6eab (patch) | |
| tree | 7d275dd4ceab6067b91e9a25a5f6338b425fbccd /include/linux/libata.h | |
| parent | 9175c9d2aed528800175ef81c90569d00d23f9be (diff) | |
| parent | 5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52 (diff) | |
Merge tag 'v3.12'
Linux 3.12
Conflicts:
fs/exec.c
Diffstat (limited to 'include/linux/libata.h')
| -rw-r--r-- | include/linux/libata.h | 120 |
1 files changed, 118 insertions, 2 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 4ea55bb45deb..0e23c26485f4 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 */ |
| @@ -156,6 +172,7 @@ enum { | |||
| 156 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ | 172 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ |
| 157 | ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ | 173 | ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ |
| 158 | ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ | 174 | ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ |
| 175 | ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */ | ||
| 159 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, | 176 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, |
| 160 | 177 | ||
| 161 | ATA_DFLAG_DETACH = (1 << 24), | 178 | ATA_DFLAG_DETACH = (1 << 24), |
| @@ -207,6 +224,7 @@ enum { | |||
| 207 | ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ | 224 | ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ |
| 208 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ | 225 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ |
| 209 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ | 226 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ |
| 227 | ATA_FLAG_FPDMA_AUX = (1 << 20), /* controller supports H2DFIS aux field */ | ||
| 210 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure | 228 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure |
| 211 | * management */ | 229 | * management */ |
| 212 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | 230 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity |
| @@ -518,6 +536,33 @@ enum sw_activity { | |||
| 518 | BLINK_OFF, | 536 | BLINK_OFF, |
| 519 | }; | 537 | }; |
| 520 | 538 | ||
| 539 | struct ata_taskfile { | ||
| 540 | unsigned long flags; /* ATA_TFLAG_xxx */ | ||
| 541 | u8 protocol; /* ATA_PROT_xxx */ | ||
| 542 | |||
| 543 | u8 ctl; /* control reg */ | ||
| 544 | |||
| 545 | u8 hob_feature; /* additional data */ | ||
| 546 | u8 hob_nsect; /* to support LBA48 */ | ||
| 547 | u8 hob_lbal; | ||
| 548 | u8 hob_lbam; | ||
| 549 | u8 hob_lbah; | ||
| 550 | |||
| 551 | u8 feature; | ||
| 552 | u8 nsect; | ||
| 553 | u8 lbal; | ||
| 554 | u8 lbam; | ||
| 555 | u8 lbah; | ||
| 556 | |||
| 557 | u8 device; | ||
| 558 | |||
| 559 | u8 command; /* IO operation */ | ||
| 560 | |||
| 561 | u32 auxiliary; /* auxiliary field */ | ||
| 562 | /* from SATA 3.1 and */ | ||
| 563 | /* ATA-8 ACS-3 */ | ||
| 564 | }; | ||
| 565 | |||
| 521 | #ifdef CONFIG_ATA_SFF | 566 | #ifdef CONFIG_ATA_SFF |
| 522 | struct ata_ioports { | 567 | struct ata_ioports { |
| 523 | void __iomem *cmd_addr; | 568 | void __iomem *cmd_addr; |
| @@ -660,6 +705,9 @@ struct ata_device { | |||
| 660 | /* DEVSLP Timing Variables from Identify Device Data Log */ | 705 | /* DEVSLP Timing Variables from Identify Device Data Log */ |
| 661 | u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; | 706 | u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; |
| 662 | 707 | ||
| 708 | /* NCQ send and receive log subcommand support */ | ||
| 709 | u8 ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_SIZE]; | ||
| 710 | |||
| 663 | /* error history */ | 711 | /* error history */ |
| 664 | int spdn_cnt; | 712 | int spdn_cnt; |
| 665 | /* ering is CLEAR_END, read comment above CLEAR_END */ | 713 | /* ering is CLEAR_END, read comment above CLEAR_END */ |
| @@ -959,6 +1007,69 @@ extern const unsigned long sata_deb_timing_long[]; | |||
| 959 | extern struct ata_port_operations ata_dummy_port_ops; | 1007 | extern struct ata_port_operations ata_dummy_port_ops; |
| 960 | extern const struct ata_port_info ata_dummy_port_info; | 1008 | extern const struct ata_port_info ata_dummy_port_info; |
| 961 | 1009 | ||
| 1010 | /* | ||
| 1011 | * protocol tests | ||
| 1012 | */ | ||
| 1013 | static inline unsigned int ata_prot_flags(u8 prot) | ||
| 1014 | { | ||
| 1015 | switch (prot) { | ||
| 1016 | case ATA_PROT_NODATA: | ||
| 1017 | return 0; | ||
| 1018 | case ATA_PROT_PIO: | ||
| 1019 | return ATA_PROT_FLAG_PIO; | ||
| 1020 | case ATA_PROT_DMA: | ||
| 1021 | return ATA_PROT_FLAG_DMA; | ||
| 1022 | case ATA_PROT_NCQ: | ||
| 1023 | return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ; | ||
| 1024 | case ATAPI_PROT_NODATA: | ||
| 1025 | return ATA_PROT_FLAG_ATAPI; | ||
| 1026 | case ATAPI_PROT_PIO: | ||
| 1027 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO; | ||
| 1028 | case ATAPI_PROT_DMA: | ||
| 1029 | return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA; | ||
| 1030 | } | ||
| 1031 | return 0; | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | static inline int ata_is_atapi(u8 prot) | ||
| 1035 | { | ||
| 1036 | return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI; | ||
| 1037 | } | ||
| 1038 | |||
| 1039 | static inline int ata_is_nodata(u8 prot) | ||
| 1040 | { | ||
| 1041 | return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA); | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | static inline int ata_is_pio(u8 prot) | ||
| 1045 | { | ||
| 1046 | return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO; | ||
| 1047 | } | ||
| 1048 | |||
| 1049 | static inline int ata_is_dma(u8 prot) | ||
| 1050 | { | ||
| 1051 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA; | ||
| 1052 | } | ||
| 1053 | |||
| 1054 | static inline int ata_is_ncq(u8 prot) | ||
| 1055 | { | ||
| 1056 | return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ; | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | static inline int ata_is_data(u8 prot) | ||
| 1060 | { | ||
| 1061 | return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA; | ||
| 1062 | } | ||
| 1063 | |||
| 1064 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | ||
| 1065 | { | ||
| 1066 | return (tf->command == ATA_CMD_READ_MULTI) || | ||
| 1067 | (tf->command == ATA_CMD_WRITE_MULTI) || | ||
| 1068 | (tf->command == ATA_CMD_READ_MULTI_EXT) || | ||
| 1069 | (tf->command == ATA_CMD_WRITE_MULTI_EXT) || | ||
| 1070 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); | ||
| 1071 | } | ||
| 1072 | |||
| 962 | static inline const unsigned long * | 1073 | static inline const unsigned long * |
| 963 | sata_ehc_deb_timing(struct ata_eh_context *ehc) | 1074 | sata_ehc_deb_timing(struct ata_eh_context *ehc) |
| 964 | { | 1075 | { |
| @@ -1142,8 +1253,6 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm); | |||
| 1142 | int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); | 1253 | int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); |
| 1143 | unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev, | 1254 | unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev, |
| 1144 | const struct ata_acpi_gtm *gtm); | 1255 | const struct ata_acpi_gtm *gtm); |
| 1145 | acpi_handle ata_ap_acpi_handle(struct ata_port *ap); | ||
| 1146 | acpi_handle ata_dev_acpi_handle(struct ata_device *dev); | ||
| 1147 | int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm); | 1256 | int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm); |
| 1148 | #else | 1257 | #else |
| 1149 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) | 1258 | static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) |
| @@ -1497,6 +1606,13 @@ static inline int ata_ncq_enabled(struct ata_device *dev) | |||
| 1497 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; | 1606 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; |
| 1498 | } | 1607 | } |
| 1499 | 1608 | ||
| 1609 | static inline bool ata_fpdma_dsm_supported(struct ata_device *dev) | ||
| 1610 | { | ||
| 1611 | return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) && | ||
| 1612 | (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] & | ||
| 1613 | ATA_LOG_NCQ_SEND_RECV_DSM_TRIM); | ||
| 1614 | } | ||
| 1615 | |||
| 1500 | static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) | 1616 | static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) |
| 1501 | { | 1617 | { |
| 1502 | qc->tf.ctl |= ATA_NIEN; | 1618 | qc->tf.ctl |= ATA_NIEN; |
