From nobody Fri May 13 22:54:55 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7EF0F1AD4C5D; Fri, 13 May 2022 22:54:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L0P9W5yL3z3nsC; Fri, 13 May 2022 22:54:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652482496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vr4RZfY2i3OLt1+WV5vEP6dm65F0jymc2GFj7jRCmMs=; b=v8qZQGHT2NsSGBWFs5pDY1/S8lwkmDvS33U2QQmzHluUyzU9thN3ZXaG8QlQblIFwP1dJ0 GHKleb1mdsR446KQ+uFckUkAyoQLtgbUTO9+Qt2nS5xGat4rofpY6VqYOjyj5kAfLieeYp XB3xkvVRb1a2ETC4D4vjRsytFAPcVE6t/4pzV6And5lA0urqJng0GYG+dChBCEA4jemfCs NhyX8ECoLUMYOgQA5aazpS2ioUSck7OFMovJQCcMBKLLIBQcsQiZMgxiG1FFkaytcPxobo qtFRwucFKyxPsX1wDHUe2FyL+FgJ4ICMmF00+poe7qMYJrxU4Svp6YRAc4Vb1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F79F3C09; Fri, 13 May 2022 22:54:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 24DMstuO078411; Fri, 13 May 2022 22:54:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24DMstkB078410; Fri, 13 May 2022 22:54:55 GMT (envelope-from git) Date: Fri, 13 May 2022 22:54:55 GMT Message-Id: <202205132254.24DMstkB078410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a72d54791d36 - stable/13 - ata_kauai: Fix support for "shasta" controllers. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a72d54791d3680e25c50e6d2e9ab8b685c26f2b0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652482496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vr4RZfY2i3OLt1+WV5vEP6dm65F0jymc2GFj7jRCmMs=; b=GTaVs+89bk+1cCCjyIiaxrZLfXdQB83EBmJ0Mq6vGncbJ7V7nOcK1LMKnA57eJlx+zESQ3 X6Y6xOCBkb0Nz+eI1mBsF7CJLsJbndN6/v/OvctJFeJUxpCpQ6LggqBziO7TVky91MFEVQ hBnygFUW2D52IG8CmZSdJavjR7s5Ntr4Au2s4PHeUdKouoGqjAXq8E3mRCiKPS5fX0MBt8 EHN1qJxX7HaqrIU21Uqsgc8MzS4EMPYxP8Z7GRA2Vtpa8+pXXrCTixBlGgB0i9fOtxkyRz Uc1qJtUf3WtNzCAN8UR1kjY0gLOLEMW4tovIQMI8dU9o4liSxV/+33EnRIK5Xg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652482496; a=rsa-sha256; cv=none; b=BOYJIVWaDHcNkFTYWRFHLrCvNPuuapLHFUiqCNZic6UoBWrJl0obetqmbd2re2HEtdkii5 1dSF+7cFT8wvUXhO6VP1NGDtOvg3tFPF+U20WbAxHK/GH2xzYoWecsxBrJtnCDsstq802k BrNJCEdOEycoKwtShvaptZ5lteiRMxn2aQv6ujUWrJxwdUsLzQCb6EWmC0jPbRZvLPKW2J K1xIANPVP6qEI0JDpuHgVBg/y9A6wl5IV6KMAMjCry+VjR0ZSdmEjOdAtfGMotkAjfqCSm mYqJL9+Hi1d8nnOUGpS6luP4Ml0lH9MTZbaF5rTrNTEo/vUpf+0lEZoeF0GVJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a72d54791d3680e25c50e6d2e9ab8b685c26f2b0 commit a72d54791d3680e25c50e6d2e9ab8b685c26f2b0 Author: John Baldwin AuthorDate: 2022-04-18 19:06:52 +0000 Commit: John Baldwin 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;