1 /* 2 * Copyright (C) 2015 Intel Corporation 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 /* THE HAL BOOTCTRL HEADER MUST BE IN SYNC WITH THE UBOOT BOOTCTRL HEADER */ 18 19 #ifndef _BOOTCTRL_H_ 20 #define _BOOTCTRL_H_ 21 22 #include <stdint.h> 23 24 /* struct boot_ctrl occupies the slot_suffix field of 25 * struct bootloader_message */ 26 #define OFFSETOF_SLOT_SUFFIX 864 27 28 #define BOOTCTRL_MAGIC 0x42424100 29 #define BOOTCTRL_SUFFIX_A "_a" 30 #define BOOTCTRL_SUFFIX_B "_b" 31 32 #define BOOT_CONTROL_VERSION 1 33 34 typedef struct slot_metadata { 35 uint8_t priority : 4; 36 uint8_t tries_remaining : 3; 37 uint8_t successful_boot : 1; 38 } slot_metadata_t; 39 40 typedef struct boot_ctrl { 41 /* Magic for identification - '\0ABB' (Boot Contrl Magic) */ 42 uint32_t magic; 43 44 /* Version of struct. */ 45 uint8_t version; 46 47 /* Information about each slot. */ 48 slot_metadata_t slot_info[2]; 49 50 uint8_t recovery_tries_remaining; 51 } boot_ctrl_t; 52 #endif /* _BOOTCTRL_H_ */ 53