/*-1* Copyright (c) 2016 The FreeBSD Foundation2*3* This software was developed by Konstantin Belousov <[email protected]>4* under sponsorship from the FreeBSD Foundation.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#ifndef __AMD64_INCLUDE_EFI_H_29#define __AMD64_INCLUDE_EFI_H_3031#include <sys/types.h>3233/*34* XXX: from gcc 6.2 manual:35* Note, the ms_abi attribute for Microsoft Windows 64-bit targets36* currently requires the -maccumulate-outgoing-args option.37*38* Avoid EFIABI_ATTR declarations for compilers that don't support it.39* GCC support began in version 4.4.40*/41#if defined(__clang__) || defined(__GNUC__) && \42(__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)43#define EFIABI_ATTR __attribute__((ms_abi))44#endif4546#ifdef _KERNEL47#include <isa/rtc.h>48#define ARCH_MAY_USE_EFI4950#define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock)51#define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock)52#define EFI_TIME_OWNED() mtx_assert(&atrtc_time_lock, MA_OWNED)5354#define EFI_RT_HANDLE_FAULTS_DEFAULT 15556#define EFI_MAP_BOOTTYPE_ALLOWED(type) (((efi_map_regs >> (type)) & 1) != 0)5758extern uint32_t efi_map_regs;59#endif6061struct efirt_callinfo {62const char *ec_name;63register_t ec_efi_status;64register_t ec_fptr;65register_t ec_argcnt;66register_t ec_arg1;67register_t ec_arg2;68register_t ec_arg3;69register_t ec_arg4;70register_t ec_arg5;71register_t ec_rbx;72register_t ec_rsp;73register_t ec_rbp;74register_t ec_r12;75register_t ec_r13;76register_t ec_r14;77register_t ec_r15;78register_t ec_rflags;79};8081#endif /* __AMD64_INCLUDE_EFI_H_ */828384