Shuo Liu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/82133?usp=email )
Change subject: soc/intel/xeon_sp: Use pre-processor to define ASL handler names ......................................................................
soc/intel/xeon_sp: Use pre-processor to define ASL handler names
ASL handler name is 4-byte length ACPI name in the scope of _SB which is not quite human readable easy to be mixed with other methods under _SB.
Use pre-processor to define human readable handler names so that they are well managed in _SB scope.
As to the parameter count of the ASL handler, which is limited to 8 by ACPI specification. It is encouraged to use up the Arg0-7 first. If the need argument exceeds 8, the last Arg (Arg7) could be passed as a package of more parameters, which could be extracted into unused local variables in the ASL handler codes.
Here is example,
ASL caller:
acpigen_write_return_namestr(ASL_HANDLER_PATH(AH_XXX)); /* passing the 1st-7th arg */ ... /* the 8th arg is a package, e.g. len = 3 */ acpigen_write_package(3); acpigen_write_integer(...); acpigen_write_integer(...); acpigen_write_integer(...); acpigen_write_package_end();
ASL callee:
Local0 = DeRefOf(Arg7[0]) Local1 = DeRefOf(Arg7[1]) Local2 = DeRefOf(Arg7[2])
TEST=Build and boot on intel/archercity CRB
Change-Id: I4134b275143d4f52622b864ed202252b2a150dae Signed-off-by: Shuo Liu shuo.liu@intel.com --- M src/soc/intel/xeon_sp/acpi.c M src/soc/intel/xeon_sp/acpi/iiostack.asl A src/soc/intel/xeon_sp/include/soc/asl_handler.h 3 files changed, 23 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/82133/1
diff --git a/src/soc/intel/xeon_sp/acpi.c b/src/soc/intel/xeon_sp/acpi.c index b513d25..7f04588 100644 --- a/src/soc/intel/xeon_sp/acpi.c +++ b/src/soc/intel/xeon_sp/acpi.c @@ -3,6 +3,7 @@ #include <acpi/acpigen.h> #include <assert.h> #include <intelblocks/acpi.h> +#include <soc/asl_handler.h> #include <soc/chip_common.h> #include <soc/pci_devs.h> #include <soc/util.h> @@ -127,7 +128,7 @@ { acpigen_write_method("_OSC", 4);
- acpigen_write_return_namestr("\_SB.POSC"); + acpigen_write_return_namestr(ASL_HANDLER_PATH(AH_PCIE_OSC)); acpigen_emit_byte(ARG0_OP); acpigen_emit_byte(ARG1_OP); acpigen_emit_byte(ARG2_OP); diff --git a/src/soc/intel/xeon_sp/acpi/iiostack.asl b/src/soc/intel/xeon_sp/acpi/iiostack.asl index c943dd5..7cd8848 100644 --- a/src/soc/intel/xeon_sp/acpi/iiostack.asl +++ b/src/soc/intel/xeon_sp/acpi/iiostack.asl @@ -1,5 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <soc/asl_handler.h> + #define PCI_HOST_BRIDGE_OSC_UUID "33db4d5b-1ff7-401c-9657-7441c03dd766" #define CXL_HOST_BRIDGE_OSC_UUID "68f2d50b-c469-4d8a-bd3d-941a103fd3fc"
@@ -16,7 +18,7 @@ Scope (_SB) { /* - * _SB.POSC - OSC handler for PCIe _OSC calls + * AH_PCIE_OSC - ASL handler for PCIe _OSC calls * * Reference: * 6.2.11 in https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/06_Device_Configuration/Device... @@ -30,9 +32,9 @@ * Arg1 - Map to _OSC Arg1. An Integer containing a Revision ID of the buffer format * Arg2 - Map to _OSC Arg2. An Integer containing a count of entries in Arg3 * Arg3 - Map to _OSC Arg3. A Buffer containing a list of DWORD capabilities - * Arg4 - GrantedPCIeFeatures - * Arg5 - IsCxlDomain - * Arg6 - GrantedCxlFeatures + * Arg4 - Extra parameter. GrantedPCIeFeatures + * Arg5 - Extra parameter. IsCxlDomain + * Arg6 - Extra parameter. GrantedCxlFeatures * * _OSC ASL Return Value: * A Buffer containing a list of capabilities @@ -59,9 +61,8 @@ * OTRC - Dword Local7 0x10 CXL Features that OS requests for control */
- Method (POSC, 7, NotSerialized) + Method (AH_PCIE_OSC, 7, NotSerialized) { - #define OscArg0 Arg0 #define OscArg1 Arg1 #define OscArg2 Arg2 diff --git a/src/soc/intel/xeon_sp/include/soc/asl_handler.h b/src/soc/intel/xeon_sp/include/soc/asl_handler.h new file mode 100644 index 0000000..ec90830 --- /dev/null +++ b/src/soc/intel/xeon_sp/include/soc/asl_handler.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _SOC_ASL_HANDLER_H_ +#define _SOC_ASL_HANDLER_H_ + +#define _TO_STR(name) #name +#define TO_STR(name) _TO_STR(name) +#define _ASL_HANDLER_PATH(scope, name) TO_STR(scope.name) +#define ASL_HANDLER_PATH(name) _ASL_HANDLER_PATH(\_SB, name) + +/* ASL handler name list */ +#define AH_PCIE_OSC H000 + +#endif /* _SOC_ASL_HANDLER_H_ */