From nobody Mon Apr 18 19:08:57 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 504FE11D59CB; Mon, 18 Apr 2022 19:08:58 +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 4KhxLL0MKYz4S2q; Mon, 18 Apr 2022 19:08:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650308938; 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=FpqKEJ4s0duC1UXceLbP8bIWsh9FQYFj9V1WUh0WYE8=; b=fPUL5d9Lkufzhjvdyu7fKgncgk7d8FN0t0I3V1lrOOSctVScLUBZm7R4QgUhZTMpjCDHx9 sFt0uVCT5SvBzwY6TLX2L2XxvldfGXVeX4SEbWzpHtPYawThPxGij+eMGOg6FNiaejKprG 5FkxBqGUa8qG4qlrtFwBfTE3PighLj5PfH9/EYDL418R550L/U1riG/6JvjMBQQos6i7FT HLBr4EWCD3scnHbVYTw2NpgLcIgqPBC9RevrjzOQHUSoeXigTZPXJNdZFO4TrNoFMidAdi MjmP4LxLxuPp2QbJTPOTPNC+JcfA4B8SrIELS066pSv6DImguqq1xWC4+IrGaw== 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 8DA30186B7; Mon, 18 Apr 2022 19:08:57 +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 23IJ8vbI089672; Mon, 18 Apr 2022 19:08:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23IJ8vBI089671; Mon, 18 Apr 2022 19:08:57 GMT (envelope-from git) Date: Mon, 18 Apr 2022 19:08:57 GMT Message-Id: <202204181908.23IJ8vBI089671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d5472cd4b3a3 - main - 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/main X-Git-Reftype: branch X-Git-Commit: d5472cd4b3a3fedd56589a16a96f997d1d8fa1dc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650308938; 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=FpqKEJ4s0duC1UXceLbP8bIWsh9FQYFj9V1WUh0WYE8=; b=a3iJYAVdbyOyueuUqY/TTB5icK8GNqHZKc3BGA1EATBkbqpy1MKMctt75U6RSMq3ktFBDJ SpjLaRmi43UiMipqia8jI1WfS2IehmeRtYQxpRjqMP3y4VQBZN2XnqjY2ED8HOxegmyA7m 389i3Owh3RxxNRAIwTtgQwFUFAM3JxY48axidVDZfHu20PCo0FQD6rIRe1KNPlYtwYo5S1 4xecnC6LSJqYOwzKrXi7V2Ib7QrGZiwd5Qspz1nFkP3KOj+vWIOdxQYmyNTNGa3IJjAn2C scwU+4ARDL0eqLeGAdAcdWhj4tVGvOE3uXfMcuKUoDiRE+u17qgMStVobk6z1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650308938; a=rsa-sha256; cv=none; b=RJoObNI2FkXbPqJszktdRWTDPwwdP2rzjLSGXIOKoHbJwAt6fhiTngVZ0l7T+TIIL4xLVm V2DfZDOxqNXHcgCzPgrjAO8nTVf+qrs8yqCPn8Gyam/s9h1KghZiQpfZPdJshP8czexTG+ oxrY+rYTEIuzyj6Z8AYDOvNluR4LIbN6pbw4yrE3D37L1yLd+JgkrdbWciLh9OrSkOChgF Wq153dj35bm6pnp/bdDtYmurIhveWz1+dinoKIWoK/k3RJqC8qKithZ0VvMf5r0bFKd0ay HC2RbJhgNcE6xNosSaTIgPFvQgVwBr3TED2tgWQeZh0opT/8mmzpsZ2UHw0kJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d5472cd4b3a3fedd56589a16a96f997d1d8fa1dc commit d5472cd4b3a3fedd56589a16a96f997d1d8fa1dc Author: John Baldwin AuthorDate: 2022-04-18 19:06:52 +0000 Commit: John Baldwin CommitDate: 2022-04-18 19:06:52 +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 --- 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 f1aea059057f..75e676eadd81 100644 --- a/sys/powerpc/powermac/ata_kauai.c +++ b/sys/powerpc/powermac/ata_kauai.c @@ -196,9 +196,7 @@ static const u_int udma_timing_shasta[] = { static int ata_kauai_probe(device_t dev) { - struct ata_kauai_softc *sc; u_int32_t devid; - const char *compatstring = NULL; int i, found; found = 0; @@ -213,18 +211,6 @@ ata_kauai_probe(device_t dev) if (!found) return (ENXIO); - 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)); } @@ -245,6 +231,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; @@ -252,6 +239,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;