diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci_sunxi.c | 16 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 20 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 7 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 31 | ||||
-rw-r--r-- | drivers/ata/libata-transport.c | 1 |
5 files changed, 62 insertions, 13 deletions
diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c index e44d675a30ec..b5aedca5ea3c 100644 --- a/drivers/ata/ahci_sunxi.c +++ b/drivers/ata/ahci_sunxi.c | |||
@@ -27,6 +27,12 @@ | |||
27 | #include <linux/regulator/consumer.h> | 27 | #include <linux/regulator/consumer.h> |
28 | #include "ahci.h" | 28 | #include "ahci.h" |
29 | 29 | ||
30 | /* Insmod parameters */ | ||
31 | static bool enable_pmp; | ||
32 | module_param(enable_pmp, bool, 0); | ||
33 | MODULE_PARM_DESC(enable_pmp, | ||
34 | "Enable support for sata port multipliers, only use if you use a pmp!"); | ||
35 | |||
30 | #define AHCI_BISTAFR 0x00a0 | 36 | #define AHCI_BISTAFR 0x00a0 |
31 | #define AHCI_BISTCR 0x00a4 | 37 | #define AHCI_BISTCR 0x00a4 |
32 | #define AHCI_BISTFCTR 0x00a8 | 38 | #define AHCI_BISTFCTR 0x00a8 |
@@ -184,7 +190,15 @@ static int ahci_sunxi_probe(struct platform_device *pdev) | |||
184 | goto disable_resources; | 190 | goto disable_resources; |
185 | 191 | ||
186 | hpriv->flags = AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI | | 192 | hpriv->flags = AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI | |
187 | AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ; | 193 | AHCI_HFLAG_YES_NCQ; |
194 | |||
195 | /* | ||
196 | * The sunxi sata controller seems to be unable to successfully do a | ||
197 | * soft reset if no pmp is attached, so disable pmp use unless | ||
198 | * requested, otherwise directly attached disks do not work. | ||
199 | */ | ||
200 | if (!enable_pmp) | ||
201 | hpriv->flags |= AHCI_HFLAG_NO_PMP; | ||
188 | 202 | ||
189 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info); | 203 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info); |
190 | if (rc) | 204 | if (rc) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c5ba15af87d3..5c84fb5c3372 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1043,8 +1043,8 @@ const char *sata_spd_string(unsigned int spd) | |||
1043 | * None. | 1043 | * None. |
1044 | * | 1044 | * |
1045 | * RETURNS: | 1045 | * RETURNS: |
1046 | * Device type, %ATA_DEV_ATA, %ATA_DEV_ATAPI, %ATA_DEV_PMP or | 1046 | * Device type, %ATA_DEV_ATA, %ATA_DEV_ATAPI, %ATA_DEV_PMP, |
1047 | * %ATA_DEV_UNKNOWN the event of failure. | 1047 | * %ATA_DEV_ZAC, or %ATA_DEV_UNKNOWN the event of failure. |
1048 | */ | 1048 | */ |
1049 | unsigned int ata_dev_classify(const struct ata_taskfile *tf) | 1049 | unsigned int ata_dev_classify(const struct ata_taskfile *tf) |
1050 | { | 1050 | { |
@@ -1089,6 +1089,11 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf) | |||
1089 | return ATA_DEV_SEMB; | 1089 | return ATA_DEV_SEMB; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | if ((tf->lbam == 0xcd) && (tf->lbah == 0xab)) { | ||
1093 | DPRINTK("found ZAC device by sig\n"); | ||
1094 | return ATA_DEV_ZAC; | ||
1095 | } | ||
1096 | |||
1092 | DPRINTK("unknown device\n"); | 1097 | DPRINTK("unknown device\n"); |
1093 | return ATA_DEV_UNKNOWN; | 1098 | return ATA_DEV_UNKNOWN; |
1094 | } | 1099 | } |
@@ -1329,7 +1334,7 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1329 | int rc; | 1334 | int rc; |
1330 | 1335 | ||
1331 | /* do we need to do it? */ | 1336 | /* do we need to do it? */ |
1332 | if (dev->class != ATA_DEV_ATA || | 1337 | if ((dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC) || |
1333 | !ata_id_has_lba(dev->id) || !ata_id_hpa_enabled(dev->id) || | 1338 | !ata_id_has_lba(dev->id) || !ata_id_hpa_enabled(dev->id) || |
1334 | (dev->horkage & ATA_HORKAGE_BROKEN_HPA)) | 1339 | (dev->horkage & ATA_HORKAGE_BROKEN_HPA)) |
1335 | return 0; | 1340 | return 0; |
@@ -1889,6 +1894,7 @@ retry: | |||
1889 | case ATA_DEV_SEMB: | 1894 | case ATA_DEV_SEMB: |
1890 | class = ATA_DEV_ATA; /* some hard drives report SEMB sig */ | 1895 | class = ATA_DEV_ATA; /* some hard drives report SEMB sig */ |
1891 | case ATA_DEV_ATA: | 1896 | case ATA_DEV_ATA: |
1897 | case ATA_DEV_ZAC: | ||
1892 | tf.command = ATA_CMD_ID_ATA; | 1898 | tf.command = ATA_CMD_ID_ATA; |
1893 | break; | 1899 | break; |
1894 | case ATA_DEV_ATAPI: | 1900 | case ATA_DEV_ATAPI: |
@@ -1980,7 +1986,7 @@ retry: | |||
1980 | rc = -EINVAL; | 1986 | rc = -EINVAL; |
1981 | reason = "device reports invalid type"; | 1987 | reason = "device reports invalid type"; |
1982 | 1988 | ||
1983 | if (class == ATA_DEV_ATA) { | 1989 | if (class == ATA_DEV_ATA || class == ATA_DEV_ZAC) { |
1984 | if (!ata_id_is_ata(id) && !ata_id_is_cfa(id)) | 1990 | if (!ata_id_is_ata(id) && !ata_id_is_cfa(id)) |
1985 | goto err_out; | 1991 | goto err_out; |
1986 | if (ap->host->flags & ATA_HOST_IGNORE_ATA && | 1992 | if (ap->host->flags & ATA_HOST_IGNORE_ATA && |
@@ -2015,7 +2021,8 @@ retry: | |||
2015 | goto retry; | 2021 | goto retry; |
2016 | } | 2022 | } |
2017 | 2023 | ||
2018 | if ((flags & ATA_READID_POSTRESET) && class == ATA_DEV_ATA) { | 2024 | if ((flags & ATA_READID_POSTRESET) && |
2025 | (class == ATA_DEV_ATA || class == ATA_DEV_ZAC)) { | ||
2019 | /* | 2026 | /* |
2020 | * The exact sequence expected by certain pre-ATA4 drives is: | 2027 | * The exact sequence expected by certain pre-ATA4 drives is: |
2021 | * SRST RESET | 2028 | * SRST RESET |
@@ -2280,7 +2287,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2280 | sizeof(modelbuf)); | 2287 | sizeof(modelbuf)); |
2281 | 2288 | ||
2282 | /* ATA-specific feature tests */ | 2289 | /* ATA-specific feature tests */ |
2283 | if (dev->class == ATA_DEV_ATA) { | 2290 | if (dev->class == ATA_DEV_ATA || dev->class == ATA_DEV_ZAC) { |
2284 | if (ata_id_is_cfa(id)) { | 2291 | if (ata_id_is_cfa(id)) { |
2285 | /* CPRM may make this media unusable */ | 2292 | /* CPRM may make this media unusable */ |
2286 | if (id[ATA_ID_CFA_KEY_MGMT] & 1) | 2293 | if (id[ATA_ID_CFA_KEY_MGMT] & 1) |
@@ -4033,6 +4040,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | |||
4033 | if (ata_class_enabled(new_class) && | 4040 | if (ata_class_enabled(new_class) && |
4034 | new_class != ATA_DEV_ATA && | 4041 | new_class != ATA_DEV_ATA && |
4035 | new_class != ATA_DEV_ATAPI && | 4042 | new_class != ATA_DEV_ATAPI && |
4043 | new_class != ATA_DEV_ZAC && | ||
4036 | new_class != ATA_DEV_SEMB) { | 4044 | new_class != ATA_DEV_SEMB) { |
4037 | ata_dev_info(dev, "class mismatch %u != %u\n", | 4045 | ata_dev_info(dev, "class mismatch %u != %u\n", |
4038 | dev->class, new_class); | 4046 | dev->class, new_class); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index dad83df555c4..3dbec8954c86 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1809,6 +1809,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
1809 | 1809 | ||
1810 | switch (qc->dev->class) { | 1810 | switch (qc->dev->class) { |
1811 | case ATA_DEV_ATA: | 1811 | case ATA_DEV_ATA: |
1812 | case ATA_DEV_ZAC: | ||
1812 | if (err & ATA_ICRC) | 1813 | if (err & ATA_ICRC) |
1813 | qc->err_mask |= AC_ERR_ATA_BUS; | 1814 | qc->err_mask |= AC_ERR_ATA_BUS; |
1814 | if (err & (ATA_UNC | ATA_AMNF)) | 1815 | if (err & (ATA_UNC | ATA_AMNF)) |
@@ -3792,7 +3793,8 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3792 | struct ata_eh_context *ehc = &link->eh_context; | 3793 | struct ata_eh_context *ehc = &link->eh_context; |
3793 | unsigned long tmp; | 3794 | unsigned long tmp; |
3794 | 3795 | ||
3795 | if (dev->class != ATA_DEV_ATA) | 3796 | if (dev->class != ATA_DEV_ATA && |
3797 | dev->class != ATA_DEV_ZAC) | ||
3796 | continue; | 3798 | continue; |
3797 | if (!(ehc->i.dev_action[dev->devno] & | 3799 | if (!(ehc->i.dev_action[dev->devno] & |
3798 | ATA_EH_PARK)) | 3800 | ATA_EH_PARK)) |
@@ -3873,7 +3875,8 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3873 | 3875 | ||
3874 | /* retry flush if necessary */ | 3876 | /* retry flush if necessary */ |
3875 | ata_for_each_dev(dev, link, ALL) { | 3877 | ata_for_each_dev(dev, link, ALL) { |
3876 | if (dev->class != ATA_DEV_ATA) | 3878 | if (dev->class != ATA_DEV_ATA && |
3879 | dev->class != ATA_DEV_ZAC) | ||
3877 | continue; | 3880 | continue; |
3878 | rc = ata_eh_maybe_retry_flush(dev); | 3881 | rc = ata_eh_maybe_retry_flush(dev); |
3879 | if (rc) | 3882 | if (rc) |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index dd45c6a03e5d..e364e86e84d7 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -235,7 +235,8 @@ static ssize_t ata_scsi_park_store(struct device *device, | |||
235 | rc = -ENODEV; | 235 | rc = -ENODEV; |
236 | goto unlock; | 236 | goto unlock; |
237 | } | 237 | } |
238 | if (dev->class != ATA_DEV_ATA) { | 238 | if (dev->class != ATA_DEV_ATA && |
239 | dev->class != ATA_DEV_ZAC) { | ||
239 | rc = -EOPNOTSUPP; | 240 | rc = -EOPNOTSUPP; |
240 | goto unlock; | 241 | goto unlock; |
241 | } | 242 | } |
@@ -1961,6 +1962,7 @@ static void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | |||
1961 | static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | 1962 | static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) |
1962 | { | 1963 | { |
1963 | const u8 versions[] = { | 1964 | const u8 versions[] = { |
1965 | 0x00, | ||
1964 | 0x60, /* SAM-3 (no version claimed) */ | 1966 | 0x60, /* SAM-3 (no version claimed) */ |
1965 | 1967 | ||
1966 | 0x03, | 1968 | 0x03, |
@@ -1969,6 +1971,20 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | |||
1969 | 0x02, | 1971 | 0x02, |
1970 | 0x60 /* SPC-3 (no version claimed) */ | 1972 | 0x60 /* SPC-3 (no version claimed) */ |
1971 | }; | 1973 | }; |
1974 | const u8 versions_zbc[] = { | ||
1975 | 0x00, | ||
1976 | 0xA0, /* SAM-5 (no version claimed) */ | ||
1977 | |||
1978 | 0x04, | ||
1979 | 0xC0, /* SBC-3 (no version claimed) */ | ||
1980 | |||
1981 | 0x04, | ||
1982 | 0x60, /* SPC-4 (no version claimed) */ | ||
1983 | |||
1984 | 0x60, | ||
1985 | 0x20, /* ZBC (no version claimed) */ | ||
1986 | }; | ||
1987 | |||
1972 | u8 hdr[] = { | 1988 | u8 hdr[] = { |
1973 | TYPE_DISK, | 1989 | TYPE_DISK, |
1974 | 0, | 1990 | 0, |
@@ -1983,6 +1999,11 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | |||
1983 | if (ata_id_removeable(args->id)) | 1999 | if (ata_id_removeable(args->id)) |
1984 | hdr[1] |= (1 << 7); | 2000 | hdr[1] |= (1 << 7); |
1985 | 2001 | ||
2002 | if (args->dev->class == ATA_DEV_ZAC) { | ||
2003 | hdr[0] = TYPE_ZBC; | ||
2004 | hdr[2] = 0x6; /* ZBC is defined in SPC-4 */ | ||
2005 | } | ||
2006 | |||
1986 | memcpy(rbuf, hdr, sizeof(hdr)); | 2007 | memcpy(rbuf, hdr, sizeof(hdr)); |
1987 | memcpy(&rbuf[8], "ATA ", 8); | 2008 | memcpy(&rbuf[8], "ATA ", 8); |
1988 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); | 2009 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); |
@@ -1995,7 +2016,10 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | |||
1995 | if (rbuf[32] == 0 || rbuf[32] == ' ') | 2016 | if (rbuf[32] == 0 || rbuf[32] == ' ') |
1996 | memcpy(&rbuf[32], "n/a ", 4); | 2017 | memcpy(&rbuf[32], "n/a ", 4); |
1997 | 2018 | ||
1998 | memcpy(rbuf + 59, versions, sizeof(versions)); | 2019 | if (args->dev->class == ATA_DEV_ZAC) |
2020 | memcpy(rbuf + 58, versions_zbc, sizeof(versions_zbc)); | ||
2021 | else | ||
2022 | memcpy(rbuf + 58, versions, sizeof(versions)); | ||
1999 | 2023 | ||
2000 | return 0; | 2024 | return 0; |
2001 | } | 2025 | } |
@@ -2564,7 +2588,6 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) | |||
2564 | 2588 | ||
2565 | DPRINTK("ATAPI request sense\n"); | 2589 | DPRINTK("ATAPI request sense\n"); |
2566 | 2590 | ||
2567 | /* FIXME: is this needed? */ | ||
2568 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 2591 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
2569 | 2592 | ||
2570 | #ifdef CONFIG_ATA_SFF | 2593 | #ifdef CONFIG_ATA_SFF |
@@ -3405,7 +3428,7 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
3405 | ata_xlat_func_t xlat_func; | 3428 | ata_xlat_func_t xlat_func; |
3406 | int rc = 0; | 3429 | int rc = 0; |
3407 | 3430 | ||
3408 | if (dev->class == ATA_DEV_ATA) { | 3431 | if (dev->class == ATA_DEV_ATA || dev->class == ATA_DEV_ZAC) { |
3409 | if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len)) | 3432 | if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len)) |
3410 | goto bad_cdb_len; | 3433 | goto bad_cdb_len; |
3411 | 3434 | ||
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index e37413228228..3227b7c8a05f 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c | |||
@@ -143,6 +143,7 @@ static struct { | |||
143 | { ATA_DEV_PMP_UNSUP, "pmp" }, | 143 | { ATA_DEV_PMP_UNSUP, "pmp" }, |
144 | { ATA_DEV_SEMB, "semb" }, | 144 | { ATA_DEV_SEMB, "semb" }, |
145 | { ATA_DEV_SEMB_UNSUP, "semb" }, | 145 | { ATA_DEV_SEMB_UNSUP, "semb" }, |
146 | { ATA_DEV_ZAC, "zac" }, | ||
146 | { ATA_DEV_NONE, "none" } | 147 | { ATA_DEV_NONE, "none" } |
147 | }; | 148 | }; |
148 | ata_bitfield_name_search(class, ata_class_names) | 149 | ata_bitfield_name_search(class, ata_class_names) |