---- linux-2.6.33/scripts/mod/modpost.c~ 2010-02-24 19:52:17.000000000 +0100
-+++ linux-2.6.33/scripts/mod/modpost.c 2010-03-07 14:26:47.242168558 +0100
-@@ -15,7 +15,8 @@
- #include <stdio.h>
- #include <ctype.h>
- #include "modpost.h"
--#include "../../include/generated/autoconf.h"
-+// PLD architectures don't use CONFIG_SYMBOL_PREFIX
-+//#include "../../include/generated/autoconf.h"
- #include "../../include/linux/license.h"
-
- /* Some toolchains use a `_' prefix for all user symbols. */
+Nothing here for now, move along...
+commit c695793b52216ad6a11ce952fc8d29f3a9d0c7cd
+Author: Balsundar P <balsundar.p@microsemi.com>
+Date: Tue Oct 15 11:52:04 2019 +0530
---- linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh~ 2011-07-22 04:17:23.000000000 +0200
-+++ linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh 2011-08-25 21:26:04.799150642 +0200
-@@ -9,6 +9,12 @@
- $cc -print-file-name=lib${lib}.${ext} | grep -q /
- if [ $? -eq 0 ]; then
- echo "-l${lib}"
-+ for libt in tinfow tinfo ; do
-+ $cc -print-file-name=lib${libt}.${ext} | grep -q /
-+ if [ $? -eq 0 ]; then
-+ echo "-l${libt}"
-+ fi
-+ done
- exit
- fi
- done
+ scsi: aacraid: bump version
+
+ Bump version to 50877.
+
+ Link: https://lore.kernel.org/r/1571120524-6037-8-git-send-email-balsundar.p@microsemi.com
+ Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
-index 7a0c800..ec5ebbb 100644
---- a/drivers/net/ethernet/realtek/r8169.c
-+++ b/drivers/net/ethernet/realtek/r8169.c
-@@ -4103,6 +4103,14 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
- /* Get MAC address */
- for (i = 0; i < ETH_ALEN; i++)
- dev->dev_addr[i] = RTL_R8(MAC0 + i);
-+
-+ if (!is_valid_ether_addr(dev->dev_addr)) {
-+ /* Report it and use a random ethernet address instead */
-+ netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr);
-+ random_ether_addr(dev->dev_addr);
-+ netdev_info(dev, "Using random MAC address: %pM\n",
-+ dev->dev_addr);
-+ }
- memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
-
- SET_ETHTOOL_OPS(dev, &rtl8169_ethtool_ops);
---
-1.7.7.3
-
-From 4acca62e1f1976015ebb718242523e1832716bc7 Mon Sep 17 00:00:00 2001
-From: Takahisa Tanaka <mc74hc00@gmail.com>
-Date: Wed, 14 Nov 2012 20:21:26 +0900
-Subject: [PATCH] sp5100_tco: Add SB8x0 chipset support
-
-The current sp5100_tco driver only supports SP5100/SB7x0 chipset, doesn't
-support SB8x0 chipset, because current sp5100_tco driver doesn't know that the
-offset address for watchdog timer was changed from SB8x0 chipset.
-
-The offset address of SP5100 and SB7x0 chipsets are as follows, quote from the
-AMD SB700/710/750 Register Reference Guide(Page 164) and the AMD SP5100
-Register Reference Guide(Page 166).
-
- WatchDogTimerControl 69h
- WatchDogTimerBase0 6Ch
- WatchDogTimerBase1 6Dh
- WatchDogTimerBase2 6Eh
- WatchDogTimerBase3 6Fh
-
-In contrast, the offset address of SB8x0 chipset is as follows, quote from
-AMD SB800-Series Southbridges Register Reference Guide(Page 147).
-
- WatchDogTimerEn 48h
- WatchDogTimerConfig 4Ch
+diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
+index 17a4e8b8bd00..e3e4ecbea726 100644
+--- a/drivers/scsi/aacraid/aacraid.h
++++ b/drivers/scsi/aacraid/aacraid.h
+@@ -85,7 +85,7 @@ enum {
+ #define PMC_GLOBAL_INT_BIT0 0x00000001
+
+ #ifndef AAC_DRIVER_BUILD
+-# define AAC_DRIVER_BUILD 50877
++# define AAC_DRIVER_BUILD 50983
+ # define AAC_DRIVER_BRANCH "-custom"
+ #endif
+ #define MAXIMUM_NUM_CONTAINERS 32
-So, In the case of SB8x0 chipset, sp5100_tco reads meaningless MMIO
-address(for example, 0xbafe00) from wrong offset address, and the following
-message is logged.
+commit 26c54d0ec25c186329d845ad1beb9d3dde586af9
+Author: Balsundar P <balsundar.p@microsemi.com>
+Date: Tue Oct 15 11:52:03 2019 +0530
- SP5100 TCO timer: mmio address 0xbafe00 already in use
+ scsi: aacraid: send AIF request post IOP RESET
+
+ After IOP reset completion, AIF request command is not issued to the
+ controller. Driver schedules a worker thread to issue a AIF request command
+ after IOP reset completion.
+
+ [mkp: fix zeroday warning]
+
+ Link: https://lore.kernel.org/r/1571120524-6037-7-git-send-email-balsundar.p@microsemi.com
+ Acked-by: Balsundar P < Balsundar.P@microchip.com>
+ Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-With this patch, sp5100_tco driver supports SB8x0 chipset, and can avoid
-iomem resource conflict.
-
-Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43176
-To: linux-watchdog@vger.kernel.org
-Signed-off-by: Takahisa Tanaka <mc74hc00@gmail.com>
-
----
-v1 -> v2
- -Fix typo in module description and source code.
- -Fix a bug that can't correctly determine the watchdog fired.
- -Improve syslog messages.
- -Truncate the commit log, because previous commit log is too long.
----
- drivers/watchdog/sp5100_tco.c | 321 +++++++++++++++++++++++++++++++++++-------
- drivers/watchdog/sp5100_tco.h | 46 ++++--
- 2 files changed, 306 insertions(+), 61 deletions(-)
-
-diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c
-index ae5e82c..183fcb2 100644
---- a/drivers/watchdog/sp5100_tco.c
-+++ b/drivers/watchdog/sp5100_tco.c
-@@ -13,7 +13,9 @@
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
-- * See AMD Publication 43009 "AMD SB700/710/750 Register Reference Guide"
-+ * See AMD Publication 43009 "AMD SB700/710/750 Register Reference Guide",
-+ * AMD Publication 45482 "AMD SB800-Series Southbridges Register
-+ * Reference Guide"
- */
-
- /*
-@@ -38,18 +40,24 @@
- #include "sp5100_tco.h"
-
- /* Module and version information */
--#define TCO_VERSION "0.01"
-+#define TCO_VERSION "0.03"
- #define TCO_MODULE_NAME "SP5100 TCO timer"
- #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION
-
- /* internal variables */
- static u32 tcobase_phys;
-+static u32 resbase_phys;
-+static u32 tco_wdt_fired;
- static void __iomem *tcobase;
- static unsigned int pm_iobase;
- static DEFINE_SPINLOCK(tco_lock); /* Guards the hardware */
- static unsigned long timer_alive;
- static char tco_expect_close;
- static struct pci_dev *sp5100_tco_pci;
-+static struct resource wdt_res = {
-+ .name = "Watchdog Timer",
-+ .flags = IORESOURCE_MEM,
-+};
-
- /* the watchdog platform device */
- static struct platform_device *sp5100_tco_platform_device;
-@@ -64,9 +72,15 @@ MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (default="
-
- static bool nowayout = WATCHDOG_NOWAYOUT;
- module_param(nowayout, bool, 0);
--MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"
-+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started."
- " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-
-+static unsigned int force_addr;
-+module_param(force_addr, uint, 0);
-+MODULE_PARM_DESC(force_addr, "Force the use of specified MMIO address."
-+ " ONLY USE THIS PARAMETER IF YOU REALLY KNOW"
-+ " WHAT YOU ARE DOING (default=none)");
+diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
+index f76a33cb0259..17a4e8b8bd00 100644
+--- a/drivers/scsi/aacraid/aacraid.h
++++ b/drivers/scsi/aacraid/aacraid.h
+@@ -1330,7 +1330,7 @@ struct fib {
+ #define AAC_DEVTYPE_ARC_RAW 2
+ #define AAC_DEVTYPE_NATIVE_RAW 3
+
+-#define AAC_SAFW_RESCAN_DELAY (10 * HZ)
++#define AAC_RESCAN_DELAY (10 * HZ)
+
+ struct aac_hba_map_info {
+ __le32 rmw_nexus; /* nexus for native HBA devices */
+@@ -1603,6 +1603,7 @@ struct aac_dev
+ struct fsa_dev_info *fsa_dev;
+ struct task_struct *thread;
+ struct delayed_work safw_rescan_work;
++ struct delayed_work src_reinit_aif_worker;
+ int cardtype;
+ /*
+ *This lock will protect the two 32-bit
+@@ -2647,7 +2648,12 @@ int aac_scan_host(struct aac_dev *dev);
+
+ static inline void aac_schedule_safw_scan_worker(struct aac_dev *dev)
+ {
+- schedule_delayed_work(&dev->safw_rescan_work, AAC_SAFW_RESCAN_DELAY);
++ schedule_delayed_work(&dev->safw_rescan_work, AAC_RESCAN_DELAY);
++}
+
- /*
- * Some TCO specific functions
- */
-@@ -122,6 +136,79 @@ static int tco_timer_set_heartbeat(int t)
- return 0;
++static inline void aac_schedule_src_reinit_aif_worker(struct aac_dev *dev)
++{
++ schedule_delayed_work(&dev->src_reinit_aif_worker, AAC_RESCAN_DELAY);
+ }
+
+ static inline void aac_safw_rescan_worker(struct work_struct *work)
+@@ -2661,10 +2667,10 @@ static inline void aac_safw_rescan_worker(struct work_struct *work)
+ aac_scan_host(dev);
}
-+static void tco_timer_enable(void)
+-static inline void aac_cancel_safw_rescan_worker(struct aac_dev *dev)
++static inline void aac_cancel_rescan_worker(struct aac_dev *dev)
+ {
+- if (dev->sa_firmware)
+- cancel_delayed_work_sync(&dev->safw_rescan_work);
++ cancel_delayed_work_sync(&dev->safw_rescan_work);
++ cancel_delayed_work_sync(&dev->src_reinit_aif_worker);
+ }
+
+ /* SCp.phase values */
+@@ -2674,6 +2680,7 @@ static inline void aac_cancel_safw_rescan_worker(struct aac_dev *dev)
+ #define AAC_OWNER_FIRMWARE 0x106
+
+ void aac_safw_rescan_worker(struct work_struct *work);
++void aac_src_reinit_aif_worker(struct work_struct *work);
+ int aac_acquire_irq(struct aac_dev *dev);
+ void aac_free_irq(struct aac_dev *dev);
+ int aac_setup_safw_adapter(struct aac_dev *dev);
+@@ -2731,6 +2738,7 @@ int aac_probe_container(struct aac_dev *dev, int cid);
+ int _aac_rx_init(struct aac_dev *dev);
+ int aac_rx_select_comm(struct aac_dev *dev, int comm);
+ int aac_rx_deliver_producer(struct fib * fib);
++void aac_reinit_aif(struct aac_dev *aac, unsigned int index);
+
+ static inline int aac_is_src(struct aac_dev *dev)
+ {
+diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
+index 3f268f669cc3..5a8a999606ea 100644
+--- a/drivers/scsi/aacraid/commsup.c
++++ b/drivers/scsi/aacraid/commsup.c
+@@ -1464,6 +1464,14 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
+ }
+ }
+
++static void aac_schedule_bus_scan(struct aac_dev *aac)
+{
-+ int val;
-+
-+ if (sp5100_tco_pci->revision >= 0x40) {
-+ /* For SB800 or later */
-+ /* Set the Watchdog timer resolution to 1 sec */
-+ outb(SB800_PM_WATCHDOG_CONFIG, SB800_IO_PM_INDEX_REG);
-+ val = inb(SB800_IO_PM_DATA_REG);
-+ val |= SB800_PM_WATCHDOG_SECOND_RES;
-+ outb(val, SB800_IO_PM_DATA_REG);
-+
-+ /* Enable watchdog decode bit and watchdog timer */
-+ outb(SB800_PM_WATCHDOG_CONTROL, SB800_IO_PM_INDEX_REG);
-+ val = inb(SB800_IO_PM_DATA_REG);
-+ val |= SB800_PCI_WATCHDOG_DECODE_EN;
-+ val &= ~SB800_PM_WATCHDOG_DISABLE;
-+ outb(val, SB800_IO_PM_DATA_REG);
-+ } else {
-+ /* For SP5100 or SB7x0 */
-+ /* Enable watchdog decode bit */
-+ pci_read_config_dword(sp5100_tco_pci,
-+ SP5100_PCI_WATCHDOG_MISC_REG,
-+ &val);
-+
-+ val |= SP5100_PCI_WATCHDOG_DECODE_EN;
-+
-+ pci_write_config_dword(sp5100_tco_pci,
-+ SP5100_PCI_WATCHDOG_MISC_REG,
-+ val);
-+
-+ /* Enable Watchdog timer and set the resolution to 1 sec */
-+ outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG);
-+ val = inb(SP5100_IO_PM_DATA_REG);
-+ val |= SP5100_PM_WATCHDOG_SECOND_RES;
-+ val &= ~SP5100_PM_WATCHDOG_DISABLE;
-+ outb(val, SP5100_IO_PM_DATA_REG);
-+ }
++ if (aac->sa_firmware)
++ aac_schedule_safw_scan_worker(aac);
++ else
++ aac_schedule_src_reinit_aif_worker(aac);
+}
+
-+static void tco_timer_disable(void)
+ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
+ {
+ int index, quirks;
+@@ -1639,7 +1647,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
+ */
+ if (!retval && !is_kdump_kernel()) {
+ dev_info(&aac->pdev->dev, "Scheduling bus rescan\n");
+- aac_schedule_safw_scan_worker(aac);
++ aac_schedule_bus_scan(aac);
+ }
+
+ if (jafo) {
+@@ -1960,6 +1968,16 @@ int aac_scan_host(struct aac_dev *dev)
+ return rcode;
+ }
+
++void aac_src_reinit_aif_worker(struct work_struct *work)
+{
-+ int val;
-+
-+ if (sp5100_tco_pci->revision >= 0x40) {
-+ /* For SB800 or later */
-+ /* Enable watchdog decode bit and Disable watchdog timer */
-+ outb(SB800_PM_WATCHDOG_CONTROL, SB800_IO_PM_INDEX_REG);
-+ val = inb(SB800_IO_PM_DATA_REG);
-+ val |= SB800_PCI_WATCHDOG_DECODE_EN;
-+ val |= SB800_PM_WATCHDOG_DISABLE;
-+ outb(val, SB800_IO_PM_DATA_REG);
-+ } else {
-+ /* For SP5100 or SB7x0 */
-+ /* Enable watchdog decode bit */
-+ pci_read_config_dword(sp5100_tco_pci,
-+ SP5100_PCI_WATCHDOG_MISC_REG,
-+ &val);
-+
-+ val |= SP5100_PCI_WATCHDOG_DECODE_EN;
++ struct aac_dev *dev = container_of(to_delayed_work(work),
++ struct aac_dev, src_reinit_aif_worker);
+
-+ pci_write_config_dword(sp5100_tco_pci,
-+ SP5100_PCI_WATCHDOG_MISC_REG,
-+ val);
-+
-+ /* Disable Watchdog timer */
-+ outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG);
-+ val = inb(SP5100_IO_PM_DATA_REG);
-+ val |= SP5100_PM_WATCHDOG_DISABLE;
-+ outb(val, SP5100_IO_PM_DATA_REG);
-+ }
++ wait_event(dev->scsi_host_ptr->host_wait,
++ !scsi_host_in_recovery(dev->scsi_host_ptr));
++ aac_reinit_aif(dev, dev->cardtype);
+}
+
- /*
- * /dev/watchdog handling
- */
-@@ -270,11 +357,12 @@ MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl);
- /*
- * Init & exit routines
- */
--
- static unsigned char __devinit sp5100_tco_setupdevice(void)
- {
- struct pci_dev *dev = NULL;
-+ const char *dev_name = NULL;
- u32 val;
-+ u32 index_reg, data_reg, base_addr;
-
- /* Match the PCI device */
- for_each_pci_dev(dev) {
-@@ -287,29 +375,160 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
- if (!sp5100_tco_pci)
- return 0;
-
-+ pr_info("PCI Revision ID: 0x%x\n", sp5100_tco_pci->revision);
-+
-+ /*
-+ * Determine type of southbridge chipset.
-+ */
-+ if (sp5100_tco_pci->revision >= 0x40) {
-+ dev_name = SB800_DEVNAME;
-+ index_reg = SB800_IO_PM_INDEX_REG;
-+ data_reg = SB800_IO_PM_DATA_REG;
-+ base_addr = SB800_PM_WATCHDOG_BASE;
-+ } else {
-+ dev_name = SP5100_DEVNAME;
-+ index_reg = SP5100_IO_PM_INDEX_REG;
-+ data_reg = SP5100_IO_PM_DATA_REG;
-+ base_addr = SP5100_PM_WATCHDOG_BASE;
-+ }
-+
- /* Request the IO ports used by this driver */
- pm_iobase = SP5100_IO_PM_INDEX_REG;
-- if (!request_region(pm_iobase, SP5100_PM_IOPORTS_SIZE, "SP5100 TCO")) {
-+ if (!request_region(pm_iobase, SP5100_PM_IOPORTS_SIZE, dev_name)) {
- pr_err("I/O address 0x%04x already in use\n", pm_iobase);
- goto exit;
+ /**
+ * aac_handle_sa_aif Handle a message from the firmware
+ * @dev: Which adapter this fib is from
+diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
+index 55a55c56fea9..ee6bc2f9b80a 100644
+--- a/drivers/scsi/aacraid/linit.c
++++ b/drivers/scsi/aacraid/linit.c
+@@ -1593,6 +1593,19 @@ static void aac_init_char(void)
}
+ }
-- /* Find the watchdog base address. */
-- outb(SP5100_PM_WATCHDOG_BASE3, SP5100_IO_PM_INDEX_REG);
-- val = inb(SP5100_IO_PM_DATA_REG);
-- outb(SP5100_PM_WATCHDOG_BASE2, SP5100_IO_PM_INDEX_REG);
-- val = val << 8 | inb(SP5100_IO_PM_DATA_REG);
-- outb(SP5100_PM_WATCHDOG_BASE1, SP5100_IO_PM_INDEX_REG);
-- val = val << 8 | inb(SP5100_IO_PM_DATA_REG);
-- outb(SP5100_PM_WATCHDOG_BASE0, SP5100_IO_PM_INDEX_REG);
-- /* Low three bits of BASE0 are reserved. */
-- val = val << 8 | (inb(SP5100_IO_PM_DATA_REG) & 0xf8);
-+ /*
-+ * First, Find the watchdog timer MMIO address from indirect I/O.
-+ */
-+ outb(base_addr+3, index_reg);
-+ val = inb(data_reg);
-+ outb(base_addr+2, index_reg);
-+ val = val << 8 | inb(data_reg);
-+ outb(base_addr+1, index_reg);
-+ val = val << 8 | inb(data_reg);
-+ outb(base_addr+0, index_reg);
-+ /* Low three bits of BASE are reserved */
-+ val = val << 8 | (inb(data_reg) & 0xf8);
-+
-+ pr_debug("Got 0x%04x from indirect I/O\n", val);
-+
-+ /* Check MMIO address conflict */
-+ if (request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
-+ dev_name))
-+ goto setup_wdt;
-+ else
-+ pr_debug("MMIO address 0x%04x already in use\n", val);
-+
-+ /*
-+ * Secondly, Find the watchdog timer MMIO address
-+ * from SBResource_MMIO register.
-+ */
-+ if (sp5100_tco_pci->revision >= 0x40) {
-+ /* Read SBResource_MMIO from AcpiMmioEn(PM_Reg: 24h) */
-+ outb(SB800_PM_ACPI_MMIO_EN+3, SB800_IO_PM_INDEX_REG);
-+ val = inb(SB800_IO_PM_DATA_REG);
-+ outb(SB800_PM_ACPI_MMIO_EN+2, SB800_IO_PM_INDEX_REG);
-+ val = val << 8 | inb(SB800_IO_PM_DATA_REG);
-+ outb(SB800_PM_ACPI_MMIO_EN+1, SB800_IO_PM_INDEX_REG);
-+ val = val << 8 | inb(SB800_IO_PM_DATA_REG);
-+ outb(SB800_PM_ACPI_MMIO_EN+0, SB800_IO_PM_INDEX_REG);
-+ val = val << 8 | inb(SB800_IO_PM_DATA_REG);
-+ } else {
-+ /* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
-+ pci_read_config_dword(sp5100_tco_pci,
-+ SP5100_SB_RESOURCE_MMIO_BASE, &val);
-+ }
-+
-+ /* The SBResource_MMIO is enabled and mapped memory space? */
-+ if ((val & (SB800_ACPI_MMIO_DECODE_EN | SB800_ACPI_MMIO_SEL)) ==
-+ SB800_ACPI_MMIO_DECODE_EN) {
-+ /* Clear unnecessary the low twelve bits */
-+ val &= ~0xFFF;
-+ /* Add the Watchdog Timer offset to base address. */
-+ val += SB800_PM_WDT_MMIO_OFFSET;
-+ /* Check MMIO address conflict */
-+ if (request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
-+ dev_name)) {
-+ pr_debug("Got 0x%04x from SBResource_MMIO register\n",
-+ val);
-+ goto setup_wdt;
-+ } else
-+ pr_debug("MMIO address 0x%04x already in use\n", val);
-+ } else
-+ pr_debug("SBResource_MMIO is disabled(0x%04x)\n", val);
-+
++void aac_reinit_aif(struct aac_dev *aac, unsigned int index)
++{
+ /*
-+ * Lastly re-programming the watchdog timer MMIO address,
-+ * This method is a last resort...
-+ *
-+ * Before re-programming, to ensure that the watchdog timer
-+ * is disabled, disable the watchdog timer.
++ * Firmware may send a AIF messages very early and the Driver may have
++ * ignored as it is not fully ready to process the messages. Send
++ * AIF to firmware so that if there are any unprocessed events they
++ * can be processed now.
+ */
-+ tco_timer_disable();
++ if (aac_drivers[index].quirks & AAC_QUIRK_SRC)
++ aac_intr_normal(aac, 0, 2, 0, NULL);
+
-+ if (force_addr) {
-+ /*
-+ * Force the use of watchdog timer MMIO address, and aligned to
-+ * 8byte boundary.
-+ */
-+ force_addr &= ~0x7;
-+ val = force_addr;
-+
-+ pr_info("Force the use of 0x%04x as MMIO address\n", val);
-+ } else {
-+ /*
-+ * Get empty slot into the resource tree for watchdog timer.
-+ */
-+ if (allocate_resource(&iomem_resource,
-+ &wdt_res,
-+ SP5100_WDT_MEM_MAP_SIZE,
-+ 0xf0000000,
-+ 0xfffffff8,
-+ 0x8,
-+ NULL,
-+ NULL)) {
-+ pr_err("MMIO allocation failed\n");
-+ goto unreg_region;
-+ }
-+
-+ val = resbase_phys = wdt_res.start;
-+ pr_debug("Got 0x%04x from resource tree\n", val);
-+ }
-+
-+ /* Restore to the low three bits, if chipset is SB8x0(or later) */
-+ if (sp5100_tco_pci->revision >= 0x40) {
-+ u8 reserved_bit;
-+ reserved_bit = inb(base_addr) & 0x7;
-+ val |= (u32)reserved_bit;
-+ }
-+
-+ /* Re-programming the watchdog timer base address */
-+ outb(base_addr+0, index_reg);
-+ /* Low three bits of BASE are reserved */
-+ outb((val >> 0) & 0xf8, data_reg);
-+ outb(base_addr+1, index_reg);
-+ outb((val >> 8) & 0xff, data_reg);
-+ outb(base_addr+2, index_reg);
-+ outb((val >> 16) & 0xff, data_reg);
-+ outb(base_addr+3, index_reg);
-+ outb((val >> 24) & 0xff, data_reg);
-+
-+ /*
-+ * Clear unnecessary the low three bits,
-+ * if chipset is SB8x0(or later)
-+ */
-+ if (sp5100_tco_pci->revision >= 0x40)
-+ val &= ~0x7;
-
- if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
-- "SP5100 TCO")) {
-- pr_err("mmio address 0x%04x already in use\n", val);
-- goto unreg_region;
-+ dev_name)) {
-+ pr_err("MMIO address 0x%04x already in use\n", val);
-+ goto unreg_resource;
- }
++}
+
-+setup_wdt:
- tcobase_phys = val;
-
- tcobase = ioremap(val, SP5100_WDT_MEM_MAP_SIZE);
-@@ -318,26 +537,18 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
- goto unreg_mem_region;
- }
-
-- /* Enable watchdog decode bit */
-- pci_read_config_dword(sp5100_tco_pci,
-- SP5100_PCI_WATCHDOG_MISC_REG,
-- &val);
--
-- val |= SP5100_PCI_WATCHDOG_DECODE_EN;
-+ pr_info("Using 0x%04x for watchdog MMIO address\n", val);
-
-- pci_write_config_dword(sp5100_tco_pci,
-- SP5100_PCI_WATCHDOG_MISC_REG,
-- val);
-+ /* Setup the watchdog timer */
-+ tco_timer_enable();
-
-- /* Enable Watchdog timer and set the resolution to 1 sec. */
-- outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG);
-- val = inb(SP5100_IO_PM_DATA_REG);
-- val |= SP5100_PM_WATCHDOG_SECOND_RES;
-- val &= ~SP5100_PM_WATCHDOG_DISABLE;
-- outb(val, SP5100_IO_PM_DATA_REG);
--
-- /* Check that the watchdog action is set to reset the system. */
-+ /* Check that the watchdog action is set to reset the system */
- val = readl(SP5100_WDT_CONTROL(tcobase));
-+ /*
-+ * Save WatchDogFired status, because WatchDogFired flag is
-+ * cleared here.
-+ */
-+ tco_wdt_fired = val & SP5100_PM_WATCHDOG_FIRED;
- val &= ~SP5100_PM_WATCHDOG_ACTION_RESET;
- writel(val, SP5100_WDT_CONTROL(tcobase));
-
-@@ -355,6 +566,9 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
-
- unreg_mem_region:
- release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
-+unreg_resource:
-+ if (resbase_phys)
-+ release_resource(&wdt_res);
- unreg_region:
- release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
- exit:
-@@ -364,23 +578,18 @@ exit:
- static int __devinit sp5100_tco_init(struct platform_device *dev)
+ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
- int ret;
-- u32 val;
-+ char addr_str[16];
+ unsigned index = id->driver_data;
+@@ -1690,6 +1703,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
+ mutex_init(&aac->scan_mutex);
-- /* Check whether or not the hardware watchdog is there. If found, then
-+ /*
-+ * Check whether or not the hardware watchdog is there. If found, then
- * set it up.
+ INIT_DELAYED_WORK(&aac->safw_rescan_work, aac_safw_rescan_worker);
++ INIT_DELAYED_WORK(&aac->src_reinit_aif_worker,
++ aac_src_reinit_aif_worker);
+ /*
+ * Map in the registers from the adapter.
*/
- if (!sp5100_tco_setupdevice())
- return -ENODEV;
+@@ -1880,7 +1895,7 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state)
+ struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
- /* Check to see if last reboot was due to watchdog timeout */
-- pr_info("Watchdog reboot %sdetected\n",
-- readl(SP5100_WDT_CONTROL(tcobase)) & SP5100_PM_WATCHDOG_FIRED ?
-- "" : "not ");
--
-- /* Clear out the old status */
-- val = readl(SP5100_WDT_CONTROL(tcobase));
-- val &= ~SP5100_PM_WATCHDOG_FIRED;
-- writel(val, SP5100_WDT_CONTROL(tcobase));
-+ pr_info("Last reboot was %striggered by watchdog.\n",
-+ tco_wdt_fired ? "" : "not ");
+ scsi_block_requests(shost);
+- aac_cancel_safw_rescan_worker(aac);
++ aac_cancel_rescan_worker(aac);
+ aac_send_shutdown(aac);
- /*
- * Check that the heartbeat value is within it's range.
-@@ -400,14 +609,24 @@ static int __devinit sp5100_tco_init(struct platform_device *dev)
+ aac_release_resources(aac);
+@@ -1939,7 +1954,7 @@ static void aac_remove_one(struct pci_dev *pdev)
+ struct Scsi_Host *shost = pci_get_drvdata(pdev);
+ struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
- clear_bit(0, &timer_alive);
+- aac_cancel_safw_rescan_worker(aac);
++ aac_cancel_rescan_worker(aac);
+ scsi_remove_host(shost);
-- pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n",
-- tcobase, heartbeat, nowayout);
-+ /* Show module parameters */
-+ if (force_addr == tcobase_phys)
-+ /* The force_addr is vaild */
-+ sprintf(addr_str, "0x%04x", force_addr);
-+ else
-+ strcpy(addr_str, "none");
-+
-+ pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d, "
-+ "force_addr=%s)\n",
-+ tcobase, heartbeat, nowayout, addr_str);
-
- return 0;
-
- exit:
- iounmap(tcobase);
- release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
-+ if (resbase_phys)
-+ release_resource(&wdt_res);
- release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
- return ret;
- }
-@@ -422,6 +641,8 @@ static void __devexit sp5100_tco_cleanup(void)
- misc_deregister(&sp5100_tco_miscdev);
- iounmap(tcobase);
- release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
-+ if (resbase_phys)
-+ release_resource(&wdt_res);
- release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
- }
+ __aac_shutdown(aac);
+@@ -1997,7 +2012,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
+ aac->handle_pci_error = 1;
+
+ scsi_block_requests(aac->scsi_host_ptr);
+- aac_cancel_safw_rescan_worker(aac);
++ aac_cancel_rescan_worker(aac);
+ aac_flush_ios(aac);
+ aac_release_resources(aac);
-@@ -451,7 +672,7 @@ static int __init sp5100_tco_init_module(void)
+
+commit 572ee53a9badf62f3973d66f6475f9ce69720a25
+Author: Balsundar P <balsundar.p@microsemi.com>
+Date: Tue Oct 15 11:52:02 2019 +0530
+
+ scsi: aacraid: check adapter health
+
+ Currently driver waits for the command IOCTL from the firmware and if the
+ firmware enters nonresponsive state, the driver doesn't respond till the
+ firmware is responsive again.
+
+ Check that firmware is alive, otherwise return -EBUSY.
+
+ [mkp: clarified commit desc]
+
+ Link: https://lore.kernel.org/r/1571120524-6037-6-git-send-email-balsundar.p@microsemi.com
+ Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
+index 40f78509ca94..55a55c56fea9 100644
+--- a/drivers/scsi/aacraid/linit.c
++++ b/drivers/scsi/aacraid/linit.c
+@@ -612,9 +612,13 @@ static struct device_attribute *aac_dev_attrs[] = {
+ static int aac_ioctl(struct scsi_device *sdev, unsigned int cmd,
+ void __user *arg)
{
- int err;
++ int retval;
+ struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata;
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
++ retval = aac_adapter_check_health(dev);
++ if (retval)
++ return -EBUSY;
+ return aac_do_ioctl(dev, cmd, arg);
+ }
+
+
+commit e2fd90dd2ed87bdcfdfb640f06da48fd23efa080
+Author: Balsundar P <balsundar.p@microsemi.com>
+Date: Tue Oct 15 11:52:01 2019 +0530
+
+ scsi: aacraid: setting different timeout for src and thor
+
+ Set 180 second timeout for thor and 60 seconds for src controllers.
+
+ Link: https://lore.kernel.org/r/1571120524-6037-5-git-send-email-balsundar.p@microsemi.com
+ Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
+index 2388143d59f5..e36608ce937a 100644
+--- a/drivers/scsi/aacraid/aachba.c
++++ b/drivers/scsi/aacraid/aachba.c
+@@ -1477,6 +1477,7 @@ static struct aac_srb * aac_scsi_common(struct fib * fib, struct scsi_cmnd * cmd
+ struct aac_srb * srbcmd;
+ u32 flag;
+ u32 timeout;
++ struct aac_dev *dev = fib->dev;
+
+ aac_fib_init(fib);
+ switch(cmd->sc_data_direction){
+@@ -1503,7 +1504,7 @@ static struct aac_srb * aac_scsi_common(struct fib * fib, struct scsi_cmnd * cmd
+ srbcmd->flags = cpu_to_le32(flag);
+ timeout = cmd->request->timeout/HZ;
+ if (timeout == 0)
+- timeout = 1;
++ timeout = (dev->sa_firmware ? AAC_SA_TIMEOUT : AAC_ARC_TIMEOUT);
+ srbcmd->timeout = cpu_to_le32(timeout); // timeout in seconds
+ srbcmd->retry_limit = 0; /* Obsolete parameter */
+ srbcmd->cdb_size = cpu_to_le32(cmd->cmd_len);
+diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
+index 3fdd4583cbb5..f76a33cb0259 100644
+--- a/drivers/scsi/aacraid/aacraid.h
++++ b/drivers/scsi/aacraid/aacraid.h
+@@ -108,6 +108,8 @@ enum {
+ #define AAC_BUS_TARGET_LOOP (AAC_MAX_BUSES * AAC_MAX_TARGETS)
+ #define AAC_MAX_NATIVE_SIZE 2048
+ #define FW_ERROR_BUFFER_SIZE 512
++#define AAC_SA_TIMEOUT 180
++#define AAC_ARC_TIMEOUT 60
+
+ #define get_bus_number(x) (x/AAC_MAX_TARGETS)
+ #define get_target_number(x) (x%AAC_MAX_TARGETS)
+diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
+index 4a858789e6c5..40f78509ca94 100644
+--- a/drivers/scsi/aacraid/linit.c
++++ b/drivers/scsi/aacraid/linit.c
+@@ -391,6 +391,7 @@ static int aac_slave_configure(struct scsi_device *sdev)
+ int chn, tid;
+ unsigned int depth = 0;
+ unsigned int set_timeout = 0;
++ int timeout = 0;
+ bool set_qd_dev_type = false;
+ u8 devtype = 0;
+
+@@ -483,10 +484,13 @@ static int aac_slave_configure(struct scsi_device *sdev)
+
+ /*
+ * Firmware has an individual device recovery time typically
+- * of 35 seconds, give us a margin.
++ * of 35 seconds, give us a margin. Thor devices can take longer in
++ * error recovery, hence different value.
+ */
+- if (set_timeout && sdev->request_queue->rq_timeout < (45 * HZ))
+- blk_queue_rq_timeout(sdev->request_queue, 45*HZ);
++ if (set_timeout) {
++ timeout = aac->sa_firmware ? AAC_SA_TIMEOUT : AAC_ARC_TIMEOUT;
++ blk_queue_rq_timeout(sdev->request_queue, timeout * HZ);
++ }
-- pr_info("SP5100 TCO WatchDog Timer Driver v%s\n", TCO_VERSION);
-+ pr_info("SP5100/SB800 TCO WatchDog Timer Driver v%s\n", TCO_VERSION);
+ if (depth > 256)
+ depth = 256;
+
+commit c02a3342bad32baa9be201da39d3809b74f92239
+Author: Balsundar P <balsundar.p@microsemi.com>
+Date: Tue Oct 15 11:52:00 2019 +0530
+
+ scsi: aacraid: fixed firmware assert issue
+
+ Before issuing IOP reset, INTX mode is selected. This is triggering MSGU
+ lockup and ended in basecode assert. Use DROP_IO command when IOP reset is
+ sent in preparation for interrupt mode switch.
+
+ Link: https://lore.kernel.org/r/1571120524-6037-4-git-send-email-balsundar.p@microsemi.com
+ Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
+index 3fa03230f6ba..3fdd4583cbb5 100644
+--- a/drivers/scsi/aacraid/aacraid.h
++++ b/drivers/scsi/aacraid/aacraid.h
+@@ -1673,6 +1673,7 @@ struct aac_dev
+ u8 adapter_shutdown;
+ u32 handle_pci_error;
+ bool init_reset;
++ u8 soft_reset_support;
+ };
+
+ #define aac_adapter_interrupt(dev) \
+diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
+index d4fcfa1e54e0..f75878d773cf 100644
+--- a/drivers/scsi/aacraid/comminit.c
++++ b/drivers/scsi/aacraid/comminit.c
+@@ -571,6 +571,11 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
+ else
+ dev->sa_firmware = 0;
+
++ if (status[4] & le32_to_cpu(AAC_EXTOPT_SOFT_RESET))
++ dev->soft_reset_support = 1;
++ else
++ dev->soft_reset_support = 0;
++
+ if ((dev->comm_interface == AAC_COMM_MESSAGE) &&
+ (status[2] > dev->base_size)) {
+ aac_adapter_ioremap(dev, 0);
+diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
+index 3b66e06726c8..787ec9baebb0 100644
+--- a/drivers/scsi/aacraid/src.c
++++ b/drivers/scsi/aacraid/src.c
+@@ -733,10 +733,20 @@ static bool aac_is_ctrl_up_and_running(struct aac_dev *dev)
+ return ctrl_up;
+ }
- err = platform_driver_register(&sp5100_tco_driver);
- if (err)
-@@ -475,13 +696,13 @@ static void __exit sp5100_tco_cleanup_module(void)
++static void aac_src_drop_io(struct aac_dev *dev)
++{
++ if (!dev->soft_reset_support)
++ return;
++
++ aac_adapter_sync_cmd(dev, DROP_IO,
++ 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL);
++}
++
+ static void aac_notify_fw_of_iop_reset(struct aac_dev *dev)
{
- platform_device_unregister(sp5100_tco_platform_device);
- platform_driver_unregister(&sp5100_tco_driver);
-- pr_info("SP5100 TCO Watchdog Module Unloaded\n");
-+ pr_info("SP5100/SB800 TCO Watchdog Module Unloaded\n");
+ aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS, 0, 0, 0, 0, 0, 0, NULL,
+ NULL, NULL, NULL, NULL);
++ aac_src_drop_io(dev);
}
- module_init(sp5100_tco_init_module);
- module_exit(sp5100_tco_cleanup_module);
-
- MODULE_AUTHOR("Priyanka Gupta");
--MODULE_DESCRIPTION("TCO timer driver for SP5100 chipset");
-+MODULE_DESCRIPTION("TCO timer driver for SP5100/SB800 chipset");
- MODULE_LICENSE("GPL");
- MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h
-index a5a16cc..71594a0 100644
---- a/drivers/watchdog/sp5100_tco.h
-+++ b/drivers/watchdog/sp5100_tco.h
-@@ -9,33 +9,57 @@
- /*
- * Some address definitions for the Watchdog
- */
--
- #define SP5100_WDT_MEM_MAP_SIZE 0x08
- #define SP5100_WDT_CONTROL(base) ((base) + 0x00) /* Watchdog Control */
- #define SP5100_WDT_COUNT(base) ((base) + 0x04) /* Watchdog Count */
+ static void aac_send_iop_reset(struct aac_dev *dev)
+
+commit f2244c1b35e5302070af4c729db0b0e9eb8350c9
+Author: Balsundar P <balsundar.p@microsemi.com>
+Date: Tue Oct 15 11:51:59 2019 +0530
+
+ scsi: aacraid: fixed IO reporting error
+
+ The problem is the driver detects FastResponse bit set and saves it to
+ Fib's flags to not check IO response status, but it never clears it for
+ next IO. Hence the next IO will pick up FastResponse bit to not check
+ the IO response status and fail to report any type IO error to kernel
+
+ Link: https://lore.kernel.org/r/1571120524-6037-3-git-send-email-balsundar.p@microsemi.com
+ Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
+index 2142a649e865..3f268f669cc3 100644
+--- a/drivers/scsi/aacraid/commsup.c
++++ b/drivers/scsi/aacraid/commsup.c
+@@ -232,6 +232,7 @@ struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
+ fibptr->type = FSAFS_NTC_FIB_CONTEXT;
+ fibptr->callback_data = NULL;
+ fibptr->callback = NULL;
++ fibptr->flags = 0;
+
+ return fibptr;
+ }
+
+commit c86fbe484c10b2cd1e770770db2d6b2c88801c1d
+Author: Balsundar P <balsundar.p@microsemi.com>
+Date: Tue Oct 15 11:51:58 2019 +0530
+
+ scsi: aacraid: fix illegal IO beyond last LBA
+
+ The driver fails to handle data when read or written beyond device reported
+ LBA, which triggers kernel panic
+
+ Link: https://lore.kernel.org/r/1571120524-6037-2-git-send-email-balsundar.p@microsemi.com
+ Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
+index 0ed3f806ace5..2388143d59f5 100644
+--- a/drivers/scsi/aacraid/aachba.c
++++ b/drivers/scsi/aacraid/aachba.c
+@@ -2467,13 +2467,13 @@ static int aac_read(struct scsi_cmnd * scsicmd)
+ scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 |
+ SAM_STAT_CHECK_CONDITION;
+ set_sense(&dev->fsa_dev[cid].sense_data,
+- HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE,
++ ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE,
+ ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
+ memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
+ min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
+ SCSI_SENSE_BUFFERSIZE));
+ scsicmd->scsi_done(scsicmd);
+- return 1;
++ return 0;
+ }
--#define SP5100_WDT_START_STOP_BIT 1
-+#define SP5100_WDT_START_STOP_BIT (1 << 0)
- #define SP5100_WDT_TRIGGER_BIT (1 << 7)
+ dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %llu, t = %ld.\n",
+@@ -2559,13 +2559,13 @@ static int aac_write(struct scsi_cmnd * scsicmd)
+ scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 |
+ SAM_STAT_CHECK_CONDITION;
+ set_sense(&dev->fsa_dev[cid].sense_data,
+- HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE,
++ ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE,
+ ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
+ memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
+ min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
+ SCSI_SENSE_BUFFERSIZE));
+ scsicmd->scsi_done(scsicmd);
+- return 1;
++ return 0;
+ }
--#define SP5100_PCI_WATCHDOG_MISC_REG 0x41
--#define SP5100_PCI_WATCHDOG_DECODE_EN (1 << 3)
+ dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %llu, t = %ld.\n",
+
+; https://lkml.org/lkml/2019/7/10/244
+diff -ur linux-5.3/drivers/scsi/aacraid.org/aacraid.h linux-5.3/drivers/scsi/aacraid/aacraid.h
+--- linux-5.3/drivers/scsi/aacraid.org/aacraid.h 2019-11-01 22:42:37.011469816 +0100
++++ linux-5.3/drivers/scsi/aacraid/aacraid.h 2019-11-04 09:29:51.321486211 +0100
+@@ -2740,17 +2740,6 @@
+ int aac_rx_deliver_producer(struct fib * fib);
+ void aac_reinit_aif(struct aac_dev *aac, unsigned int index);
+
+-static inline int aac_is_src(struct aac_dev *dev)
+-{
+- u16 device = dev->pdev->device;
+-
+- if (device == PMC_DEVICE_S6 ||
+- device == PMC_DEVICE_S7 ||
+- device == PMC_DEVICE_S8)
+- return 1;
+- return 0;
+-}
-
- #define SP5100_PM_IOPORTS_SIZE 0x02
+ static inline int aac_supports_2T(struct aac_dev *dev)
+ {
+ return (dev->adapter_info.options & AAC_OPT_NEW_COMM_64);
+diff -ur linux-5.3/drivers/scsi/aacraid.org/comminit.c linux-5.3/drivers/scsi/aacraid/comminit.c
+--- linux-5.3/drivers/scsi/aacraid.org/comminit.c 2019-11-01 22:42:37.014803249 +0100
++++ linux-5.3/drivers/scsi/aacraid/comminit.c 2019-11-04 09:29:51.321486211 +0100
+@@ -41,8 +41,11 @@
+ {
+ u32 status = 0;
--/* These two IO registers are hardcoded and there doesn't seem to be a way to
-+/*
-+ * These two IO registers are hardcoded and there doesn't seem to be a way to
- * read them from a register.
- */
-+
-+/* For SP5100/SB7x0 chipset */
- #define SP5100_IO_PM_INDEX_REG 0xCD6
- #define SP5100_IO_PM_DATA_REG 0xCD7
+- if (aac_is_src(dev))
++ if (dev->pdev->device == PMC_DEVICE_S6 ||
++ dev->pdev->device == PMC_DEVICE_S7 ||
++ dev->pdev->device == PMC_DEVICE_S8) {
+ status = src_readl(dev, MUnit.OMR);
++ }
+ return (status & AAC_INT_MODE_MSIX);
+ }
-+#define SP5100_SB_RESOURCE_MMIO_BASE 0x9C
-+
- #define SP5100_PM_WATCHDOG_CONTROL 0x69
--#define SP5100_PM_WATCHDOG_BASE0 0x6C
--#define SP5100_PM_WATCHDOG_BASE1 0x6D
--#define SP5100_PM_WATCHDOG_BASE2 0x6E
--#define SP5100_PM_WATCHDOG_BASE3 0x6F
-+#define SP5100_PM_WATCHDOG_BASE 0x6C
-
- #define SP5100_PM_WATCHDOG_FIRED (1 << 1)
- #define SP5100_PM_WATCHDOG_ACTION_RESET (1 << 2)
-
--#define SP5100_PM_WATCHDOG_DISABLE 1
-+#define SP5100_PCI_WATCHDOG_MISC_REG 0x41
-+#define SP5100_PCI_WATCHDOG_DECODE_EN (1 << 3)
-+
-+#define SP5100_PM_WATCHDOG_DISABLE (1 << 0)
- #define SP5100_PM_WATCHDOG_SECOND_RES (3 << 1)
-+
-+#define SP5100_DEVNAME "SP5100 TCO"
-+
-+
-+/* For SB8x0(or later) chipset */
-+#define SB800_IO_PM_INDEX_REG 0xCD6
-+#define SB800_IO_PM_DATA_REG 0xCD7
-+
-+#define SB800_PM_ACPI_MMIO_EN 0x24
-+#define SB800_PM_WATCHDOG_CONTROL 0x48
-+#define SB800_PM_WATCHDOG_BASE 0x48
-+#define SB800_PM_WATCHDOG_CONFIG 0x4C
-+
-+#define SB800_PCI_WATCHDOG_DECODE_EN (1 << 0)
-+#define SB800_PM_WATCHDOG_DISABLE (1 << 2)
-+#define SB800_PM_WATCHDOG_SECOND_RES (3 << 0)
-+#define SB800_ACPI_MMIO_DECODE_EN (1 << 0)
-+#define SB800_ACPI_MMIO_SEL (1 << 2)
-+
-+
-+#define SB800_PM_WDT_MMIO_OFFSET 0xB00
-+
-+#define SB800_DEVNAME "SB800 TCO"
---
-1.7.11.7
-
+@@ -349,7 +352,8 @@
+ /* FIB should be freed only after getting the response from the F/W */
+ if (status != -ERESTARTSYS)
+ aac_fib_free(fibctx);
+- if (aac_is_src(dev) &&
++ if ((dev->pdev->device == PMC_DEVICE_S7 ||
++ dev->pdev->device == PMC_DEVICE_S8) &&
+ dev->msi_enabled)
+ aac_set_intx_mode(dev);
+ return status;
+@@ -610,7 +614,8 @@
+ dev->max_fib_size = status[1] & 0xFFE0;
+ host->sg_tablesize = status[2] >> 16;
+ dev->sg_tablesize = status[2] & 0xFFFF;
+- if (aac_is_src(dev)) {
++ if (dev->pdev->device == PMC_DEVICE_S7 ||
++ dev->pdev->device == PMC_DEVICE_S8) {
+ if (host->can_queue > (status[3] >> 16) -
+ AAC_NUM_MGT_FIB)
+ host->can_queue = (status[3] >> 16) -
+@@ -629,7 +634,9 @@
+ pr_warn("numacb=%d ignored\n", numacb);
+ }
+
+- if (aac_is_src(dev))
++ if (dev->pdev->device == PMC_DEVICE_S6 ||
++ dev->pdev->device == PMC_DEVICE_S7 ||
++ dev->pdev->device == PMC_DEVICE_S8)
+ aac_define_int_mode(dev);
+ /*
+ * Ok now init the communication subsystem
+diff -ur linux-5.3/drivers/scsi/aacraid.org/commsup.c linux-5.3/drivers/scsi/aacraid/commsup.c
+--- linux-5.3/drivers/scsi/aacraid.org/commsup.c 2019-11-01 22:42:37.014803249 +0100
++++ linux-5.3/drivers/scsi/aacraid/commsup.c 2019-11-04 09:29:51.321486211 +0100
+@@ -2593,7 +2593,9 @@
+ {
+ int i;
+
+- if (aac_is_src(dev)) {
++ if (dev->pdev->device == PMC_DEVICE_S6 ||
++ dev->pdev->device == PMC_DEVICE_S7 ||
++ dev->pdev->device == PMC_DEVICE_S8) {
+ if (dev->max_msix > 1) {
+ for (i = 0; i < dev->max_msix; i++)
+ free_irq(pci_irq_vector(dev->pdev, i),
+diff -ur linux-5.3/drivers/scsi/aacraid.org/linit.c linux-5.3/drivers/scsi/aacraid/linit.c
+--- linux-5.3/drivers/scsi/aacraid.org/linit.c 2019-11-01 22:42:37.011469816 +0100
++++ linux-5.3/drivers/scsi/aacraid/linit.c 2019-11-04 09:29:51.321486211 +0100
+@@ -1567,8 +1567,9 @@
+ aac_send_shutdown(aac);
+
+ aac_adapter_disable_int(aac);
+-
+- if (aac_is_src(aac)) {
++ if (aac->pdev->device == PMC_DEVICE_S6 ||
++ aac->pdev->device == PMC_DEVICE_S7 ||
++ aac->pdev->device == PMC_DEVICE_S8) {
+ if (aac->max_msix > 1) {
+ for (i = 0; i < aac->max_msix; i++) {
+ free_irq(pci_irq_vector(aac->pdev, i),
+@@ -1858,7 +1859,8 @@
+ aac_adapter_enable_int(dev);
+
+
+- if (aac_is_src(dev))
++ if (dev->pdev->device == PMC_DEVICE_S7 ||
++ dev->pdev->device == PMC_DEVICE_S8)
+ aac_define_int_mode(dev);
+
+ if (dev->msi_enabled)