blob: fb8f667a3e9bea69047f516f614e9dba9ef86df2 [file] [log] [blame]
// Copyright 2018 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.nand;
using zx;
const uint32 MAX_PARTITIONS = 10;
const uint32 NAME_LEN = 32;
[ForDeprecatedCBindings]
struct Partition {
/// GUID specifying the format and use of data stored in the partition.
array<uint8>:GUID_LEN type_guid;
/// GUID unique to this partition.
array<uint8>:GUID_LEN unique_guid;
/// First and last block occupied by this partition.
uint32 first_block;
uint32 last_block;
/// The number of data copies and offset between each data copy (if relevant).
uint32 copy_count;
uint32 copy_byte_offset;
// A string would break the current requirement for a simple C binding.
array<uint8>:NAME_LEN name;
/// Not a user-visible partition.
bool hidden;
/// Contains a legacy bad block table.
bool bbt;
};
[ForDeprecatedCBindings]
struct PartitionMap {
array<uint8>:GUID_LEN device_guid;
/// Number of partitions in the map.
uint32 partition_count;
array<Partition>:MAX_PARTITIONS partitions;
};
/// Defines how a newly created ram-nand volume should operate.
[ForDeprecatedCBindings]
resource struct RamNandInfo {
/// VMO to use as backing store for nand device. Size should match size of `nand_info`.
/// If a vmo is not provided, the device will create its own buffer and initialize it to be
/// empty (all 1s).
zx.handle:VMO? vmo;
/// The desired "chip" configuration.
Info nand_info;
/// Partition map for the device. This can be left fully empty (as in default-initialized),
/// as long as no metadata has to be exported by the device. If any metadata is required,
/// it will be extracted from this map.
PartitionMap partition_map;
/// If true, export "extra" partition configuration as metadata.
bool export_nand_config;
/// if true, export a boot partition map as metadata.
bool export_partition_map;
/// If non-zero, fail after `fail_after` writes.
uint32 fail_after;
};
[ForDeprecatedCBindings]
protocol RamNandCtl {
/// Creates a new ram-nand device. On success, returns the device's name (not the full
/// topological name, just the last component).
CreateDevice(RamNandInfo info) -> (zx.status status, string:NAME_LEN name);
};
[ForDeprecatedCBindings]
protocol RamNand {
/// Removes the device.
Unlink() -> (zx.status status);
};