1// Copyright 2018 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5library fuchsia.hardware.nand; 6 7using zx; 8 9const uint32 MAX_PARTITIONS = 7; 10const uint32 NAME_LEN = 32; 11 12struct Partition { 13 // GUID specifying the format and use of data stored in the partition. 14 array<uint8>:GUID_LEN type_guid; 15 16 // GUID unique to this partition. 17 array<uint8>:GUID_LEN unique_guid; 18 19 // First and last block occupied by this partition. 20 uint32 first_block; 21 uint32 last_block; 22 23 // The number of data copies and offset between each data copy (if relevant). 24 uint32 copy_count; 25 uint32 copy_byte_offset; 26 27 // A string would break the current requirement for a simple C binding. 28 array<uint8>:NAME_LEN name; 29 30 bool hidden; // Not a user-visible partition. 31 bool bbt; // Contains a legacy bad block table. 32}; 33 34struct PartitionMap { 35 array<uint8>:GUID_LEN device_guid; 36 37 // Number of partitions in the map. 38 uint32 partition_count; 39 array<Partition>:MAX_PARTITIONS partitions; 40}; 41 42// Defines how a newly created ram-nand volume should operate. 43struct RamNandInfo { 44 // VMO to use as backing store for nand device. Size should match size of |nand_info|. 45 // If a vmo is not provided, the device will create its own buffer and initialize it to be 46 // empty (all 1s). 47 handle<vmo>? vmo; 48 49 // The desired "chip" configuration. 50 Info nand_info; 51 52 // Partition map for the device. This can be left fully empty (as in default-initialized), 53 // as long as no metadata has to be exported by the device. If any metadata is required, 54 // it will be extracted from this map. 55 PartitionMap partition_map; 56 57 bool export_nand_config; // If true, export "extra" partition configuration as metadata. 58 bool export_partition_map; // if true, export a boot partition map as metadata. 59}; 60 61[Layout = "Simple"] 62interface RamNandCtl { 63 // Creates a new ram-nand device. On success, returns the device's name (not the full 64 // topological name, just the last component). 65 1: CreateDevice(RamNandInfo info) -> (zx.status status, string:NAME_LEN name); 66}; 67 68[Layout = "Simple"] 69interface RamNand { 70 // Removes the device. 71 1: Unlink() -> (zx.status status); 72}; 73