FreeBSD/Linux Kernel Cross Reference
sys/sys/efi.h
1 /*-
2 * Copyright (c) 2004 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: releng/11.1/sys/sys/efi.h 317004 2017-04-16 07:21:20Z mmel $
27 */
28
29 #ifndef _SYS_EFI_H_
30 #define _SYS_EFI_H_
31
32 #include <sys/uuid.h>
33 #include <machine/efi.h>
34
35 #define EFI_PAGE_SHIFT 12
36 #define EFI_PAGE_SIZE (1 << EFI_PAGE_SHIFT)
37 #define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1)
38
39 #define EFI_TABLE_ACPI20 \
40 {0x8868e871,0xe4f1,0x11d3,0xbc,0x22,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
41 #define EFI_TABLE_SAL \
42 {0xeb9d2d32,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}}
43
44 enum efi_reset {
45 EFI_RESET_COLD,
46 EFI_RESET_WARM
47 };
48
49 typedef uint16_t efi_char;
50 typedef unsigned long efi_status;
51
52 struct efi_cfgtbl {
53 struct uuid ct_uuid;
54 uint64_t ct_data;
55 };
56
57 struct efi_md {
58 uint32_t md_type;
59 #define EFI_MD_TYPE_NULL 0
60 #define EFI_MD_TYPE_CODE 1 /* Loader text. */
61 #define EFI_MD_TYPE_DATA 2 /* Loader data. */
62 #define EFI_MD_TYPE_BS_CODE 3 /* Boot services text. */
63 #define EFI_MD_TYPE_BS_DATA 4 /* Boot services data. */
64 #define EFI_MD_TYPE_RT_CODE 5 /* Runtime services text. */
65 #define EFI_MD_TYPE_RT_DATA 6 /* Runtime services data. */
66 #define EFI_MD_TYPE_FREE 7 /* Unused/free memory. */
67 #define EFI_MD_TYPE_BAD 8 /* Bad memory */
68 #define EFI_MD_TYPE_RECLAIM 9 /* ACPI reclaimable memory. */
69 #define EFI_MD_TYPE_FIRMWARE 10 /* ACPI NV memory */
70 #define EFI_MD_TYPE_IOMEM 11 /* Memory-mapped I/O. */
71 #define EFI_MD_TYPE_IOPORT 12 /* I/O port space. */
72 #define EFI_MD_TYPE_PALCODE 13 /* PAL */
73 #define EFI_MD_TYPE_PERSISTENT 14 /* Persistent memory. */
74 uint32_t __pad;
75 uint64_t md_phys;
76 void *md_virt;
77 uint64_t md_pages;
78 uint64_t md_attr;
79 #define EFI_MD_ATTR_UC 0x0000000000000001UL
80 #define EFI_MD_ATTR_WC 0x0000000000000002UL
81 #define EFI_MD_ATTR_WT 0x0000000000000004UL
82 #define EFI_MD_ATTR_WB 0x0000000000000008UL
83 #define EFI_MD_ATTR_UCE 0x0000000000000010UL
84 #define EFI_MD_ATTR_WP 0x0000000000001000UL
85 #define EFI_MD_ATTR_RP 0x0000000000002000UL
86 #define EFI_MD_ATTR_XP 0x0000000000004000UL
87 #define EFI_MD_ATTR_NV 0x0000000000008000UL
88 #define EFI_MD_ATTR_MORE_RELIABLE \
89 0x0000000000010000UL
90 #define EFI_MD_ATTR_RO 0x0000000000020000UL
91 #define EFI_MD_ATTR_RT 0x8000000000000000UL
92 };
93
94 #define efi_next_descriptor(ptr, size) \
95 ((struct efi_md *)(((uint8_t *)(ptr)) + (size)))
96
97 struct efi_tm {
98 uint16_t tm_year; /* 1998 - 20XX */
99 uint8_t tm_mon; /* 1 - 12 */
100 uint8_t tm_mday; /* 1 - 31 */
101 uint8_t tm_hour; /* 0 - 23 */
102 uint8_t tm_min; /* 0 - 59 */
103 uint8_t tm_sec; /* 0 - 59 */
104 uint8_t __pad1;
105 uint32_t tm_nsec; /* 0 - 999,999,999 */
106 int16_t tm_tz; /* -1440 to 1440 or 2047 */
107 uint8_t tm_dst;
108 uint8_t __pad2;
109 };
110
111 struct efi_tmcap {
112 uint32_t tc_res; /* 1e-6 parts per million */
113 uint32_t tc_prec; /* hertz */
114 uint8_t tc_stz; /* Set clears sub-second time */
115 };
116
117 struct efi_tblhdr {
118 uint64_t th_sig;
119 uint32_t th_rev;
120 uint32_t th_hdrsz;
121 uint32_t th_crc32;
122 uint32_t __res;
123 };
124
125 struct efi_rt {
126 struct efi_tblhdr rt_hdr;
127 efi_status (*rt_gettime)(struct efi_tm *, struct efi_tmcap *)
128 EFIABI_ATTR;
129 efi_status (*rt_settime)(struct efi_tm *) EFIABI_ATTR;
130 efi_status (*rt_getwaketime)(uint8_t *, uint8_t *,
131 struct efi_tm *) EFIABI_ATTR;
132 efi_status (*rt_setwaketime)(uint8_t, struct efi_tm *)
133 EFIABI_ATTR;
134 efi_status (*rt_setvirtual)(u_long, u_long, uint32_t,
135 struct efi_md *) EFIABI_ATTR;
136 efi_status (*rt_cvtptr)(u_long, void **) EFIABI_ATTR;
137 efi_status (*rt_getvar)(efi_char *, struct uuid *, uint32_t *,
138 u_long *, void *) EFIABI_ATTR;
139 efi_status (*rt_scanvar)(u_long *, efi_char *, struct uuid *)
140 EFIABI_ATTR;
141 efi_status (*rt_setvar)(efi_char *, struct uuid *, uint32_t,
142 u_long, void *) EFIABI_ATTR;
143 efi_status (*rt_gethicnt)(uint32_t *) EFIABI_ATTR;
144 efi_status (*rt_reset)(enum efi_reset, efi_status, u_long,
145 efi_char *) EFIABI_ATTR;
146 };
147
148 struct efi_systbl {
149 struct efi_tblhdr st_hdr;
150 #define EFI_SYSTBL_SIG 0x5453595320494249UL
151 efi_char *st_fwvendor;
152 uint32_t st_fwrev;
153 uint32_t __pad;
154 void *st_cin;
155 void *st_cinif;
156 void *st_cout;
157 void *st_coutif;
158 void *st_cerr;
159 void *st_cerrif;
160 uint64_t st_rt;
161 void *st_bs;
162 u_long st_entries;
163 uint64_t st_cfgtbl;
164 };
165
166 #ifdef _KERNEL
167 extern vm_paddr_t efi_systbl_phys;
168 #endif /* _KERNEL */
169
170 #endif /* _SYS_EFI_H_ */
Cache object: 157d2443e20483ab2fbc923f20d37e81
|