1 /*
2  * Copyright (C) 2025 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __VARIABLE_MEM_
19 #define __VARIABLE_MEM_
20 
21 #include <uefi/types.h>
22 
23 static constexpr auto EFI_GLOBAL_VARIABLE_GUID =
24     EfiGuid{0x8be4df61,
25             0x93ca,
26             0x11d2,
27             {0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c}};
28 
29 static constexpr uint32_t EFI_VARIABLE_NON_VOLATILE = 0x01;
30 static constexpr uint32_t EFI_VARIABLE_BOOTSERVICE_ACCESS = 0x02;
31 static constexpr uint32_t EFI_VARIABLE_RUNTIME_ACCESS = 0x04;
32 static constexpr uint32_t EFI_VARIABLE_HARDWARE_ERROR_RECORD = 0x08;
33 
34 EfiStatus efi_get_variable(const char16_t *variable_name,
35                            const EfiGuid *guid,
36                            uint32_t *attribute,
37                            char **data,
38                            size_t *data_size);
39 void efi_set_variable(const char16_t *variable_name,
40                       const EfiGuid *guid,
41                       uint32_t attribute,
42                       const char *data,
43                       size_t data_len);
44 
45 void efi_list_variable(void);
46 #endif
47