.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2003-2005 Red Hat, Inc. All rights reserved. |
---|
3 | 4 | * Copyright 2003-2005 Jeff Garzik |
---|
4 | 5 | * |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2, or (at your option) |
---|
9 | | - * any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; see the file COPYING. If not, write to |
---|
18 | | - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
19 | | - * |
---|
20 | | - * |
---|
21 | 6 | * libata documentation is available via 'make {ps|pdf}docs', |
---|
22 | 7 | * as Documentation/driver-api/libata.rst |
---|
23 | | - * |
---|
24 | 8 | */ |
---|
25 | 9 | |
---|
26 | 10 | #ifndef __LINUX_LIBATA_H__ |
---|
.. | .. |
---|
73 | 57 | #define DPRINTK(fmt, args...) |
---|
74 | 58 | #define VPRINTK(fmt, args...) |
---|
75 | 59 | #endif /* ATA_DEBUG */ |
---|
76 | | - |
---|
77 | | -#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args) |
---|
78 | 60 | |
---|
79 | 61 | #define ata_print_version_once(dev, version) \ |
---|
80 | 62 | ({ \ |
---|
.. | .. |
---|
136 | 118 | |
---|
137 | 119 | ATA_SHT_EMULATED = 1, |
---|
138 | 120 | ATA_SHT_THIS_ID = -1, |
---|
139 | | - ATA_SHT_USE_CLUSTERING = 1, |
---|
140 | 121 | |
---|
141 | 122 | /* struct ata_taskfile flags */ |
---|
142 | 123 | ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */ |
---|
.. | .. |
---|
194 | 175 | ATA_DEV_NONE = 11, /* no device */ |
---|
195 | 176 | |
---|
196 | 177 | /* struct ata_link flags */ |
---|
| 178 | + /* NOTE: struct ata_force_param currently stores lflags in u16 */ |
---|
197 | 179 | ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */ |
---|
198 | 180 | ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ |
---|
199 | 181 | ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ |
---|
.. | .. |
---|
205 | 187 | ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */ |
---|
206 | 188 | ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */ |
---|
207 | 189 | ATA_LFLAG_CHANGED = (1 << 10), /* LPM state changed on this link */ |
---|
208 | | - ATA_LFLAG_NO_DB_DELAY = (1 << 11), /* no debounce delay on link resume */ |
---|
| 190 | + ATA_LFLAG_NO_DEBOUNCE_DELAY = (1 << 11), /* no debounce delay on link resume */ |
---|
209 | 191 | |
---|
210 | 192 | /* struct ata_port flags */ |
---|
211 | 193 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ |
---|
.. | .. |
---|
278 | 260 | ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */ |
---|
279 | 261 | ATA_HOST_IGNORE_ATA = (1 << 3), /* Ignore ATA devices on this host. */ |
---|
280 | 262 | |
---|
| 263 | + ATA_HOST_NO_PART = (1 << 4), /* Host does not support partial */ |
---|
| 264 | + ATA_HOST_NO_SSC = (1 << 5), /* Host does not support slumber */ |
---|
| 265 | + ATA_HOST_NO_DEVSLP = (1 << 6), /* Host does not support devslp */ |
---|
| 266 | + |
---|
281 | 267 | /* bits 24:31 of host->flags are reserved for LLD specific flags */ |
---|
282 | 268 | |
---|
283 | 269 | /* various lengths of time */ |
---|
.. | .. |
---|
311 | 297 | * advised to wait only for the following duration before |
---|
312 | 298 | * doing SRST. |
---|
313 | 299 | */ |
---|
314 | | - ATA_TMOUT_PMP_SRST_WAIT = 5000, |
---|
| 300 | + ATA_TMOUT_PMP_SRST_WAIT = 10000, |
---|
315 | 301 | |
---|
316 | 302 | /* When the LPM policy is set to ATA_LPM_MAX_POWER, there might |
---|
317 | 303 | * be a spurious PHY event, so ignore the first PHY event that |
---|
.. | .. |
---|
551 | 537 | unsigned long deadline); |
---|
552 | 538 | typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes); |
---|
553 | 539 | |
---|
554 | | -extern struct device_attribute dev_attr_link_power_management_policy; |
---|
555 | 540 | extern struct device_attribute dev_attr_unload_heads; |
---|
| 541 | +#ifdef CONFIG_SATA_HOST |
---|
| 542 | +extern struct device_attribute dev_attr_link_power_management_policy; |
---|
556 | 543 | extern struct device_attribute dev_attr_ncq_prio_enable; |
---|
557 | 544 | extern struct device_attribute dev_attr_em_message_type; |
---|
558 | 545 | extern struct device_attribute dev_attr_em_message; |
---|
559 | 546 | extern struct device_attribute dev_attr_sw_activity; |
---|
| 547 | +#endif |
---|
560 | 548 | |
---|
561 | 549 | enum sw_activity { |
---|
562 | 550 | OFF, |
---|
.. | .. |
---|
628 | 616 | struct task_struct *eh_owner; |
---|
629 | 617 | |
---|
630 | 618 | struct ata_port *simplex_claimed; /* channel owning the DMA */ |
---|
631 | | - struct ata_port *ports[0]; |
---|
| 619 | + struct ata_port *ports[]; |
---|
632 | 620 | }; |
---|
633 | 621 | |
---|
634 | 622 | struct ata_queued_cmd { |
---|
.. | .. |
---|
1042 | 1030 | /* |
---|
1043 | 1031 | * Core layer - drivers/ata/libata-core.c |
---|
1044 | 1032 | */ |
---|
1045 | | -extern const unsigned long sata_deb_timing_normal[]; |
---|
1046 | | -extern const unsigned long sata_deb_timing_hotplug[]; |
---|
1047 | | -extern const unsigned long sata_deb_timing_long[]; |
---|
1048 | | - |
---|
1049 | 1033 | extern struct ata_port_operations ata_dummy_port_ops; |
---|
1050 | 1034 | extern const struct ata_port_info ata_dummy_port_info; |
---|
1051 | 1035 | |
---|
.. | .. |
---|
1083 | 1067 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); |
---|
1084 | 1068 | } |
---|
1085 | 1069 | |
---|
1086 | | -static inline const unsigned long * |
---|
1087 | | -sata_ehc_deb_timing(struct ata_eh_context *ehc) |
---|
1088 | | -{ |
---|
1089 | | - if (ehc->i.flags & ATA_EHI_HOTPLUGGED) |
---|
1090 | | - return sata_deb_timing_hotplug; |
---|
1091 | | - else |
---|
1092 | | - return sata_deb_timing_normal; |
---|
1093 | | -} |
---|
1094 | | - |
---|
1095 | 1070 | static inline int ata_port_is_dummy(struct ata_port *ap) |
---|
1096 | 1071 | { |
---|
1097 | 1072 | return ap->ops == &ata_dummy_port_ops; |
---|
1098 | 1073 | } |
---|
1099 | 1074 | |
---|
1100 | | -extern int sata_set_spd(struct ata_link *link); |
---|
1101 | 1075 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); |
---|
1102 | 1076 | extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, |
---|
1103 | 1077 | int (*check_ready)(struct ata_link *link)); |
---|
1104 | | -extern int sata_link_debounce(struct ata_link *link, |
---|
1105 | | - const unsigned long *params, unsigned long deadline); |
---|
1106 | | -extern int sata_link_resume(struct ata_link *link, const unsigned long *params, |
---|
1107 | | - unsigned long deadline); |
---|
1108 | | -extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, |
---|
1109 | | - bool spm_wakeup); |
---|
1110 | | -extern int sata_link_hardreset(struct ata_link *link, |
---|
1111 | | - const unsigned long *timing, unsigned long deadline, |
---|
1112 | | - bool *online, int (*check_ready)(struct ata_link *)); |
---|
1113 | 1078 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, |
---|
1114 | 1079 | unsigned long deadline); |
---|
1115 | 1080 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); |
---|
.. | .. |
---|
1117 | 1082 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
---|
1118 | 1083 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
---|
1119 | 1084 | const struct ata_port_info * const * ppi, int n_ports); |
---|
1120 | | -extern int ata_slave_link_init(struct ata_port *ap); |
---|
1121 | 1085 | extern void ata_host_get(struct ata_host *host); |
---|
1122 | 1086 | extern void ata_host_put(struct ata_host *host); |
---|
1123 | 1087 | extern int ata_host_start(struct ata_host *host); |
---|
.. | .. |
---|
1129 | 1093 | extern void ata_host_detach(struct ata_host *host); |
---|
1130 | 1094 | extern void ata_host_init(struct ata_host *, struct device *, struct ata_port_operations *); |
---|
1131 | 1095 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
---|
1132 | | -extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
---|
| 1096 | +extern int ata_scsi_ioctl(struct scsi_device *dev, unsigned int cmd, |
---|
| 1097 | + void __user *arg); |
---|
| 1098 | +#ifdef CONFIG_COMPAT |
---|
| 1099 | +#define ATA_SCSI_COMPAT_IOCTL .compat_ioctl = ata_scsi_ioctl, |
---|
| 1100 | +#else |
---|
| 1101 | +#define ATA_SCSI_COMPAT_IOCTL /* empty */ |
---|
| 1102 | +#endif |
---|
1133 | 1103 | extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
---|
| 1104 | +#if IS_REACHABLE(CONFIG_ATA) |
---|
| 1105 | +bool ata_scsi_dma_need_drain(struct request *rq); |
---|
| 1106 | +#else |
---|
| 1107 | +#define ata_scsi_dma_need_drain NULL |
---|
| 1108 | +#endif |
---|
1134 | 1109 | extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, |
---|
1135 | | - int cmd, void __user *arg); |
---|
1136 | | -extern void ata_sas_port_destroy(struct ata_port *); |
---|
1137 | | -extern struct ata_port *ata_sas_port_alloc(struct ata_host *, |
---|
1138 | | - struct ata_port_info *, struct Scsi_Host *); |
---|
1139 | | -extern void ata_sas_async_probe(struct ata_port *ap); |
---|
1140 | | -extern int ata_sas_sync_probe(struct ata_port *ap); |
---|
1141 | | -extern int ata_sas_port_init(struct ata_port *); |
---|
1142 | | -extern int ata_sas_port_start(struct ata_port *ap); |
---|
1143 | | -extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); |
---|
1144 | | -extern void ata_sas_tport_delete(struct ata_port *ap); |
---|
1145 | | -extern void ata_sas_port_stop(struct ata_port *ap); |
---|
1146 | | -extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); |
---|
1147 | | -extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap); |
---|
1148 | | -extern int sata_scr_valid(struct ata_link *link); |
---|
1149 | | -extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); |
---|
1150 | | -extern int sata_scr_write(struct ata_link *link, int reg, u32 val); |
---|
1151 | | -extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); |
---|
| 1110 | + unsigned int cmd, void __user *arg); |
---|
1152 | 1111 | extern bool ata_link_online(struct ata_link *link); |
---|
1153 | 1112 | extern bool ata_link_offline(struct ata_link *link); |
---|
1154 | 1113 | #ifdef CONFIG_PM |
---|
.. | .. |
---|
1169 | 1128 | extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, |
---|
1170 | 1129 | u32 val, unsigned long interval, unsigned long timeout); |
---|
1171 | 1130 | extern int atapi_cmd_type(u8 opcode); |
---|
1172 | | -extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
---|
1173 | | - u8 pmp, int is_cmd, u8 *fis); |
---|
1174 | | -extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); |
---|
1175 | 1131 | extern unsigned long ata_pack_xfermask(unsigned long pio_mask, |
---|
1176 | 1132 | unsigned long mwdma_mask, unsigned long udma_mask); |
---|
1177 | 1133 | extern void ata_unpack_xfermask(unsigned long xfer_mask, |
---|
.. | .. |
---|
1195 | 1151 | extern unsigned int ata_do_dev_read_id(struct ata_device *dev, |
---|
1196 | 1152 | struct ata_taskfile *tf, u16 *id); |
---|
1197 | 1153 | extern void ata_qc_complete(struct ata_queued_cmd *qc); |
---|
1198 | | -extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active); |
---|
1199 | 1154 | extern u64 ata_qc_get_active(struct ata_port *ap); |
---|
1200 | 1155 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); |
---|
1201 | 1156 | extern int ata_std_bios_param(struct scsi_device *sdev, |
---|
.. | .. |
---|
1212 | 1167 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
---|
1213 | 1168 | extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); |
---|
1214 | 1169 | extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); |
---|
| 1170 | + |
---|
| 1171 | +/* |
---|
| 1172 | + * SATA specific code - drivers/ata/libata-sata.c |
---|
| 1173 | + */ |
---|
| 1174 | +#ifdef CONFIG_SATA_HOST |
---|
| 1175 | +extern const unsigned long sata_deb_timing_normal[]; |
---|
| 1176 | +extern const unsigned long sata_deb_timing_hotplug[]; |
---|
| 1177 | +extern const unsigned long sata_deb_timing_long[]; |
---|
| 1178 | + |
---|
| 1179 | +static inline const unsigned long * |
---|
| 1180 | +sata_ehc_deb_timing(struct ata_eh_context *ehc) |
---|
| 1181 | +{ |
---|
| 1182 | + if (ehc->i.flags & ATA_EHI_HOTPLUGGED) |
---|
| 1183 | + return sata_deb_timing_hotplug; |
---|
| 1184 | + else |
---|
| 1185 | + return sata_deb_timing_normal; |
---|
| 1186 | +} |
---|
| 1187 | + |
---|
| 1188 | +extern int sata_scr_valid(struct ata_link *link); |
---|
| 1189 | +extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); |
---|
| 1190 | +extern int sata_scr_write(struct ata_link *link, int reg, u32 val); |
---|
| 1191 | +extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); |
---|
| 1192 | +extern int sata_set_spd(struct ata_link *link); |
---|
| 1193 | +extern int sata_link_hardreset(struct ata_link *link, |
---|
| 1194 | + const unsigned long *timing, unsigned long deadline, |
---|
| 1195 | + bool *online, int (*check_ready)(struct ata_link *)); |
---|
| 1196 | +extern int sata_link_resume(struct ata_link *link, const unsigned long *params, |
---|
| 1197 | + unsigned long deadline); |
---|
| 1198 | +extern void ata_eh_analyze_ncq_error(struct ata_link *link); |
---|
| 1199 | +#else |
---|
| 1200 | +static inline const unsigned long * |
---|
| 1201 | +sata_ehc_deb_timing(struct ata_eh_context *ehc) |
---|
| 1202 | +{ |
---|
| 1203 | + return NULL; |
---|
| 1204 | +} |
---|
| 1205 | +static inline int sata_scr_valid(struct ata_link *link) { return 0; } |
---|
| 1206 | +static inline int sata_scr_read(struct ata_link *link, int reg, u32 *val) |
---|
| 1207 | +{ |
---|
| 1208 | + return -EOPNOTSUPP; |
---|
| 1209 | +} |
---|
| 1210 | +static inline int sata_scr_write(struct ata_link *link, int reg, u32 val) |
---|
| 1211 | +{ |
---|
| 1212 | + return -EOPNOTSUPP; |
---|
| 1213 | +} |
---|
| 1214 | +static inline int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) |
---|
| 1215 | +{ |
---|
| 1216 | + return -EOPNOTSUPP; |
---|
| 1217 | +} |
---|
| 1218 | +static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; } |
---|
| 1219 | +static inline int sata_link_hardreset(struct ata_link *link, |
---|
| 1220 | + const unsigned long *timing, |
---|
| 1221 | + unsigned long deadline, |
---|
| 1222 | + bool *online, |
---|
| 1223 | + int (*check_ready)(struct ata_link *)) |
---|
| 1224 | +{ |
---|
| 1225 | + if (online) |
---|
| 1226 | + *online = false; |
---|
| 1227 | + return -EOPNOTSUPP; |
---|
| 1228 | +} |
---|
| 1229 | +static inline int sata_link_resume(struct ata_link *link, |
---|
| 1230 | + const unsigned long *params, |
---|
| 1231 | + unsigned long deadline) |
---|
| 1232 | +{ |
---|
| 1233 | + return -EOPNOTSUPP; |
---|
| 1234 | +} |
---|
| 1235 | +static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { } |
---|
| 1236 | +#endif |
---|
| 1237 | +extern int sata_link_debounce(struct ata_link *link, |
---|
| 1238 | + const unsigned long *params, unsigned long deadline); |
---|
| 1239 | +extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, |
---|
| 1240 | + bool spm_wakeup); |
---|
| 1241 | +extern int ata_slave_link_init(struct ata_port *ap); |
---|
| 1242 | +extern void ata_sas_port_destroy(struct ata_port *); |
---|
| 1243 | +extern struct ata_port *ata_sas_port_alloc(struct ata_host *, |
---|
| 1244 | + struct ata_port_info *, struct Scsi_Host *); |
---|
| 1245 | +extern void ata_sas_async_probe(struct ata_port *ap); |
---|
| 1246 | +extern int ata_sas_sync_probe(struct ata_port *ap); |
---|
| 1247 | +extern int ata_sas_port_init(struct ata_port *); |
---|
| 1248 | +extern int ata_sas_port_start(struct ata_port *ap); |
---|
| 1249 | +extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); |
---|
| 1250 | +extern void ata_sas_tport_delete(struct ata_port *ap); |
---|
| 1251 | +extern void ata_sas_port_stop(struct ata_port *ap); |
---|
| 1252 | +extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); |
---|
| 1253 | +extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap); |
---|
| 1254 | +extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
---|
| 1255 | + u8 pmp, int is_cmd, u8 *fis); |
---|
| 1256 | +extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); |
---|
| 1257 | +extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active); |
---|
1215 | 1258 | extern bool sata_lpm_ignore_phy_events(struct ata_link *link); |
---|
| 1259 | +extern int sata_async_notification(struct ata_port *ap); |
---|
1216 | 1260 | |
---|
1217 | 1261 | extern int ata_cable_40wire(struct ata_port *ap); |
---|
1218 | 1262 | extern int ata_cable_80wire(struct ata_port *ap); |
---|
.. | .. |
---|
1222 | 1266 | |
---|
1223 | 1267 | /* Timing helpers */ |
---|
1224 | 1268 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); |
---|
1225 | | -extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); |
---|
1226 | | -extern int ata_timing_compute(struct ata_device *, unsigned short, |
---|
1227 | | - struct ata_timing *, int, int); |
---|
1228 | | -extern void ata_timing_merge(const struct ata_timing *, |
---|
1229 | | - const struct ata_timing *, struct ata_timing *, |
---|
1230 | | - unsigned int); |
---|
1231 | 1269 | extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); |
---|
1232 | 1270 | |
---|
1233 | 1271 | /* PCI */ |
---|
.. | .. |
---|
1311 | 1349 | extern int ata_link_abort(struct ata_link *link); |
---|
1312 | 1350 | extern int ata_port_abort(struct ata_port *ap); |
---|
1313 | 1351 | extern int ata_port_freeze(struct ata_port *ap); |
---|
1314 | | -extern int sata_async_notification(struct ata_port *ap); |
---|
1315 | 1352 | |
---|
1316 | 1353 | extern void ata_eh_freeze_port(struct ata_port *ap); |
---|
1317 | 1354 | extern void ata_eh_thaw_port(struct ata_port *ap); |
---|
1318 | 1355 | |
---|
1319 | 1356 | extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); |
---|
1320 | 1357 | extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); |
---|
1321 | | -extern void ata_eh_analyze_ncq_error(struct ata_link *link); |
---|
1322 | 1358 | |
---|
1323 | 1359 | extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, |
---|
1324 | 1360 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
---|
.. | .. |
---|
1359 | 1395 | * edge driver's module reference, otherwise the driver can be unloaded |
---|
1360 | 1396 | * even if the scsi_device is being accessed. |
---|
1361 | 1397 | */ |
---|
1362 | | -#define ATA_BASE_SHT(drv_name) \ |
---|
| 1398 | +#define __ATA_BASE_SHT(drv_name) \ |
---|
1363 | 1399 | .module = THIS_MODULE, \ |
---|
1364 | 1400 | .name = drv_name, \ |
---|
1365 | 1401 | .ioctl = ata_scsi_ioctl, \ |
---|
| 1402 | + ATA_SCSI_COMPAT_IOCTL \ |
---|
1366 | 1403 | .queuecommand = ata_scsi_queuecmd, \ |
---|
| 1404 | + .dma_need_drain = ata_scsi_dma_need_drain, \ |
---|
1367 | 1405 | .can_queue = ATA_DEF_QUEUE, \ |
---|
1368 | 1406 | .tag_alloc_policy = BLK_TAG_ALLOC_RR, \ |
---|
1369 | 1407 | .this_id = ATA_SHT_THIS_ID, \ |
---|
1370 | 1408 | .emulated = ATA_SHT_EMULATED, \ |
---|
1371 | | - .use_clustering = ATA_SHT_USE_CLUSTERING, \ |
---|
1372 | 1409 | .proc_name = drv_name, \ |
---|
1373 | 1410 | .slave_configure = ata_scsi_slave_config, \ |
---|
1374 | 1411 | .slave_destroy = ata_scsi_slave_destroy, \ |
---|
1375 | 1412 | .bios_param = ata_std_bios_param, \ |
---|
1376 | | - .unlock_native_capacity = ata_scsi_unlock_native_capacity, \ |
---|
| 1413 | + .unlock_native_capacity = ata_scsi_unlock_native_capacity |
---|
| 1414 | + |
---|
| 1415 | +#define ATA_BASE_SHT(drv_name) \ |
---|
| 1416 | + __ATA_BASE_SHT(drv_name), \ |
---|
1377 | 1417 | .sdev_attrs = ata_common_sdev_attrs |
---|
1378 | 1418 | |
---|
| 1419 | +#ifdef CONFIG_SATA_HOST |
---|
| 1420 | +extern struct device_attribute *ata_ncq_sdev_attrs[]; |
---|
| 1421 | + |
---|
1379 | 1422 | #define ATA_NCQ_SHT(drv_name) \ |
---|
1380 | | - ATA_BASE_SHT(drv_name), \ |
---|
| 1423 | + __ATA_BASE_SHT(drv_name), \ |
---|
| 1424 | + .sdev_attrs = ata_ncq_sdev_attrs, \ |
---|
1381 | 1425 | .change_queue_depth = ata_scsi_change_queue_depth |
---|
| 1426 | +#endif |
---|
1382 | 1427 | |
---|
1383 | 1428 | /* |
---|
1384 | 1429 | * PMP helpers |
---|
.. | .. |
---|
1651 | 1696 | */ |
---|
1652 | 1697 | static inline int ata_ncq_enabled(struct ata_device *dev) |
---|
1653 | 1698 | { |
---|
| 1699 | + if (!IS_ENABLED(CONFIG_SATA_HOST)) |
---|
| 1700 | + return 0; |
---|
1654 | 1701 | return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | |
---|
1655 | 1702 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; |
---|
1656 | 1703 | } |
---|
.. | .. |
---|
1820 | 1867 | } |
---|
1821 | 1868 | |
---|
1822 | 1869 | /************************************************************************** |
---|
| 1870 | + * PATA timings - drivers/ata/libata-pata-timings.c |
---|
| 1871 | + */ |
---|
| 1872 | +extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); |
---|
| 1873 | +extern int ata_timing_compute(struct ata_device *, unsigned short, |
---|
| 1874 | + struct ata_timing *, int, int); |
---|
| 1875 | +extern void ata_timing_merge(const struct ata_timing *, |
---|
| 1876 | + const struct ata_timing *, struct ata_timing *, |
---|
| 1877 | + unsigned int); |
---|
| 1878 | + |
---|
| 1879 | +/************************************************************************** |
---|
1823 | 1880 | * PMP - drivers/ata/libata-pmp.c |
---|
1824 | 1881 | */ |
---|
1825 | 1882 | #ifdef CONFIG_SATA_PMP |
---|