Re: git: 74704a26bc2c - main - efi: Create a define for memory descriptor version

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Fri, 26 Aug 2022 17:44:56 UTC
On 26 Aug 2022, at 18:41, Warner Losh <imp@FreeBSD.org> wrote:
> 
> The branch main has been updated by imp:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=74704a26bc2cfc72de6821d29a1f53b9d8c65f55
> 
> commit 74704a26bc2cfc72de6821d29a1f53b9d8c65f55
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2022-08-26 17:39:37 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2022-08-26 17:40:42 +0000
> 
>    efi: Create a define for memory descriptor version
> 
>    For true EFI platforms, the EFI BIOS will return version 1 (since no
>    other version is defined as of this commit). However, for environments
>    that wish to create an EFI memory mapping table that aren't actually
>    EFI, we need to know this. Add EFI_MEMORY_DESCRIPTOR_VERSION for this
>    constant.

Should such environments not be hard-coding version 1? Otherwise you
risk starting to silently create version 2 structures in the future if
this is bumped, but initialised as if they were version 1, which could
mean leaving some new fields uninitialised.

Jess

>    Sponsored by:           Netflix
> ---
> sys/sys/efi.h | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/sys/sys/efi.h b/sys/sys/efi.h
> index 6ace7dd6e523..f5dc15ae418f 100644
> --- a/sys/sys/efi.h
> +++ b/sys/sys/efi.h
> @@ -59,6 +59,8 @@ struct efi_cfgtbl {
> 	void		*ct_data;
> };
> 
> +#define EFI_MEMORY_DESCRIPTOR_VERSION 1
> +
> struct efi_md {
> 	uint32_t	md_type;
> #define	EFI_MD_TYPE_NULL	0