x86, efi: Abstract x86 efi_early calls
The ARM EFI boot stub doesn't need to care about the efi_early infrastructure that x86 requires in order to do mixed mode thunking. So wrap everything up in an efi_call_early() macro. This allows x86 to do the necessary indirection jumps to call whatever firmware interface is necessary (native or mixed mode), but also allows the ARM folks to mask the fact that they don't support relocation in the boot stub and need to pass 'sys_table_arg' to every function. [ hpa: there are no object code changes from this patch ] Signed-off-by: Matt Fleming <matt.fleming@intel.com> Link: http://lkml.kernel.org/r/20140326091011.GB2958@console-pimps.org Cc: Roy Franz <roy.franz@linaro.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
9a11040ff9
commit
204b0a1a4b
2 changed files with 98 additions and 101 deletions
|
@ -21,6 +21,9 @@ static efi_system_table_t *sys_table;
|
||||||
|
|
||||||
static struct efi_config *efi_early;
|
static struct efi_config *efi_early;
|
||||||
|
|
||||||
|
#define efi_call_early(f, ...) \
|
||||||
|
efi_early->call(efi_early->f, __VA_ARGS__);
|
||||||
|
|
||||||
#define BOOT_SERVICES(bits) \
|
#define BOOT_SERVICES(bits) \
|
||||||
static void setup_boot_services##bits(struct efi_config *c) \
|
static void setup_boot_services##bits(struct efi_config *c) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -78,7 +81,7 @@ __file_size32(void *__fh, efi_char16_t *filename_16,
|
||||||
}
|
}
|
||||||
|
|
||||||
grow:
|
grow:
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
info_sz, (void **)&info);
|
info_sz, (void **)&info);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to alloc mem for file info\n");
|
efi_printk(sys_table, "Failed to alloc mem for file info\n");
|
||||||
|
@ -88,12 +91,12 @@ __file_size32(void *__fh, efi_char16_t *filename_16,
|
||||||
status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
|
status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
|
||||||
&info_sz, info);
|
&info_sz, info);
|
||||||
if (status == EFI_BUFFER_TOO_SMALL) {
|
if (status == EFI_BUFFER_TOO_SMALL) {
|
||||||
efi_early->call(efi_early->free_pool, info);
|
efi_call_early(free_pool, info);
|
||||||
goto grow;
|
goto grow;
|
||||||
}
|
}
|
||||||
|
|
||||||
*file_sz = info->file_size;
|
*file_sz = info->file_size;
|
||||||
efi_early->call(efi_early->free_pool, info);
|
efi_call_early(free_pool, info);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
efi_printk(sys_table, "Failed to get initrd info\n");
|
efi_printk(sys_table, "Failed to get initrd info\n");
|
||||||
|
@ -131,7 +134,7 @@ __file_size64(void *__fh, efi_char16_t *filename_16,
|
||||||
}
|
}
|
||||||
|
|
||||||
grow:
|
grow:
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
info_sz, (void **)&info);
|
info_sz, (void **)&info);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to alloc mem for file info\n");
|
efi_printk(sys_table, "Failed to alloc mem for file info\n");
|
||||||
|
@ -141,12 +144,12 @@ __file_size64(void *__fh, efi_char16_t *filename_16,
|
||||||
status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
|
status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
|
||||||
&info_sz, info);
|
&info_sz, info);
|
||||||
if (status == EFI_BUFFER_TOO_SMALL) {
|
if (status == EFI_BUFFER_TOO_SMALL) {
|
||||||
efi_early->call(efi_early->free_pool, info);
|
efi_call_early(free_pool, info);
|
||||||
goto grow;
|
goto grow;
|
||||||
}
|
}
|
||||||
|
|
||||||
*file_sz = info->file_size;
|
*file_sz = info->file_size;
|
||||||
efi_early->call(efi_early->free_pool, info);
|
efi_call_early(free_pool, info);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
efi_printk(sys_table, "Failed to get initrd info\n");
|
efi_printk(sys_table, "Failed to get initrd info\n");
|
||||||
|
@ -204,7 +207,7 @@ static inline efi_status_t __open_volume32(void *__image, void **__fh)
|
||||||
void *handle = (void *)(unsigned long)image->device_handle;
|
void *handle = (void *)(unsigned long)image->device_handle;
|
||||||
unsigned long func;
|
unsigned long func;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, handle,
|
status = efi_call_early(handle_protocol, handle,
|
||||||
&fs_proto, (void **)&io);
|
&fs_proto, (void **)&io);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to handle fs_proto\n");
|
efi_printk(sys_table, "Failed to handle fs_proto\n");
|
||||||
|
@ -230,7 +233,7 @@ static inline efi_status_t __open_volume64(void *__image, void **__fh)
|
||||||
void *handle = (void *)(unsigned long)image->device_handle;
|
void *handle = (void *)(unsigned long)image->device_handle;
|
||||||
unsigned long func;
|
unsigned long func;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, handle,
|
status = efi_call_early(handle_protocol, handle,
|
||||||
&fs_proto, (void **)&io);
|
&fs_proto, (void **)&io);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to handle fs_proto\n");
|
efi_printk(sys_table, "Failed to handle fs_proto\n");
|
||||||
|
@ -325,9 +328,7 @@ __setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom)
|
||||||
|
|
||||||
size = pci->romsize + sizeof(*rom);
|
size = pci->romsize + sizeof(*rom);
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pool,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom);
|
||||||
EFI_LOADER_DATA, size, &rom);
|
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
@ -361,7 +362,7 @@ __setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
free_struct:
|
free_struct:
|
||||||
efi_early->call(efi_early->free_pool, rom);
|
efi_call_early(free_pool, rom);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +388,7 @@ setup_efi_pci32(struct boot_params *params, void **pci_handle,
|
||||||
struct pci_setup_rom *rom = NULL;
|
struct pci_setup_rom *rom = NULL;
|
||||||
u32 h = handles[i];
|
u32 h = handles[i];
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, h,
|
status = efi_call_early(handle_protocol, h,
|
||||||
&pci_proto, (void **)&pci);
|
&pci_proto, (void **)&pci);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
|
@ -431,9 +432,7 @@ __setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom)
|
||||||
|
|
||||||
size = pci->romsize + sizeof(*rom);
|
size = pci->romsize + sizeof(*rom);
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pool,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom);
|
||||||
EFI_LOADER_DATA, size, &rom);
|
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
@ -465,7 +464,7 @@ __setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
free_struct:
|
free_struct:
|
||||||
efi_early->call(efi_early->free_pool, rom);
|
efi_call_early(free_pool, rom);
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -492,7 +491,7 @@ setup_efi_pci64(struct boot_params *params, void **pci_handle,
|
||||||
struct pci_setup_rom *rom = NULL;
|
struct pci_setup_rom *rom = NULL;
|
||||||
u64 h = handles[i];
|
u64 h = handles[i];
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, h,
|
status = efi_call_early(handle_protocol, h,
|
||||||
&pci_proto, (void **)&pci);
|
&pci_proto, (void **)&pci);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
|
@ -524,19 +523,19 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
|
||||||
efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID;
|
efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID;
|
||||||
unsigned long size = 0;
|
unsigned long size = 0;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->locate_handle,
|
status = efi_call_early(locate_handle,
|
||||||
EFI_LOCATE_BY_PROTOCOL,
|
EFI_LOCATE_BY_PROTOCOL,
|
||||||
&pci_proto, NULL, &size, pci_handle);
|
&pci_proto, NULL, &size, pci_handle);
|
||||||
|
|
||||||
if (status == EFI_BUFFER_TOO_SMALL) {
|
if (status == EFI_BUFFER_TOO_SMALL) {
|
||||||
status = efi_early->call(efi_early->allocate_pool,
|
status = efi_call_early(allocate_pool,
|
||||||
EFI_LOADER_DATA,
|
EFI_LOADER_DATA,
|
||||||
size, (void **)&pci_handle);
|
size, (void **)&pci_handle);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->locate_handle,
|
status = efi_call_early(locate_handle,
|
||||||
EFI_LOCATE_BY_PROTOCOL, &pci_proto,
|
EFI_LOCATE_BY_PROTOCOL, &pci_proto,
|
||||||
NULL, &size, pci_handle);
|
NULL, &size, pci_handle);
|
||||||
}
|
}
|
||||||
|
@ -550,7 +549,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
|
||||||
status = setup_efi_pci32(params, pci_handle, size);
|
status = setup_efi_pci32(params, pci_handle, size);
|
||||||
|
|
||||||
free_handle:
|
free_handle:
|
||||||
efi_early->call(efi_early->free_pool, pci_handle);
|
efi_call_early(free_pool, pci_handle);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,12 +650,12 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto,
|
||||||
void *dummy = NULL;
|
void *dummy = NULL;
|
||||||
u32 h = handles[i];
|
u32 h = handles[i];
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, h,
|
status = efi_call_early(handle_protocol, h,
|
||||||
proto, (void **)&gop32);
|
proto, (void **)&gop32);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, h,
|
status = efi_call_early(handle_protocol, h,
|
||||||
&conout_proto, &dummy);
|
&conout_proto, &dummy);
|
||||||
if (status == EFI_SUCCESS)
|
if (status == EFI_SUCCESS)
|
||||||
conout_found = true;
|
conout_found = true;
|
||||||
|
@ -754,12 +753,12 @@ setup_gop64(struct screen_info *si, efi_guid_t *proto,
|
||||||
void *dummy = NULL;
|
void *dummy = NULL;
|
||||||
u64 h = handles[i];
|
u64 h = handles[i];
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, h,
|
status = efi_call_early(handle_protocol, h,
|
||||||
proto, (void **)&gop64);
|
proto, (void **)&gop64);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, h,
|
status = efi_call_early(handle_protocol, h,
|
||||||
&conout_proto, &dummy);
|
&conout_proto, &dummy);
|
||||||
if (status == EFI_SUCCESS)
|
if (status == EFI_SUCCESS)
|
||||||
conout_found = true;
|
conout_found = true;
|
||||||
|
@ -819,12 +818,12 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
|
||||||
efi_status_t status;
|
efi_status_t status;
|
||||||
void **gop_handle = NULL;
|
void **gop_handle = NULL;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
size, (void **)&gop_handle);
|
size, (void **)&gop_handle);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->locate_handle,
|
status = efi_call_early(locate_handle,
|
||||||
EFI_LOCATE_BY_PROTOCOL,
|
EFI_LOCATE_BY_PROTOCOL,
|
||||||
proto, NULL, &size, gop_handle);
|
proto, NULL, &size, gop_handle);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
|
@ -836,7 +835,7 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
|
||||||
status = setup_gop32(si, proto, size, gop_handle);
|
status = setup_gop32(si, proto, size, gop_handle);
|
||||||
|
|
||||||
free_handle:
|
free_handle:
|
||||||
efi_early->call(efi_early->free_pool, gop_handle);
|
efi_call_early(free_pool, gop_handle);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -858,13 +857,12 @@ setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height)
|
||||||
void *pciio;
|
void *pciio;
|
||||||
u32 handle = handles[i];
|
u32 handle = handles[i];
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, handle,
|
status = efi_call_early(handle_protocol, handle,
|
||||||
&uga_proto, (void **)&uga);
|
&uga_proto, (void **)&uga);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
efi_early->call(efi_early->handle_protocol, handle,
|
efi_call_early(handle_protocol, handle, &pciio_proto, &pciio);
|
||||||
&pciio_proto, &pciio);
|
|
||||||
|
|
||||||
status = efi_early->call((unsigned long)uga->get_mode, uga,
|
status = efi_early->call((unsigned long)uga->get_mode, uga,
|
||||||
&w, &h, &depth, &refresh);
|
&w, &h, &depth, &refresh);
|
||||||
|
@ -904,13 +902,12 @@ setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height)
|
||||||
void *pciio;
|
void *pciio;
|
||||||
u64 handle = handles[i];
|
u64 handle = handles[i];
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, handle,
|
status = efi_call_early(handle_protocol, handle,
|
||||||
&uga_proto, (void **)&uga);
|
&uga_proto, (void **)&uga);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
efi_early->call(efi_early->handle_protocol, handle,
|
efi_call_early(handle_protocol, handle, &pciio_proto, &pciio);
|
||||||
&pciio_proto, &pciio);
|
|
||||||
|
|
||||||
status = efi_early->call((unsigned long)uga->get_mode, uga,
|
status = efi_early->call((unsigned long)uga->get_mode, uga,
|
||||||
&w, &h, &depth, &refresh);
|
&w, &h, &depth, &refresh);
|
||||||
|
@ -942,12 +939,12 @@ static efi_status_t setup_uga(struct screen_info *si, efi_guid_t *uga_proto,
|
||||||
u32 width, height;
|
u32 width, height;
|
||||||
void **uga_handle = NULL;
|
void **uga_handle = NULL;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
size, (void **)&uga_handle);
|
size, (void **)&uga_handle);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->locate_handle,
|
status = efi_call_early(locate_handle,
|
||||||
EFI_LOCATE_BY_PROTOCOL,
|
EFI_LOCATE_BY_PROTOCOL,
|
||||||
uga_proto, NULL, &size, uga_handle);
|
uga_proto, NULL, &size, uga_handle);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
|
@ -981,7 +978,7 @@ static efi_status_t setup_uga(struct screen_info *si, efi_guid_t *uga_proto,
|
||||||
si->rsvd_pos = 24;
|
si->rsvd_pos = 24;
|
||||||
|
|
||||||
free_handle:
|
free_handle:
|
||||||
efi_early->call(efi_early->free_pool, uga_handle);
|
efi_call_early(free_pool, uga_handle);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,7 +996,7 @@ void setup_graphics(struct boot_params *boot_params)
|
||||||
memset(si, 0, sizeof(*si));
|
memset(si, 0, sizeof(*si));
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
status = efi_early->call(efi_early->locate_handle,
|
status = efi_call_early(locate_handle,
|
||||||
EFI_LOCATE_BY_PROTOCOL,
|
EFI_LOCATE_BY_PROTOCOL,
|
||||||
&graphics_proto, NULL, &size, gop_handle);
|
&graphics_proto, NULL, &size, gop_handle);
|
||||||
if (status == EFI_BUFFER_TOO_SMALL)
|
if (status == EFI_BUFFER_TOO_SMALL)
|
||||||
|
@ -1007,7 +1004,7 @@ void setup_graphics(struct boot_params *boot_params)
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
size = 0;
|
size = 0;
|
||||||
status = efi_early->call(efi_early->locate_handle,
|
status = efi_call_early(locate_handle,
|
||||||
EFI_LOCATE_BY_PROTOCOL,
|
EFI_LOCATE_BY_PROTOCOL,
|
||||||
&uga_proto, NULL, &size, uga_handle);
|
&uga_proto, NULL, &size, uga_handle);
|
||||||
if (status == EFI_BUFFER_TOO_SMALL)
|
if (status == EFI_BUFFER_TOO_SMALL)
|
||||||
|
@ -1052,7 +1049,7 @@ struct boot_params *make_boot_params(struct efi_config *c)
|
||||||
else
|
else
|
||||||
setup_boot_services32(efi_early);
|
setup_boot_services32(efi_early);
|
||||||
|
|
||||||
status = efi_early->call(efi_early->handle_protocol, handle,
|
status = efi_call_early(handle_protocol, handle,
|
||||||
&proto, (void *)&image);
|
&proto, (void *)&image);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
|
efi_printk(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
|
||||||
|
@ -1242,12 +1239,12 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
|
||||||
sizeof(struct e820entry) * nr_desc;
|
sizeof(struct e820entry) * nr_desc;
|
||||||
|
|
||||||
if (*e820ext) {
|
if (*e820ext) {
|
||||||
efi_early->call(efi_early->free_pool, *e820ext);
|
efi_call_early(free_pool, *e820ext);
|
||||||
*e820ext = NULL;
|
*e820ext = NULL;
|
||||||
*e820ext_size = 0;
|
*e820ext_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
size, (void **)e820ext);
|
size, (void **)e820ext);
|
||||||
if (status == EFI_SUCCESS)
|
if (status == EFI_SUCCESS)
|
||||||
*e820ext_size = size;
|
*e820ext_size = size;
|
||||||
|
@ -1292,7 +1289,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
goto free_mem_map;
|
goto free_mem_map;
|
||||||
|
|
||||||
efi_early->call(efi_early->free_pool, mem_map);
|
efi_call_early(free_pool, mem_map);
|
||||||
goto get_map; /* Allocated memory, get map again */
|
goto get_map; /* Allocated memory, get map again */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1311,7 +1308,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Might as well exit boot services now */
|
/* Might as well exit boot services now */
|
||||||
status = efi_early->call(efi_early->exit_boot_services, handle, key);
|
status = efi_call_early(exit_boot_services, handle, key);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
/*
|
/*
|
||||||
* ExitBootServices() will fail if any of the event
|
* ExitBootServices() will fail if any of the event
|
||||||
|
@ -1324,7 +1321,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
|
||||||
goto free_mem_map;
|
goto free_mem_map;
|
||||||
|
|
||||||
called_exit = true;
|
called_exit = true;
|
||||||
efi_early->call(efi_early->free_pool, mem_map);
|
efi_call_early(free_pool, mem_map);
|
||||||
goto get_map;
|
goto get_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1338,7 +1335,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
free_mem_map:
|
free_mem_map:
|
||||||
efi_early->call(efi_early->free_pool, mem_map);
|
efi_call_early(free_pool, mem_map);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,7 +1376,7 @@ struct boot_params *efi_main(struct efi_config *c,
|
||||||
|
|
||||||
setup_efi_pci(boot_params);
|
setup_efi_pci(boot_params);
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
sizeof(*gdt), (void **)&gdt);
|
sizeof(*gdt), (void **)&gdt);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to alloc mem for gdt structure\n");
|
efi_printk(sys_table, "Failed to alloc mem for gdt structure\n");
|
||||||
|
|
|
@ -53,22 +53,22 @@ static efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
|
||||||
* allocation which may be in a new descriptor region.
|
* allocation which may be in a new descriptor region.
|
||||||
*/
|
*/
|
||||||
*map_size += sizeof(*m);
|
*map_size += sizeof(*m);
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
*map_size, (void **)&m);
|
*map_size, (void **)&m);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
*desc_size = 0;
|
*desc_size = 0;
|
||||||
key = 0;
|
key = 0;
|
||||||
status = efi_early->call(efi_early->get_memory_map, map_size, m,
|
status = efi_call_early(get_memory_map, map_size, m,
|
||||||
&key, desc_size, &desc_version);
|
&key, desc_size, &desc_version);
|
||||||
if (status == EFI_BUFFER_TOO_SMALL) {
|
if (status == EFI_BUFFER_TOO_SMALL) {
|
||||||
efi_early->call(efi_early->free_pool, m);
|
efi_call_early(free_pool, m);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
efi_early->call(efi_early->free_pool, m);
|
efi_call_early(free_pool, m);
|
||||||
|
|
||||||
if (key_ptr && status == EFI_SUCCESS)
|
if (key_ptr && status == EFI_SUCCESS)
|
||||||
*key_ptr = key;
|
*key_ptr = key;
|
||||||
|
@ -149,7 +149,7 @@ static efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
|
||||||
if (!max_addr)
|
if (!max_addr)
|
||||||
status = EFI_NOT_FOUND;
|
status = EFI_NOT_FOUND;
|
||||||
else {
|
else {
|
||||||
status = efi_early->call(efi_early->allocate_pages,
|
status = efi_call_early(allocate_pages,
|
||||||
EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
|
EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
|
||||||
nr_pages, &max_addr);
|
nr_pages, &max_addr);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
|
@ -161,7 +161,7 @@ static efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
|
||||||
*addr = max_addr;
|
*addr = max_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
efi_early->call(efi_early->free_pool, map);
|
efi_call_early(free_pool, map);
|
||||||
fail:
|
fail:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
|
||||||
if ((start + size) > end)
|
if ((start + size) > end)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pages,
|
status = efi_call_early(allocate_pages,
|
||||||
EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
|
EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
|
||||||
nr_pages, &start);
|
nr_pages, &start);
|
||||||
if (status == EFI_SUCCESS) {
|
if (status == EFI_SUCCESS) {
|
||||||
|
@ -233,7 +233,7 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
|
||||||
if (i == map_size / desc_size)
|
if (i == map_size / desc_size)
|
||||||
status = EFI_NOT_FOUND;
|
status = EFI_NOT_FOUND;
|
||||||
|
|
||||||
efi_early->call(efi_early->free_pool, map);
|
efi_call_early(free_pool, map);
|
||||||
fail:
|
fail:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ static void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
|
nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
|
||||||
efi_early->call(efi_early->free_pages, addr, nr_pages);
|
efi_call_early(free_pages, addr, nr_pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
|
||||||
if (!nr_files)
|
if (!nr_files)
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
nr_files * sizeof(*files), (void **)&files);
|
nr_files * sizeof(*files), (void **)&files);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n");
|
efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n");
|
||||||
|
@ -413,7 +413,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
efi_early->call(efi_early->free_pool, files);
|
efi_call_early(free_pool, files);
|
||||||
|
|
||||||
*load_addr = file_addr;
|
*load_addr = file_addr;
|
||||||
*load_size = file_size_total;
|
*load_size = file_size_total;
|
||||||
|
@ -427,7 +427,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
|
||||||
for (k = j; k < i; k++)
|
for (k = j; k < i; k++)
|
||||||
efi_file_close(fh, files[k].handle);
|
efi_file_close(fh, files[k].handle);
|
||||||
free_files:
|
free_files:
|
||||||
efi_early->call(efi_early->free_pool, files);
|
efi_call_early(free_pool, files);
|
||||||
fail:
|
fail:
|
||||||
*load_addr = 0;
|
*load_addr = 0;
|
||||||
*load_size = 0;
|
*load_size = 0;
|
||||||
|
@ -473,7 +473,7 @@ static efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
|
||||||
* as possible while respecting the required alignment.
|
* as possible while respecting the required alignment.
|
||||||
*/
|
*/
|
||||||
nr_pages = round_up(alloc_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
|
nr_pages = round_up(alloc_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
|
||||||
status = efi_early->call(efi_early->allocate_pages,
|
status = efi_call_early(allocate_pages,
|
||||||
EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
|
EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
|
||||||
nr_pages, &efi_addr);
|
nr_pages, &efi_addr);
|
||||||
new_addr = efi_addr;
|
new_addr = efi_addr;
|
||||||
|
|
Loading…
Reference in a new issue