git: a72d54791d36 - stable/13 - ata_kauai: Fix support for "shasta" controllers.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 May 2022 22:54:55 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a72d54791d3680e25c50e6d2e9ab8b685c26f2b0 commit a72d54791d3680e25c50e6d2e9ab8b685c26f2b0 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-04-18 19:06:52 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-05-13 20:15:56 +0000 ata_kauai: Fix support for "shasta" controllers. The probe routine was setting a value in the softc, but since the probe routine was not returning zero, this value was lost since the softc was reallocated (and re-zeroed) when the device was attached. This is similar in nature to the fixes from 965205eb66cae3fd5de75a70a3aef2f014f98020. To fix, move the code to set the 'shasta' flag to the start of attach along with related code to set an IRQ resource on some non-shasta devices. The IRQ resource still "worked" being in the probe routine as the IRQ resource persisted after probe returned, but it is cleaner to go ahead and move it to attach after setting the 'shasta' flag. I have no way to test this, but noticed this while reading the code. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D34888 (cherry picked from commit d5472cd4b3a3fedd56589a16a96f997d1d8fa1dc) --- sys/powerpc/powermac/ata_kauai.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/powerpc/powermac/ata_kauai.c b/sys/powerpc/powermac/ata_kauai.c index ffe8cea3a77f..32b33f130a6b 100644 --- a/sys/powerpc/powermac/ata_kauai.c +++ b/sys/powerpc/powermac/ata_kauai.c @@ -196,10 +196,8 @@ static const u_int udma_timing_shasta[] = { static int ata_kauai_probe(device_t dev) { - struct ata_kauai_softc *sc; u_int32_t devid; phandle_t node; - const char *compatstring = NULL; int i, found; found = 0; @@ -215,18 +213,6 @@ ata_kauai_probe(device_t dev) return (ENXIO); node = ofw_bus_get_node(dev); - sc = device_get_softc(dev); - bzero(sc, sizeof(struct ata_kauai_softc)); - - compatstring = ofw_bus_get_compat(dev); - if (compatstring != NULL && strcmp(compatstring,"shasta-ata") == 0) - sc->shasta = 1; - - /* Pre-K2 controllers apparently need this hack */ - if (!sc->shasta && - (compatstring == NULL || strcmp(compatstring, "K2-UATA") != 0)) - bus_set_resource(dev, SYS_RES_IRQ, 0, 39, 1); - return (ata_probe(dev)); } @@ -247,6 +233,7 @@ ata_kauai_attach(device_t dev) { struct ata_kauai_softc *sc = device_get_softc(dev); struct ata_channel *ch; + const char *compatstring; int i, rid; #if USE_DBDMA_IRQ int dbdma_irq_rid = 1; @@ -254,6 +241,15 @@ ata_kauai_attach(device_t dev) void *cookie; #endif + compatstring = ofw_bus_get_compat(dev); + if (compatstring != NULL && strcmp(compatstring,"shasta-ata") == 0) + sc->shasta = 1; + + /* Pre-K2 controllers apparently need this hack */ + if (!sc->shasta && + (compatstring == NULL || strcmp(compatstring, "K2-UATA") != 0)) + bus_set_resource(dev, SYS_RES_IRQ, 0, 39, 1); + ch = &sc->sc_ch.sc_ch; rid = PCIR_BARS;