1559a7b20SKonstantin Belousov /*- 2559a7b20SKonstantin Belousov * Copyright (c) 2016 The FreeBSD Foundation 3559a7b20SKonstantin Belousov * 4559a7b20SKonstantin Belousov * This software was developed by Konstantin Belousov <kib@FreeBSD.org> 5559a7b20SKonstantin Belousov * under sponsorship from the FreeBSD Foundation. 6559a7b20SKonstantin Belousov * 7559a7b20SKonstantin Belousov * Redistribution and use in source and binary forms, with or without 8559a7b20SKonstantin Belousov * modification, are permitted provided that the following conditions 9559a7b20SKonstantin Belousov * are met: 10559a7b20SKonstantin Belousov * 1. Redistributions of source code must retain the above copyright 11559a7b20SKonstantin Belousov * notice, this list of conditions and the following disclaimer. 12559a7b20SKonstantin Belousov * 2. Redistributions in binary form must reproduce the above copyright 13559a7b20SKonstantin Belousov * notice, this list of conditions and the following disclaimer in the 14559a7b20SKonstantin Belousov * documentation and/or other materials provided with the distribution. 15559a7b20SKonstantin Belousov * 16559a7b20SKonstantin Belousov * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17559a7b20SKonstantin Belousov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18559a7b20SKonstantin Belousov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19559a7b20SKonstantin Belousov * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20559a7b20SKonstantin Belousov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21559a7b20SKonstantin Belousov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22559a7b20SKonstantin Belousov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23559a7b20SKonstantin Belousov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24559a7b20SKonstantin Belousov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25559a7b20SKonstantin Belousov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26559a7b20SKonstantin Belousov * SUCH DAMAGE. 27559a7b20SKonstantin Belousov */ 28559a7b20SKonstantin Belousov 29559a7b20SKonstantin Belousov #ifndef __AMD64_INCLUDE_EFI_H_ 30559a7b20SKonstantin Belousov #define __AMD64_INCLUDE_EFI_H_ 31559a7b20SKonstantin Belousov 32559a7b20SKonstantin Belousov /* 33559a7b20SKonstantin Belousov * XXX: from gcc 6.2 manual: 34559a7b20SKonstantin Belousov * Note, the ms_abi attribute for Microsoft Windows 64-bit targets 35559a7b20SKonstantin Belousov * currently requires the -maccumulate-outgoing-args option. 365e6f40bdSRyan Libby * 375e6f40bdSRyan Libby * Avoid EFIABI_ATTR declarations for compilers that don't support it. 385e6f40bdSRyan Libby * GCC support began in version 4.4. 39559a7b20SKonstantin Belousov */ 405e6f40bdSRyan Libby #if defined(__clang__) || defined(__GNUC__) && \ 415e6f40bdSRyan Libby (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4) 42559a7b20SKonstantin Belousov #define EFIABI_ATTR __attribute__((ms_abi)) 435e6f40bdSRyan Libby #endif 44559a7b20SKonstantin Belousov 459674d763SKonstantin Belousov #ifdef _KERNEL 469674d763SKonstantin Belousov #include <isa/rtc.h> 47*a29bff7aSGreg V #define ARCH_MAY_USE_EFI 489674d763SKonstantin Belousov 49d4be3789SKonstantin Belousov #define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock) 50d4be3789SKonstantin Belousov #define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock) 51d4be3789SKonstantin Belousov #define EFI_TIME_OWNED() mtx_assert(&atrtc_time_lock, MA_OWNED) 5250cd0be7SKonstantin Belousov 5350cd0be7SKonstantin Belousov #define EFI_RT_HANDLE_FAULTS_DEFAULT 1 549674d763SKonstantin Belousov #endif 55bc3ad3a1SKonstantin Belousov 5650cd0be7SKonstantin Belousov struct efirt_callinfo { 5750cd0be7SKonstantin Belousov const char *ec_name; 5850cd0be7SKonstantin Belousov register_t ec_efi_status; 5950cd0be7SKonstantin Belousov register_t ec_fptr; 6050cd0be7SKonstantin Belousov register_t ec_argcnt; 6150cd0be7SKonstantin Belousov register_t ec_arg1; 6250cd0be7SKonstantin Belousov register_t ec_arg2; 6350cd0be7SKonstantin Belousov register_t ec_arg3; 6450cd0be7SKonstantin Belousov register_t ec_arg4; 6550cd0be7SKonstantin Belousov register_t ec_arg5; 6650cd0be7SKonstantin Belousov register_t ec_rbx; 6750cd0be7SKonstantin Belousov register_t ec_rsp; 6850cd0be7SKonstantin Belousov register_t ec_rbp; 6950cd0be7SKonstantin Belousov register_t ec_r12; 7050cd0be7SKonstantin Belousov register_t ec_r13; 7150cd0be7SKonstantin Belousov register_t ec_r14; 7250cd0be7SKonstantin Belousov register_t ec_r15; 73185f7e0aSKonstantin Belousov register_t ec_rflags; 7450cd0be7SKonstantin Belousov }; 7550cd0be7SKonstantin Belousov 76559a7b20SKonstantin Belousov #endif /* __AMD64_INCLUDE_EFI_H_ */ 77