git: bf206683a865 - stable/13 - amdsbwd: always enable watchdog register decoding

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Mon, 27 Dec 2021 11:38:14 UTC
The branch stable/13 has been updated by avg:

URL: https://cgit.FreeBSD.org/src/commit/?id=bf206683a865c381f8f6f70bd8a0c0cf840ea940

commit bf206683a865c381f8f6f70bd8a0c0cf840ea940
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2020-05-27 10:15:54 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2021-12-27 11:37:29 +0000

    amdsbwd: always enable watchdog register decoding
    
    This seems to be required even if the watchdog is accessed via the common
    MMIO space.
    
    Tested on:
    - Ryzen 3 3200U APU;
    - Ryzen 7 5800X CPU with X570 chipset.
    
    (cherry picked from commit cca0d3bbd8c9f8b50c6940c33704a6c8c464b68f)
---
 sys/dev/amdsbwd/amdsbwd.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/sys/dev/amdsbwd/amdsbwd.c b/sys/dev/amdsbwd/amdsbwd.c
index 452b014d2240..a7ab67f1a8b8 100644
--- a/sys/dev/amdsbwd/amdsbwd.c
+++ b/sys/dev/amdsbwd/amdsbwd.c
@@ -381,24 +381,23 @@ amdsbwd_probe_fch41(device_t dev, struct resource *pmres, uint32_t *addr)
 	uint8_t	val;
 	char buf[36];
 
+	/*
+	 * Enable decoding of watchdog MMIO address.
+	 */
+	val = pmio_read(pmres, AMDFCH41_PM_DECODE_EN0);
+	val |= AMDFCH41_WDT_EN;
+	pmio_write(pmres, AMDFCH41_PM_DECODE_EN0, val);
+#ifdef AMDSBWD_DEBUG
+	val = pmio_read(pmres, AMDFCH41_PM_DECODE_EN0);
+	device_printf(dev, "AMDFCH41_PM_DECODE_EN0 value = %#04x\n", val);
+#endif
+
 	val = pmio_read(pmres, AMDFCH41_PM_ISA_CTRL);
 	if ((val & AMDFCH41_MMIO_EN) != 0) {
 		/* Fixed offset for the watchdog within ACPI MMIO range. */
 		amdsbwd_verbose_printf(dev, "ACPI MMIO range is enabled\n");
 		*addr = AMDFCH41_MMIO_ADDR + AMDFCH41_MMIO_WDT_OFF;
 	} else {
-		/*
-		 * Enable decoding of watchdog MMIO address.
-		 */
-		val = pmio_read(pmres, AMDFCH41_PM_DECODE_EN0);
-		val |= AMDFCH41_WDT_EN;
-		pmio_write(pmres, AMDFCH41_PM_DECODE_EN0, val);
-#ifdef AMDSBWD_DEBUG
-		val = pmio_read(pmres, AMDFCH41_PM_DECODE_EN0);
-		device_printf(dev, "AMDFCH41_PM_DECODE_EN0 value = %#04x\n",
-		    val);
-#endif
-
 		/* Special fixed MMIO range for the watchdog. */
 		*addr = AMDFCH41_WDT_FIXED_ADDR;
 	}