From nobody Tue Jun 4 11:19:42 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 4Vtp5p6K8vz5NFvh; Tue, 04 Jun 2024 11:19:42 +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 4Vtp5p4vPxz4Ll8; Tue, 4 Jun 2024 11:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717499982; 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=AvrtYddFa/ccrk6i5qwc+KO6Cm9SbbOMCECdxKh8ncQ=; b=PXqd/0aRceYoqbQRP/cxA30KpVSv1Ymb3wXfV7pb33lRYqJD2JsKcIeHSYp7Oo7YsEhyYW yJ4QdI+k7GqXWDEwvgpJPCpsJtcSgjCku0QqjsK9gR+lb0L+Kcn8C/RvS5q8WlB2j55T8M q2SBtbAU/y4bKIVkLzqjapcTtIViaD9e7CBQD7BpQVWTUtHyz5sBJPiypykafQb4adtZQW hENM8osYTIGbPnmPaP52tERD4Zgnq0t3kz230oEpBo/NzsZWg1XnKlDa+aS/TaQ5qzkJRF 43/VyyHT5wZla+oOugAwFkx/1ug3ZLR9e3BOaFmTWiBCN9O9L5bcdo658xzidw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717499982; a=rsa-sha256; cv=none; b=EhNi5zFOXs49S7D6/2bTuLEkOhbmQ7iUU5t6NQ5q7R3ZPeLqrdDZqNPREhsn97jMwAaEuf /eqsFTTtigIL2GIRuVrhtjW1wLm8ncDesRQehzkbjw5x9dJYydxQ28rde/Fbb5dozNSiOO dr4uJrt0+ftp9J+QZCQttQ0qm1CpkGL9FM5v9gDASj5shoOfivyMprsm5PyJMqca5c90QU g3Oswl1D8az/2vTotlHF/IbJUtar5GzCi/2kLSi6OwJ6dw+aDIIZrBHfHG9DoJEE1/Lgop jA7+GKnzqzWzTXeRJZmexQ4BuveAXTkp1/W3UJvjY50tkPyVkyGsli0FB5pa2A== 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=1717499982; 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=AvrtYddFa/ccrk6i5qwc+KO6Cm9SbbOMCECdxKh8ncQ=; b=eaL+2f4sXi/oUtJ0TBp0KqeLYO4OsfKqCnXuA+lEHX/x2MbIfrKFHA5sNERSN418gXfjqg oR5feTZVitGJjNhCnEfRAqaQdDRZ3FVJv2FkJn3W2a/bQJAMy2L/Itlls3yISwJUeBUXKO vq7hePFEqun49fl/+CExE8y6hhyMqc650vpH0RjSX/UVzSeY8xaIxu08SOaV/grg//d2NU C5KQ4/ebCgdnDuo1MgbfTj0Bh8qpGNgeVahLQYXubkRpRkbDTXMdNHKY/BsoajZN5owL/2 4DRbEULmaN/vYvEmlCuMreLNZ1N+V4reYps0r7TcysKW+3wVmqqE0UDFhQAZ2w== 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 4Vtp5p4VyjzGNj; Tue, 4 Jun 2024 11:19:42 +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 454BJgtE077797; Tue, 4 Jun 2024 11:19:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454BJgLN077794; Tue, 4 Jun 2024 11:19:42 GMT (envelope-from git) Date: Tue, 4 Jun 2024 11:19:42 GMT Message-Id: <202406041119.454BJgLN077794@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 5080cf0846df - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 5080cf0846dff22c25358bc2db15a147866578af Auto-Submitted: auto-generated The branch stable/14 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5080cf0846dff22c25358bc2db15a147866578af commit 5080cf0846dff22c25358bc2db15a147866578af Author: Emmanuel Vadot AuthorDate: 2024-04-24 08:14:36 +0000 Commit: Emmanuel Vadot CommitDate: 2024-06-04 11:06:45 +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 (cherry picked from commit 11d79c4756b7c85faf7c4a268c301a41ce0887b9) --- .../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