From nobody Sat Feb 17 21:33:11 2024 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 4TchqX3d6Gz59lGw; Sat, 17 Feb 2024 21:33:12 +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 4TchqX1C4Kz4j02; Sat, 17 Feb 2024 21:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708205592; 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=ZlSMQv/zxVMXvw5XeblXw+YqPWuLhVLuXKqtE2Ph5Jw=; b=IIUEa4isapwZlLZZwfJKaoetBpD12L9P9VlxhyrwJHaGY5rNy+/KZMRvHXe6bw23MhOBz1 2PSB2RcCJcoPWdSFAJDt7/16zCOagB8HojFSLSFm8vRnHb8ptT+gOVxH31pEBxBOf7CcCi Bu6euDrRLaAN551kThf534cJry1swTD8W3xFiahNIh7de5hBJF1F6oYSXCaMchzBIBWQfs mRIbc+/dXmUBPwvI6yJH1fddtTFSMoGwF8mIRT6svGIXOduVvGpsR0yXF1Ga+XB+wBgGwu dwit1LUvfd/w9nVedMnW1ATl+W9ufqUxh9xmBhXwuiE+DEZCDdRfHvMWGBu1mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708205592; 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=ZlSMQv/zxVMXvw5XeblXw+YqPWuLhVLuXKqtE2Ph5Jw=; b=sZurESxnWIlJAcex1S15VtlBIf5wTS3ncxW7KKs5RXCTbpFfaxOQom4e1y5l7Bsmjgb+zN HIY/wZhzljBmr7KJETnEjeKbTzVUPAz22euMC+zwEng1Ma0b0AgpIB7p0lTWvfq0ieYysn ZfHw3a2kxVGz3k7d2WG5BcPq7M6rlkeTKkRyBCROLRs9WvJw6mWMkxceKbX3L0Y861SnQL z5Ra7pMUJAxY1r1G2vv2corMrvLPIMVPtziiAb2lA8/20qMe6Btu6+qeOqnSeEqrKfXme4 euRmjbw+P70pXx+seWx9JDHNRBOP5p2i2MkpbLRaMbc5lnzVfgBy2rTyC881Nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708205592; a=rsa-sha256; cv=none; b=aUv3usEM+mfp2H8v6i6lgmNMVAXbbtDMdXtOxfyEZdTL9yuzf/mbCWF6XqPA5FukknkBpD tXVDJLTfJDaxDkDdZy2tpvtj3ZjNuA1JKnS4/x4knPDio7TjhXuVCR0AdqvzEb9CIA/xZS DgNUOJsfNPHQtPvI7mu8JtRA+W5Y5S1FY5J7VXu9ASmFSatxQWsY3e1HGZWQCCLdpdbZqr eaITTiS/qDu8U8jYSLy9MBQ5jd8hD6V+cLpoRBfWePsJM2P0bYqVwwZd0dBJ5OAKiVdCcZ J+j52gKLFTmb5snlI2dUyBLt7836C6SWIRmKxdDyL/XqkzOMDbHRw3/eRivw5A== 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 4TchqX0JsXzP5W; Sat, 17 Feb 2024 21:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41HLXBWk021268; Sat, 17 Feb 2024 21:33:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41HLXBb4021265; Sat, 17 Feb 2024 21:33:11 GMT (envelope-from git) Date: Sat, 17 Feb 2024 21:33:11 GMT Message-Id: <202402172133.41HLXBb4021265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 559999c00b8e - stable/14 - LinuxKPI: Add linux/ioport.h header 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: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 559999c00b8e8afd690fc5fb3738c72ca1aa88ba Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=559999c00b8e8afd690fc5fb3738c72ca1aa88ba commit 559999c00b8e8afd690fc5fb3738c72ca1aa88ba Author: Vladimir Kondratyev AuthorDate: 2023-12-24 08:20:00 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-02-17 20:58:38 +0000 LinuxKPI: Add linux/ioport.h header Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42817 (cherry picked from commit 9903d83d67ea5eed7c36fbe8b4afe6c4dd148d0e) --- sys/compat/linuxkpi/common/include/linux/ioport.h | 57 +++++++++++++++++++++++ sys/compat/linuxkpi/dummy/include/linux/ioport.h | 0 2 files changed, 57 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/ioport.h b/sys/compat/linuxkpi/common/include/linux/ioport.h new file mode 100644 index 000000000000..444f3ad94602 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/ioport.h @@ -0,0 +1,57 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Serenity Cyber Security, LLC. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUXKPI_LINUX_IOPORT_H +#define _LINUXKPI_LINUX_IOPORT_H + +#include +#include + +#define DEFINE_RES_MEM(_start, _size) \ + (struct resource) { \ + .start = (_start), \ + .end = (_start) + (_size) - 1, \ + } + +struct resource { + resource_size_t start; + resource_size_t end; +}; + +static inline resource_size_t +resource_size(const struct resource *r) +{ + return (r->end - r->start + 1); +} + +static inline bool +resource_contains(struct resource *a, struct resource *b) +{ + return (a->start <= b->start && a->end >= b->end); +} + +#endif diff --git a/sys/compat/linuxkpi/dummy/include/linux/ioport.h b/sys/compat/linuxkpi/dummy/include/linux/ioport.h deleted file mode 100644 index e69de29bb2d1..000000000000