blob: 45b7efad4371c8f24f30ef448c372adb7a1fbce8 [file] [log] [blame]
Jason Chiu5d247d12023-11-27 16:42:44 +08001/*
2 * Copyright (C) 2020 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
19#include <android/hardware/boot/1.2/IBootControl.h>
20#include <hidl/MQDescriptor.h>
21#include <hidl/Status.h>
22
23namespace android {
24namespace hardware {
25namespace boot {
26namespace V1_2 {
27namespace implementation {
28
29using ::android::sp;
30using ::android::hardware::hidl_array;
31using ::android::hardware::hidl_memory;
32using ::android::hardware::hidl_string;
33using ::android::hardware::hidl_vec;
34using ::android::hardware::Return;
35using ::android::hardware::Void;
36
37struct BootControl : public IBootControl {
38 bool Init();
39
40 // Methods from ::android::hardware::boot::V1_0::IBootControl follow.
41 Return<uint32_t> getNumberSlots() override;
42 Return<uint32_t> getCurrentSlot() override;
43 Return<void> markBootSuccessful(markBootSuccessful_cb _hidl_cb) override;
44 Return<void> setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override;
45 Return<void> setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) override;
46 Return<::android::hardware::boot::V1_0::BoolResult> isSlotBootable(uint32_t slot) override;
47 Return<::android::hardware::boot::V1_0::BoolResult> isSlotMarkedSuccessful(
48 uint32_t slot) override;
49 Return<void> getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override;
50
51 // Methods from ::android::hardware::boot::V1_1::IBootControl follow.
52 Return<bool> setSnapshotMergeStatus(
53 ::android::hardware::boot::V1_1::MergeStatus status) override;
54 Return<::android::hardware::boot::V1_1::MergeStatus> getSnapshotMergeStatus() override;
55
56 // Methods from ::android::hardware::boot::V1_2::IBootControl follow.
57 Return<uint32_t> getActiveBootSlot() override;
58
59 // Methods from ::android::hidl::base::V1_0::IBase follow.
60};
61
62// FIXME: most likely delete, this is only for passthrough implementations
63extern "C" IBootControl *HIDL_FETCH_IBootControl(const char *name);
64
65enum otpmgr_command : uint32_t {
66 OTP_REQ_SHIFT = 1,
67 OTP_RESP_BIT = 1,
68 OTP_CMD_write_antirbk_non_secure_ap = (7 << OTP_REQ_SHIFT),
69 OTP_CMD_write_antirbk_secure_ap = (8 << OTP_REQ_SHIFT),
70};
71
72struct otp_mgr_req_base {
73 uint32_t command;
74 uint32_t resp_payload_size;
75 uint8_t handle;
76}__packed;
77
78struct otp_mgr_rsp_base {
79 uint32_t command;
80 uint32_t resp_payload_size;
81 int result;
82}__packed;
83
84} // namespace implementation
85} // namespace V1_2
86} // namespace boot
87} // namespace hardware
88} // namespace android