--- zzzz-none-000/linux-3.10.107/drivers/ata/libata-core.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/drivers/ata/libata-core.c 2021-11-10 11:53:55.000000000 +0000 @@ -40,6 +40,13 @@ * */ +/** + * Some part of this file is modified by Ikanos Communications. + * + * Copyright (C) 2013-2014 Ikanos Communications. + */ + + #include #include #include @@ -72,6 +79,11 @@ #include "libata.h" #include "libata-transport.h" +#if (defined(CONFIG_FUSIV_VX185) || defined(CONFIG_FUSIV_VX585))&& defined(CONFIG_CPU_MIPSR2_IRQ_VI) +#include +fusiv_irq_params_t ahci_fusiv_irq; +#endif + /* debounce timing parameters in msecs { interval, duration, timeout } */ const unsigned long sata_deb_timing_normal[] = { 5, 100, 2000 }; const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 }; @@ -4763,10 +4775,6 @@ * ata_qc_new - Request an available ATA command, for queueing * @ap: target port * - * Some ATA host controllers may implement a queue depth which is less - * than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond - * the hardware limitation. - * * LOCKING: * None. */ @@ -4774,17 +4782,16 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) { struct ata_queued_cmd *qc = NULL; - unsigned int max_queue = ap->host->n_tags; unsigned int i, tag; /* no command while frozen */ if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) return NULL; - for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { - tag = tag < max_queue ? tag : 0; + for (i = 0; i < ATA_MAX_QUEUE; i++) { + tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE; - /* the last tag is reserved for internal command. */ + /* the last tag is reserved for internal command. */ if (tag == ATA_TAG_INTERNAL) continue; @@ -6083,7 +6090,6 @@ { spin_lock_init(&host->lock); mutex_init(&host->eh_mutex); - host->n_tags = ATA_MAX_QUEUE - 1; host->dev = dev; host->ops = ops; } @@ -6165,8 +6171,6 @@ { int i, rc; - host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE - 1); - /* host must have been started */ if (!(host->flags & ATA_HOST_STARTED)) { dev_err(host->dev, "BUG: trying to register unstarted host\n"); @@ -6283,8 +6287,15 @@ return ata_host_register(host, sht); } +#if defined(CONFIG_FUSIV_VX185) + ahci_fusiv_irq.ipc_src = SATA_INT; + ahci_fusiv_irq.priv = (void *)host; + rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags, + dev_driver_string(host->dev), &ahci_fusiv_irq); +#else rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags, dev_driver_string(host->dev), host); +#endif if (rc) return rc;