Skip to content

Commit d6e6c48

Browse files
committed
Merge branch 'for-3.16-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata fixes from Tejun Heo: "Late libata fixes. The most important one is from Kevin Hao which makes sure that libata only allocates tags inside the max tag number the controller supports. libata always had this problem but the recent tag allocation change and addition of support for sata_fsl which only supports queue depth of 16 exposed the issue. Hans de Goede agreed to become the maintainer of libahci_platform which is under higher than usual development pressure from all the new controllers popping up from the ARM world" * 'for-3.16-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: ahci: add support for the Promise FastTrak TX8660 SATA HBA (ahci mode) drivers/ata/pata_ep93xx.c: use signed int type for result of platform_get_irq() libata: EH should handle AMNF error condition as a media error libata: support the ata host which implements a queue depth less than 32 MAINTAINERS: Add Hans de Goede as ahci-platform maintainer
2 parents 5b2b9d7 + b32bfc0 commit d6e6c48

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8019,6 +8019,16 @@ F: drivers/ata/
80198019
F: include/linux/ata.h
80208020
F: include/linux/libata.h
80218021

8022+
SERIAL ATA AHCI PLATFORM devices support
8023+
M: Hans de Goede <[email protected]>
8024+
M: Tejun Heo <[email protected]>
8025+
8026+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git
8027+
S: Supported
8028+
F: drivers/ata/ahci_platform.c
8029+
F: drivers/ata/libahci_platform.c
8030+
F: include/linux/ahci_platform.h
8031+
80228032
SERVER ENGINES 10Gbps iSCSI - BladeEngine 2 DRIVER
80238033
M: Jayamohan Kallickal <[email protected]>
80248034

drivers/ata/ahci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
456456

457457
/* Promise */
458458
{ PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
459+
{ PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */
459460

460461
/* Asmedia */
461462
{ PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */

drivers/ata/libata-core.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4787,21 +4787,27 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
47874787
* ata_qc_new - Request an available ATA command, for queueing
47884788
* @ap: target port
47894789
*
4790+
* Some ATA host controllers may implement a queue depth which is less
4791+
* than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond
4792+
* the hardware limitation.
4793+
*
47904794
* LOCKING:
47914795
* None.
47924796
*/
47934797

47944798
static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
47954799
{
47964800
struct ata_queued_cmd *qc = NULL;
4797-
unsigned int i, tag;
4801+
unsigned int i, tag, max_queue;
4802+
4803+
max_queue = ap->scsi_host->can_queue;
47984804

47994805
/* no command while frozen */
48004806
if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
48014807
return NULL;
48024808

4803-
for (i = 0; i < ATA_MAX_QUEUE; i++) {
4804-
tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE;
4809+
for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) {
4810+
tag = tag < max_queue ? tag : 0;
48054811

48064812
/* the last tag is reserved for internal command. */
48074813
if (tag == ATA_TAG_INTERNAL)
@@ -6169,6 +6175,16 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
61696175
{
61706176
int i, rc;
61716177

6178+
/*
6179+
* The max queue supported by hardware must not be greater than
6180+
* ATA_MAX_QUEUE.
6181+
*/
6182+
if (sht->can_queue > ATA_MAX_QUEUE) {
6183+
dev_err(host->dev, "BUG: the hardware max queue is too large\n");
6184+
WARN_ON(1);
6185+
return -EINVAL;
6186+
}
6187+
61726188
/* host must have been started */
61736189
if (!(host->flags & ATA_HOST_STARTED)) {
61746190
dev_err(host->dev, "BUG: trying to register unstarted host\n");

drivers/ata/libata-eh.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
18111811
case ATA_DEV_ATA:
18121812
if (err & ATA_ICRC)
18131813
qc->err_mask |= AC_ERR_ATA_BUS;
1814-
if (err & ATA_UNC)
1814+
if (err & (ATA_UNC | ATA_AMNF))
18151815
qc->err_mask |= AC_ERR_MEDIA;
18161816
if (err & ATA_IDNF)
18171817
qc->err_mask |= AC_ERR_INVALID;
@@ -2556,11 +2556,12 @@ static void ata_eh_link_report(struct ata_link *link)
25562556
}
25572557

25582558
if (cmd->command != ATA_CMD_PACKET &&
2559-
(res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF |
2560-
ATA_ABORTED)))
2561-
ata_dev_err(qc->dev, "error: { %s%s%s%s}\n",
2559+
(res->feature & (ATA_ICRC | ATA_UNC | ATA_AMNF |
2560+
ATA_IDNF | ATA_ABORTED)))
2561+
ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n",
25622562
res->feature & ATA_ICRC ? "ICRC " : "",
25632563
res->feature & ATA_UNC ? "UNC " : "",
2564+
res->feature & ATA_AMNF ? "AMNF " : "",
25642565
res->feature & ATA_IDNF ? "IDNF " : "",
25652566
res->feature & ATA_ABORTED ? "ABRT " : "");
25662567
#endif

drivers/ata/pata_ep93xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev)
915915
struct ep93xx_pata_data *drv_data;
916916
struct ata_host *host;
917917
struct ata_port *ap;
918-
unsigned int irq;
918+
int irq;
919919
struct resource *mem_res;
920920
void __iomem *ide_base;
921921
int err;

0 commit comments

Comments
 (0)