From nobody Sun Jul 13 19:31:10 2025 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 4bgFtR4pyzz61N0p; Sun, 13 Jul 2025 19:31:11 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bgFtQ74qQz3k1s; Sun, 13 Jul 2025 19:31:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752435071; 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=3eeUdS5pLfPIbUpQHWZK0uP3iYZkh1N+iaIf9pI9Zn0=; b=eB3b8QbwycIfkf+CIVBweHeiCkTQhzumOqMPDHP5ZEeAmv7pcM+5i/jQEJxeB3GxMr2jVq 6rNgtQX6LqQqnLXdaydVXlDeYZzMLjYpLPwHDfJlDZeT4/Qkxcs4CQJ6mVZFE2YaLm6LvZ +5Qw12x9Si7tnmRvnKU1oUba7nKneFTOvQlrCjEi+Xpjse+OuEONolWIGXRRh3aL5K+I/2 6EfgpdLWbu3i/bEcke9cqtR3UNGhGMvxbaPlEkx7vWAMfzLesFPnyVPOHoaBsAe9viqqFk hYrAWsKHON5VkKd3QAYAe0VqsOTsobRHtFnNrWRW8TKpO4ceJNdXitencRPAEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752435071; 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=3eeUdS5pLfPIbUpQHWZK0uP3iYZkh1N+iaIf9pI9Zn0=; b=cI/17J1l55PHvY07iTqUU4k2OBL9VpsLvqBVQHRQbusSmkXje5uHQo8tGHDz7I/8l+P4lk KLo8Uv3Vzo1jRaMw4cvc5D116D25KRFUb1MUjDy2NW7t5h0a84Ae5mf0svYNr/tuI4eejT mZTmurdrIoTgTCYb20B1MVxd8HFaxGPwquOpINyqlJwVv/qHzAI/HzZNtzZeTfsq52VhHF +rWMnZaCAkbyIcmnsMYOmB0Mkl1sic4NktiSaUgiJVOUkDFD4ym3qD7KUHLXmBA/i+T7w1 huwwFAFfYr9lvPyk51nJ6AzYWSmu1/BpvFqKrqSh7cBLPcllVB9SJghvcIZxFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752435071; a=rsa-sha256; cv=none; b=DnsNU0KRkk9mJEznf9ZwIEEIfKmZZKYy2eJ1A9uyHK3m6J5k3g9gK+VtT/3eruyZHuEvxv +oNw0Sm9nX/4YibEDufht5NjZwTKWQTOgobpiev2dxKqvm+sMXkpAsdyCoCOj2EJfkYQPk N4GwfOoTnZZJM0S9g6bImEctlPW2JTsV2Eiac2AXpicDgXrmlKYY7/eMYLi1Dj0+jLsJzn Fn8KFYUwtzk2Ej6tYaBZinPB8sO9h3Easllg9eQS4rOkyg5tMeQq7+hqr0pUVMaLRg/StA UiiFOjUQeeZYFWRiSwpajvKKSAmqQXvmwdYCFSpOYSj574TDmChF9VPdR6BbWA== 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 4bgFtQ5wX2z6S5; Sun, 13 Jul 2025 19:31:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56DJVAse070828; Sun, 13 Jul 2025 19:31:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56DJVAsK070825; Sun, 13 Jul 2025 19:31:10 GMT (envelope-from git) Date: Sun, 13 Jul 2025 19:31:10 GMT Message-Id: <202507131931.56DJVAsK070825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ddf9cecb559d - stable/14 - LinuxKPI: acpi: provide union [linuxkpi]_acpi_(object|buffer) 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ddf9cecb559d1504d5024648e983a46ab3136739 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ddf9cecb559d1504d5024648e983a46ab3136739 commit ddf9cecb559d1504d5024648e983a46ab3136739 Author: Bjoern A. Zeeb AuthorDate: 2025-06-15 10:38:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-13 19:25:03 +0000 LinuxKPI: acpi: provide union [linuxkpi]_acpi_(object|buffer) Provide union acpi_(object|buffer) as linuxkpi_ versions and in Linux native lower case spelling so that driver code compiles unmodified. Use the linuxkpi_ prefix to avoid name clashes with the native ACPI implementation which uses CamelCase. Use the linuxkpi_ names internally and redefine the linuxkpi_ unions to their native names so they are avail as expected in drivers. As a transition to not break drm-kmod which has in-place (no #ifdef) changes from Linux spelling ot FreeBSD spelling, introduce LINUXKPI_WANT_LINUX_ACPI so we have the Linux spelling as an opt-in. That way the transition can happen gracefully and once "top-of-trees" are all sorted we can remove the #ifdefs here again. Bump __FreeBSD_version to be able to detect this change. Sponsored by: The FreeBSD Foundation Reviewed by: wulf (previous version), dumbbell Differential Revision: https://reviews.freebsd.org/D50863 (cherry picked from commit 2ddfcc013c251f13c8c9b24970b8134ddd49afea) --- sys/compat/linuxkpi/common/include/acpi/acpi.h | 76 ++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/acpi/acpi.h b/sys/compat/linuxkpi/common/include/acpi/acpi.h index e0218bdde12e..1e398d05ba20 100644 --- a/sys/compat/linuxkpi/common/include/acpi/acpi.h +++ b/sys/compat/linuxkpi/common/include/acpi/acpi.h @@ -3,6 +3,10 @@ * * Copyright (c) 2017 Mark Johnston * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2025 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -30,6 +34,13 @@ #ifndef _LINUXKPI_ACPI_ACPI_H_ #define _LINUXKPI_ACPI_ACPI_H_ +/* + * LINUXKPI_WANT_LINUX_ACPI is a temporary workaround to allow drm-kmod + * to update all needed branches without breaking builds. + * Once that happened and checks are implemented based on __FreeBSD_verison + * we will remove these conditions again. + */ + /* * FreeBSD import of ACPICA has a typedef for BOOLEAN which conflicts with * amdgpu driver. Workaround it on preprocessor level. @@ -46,8 +57,8 @@ typedef int64_t INT64; #include #undef BOOLEAN +typedef ACPI_IO_ADDRESS acpi_io_address; typedef ACPI_HANDLE acpi_handle; -typedef ACPI_OBJECT acpi_object; typedef ACPI_OBJECT_HANDLER acpi_object_handler; typedef ACPI_OBJECT_TYPE acpi_object_type; typedef ACPI_STATUS acpi_status; @@ -55,12 +66,62 @@ typedef ACPI_STRING acpi_string; typedef ACPI_SIZE acpi_size; typedef ACPI_WALK_CALLBACK acpi_walk_callback; +union linuxkpi_acpi_object { + acpi_object_type type; + struct { + acpi_object_type type; + UINT64 value; + } integer; + struct { + acpi_object_type type; + UINT32 length; + char *pointer; + } string; + struct { + acpi_object_type type; + UINT32 length; + UINT8 *pointer; + } buffer; + struct { + acpi_object_type type; + UINT32 count; + union linuxkpi_acpi_object *elements; + } package; + struct { + acpi_object_type type; + acpi_object_type actual_type; + acpi_handle handle; + } reference; + struct { + acpi_object_type type; + UINT32 proc_id; + acpi_io_address pblk_address; + UINT32 pblk_length; + } processor; + struct { + acpi_object_type type; + UINT32 system_level; + UINT32 resource_order; + } power_resource; +}; + +#ifdef LINUXKPI_WANT_LINUX_ACPI +struct linuxkpi_acpi_buffer { + acpi_size length; /* Length in bytes of the buffer */ + void *pointer; /* pointer to buffer */ +}; + +typedef struct linuxkpi_acpi_buffer lkpi_acpi_buffer_t; +#else +typedef ACPI_BUFFER lkpi_acpi_buffer_t; +#endif + static inline ACPI_STATUS acpi_evaluate_object(ACPI_HANDLE Object, ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ParameterObjects, ACPI_BUFFER *ReturnObjectBuffer) + ACPI_OBJECT_LIST *ParameterObjects, lkpi_acpi_buffer_t *ReturnObjectBuffer) { return (AcpiEvaluateObject( - Object, Pathname, ParameterObjects, ReturnObjectBuffer)); + Object, Pathname, ParameterObjects, (ACPI_BUFFER *)ReturnObjectBuffer)); } static inline const char * @@ -83,9 +144,9 @@ acpi_get_data(ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, void **Data) } static inline ACPI_STATUS -acpi_get_name(ACPI_HANDLE Object, UINT32 NameType, ACPI_BUFFER *RetPathPtr) +acpi_get_name(ACPI_HANDLE Object, UINT32 NameType, lkpi_acpi_buffer_t *RetPathPtr) { - return (AcpiGetName(Object, NameType, RetPathPtr)); + return (AcpiGetName(Object, NameType, (ACPI_BUFFER *)RetPathPtr)); } static inline ACPI_STATUS @@ -101,4 +162,9 @@ acpi_put_table(ACPI_TABLE_HEADER *Table) AcpiPutTable(Table); } +#ifdef LINUXKPI_WANT_LINUX_ACPI +#define acpi_object linuxkpi_acpi_object +#define acpi_buffer linuxkpi_acpi_buffer +#endif + #endif /* _LINUXKPI_ACPI_ACPI_H_ */