I am working on Linux UEFI .I want to access the efi variables through my driver code. Currently I'm looking linux/efi.h API like efi.get_variable(). but I'm not getting how to call those APIs with from my driver code.
struct efi efi1;
efi_init();
efi_char16_t *name = (efi_char16_t *)"Boot001";
efi_guid_t *vendor = (efi_guid_t *)"8be4df61-93ca-11d2-aa0d-00e098032b8c";
u32 *attr = (u32 *)0x7;
unsigned long data_size = 1024;
void *data = NULL;
printk("\n Showing efi info \n");
stat = efi1.get_variable(name,vendor,attr,&data_size,data);
with this code I'm getting NULL value for data. So can you suggest what should I do? or any modification?
Try rewriting the code to something like this (beware, it's not tested):