| /* | |
| * Copyright (C) 2024 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, embodiment or | |
| * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| * KIND, either express or implied. See the License for the specific language | |
| * governing permissions and limitations under the License. | |
| * | |
| * SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause-Patent | |
| * | |
| * This file is dual-licensed under Apache 2.0 and BSD-2-Clause-Patent. | |
| * You may choose to use this file under the terms of either: | |
| * (a) the Apache License, Version 2.0, or | |
| * (b) the BSD 2-Clause Patent License. | |
| * | |
| * Unless you expressly elect the BSD-2-Clause-Patent terms, the Apache-2.0 | |
| * license terms apply by default. | |
| */ | |
| #ifndef __GBL_EFI_FASTBOOT_PROTOCOL_H__ | |
| #define __GBL_EFI_FASTBOOT_PROTOCOL_H__ | |
| #include <efi_api.h> | |
| #include <gbl_efi_common.h> | |
| #define GBL_EFI_FASTBOOT_PROTOCOL_GUID \ | |
| EFI_GUID(0xc67e48a0, 0x5eb8, 0x4127, 0xbe, 0x89, 0xdf, 0x2e, 0xd9, \ | |
| 0x3d, 0x8a, 0x9a) | |
| #define GBL_EFI_FASTBOOT_PROTOCOL_REVISION GBL_PROTOCOL_REVISION(1, 0) | |
| #define GBL_EFI_FASTBOOT_SERIAL_NUMBER_MAX_LEN_UTF8 32 | |
| typedef void (*GetVarAllCallback)(void* context, size_t num_args, | |
| const char *const *args, | |
| const char *val); | |
| EFI_ENUM(GblEfiFastbootMessageType, uint32_t, | |
| GBL_EFI_FASTBOOT_MESSAGE_TYPE_OKAY, | |
| GBL_EFI_FASTBOOT_MESSAGE_TYPE_FAIL, | |
| GBL_EFI_FASTBOOT_MESSAGE_TYPE_INFO); | |
| typedef efi_status_t (*FastbootMessageSender)(void* context, | |
| GblEfiFastbootMessageType msg_type, | |
| size_t msg_len, const char *msg); | |
| EFI_ENUM(GblEfiFastbootCommandExecResult, uint32_t, | |
| GBL_EFI_FASTBOOT_COMMAND_EXEC_RESULT_PROHIBITED, | |
| GBL_EFI_FASTBOOT_COMMAND_EXEC_RESULT_DEFAULT_IMPL, | |
| GBL_EFI_FASTBOOT_COMMAND_EXEC_RESULT_CUSTOM_IMPL); | |
| typedef struct GblEfiFastbootProtocol { | |
| uint64_t revision; | |
| char serial_number[GBL_EFI_FASTBOOT_SERIAL_NUMBER_MAX_LEN_UTF8]; | |
| efi_status_t (*get_var)(struct GblEfiFastbootProtocol *self, | |
| size_t num_args, const char *const *args, | |
| size_t *buffer_size, char *buffer); | |
| efi_status_t (*get_var_all)(struct GblEfiFastbootProtocol *self, | |
| void *context, GetVarAllCallback cb); | |
| efi_status_t (*get_staged)(struct GblEfiFastbootProtocol *self, | |
| size_t *buffer_size, size_t *buffer_remains, | |
| uint8_t *buffer); | |
| efi_status_t (*command_exec)(struct GblEfiFastbootProtocol *self, | |
| size_t num_args, const char *const *args, | |
| size_t download_buffer_size, | |
| size_t download_buffer_used_size, | |
| uint8_t *download_buffer, | |
| GblEfiFastbootCommandExecResult *implementation, | |
| FastbootMessageSender sender, void *context); | |
| efi_status_t (*get_partition_type)(struct GblEfiFastbootProtocol *self, | |
| const char *part_name, | |
| size_t *part_type_len, char *part_type); | |
| } GblEfiFastbootProtocol; | |
| #endif /* __GBL_EFI_FASTBOOT_PROTOCOL_H__ */ |