mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
stand: Rename EFI_ERROR_CODE to DECODE_ERROR to avoid Edk2 Clash
This follows what Illumos has done. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D53656
This commit is contained in:
parent
1390bba42c
commit
87795c6e95
18 changed files with 40 additions and 40 deletions
|
|
@ -118,7 +118,7 @@ try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t load
|
|||
if ((status = BS->LoadImage(TRUE, IH, efi_devpath_last_node(dev->devpath),
|
||||
loaderbuf, loadersize, &loaderhandle)) != EFI_SUCCESS) {
|
||||
printf("Failed to load image provided by %s, size: %zu, (%lu)\n",
|
||||
mod->name, loadersize, EFI_ERROR_CODE(status));
|
||||
mod->name, loadersize, DECODE_ERROR(status));
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t load
|
|||
(void **)&loaded_image);
|
||||
if (status != EFI_SUCCESS) {
|
||||
printf("Failed to query LoadedImage provided by %s (%lu)\n",
|
||||
mod->name, EFI_ERROR_CODE(status));
|
||||
mod->name, DECODE_ERROR(status));
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t load
|
|||
if ((status = BS->StartImage(loaderhandle, NULL, NULL)) !=
|
||||
EFI_SUCCESS) {
|
||||
printf("Failed to start image provided by %s (%lu)\n",
|
||||
mod->name, EFI_ERROR_CODE(status));
|
||||
mod->name, DECODE_ERROR(status));
|
||||
loaded_image->LoadOptionsSize = 0;
|
||||
loaded_image->LoadOptions = NULL;
|
||||
}
|
||||
|
|
@ -254,7 +254,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
|
|||
&DevicePathGUID, (void **)&imgpath);
|
||||
if (status != EFI_SUCCESS) {
|
||||
DPRINTF("Failed to get image DevicePath (%lu)\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
} else {
|
||||
text = efi_devpath_name(imgpath);
|
||||
if (text != NULL) {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath)
|
|||
|
||||
if (status != EFI_SUCCESS) {
|
||||
DPRINTF("\nFailed to query DevicePath (%lu)\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (-1);
|
||||
}
|
||||
#ifdef EFI_DEBUG
|
||||
|
|
@ -84,7 +84,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath)
|
|||
|
||||
if (status != EFI_SUCCESS) {
|
||||
DPRINTF("\nFailed to query BlockIoProtocol (%lu)\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ dskread(void *buf, uint64_t lba, int nblk)
|
|||
DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, "
|
||||
"status: %lu\n", devinfo->dev,
|
||||
devinfo->dev->Media->MediaId, (uintmax_t)lba, size,
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ error:
|
|||
DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %ju, size: %zu,"
|
||||
" rb_size: %zu, status: %lu\n", devinfo->dev,
|
||||
devinfo->dev->Media->MediaId, (uintmax_t)lba, bytes, rb_size,
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk)
|
|||
DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, "
|
||||
"status: %lu\n", devinfo->dev,
|
||||
dev->Media->MediaId, (uintmax_t)lba, size,
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk)
|
|||
DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, "
|
||||
"status: %lu\n", devinfo->dev,
|
||||
dev->Media->MediaId, (uintmax_t)lba, size,
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Revision History
|
|||
|
||||
#define EFIWARN(a) (a)
|
||||
#define EFI_ERROR(a) (((INTN) a) < 0)
|
||||
#define EFI_ERROR_CODE(a) (unsigned long)(a & ~EFI_ERROR_MASK)
|
||||
#define DECODE_ERROR(a) (unsigned long)(a & ~EFI_ERROR_MASK)
|
||||
|
||||
|
||||
#define EFI_SUCCESS 0
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ efi_close_devpath(EFI_HANDLE handle)
|
|||
|
||||
status = BS->CloseProtocol(handle, &DevicePathGUID, IH, NULL);
|
||||
if (EFI_ERROR(status))
|
||||
printf("CloseProtocol error: %lu\n", EFI_ERROR_CODE(status));
|
||||
printf("CloseProtocol error: %lu\n", DECODE_ERROR(status));
|
||||
}
|
||||
|
||||
static char *
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ install_driver(EFI_DRIVER_BINDING *driver)
|
|||
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("Failed to install driver (%ld)!\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
}
|
||||
|
||||
return (status);
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ comc_port_set(struct env_var *ev, int flags, const void *value)
|
|||
(void**)&sio, IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("OpenProtocol: %lu\n", EFI_ERROR_CODE(status));
|
||||
printf("OpenProtocol: %lu\n", DECODE_ERROR(status));
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ efinet_probe(struct netif *nif, void *machdep_hint)
|
|||
if (status != EFI_SUCCESS) {
|
||||
printf("Unable to open network interface %d for "
|
||||
"exclusive access: %lu\n", nif->nif_unit,
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (efi_status_to_errno(status));
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
|
|||
status = OpenProtocolByHandle(h, &sn_guid, (void **)&nif->nif_devdata);
|
||||
if (status != EFI_SUCCESS) {
|
||||
printf("net%d: cannot fetch interface data (status=%lu)\n",
|
||||
nif->nif_unit, EFI_ERROR_CODE(status));
|
||||
nif->nif_unit, DECODE_ERROR(status));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
|
|||
status = net->Start(net);
|
||||
if (status != EFI_SUCCESS) {
|
||||
printf("net%d: cannot start interface (status=%lu)\n",
|
||||
nif->nif_unit, EFI_ERROR_CODE(status));
|
||||
nif->nif_unit, DECODE_ERROR(status));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
|
|||
status = net->Initialize(net, 0, 0);
|
||||
if (status != EFI_SUCCESS) {
|
||||
printf("net%d: cannot init. interface (status=%lu)\n",
|
||||
nif->nif_unit, EFI_ERROR_CODE(status));
|
||||
nif->nif_unit, DECODE_ERROR(status));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
|
|||
status = net->ReceiveFilters(net, mask, 0, FALSE, 0, NULL);
|
||||
if (status != EFI_SUCCESS)
|
||||
printf("net%d: cannot set rx. filters (status=%lu)\n",
|
||||
nif->nif_unit, EFI_ERROR_CODE(status));
|
||||
nif->nif_unit, DECODE_ERROR(status));
|
||||
|
||||
#ifdef EFINET_DEBUG
|
||||
dump_mode(net->Mode);
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ efipart_inithandles(void)
|
|||
status = OpenProtocolByHandle(hin[i], &blkio_guid,
|
||||
(void **)&blkio);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("error %lu\n", EFI_ERROR_CODE(status));
|
||||
printf("error %lu\n", DECODE_ERROR(status));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1033,7 +1033,7 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, int rw, daddr_t blk, daddr_t nblks,
|
|||
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("%s: rw=%d, blk=%ju size=%ju status=%lu\n", __func__, rw,
|
||||
blk, nblks, EFI_ERROR_CODE(status));
|
||||
blk, nblks, DECODE_ERROR(status));
|
||||
}
|
||||
TSEXIT();
|
||||
return (efi_status_to_errno(status));
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag)
|
|||
status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, NULL);
|
||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
printf("Can't get the variable: error %#lx\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
data = malloc(datasz);
|
||||
|
|
@ -691,7 +691,7 @@ efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag)
|
|||
status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, data);
|
||||
if (status != EFI_SUCCESS) {
|
||||
printf("Can't get the variable: error %#lx\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
free(data);
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
|
|
@ -954,7 +954,7 @@ command_efi_set(int argc, char *argv[])
|
|||
strlen(val) + 1, val);
|
||||
if (EFI_ERROR(err)) {
|
||||
printf("Failed to set variable: error %lu\n",
|
||||
EFI_ERROR_CODE(err));
|
||||
DECODE_ERROR(err));
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
#else
|
||||
|
|
@ -990,7 +990,7 @@ command_efi_unset(int argc, char *argv[])
|
|||
err = RS->SetVariable(wvar, &guid, 0, 0, NULL);
|
||||
if (EFI_ERROR(err)) {
|
||||
printf("Failed to unset variable: error %lu\n",
|
||||
EFI_ERROR_CODE(err));
|
||||
DECODE_ERROR(err));
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ exec(struct preloaded_file *fp)
|
|||
EFI_SIZE_TO_PAGES(PAGE_SIZE), &addr);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("Failed to allocate pages for multiboot2 header: %lu\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
error = ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
|
@ -351,7 +351,7 @@ exec(struct preloaded_file *fp)
|
|||
EFI_SIZE_TO_PAGES(128 * 1024), &stack);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("Failed to allocate pages for Xen stack: %lu\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
error = ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ efi_setup_tss(struct region_descriptor *gdt, uint32_t loader_tss_idx,
|
|||
EFI_SIZE_TO_PAGES(sizeof(struct amd64tss)), &tss_pa);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("efi_setup_tss: AllocatePages tss error %lu\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (0);
|
||||
}
|
||||
*tss = (struct amd64tss *)tss_pa;
|
||||
|
|
@ -251,7 +251,7 @@ efi_redirect_exceptions(void)
|
|||
EFI_SIZE_TO_PAGES(fw_idt.rd_limit), &lidt_pa);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("efi_redirect_exceptions: AllocatePages IDT error %lu\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
lidt_pa = 0;
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ efi_redirect_exceptions(void)
|
|||
&exc_stack_pa);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("efi_redirect_exceptions: AllocatePages stk error %lu\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
exc_stack_pa = 0;
|
||||
free_tables();
|
||||
return (0);
|
||||
|
|
@ -303,7 +303,7 @@ efi_redirect_exceptions(void)
|
|||
&loader_gdt_pa);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("efi_setup_tss: AllocatePages gdt error "
|
||||
"%lu\n", EFI_ERROR_CODE(status));
|
||||
"%lu\n", DECODE_ERROR(status));
|
||||
loader_gdt_pa = 0;
|
||||
free_tables();
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs)
|
|||
|
||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
printf("%s: GetMemoryMap error %lu\n", __func__,
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs)
|
|||
pages, &addr);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("%s: AllocatePages error %lu\n", __func__,
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs)
|
|||
|
||||
if (retry == 0) {
|
||||
BS->FreePages(addr, pages);
|
||||
printf("ExitBootServices error %lu\n", EFI_ERROR_CODE(status));
|
||||
printf("ExitBootServices error %lu\n", DECODE_ERROR(status));
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ efi_verify_staging_size(unsigned long *nr_pages)
|
|||
|
||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
printf("Can't read memory map: %lu\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ efi_copy_init(void)
|
|||
nr_pages, &staging);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("failed to allocate staging area: %lu\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
DECODE_ERROR(status));
|
||||
return (status);
|
||||
}
|
||||
staging_base = staging;
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOCOL *uga, u_int line,
|
|||
printf("No change detected in frame buffer");
|
||||
|
||||
fail:
|
||||
printf(" -- error %lu\n", EFI_ERROR_CODE(status));
|
||||
printf(" -- error %lu\n", DECODE_ERROR(status));
|
||||
free(data1);
|
||||
return (-1);
|
||||
}
|
||||
|
|
@ -781,7 +781,7 @@ gop_autoresize(void)
|
|||
if (EFI_ERROR(status)) {
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"gop_autoresize: Unable to set mode to %u (error=%lu)",
|
||||
mode, EFI_ERROR_CODE(status));
|
||||
mode, DECODE_ERROR(status));
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
(void) cons_update_mode(true);
|
||||
|
|
@ -884,7 +884,7 @@ command_gop(int argc, char *argv[])
|
|||
if (EFI_ERROR(status)) {
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"%s: Unable to set mode to %u (error=%lu)",
|
||||
argv[0], mode, EFI_ERROR_CODE(status));
|
||||
argv[0], mode, DECODE_ERROR(status));
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
(void) cons_update_mode(true);
|
||||
|
|
|
|||
|
|
@ -1936,7 +1936,7 @@ command_chain(int argc, char *argv[])
|
|||
|
||||
status = BS->StartImage(loaderhandle, &ExitDataSize, &ExitData);
|
||||
if (status != EFI_SUCCESS) {
|
||||
printf("StartImage failed (%lu)", EFI_ERROR_CODE(status));
|
||||
printf("StartImage failed (%lu)", DECODE_ERROR(status));
|
||||
if (ExitData != NULL) {
|
||||
printf(": %S", ExitData);
|
||||
BS->FreePool(ExitData);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue