The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=87795c6e95b01cd20df103109cdb7077eb46bc46

commit 87795c6e95b01cd20df103109cdb7077eb46bc46
Author:     Warner Losh <[email protected]>
AuthorDate: 2025-11-16 17:32:18 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2025-11-16 18:29:02 +0000

    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
---
 stand/efi/boot1/boot1.c                  |  8 ++++----
 stand/efi/boot1/proto.c                  |  4 ++--
 stand/efi/boot1/ufs_module.c             |  2 +-
 stand/efi/boot1/zfs_module.c             |  2 +-
 stand/efi/gptboot/proto.c                |  4 ++--
 stand/efi/include/efierr.h               |  2 +-
 stand/efi/libefi/devpath.c               |  2 +-
 stand/efi/libefi/efi_driver_utils.c      |  2 +-
 stand/efi/libefi/eficom.c                |  2 +-
 stand/efi/libefi/efinet.c                | 10 +++++-----
 stand/efi/libefi/efipart.c               |  4 ++--
 stand/efi/libefi/env.c                   |  8 ++++----
 stand/efi/loader/arch/amd64/multiboot2.c |  4 ++--
 stand/efi/loader/arch/amd64/trap.c       |  8 ++++----
 stand/efi/loader/bootinfo.c              |  6 +++---
 stand/efi/loader/copy.c                  |  4 ++--
 stand/efi/loader/framebuffer.c           |  6 +++---
 stand/efi/loader/main.c                  |  2 +-
 18 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/stand/efi/boot1/boot1.c b/stand/efi/boot1/boot1.c
index c906b430c0d6..8228044b3be3 100644
--- a/stand/efi/boot1/boot1.c
+++ b/stand/efi/boot1/boot1.c
@@ -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) {
diff --git a/stand/efi/boot1/proto.c b/stand/efi/boot1/proto.c
index f81debd168b9..042a675f543d 100644
--- a/stand/efi/boot1/proto.c
+++ b/stand/efi/boot1/proto.c
@@ -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);
        }
 
diff --git a/stand/efi/boot1/ufs_module.c b/stand/efi/boot1/ufs_module.c
index 0bdd5c018b06..e6c7c64c1e19 100644
--- a/stand/efi/boot1/ufs_module.c
+++ b/stand/efi/boot1/ufs_module.c
@@ -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);
        }
 
diff --git a/stand/efi/boot1/zfs_module.c b/stand/efi/boot1/zfs_module.c
index 16722b33f0b9..f0cf28e8ce68 100644
--- a/stand/efi/boot1/zfs_module.c
+++ b/stand/efi/boot1/zfs_module.c
@@ -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);
 }
 
diff --git a/stand/efi/gptboot/proto.c b/stand/efi/gptboot/proto.c
index a1825d9c1c15..a6bc0c268dcd 100644
--- a/stand/efi/gptboot/proto.c
+++ b/stand/efi/gptboot/proto.c
@@ -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);
        }
 
diff --git a/stand/efi/include/efierr.h b/stand/efi/include/efierr.h
index 2aa2622a3877..be0aab8264e1 100644
--- a/stand/efi/include/efierr.h
+++ b/stand/efi/include/efierr.h
@@ -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
diff --git a/stand/efi/libefi/devpath.c b/stand/efi/libefi/devpath.c
index db152f8eb9ad..22ae895ff95a 100644
--- a/stand/efi/libefi/devpath.c
+++ b/stand/efi/libefi/devpath.c
@@ -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 *
diff --git a/stand/efi/libefi/efi_driver_utils.c 
b/stand/efi/libefi/efi_driver_utils.c
index adb57f39fdce..22c93d7ef296 100644
--- a/stand/efi/libefi/efi_driver_utils.c
+++ b/stand/efi/libefi/efi_driver_utils.c
@@ -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);
diff --git a/stand/efi/libefi/eficom.c b/stand/efi/libefi/eficom.c
index 2aa592da47f4..a033a8ebc2ef 100644
--- a/stand/efi/libefi/eficom.c
+++ b/stand/efi/libefi/eficom.c
@@ -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);
        }
 
diff --git a/stand/efi/libefi/efinet.c b/stand/efi/libefi/efinet.c
index e872110ef08f..161d2cfd930a 100644
--- a/stand/efi/libefi/efinet.c
+++ b/stand/efi/libefi/efinet.c
@@ -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);
diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c
index 3df6034571f5..7acbe3921137 100644
--- a/stand/efi/libefi/efipart.c
+++ b/stand/efi/libefi/efipart.c
@@ -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));
diff --git a/stand/efi/libefi/env.c b/stand/efi/libefi/env.c
index 328476a9f68b..d518b8fac257 100644
--- a/stand/efi/libefi/env.c
+++ b/stand/efi/libefi/env.c
@@ -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
diff --git a/stand/efi/loader/arch/amd64/multiboot2.c 
b/stand/efi/loader/arch/amd64/multiboot2.c
index 6216fac42e4a..086dba33895a 100644
--- a/stand/efi/loader/arch/amd64/multiboot2.c
+++ b/stand/efi/loader/arch/amd64/multiboot2.c
@@ -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;
        }
diff --git a/stand/efi/loader/arch/amd64/trap.c 
b/stand/efi/loader/arch/amd64/trap.c
index 37e7e9d263a7..f79d74bf0322 100644
--- a/stand/efi/loader/arch/amd64/trap.c
+++ b/stand/efi/loader/arch/amd64/trap.c
@@ -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);
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
index 7931622c2df6..67b36313c26f 100644
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -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);
        }
 
diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c
index 7452726565ad..d14411d52f10 100644
--- a/stand/efi/loader/copy.c
+++ b/stand/efi/loader/copy.c
@@ -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;
diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c
index fc61ed15ba3c..bd618cf0be86 100644
--- a/stand/efi/loader/framebuffer.c
+++ b/stand/efi/loader/framebuffer.c
@@ -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);
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 2e51f15f0b5f..2f154321b281 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -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);

Reply via email to