the expansion 'func(params)'.
Allows upcoming removal of eficall.h.
Tested & ok naddy@
-/* $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>
#include <efi.h>
#include <efiapi.h>
-#include "eficall.h"
#include "fdt.h"
#include "libsa.h"
-/* $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>
#include "efidev.h"
#include "efiboot.h"
-#include "eficall.h"
#include "fdt.h"
EFI_SYSTEM_TABLE *ST;
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;
{
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()");
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;
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);
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;
}
}
- status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL, (void **)&gop);
+ status = BS->LocateProtocol(&gop_guid, NULL, (void **)&gop);
if (status != EFI_SUCCESS)
return;
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)
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;
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;
}
int
Xexit_efi(void)
{
- EFI_CALL(BS->Exit, IH, 0, 0, NULL);
+ BS->Exit(IH, 0, 0, NULL);
for (;;)
continue;
return (0);
int
Xpoweroff_efi(void)
{
- EFI_CALL(RS->ResetSystem, EfiResetShutdown, EFI_SUCCESS, 0, NULL);
+ RS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
return (0);
}
-/* $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>
#include "libsa.h"
#include <efi.h>
-#include "eficall.h"
extern EFI_BOOT_SERVICES *BS;
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;
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),
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);
}
-/* $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>
*
#include <efi.h>
#include <efiapi.h>
-#include "eficall.h"
#include "efiboot.h"
#include "disk.h"
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;
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;
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;
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;
}
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;
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));
}
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));
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;
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;
}
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;
}
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);
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)
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;
}
if (net == NULL)
return;
- EFI_CALL(net->Shutdown, net);
+ net->Shutdown(net);
}
-/* $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>
#include <efi.h>
#include <efiapi.h>
-#include "eficall.h"
#include "libsa.h"
extern EFI_BOOT_SERVICES *BS;
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;