public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Bob Moore <robert.moore@intel.com>
Subject: [PATCH 07/11] ACPICA: Add support for FFH Opregion special context data
Date: Thu, 27 Oct 2022 19:54:32 +0200	[thread overview]
Message-ID: <3135123.5fSG56mABF@kreacher> (raw)
In-Reply-To: <4756726.GXAFRqVoOG@kreacher>

From: Sudeep Holla <sudeep.holla@arm.com>

ACPICA commit fad527b6e76babc7527c41325bfbef6bd1a1132b

FFH(Fixed Function Hardware) Opregion is approved to be added in ACPI 6.5 via
code first approach [1]. It requires special context data similar to GPIO and
Generic Serial Bus as it needs to know platform specific offset and length.

Add support for the special context data needed by FFH Opregion.

FFH op_region enables advanced use of FFH on some architectures. For example,
it could be used to easily proxy AML code to architecture-specific behavior
(to ensure it is OS initiated)

Actual behavior of FFH is ofcourse architecture specific and depends on
the FFH bindings. The offset and length could have arch specific meaning
or usage.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3598 # [1]
Link: https://github.com/acpica/acpica/commit/fad527b6
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/evregion.c |    9 +++++++++
 drivers/acpi/acpica/exfield.c  |    8 ++++++--
 drivers/acpi/acpica/exserial.c |    6 ++++++
 include/acpi/acconfig.h        |    2 ++
 include/acpi/actypes.h         |    7 +++++++
 5 files changed, 30 insertions(+), 2 deletions(-)

Index: linux-pm/drivers/acpi/acpica/evregion.c
===================================================================
--- linux-pm.orig/drivers/acpi/acpica/evregion.c
+++ linux-pm/drivers/acpi/acpica/evregion.c
@@ -172,6 +172,15 @@ acpi_ev_address_space_dispatch(union acp
 			ctx->subspace_id = (u8)region_obj->region.address;
 		}
 
+		if (region_obj->region.space_id ==
+		    ACPI_ADR_SPACE_FIXED_HARDWARE) {
+			struct acpi_ffh_info *ctx =
+			    handler_desc->address_space.context;
+
+			ctx->length = region_obj->region.length;
+			ctx->offset = region_obj->region.address;
+		}
+
 		/*
 		 * We must exit the interpreter because the region setup will
 		 * potentially execute control methods (for example, the _REG method
Index: linux-pm/drivers/acpi/acpica/exfield.c
===================================================================
--- linux-pm.orig/drivers/acpi/acpica/exfield.c
+++ linux-pm/drivers/acpi/acpica/exfield.c
@@ -141,7 +141,9 @@ acpi_ex_read_data_from_field(struct acpi
 		    || obj_desc->field.region_obj->region.space_id ==
 		    ACPI_ADR_SPACE_IPMI
 		    || obj_desc->field.region_obj->region.space_id ==
-		    ACPI_ADR_SPACE_PLATFORM_RT)) {
+		    ACPI_ADR_SPACE_PLATFORM_RT
+		    || obj_desc->field.region_obj->region.space_id ==
+		    ACPI_ADR_SPACE_FIXED_HARDWARE)) {
 
 		/* SMBus, GSBus, IPMI serial */
 
@@ -305,7 +307,9 @@ acpi_ex_write_data_to_field(union acpi_o
 		    || obj_desc->field.region_obj->region.space_id ==
 		    ACPI_ADR_SPACE_IPMI
 		    || obj_desc->field.region_obj->region.space_id ==
-		    ACPI_ADR_SPACE_PLATFORM_RT)) {
+		    ACPI_ADR_SPACE_PLATFORM_RT
+		    || obj_desc->field.region_obj->region.space_id ==
+		    ACPI_ADR_SPACE_FIXED_HARDWARE)) {
 
 		/* SMBus, GSBus, IPMI serial */
 
Index: linux-pm/drivers/acpi/acpica/exserial.c
===================================================================
--- linux-pm.orig/drivers/acpi/acpica/exserial.c
+++ linux-pm/drivers/acpi/acpica/exserial.c
@@ -323,6 +323,12 @@ acpi_ex_write_serial_bus(union acpi_oper
 		function = ACPI_WRITE;
 		break;
 
+	case ACPI_ADR_SPACE_FIXED_HARDWARE:
+
+		buffer_length = ACPI_FFH_INPUT_BUFFER_SIZE;
+		function = ACPI_WRITE;
+		break;
+
 	default:
 		return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
 	}
Index: linux-pm/include/acpi/acconfig.h
===================================================================
--- linux-pm.orig/include/acpi/acconfig.h
+++ linux-pm/include/acpi/acconfig.h
@@ -190,6 +190,8 @@
 
 #define ACPI_PRM_INPUT_BUFFER_SIZE      26
 
+#define ACPI_FFH_INPUT_BUFFER_SIZE      256
+
 /* _sx_d and _sx_w control methods */
 
 #define ACPI_NUM_sx_d_METHODS           4
Index: linux-pm/include/acpi/actypes.h
===================================================================
--- linux-pm.orig/include/acpi/actypes.h
+++ linux-pm/include/acpi/actypes.h
@@ -1116,6 +1116,13 @@ struct acpi_pcc_info {
 	u8 *internal_buffer;
 };
 
+/* Special Context data for FFH Opregion (ACPI 6.5) */
+
+struct acpi_ffh_info {
+	u64 offset;
+	u64 length;
+};
+
 typedef
 acpi_status (*acpi_adr_space_setup) (acpi_handle region_handle,
 				     u32 function,




  parent reply	other threads:[~2022-10-27 17:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 17:45 [PATCH 00/11] ACPICA: Upstream changes since ACPICA 20220331 Rafael J. Wysocki
2022-10-27 17:47 ` [PATCH 01/11] ACPICA: MADT: Add loong_arch-specific APICs support Rafael J. Wysocki
2022-10-27 17:48 ` [PATCH 02/11] ACPICA: Events: Support fixed PCIe wake event Rafael J. Wysocki
2022-10-27 17:50 ` [PATCH 03/11] ACPICA: Check that EBDA pointer is in valid memory Rafael J. Wysocki
2022-10-27 17:50 ` [PATCH 04/11] ACPICA: Do not touch VGA memory when EBDA < 1ki_b Rafael J. Wysocki
2022-10-27 17:51 ` [PATCH 05/11] ACPICA: iASL: Add CCEL table to both compiler/disassembler Rafael J. Wysocki
2022-10-27 17:52 ` [PATCH 06/11] ACPICA: Add a couple of new UUIDs to the known UUID list Rafael J. Wysocki
2022-10-27 17:54 ` Rafael J. Wysocki [this message]
2022-10-27 17:55 ` [PATCH 08/11] ACPICA: Improve warning message for "invalid ACPI name" Rafael J. Wysocki
2022-10-27 17:56 ` [PATCH 09/11] ACPICA: Add CXL 3.0 structures (CXIMS & RDPAS) to the CEDT table Rafael J. Wysocki
2022-10-27 17:57 ` [PATCH 10/11] ACPICA: IORT: Update for revision E.e Rafael J. Wysocki
2022-10-27 17:58 ` [PATCH 11/11] ACPICA: Finish support for the CDAT table Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3135123.5fSG56mABF@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox