From: krw Date: Mon, 7 Jun 2021 00:04:20 +0000 (+0000) Subject: Replace all uses of 'EFI_CALL(func, params)' with X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=147ac6c235575f6ba7cfa96bdd00a7d4ea866309;p=openbsd Replace all uses of 'EFI_CALL(func, params)' with the expansion 'func(params)'. Allows upcoming removal of eficall.h. --- diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c index f00c0f257ef..a8d8c762197 100644 --- a/sys/arch/amd64/stand/efiboot/efiboot.c +++ b/sys/arch/amd64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.37 2021/05/23 20:30:42 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.38 2021/06/07 00:04:20 krw Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -36,7 +36,6 @@ #include "efidev.h" #include "efiboot.h" -#include "eficall.h" #include "run_i386.h" #define KERN_LOADSPACE_SIZE (64 * 1024 * 1024) @@ -85,16 +84,15 @@ 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); efi_video_init(); efi_heap_init(); - status = EFI_CALL(BS->HandleProtocol, image, &imgp_guid, - (void **)&imgp); + status = BS->HandleProtocol(image, &imgp_guid, (void **)&imgp); if (status == EFI_SUCCESS) - status = EFI_CALL(BS->HandleProtocol, imgp->DeviceHandle, - &devp_guid, (void **)&dp0); + status = BS->HandleProtocol(imgp->DeviceHandle, &devp_guid, + (void **)&dp0); if (status == EFI_SUCCESS) { for (dp = dp0; !IsDevicePathEnd(dp); dp = NextDevicePathNode(dp)) { @@ -160,7 +158,7 @@ efi_cleanup(void) /* retry once in case of failure */ for (retry = 1; retry >= 0; retry--) { efi_memprobe_internal(); /* sync the current map */ - status = EFI_CALL(BS->ExitBootServices, IH, mmap_key); + status = BS->ExitBootServices(IH, mmap_key); if (status == EFI_SUCCESS) break; if (retry == 0) @@ -188,10 +186,10 @@ efi_diskprobe(void) TAILQ_INIT(&efi_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, + status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, handles); } if (handles == NULL || EFI_ERROR(status)) @@ -210,7 +208,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); @@ -223,7 +221,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; @@ -290,7 +288,7 @@ efi_heap_init(void) EFI_STATUS status; heap = HEAP_LIMIT; - status = EFI_CALL(BS->AllocatePages, AllocateMaxAddress, EfiLoaderData, + status = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, EFI_SIZE_TO_PAGES(heapsiz), &heap); if (status != EFI_SUCCESS) panic("BS->AllocatePages()"); @@ -306,7 +304,7 @@ efi_memprobe(void) addr = 0x10000000ULL; /* Below 256MB */ int error; - status = EFI_CALL(BS->AllocatePages, AllocateMaxAddress, EfiLoaderData, + status = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, EFI_SIZE_TO_PAGES(KERN_LOADSPACE_SIZE), &addr); if (status != EFI_SUCCESS) panic("BS->AllocatePages()"); @@ -347,12 +345,11 @@ efi_memprobe_internal(void) free((void *)bios_efiinfo.mmap_start, bios_efiinfo.mmap_size); 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"); mm0 = alloc(siz); - status = EFI_CALL(BS->GetMemoryMap, &siz, mm0, &mapkey, &mmsiz, &mmver); + status = BS->GetMemoryMap(&siz, mm0, &mapkey, &mmsiz, &mmver); if (status != EFI_SUCCESS) panic("cannot get the memory map"); n = siz / mmsiz; @@ -449,15 +446,13 @@ efi_video_init(void) EFI_STATUS status; conout = ST->ConOut; - status = EFI_CALL(BS->LocateProtocol, &con_guid, NULL, - (void **)&conctrl); + status = BS->LocateProtocol(&con_guid, NULL, (void **)&conctrl); if (status == EFI_SUCCESS) - (void)EFI_CALL(conctrl->SetMode, conctrl, - EfiConsoleControlScreenText); + conctrl->SetMode(conctrl, EfiConsoleControlScreenText); mode80x25 = -1; mode100x31 = -1; for (i = 0; i < conout->Mode->MaxMode; i++) { - status = EFI_CALL(conout->QueryMode, conout, i, &cols, &rows); + status = conout->QueryMode(conout, i, &cols, &rows); if (EFI_ERROR(status)) continue; if (mode80x25 < 0 && cols == 80 && rows == 25) @@ -470,9 +465,9 @@ efi_video_init(void) } } if (mode100x31 >= 0) - EFI_CALL(conout->SetMode, conout, mode100x31); + conout->SetMode(conout, mode100x31); else if (mode80x25 >= 0) - EFI_CALL(conout->SetMode, conout, mode80x25); + conout->SetMode(conout, mode80x25); conin = ST->ConIn; efi_video_reset(); } @@ -480,10 +475,9 @@ efi_video_init(void) static void efi_video_reset(void) { - EFI_CALL(conout->EnableCursor, conout, TRUE); - EFI_CALL(conout->SetAttribute, conout, - EFI_TEXT_ATTR(EFI_LIGHTGRAY, EFI_BLACK)); - EFI_CALL(conout->ClearScreen, conout); + conout->EnableCursor(conout, TRUE); + conout->SetAttribute(conout, EFI_TEXT_ATTR(EFI_LIGHTGRAY, EFI_BLACK)); + conout->ClearScreen(conout); } void @@ -514,12 +508,12 @@ efi_cons_getc(dev_t dev) return (r); } - status = EFI_CALL(conin->ReadKeyStroke, conin, &key); + status = conin->ReadKeyStroke(conin, &key); while (status == EFI_NOT_READY || key.UnicodeChar == 0) { if (dev & 0x80) return (0); - EFI_CALL(BS->WaitForEvent, 1, &conin->WaitForKey, &dummy); - status = EFI_CALL(conin->ReadKeyStroke, conin, &key); + BS->WaitForEvent(1, &conin->WaitForKey, &dummy); + status = conin->ReadKeyStroke(conin, &key); } if (dev & 0x80) @@ -539,7 +533,7 @@ efi_cons_putc(dev_t dev, int c) buf[0] = c; buf[1] = 0; - EFI_CALL(conout->OutputString, conout, buf); + conout->OutputString(conout, buf); } int @@ -650,10 +644,10 @@ efi_com_probe(struct consdev *cn) cn->cn_dev = makedev(8, 0); sz = 0; - status = EFI_CALL(BS->LocateHandle, ByProtocol, &serio_guid, 0, &sz, 0); + status = BS->LocateHandle(ByProtocol, &serio_guid, 0, &sz, 0); if (status == EFI_BUFFER_TOO_SMALL) { handles = alloc(sz); - status = EFI_CALL(BS->LocateHandle, ByProtocol, &serio_guid, + status = BS->LocateHandle(ByProtocol, &serio_guid, 0, &sz, handles); } if (handles == NULL || EFI_ERROR(status)) { @@ -667,7 +661,7 @@ efi_com_probe(struct consdev *cn) * UID 0-3 map to legacy COM[1-4] and they use the legacy * port address. */ - status = EFI_CALL(BS->HandleProtocol, handles[i], &devp_guid, + status = BS->HandleProtocol(handles[i], &devp_guid, (void **)&dp0); if (EFI_ERROR(status)) continue; @@ -686,7 +680,7 @@ efi_com_probe(struct consdev *cn) continue; /* Prepare SERIAL_IO_INTERFACE */ - status = EFI_CALL(BS->HandleProtocol, handles[i], &serio_guid, + status = BS->HandleProtocol(handles[i], &serio_guid, (void **)&serio); if (EFI_ERROR(status)) continue; @@ -720,8 +714,8 @@ comspeed(dev_t dev, int sp) return pio_comspeed(dev, sp); if (serio->Mode->BaudRate != sp) { - status = EFI_CALL(serio->SetAttributes, serio, - sp, serio->Mode->ReceiveFifoDepth, + status = serio->SetAttributes(serio, sp, + serio->Mode->ReceiveFifoDepth, serio->Mode->Timeout, serio->Mode->Parity, serio->Mode->DataBits, serio->Mode->StopBits); if (EFI_ERROR(status)) { @@ -773,7 +767,7 @@ efi_com_getc(dev_t dev) for (;;) { sz = 1; - status = EFI_CALL(serio->Read, serio, &sz, &buf); + status = serio->Read(serio, &sz, &buf); if (status == EFI_SUCCESS && sz > 0) break; if (status != EFI_TIMEOUT && EFI_ERROR(status)) @@ -801,7 +795,7 @@ efi_com_putc(dev_t dev, int c) } serio = serios[minor(dev)]; buf = c; - EFI_CALL(serio->Write, serio, &sz, &buf); + serio->Write(serio, &sz, &buf); } /*********************************************************************** @@ -824,7 +818,7 @@ efi_gop_setmode(int mode) { EFI_STATUS status; - status = EFI_CALL(gop->SetMode, gop, mode); + status = gop->SetMode(gop, mode); if (EFI_ERROR(status) || gop->Mode->Mode != mode) printf("GOP SetMode() failed (%d)\n", status); @@ -859,13 +853,11 @@ efi_makebootargs(void) /* * Frame buffer */ - status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL, - (void **)&gop); + status = BS->LocateProtocol(&gop_guid, NULL, (void **)&gop); if (!EFI_ERROR(status)) { if (gopmode < 0) { for (i = 0; i < gop->Mode->MaxMode; i++) { - status = EFI_CALL(gop->QueryMode, gop, - i, &sz, &gopi); + status = gop->QueryMode(gop, i, &sz, &gopi); if (EFI_ERROR(status)) continue; gopsiz = gopi->HorizontalResolution * @@ -932,7 +924,7 @@ _rtt(void) printf("Hit any key to reboot\n"); efi_cons_getc(0); #endif - EFI_CALL(RS->ResetSystem, EfiResetCold, EFI_SUCCESS, 0, NULL); + RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); for (;;) continue; } @@ -949,7 +941,7 @@ getsecs(void) }; #define isleap(_y) (((_y) % 4) == 0 && (((_y) % 100) != 0 || ((_y) % 400) == 0)) - EFI_CALL(ST->RuntimeServices->GetTime, &t, NULL); + ST->RuntimeServices->GetTime(&t, NULL); /* Calc days from UNIX epoch */ r = (t.Year - 1970) * 365; @@ -989,7 +981,7 @@ sleep(u_int i) int Xexit_efi(void) { - EFI_CALL(BS->Exit, IH, 0, 0, NULL); + BS->Exit(IH, 0, 0, NULL); for (;;) continue; return (0); @@ -1004,7 +996,7 @@ Xvideo_efi(void) mode = strtol(cmd.argv[1], NULL, 10); if (0 <= mode && mode < nitems(efi_video) && efi_video[mode].cols > 0) { - EFI_CALL(conout->SetMode, conout, mode); + conout->SetMode(conout, mode); efi_video_reset(); } } else { @@ -1025,7 +1017,7 @@ Xvideo_efi(void) int Xpoweroff_efi(void) { - EFI_CALL(RS->ResetSystem, EfiResetShutdown, EFI_SUCCESS, 0, NULL); + RS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); return (0); } @@ -1038,16 +1030,14 @@ Xgop_efi(void) EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *gopi; - status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL, - (void **)&gop); + status = BS->LocateProtocol(&gop_guid, NULL, (void **)&gop); if (EFI_ERROR(status)) return (0); if (cmd.argc >= 2) { mode = strtol(cmd.argv[1], NULL, 10); if (0 <= mode && mode < gop->Mode->MaxMode) { - status = EFI_CALL(gop->QueryMode, gop, mode, - &sz, &gopi); + status = gop->QueryMode(gop, mode, &sz, &gopi); if (!EFI_ERROR(status)) { if (efi_gop_setmode(mode) == EFI_SUCCESS) gopmode = mode; @@ -1055,7 +1045,7 @@ Xgop_efi(void) } } else { for (i = 0; i < gop->Mode->MaxMode; i++) { - status = EFI_CALL(gop->QueryMode, gop, i, &sz, &gopi); + status = gop->QueryMode(gop, i, &sz, &gopi); if (EFI_ERROR(status)) continue; printf("Mode %d: %d x %d (stride = %d)\n", i, diff --git a/sys/arch/amd64/stand/efiboot/efidev.c b/sys/arch/amd64/stand/efiboot/efidev.c index bbf248eb586..235a40804b7 100644 --- a/sys/arch/amd64/stand/efiboot/efidev.c +++ b/sys/arch/amd64/stand/efiboot/efidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efidev.c,v 1.34 2021/06/02 22:44:26 krw Exp $ */ +/* $OpenBSD: efidev.c,v 1.35 2021/06/07 00:04:20 krw Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -44,7 +44,6 @@ #endif #include -#include "eficall.h" extern int debug; @@ -110,8 +109,7 @@ 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, + status = ed->blkio->ReadBlocks(ed->blkio, ed->mediaid, start, (end - start) * ed->blkio->Media->BlockSize, ibuf); if (EFI_ERROR(status)) goto on_eio; @@ -120,16 +118,15 @@ efid_io(int rw, efi_diskinfo_t ed, u_int off, int nsect, void *buf) break; case F_WRITE: if (off % blks != 0 || nsect % blks != 0) { - status = EFI_CALL(ed->blkio->ReadBlocks, - ed->blkio, ed->mediaid, start, - (end - start) * ed->blkio->Media->BlockSize, ibuf); + status = ed->blkio->ReadBlocks(ed->blkio, ed->mediaid, + start, (end - start) * ed->blkio->Media->BlockSize, + ibuf); if (EFI_ERROR(status)) goto on_eio; } memcpy(ibuf + DEV_BSIZE * (off - start * blks), buf, DEV_BSIZE * nsect); - status = EFI_CALL(ed->blkio->WriteBlocks, - ed->blkio, ed->mediaid, start, + status = ed->blkio->WriteBlocks(ed->blkio, ed->mediaid, start, (end - start) * ed->blkio->Media->BlockSize, ibuf); if (EFI_ERROR(status)) goto on_eio; diff --git a/sys/arch/amd64/stand/efiboot/efipxe.c b/sys/arch/amd64/stand/efiboot/efipxe.c index 5cca69abae3..316f2f81d6b 100644 --- a/sys/arch/amd64/stand/efiboot/efipxe.c +++ b/sys/arch/amd64/stand/efiboot/efipxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efipxe.c,v 1.9 2021/03/11 11:16:55 jsg Exp $ */ +/* $OpenBSD: efipxe.c,v 1.10 2021/06/07 00:04:20 krw Exp $ */ /* * Copyright (c) 2017 Patrick Wildt * @@ -26,7 +26,6 @@ #include #include -#include "eficall.h" #include "efiboot.h" extern EFI_BOOT_SERVICES *BS; @@ -60,16 +59,16 @@ efi_pxeprobe(void) if (efi_bootdp == NULL) return; - status = EFI_CALL(BS->LocateHandleBuffer, ByProtocol, &pxe_guid, NULL, - &nhandles, &handles); + status = BS->LocateHandleBuffer(ByProtocol, &pxe_guid, NULL, &nhandles, + &handles); if (status != EFI_SUCCESS) return; 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; @@ -77,7 +76,7 @@ efi_pxeprobe(void) if (depth == -1 || efi_device_path_ncmp(efi_bootdp, dp0, depth)) continue; - status = EFI_CALL(BS->HandleProtocol, handles[i], &pxe_guid, + status = BS->HandleProtocol(handles[i], &pxe_guid, (void **)&pxe); if (status != EFI_SUCCESS) continue; @@ -138,8 +137,8 @@ tftp_open(char *path, struct open_file *f) return ENOMEM; memset(tftpfile, 0, sizeof(*tftpfile)); - status = EFI_CALL(PXE->Mtftp, PXE, EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, - NULL, FALSE, &size, NULL, &servip, path, NULL, FALSE); + status = PXE->Mtftp(PXE, EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, NULL, + FALSE, &size, NULL, &servip, path, NULL, FALSE); if (status != EFI_SUCCESS) { free(tftpfile, sizeof(*tftpfile)); return ENOENT; @@ -149,7 +148,7 @@ tftp_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)); @@ -157,7 +156,7 @@ tftp_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, &servip, path, NULL, FALSE); if (status != EFI_SUCCESS) { free(tftpfile, sizeof(*tftpfile)); @@ -174,7 +173,7 @@ tftp_close(struct open_file *f) struct tftp_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; diff --git a/sys/arch/amd64/stand/efiboot/efirng.c b/sys/arch/amd64/stand/efiboot/efirng.c index 2f503909488..4892a107fc1 100644 --- a/sys/arch/amd64/stand/efiboot/efirng.c +++ b/sys/arch/amd64/stand/efiboot/efirng.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efirng.c,v 1.2 2020/05/25 14:53:59 deraadt Exp $ */ +/* $OpenBSD: efirng.c,v 1.3 2021/06/07 00:04:20 krw Exp $ */ /* * Copyright (c) 2018 Mark Kettenis @@ -21,7 +21,6 @@ #include #include -#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; diff --git a/sys/arch/amd64/stand/efiboot/exec_i386.c b/sys/arch/amd64/stand/efiboot/exec_i386.c index dc83302a17b..56afe729c82 100644 --- a/sys/arch/amd64/stand/efiboot/exec_i386.c +++ b/sys/arch/amd64/stand/efiboot/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.5 2020/09/01 18:03:09 patrick Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.6 2021/06/07 00:04:20 krw Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -49,7 +49,6 @@ #include #include -#include "eficall.h" #include "efiboot.h" extern EFI_BOOT_SERVICES *BS; @@ -213,7 +212,7 @@ ucode_load(void) buflen = sb.st_size; addr = 16 * 1024 * 1024; - if (EFI_CALL(BS->AllocatePages, AllocateMaxAddress, EfiLoaderData, + if (BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, EFI_SIZE_TO_PAGES(buflen), &addr) != EFI_SUCCESS) { printf("cannot allocate memory for ucode\n"); return;