From nobody Tue Apr 30 05:59:24 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 4VT8fN30tcz5JGjR; Tue, 30 Apr 2024 05:59:24 +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 4VT8fN248fz530q; Tue, 30 Apr 2024 05:59:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714456764; 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=gavZRPczbTEdHP8/rAue7iUSEn0hG5Pt+ET8fPzsvhM=; b=l/Ij3XAj02fBEz4/dbQqiGxvV6Q8R4UY0SHf1V2ZjSSqke4u7R8qHDQJsp0E2uqm9rsiNG FXUmKcid8KHK77e4NKGLjZOlfkP2iZ2mYCqklBcazp7l+rkG9Z9w0Oj1gDc1AEDQ44Aa8h zgJhIu09vUJ/PN4oN/WYYvpJuCgx+00cJVO479mtfP3g4DaO3jWmBJXsBzTLoT2AJFhuk5 cLVcDlM1HKUgycN2vKORUvZw12yxczndmFG9M7HoWL0LmHPab9ISmETZ7ulVi3wGRfluOp Bark0584DwjxdyYLw3aspRoRdRxFJGIiD0PQPSwI+KPAJ8mYf9XOUviBH//Sog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714456764; a=rsa-sha256; cv=none; b=JNOgTQmiIAPOjFWik9DnRt+bf0z5Zo4JcTegiRlj8T6Lk5letNnTFQi/lIzYodVSwziU25 nOq8LfFSpurbo60U79Eur4hObpGXzEK1XymirGaBcdScT5y/bxiX43XdKkQcrwrguXj6gj cO409/7sCliogZ30191F/UCt7gOA0T0YxLLOQv+FogNMp1EKv1Xu0xNIgefbK27hpcP0qs qpLTedEN9EItjH9nzvTkjx/Z9FEHfgZE/6ikF/d3XiKBXUKoyeFWne2yZFZKMP4cDhWWZz /eh5mavrqu3D3j2hN1uphi030ke/M0NaHGjOS+1BY/BZjTz0OL+cmy1L+nBbkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714456764; 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=gavZRPczbTEdHP8/rAue7iUSEn0hG5Pt+ET8fPzsvhM=; b=NUh/HZdUnb1u8LcNaNrBHnXP8mkwlLbz6KT7ZJISnwTy/ex5sta7aaivTTgQkRR8/5U7sJ xSYhmhWGYEX2Oa4z5VE4k7q4EdjiCwfePBEIyB5CsZCz/nn7s5H4mqVjXaSs29GS8EGI6V anaEx57saUhCsWGxDGIJ9i8oXw1b8uHUxoBuFp/XGAl1by643QWyM7c9QG9y9VwGPAFiht HOu3NJNSolcB+LgD4WHF6MKQwOk/ggkxYOCAi7KPmNbmghJLwyU/Wp24q8HiQYErOcjZ6u M1SarGsUJFcLUB0SUm+q/8J3OihM4agWO5w8vYYcizUquYDK1I5mdTqmXheggg== 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 4VT8fN1dyvzNQn; Tue, 30 Apr 2024 05:59:24 +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 43U5xO56037925; Tue, 30 Apr 2024 05:59:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43U5xOXg037922; Tue, 30 Apr 2024 05:59:24 GMT (envelope-from git) Date: Tue, 30 Apr 2024 05:59:24 GMT Message-Id: <202404300559.43U5xOXg037922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 11d79c4756b7 - main - linuxkpi: Add linuxkpi_video module 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11d79c4756b7c85faf7c4a268c301a41ce0887b9 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=11d79c4756b7c85faf7c4a268c301a41ce0887b9 commit 11d79c4756b7c85faf7c4a268c301a41ce0887b9 Author: Emmanuel Vadot AuthorDate: 2024-04-24 08:14:36 +0000 Commit: Emmanuel Vadot CommitDate: 2024-04-30 05:42:31 +0000 linuxkpi: Add linuxkpi_video module This contain the hdmi code and the aperture code like in linux. Differential Revision: https://reviews.freebsd.org/D44925 Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG --- .../linuxkpi/common/include/linux/aperture.h | 58 ++++ sys/compat/linuxkpi/common/src/linux_aperture.c | 365 +++++++++++++++++++++ .../linuxkpi/common/src/linuxkpi_videokmod.c | 7 + sys/modules/Makefile | 1 + sys/modules/linuxkpi_video/Makefile | 15 + 5 files changed, 446 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/aperture.h b/sys/compat/linuxkpi/common/include/linux/aperture.h new file mode 100644 index 000000000000..e0387ed0225d --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/aperture.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef _LINUX_APERTURE_H_ +#define _LINUX_APERTURE_H_ + +#include + +#define CONFIG_APERTURE_HELPERS + +struct pci_dev; +struct platform_device; + +#if defined(CONFIG_APERTURE_HELPERS) +int devm_aperture_acquire_for_platform_device(struct platform_device *pdev, + resource_size_t base, + resource_size_t size); + +int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, + bool primary, const char *name); + +int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name); +#else +static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev, + resource_size_t base, + resource_size_t size) +{ + return 0; +} + +static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, + bool primary, const char *name) +{ + return 0; +} + +static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name) +{ + return 0; +} +#endif + +/** + * aperture_remove_all_conflicting_devices - remove all existing framebuffers + * @primary: also kick vga16fb if present; only relevant for VGA devices + * @name: a descriptive name of the requesting driver + * + * This function removes all graphics device drivers. Use this function on systems + * that can have their framebuffer located anywhere in memory. + * + * Returns: + * 0 on success, or a negative errno code otherwise + */ +static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name) +{ + return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name); +} + +#endif diff --git a/sys/compat/linuxkpi/common/src/linux_aperture.c b/sys/compat/linuxkpi/common/src/linux_aperture.c new file mode 100644 index 000000000000..15a56839fa9c --- /dev/null +++ b/sys/compat/linuxkpi/common/src/linux_aperture.c @@ -0,0 +1,365 @@ +// SPDX-License-Identifier: MIT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include