ACK: [PATCH 2/3] fwts_firmware: Rework Devicetree firmware detection
ivanhu
ivan.hu at canonical.com
Tue Sep 7 08:08:43 UTC 2021
On 8/25/21 11:27 PM, Rob Herring wrote:
> Currently, ACPI is assumed for UEFI based systems, but Arm based UEFI
> systems may use ACPI or DT for hardware description. It's also possible
> to have DT without UEFI or OPAL such as non-UEFI u-boot.
>
> Rework the feature detection to ignore the firmware type and just check
> sysfs. As Arm systems always have a DT for boot parameters even with
> ACPI, check for ACPI firmware first.
>
> Signed-off-by: Rob Herring <robh at kernel.org>
> ---
> src/lib/src/fwts_firmware.c | 21 +++++++--------------
> 1 file changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c
> index ba0b939c09ba..b249f00a9917 100644
> --- a/src/lib/src/fwts_firmware.c
> +++ b/src/lib/src/fwts_firmware.c
> @@ -54,22 +54,15 @@ fwts_firmware_type fwts_firmware_detect(void)
> int fwts_firmware_features(void)
> {
> int features = 0;
> - struct stat ipmi_statbuf;
> -
> - switch (fwts_firmware_detect()) {
> - case FWTS_FIRMWARE_BIOS:
> - case FWTS_FIRMWARE_UEFI:
> - features = FWTS_FW_FEATURE_ACPI;
> - break;
> - case FWTS_FIRMWARE_OPAL:
> - features = FWTS_FW_FEATURE_DEVICETREE;
> - break;
> - default:
> - break;
> - }
> + struct stat statbuf;
> +
> + if (!stat("/sys/firmware/acpi", &statbuf))
> + features |= FWTS_FW_FEATURE_ACPI;
> + else if (!stat("/sys/firmware/devicetree/base", &statbuf))
> + features |= FWTS_FW_FEATURE_DEVICETREE;
>
> /* just check for IPMI device presence */
> - if (!stat("/dev/ipmi0", &ipmi_statbuf))
> + if (!stat("/dev/ipmi0", &statbuf))
> features |= FWTS_FW_FEATURE_IPMI;
>
> return features;
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list