blob: 1e6aadc8f922079b2e0f7936dd1040a2adb47577 [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;
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;
bool hidden; // Not a user-visible partition.
bool bbt; // Contains a legacy bad block table.
};
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.
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).
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;
bool export_nand_config; // If true, export "extra" partition configuration as metadata.
bool export_partition_map; // if true, export a boot partition map as metadata.
};
[Layout = "Simple"]
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);
};
[Layout = "Simple"]
protocol RamNand {
// Removes the device.
Unlink() -> (zx.status status);
};