Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/23574
Change subject: soc/amd/stoneyridge/acpi/sb_pci0_fch.asl: Fix guarded code ......................................................................
soc/amd/stoneyridge/acpi/sb_pci0_fch.asl: Fix guarded code
Remove #if statements and replace them with if(IS_ENABLED(...)) per coreboot recommendations. The if conditional on CONFIG_ACPI_ENABLE_THERMAL_ZONE will be moved to procedure ITZE() inside AmdImc.asl.
BUG=b:62200858 TEST=Build kahlee.
Change-Id: I3a518e4b76a5124d4b860d03d33878d145d0c1de Signed-off-by: Richard Spiegel richard.spiegel@silverbackltd.com --- M src/soc/amd/stoneyridge/acpi/AmdImc.asl M src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl 2 files changed, 37 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/23574/1
diff --git a/src/soc/amd/stoneyridge/acpi/AmdImc.asl b/src/soc/amd/stoneyridge/acpi/AmdImc.asl index 519b05c..8fcdb54 100644 --- a/src/soc/amd/stoneyridge/acpi/AmdImc.asl +++ b/src/soc/amd/stoneyridge/acpi/AmdImc.asl @@ -1,7 +1,7 @@ /* * This file is part of the coreboot project. * - * Copyright (C) 2015 Advanced Micro Devices, Inc. + * Copyright (C) 2015-2018 Advanced Micro Devices, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,33 +32,38 @@
Method(WACK, 0) { - Store(0, Local0) - While (LNotEqual(Local0, 0xFA)) { - Store(MRG0, Local0) - Sleep(10) + if (IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM)) { + Store(0, Local0) + While (LNotEqual(Local0, 0xFA)) { + Store(MRG0, Local0) + Sleep(10) + } } }
//Init Method (ITZE, 0) { - Store(0, MRG0) - Store(0xB5, MRG1) - Store(0, MRG2) - Store(0x96, MSTI) - WACK() + if (LAnd(IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM), + IS_ENABLED(CONFIG_ACPI_ENABLE_THERMAL_ZONE))) { + Store(0, MRG0) + Store(0xB5, MRG1) + Store(0, MRG2) + Store(0x96, MSTI) + WACK()
- Store(0, MRG0) - Store(0, MRG1) - Store(0, MRG2) - Store(0x80, MSTI) - WACK() + Store(0, MRG0) + Store(0, MRG1) + Store(0, MRG2) + Store(0x80, MSTI) + WACK()
- Or(MRG2, 0x01, Local0) + Or(MRG2, 0x01, Local0)
- Store(0, MRG0) - Store(0, MRG1) - Store(Local0, MRG2) - Store(0x81, MSTI) - WACK() + Store(0, MRG0) + Store(0, MRG1) + Store(Local0, MRG2) + Store(0x81, MSTI) + WACK() + } } diff --git a/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl b/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl index ad7326c..af9323c 100644 --- a/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl +++ b/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl @@ -1,7 +1,7 @@ /* * This file is part of the coreboot project. * - * Copyright (C) 2011 Advanced Micro Devices, Inc. + * Copyright (C) 2011-2018 Advanced Micro Devices, Inc. * Copyright (C) 2013 Sage Electronic Engineering, LLC * * This program is free software; you can redistribute it and/or modify @@ -130,9 +130,13 @@ Return(CRES) /* note to change the Name buffer */ } /* end of Method(_SB.PCI0._CRS) */
-#if IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM) - #include "acpi/AmdImc.asl" -#endif +/* + * You can't use if (IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM)) outside a + * method, thus the file has to be permanently included and the + * if (IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM)) moved to every method + * within the file. + */ +#include "acpi/AmdImc.asl"
/* * @@ -159,17 +163,9 @@ /* Determine the OS we're running on */ OSFL()
-/* - * This is an ugly temporary construction part of a group of commits that - * will remove all #if from ASL files. This message plus this temporary - * construction will be removed in next commit from the series, its sole - * purpose to facilitate next commit. - */ -#if IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM) -#if IS_ENABLED(CONFIG_ACPI_ENABLE_THERMAL_ZONE) - ITZE() /* enable IMC Fan Control*/ -#endif -#endif + if (IS_ENABLED(CONFIG_STONEYRIDGE_IMC_FWM)) { + ITZE() /* enable IMC Fan Control*/ + } } /* End Method(_SB._INI) */
Method(OSFL, 0){