xref: /freebsd/sys/amd64/include/efi.h (revision 50cd0be78f3e7fc069f5a06a4dc9aac35a4c0af0)
1559a7b20SKonstantin Belousov /*-
2559a7b20SKonstantin Belousov  * Copyright (c) 2016 The FreeBSD Foundation
3559a7b20SKonstantin Belousov  * All rights reserved.
4559a7b20SKonstantin Belousov  *
5559a7b20SKonstantin Belousov  * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
6559a7b20SKonstantin Belousov  * under sponsorship from the FreeBSD Foundation.
7559a7b20SKonstantin Belousov  *
8559a7b20SKonstantin Belousov  * Redistribution and use in source and binary forms, with or without
9559a7b20SKonstantin Belousov  * modification, are permitted provided that the following conditions
10559a7b20SKonstantin Belousov  * are met:
11559a7b20SKonstantin Belousov  * 1. Redistributions of source code must retain the above copyright
12559a7b20SKonstantin Belousov  *    notice, this list of conditions and the following disclaimer.
13559a7b20SKonstantin Belousov  * 2. Redistributions in binary form must reproduce the above copyright
14559a7b20SKonstantin Belousov  *    notice, this list of conditions and the following disclaimer in the
15559a7b20SKonstantin Belousov  *    documentation and/or other materials provided with the distribution.
16559a7b20SKonstantin Belousov  *
17559a7b20SKonstantin Belousov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18559a7b20SKonstantin Belousov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19559a7b20SKonstantin Belousov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20559a7b20SKonstantin Belousov  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21559a7b20SKonstantin Belousov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22559a7b20SKonstantin Belousov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23559a7b20SKonstantin Belousov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24559a7b20SKonstantin Belousov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25559a7b20SKonstantin Belousov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26559a7b20SKonstantin Belousov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27559a7b20SKonstantin Belousov  * SUCH DAMAGE.
28559a7b20SKonstantin Belousov  *
29559a7b20SKonstantin Belousov  * $FreeBSD$
30559a7b20SKonstantin Belousov  */
31559a7b20SKonstantin Belousov 
32559a7b20SKonstantin Belousov #ifndef __AMD64_INCLUDE_EFI_H_
33559a7b20SKonstantin Belousov #define __AMD64_INCLUDE_EFI_H_
34559a7b20SKonstantin Belousov 
35559a7b20SKonstantin Belousov /*
36559a7b20SKonstantin Belousov  * XXX: from gcc 6.2 manual:
37559a7b20SKonstantin Belousov  * Note, the ms_abi attribute for Microsoft Windows 64-bit targets
38559a7b20SKonstantin Belousov  * currently requires the -maccumulate-outgoing-args option.
395e6f40bdSRyan Libby  *
405e6f40bdSRyan Libby  * Avoid EFIABI_ATTR declarations for compilers that don't support it.
415e6f40bdSRyan Libby  * GCC support began in version 4.4.
42559a7b20SKonstantin Belousov  */
435e6f40bdSRyan Libby #if defined(__clang__) || defined(__GNUC__) && \
445e6f40bdSRyan Libby     (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)
45559a7b20SKonstantin Belousov #define	EFIABI_ATTR	__attribute__((ms_abi))
465e6f40bdSRyan Libby #endif
47559a7b20SKonstantin Belousov 
489674d763SKonstantin Belousov #ifdef _KERNEL
499674d763SKonstantin Belousov #include <isa/rtc.h>
509674d763SKonstantin Belousov 
51d4be3789SKonstantin Belousov #define	EFI_TIME_LOCK()		mtx_lock(&atrtc_time_lock)
52d4be3789SKonstantin Belousov #define	EFI_TIME_UNLOCK()	mtx_unlock(&atrtc_time_lock)
53d4be3789SKonstantin Belousov #define	EFI_TIME_OWNED()	mtx_assert(&atrtc_time_lock, MA_OWNED)
54*50cd0be7SKonstantin Belousov 
55*50cd0be7SKonstantin Belousov #define	EFI_RT_HANDLE_FAULTS_DEFAULT	1
569674d763SKonstantin Belousov #endif
57bc3ad3a1SKonstantin Belousov 
58*50cd0be7SKonstantin Belousov struct efirt_callinfo {
59*50cd0be7SKonstantin Belousov 	const char	*ec_name;
60*50cd0be7SKonstantin Belousov 	register_t	ec_efi_status;
61*50cd0be7SKonstantin Belousov 	register_t	ec_fptr;
62*50cd0be7SKonstantin Belousov 	register_t	ec_argcnt;
63*50cd0be7SKonstantin Belousov 	register_t	ec_arg1;
64*50cd0be7SKonstantin Belousov 	register_t	ec_arg2;
65*50cd0be7SKonstantin Belousov 	register_t	ec_arg3;
66*50cd0be7SKonstantin Belousov 	register_t	ec_arg4;
67*50cd0be7SKonstantin Belousov 	register_t	ec_arg5;
68*50cd0be7SKonstantin Belousov 	register_t	ec_rbx;
69*50cd0be7SKonstantin Belousov 	register_t	ec_rsp;
70*50cd0be7SKonstantin Belousov 	register_t	ec_rbp;
71*50cd0be7SKonstantin Belousov 	register_t	ec_r12;
72*50cd0be7SKonstantin Belousov 	register_t	ec_r13;
73*50cd0be7SKonstantin Belousov 	register_t	ec_r14;
74*50cd0be7SKonstantin Belousov 	register_t	ec_r15;
75*50cd0be7SKonstantin Belousov };
76*50cd0be7SKonstantin Belousov 
77559a7b20SKonstantin Belousov #endif /* __AMD64_INCLUDE_EFI_H_ */
78