From: anonymix007 <48598263+anonymix007@users.noreply.github.com> Date: Tue, 5 Nov 2024 19:17:21 +0000 (+0300) Subject: boot: Add firmware_devicetree_exists() X-Git-Tag: v257-rc1~19^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c3a0a4b1f8a51f6f8f6c43e04306c2e53eaf65d;p=thirdparty%2Fsystemd.git boot: Add firmware_devicetree_exists() --- diff --git a/src/boot/efi/devicetree.c b/src/boot/efi/devicetree.c index 7e77ed6e60d..f3563f296fb 100644 --- a/src/boot/efi/devicetree.c +++ b/src/boot/efi/devicetree.c @@ -174,6 +174,10 @@ static const char* devicetree_get_compatible(const void *dtb) { return NULL; } +bool firmware_devicetree_exists(void) { + return !!find_configuration_table(MAKE_GUID_PTR(EFI_DTB_TABLE)); +} + /* This function checks if the firmware provided Devicetree * and a UKI provided Devicetree contain the same first entry * on their respective "compatible" fields (which usually defines diff --git a/src/boot/efi/devicetree.h b/src/boot/efi/devicetree.h index 44c61fff6fd..5f6720f655a 100644 --- a/src/boot/efi/devicetree.h +++ b/src/boot/efi/devicetree.h @@ -30,6 +30,7 @@ typedef struct FdtHeader { uint32_t size_dt_struct; } FdtHeader; +bool firmware_devicetree_exists(void); EFI_STATUS devicetree_match(const void *uki_dtb, size_t uki_dtb_length); EFI_STATUS devicetree_match_by_compatible(const void *uki_dtb, size_t uki_dtb_length, const char *compat); EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir, char16_t *name);