From nobody Thu Mar 31 01:49:17 2022 X-Original-To: dev-commits-src-branches@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 424E11A51EA0; Thu, 31 Mar 2022 01:49:18 +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 4KTR713ZQKz4mrD; Thu, 31 Mar 2022 01:49:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648691357; 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=igeB0vpzLnlEXpilzyIa0jH+W3pU6s2VbD7+IMrwHYk=; b=u6jR7mV8JFTDQvd70d81ERxkw1htzlFX360h4hIOie+MK3AahXoQhSPRL+mj4nN6iaa5gx OAyeKYF72Th9fd7lRBqEcc6qQGzcJJ2SRvuFsYopJpgdL5rIrVqGA6TCDKZYTFhdO3NDRS 4JwvS3kVYJ6UjZf9kam3xUA9dh90ebMaXsG5M+PXZtLx+UVigkVPTaaUwGvIDgxj2tWorG NZavTikMYdzESAbq76sC2zkV68zoTjbIPbOBaAkd14RDrRdYn6D7fj0is3jalnJYbB5mpi OVoYZ47uCKwAd4k7ekLoPQCfn7PQVy6x7rFKG/AoWT044O7dOgoPu01KHA7KZw== 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 357051E9AA; Thu, 31 Mar 2022 01:49:17 +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 22V1nHEE035625; Thu, 31 Mar 2022 01:49:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22V1nHBI035624; Thu, 31 Mar 2022 01:49:17 GMT (envelope-from git) Date: Thu, 31 Mar 2022 01:49:17 GMT Message-Id: <202203310149.22V1nHBI035624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: ee772cbdc4e2 - stable/13 - rtsx: Remove update of softc during probe and some var rename. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ee772cbdc4e268c7d78d0b88b9176d8834e3062f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648691357; 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=igeB0vpzLnlEXpilzyIa0jH+W3pU6s2VbD7+IMrwHYk=; b=vqP8h3wIXiJhksH2RxW5QHLrjeKHKMG+bt/8UPtibMnKGCNaqXoB5jnBslFCMfiwG8J2CI TITAB5E3uDKbs4DhZy3u81R9TuH+GWx+9WyDQKtpPqcs/BKgkacEx9VL1Rkd3XRbZQ8ufn rEIv21S9XNoQIDQGItedgBiwPPWTVOzzfX/5kxFaD97YNMRB5UX9DEYitdMqLwEvviGcaT RElt89qoMq1HHooeeccMeoa2ooaAYUgzs3W5cZ3WzzEbk5K3QU4hfLNBPXdSPRiHVJfWst 9OvPC67BExwEturYAfR1cONzAaAwXMfU8kYxv22dmtkUT5ShB76U+cxLXOPSxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648691357; a=rsa-sha256; cv=none; b=ngFGLt0NFgDkF4nFJt0vtv79yMlxAdigF+CLYczD8dXbADJ8/JFwkRDd0VZeFEBGn2+mwO vk4yGryEdzktYVJTDaPEIRH5J+f0BL1bVw+Fei9O3m3MrEswOszmruJ+NCjMEDrWvt30q3 7mCDv8h1PI+J3jfOquRH6+GQmpjm1q2bXmxTLbfH4JxHCJE+RKmjgUs3KYeEYVsk7zumi4 N26z6Y1g9x1SNcOIgMAdUhPWIJat5ht/DqBshParLi3GK9SEcEbtITxXf/vWZHEqXRI0R2 NKVrXbCLcOW3Q93QEHWDdAdz9B/5Cehf19Q71l8JQ8efu70k+C1t9Tv8TRXEKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ee772cbdc4e268c7d78d0b88b9176d8834e3062f commit ee772cbdc4e268c7d78d0b88b9176d8834e3062f Author: Henri Hennebert AuthorDate: 2022-03-25 19:23:59 +0000 Commit: Alexander Motin CommitDate: 2022-03-31 01:48:24 +0000 rtsx: Remove update of softc during probe and some var rename. MFC after: 1 week (cherry picked from commit 2e8830678637f5c1757a228ceb2605387c6f97ef) --- sys/dev/rtsx/rtsx.c | 58 +++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/sys/dev/rtsx/rtsx.c b/sys/dev/rtsx/rtsx.c index 5664be67181f..88d7075c6ce1 100644 --- a/sys/dev/rtsx/rtsx.c +++ b/sys/dev/rtsx/rtsx.c @@ -97,10 +97,10 @@ struct rtsx_softc { rtsx_card_insert_task; /* card insert delayed task */ struct task rtsx_card_remove_task; /* card remove task */ - int rtsx_res_id; /* bus memory resource id */ - struct resource *rtsx_res; /* bus memory resource */ - bus_space_tag_t rtsx_btag; /* host register set tag */ - bus_space_handle_t rtsx_bhandle; /* host register set handle */ + int rtsx_mem_res_id; /* bus memory resource id */ + struct resource *rtsx_mem_res; /* bus memory resource */ + bus_space_tag_t rtsx_mem_btag; /* host register set tag */ + bus_space_handle_t rtsx_mem_bhandle; /* host register set handle */ bus_dma_tag_t rtsx_cmd_dma_tag; /* DMA tag for command transfer */ bus_dmamap_t rtsx_cmd_dmamap; /* DMA map for command transfer */ @@ -172,7 +172,7 @@ struct rtsx_softc { #define RTSX_RTL8411 0x5289 #define RTSX_RTL8411B 0x5287 -#define RTSX_VERSION "2.1f" +#define RTSX_VERSION "2.1f-1" static const struct rtsx_device { uint16_t vendor_id; @@ -320,9 +320,9 @@ static int rtsx_resume(device_t dev); #define ISSET(t, f) ((t) & (f)) #define READ4(sc, reg) \ - (bus_space_read_4((sc)->rtsx_btag, (sc)->rtsx_bhandle, (reg))) + (bus_space_read_4((sc)->rtsx_mem_btag, (sc)->rtsx_mem_bhandle, (reg))) #define WRITE4(sc, reg, val) \ - (bus_space_write_4((sc)->rtsx_btag, (sc)->rtsx_bhandle, (reg), (val))) + (bus_space_write_4((sc)->rtsx_mem_btag, (sc)->rtsx_mem_bhandle, (reg), (val))) #define RTSX_READ(sc, reg, val) \ do { \ @@ -3537,7 +3537,6 @@ rtsx_mmcbr_release_host(device_t bus, device_t child __unused) static int rtsx_probe(device_t dev) { - struct rtsx_softc *sc; uint16_t vendor_id; uint16_t device_id; int i; @@ -3551,8 +3550,6 @@ rtsx_probe(device_t dev) if (rtsx_devices[i].vendor_id == vendor_id && rtsx_devices[i].device_id == device_id) { device_set_desc(dev, rtsx_devices[i].desc); - sc = device_get_softc(dev); - sc->rtsx_device_id = device_id; result = BUS_PROBE_DEFAULT; break; } @@ -3568,6 +3565,8 @@ static int rtsx_attach(device_t dev) { struct rtsx_softc *sc = device_get_softc(dev); + uint16_t vendor_id; + uint16_t device_id; struct sysctl_ctx_list *ctx; struct sysctl_oid_list *tree; int msi_count = 1; @@ -3578,11 +3577,14 @@ rtsx_attach(device_t dev) char *product; int i; + vendor_id = pci_get_vendor(dev); + device_id = pci_get_device(dev); if (bootverbose) device_printf(dev, "Attach - Vendor ID: 0x%x - Device ID: 0x%x\n", - pci_get_vendor(dev), pci_get_device(dev)); + vendor_id, device_id); sc->rtsx_dev = dev; + sc->rtsx_device_id = device_id; sc->rtsx_req = NULL; sc->rtsx_timeout_cmd = 1; sc->rtsx_timeout_io = 10; @@ -3647,21 +3649,21 @@ rtsx_attach(device_t dev) /* Allocate memory resource. */ if (sc->rtsx_device_id == RTSX_RTS525A) - sc->rtsx_res_id = PCIR_BAR(1); + sc->rtsx_mem_res_id = PCIR_BAR(1); else - sc->rtsx_res_id = PCIR_BAR(0); - sc->rtsx_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rtsx_res_id, RF_ACTIVE); - if (sc->rtsx_res == NULL) { - device_printf(dev, "Can't allocate memory resource for %d\n", sc->rtsx_res_id); + sc->rtsx_mem_res_id = PCIR_BAR(0); + sc->rtsx_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rtsx_mem_res_id, RF_ACTIVE); + if (sc->rtsx_mem_res == NULL) { + device_printf(dev, "Can't allocate memory resource for %d\n", sc->rtsx_mem_res_id); goto destroy_rtsx_irq_res; } if (bootverbose) - device_printf(dev, "rtsx_irq_res_id: %d, rtsx_res_id: %d\n", - sc->rtsx_irq_res_id, sc->rtsx_res_id); + device_printf(dev, "rtsx_irq_res_id: %d, rtsx_mem_res_id: %d\n", + sc->rtsx_irq_res_id, sc->rtsx_mem_res_id); - sc->rtsx_btag = rman_get_bustag(sc->rtsx_res); - sc->rtsx_bhandle = rman_get_bushandle(sc->rtsx_res); + sc->rtsx_mem_btag = rman_get_bustag(sc->rtsx_mem_res); + sc->rtsx_mem_bhandle = rman_get_bushandle(sc->rtsx_mem_res); TIMEOUT_TASK_INIT(taskqueue_swi_giant, &sc->rtsx_card_insert_task, 0, rtsx_card_task, sc); @@ -3677,7 +3679,7 @@ rtsx_attach(device_t dev) NULL, rtsx_intr, sc, &sc->rtsx_irq_cookie); if (error) { device_printf(dev, "Can't set up irq [0x%x]!\n", error); - goto destroy_rtsx_res; + goto destroy_rtsx_mem_res; } pci_enable_busmaster(dev); @@ -3728,9 +3730,9 @@ rtsx_attach(device_t dev) destroy_rtsx_irq: bus_teardown_intr(dev, sc->rtsx_irq_res, sc->rtsx_irq_cookie); - destroy_rtsx_res: - bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_res_id, - sc->rtsx_res); + destroy_rtsx_mem_res: + bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_mem_res_id, + sc->rtsx_mem_res); rtsx_dma_free(sc); destroy_rtsx_irq_res: callout_drain(&sc->rtsx_timeout_callout); @@ -3750,7 +3752,7 @@ rtsx_detach(device_t dev) if (bootverbose) device_printf(dev, "Detach - Vendor ID: 0x%x - Device ID: 0x%x\n", - pci_get_vendor(dev), pci_get_device(dev)); + pci_get_vendor(dev), sc->rtsx_device_id); /* Disable interrupts. */ sc->rtsx_intr_enabled = 0; @@ -3767,9 +3769,9 @@ rtsx_detach(device_t dev) /* Teardown the state in our softc created in our attach routine. */ rtsx_dma_free(sc); - if (sc->rtsx_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_res_id, - sc->rtsx_res); + if (sc->rtsx_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_mem_res_id, + sc->rtsx_mem_res); if (sc->rtsx_irq_cookie != NULL) bus_teardown_intr(dev, sc->rtsx_irq_res, sc->rtsx_irq_cookie); if (sc->rtsx_irq_res != NULL) {