blob: a54f66d068e191763db3bd4a026f88f30ce24578 [file] [log] [blame]
Jason Chiu33031712023-11-27 16:52:08 +08001/*
2 * Copyright (C) 2023 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 <aidl/android/hardware/boot/BnBootControl.h>
20#include <libboot_control/libboot_control.h>
21
22namespace aidl::android::hardware::boot {
23
24class BootControl final : public BnBootControl {
25 public:
26 BootControl();
27 ::ndk::ScopedAStatus getActiveBootSlot(int32_t* _aidl_return) override;
28 ::ndk::ScopedAStatus getCurrentSlot(int32_t* _aidl_return) override;
29 ::ndk::ScopedAStatus getNumberSlots(int32_t* _aidl_return) override;
30 ::ndk::ScopedAStatus getSnapshotMergeStatus(
31 ::aidl::android::hardware::boot::MergeStatus* _aidl_return) override;
32 ::ndk::ScopedAStatus getSuffix(int32_t in_slot, std::string* _aidl_return) override;
33 ::ndk::ScopedAStatus isSlotBootable(int32_t in_slot, bool* _aidl_return) override;
34 ::ndk::ScopedAStatus isSlotMarkedSuccessful(int32_t in_slot, bool* _aidl_return) override;
35 ::ndk::ScopedAStatus markBootSuccessful() override;
36 ::ndk::ScopedAStatus setActiveBootSlot(int32_t in_slot) override;
37 ::ndk::ScopedAStatus setSlotAsUnbootable(int32_t in_slot) override;
38 ::ndk::ScopedAStatus setSnapshotMergeStatus(
39 ::aidl::android::hardware::boot::MergeStatus in_status) override;
40};
41
42enum otpmgr_command : uint32_t {
43 OTP_REQ_SHIFT = 1,
44 OTP_RESP_BIT = 1,
45 OTP_CMD_write_antirbk_non_secure_ap = (7 << OTP_REQ_SHIFT),
46 OTP_CMD_write_antirbk_secure_ap = (8 << OTP_REQ_SHIFT),
47};
48
49struct otp_mgr_req_base {
50 uint32_t command;
51 uint32_t resp_payload_size;
52 uint8_t handle;
53}__packed;
54
55struct otp_mgr_rsp_base {
56 uint32_t command;
57 uint32_t resp_payload_size;
58 int result;
59}__packed;
60
61} // namespace aidl::android::hardware::boot