diff --git a/stand/efi/boot1/boot1.c b/stand/efi/boot1/boot1.c --- a/stand/efi/boot1/boot1.c +++ b/stand/efi/boot1/boot1.c @@ -118,7 +118,7 @@ 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 @@ (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 @@ 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 @@ &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) { diff --git a/stand/efi/boot1/proto.c b/stand/efi/boot1/proto.c --- a/stand/efi/boot1/proto.c +++ b/stand/efi/boot1/proto.c @@ -68,7 +68,7 @@ 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 @@ if (status != EFI_SUCCESS) { DPRINTF("\nFailed to query BlockIoProtocol (%lu)\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (-1); } diff --git a/stand/efi/boot1/ufs_module.c b/stand/efi/boot1/ufs_module.c --- a/stand/efi/boot1/ufs_module.c +++ b/stand/efi/boot1/ufs_module.c @@ -62,7 +62,7 @@ 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); } diff --git a/stand/efi/boot1/zfs_module.c b/stand/efi/boot1/zfs_module.c --- a/stand/efi/boot1/zfs_module.c +++ b/stand/efi/boot1/zfs_module.c @@ -106,7 +106,7 @@ 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); } diff --git a/stand/efi/gptboot/proto.c b/stand/efi/gptboot/proto.c --- a/stand/efi/gptboot/proto.c +++ b/stand/efi/gptboot/proto.c @@ -69,7 +69,7 @@ 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 @@ 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); } diff --git a/stand/efi/include/efierr.h b/stand/efi/include/efierr.h --- a/stand/efi/include/efierr.h +++ b/stand/efi/include/efierr.h @@ -30,7 +30,7 @@ #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 diff --git a/stand/efi/libefi/devpath.c b/stand/efi/libefi/devpath.c --- a/stand/efi/libefi/devpath.c +++ b/stand/efi/libefi/devpath.c @@ -71,7 +71,7 @@ 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 * diff --git a/stand/efi/libefi/efi_driver_utils.c b/stand/efi/libefi/efi_driver_utils.c --- a/stand/efi/libefi/efi_driver_utils.c +++ b/stand/efi/libefi/efi_driver_utils.c @@ -84,7 +84,7 @@ if (EFI_ERROR(status)) { printf("Failed to install driver (%ld)!\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); } return (status); diff --git a/stand/efi/libefi/eficom.c b/stand/efi/libefi/eficom.c --- a/stand/efi/libefi/eficom.c +++ b/stand/efi/libefi/eficom.c @@ -510,7 +510,7 @@ (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); } diff --git a/stand/efi/libefi/efinet.c b/stand/efi/libefi/efinet.c --- a/stand/efi/libefi/efinet.c +++ b/stand/efi/libefi/efinet.c @@ -122,7 +122,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c --- a/stand/efi/libefi/efipart.c +++ b/stand/efi/libefi/efipart.c @@ -388,7 +388,7 @@ 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 @@ 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)); diff --git a/stand/efi/libefi/env.c b/stand/efi/libefi/env.c --- a/stand/efi/libefi/env.c +++ b/stand/efi/libefi/env.c @@ -679,7 +679,7 @@ 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 @@ 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 @@ 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 @@ 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 diff --git a/stand/efi/loader/arch/amd64/multiboot2.c b/stand/efi/loader/arch/amd64/multiboot2.c --- a/stand/efi/loader/arch/amd64/multiboot2.c +++ b/stand/efi/loader/arch/amd64/multiboot2.c @@ -343,7 +343,7 @@ 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 @@ 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; } diff --git a/stand/efi/loader/arch/amd64/trap.c b/stand/efi/loader/arch/amd64/trap.c --- a/stand/efi/loader/arch/amd64/trap.c +++ b/stand/efi/loader/arch/amd64/trap.c @@ -214,7 +214,7 @@ 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_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 @@ &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 @@ &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); diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -251,7 +251,7 @@ 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 @@ 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 @@ 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); } diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -107,7 +107,7 @@ 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 @@ 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; diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c --- a/stand/efi/loader/framebuffer.c +++ b/stand/efi/loader/framebuffer.c @@ -239,7 +239,7 @@ 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 @@ 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 @@ 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); diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -1936,7 +1936,7 @@ 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);