Add Exynos bootctrl hal
[GitHub/moto-9609/twrp_device_motorola_troika.git] / bootctrl / bctl_metadata.h
1 /*
2 * Copyright (C) 2020 The LineageOS 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 #ifndef SAMSUNG_BCTL_METADATA_H
18 #define SAMSUNG_BCTL_METADATA_H
19
20 #include <iostream>
21
22 #define BCTL_METADATA_PARTITION "/dev/block/bootdevice/by-name/slotinfo"
23 #define BCTL_METADATA_OFFSET 0x800
24 #define BCTL_METADATA_MAGIC 0x43425845
25
26 #define SLOT_SUFFIX_A "_a"
27 #define SLOT_SUFFIX_B "_b"
28
29 // Our internal data structures
30 struct slot_metadata_t {
31 uint32_t magic;
32 uint8_t bootable;
33 uint8_t is_active;
34 uint8_t boot_successful;
35 uint8_t tries_remaining;
36 uint8_t reserved[8];
37 };
38
39 struct bctl_metadata_t {
40 slot_metadata_t slot_info[2];
41 };
42
43 #endif // SAMSUNG_BCTL_METADATA_H