Skip to contentSkip to conversation

access efi variables

DISCUSSION Arend van Spriel 3 participants 5 messages Sep 13, 2013 – Sep 17, 2013 EFI

lore
Share & tools
lore
#0 lore raw

I need to obtain a uefi variable so I went looking at the API in include/linux/efi.h. I found the following definition:

/*
* The maximum size of VariableName + Data = 1024
* Therefore, it's reasonable to save that much
* space in each part of the structure,
* and we use a page for reading/writing.
*/

struct efi_variable {
	efi_char16_t  VariableName[1024/sizeof(efi_char16_t)];
	efi_guid_t    VendorGuid;
	unsigned long DataSize;
	__u8          Data[1024];
	efi_status_t  Status;
	__u32         Attributes;
} __attribute__((packed));

But according to the specs the variable I need to obtain is 2k bytes. Should I expect trouble :-p

Regards,
Arend

#1 lore raw
Quoted 19 lines · Arend van Spriel

I need to obtain a uefi variable so I went looking at the API in include/linux/efi.h. I found the following definition:

/*
* The maximum size of VariableName + Data = 1024
* Therefore, it's reasonable to save that much
* space in each part of the structure,
* and we use a page for reading/writing. */

struct efi_variable {
     efi_char16_t  VariableName[1024/sizeof(efi_char16_t)];
     efi_guid_t    VendorGuid;
     unsigned long DataSize;
     __u8          Data[1024];
     efi_status_t  Status;
     __u32         Attributes;
} __attribute__((packed));
Quoted 1 line

But according to the specs the variable I need to obtain is 2k bytes.

Maybe clarify that "the specs" is basically the feature information I received internally here.

Quoted 11 lines

Should I expect trouble :-p

Regards,
Arend

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Arend van Spriel
Quoted 6 lines · Arend van Spriel

I need to obtain a uefi variable so I went looking at the API in include/linux/efi.h. I found the following definition:

But according to the specs the variable I need to obtain is 2k bytes. Should I expect trouble :-p

efivarfs doesn't have those limitations.

-hpa

#3 lore raw
Quoted 9 lines · H. Peter Anvin
Quoted 6 lines · Arend van Spriel

I need to obtain a uefi variable so I went looking at the API in include/linux/efi.h. I found the following definition:

But according to the specs the variable I need to obtain is 2k bytes. Should I expect trouble :-p

efivarfs doesn't have those limitations.

Thanks, Peter

Looking into efivarfs it seems to use the functions that I looked at in efi.h so I guess I am misinterpreting the 1024 bytes limitation in the comment (either that or you are mistaken ;-) ). I need to access the variable from within a device driver so using efivarfs does not feel like the way to go here.

Regards,
Arend

#4 lore raw
Quoted 11 lines · Arend van Spriel
Quoted 9 lines · H. Peter Anvin
Quoted 6 lines · Arend van Spriel

I need to obtain a uefi variable so I went looking at the API in include/linux/efi.h. I found the following definition:

But according to the specs the variable I need to obtain is 2k bytes. Should I expect trouble :-p

efivarfs doesn't have those limitations.

Quoted 7 lines

Thanks, Peter

Looking into efivarfs it seems to use the functions that I looked at in efi.h so I guess I am misinterpreting the 1024 bytes limitation in the comment (either that or you are mistaken ;-) ). I need to access the variable from within a device driver so using efivarfs does not feel like the way to go here.

Look at how efivarfs_file_read() is implemented, e.g. using efivar_entry_get(). In particular, note how it kmalloc()'s a buffer for reading the variable data into, thereby avoiding any 1024-byte limitation.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center