From nobody Thu Sep 22 16:16:29 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 4MYL4s6BM4z4cjFl; Thu, 22 Sep 2022 16:16:29 +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 4MYL4s5J0mz3NqW; Thu, 22 Sep 2022 16:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663863389; 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=4zf4pX6l2HZrHgxawFj+8oyFi2bVgluwjX+cqRpliBo=; b=MMvnWHBo5Q6s3JvnCoZbAr/TBzOnNoKCQexoLQOOHnuDqbs1/Q+7mY67rr818KmkfbaSry kjZr0Slh7wrMYbfxzDPmVwpvToV/GVFrBFVppFAQlzNq/aAh3vsrUrEt1hE00wggtNQkJS KfiEkyzFiVMIc6k1AGx2OyBX8JOl3+U1JSxPn3I3LFD27dnlE2OsXfkgDy6zuCkXyNIDd/ odorzbN4v9RMkd50r2PGFqYhsrloUshod+s40dLU4GWsSjZhkJNoHTNKPmiAiNy52DDNFb kpcYuNSd5uBNfCzEJZiJs8v5JI8anVlEyeV/a6odIYDiJtCtuyrqN+Zm+9mm9A== 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 4MYL4s4G4jzSDC; Thu, 22 Sep 2022 16:16:29 +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 28MGGTgp050415; Thu, 22 Sep 2022 16:16:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28MGGTf4050414; Thu, 22 Sep 2022 16:16:29 GMT (envelope-from git) Date: Thu, 22 Sep 2022 16:16:29 GMT Message-Id: <202209221616.28MGGTf4050414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 046b82842c61 - main - LinuxKPI: io.h constify arguments and add more functions 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 046b82842c61c2d5d1648b5024958827e0a85725 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663863389; 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=4zf4pX6l2HZrHgxawFj+8oyFi2bVgluwjX+cqRpliBo=; b=h4OjR8Y+3X3dR2ICwwnCsVnM+/LEikXlDnekKXfT/ZE94adrAA8DJn0AppNiNHluMa6iuY 9qKXiq0NHWIDxTTZ0Y2XdgPpBwfISnZCVb3SjCNSiAoku/n6nAA4/UqxxN8liQ+cVxaKe0 Jc08UHETbmnqevvIGh6H0aOJ9cwYGVyWGkfza3YFzkjt1TcPqDuNAqNWHr3p7JE4Tu48IV 6s5thdku+9mJi34r/69dY+bnrIyA8DFu5WrbEcJczHaNpxCGHVu0Jq+UvJFafKubhJgVkR vwUo2uBHpB1j/ENTUOkMNktW3qXrRFRPw8R1MGSwsui3YJVZcj4D6OLLP3gqpA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663863389; a=rsa-sha256; cv=none; b=I/BUM/qWJms6CZHcJlOGruH5zJq5k30k3AEwCyhSS7SnmHKd2N/krM9221HgFw6u07tmSC NfDbanFOznXearQUz75v50HYCynUDHldRG8yBLVXo953pSeJIP3+uqq+a1tLLs6QJDfF6j DsyG0XYvnxS27x2Co09RXTD4g67qYqSahLfqOlBhh0qTwdFu5g+OiGdy0CK/UbKxQ6144W NbOdvFhmDWHKye2RkNDqsX9y9qtxDNF8AYiFQ9d31x2Amz5wbdvB4aBBCayZSRs1HYDLb/ u0hslkqBE3LXP5R0s7qXF0UDfLXPHs/1Ws0v4f4GOBqE7sXOJABVuf/25Yfgrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=046b82842c61c2d5d1648b5024958827e0a85725 commit 046b82842c61c2d5d1648b5024958827e0a85725 Author: Bjoern A. Zeeb AuthorDate: 2022-09-21 19:55:47 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-09-22 15:10:04 +0000 LinuxKPI: io.h constify arguments and add more functions Constify "*from" arguments and add __ioread32_copy() and __ioread64_copy() based on the already existing implementations. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36657 --- sys/compat/linuxkpi/common/include/linux/io.h | 34 +++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h index e12f9b36a9a1..64e8b294eeff 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -433,9 +433,9 @@ void iounmap(void *addr); #define memcpy_toio(a, b, c) memcpy((a), (b), (c)) static inline void -__iowrite32_copy(void *to, void *from, size_t count) +__iowrite32_copy(void *to, const void *from, size_t count) { - uint32_t *src; + const uint32_t *src; uint32_t *dst; int i; @@ -444,10 +444,10 @@ __iowrite32_copy(void *to, void *from, size_t count) } static inline void -__iowrite64_copy(void *to, void *from, size_t count) +__iowrite64_copy(void *to, const void *from, size_t count) { #ifdef __LP64__ - uint64_t *src; + const uint64_t *src; uint64_t *dst; int i; @@ -458,6 +458,32 @@ __iowrite64_copy(void *to, void *from, size_t count) #endif } +static inline void +__ioread32_copy(void *to, const void *from, size_t count) +{ + const uint32_t *src; + uint32_t *dst; + int i; + + for (i = 0, src = from, dst = to; i < count; i++, src++, dst++) + *dst = __raw_readl(src); +} + +static inline void +__ioread64_copy(void *to, const void *from, size_t count) +{ +#ifdef __LP64__ + const uint64_t *src; + uint64_t *dst; + int i; + + for (i = 0, src = from, dst = to; i < count; i++, src++, dst++) + *dst = __raw_readq(src); +#else + __ioread32_copy(to, from, count * 2); +#endif +} + enum { MEMREMAP_WB = 1 << 0, MEMREMAP_WT = 1 << 1,