hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/ata/libata-core.c
....@@ -1,28 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * libata-core.c - helper library for ATA
34 *
4
- * Maintained by: Tejun Heo <tj@kernel.org>
5
- * Please ALWAYS copy linux-ide@vger.kernel.org
6
- * on emails.
7
- *
85 * Copyright 2003-2004 Red Hat, Inc. All rights reserved.
96 * Copyright 2003-2004 Jeff Garzik
10
- *
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2, or (at your option)
15
- * any later version.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
21
- *
22
- * You should have received a copy of the GNU General Public License
23
- * along with this program; see the file COPYING. If not, write to
24
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25
- *
267 *
278 * libata documentation is available via 'make {ps|pdf}docs',
289 * as Documentation/driver-api/libata.rst
....@@ -38,6 +19,10 @@
3819 * http://www.qic.org (QIC157 - Tape and DSC)
3920 * http://www.ce-ata.org (CE-ATA: not supported)
4021 *
22
+ * libata is essentially a library of internal helper functions for
23
+ * low-level ATA host controller drivers. As such, the API/ABI is
24
+ * likely to change as new drivers are added and updated.
25
+ * Do not depend on ABI/API stability.
4126 */
4227
4328 #include <linux/kernel.h>
....@@ -71,17 +56,13 @@
7156 #include <linux/leds.h>
7257 #include <linux/pm_runtime.h>
7358 #include <linux/platform_device.h>
59
+#include <asm/setup.h>
7460
7561 #define CREATE_TRACE_POINTS
7662 #include <trace/events/libata.h>
7763
7864 #include "libata.h"
7965 #include "libata-transport.h"
80
-
81
-/* debounce timing parameters in msecs { interval, duration, timeout } */
82
-const unsigned long sata_deb_timing_normal[] = { 5, 100, 2000 };
83
-const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };
84
-const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };
8566
8667 const struct ata_port_operations ata_base_port_ops = {
8768 .prereset = ata_std_prereset,
....@@ -97,6 +78,7 @@
9778 .qc_defer = ata_std_qc_defer,
9879 .hardreset = sata_std_hardreset,
9980 };
81
+EXPORT_SYMBOL_GPL(sata_port_ops);
10082
10183 static unsigned int ata_dev_init_params(struct ata_device *dev,
10284 u16 heads, u16 sectors);
....@@ -106,14 +88,15 @@
10688
10789 atomic_t ata_print_id = ATOMIC_INIT(0);
10890
91
+#ifdef CONFIG_ATA_FORCE
10992 struct ata_force_param {
11093 const char *name;
111
- unsigned int cbl;
112
- int spd_limit;
94
+ u8 cbl;
95
+ u8 spd_limit;
11396 unsigned long xfer_mask;
11497 unsigned int horkage_on;
11598 unsigned int horkage_off;
116
- unsigned int lflags;
99
+ u16 lflags;
117100 };
118101
119102 struct ata_force_ent {
....@@ -125,10 +108,11 @@
125108 static struct ata_force_ent *ata_force_tbl;
126109 static int ata_force_tbl_size;
127110
128
-static char ata_force_param_buf[PAGE_SIZE] __initdata;
111
+static char ata_force_param_buf[COMMAND_LINE_SIZE] __initdata;
129112 /* param_buf is thrown away after initialization, disallow read */
130113 module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0);
131114 MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/admin-guide/kernel-parameters.rst for details)");
115
+#endif
132116
133117 static int atapi_enabled = 1;
134118 module_param(atapi_enabled, int, 0444);
....@@ -206,7 +190,7 @@
206190 case ATA_LITER_PMP_FIRST:
207191 if (sata_pmp_attached(ap))
208192 return ap->pmp_link;
209
- /* fall through */
193
+ fallthrough;
210194 case ATA_LITER_HOST_FIRST:
211195 return &ap->link;
212196 }
....@@ -217,11 +201,11 @@
217201 case ATA_LITER_HOST_FIRST:
218202 if (sata_pmp_attached(ap))
219203 return ap->pmp_link;
220
- /* fall through */
204
+ fallthrough;
221205 case ATA_LITER_PMP_FIRST:
222206 if (unlikely(ap->slave_link))
223207 return ap->slave_link;
224
- /* fall through */
208
+ fallthrough;
225209 case ATA_LITER_EDGE:
226210 return NULL;
227211 }
....@@ -239,6 +223,7 @@
239223
240224 return NULL;
241225 }
226
+EXPORT_SYMBOL_GPL(ata_link_next);
242227
243228 /**
244229 * ata_dev_next - device iteration helper
....@@ -292,6 +277,7 @@
292277 goto next;
293278 return dev;
294279 }
280
+EXPORT_SYMBOL_GPL(ata_dev_next);
295281
296282 /**
297283 * ata_dev_phys_link - find physical link for a device
....@@ -318,6 +304,7 @@
318304 return ap->slave_link;
319305 }
320306
307
+#ifdef CONFIG_ATA_FORCE
321308 /**
322309 * ata_force_cbl - force cable type according to libata.force
323310 * @ap: ATA port of interest
....@@ -498,6 +485,11 @@
498485 fe->param.name);
499486 }
500487 }
488
+#else
489
+static inline void ata_force_link_limits(struct ata_link *link) { }
490
+static inline void ata_force_xfermask(struct ata_device *dev) { }
491
+static inline void ata_force_horkage(struct ata_device *dev) { }
492
+#endif
501493
502494 /**
503495 * atapi_cmd_type - Determine ATAPI command type from SCSI opcode
....@@ -531,84 +523,12 @@
531523 case ATA_12:
532524 if (atapi_passthru16)
533525 return ATAPI_PASS_THRU;
534
- /* fall thru */
526
+ fallthrough;
535527 default:
536528 return ATAPI_MISC;
537529 }
538530 }
539
-
540
-/**
541
- * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
542
- * @tf: Taskfile to convert
543
- * @pmp: Port multiplier port
544
- * @is_cmd: This FIS is for command
545
- * @fis: Buffer into which data will output
546
- *
547
- * Converts a standard ATA taskfile to a Serial ATA
548
- * FIS structure (Register - Host to Device).
549
- *
550
- * LOCKING:
551
- * Inherited from caller.
552
- */
553
-void ata_tf_to_fis(const struct ata_taskfile *tf, u8 pmp, int is_cmd, u8 *fis)
554
-{
555
- fis[0] = 0x27; /* Register - Host to Device FIS */
556
- fis[1] = pmp & 0xf; /* Port multiplier number*/
557
- if (is_cmd)
558
- fis[1] |= (1 << 7); /* bit 7 indicates Command FIS */
559
-
560
- fis[2] = tf->command;
561
- fis[3] = tf->feature;
562
-
563
- fis[4] = tf->lbal;
564
- fis[5] = tf->lbam;
565
- fis[6] = tf->lbah;
566
- fis[7] = tf->device;
567
-
568
- fis[8] = tf->hob_lbal;
569
- fis[9] = tf->hob_lbam;
570
- fis[10] = tf->hob_lbah;
571
- fis[11] = tf->hob_feature;
572
-
573
- fis[12] = tf->nsect;
574
- fis[13] = tf->hob_nsect;
575
- fis[14] = 0;
576
- fis[15] = tf->ctl;
577
-
578
- fis[16] = tf->auxiliary & 0xff;
579
- fis[17] = (tf->auxiliary >> 8) & 0xff;
580
- fis[18] = (tf->auxiliary >> 16) & 0xff;
581
- fis[19] = (tf->auxiliary >> 24) & 0xff;
582
-}
583
-
584
-/**
585
- * ata_tf_from_fis - Convert SATA FIS to ATA taskfile
586
- * @fis: Buffer from which data will be input
587
- * @tf: Taskfile to output
588
- *
589
- * Converts a serial ATA FIS structure to a standard ATA taskfile.
590
- *
591
- * LOCKING:
592
- * Inherited from caller.
593
- */
594
-
595
-void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf)
596
-{
597
- tf->command = fis[2]; /* status */
598
- tf->feature = fis[3]; /* error */
599
-
600
- tf->lbal = fis[4];
601
- tf->lbam = fis[5];
602
- tf->lbah = fis[6];
603
- tf->device = fis[7];
604
-
605
- tf->hob_lbal = fis[8];
606
- tf->hob_lbam = fis[9];
607
- tf->hob_lbah = fis[10];
608
-
609
- tf->nsect = fis[12];
610
- tf->hob_nsect = fis[13];
611
-}
531
+EXPORT_SYMBOL_GPL(atapi_cmd_type);
612532
613533 static const u8 ata_rw_cmds[] = {
614534 /* pio multi */
....@@ -883,6 +803,7 @@
883803 ((mwdma_mask << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA) |
884804 ((udma_mask << ATA_SHIFT_UDMA) & ATA_MASK_UDMA);
885805 }
806
+EXPORT_SYMBOL_GPL(ata_pack_xfermask);
886807
887808 /**
888809 * ata_unpack_xfermask - Unpack xfer_mask into pio, mwdma and udma masks
....@@ -938,6 +859,7 @@
938859 return ent->base + highbit - ent->shift;
939860 return 0xff;
940861 }
862
+EXPORT_SYMBOL_GPL(ata_xfer_mask2mode);
941863
942864 /**
943865 * ata_xfer_mode2mask - Find matching xfer_mask for XFER_*
....@@ -961,6 +883,7 @@
961883 & ~((1 << ent->shift) - 1);
962884 return 0;
963885 }
886
+EXPORT_SYMBOL_GPL(ata_xfer_mode2mask);
964887
965888 /**
966889 * ata_xfer_mode2shift - Find matching xfer_shift for XFER_*
....@@ -983,6 +906,7 @@
983906 return ent->shift;
984907 return -1;
985908 }
909
+EXPORT_SYMBOL_GPL(ata_xfer_mode2shift);
986910
987911 /**
988912 * ata_mode_string - convert xfer_mask to string
....@@ -1029,6 +953,7 @@
1029953 return xfer_mode_str[highbit];
1030954 return "<n/a>";
1031955 }
956
+EXPORT_SYMBOL_GPL(ata_mode_string);
1032957
1033958 const char *sata_spd_string(unsigned int spd)
1034959 {
....@@ -1109,6 +1034,7 @@
11091034 DPRINTK("unknown device\n");
11101035 return ATA_DEV_UNKNOWN;
11111036 }
1037
+EXPORT_SYMBOL_GPL(ata_dev_classify);
11121038
11131039 /**
11141040 * ata_id_string - Convert IDENTIFY DEVICE page into string
....@@ -1145,6 +1071,7 @@
11451071 len -= 2;
11461072 }
11471073 }
1074
+EXPORT_SYMBOL_GPL(ata_id_string);
11481075
11491076 /**
11501077 * ata_id_c_string - Convert IDENTIFY DEVICE page into C string
....@@ -1172,6 +1099,7 @@
11721099 p--;
11731100 *p = '\0';
11741101 }
1102
+EXPORT_SYMBOL_GPL(ata_id_c_string);
11751103
11761104 static u64 ata_id_n_sectors(const u16 *id)
11771105 {
....@@ -1529,6 +1457,7 @@
15291457
15301458 return ata_pack_xfermask(pio_mask, mwdma_mask, udma_mask);
15311459 }
1460
+EXPORT_SYMBOL_GPL(ata_id_xfermask);
15321461
15331462 static void ata_qc_complete_internal(struct ata_queued_cmd *qc)
15341463 {
....@@ -1786,6 +1715,7 @@
17861715 return 1;
17871716 return 0;
17881717 }
1718
+EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
17891719
17901720 /**
17911721 * ata_pio_mask_no_iordy - Return the non IORDY mask
....@@ -1826,6 +1756,7 @@
18261756 return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
18271757 id, sizeof(id[0]) * ATA_ID_WORDS, 0);
18281758 }
1759
+EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
18291760
18301761 /**
18311762 * ata_dev_read_id - Read ID data from the specified device
....@@ -1869,7 +1800,7 @@
18691800 switch (class) {
18701801 case ATA_DEV_SEMB:
18711802 class = ATA_DEV_ATA; /* some hard drives report SEMB sig */
1872
- /* fall through */
1803
+ fallthrough;
18731804 case ATA_DEV_ATA:
18741805 case ATA_DEV_ZAC:
18751806 tf.command = ATA_CMD_ID_ATA;
....@@ -2299,6 +2230,8 @@
22992230 desc[0] = '\0';
23002231 return 0;
23012232 }
2233
+ if (!IS_ENABLED(CONFIG_SATA_HOST))
2234
+ return 0;
23022235 if (dev->horkage & ATA_HORKAGE_NONCQ) {
23032236 snprintf(desc, desc_sz, "NCQ (not used)");
23042237 return 0;
....@@ -2824,6 +2757,7 @@
28242757 {
28252758 return ATA_CBL_PATA40;
28262759 }
2760
+EXPORT_SYMBOL_GPL(ata_cable_40wire);
28272761
28282762 /**
28292763 * ata_cable_80wire - return 80 wire cable type
....@@ -2837,6 +2771,7 @@
28372771 {
28382772 return ATA_CBL_PATA80;
28392773 }
2774
+EXPORT_SYMBOL_GPL(ata_cable_80wire);
28402775
28412776 /**
28422777 * ata_cable_unknown - return unknown PATA cable.
....@@ -2849,6 +2784,7 @@
28492784 {
28502785 return ATA_CBL_PATA_UNK;
28512786 }
2787
+EXPORT_SYMBOL_GPL(ata_cable_unknown);
28522788
28532789 /**
28542790 * ata_cable_ignore - return ignored PATA cable.
....@@ -2861,6 +2797,7 @@
28612797 {
28622798 return ATA_CBL_PATA_IGN;
28632799 }
2800
+EXPORT_SYMBOL_GPL(ata_cable_ignore);
28642801
28652802 /**
28662803 * ata_cable_sata - return SATA cable type
....@@ -2873,6 +2810,7 @@
28732810 {
28742811 return ATA_CBL_SATA;
28752812 }
2813
+EXPORT_SYMBOL_GPL(ata_cable_sata);
28762814
28772815 /**
28782816 * ata_bus_probe - Reset and probe ATA bus
....@@ -2995,7 +2933,7 @@
29952933 case -ENODEV:
29962934 /* give it just one more chance */
29972935 tries[dev->devno] = min(tries[dev->devno], 1);
2998
- /* fall through */
2936
+ fallthrough;
29992937 case -EIO:
30002938 if (tries[dev->devno] == 1) {
30012939 /* This is the last chance, better to slow
....@@ -3055,6 +2993,7 @@
30552993 return NULL;
30562994 return pair;
30572995 }
2996
+EXPORT_SYMBOL_GPL(ata_dev_pair);
30582997
30592998 /**
30602999 * sata_down_spd_limit - adjust SATA spd limit downward
....@@ -3112,7 +3051,7 @@
31123051 */
31133052 if (spd > 1)
31143053 mask &= (1 << (spd - 1)) - 1;
3115
- else
3054
+ else if (link->sata_spd)
31163055 return -EINVAL;
31173056
31183057 /* were we already at the bottom? */
....@@ -3136,252 +3075,7 @@
31363075 return 0;
31373076 }
31383077
3139
-static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
3140
-{
3141
- struct ata_link *host_link = &link->ap->link;
3142
- u32 limit, target, spd;
3143
-
3144
- limit = link->sata_spd_limit;
3145
-
3146
- /* Don't configure downstream link faster than upstream link.
3147
- * It doesn't speed up anything and some PMPs choke on such
3148
- * configuration.
3149
- */
3150
- if (!ata_is_host_link(link) && host_link->sata_spd)
3151
- limit &= (1 << host_link->sata_spd) - 1;
3152
-
3153
- if (limit == UINT_MAX)
3154
- target = 0;
3155
- else
3156
- target = fls(limit);
3157
-
3158
- spd = (*scontrol >> 4) & 0xf;
3159
- *scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);
3160
-
3161
- return spd != target;
3162
-}
3163
-
3164
-/**
3165
- * sata_set_spd_needed - is SATA spd configuration needed
3166
- * @link: Link in question
3167
- *
3168
- * Test whether the spd limit in SControl matches
3169
- * @link->sata_spd_limit. This function is used to determine
3170
- * whether hardreset is necessary to apply SATA spd
3171
- * configuration.
3172
- *
3173
- * LOCKING:
3174
- * Inherited from caller.
3175
- *
3176
- * RETURNS:
3177
- * 1 if SATA spd configuration is needed, 0 otherwise.
3178
- */
3179
-static int sata_set_spd_needed(struct ata_link *link)
3180
-{
3181
- u32 scontrol;
3182
-
3183
- if (sata_scr_read(link, SCR_CONTROL, &scontrol))
3184
- return 1;
3185
-
3186
- return __sata_set_spd_needed(link, &scontrol);
3187
-}
3188
-
3189
-/**
3190
- * sata_set_spd - set SATA spd according to spd limit
3191
- * @link: Link to set SATA spd for
3192
- *
3193
- * Set SATA spd of @link according to sata_spd_limit.
3194
- *
3195
- * LOCKING:
3196
- * Inherited from caller.
3197
- *
3198
- * RETURNS:
3199
- * 0 if spd doesn't need to be changed, 1 if spd has been
3200
- * changed. Negative errno if SCR registers are inaccessible.
3201
- */
3202
-int sata_set_spd(struct ata_link *link)
3203
-{
3204
- u32 scontrol;
3205
- int rc;
3206
-
3207
- if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
3208
- return rc;
3209
-
3210
- if (!__sata_set_spd_needed(link, &scontrol))
3211
- return 0;
3212
-
3213
- if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol)))
3214
- return rc;
3215
-
3216
- return 1;
3217
-}
3218
-
3219
-/*
3220
- * This mode timing computation functionality is ported over from
3221
- * drivers/ide/ide-timing.h and was originally written by Vojtech Pavlik
3222
- */
3223
-/*
3224
- * PIO 0-4, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds).
3225
- * These were taken from ATA/ATAPI-6 standard, rev 0a, except
3226
- * for UDMA6, which is currently supported only by Maxtor drives.
3227
- *
3228
- * For PIO 5/6 MWDMA 3/4 see the CFA specification 3.0.
3229
- */
3230
-
3231
-static const struct ata_timing ata_timing[] = {
3232
-/* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 0, 960, 0 }, */
3233
- { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 0, 600, 0 },
3234
- { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 0, 383, 0 },
3235
- { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 0, 240, 0 },
3236
- { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 0, 180, 0 },
3237
- { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 0, 120, 0 },
3238
- { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 0, 100, 0 },
3239
- { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 0, 80, 0 },
3240
-
3241
- { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 50, 960, 0 },
3242
- { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 30, 480, 0 },
3243
- { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 20, 240, 0 },
3244
-
3245
- { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 20, 480, 0 },
3246
- { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 5, 150, 0 },
3247
- { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 5, 120, 0 },
3248
- { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 5, 100, 0 },
3249
- { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 5, 80, 0 },
3250
-
3251
-/* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 0, 150 }, */
3252
- { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 0, 120 },
3253
- { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 0, 80 },
3254
- { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 0, 60 },
3255
- { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 0, 45 },
3256
- { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 0, 30 },
3257
- { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 0, 20 },
3258
- { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 0, 15 },
3259
-
3260
- { 0xFF }
3261
-};
3262
-
3263
-#define ENOUGH(v, unit) (((v)-1)/(unit)+1)
3264
-#define EZ(v, unit) ((v)?ENOUGH(((v) * 1000), unit):0)
3265
-
3266
-static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT)
3267
-{
3268
- q->setup = EZ(t->setup, T);
3269
- q->act8b = EZ(t->act8b, T);
3270
- q->rec8b = EZ(t->rec8b, T);
3271
- q->cyc8b = EZ(t->cyc8b, T);
3272
- q->active = EZ(t->active, T);
3273
- q->recover = EZ(t->recover, T);
3274
- q->dmack_hold = EZ(t->dmack_hold, T);
3275
- q->cycle = EZ(t->cycle, T);
3276
- q->udma = EZ(t->udma, UT);
3277
-}
3278
-
3279
-void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
3280
- struct ata_timing *m, unsigned int what)
3281
-{
3282
- if (what & ATA_TIMING_SETUP ) m->setup = max(a->setup, b->setup);
3283
- if (what & ATA_TIMING_ACT8B ) m->act8b = max(a->act8b, b->act8b);
3284
- if (what & ATA_TIMING_REC8B ) m->rec8b = max(a->rec8b, b->rec8b);
3285
- if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b);
3286
- if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active);
3287
- if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover);
3288
- if (what & ATA_TIMING_DMACK_HOLD) m->dmack_hold = max(a->dmack_hold, b->dmack_hold);
3289
- if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle);
3290
- if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma);
3291
-}
3292
-
3293
-const struct ata_timing *ata_timing_find_mode(u8 xfer_mode)
3294
-{
3295
- const struct ata_timing *t = ata_timing;
3296
-
3297
- while (xfer_mode > t->mode)
3298
- t++;
3299
-
3300
- if (xfer_mode == t->mode)
3301
- return t;
3302
-
3303
- WARN_ONCE(true, "%s: unable to find timing for xfer_mode 0x%x\n",
3304
- __func__, xfer_mode);
3305
-
3306
- return NULL;
3307
-}
3308
-
3309
-int ata_timing_compute(struct ata_device *adev, unsigned short speed,
3310
- struct ata_timing *t, int T, int UT)
3311
-{
3312
- const u16 *id = adev->id;
3313
- const struct ata_timing *s;
3314
- struct ata_timing p;
3315
-
3316
- /*
3317
- * Find the mode.
3318
- */
3319
-
3320
- if (!(s = ata_timing_find_mode(speed)))
3321
- return -EINVAL;
3322
-
3323
- memcpy(t, s, sizeof(*s));
3324
-
3325
- /*
3326
- * If the drive is an EIDE drive, it can tell us it needs extended
3327
- * PIO/MW_DMA cycle timing.
3328
- */
3329
-
3330
- if (id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */
3331
- memset(&p, 0, sizeof(p));
3332
-
3333
- if (speed >= XFER_PIO_0 && speed < XFER_SW_DMA_0) {
3334
- if (speed <= XFER_PIO_2)
3335
- p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO];
3336
- else if ((speed <= XFER_PIO_4) ||
3337
- (speed == XFER_PIO_5 && !ata_id_is_cfa(id)))
3338
- p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO_IORDY];
3339
- } else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
3340
- p.cycle = id[ATA_ID_EIDE_DMA_MIN];
3341
-
3342
- ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B);
3343
- }
3344
-
3345
- /*
3346
- * Convert the timing to bus clock counts.
3347
- */
3348
-
3349
- ata_timing_quantize(t, t, T, UT);
3350
-
3351
- /*
3352
- * Even in DMA/UDMA modes we still use PIO access for IDENTIFY,
3353
- * S.M.A.R.T * and some other commands. We have to ensure that the
3354
- * DMA cycle timing is slower/equal than the fastest PIO timing.
3355
- */
3356
-
3357
- if (speed > XFER_PIO_6) {
3358
- ata_timing_compute(adev, adev->pio_mode, &p, T, UT);
3359
- ata_timing_merge(&p, t, t, ATA_TIMING_ALL);
3360
- }
3361
-
3362
- /*
3363
- * Lengthen active & recovery time so that cycle time is correct.
3364
- */
3365
-
3366
- if (t->act8b + t->rec8b < t->cyc8b) {
3367
- t->act8b += (t->cyc8b - (t->act8b + t->rec8b)) / 2;
3368
- t->rec8b = t->cyc8b - t->act8b;
3369
- }
3370
-
3371
- if (t->active + t->recover < t->cycle) {
3372
- t->active += (t->cycle - (t->active + t->recover)) / 2;
3373
- t->recover = t->cycle - t->active;
3374
- }
3375
-
3376
- /* In a few cases quantisation may produce enough errors to
3377
- leave t->cycle too low for the sum of active and recovery
3378
- if so we must correct this */
3379
- if (t->active + t->recover > t->cycle)
3380
- t->cycle = t->active + t->recover;
3381
-
3382
- return 0;
3383
-}
3384
-
3078
+#ifdef CONFIG_ATA_ACPI
33853079 /**
33863080 * ata_timing_cycle2mode - find xfer mode for the specified cycle duration
33873081 * @xfer_shift: ATA_SHIFT_* value for transfer type to examine.
....@@ -3432,6 +3126,7 @@
34323126
34333127 return last_mode;
34343128 }
3129
+#endif
34353130
34363131 /**
34373132 * ata_down_xfermask_limit - adjust dev xfer masks downward
....@@ -3489,7 +3184,7 @@
34893184
34903185 case ATA_DNXFER_FORCE_PIO0:
34913186 pio_mask &= 1;
3492
- /* fall through */
3187
+ fallthrough;
34933188 case ATA_DNXFER_FORCE_PIO:
34943189 mwdma_mask = 0;
34953190 udma_mask = 0;
....@@ -3703,6 +3398,7 @@
37033398 *r_failed_dev = dev;
37043399 return rc;
37053400 }
3401
+EXPORT_SYMBOL_GPL(ata_do_set_mode);
37063402
37073403 /**
37083404 * ata_wait_ready - wait for link to become ready
....@@ -3812,216 +3508,7 @@
38123508
38133509 return ata_wait_ready(link, deadline, check_ready);
38143510 }
3815
-
3816
-/**
3817
- * sata_link_debounce - debounce SATA phy status
3818
- * @link: ATA link to debounce SATA phy status for
3819
- * @params: timing parameters { interval, duration, timeout } in msec
3820
- * @deadline: deadline jiffies for the operation
3821
- *
3822
- * Make sure SStatus of @link reaches stable state, determined by
3823
- * holding the same value where DET is not 1 for @duration polled
3824
- * every @interval, before @timeout. Timeout constraints the
3825
- * beginning of the stable state. Because DET gets stuck at 1 on
3826
- * some controllers after hot unplugging, this functions waits
3827
- * until timeout then returns 0 if DET is stable at 1.
3828
- *
3829
- * @timeout is further limited by @deadline. The sooner of the
3830
- * two is used.
3831
- *
3832
- * LOCKING:
3833
- * Kernel thread context (may sleep)
3834
- *
3835
- * RETURNS:
3836
- * 0 on success, -errno on failure.
3837
- */
3838
-int sata_link_debounce(struct ata_link *link, const unsigned long *params,
3839
- unsigned long deadline)
3840
-{
3841
- unsigned long interval = params[0];
3842
- unsigned long duration = params[1];
3843
- unsigned long last_jiffies, t;
3844
- u32 last, cur;
3845
- int rc;
3846
-
3847
- t = ata_deadline(jiffies, params[2]);
3848
- if (time_before(t, deadline))
3849
- deadline = t;
3850
-
3851
- if ((rc = sata_scr_read(link, SCR_STATUS, &cur)))
3852
- return rc;
3853
- cur &= 0xf;
3854
-
3855
- last = cur;
3856
- last_jiffies = jiffies;
3857
-
3858
- while (1) {
3859
- ata_msleep(link->ap, interval);
3860
- if ((rc = sata_scr_read(link, SCR_STATUS, &cur)))
3861
- return rc;
3862
- cur &= 0xf;
3863
-
3864
- /* DET stable? */
3865
- if (cur == last) {
3866
- if (cur == 1 && time_before(jiffies, deadline))
3867
- continue;
3868
- if (time_after(jiffies,
3869
- ata_deadline(last_jiffies, duration)))
3870
- return 0;
3871
- continue;
3872
- }
3873
-
3874
- /* unstable, start over */
3875
- last = cur;
3876
- last_jiffies = jiffies;
3877
-
3878
- /* Check deadline. If debouncing failed, return
3879
- * -EPIPE to tell upper layer to lower link speed.
3880
- */
3881
- if (time_after(jiffies, deadline))
3882
- return -EPIPE;
3883
- }
3884
-}
3885
-
3886
-/**
3887
- * sata_link_resume - resume SATA link
3888
- * @link: ATA link to resume SATA
3889
- * @params: timing parameters { interval, duration, timeout } in msec
3890
- * @deadline: deadline jiffies for the operation
3891
- *
3892
- * Resume SATA phy @link and debounce it.
3893
- *
3894
- * LOCKING:
3895
- * Kernel thread context (may sleep)
3896
- *
3897
- * RETURNS:
3898
- * 0 on success, -errno on failure.
3899
- */
3900
-int sata_link_resume(struct ata_link *link, const unsigned long *params,
3901
- unsigned long deadline)
3902
-{
3903
- int tries = ATA_LINK_RESUME_TRIES;
3904
- u32 scontrol, serror;
3905
- int rc;
3906
-
3907
- if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
3908
- return rc;
3909
-
3910
- /*
3911
- * Writes to SControl sometimes get ignored under certain
3912
- * controllers (ata_piix SIDPR). Make sure DET actually is
3913
- * cleared.
3914
- */
3915
- do {
3916
- scontrol = (scontrol & 0x0f0) | 0x300;
3917
- if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol)))
3918
- return rc;
3919
- /*
3920
- * Some PHYs react badly if SStatus is pounded
3921
- * immediately after resuming. Delay 200ms before
3922
- * debouncing.
3923
- */
3924
- if (!(link->flags & ATA_LFLAG_NO_DB_DELAY))
3925
- ata_msleep(link->ap, 200);
3926
-
3927
- /* is SControl restored correctly? */
3928
- if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
3929
- return rc;
3930
- } while ((scontrol & 0xf0f) != 0x300 && --tries);
3931
-
3932
- if ((scontrol & 0xf0f) != 0x300) {
3933
- ata_link_warn(link, "failed to resume link (SControl %X)\n",
3934
- scontrol);
3935
- return 0;
3936
- }
3937
-
3938
- if (tries < ATA_LINK_RESUME_TRIES)
3939
- ata_link_warn(link, "link resume succeeded after %d retries\n",
3940
- ATA_LINK_RESUME_TRIES - tries);
3941
-
3942
- if ((rc = sata_link_debounce(link, params, deadline)))
3943
- return rc;
3944
-
3945
- /* clear SError, some PHYs require this even for SRST to work */
3946
- if (!(rc = sata_scr_read(link, SCR_ERROR, &serror)))
3947
- rc = sata_scr_write(link, SCR_ERROR, serror);
3948
-
3949
- return rc != -EINVAL ? rc : 0;
3950
-}
3951
-
3952
-/**
3953
- * sata_link_scr_lpm - manipulate SControl IPM and SPM fields
3954
- * @link: ATA link to manipulate SControl for
3955
- * @policy: LPM policy to configure
3956
- * @spm_wakeup: initiate LPM transition to active state
3957
- *
3958
- * Manipulate the IPM field of the SControl register of @link
3959
- * according to @policy. If @policy is ATA_LPM_MAX_POWER and
3960
- * @spm_wakeup is %true, the SPM field is manipulated to wake up
3961
- * the link. This function also clears PHYRDY_CHG before
3962
- * returning.
3963
- *
3964
- * LOCKING:
3965
- * EH context.
3966
- *
3967
- * RETURNS:
3968
- * 0 on success, -errno otherwise.
3969
- */
3970
-int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3971
- bool spm_wakeup)
3972
-{
3973
- struct ata_eh_context *ehc = &link->eh_context;
3974
- bool woken_up = false;
3975
- u32 scontrol;
3976
- int rc;
3977
-
3978
- rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
3979
- if (rc)
3980
- return rc;
3981
-
3982
- switch (policy) {
3983
- case ATA_LPM_MAX_POWER:
3984
- /* disable all LPM transitions */
3985
- scontrol |= (0x7 << 8);
3986
- /* initiate transition to active state */
3987
- if (spm_wakeup) {
3988
- scontrol |= (0x4 << 12);
3989
- woken_up = true;
3990
- }
3991
- break;
3992
- case ATA_LPM_MED_POWER:
3993
- /* allow LPM to PARTIAL */
3994
- scontrol &= ~(0x1 << 8);
3995
- scontrol |= (0x6 << 8);
3996
- break;
3997
- case ATA_LPM_MED_POWER_WITH_DIPM:
3998
- case ATA_LPM_MIN_POWER_WITH_PARTIAL:
3999
- case ATA_LPM_MIN_POWER:
4000
- if (ata_link_nr_enabled(link) > 0)
4001
- /* no restrictions on LPM transitions */
4002
- scontrol &= ~(0x7 << 8);
4003
- else {
4004
- /* empty port, power off */
4005
- scontrol &= ~0xf;
4006
- scontrol |= (0x1 << 2);
4007
- }
4008
- break;
4009
- default:
4010
- WARN_ON(1);
4011
- }
4012
-
4013
- rc = sata_scr_write(link, SCR_CONTROL, scontrol);
4014
- if (rc)
4015
- return rc;
4016
-
4017
- /* give the link time to transit out of LPM state */
4018
- if (woken_up)
4019
- msleep(10);
4020
-
4021
- /* clear PHYRDY_CHG from SError */
4022
- ehc->i.serror &= ~SERR_PHYRDY_CHG;
4023
- return sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG);
4024
-}
3511
+EXPORT_SYMBOL_GPL(ata_wait_after_reset);
40253512
40263513 /**
40273514 * ata_std_prereset - prepare for reset
....@@ -4067,118 +3554,7 @@
40673554
40683555 return 0;
40693556 }
4070
-
4071
-/**
4072
- * sata_link_hardreset - reset link via SATA phy reset
4073
- * @link: link to reset
4074
- * @timing: timing parameters { interval, duration, timeout } in msec
4075
- * @deadline: deadline jiffies for the operation
4076
- * @online: optional out parameter indicating link onlineness
4077
- * @check_ready: optional callback to check link readiness
4078
- *
4079
- * SATA phy-reset @link using DET bits of SControl register.
4080
- * After hardreset, link readiness is waited upon using
4081
- * ata_wait_ready() if @check_ready is specified. LLDs are
4082
- * allowed to not specify @check_ready and wait itself after this
4083
- * function returns. Device classification is LLD's
4084
- * responsibility.
4085
- *
4086
- * *@online is set to one iff reset succeeded and @link is online
4087
- * after reset.
4088
- *
4089
- * LOCKING:
4090
- * Kernel thread context (may sleep)
4091
- *
4092
- * RETURNS:
4093
- * 0 on success, -errno otherwise.
4094
- */
4095
-int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
4096
- unsigned long deadline,
4097
- bool *online, int (*check_ready)(struct ata_link *))
4098
-{
4099
- u32 scontrol;
4100
- int rc;
4101
-
4102
- DPRINTK("ENTER\n");
4103
-
4104
- if (online)
4105
- *online = false;
4106
-
4107
- if (sata_set_spd_needed(link)) {
4108
- /* SATA spec says nothing about how to reconfigure
4109
- * spd. To be on the safe side, turn off phy during
4110
- * reconfiguration. This works for at least ICH7 AHCI
4111
- * and Sil3124.
4112
- */
4113
- if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
4114
- goto out;
4115
-
4116
- scontrol = (scontrol & 0x0f0) | 0x304;
4117
-
4118
- if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol)))
4119
- goto out;
4120
-
4121
- sata_set_spd(link);
4122
- }
4123
-
4124
- /* issue phy wake/reset */
4125
- if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
4126
- goto out;
4127
-
4128
- scontrol = (scontrol & 0x0f0) | 0x301;
4129
-
4130
- if ((rc = sata_scr_write_flush(link, SCR_CONTROL, scontrol)))
4131
- goto out;
4132
-
4133
- /* Couldn't find anything in SATA I/II specs, but AHCI-1.1
4134
- * 10.4.2 says at least 1 ms.
4135
- */
4136
- ata_msleep(link->ap, 1);
4137
-
4138
- /* bring link back */
4139
- rc = sata_link_resume(link, timing, deadline);
4140
- if (rc)
4141
- goto out;
4142
- /* if link is offline nothing more to do */
4143
- if (ata_phys_link_offline(link))
4144
- goto out;
4145
-
4146
- /* Link is online. From this point, -ENODEV too is an error. */
4147
- if (online)
4148
- *online = true;
4149
-
4150
- if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) {
4151
- /* If PMP is supported, we have to do follow-up SRST.
4152
- * Some PMPs don't send D2H Reg FIS after hardreset if
4153
- * the first port is empty. Wait only for
4154
- * ATA_TMOUT_PMP_SRST_WAIT.
4155
- */
4156
- if (check_ready) {
4157
- unsigned long pmp_deadline;
4158
-
4159
- pmp_deadline = ata_deadline(jiffies,
4160
- ATA_TMOUT_PMP_SRST_WAIT);
4161
- if (time_after(pmp_deadline, deadline))
4162
- pmp_deadline = deadline;
4163
- ata_wait_ready(link, pmp_deadline, check_ready);
4164
- }
4165
- rc = -EAGAIN;
4166
- goto out;
4167
- }
4168
-
4169
- rc = 0;
4170
- if (check_ready)
4171
- rc = ata_wait_ready(link, deadline, check_ready);
4172
- out:
4173
- if (rc && rc != -EAGAIN) {
4174
- /* online is set iff link is online && reset succeeded */
4175
- if (online)
4176
- *online = false;
4177
- ata_link_err(link, "COMRESET failed (errno=%d)\n", rc);
4178
- }
4179
- DPRINTK("EXIT, rc=%d\n", rc);
4180
- return rc;
4181
-}
3557
+EXPORT_SYMBOL_GPL(ata_std_prereset);
41823558
41833559 /**
41843560 * sata_std_hardreset - COMRESET w/o waiting or classification
....@@ -4205,6 +3581,7 @@
42053581 rc = sata_link_hardreset(link, timing, deadline, &online, NULL);
42063582 return online ? -EAGAIN : rc;
42073583 }
3584
+EXPORT_SYMBOL_GPL(sata_std_hardreset);
42083585
42093586 /**
42103587 * ata_std_postreset - standard postreset callback
....@@ -4233,6 +3610,7 @@
42333610
42343611 DPRINTK("EXIT\n");
42353612 }
3613
+EXPORT_SYMBOL_GPL(ata_std_postreset);
42363614
42373615 /**
42383616 * ata_dev_same_device - Determine whether new ID matches configured device
....@@ -4505,9 +3883,7 @@
45053883
45063884 /* drives which fail FPDMA_AA activation (some may freeze afterwards)
45073885 the ST disks also have LPM issues */
4508
- { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA |
4509
- ATA_HORKAGE_NOLPM, },
4510
- { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA |
3886
+ { "ST1000LM024 HN-M101MBB", NULL, ATA_HORKAGE_BROKEN_FPDMA_AA |
45113887 ATA_HORKAGE_NOLPM, },
45123888 { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA },
45133889
....@@ -4560,6 +3936,10 @@
45603936 { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
45613937 { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
45623938
3939
+ /* These specific Pioneer models have LPM issues */
3940
+ { "PIONEER BD-RW BDR-207M", NULL, ATA_HORKAGE_NOLPM },
3941
+ { "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM },
3942
+
45633943 /* Crucial BX100 SSD 500GB has broken LPM support */
45643944 { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM },
45653945
....@@ -4597,6 +3977,9 @@
45973977 { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
45983978 ATA_HORKAGE_ZERO_AFTER_TRIM, },
45993979 { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
3980
+ ATA_HORKAGE_ZERO_AFTER_TRIM, },
3981
+ { "Samsung SSD 840 EVO*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
3982
+ ATA_HORKAGE_NO_DMA_LOG |
46003983 ATA_HORKAGE_ZERO_AFTER_TRIM, },
46013984 { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
46023985 ATA_HORKAGE_ZERO_AFTER_TRIM, },
....@@ -5030,11 +4413,13 @@
50304413
50314414 return ATA_DEFER_LINK;
50324415 }
4416
+EXPORT_SYMBOL_GPL(ata_std_qc_defer);
50334417
50344418 enum ata_completion_errors ata_noop_qc_prep(struct ata_queued_cmd *qc)
50354419 {
50364420 return AC_ERR_OK;
50374421 }
4422
+EXPORT_SYMBOL_GPL(ata_noop_qc_prep);
50384423
50394424 /**
50404425 * ata_sg_init - Associate command with scatter-gather table.
....@@ -5350,7 +4735,7 @@
53504735 qc->tf.feature != SETFEATURES_RA_ON &&
53514736 qc->tf.feature != SETFEATURES_RA_OFF)
53524737 break;
5353
- /* fall through */
4738
+ fallthrough;
53544739 case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
53554740 case ATA_CMD_SET_MULTI: /* multi_count changed */
53564741 /* revalidate device */
....@@ -5378,6 +4763,7 @@
53784763 __ata_qc_complete(qc);
53794764 }
53804765 }
4766
+EXPORT_SYMBOL_GPL(ata_qc_complete);
53814767
53824768 /**
53834769 * ata_qc_get_active - get bitmask of active qcs
....@@ -5402,64 +4788,6 @@
54024788 return qc_active;
54034789 }
54044790 EXPORT_SYMBOL_GPL(ata_qc_get_active);
5405
-
5406
-/**
5407
- * ata_qc_complete_multiple - Complete multiple qcs successfully
5408
- * @ap: port in question
5409
- * @qc_active: new qc_active mask
5410
- *
5411
- * Complete in-flight commands. This functions is meant to be
5412
- * called from low-level driver's interrupt routine to complete
5413
- * requests normally. ap->qc_active and @qc_active is compared
5414
- * and commands are completed accordingly.
5415
- *
5416
- * Always use this function when completing multiple NCQ commands
5417
- * from IRQ handlers instead of calling ata_qc_complete()
5418
- * multiple times to keep IRQ expect status properly in sync.
5419
- *
5420
- * LOCKING:
5421
- * spin_lock_irqsave(host lock)
5422
- *
5423
- * RETURNS:
5424
- * Number of completed commands on success, -errno otherwise.
5425
- */
5426
-int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active)
5427
-{
5428
- u64 done_mask, ap_qc_active = ap->qc_active;
5429
- int nr_done = 0;
5430
-
5431
- /*
5432
- * If the internal tag is set on ap->qc_active, then we care about
5433
- * bit0 on the passed in qc_active mask. Move that bit up to match
5434
- * the internal tag.
5435
- */
5436
- if (ap_qc_active & (1ULL << ATA_TAG_INTERNAL)) {
5437
- qc_active |= (qc_active & 0x01) << ATA_TAG_INTERNAL;
5438
- qc_active ^= qc_active & 0x01;
5439
- }
5440
-
5441
- done_mask = ap_qc_active ^ qc_active;
5442
-
5443
- if (unlikely(done_mask & qc_active)) {
5444
- ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n",
5445
- ap->qc_active, qc_active);
5446
- return -EINVAL;
5447
- }
5448
-
5449
- while (done_mask) {
5450
- struct ata_queued_cmd *qc;
5451
- unsigned int tag = __ffs64(done_mask);
5452
-
5453
- qc = ata_qc_from_tag(ap, tag);
5454
- if (qc) {
5455
- ata_qc_complete(qc);
5456
- nr_done++;
5457
- }
5458
- done_mask &= ~(1ULL << tag);
5459
- }
5460
-
5461
- return nr_done;
5462
-}
54634791
54644792 /**
54654793 * ata_qc_issue - issue taskfile to device
....@@ -5537,111 +4865,6 @@
55374865 }
55384866
55394867 /**
5540
- * sata_scr_valid - test whether SCRs are accessible
5541
- * @link: ATA link to test SCR accessibility for
5542
- *
5543
- * Test whether SCRs are accessible for @link.
5544
- *
5545
- * LOCKING:
5546
- * None.
5547
- *
5548
- * RETURNS:
5549
- * 1 if SCRs are accessible, 0 otherwise.
5550
- */
5551
-int sata_scr_valid(struct ata_link *link)
5552
-{
5553
- struct ata_port *ap = link->ap;
5554
-
5555
- return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read;
5556
-}
5557
-
5558
-/**
5559
- * sata_scr_read - read SCR register of the specified port
5560
- * @link: ATA link to read SCR for
5561
- * @reg: SCR to read
5562
- * @val: Place to store read value
5563
- *
5564
- * Read SCR register @reg of @link into *@val. This function is
5565
- * guaranteed to succeed if @link is ap->link, the cable type of
5566
- * the port is SATA and the port implements ->scr_read.
5567
- *
5568
- * LOCKING:
5569
- * None if @link is ap->link. Kernel thread context otherwise.
5570
- *
5571
- * RETURNS:
5572
- * 0 on success, negative errno on failure.
5573
- */
5574
-int sata_scr_read(struct ata_link *link, int reg, u32 *val)
5575
-{
5576
- if (ata_is_host_link(link)) {
5577
- if (sata_scr_valid(link))
5578
- return link->ap->ops->scr_read(link, reg, val);
5579
- return -EOPNOTSUPP;
5580
- }
5581
-
5582
- return sata_pmp_scr_read(link, reg, val);
5583
-}
5584
-
5585
-/**
5586
- * sata_scr_write - write SCR register of the specified port
5587
- * @link: ATA link to write SCR for
5588
- * @reg: SCR to write
5589
- * @val: value to write
5590
- *
5591
- * Write @val to SCR register @reg of @link. This function is
5592
- * guaranteed to succeed if @link is ap->link, the cable type of
5593
- * the port is SATA and the port implements ->scr_read.
5594
- *
5595
- * LOCKING:
5596
- * None if @link is ap->link. Kernel thread context otherwise.
5597
- *
5598
- * RETURNS:
5599
- * 0 on success, negative errno on failure.
5600
- */
5601
-int sata_scr_write(struct ata_link *link, int reg, u32 val)
5602
-{
5603
- if (ata_is_host_link(link)) {
5604
- if (sata_scr_valid(link))
5605
- return link->ap->ops->scr_write(link, reg, val);
5606
- return -EOPNOTSUPP;
5607
- }
5608
-
5609
- return sata_pmp_scr_write(link, reg, val);
5610
-}
5611
-
5612
-/**
5613
- * sata_scr_write_flush - write SCR register of the specified port and flush
5614
- * @link: ATA link to write SCR for
5615
- * @reg: SCR to write
5616
- * @val: value to write
5617
- *
5618
- * This function is identical to sata_scr_write() except that this
5619
- * function performs flush after writing to the register.
5620
- *
5621
- * LOCKING:
5622
- * None if @link is ap->link. Kernel thread context otherwise.
5623
- *
5624
- * RETURNS:
5625
- * 0 on success, negative errno on failure.
5626
- */
5627
-int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
5628
-{
5629
- if (ata_is_host_link(link)) {
5630
- int rc;
5631
-
5632
- if (sata_scr_valid(link)) {
5633
- rc = link->ap->ops->scr_write(link, reg, val);
5634
- if (rc == 0)
5635
- rc = link->ap->ops->scr_read(link, reg, &val);
5636
- return rc;
5637
- }
5638
- return -EOPNOTSUPP;
5639
- }
5640
-
5641
- return sata_pmp_scr_write(link, reg, val);
5642
-}
5643
-
5644
-/**
56454868 * ata_phys_link_online - test whether the given link is online
56464869 * @link: ATA link to test
56474870 *
....@@ -5714,6 +4937,7 @@
57144937 return ata_phys_link_online(link) ||
57154938 (slave && ata_phys_link_online(slave));
57164939 }
4940
+EXPORT_SYMBOL_GPL(ata_link_online);
57174941
57184942 /**
57194943 * ata_link_offline - test whether the given link is offline
....@@ -5740,6 +4964,7 @@
57404964 return ata_phys_link_offline(link) &&
57414965 (!slave || ata_phys_link_offline(slave));
57424966 }
4967
+EXPORT_SYMBOL_GPL(ata_link_offline);
57434968
57444969 #ifdef CONFIG_PM
57454970 static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
....@@ -5749,17 +4974,19 @@
57494974 struct ata_link *link;
57504975 unsigned long flags;
57514976
5752
- /* Previous resume operation might still be in
5753
- * progress. Wait for PM_PENDING to clear.
5754
- */
5755
- if (ap->pflags & ATA_PFLAG_PM_PENDING) {
5756
- ata_port_wait_eh(ap);
5757
- WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5758
- }
5759
-
5760
- /* request PM ops to EH */
57614977 spin_lock_irqsave(ap->lock, flags);
57624978
4979
+ /*
4980
+ * A previous PM operation might still be in progress. Wait for
4981
+ * ATA_PFLAG_PM_PENDING to clear.
4982
+ */
4983
+ if (ap->pflags & ATA_PFLAG_PM_PENDING) {
4984
+ spin_unlock_irqrestore(ap->lock, flags);
4985
+ ata_port_wait_eh(ap);
4986
+ spin_lock_irqsave(ap->lock, flags);
4987
+ }
4988
+
4989
+ /* Request PM operation to EH */
57634990 ap->pm_mesg = mesg;
57644991 ap->pflags |= ATA_PFLAG_PM_PENDING;
57654992 ata_for_each_link(link, ap, HOST_FIRST) {
....@@ -5771,10 +4998,8 @@
57714998
57724999 spin_unlock_irqrestore(ap->lock, flags);
57735000
5774
- if (!async) {
5001
+ if (!async)
57755002 ata_port_wait_eh(ap);
5776
- WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5777
- }
57785003 }
57795004
57805005 /*
....@@ -5926,6 +5151,7 @@
59265151 host->dev->power.power_state = mesg;
59275152 return 0;
59285153 }
5154
+EXPORT_SYMBOL_GPL(ata_host_suspend);
59295155
59305156 /**
59315157 * ata_host_resume - resume host
....@@ -5937,10 +5163,11 @@
59375163 {
59385164 host->dev->power.power_state = PMSG_ON;
59395165 }
5166
+EXPORT_SYMBOL_GPL(ata_host_resume);
59405167 #endif
59415168
59425169 const struct device_type ata_port_type = {
5943
- .name = "ata_port",
5170
+ .name = ATA_PORT_TYPE_NAME,
59445171 #ifdef CONFIG_PM
59455172 .pm = &ata_port_pm_ops,
59465173 #endif
....@@ -6022,7 +5249,7 @@
60225249 * sata_link_init_spd - Initialize link->sata_spd_limit
60235250 * @link: Link to configure sata_spd_limit for
60245251 *
6025
- * Initialize @link->[hw_]sata_spd_limit to the currently
5252
+ * Initialize ``link->[hw_]sata_spd_limit`` to the currently
60265253 * configured value.
60275254 *
60285255 * LOCKING:
....@@ -6156,6 +5383,7 @@
61565383 {
61575384 kref_put(&host->kref, ata_host_release);
61585385 }
5386
+EXPORT_SYMBOL_GPL(ata_host_put);
61595387
61605388 /**
61615389 * ata_host_alloc - allocate and init basic ATA host resources
....@@ -6229,6 +5457,7 @@
62295457 kfree(host);
62305458 return NULL;
62315459 }
5460
+EXPORT_SYMBOL_GPL(ata_host_alloc);
62325461
62335462 /**
62345463 * ata_host_alloc_pinfo - alloc host and init with port_info array
....@@ -6250,7 +5479,7 @@
62505479 const struct ata_port_info * const * ppi,
62515480 int n_ports)
62525481 {
6253
- const struct ata_port_info *pi;
5482
+ const struct ata_port_info *pi = &ata_dummy_port_info;
62545483 struct ata_host *host;
62555484 int i, j;
62565485
....@@ -6258,7 +5487,7 @@
62585487 if (!host)
62595488 return NULL;
62605489
6261
- for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) {
5490
+ for (i = 0, j = 0; i < host->n_ports; i++) {
62625491 struct ata_port *ap = host->ports[i];
62635492
62645493 if (ppi[j])
....@@ -6277,68 +5506,7 @@
62775506
62785507 return host;
62795508 }
6280
-
6281
-/**
6282
- * ata_slave_link_init - initialize slave link
6283
- * @ap: port to initialize slave link for
6284
- *
6285
- * Create and initialize slave link for @ap. This enables slave
6286
- * link handling on the port.
6287
- *
6288
- * In libata, a port contains links and a link contains devices.
6289
- * There is single host link but if a PMP is attached to it,
6290
- * there can be multiple fan-out links. On SATA, there's usually
6291
- * a single device connected to a link but PATA and SATA
6292
- * controllers emulating TF based interface can have two - master
6293
- * and slave.
6294
- *
6295
- * However, there are a few controllers which don't fit into this
6296
- * abstraction too well - SATA controllers which emulate TF
6297
- * interface with both master and slave devices but also have
6298
- * separate SCR register sets for each device. These controllers
6299
- * need separate links for physical link handling
6300
- * (e.g. onlineness, link speed) but should be treated like a
6301
- * traditional M/S controller for everything else (e.g. command
6302
- * issue, softreset).
6303
- *
6304
- * slave_link is libata's way of handling this class of
6305
- * controllers without impacting core layer too much. For
6306
- * anything other than physical link handling, the default host
6307
- * link is used for both master and slave. For physical link
6308
- * handling, separate @ap->slave_link is used. All dirty details
6309
- * are implemented inside libata core layer. From LLD's POV, the
6310
- * only difference is that prereset, hardreset and postreset are
6311
- * called once more for the slave link, so the reset sequence
6312
- * looks like the following.
6313
- *
6314
- * prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) ->
6315
- * softreset(M) -> postreset(M) -> postreset(S)
6316
- *
6317
- * Note that softreset is called only for the master. Softreset
6318
- * resets both M/S by definition, so SRST on master should handle
6319
- * both (the standard method will work just fine).
6320
- *
6321
- * LOCKING:
6322
- * Should be called before host is registered.
6323
- *
6324
- * RETURNS:
6325
- * 0 on success, -errno on failure.
6326
- */
6327
-int ata_slave_link_init(struct ata_port *ap)
6328
-{
6329
- struct ata_link *link;
6330
-
6331
- WARN_ON(ap->slave_link);
6332
- WARN_ON(ap->flags & ATA_FLAG_PMP);
6333
-
6334
- link = kzalloc(sizeof(*link), GFP_KERNEL);
6335
- if (!link)
6336
- return -ENOMEM;
6337
-
6338
- ata_link_init(ap, link, 1);
6339
- ap->slave_link = link;
6340
- return 0;
6341
-}
5509
+EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo);
63425510
63435511 static void ata_host_stop(struct device *gendev, void *res)
63445512 {
....@@ -6487,9 +5655,10 @@
64875655 devres_free(start_dr);
64885656 return rc;
64895657 }
5658
+EXPORT_SYMBOL_GPL(ata_host_start);
64905659
64915660 /**
6492
- * ata_sas_host_init - Initialize a host struct for sas (ipr, libsas)
5661
+ * ata_host_init - Initialize a host struct for sas (ipr, libsas)
64935662 * @host: host to initialize
64945663 * @dev: device host is attached to
64955664 * @ops: port_ops
....@@ -6505,6 +5674,7 @@
65055674 host->ops = ops;
65065675 kref_init(&host->kref);
65075676 }
5677
+EXPORT_SYMBOL_GPL(ata_host_init);
65085678
65095679 void __ata_port_probe(struct ata_port *ap)
65105680 {
....@@ -6660,6 +5830,7 @@
66605830 return rc;
66615831
66625832 }
5833
+EXPORT_SYMBOL_GPL(ata_host_register);
66635834
66645835 /**
66655836 * ata_host_activate - start host, request IRQ and register it
....@@ -6722,6 +5893,7 @@
67225893
67235894 return rc;
67245895 }
5896
+EXPORT_SYMBOL_GPL(ata_host_activate);
67255897
67265898 /**
67275899 * ata_port_detach - Detach ATA port in preparation of device removal
....@@ -6743,11 +5915,30 @@
67435915 if (!ap->ops->error_handler)
67445916 goto skip_eh;
67455917
6746
- /* tell EH we're leaving & flush EH */
5918
+ /* Wait for any ongoing EH */
5919
+ ata_port_wait_eh(ap);
5920
+
5921
+ mutex_lock(&ap->scsi_scan_mutex);
67475922 spin_lock_irqsave(ap->lock, flags);
5923
+
5924
+ /* Remove scsi devices */
5925
+ ata_for_each_link(link, ap, HOST_FIRST) {
5926
+ ata_for_each_dev(dev, link, ALL) {
5927
+ if (dev->sdev) {
5928
+ spin_unlock_irqrestore(ap->lock, flags);
5929
+ scsi_remove_device(dev->sdev);
5930
+ spin_lock_irqsave(ap->lock, flags);
5931
+ dev->sdev = NULL;
5932
+ }
5933
+ }
5934
+ }
5935
+
5936
+ /* Tell EH to disable all devices */
67485937 ap->pflags |= ATA_PFLAG_UNLOADING;
67495938 ata_port_schedule_eh(ap);
5939
+
67505940 spin_unlock_irqrestore(ap->lock, flags);
5941
+ mutex_unlock(&ap->scsi_scan_mutex);
67515942
67525943 /* wait till EH commits suicide */
67535944 ata_port_wait_eh(ap);
....@@ -6797,6 +5988,7 @@
67975988 /* the host is dead now, dissociate ACPI */
67985989 ata_acpi_dissociate(host);
67995990 }
5991
+EXPORT_SYMBOL_GPL(ata_host_detach);
68005992
68015993 #ifdef CONFIG_PCI
68025994
....@@ -6817,6 +6009,7 @@
68176009
68186010 ata_host_detach(host);
68196011 }
6012
+EXPORT_SYMBOL_GPL(ata_pci_remove_one);
68206013
68216014 void ata_pci_shutdown_one(struct pci_dev *pdev)
68226015 {
....@@ -6837,6 +6030,7 @@
68376030 ap->ops->port_stop(ap);
68386031 }
68396032 }
6033
+EXPORT_SYMBOL_GPL(ata_pci_shutdown_one);
68406034
68416035 /* move to PCI subsystem */
68426036 int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
....@@ -6871,6 +6065,7 @@
68716065
68726066 return (tmp == bits->val) ? 1 : 0;
68736067 }
6068
+EXPORT_SYMBOL_GPL(pci_test_config_bits);
68746069
68756070 #ifdef CONFIG_PM
68766071 void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg)
....@@ -6881,6 +6076,7 @@
68816076 if (mesg.event & PM_EVENT_SLEEP)
68826077 pci_set_power_state(pdev, PCI_D3hot);
68836078 }
6079
+EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend);
68846080
68856081 int ata_pci_device_do_resume(struct pci_dev *pdev)
68866082 {
....@@ -6899,6 +6095,7 @@
68996095 pci_set_master(pdev);
69006096 return 0;
69016097 }
6098
+EXPORT_SYMBOL_GPL(ata_pci_device_do_resume);
69026099
69036100 int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
69046101 {
....@@ -6913,6 +6110,7 @@
69136110
69146111 return 0;
69156112 }
6113
+EXPORT_SYMBOL_GPL(ata_pci_device_suspend);
69166114
69176115 int ata_pci_device_resume(struct pci_dev *pdev)
69186116 {
....@@ -6924,8 +6122,8 @@
69246122 ata_host_resume(host);
69256123 return rc;
69266124 }
6125
+EXPORT_SYMBOL_GPL(ata_pci_device_resume);
69276126 #endif /* CONFIG_PM */
6928
-
69296127 #endif /* CONFIG_PCI */
69306128
69316129 /**
....@@ -6947,7 +6145,9 @@
69476145
69486146 return 0;
69496147 }
6148
+EXPORT_SYMBOL_GPL(ata_platform_remove_one);
69506149
6150
+#ifdef CONFIG_ATA_FORCE
69516151 static int __init ata_parse_force_one(char **cur,
69526152 struct ata_force_ent *force_ent,
69536153 const char **reason)
....@@ -7129,6 +6329,15 @@
71296329 ata_force_tbl_size = idx;
71306330 }
71316331
6332
+static void ata_free_force_param(void)
6333
+{
6334
+ kfree(ata_force_tbl);
6335
+}
6336
+#else
6337
+static inline void ata_parse_force_param(void) { }
6338
+static inline void ata_free_force_param(void) { }
6339
+#endif
6340
+
71326341 static int __init ata_init(void)
71336342 {
71346343 int rc;
....@@ -7137,7 +6346,7 @@
71376346
71386347 rc = ata_sff_init();
71396348 if (rc) {
7140
- kfree(ata_force_tbl);
6349
+ ata_free_force_param();
71416350 return rc;
71426351 }
71436352
....@@ -7161,7 +6370,7 @@
71616370 ata_release_transport(ata_scsi_transport_template);
71626371 libata_transport_exit();
71636372 ata_sff_exit();
7164
- kfree(ata_force_tbl);
6373
+ ata_free_force_param();
71656374 }
71666375
71676376 subsys_initcall(ata_init);
....@@ -7173,6 +6382,7 @@
71736382 {
71746383 return __ratelimit(&ratelimit);
71756384 }
6385
+EXPORT_SYMBOL_GPL(ata_ratelimit);
71766386
71776387 /**
71786388 * ata_msleep - ATA EH owner aware msleep
....@@ -7205,6 +6415,7 @@
72056415 if (owns_eh)
72066416 ata_eh_acquire(ap);
72076417 }
6418
+EXPORT_SYMBOL_GPL(ata_msleep);
72086419
72096420 /**
72106421 * ata_wait_register - wait until register value changes
....@@ -7251,38 +6462,7 @@
72516462
72526463 return tmp;
72536464 }
7254
-
7255
-/**
7256
- * sata_lpm_ignore_phy_events - test if PHY event should be ignored
7257
- * @link: Link receiving the event
7258
- *
7259
- * Test whether the received PHY event has to be ignored or not.
7260
- *
7261
- * LOCKING:
7262
- * None:
7263
- *
7264
- * RETURNS:
7265
- * True if the event has to be ignored.
7266
- */
7267
-bool sata_lpm_ignore_phy_events(struct ata_link *link)
7268
-{
7269
- unsigned long lpm_timeout = link->last_lpm_change +
7270
- msecs_to_jiffies(ATA_TMOUT_SPURIOUS_PHY);
7271
-
7272
- /* if LPM is enabled, PHYRDY doesn't mean anything */
7273
- if (link->lpm_policy > ATA_LPM_MAX_POWER)
7274
- return true;
7275
-
7276
- /* ignore the first PHY event after the LPM policy changed
7277
- * as it is might be spurious
7278
- */
7279
- if ((link->flags & ATA_LFLAG_CHANGED) &&
7280
- time_before(jiffies, lpm_timeout))
7281
- return true;
7282
-
7283
- return false;
7284
-}
7285
-EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events);
6465
+EXPORT_SYMBOL_GPL(ata_wait_register);
72866466
72876467 /*
72886468 * Dummy port_ops
....@@ -7304,10 +6484,12 @@
73046484 .sched_eh = ata_std_sched_eh,
73056485 .end_eh = ata_std_end_eh,
73066486 };
6487
+EXPORT_SYMBOL_GPL(ata_dummy_port_ops);
73076488
73086489 const struct ata_port_info ata_dummy_port_info = {
73096490 .port_ops = &ata_dummy_port_ops,
73106491 };
6492
+EXPORT_SYMBOL_GPL(ata_dummy_port_info);
73116493
73126494 /*
73136495 * Utility print functions
....@@ -7375,127 +6557,3 @@
73756557 dev_printk(KERN_DEBUG, dev, "version %s\n", version);
73766558 }
73776559 EXPORT_SYMBOL(ata_print_version);
7378
-
7379
-/*
7380
- * libata is essentially a library of internal helper functions for
7381
- * low-level ATA host controller drivers. As such, the API/ABI is
7382
- * likely to change as new drivers are added and updated.
7383
- * Do not depend on ABI/API stability.
7384
- */
7385
-EXPORT_SYMBOL_GPL(sata_deb_timing_normal);
7386
-EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug);
7387
-EXPORT_SYMBOL_GPL(sata_deb_timing_long);
7388
-EXPORT_SYMBOL_GPL(ata_base_port_ops);
7389
-EXPORT_SYMBOL_GPL(sata_port_ops);
7390
-EXPORT_SYMBOL_GPL(ata_dummy_port_ops);
7391
-EXPORT_SYMBOL_GPL(ata_dummy_port_info);
7392
-EXPORT_SYMBOL_GPL(ata_link_next);
7393
-EXPORT_SYMBOL_GPL(ata_dev_next);
7394
-EXPORT_SYMBOL_GPL(ata_std_bios_param);
7395
-EXPORT_SYMBOL_GPL(ata_scsi_unlock_native_capacity);
7396
-EXPORT_SYMBOL_GPL(ata_host_init);
7397
-EXPORT_SYMBOL_GPL(ata_host_alloc);
7398
-EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo);
7399
-EXPORT_SYMBOL_GPL(ata_slave_link_init);
7400
-EXPORT_SYMBOL_GPL(ata_host_start);
7401
-EXPORT_SYMBOL_GPL(ata_host_register);
7402
-EXPORT_SYMBOL_GPL(ata_host_activate);
7403
-EXPORT_SYMBOL_GPL(ata_host_detach);
7404
-EXPORT_SYMBOL_GPL(ata_sg_init);
7405
-EXPORT_SYMBOL_GPL(ata_qc_complete);
7406
-EXPORT_SYMBOL_GPL(ata_qc_complete_multiple);
7407
-EXPORT_SYMBOL_GPL(atapi_cmd_type);
7408
-EXPORT_SYMBOL_GPL(ata_tf_to_fis);
7409
-EXPORT_SYMBOL_GPL(ata_tf_from_fis);
7410
-EXPORT_SYMBOL_GPL(ata_pack_xfermask);
7411
-EXPORT_SYMBOL_GPL(ata_unpack_xfermask);
7412
-EXPORT_SYMBOL_GPL(ata_xfer_mask2mode);
7413
-EXPORT_SYMBOL_GPL(ata_xfer_mode2mask);
7414
-EXPORT_SYMBOL_GPL(ata_xfer_mode2shift);
7415
-EXPORT_SYMBOL_GPL(ata_mode_string);
7416
-EXPORT_SYMBOL_GPL(ata_id_xfermask);
7417
-EXPORT_SYMBOL_GPL(ata_do_set_mode);
7418
-EXPORT_SYMBOL_GPL(ata_std_qc_defer);
7419
-EXPORT_SYMBOL_GPL(ata_noop_qc_prep);
7420
-EXPORT_SYMBOL_GPL(ata_dev_disable);
7421
-EXPORT_SYMBOL_GPL(sata_set_spd);
7422
-EXPORT_SYMBOL_GPL(ata_wait_after_reset);
7423
-EXPORT_SYMBOL_GPL(sata_link_debounce);
7424
-EXPORT_SYMBOL_GPL(sata_link_resume);
7425
-EXPORT_SYMBOL_GPL(sata_link_scr_lpm);
7426
-EXPORT_SYMBOL_GPL(ata_std_prereset);
7427
-EXPORT_SYMBOL_GPL(sata_link_hardreset);
7428
-EXPORT_SYMBOL_GPL(sata_std_hardreset);
7429
-EXPORT_SYMBOL_GPL(ata_std_postreset);
7430
-EXPORT_SYMBOL_GPL(ata_dev_classify);
7431
-EXPORT_SYMBOL_GPL(ata_dev_pair);
7432
-EXPORT_SYMBOL_GPL(ata_ratelimit);
7433
-EXPORT_SYMBOL_GPL(ata_msleep);
7434
-EXPORT_SYMBOL_GPL(ata_wait_register);
7435
-EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
7436
-EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
7437
-EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy);
7438
-EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
7439
-EXPORT_SYMBOL_GPL(__ata_change_queue_depth);
7440
-EXPORT_SYMBOL_GPL(sata_scr_valid);
7441
-EXPORT_SYMBOL_GPL(sata_scr_read);
7442
-EXPORT_SYMBOL_GPL(sata_scr_write);
7443
-EXPORT_SYMBOL_GPL(sata_scr_write_flush);
7444
-EXPORT_SYMBOL_GPL(ata_link_online);
7445
-EXPORT_SYMBOL_GPL(ata_link_offline);
7446
-#ifdef CONFIG_PM
7447
-EXPORT_SYMBOL_GPL(ata_host_suspend);
7448
-EXPORT_SYMBOL_GPL(ata_host_resume);
7449
-#endif /* CONFIG_PM */
7450
-EXPORT_SYMBOL_GPL(ata_id_string);
7451
-EXPORT_SYMBOL_GPL(ata_id_c_string);
7452
-EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
7453
-EXPORT_SYMBOL_GPL(ata_scsi_simulate);
7454
-
7455
-EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
7456
-EXPORT_SYMBOL_GPL(ata_timing_find_mode);
7457
-EXPORT_SYMBOL_GPL(ata_timing_compute);
7458
-EXPORT_SYMBOL_GPL(ata_timing_merge);
7459
-EXPORT_SYMBOL_GPL(ata_timing_cycle2mode);
7460
-
7461
-#ifdef CONFIG_PCI
7462
-EXPORT_SYMBOL_GPL(pci_test_config_bits);
7463
-EXPORT_SYMBOL_GPL(ata_pci_shutdown_one);
7464
-EXPORT_SYMBOL_GPL(ata_pci_remove_one);
7465
-#ifdef CONFIG_PM
7466
-EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend);
7467
-EXPORT_SYMBOL_GPL(ata_pci_device_do_resume);
7468
-EXPORT_SYMBOL_GPL(ata_pci_device_suspend);
7469
-EXPORT_SYMBOL_GPL(ata_pci_device_resume);
7470
-#endif /* CONFIG_PM */
7471
-#endif /* CONFIG_PCI */
7472
-
7473
-EXPORT_SYMBOL_GPL(ata_platform_remove_one);
7474
-
7475
-EXPORT_SYMBOL_GPL(__ata_ehi_push_desc);
7476
-EXPORT_SYMBOL_GPL(ata_ehi_push_desc);
7477
-EXPORT_SYMBOL_GPL(ata_ehi_clear_desc);
7478
-EXPORT_SYMBOL_GPL(ata_port_desc);
7479
-#ifdef CONFIG_PCI
7480
-EXPORT_SYMBOL_GPL(ata_port_pbar_desc);
7481
-#endif /* CONFIG_PCI */
7482
-EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
7483
-EXPORT_SYMBOL_GPL(ata_link_abort);
7484
-EXPORT_SYMBOL_GPL(ata_port_abort);
7485
-EXPORT_SYMBOL_GPL(ata_port_freeze);
7486
-EXPORT_SYMBOL_GPL(sata_async_notification);
7487
-EXPORT_SYMBOL_GPL(ata_eh_freeze_port);
7488
-EXPORT_SYMBOL_GPL(ata_eh_thaw_port);
7489
-EXPORT_SYMBOL_GPL(ata_eh_qc_complete);
7490
-EXPORT_SYMBOL_GPL(ata_eh_qc_retry);
7491
-EXPORT_SYMBOL_GPL(ata_eh_analyze_ncq_error);
7492
-EXPORT_SYMBOL_GPL(ata_do_eh);
7493
-EXPORT_SYMBOL_GPL(ata_std_error_handler);
7494
-
7495
-EXPORT_SYMBOL_GPL(ata_cable_40wire);
7496
-EXPORT_SYMBOL_GPL(ata_cable_80wire);
7497
-EXPORT_SYMBOL_GPL(ata_cable_unknown);
7498
-EXPORT_SYMBOL_GPL(ata_cable_ignore);
7499
-EXPORT_SYMBOL_GPL(ata_cable_sata);
7500
-EXPORT_SYMBOL_GPL(ata_host_get);
7501
-EXPORT_SYMBOL_GPL(ata_host_put);