blob: ba9e178472d679472e4dce18dd413a9ac26172ee [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.hardware.rpmb;
using zx;
using fuchsia.mem;
// RPMB: Replay Protected Memory Block
// RPMB is a secure area included in certain types of storage devices. For more information, see:
/// The RPMB frame size in bytes.
const FRAME_SIZE uint32 = 512;
type EmmcDeviceInfo = struct {
/// The device's CID register.
cid array<uint8, 16>;
/// RPMB_SIZE_MULT from the device's EXT_CSD register.
rpmb_size uint8;
/// REL_WR_SEC_C from the device's EXT_CSD register.
reliable_write_sector_count uint8;
type DeviceInfo = flexible union {
1: emmc_info EmmcDeviceInfo;
/// Represents an RPMB operation, which consists of sending one or more frames then receiving zero
/// or more frames. The tx_frames and rx_frames VMOs will be transferred to the protocol
/// implementation, so clients should keep duplicates of them if access is needed after the call to
/// Request().
/// The request will be aborted as soon as an error is encountered, meaning the read operation will
/// not be performed if the write operation failed. Invalid parameters passed through tx_frames or
/// rx_frames will cause an error to be returned immediately, without either operation having been
/// performed.
type Request = resource struct {
/// May not be null as all operations involve sending at least one frame. tx_frames.size must be
/// a multiple of and at least FRAME_SIZE.
tx_frames fuchsia.mem.Range;
/// May be null if no frames need to be received. rx_frames.size must be a multiple of
/// FRAME_SIZE if rx_frames is not null.
rx_frames box<fuchsia.mem.Range>;
protocol Rpmb {
GetDeviceInfo() -> (struct {
info DeviceInfo;
Request(resource struct {
request Request;
}) -> (struct {}) error zx.status;