blob: a09a83a293106ff13e96775d770be273997f6878 [file] [log] [blame]
Jason Chiu5d247d12023-11-27 16:42:44 +08001/*
2 * Copyright (C) 2021 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#pragma once
18
19namespace android {
20namespace hardware {
21namespace boot {
22namespace V1_2 {
23namespace implementation {
24
25//
26// definitions taken from ABL code
27//
28
29constexpr uint32_t DEVINFO_MAGIC = 0x49564544;
30constexpr size_t DEVINFO_AB_SLOT_COUNT = 2;
31
32struct devinfo_ab_slot_data_t {
33 uint8_t retry_count;
34 uint8_t unbootable : 1;
35 uint8_t successful : 1;
36 uint8_t active : 1;
37 uint8_t fastboot_ok : 1;
38 uint8_t : 4;
39 uint8_t unused[2];
40} __attribute__((packed));
41
42typedef struct {
43 devinfo_ab_slot_data_t slots[DEVINFO_AB_SLOT_COUNT];
44} __attribute__((packed)) devinfo_ab_data_t;
45
46struct devinfo_t {
47 uint32_t magic;
48 uint16_t ver_major;
49 uint16_t ver_minor;
50 uint8_t unused[40];
51 devinfo_ab_data_t ab_data;
52 uint8_t unused1[72]; // use remaining up to complete 128 bytes
53} __attribute__((packed));
54
55static_assert(sizeof(devinfo_t) == 128, "invalid devinfo struct size");
56
57} // namespace implementation
58} // namespace V1_2
59} // namespace boot
60} // namespace hardware
61} // namespace android