diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2021-06-06 23:56:56 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2021-06-06 23:56:56 +0000 |
commit | 49efcbcc3303f8fcf7f05ce3fab0ef20e364507b (patch) | |
tree | 0facc57a8460056a6aca9e2c461330a018382b93 /sys | |
parent | ade32329c738efec582d91dc129d77769615938f (diff) |
Replace all uses of 'EFI_CALL(func, params)' with
the expansion 'func(params)'.
Allows upcoming removal of eficall.h.
Tested & ok naddy@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiacpi.c | 3 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiboot.c | 40 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efidev.c | 19 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efipxe.c | 53 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efirng.c | 7 |
5 files changed, 56 insertions, 66 deletions
diff --git a/sys/arch/arm64/stand/efiboot/efiacpi.c b/sys/arch/arm64/stand/efiboot/efiacpi.c index 4b315cc8c1c..f88a1bd1446 100644 --- a/sys/arch/arm64/stand/efiboot/efiacpi.c +++ b/sys/arch/arm64/stand/efiboot/efiacpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiacpi.c,v 1.11 2021/03/23 09:41:12 patrick Exp $ */ +/* $OpenBSD: efiacpi.c,v 1.12 2021/06/06 23:56:55 krw Exp $ */ /* * Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> @@ -21,7 +21,6 @@ #include <efi.h> #include <efiapi.h> -#include "eficall.h" #include "fdt.h" #include "libsa.h" diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c index d8363a97cca..b446bea0cf5 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.c +++ b/sys/arch/arm64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.32 2021/03/26 23:29:21 kn Exp $ */ +/* $OpenBSD: efiboot.c,v 1.33 2021/06/06 23:56:55 krw Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -41,7 +41,6 @@ #include "efidev.h" #include "efiboot.h" -#include "eficall.h" #include "fdt.h" EFI_SYSTEM_TABLE *ST; @@ -84,13 +83,13 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) IH = image; /* disable reset by watchdog after 5 minutes */ - EFI_CALL(BS->SetWatchdogTimer, 0, 0, 0, NULL); + BS->SetWatchdogTimer(0, 0, 0, NULL); - status = EFI_CALL(BS->HandleProtocol, image, &imgp_guid, + status = BS->HandleProtocol(image, &imgp_guid, (void **)&imgp); if (status == EFI_SUCCESS) - status = EFI_CALL(BS->HandleProtocol, imgp->DeviceHandle, - &devp_guid, (void **)&dp); + status = BS->HandleProtocol(imgp->DeviceHandle, &devp_guid, + (void **)&dp); if (status == EFI_SUCCESS) efi_bootdp = dp; @@ -210,7 +209,7 @@ efi_heap_init(void) { EFI_STATUS status; - status = EFI_CALL(BS->AllocatePages, AllocateAnyPages, EfiLoaderData, + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, EFI_SIZE_TO_PAGES(heapsiz), &heap); if (status != EFI_SUCCESS) panic("BS->AllocatePages()"); @@ -234,11 +233,11 @@ efi_diskprobe(void) TAILQ_INIT(&disklist); sz = 0; - status = EFI_CALL(BS->LocateHandle, ByProtocol, &blkio_guid, 0, &sz, 0); + status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, 0); if (status == EFI_BUFFER_TOO_SMALL) { handles = alloc(sz); - status = EFI_CALL(BS->LocateHandle, ByProtocol, &blkio_guid, - 0, &sz, handles); + status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, + handles); } if (handles == NULL || EFI_ERROR(status)) return; @@ -256,7 +255,7 @@ efi_diskprobe(void) depth = 1; for (i = 0; i < sz / sizeof(EFI_HANDLE); i++) { - status = EFI_CALL(BS->HandleProtocol, handles[i], &blkio_guid, + status = BS->HandleProtocol(handles[i], &blkio_guid, (void **)&blkio); if (EFI_ERROR(status)) panic("BS->HandleProtocol() returns %d", status); @@ -269,7 +268,7 @@ efi_diskprobe(void) if (efi_bootdp == NULL || depth == -1 || bootdev != 0) goto next; - status = EFI_CALL(BS->HandleProtocol, handles[i], &devp_guid, + status = BS->HandleProtocol(handles[i], &devp_guid, (void **)&dp); if (EFI_ERROR(status)) goto next; @@ -382,7 +381,7 @@ efi_framebuffer(void) } } - status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL, (void **)&gop); + status = BS->LocateProtocol(&gop_guid, NULL, (void **)&gop); if (status != EFI_SUCCESS) return; @@ -628,7 +627,7 @@ efi_cleanup(void) for (retry = 1; retry >= 0; retry--) { efi_memprobe_internal(); /* sync the current map */ efi_updatefdt(); - status = EFI_CALL(BS->ExitBootServices, IH, mmap_key); + status = BS->ExitBootServices(IH, mmap_key); if (status == EFI_SUCCESS) break; if (retry == 0) @@ -886,12 +885,11 @@ efi_memprobe_internal(void) free(mmap, mmap_ndesc * mmap_descsiz); siz = 0; - status = EFI_CALL(BS->GetMemoryMap, &siz, NULL, &mapkey, &mmsiz, - &mmver); + status = BS->GetMemoryMap(&siz, NULL, &mapkey, &mmsiz, &mmver); if (status != EFI_BUFFER_TOO_SMALL) panic("cannot get the size of memory map"); mm = alloc(siz); - status = EFI_CALL(BS->GetMemoryMap, &siz, mm, &mapkey, &mmsiz, &mmver); + status = BS->GetMemoryMap(&siz, mm, &mapkey, &mmsiz, &mmver); if (status != EFI_SUCCESS) panic("cannot get the memory map"); n = siz / mmsiz; @@ -936,8 +934,8 @@ efi_memprobe_find(UINTN pages, UINTN align, EFI_PHYSICAL_ADDRESS *addr) if (paddr & (align - 1)) continue; - if (EFI_CALL(BS->AllocatePages, AllocateAddress, - EfiLoaderData, pages, &paddr) == EFI_SUCCESS) { + if (BS->AllocatePages(AllocateAddress, EfiLoaderData, + pages, &paddr) == EFI_SUCCESS) { *addr = paddr; return EFI_SUCCESS; } @@ -1009,7 +1007,7 @@ Xdtb_efi(void) int Xexit_efi(void) { - EFI_CALL(BS->Exit, IH, 0, 0, NULL); + BS->Exit(IH, 0, 0, NULL); for (;;) continue; return (0); @@ -1018,6 +1016,6 @@ Xexit_efi(void) int Xpoweroff_efi(void) { - EFI_CALL(RS->ResetSystem, EfiResetShutdown, EFI_SUCCESS, 0, NULL); + RS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); return (0); } diff --git a/sys/arch/arm64/stand/efiboot/efidev.c b/sys/arch/arm64/stand/efiboot/efidev.c index 902faa7c8ba..4f6a2fee447 100644 --- a/sys/arch/arm64/stand/efiboot/efidev.c +++ b/sys/arch/arm64/stand/efiboot/efidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efidev.c,v 1.8 2021/06/02 22:44:27 krw Exp $ */ +/* $OpenBSD: efidev.c,v 1.9 2021/06/06 23:56:55 krw Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -36,7 +36,6 @@ #include "libsa.h" #include <efi.h> -#include "eficall.h" extern EFI_BOOT_SERVICES *BS; @@ -91,7 +90,7 @@ efid_io(int rw, efi_diskinfo_t ed, u_int off, int nsect, void *buf) end = (off + nsect + blks - 1) / blks; size = (end - start) * ed->blkio->Media->BlockSize; - status = EFI_CALL(BS->AllocatePages, AllocateAnyPages, EfiLoaderData, + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, EFI_SIZE_TO_PAGES(size), &addr); if (EFI_ERROR(status)) goto on_eio; @@ -99,8 +98,8 @@ efid_io(int rw, efi_diskinfo_t ed, u_int off, int nsect, void *buf) switch (rw) { case F_READ: - status = EFI_CALL(ed->blkio->ReadBlocks, - ed->blkio, ed->mediaid, start, size, data); + status = ed->blkio->ReadBlocks(ed->blkio, ed->mediaid, start, + size, data); if (EFI_ERROR(status)) goto on_eio; memcpy(buf, data + DEV_BSIZE * (off - start * blks), @@ -110,22 +109,22 @@ efid_io(int rw, efi_diskinfo_t ed, u_int off, int nsect, void *buf) if (ed->blkio->Media->ReadOnly) goto on_eio; if (off % blks != 0 || nsect % blks != 0) { - status = EFI_CALL(ed->blkio->ReadBlocks, - ed->blkio, ed->mediaid, start, size, data); + status = ed->blkio->ReadBlocks(ed->blkio, ed->mediaid, + start, size, data); if (EFI_ERROR(status)) goto on_eio; } memcpy(data + DEV_BSIZE * (off - start * blks), buf, DEV_BSIZE * nsect); - status = EFI_CALL(ed->blkio->WriteBlocks, - ed->blkio, ed->mediaid, start, size, data); + status = ed->blkio->WriteBlocks(ed->blkio, ed->mediaid, start, + size, data); if (EFI_ERROR(status)) goto on_eio; break; } on_eio: - EFI_CALL(BS->FreePages, addr, EFI_SIZE_TO_PAGES(size)); + BS->FreePages(addr, EFI_SIZE_TO_PAGES(size)); return (status); } diff --git a/sys/arch/arm64/stand/efiboot/efipxe.c b/sys/arch/arm64/stand/efiboot/efipxe.c index 6c428fd3d9d..d34d5d95ec6 100644 --- a/sys/arch/arm64/stand/efiboot/efipxe.c +++ b/sys/arch/arm64/stand/efiboot/efipxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efipxe.c,v 1.10 2021/03/11 11:16:56 jsg Exp $ */ +/* $OpenBSD: efipxe.c,v 1.11 2021/06/06 23:56:55 krw Exp $ */ /* * Copyright (c) 2017 Patrick Wildt <patrick@blueri.se> * @@ -35,7 +35,6 @@ #include <efi.h> #include <efiapi.h> -#include "eficall.h" #include "efiboot.h" #include "disk.h" @@ -83,7 +82,7 @@ efi_pxeprobe(void) if (efi_bootdp == NULL) return; - status = EFI_CALL(BS->LocateHandleBuffer, ByProtocol, &pxe_guid, NULL, + status = BS->LocateHandleBuffer(ByProtocol, &pxe_guid, NULL, &nhandles, &handles); if (status != EFI_SUCCESS) return; @@ -91,8 +90,8 @@ efi_pxeprobe(void) for (i = 0; i < nhandles; i++) { EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp; - status = EFI_CALL(BS->HandleProtocol, handles[i], - &devp_guid, (void **)&dp0); + status = BS->HandleProtocol(handles[i], &devp_guid, + (void **)&dp0); if (status != EFI_SUCCESS) continue; @@ -100,12 +99,12 @@ efi_pxeprobe(void) if (depth == -1 || efi_device_path_ncmp(efi_bootdp, dp0, depth)) continue; - status = EFI_CALL(BS->HandleProtocol, handles[i], &net_guid, + status = BS->HandleProtocol(handles[i], &net_guid, (void **)&net); if (status != EFI_SUCCESS) continue; - status = EFI_CALL(BS->HandleProtocol, handles[i], &pxe_guid, + status = BS->HandleProtocol(handles[i], &pxe_guid, (void **)&pxe); if (status != EFI_SUCCESS) continue; @@ -114,8 +113,8 @@ efi_pxeprobe(void) continue; if (pxe->Mtftp != NULL) { - status = EFI_CALL(pxe->Mtftp, NULL, 0, NULL, - FALSE, NULL, NULL, NULL, NULL, NULL, FALSE); + status = pxe->Mtftp(NULL, 0, NULL, FALSE, NULL, NULL, + NULL, NULL, NULL, FALSE); if (status != EFI_UNSUPPORTED) use_mtftp = 1; } @@ -165,8 +164,8 @@ mtftp_open(char *path, struct open_file *f) memset(tftpfile, 0, sizeof(*tftpfile)); memcpy(&dstip, &servip, sizeof(servip)); - status = EFI_CALL(PXE->Mtftp, PXE, EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, - NULL, FALSE, &size, NULL, &dstip, path, NULL, FALSE); + status = PXE->Mtftp(PXE, EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, NULL, + FALSE, &size, NULL, &dstip, path, NULL, FALSE); if (status != EFI_SUCCESS) { free(tftpfile, sizeof(*tftpfile)); return ENOENT; @@ -176,7 +175,7 @@ mtftp_open(char *path, struct open_file *f) if (tftpfile->inbufsize == 0) goto out; - status = EFI_CALL(BS->AllocatePages, AllocateAnyPages, EfiLoaderData, + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, EFI_SIZE_TO_PAGES(tftpfile->inbufsize), &addr); if (status != EFI_SUCCESS) { free(tftpfile, sizeof(*tftpfile)); @@ -184,7 +183,7 @@ mtftp_open(char *path, struct open_file *f) } tftpfile->inbuf = (unsigned char *)((paddr_t)addr); - status = EFI_CALL(PXE->Mtftp, PXE, EFI_PXE_BASE_CODE_TFTP_READ_FILE, + status = PXE->Mtftp(PXE, EFI_PXE_BASE_CODE_TFTP_READ_FILE, tftpfile->inbuf, FALSE, &size, NULL, &dstip, path, NULL, FALSE); if (status != EFI_SUCCESS) { free(tftpfile, sizeof(*tftpfile)); @@ -201,7 +200,7 @@ mtftp_close(struct open_file *f) struct mtftp_handle *tftpfile = f->f_fsdata; if (tftpfile->inbuf != NULL) - EFI_CALL(BS->FreePages, (paddr_t)tftpfile->inbuf, + BS->FreePages((paddr_t)tftpfile->inbuf, EFI_SIZE_TO_PAGES(tftpfile->inbufsize)); free(tftpfile, sizeof(*tftpfile)); return 0; @@ -328,14 +327,13 @@ tftpopen(struct open_file *f, ...) return 1; if (!use_mtftp) { - status = EFI_CALL(BS->AllocatePages, AllocateAnyPages, - EfiLoaderData, EFI_SIZE_TO_PAGES(RECV_SIZE), &txbuf); + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, + EFI_SIZE_TO_PAGES(RECV_SIZE), &txbuf); if (status != EFI_SUCCESS) return ENOMEM; if ((tftpdev_sock = netif_open("efinet")) < 0) { - EFI_CALL(BS->FreePages, txbuf, - EFI_SIZE_TO_PAGES(RECV_SIZE)); + BS->FreePages(txbuf, EFI_SIZE_TO_PAGES(RECV_SIZE)); return ENXIO; } @@ -352,7 +350,7 @@ tftpclose(struct open_file *f) if (!use_mtftp) { ret = netif_close(*(int *)f->f_devdata); - EFI_CALL(BS->FreePages, txbuf, EFI_SIZE_TO_PAGES(RECV_SIZE)); + BS->FreePages(txbuf, EFI_SIZE_TO_PAGES(RECV_SIZE)); txbuf = 0; } @@ -417,19 +415,18 @@ efinet_init(struct iodesc *desc, void *v) return; if (net->Mode->State == EfiSimpleNetworkStopped) { - status = EFI_CALL(net->Start, net); + status = net->Start(net); if (status != EFI_SUCCESS) return; } if (net->Mode->State != EfiSimpleNetworkInitialized) { - status = EFI_CALL(net->Initialize, net, 0, 0); + status = net->Initialize(net, 0, 0); if (status != EFI_SUCCESS) return; } - EFI_CALL(net->ReceiveFilters, net, - EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | + net->ReceiveFilters(net, EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST, 0, FALSE, 0, NULL); @@ -461,8 +458,7 @@ efinet_get(struct iodesc *desc, void *pkt, size_t len, time_t tmo) status = EFI_NOT_READY; while ((getsecs() - t) < tmo) { pktsz = bufsz; - status = EFI_CALL(net->Receive, net, NULL, &pktsz, ptr, - NULL, NULL, NULL); + status = net->Receive(net, NULL, &pktsz, ptr, NULL, NULL, NULL); if (status == EFI_SUCCESS) break; if (status != EFI_NOT_READY) @@ -493,14 +489,13 @@ efinet_put(struct iodesc *desc, void *pkt, size_t len) goto out; memcpy((void *)txbuf, pkt, len); - status = EFI_CALL(net->Transmit, net, 0, len, (void *)txbuf, - NULL, NULL, NULL); + status = net->Transmit(net, 0, len, (void *)txbuf, NULL, NULL, NULL); if (status != EFI_SUCCESS) goto out; buf = NULL; while (status == EFI_SUCCESS) { - status = EFI_CALL(net->GetStatus, net, NULL, &buf); + status = net->GetStatus(net, NULL, &buf); if (buf) break; } @@ -520,5 +515,5 @@ efinet_end(struct netif *nif) if (net == NULL) return; - EFI_CALL(net->Shutdown, net); + net->Shutdown(net); } diff --git a/sys/arch/arm64/stand/efiboot/efirng.c b/sys/arch/arm64/stand/efiboot/efirng.c index 9d769e75b47..d8dab07be05 100644 --- a/sys/arch/arm64/stand/efiboot/efirng.c +++ b/sys/arch/arm64/stand/efiboot/efirng.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efirng.c,v 1.2 2020/05/25 14:53:58 deraadt Exp $ */ +/* $OpenBSD: efirng.c,v 1.3 2021/06/06 23:56:55 krw Exp $ */ /* * Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> @@ -21,7 +21,6 @@ #include <efi.h> #include <efiapi.h> -#include "eficall.h" #include "libsa.h" extern EFI_BOOT_SERVICES *BS; @@ -68,13 +67,13 @@ fwrandom(char *buf, size_t buflen) size_t i; int ret = 0; - status = EFI_CALL(BS->LocateProtocol, &rng_guid, NULL, (void **)&rng); + status = BS->LocateProtocol(&rng_guid, NULL, (void **)&rng); if (rng == NULL || EFI_ERROR(status)) return -1; random = alloc(buflen); - status = EFI_CALL(rng->GetRNG, rng, NULL, buflen, random); + status = rng->GetRNG(rng, NULL, buflen, random); if (EFI_ERROR(status)) { printf("RNG GetRNG() failed (%d)\n", status); ret = -1; |