linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* access efi variables
@ 2013-09-13 15:37 Arend van Spriel
  2013-09-13 16:39 ` Arend van Spriel
       [not found] ` <52333139.6020203-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Arend van Spriel @ 2013-09-13 15:37 UTC (permalink / raw)
  To: Matt Fleming
  Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: access efi variables
  2013-09-13 15:37 access efi variables Arend van Spriel
@ 2013-09-13 16:39 ` Arend van Spriel
       [not found] ` <52333139.6020203-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Arend van Spriel @ 2013-09-13 16:39 UTC (permalink / raw)
  To: Matt Fleming; +Cc: linux-efi, linux-kernel@vger.kernel.org

On 09/13/2013 05:37 PM, Arend van Spriel wrote:
> 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.

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

> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: access efi variables
       [not found] ` <52333139.6020203-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
@ 2013-09-13 22:37   ` H. Peter Anvin
       [not found]     ` <5233939B.3020401-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2013-09-13 22:37 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Matt Fleming, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 09/13/2013 08:37 AM, Arend van Spriel wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: access efi variables
       [not found]     ` <5233939B.3020401-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
@ 2013-09-14 17:01       ` Arend van Spriel
       [not found]         ` <5234965F.3050404-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Arend van Spriel @ 2013-09-14 17:01 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Matt Fleming, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 09/14/13 00:37, H. Peter Anvin wrote:
> On 09/13/2013 08:37 AM, Arend van Spriel wrote:
>> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: access efi variables
       [not found]         ` <5234965F.3050404-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
@ 2013-09-17 15:46           ` Matt Fleming
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Fleming @ 2013-09-17 15:46 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: H. Peter Anvin, Matt Fleming, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Sat, 14 Sep, at 07:01:19PM, Arend van Spriel wrote:
> On 09/14/13 00:37, H. Peter Anvin wrote:
> >On 09/13/2013 08:37 AM, Arend van Spriel wrote:
> >>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.

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.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-17 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-13 15:37 access efi variables Arend van Spriel
2013-09-13 16:39 ` Arend van Spriel
     [not found] ` <52333139.6020203-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2013-09-13 22:37   ` H. Peter Anvin
     [not found]     ` <5233939B.3020401-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2013-09-14 17:01       ` Arend van Spriel
     [not found]         ` <5234965F.3050404-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2013-09-17 15:46           ` Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).