]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/efirt.9
MFV r341771,342040,342041:
[FreeBSD/FreeBSD.git] / share / man / man9 / efirt.9
1 .\"-
2 .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 .\"
4 .\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
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 AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .\" $FreeBSD$
28 .\"
29 .Dd August 12, 2018
30 .Dt EFIRT 9
31 .Os
32 .Sh NAME
33 .Nm efirt ,
34 .Nm efi_rt_ok ,
35 .Nm efi_get_table ,
36 .Nm efi_get_time ,
37 .Nm efi_get_time_capabilities ,
38 .Nm efi_reset_system ,
39 .Nm efi_set_time ,
40 .Nm efi_var_get ,
41 .Nm efi_var_nextname ,
42 .Nm efi_var_set
43 .Nd kernel access to UEFI runtime services
44 .Sh SYNOPSIS
45 .Cd "options EFIRT"
46 .Pp
47 .In sys/efi.h
48 .Ft int
49 .Fn efi_rt_ok "void"
50 .Ft int
51 .Fn efi_get_table "struct uuid *uuid" "void **ptr"
52 .Ft int
53 .Fn efi_get_time "struct efi_tm *tm"
54 .Ft int
55 .Fn efi_get_time_capabilities "struct efi_tmcap *tmcap"
56 .Ft int
57 .Fn efi_reset_system "void"
58 .Ft int
59 .Fn efi_set_time "struct efi_tm *tm"
60 .Ft int
61 .Fn efi_var_get "uint16_t *name" "struct uuid *vendor" "uint32_t *attrib" \
62     "size_t *datasize" "void *data"
63 .Ft int
64 .Fn efi_var_nextname "size_t *namesize" "uint16_t *name" "struct uuid *vendor"
65 .Ft int
66 .Fn efi_var_set "uint16_t *name" "struct uuid *vendor" "uint32_t *attrib" \
67     "size_t *datasize" "void *data"
68 .Sh DESCRIPTION
69 All of the following calls will return
70 .Dv ENXIO
71 if UEFI runtime services are not available.
72 .Nm
73 is currently only available on amd64 and arm64.
74 .Pp
75 The
76 .Fn efi_rt_ok
77 Returns 0 if UEFI runtime services are present and functional, or
78 .Dv ENXIO
79 if not.
80 .Pp
81 The
82 .Fn efi_get_table
83 function gets a table by uuid from the UEFI system table.
84 Returns 0 if the table was found and populates *ptr with the address.
85 Returns
86 .Dv ENXIO
87 if the configuration table or system table are unset.
88 Returns
89 .Dv ENOENT
90 if the requested table cannot be found.
91 .Pp
92 The
93 .Fn efi_get_time
94 function gets the current time from the RTC, if available.
95 Returns 0 and populates the
96 .Vt struct efi_tm
97 on success.
98 Returns
99 .Dv EINVAL
100 if the
101 .Vt struct efi_tm
102 is
103 .Dv NULL ,
104 or
105 .Dv EIO
106 if the time could not be retrieved due to a hardware error.
107 .Pp
108 The
109 .Fn efi_get_time_capabilities
110 function gets the capabilities from the RTC.
111 Returns 0 and populates the
112 .Vt struct efi_tmcap
113 on success.
114 Returns
115 .Dv EINVAL
116 if the
117 .Vt struct efi_tm
118 is
119 .Dv NULL ,
120 or
121 .Dv EIO
122 if the time could not be retrieved due to a hardware error.
123 .Pp
124 The
125 .Fn efi_reset_system
126 function requests a warm reset and reboot of the system.
127 .Pp
128 The
129 .Fn efi_set_time
130 function sets the time on the RTC to the time described by the
131 .Vt struct efi_tm
132 passed in.
133 Returns 0 on success,
134 .Dv EINVAL
135 if a time field is out of range, or
136 .Dv EIO
137 if the time could not be set due to a hardware error.
138 .Pp
139 The
140 .Fn efi_var_get
141 function fetches the variable identified by
142 .Fa vendor
143 and
144 .Fa name .
145 Returns 0 and populates
146 .Fa attrib ,
147 .Fa datasize ,
148 and
149 .Fa data
150 on success.
151 Otherwise, one of the following errors are returned:
152 .Bl -tag -width ".Dv EOVERFLOW"
153 .It Dv ENOENT
154 The variable was not found.
155 .It Dv EOVERFLOW
156 .Fa datasize
157 is not sufficient to hold the variable data.
158 .Fa namesize
159 is updated to reflect the size needed to complete the request.
160 .It Dv EINVAL
161 One of
162 .Fa name ,
163 .Fa vendor ,
164 or
165 .Fa datasize
166 are NULL.
167 Alternatively,
168 .Fa datasize
169 is large enough to hold the response but
170 .Fa data
171 is NULL.
172 .It Dv EIO
173 The variable could not be retrieved due to a hardware error.
174 .It Dv EDOOFUS
175 The variable could not be retireved due to an authentication failure.
176 .El
177 .Pp
178 The
179 .Fn efi_var_nextname
180 function is used for enumeration of variables.
181 On the initial call to
182 .Fn efi_var_nextname ,
183 .Fa name
184 should be an empty string.
185 Subsequent calls should pass in the last
186 .Fa name
187 and
188 .Fa vendor
189 returned until
190 .Dv ENOENT
191 is returned.
192 Returns 0 and populates
193 .Fa namesize ,
194 .Fa name ,
195 and
196 .Fa vendor
197 with the next variable's data.
198 Otherwise, returns one of the following errors:
199 .Bl -tag -width ".Dv EOVERFLOW"
200 .It Dv ENOENT
201 The next variable was not found.
202 .It Dv EOVERFLOW
203 .Fa datasize
204 is not sufficient to hold the variable data.
205 .Fa namesize
206 is updated to reflect the size needed to complete the request.
207 .It Dv EINVAL
208 One of
209 .Fa name ,
210 .Fa vendor ,
211 or
212 .Fa datasize
213 are NULL.
214 .It Dv EIO
215 The variable could not be retrieved due to a hardware error.
216 .El
217 .Pp
218 The
219 .Fn efi_var_set
220 function sets the variable described by
221 .Fa name
222 and
223 .Fa vendor .
224 Returns 0 if the variable has been successfully.
225 Otherwise, returns one of the following errors:
226 .Bl -tag -width ".Dv EOVERFLOW"
227 .It Dv EINVAL
228 Either
229 .Fa attrib
230 was an invalid combination of attributes,
231 .Fa datasize
232 exceeds the maximum allowed size, or
233 .Fa name
234 is an empty Unicode stirng.
235 .It Dv EAGAIN
236 Not enough storage is available to hold the variable and its data.
237 .It Dv EIO
238 The variable could not be saved due to a hardware error.
239 .It Dv EROFS
240 The variable in question is read-only or may not be deleted.
241 .It Dv EDOOFUS
242 The varialbe could not be set due to an authentication failure.
243 .It Dv ENOENT
244 The variable trying to be updated or deleted was not found.
245 .El
246 .Sh SEE ALSO
247 .Xr efidev 4
248 .Sh AUTHORS
249 This manual page was written by
250 .An Kyle Evans Aq Mt kevans@FreeBSD.org .