blob: 0fe8f483ce3da162dc58d40f2c82900b7b92daaf [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.
@available(added=HEAD)
library fuchsia.hardware.nand;
// Matches the value of ZBI_PARTITION_GUID_LEN.
const GUID_LEN uint32 = 16;
const MAX_PARTITION_COUNT uint32 = 10;
type Class = strict enum : uint32 {
UNKNOWN = 0; // Unknown device.
PARTMAP = 1; // NAND device contains multiple partitions.
FTL = 2; // NAND device is a FTL partition.
BBS = 3; // NAND device is a bad block skip partition.
TEST = 4; // Test device.
/// NAND device contains an Intel flash descriptor.
INTEL_FLASH_DESCRIPTOR = 5;
};
type Info = struct {
page_size uint32; // Read/write unit size, in bytes.
pages_per_block uint32; // Erase block size, in pages.
num_blocks uint32; // Device size, in erase blocks.
ecc_bits uint32; // Number of ECC bits (correctable bit flips),
// per correction chunk.
oob_size uint32; // Available out of band bytes per page.
nand_class Class; // The device purpose.
partition_guid array<uint8, GUID_LEN>; // Partition type GUID from partition map.
};
type BadBlockConfigType = strict enum : uint32 {
AMLOGIC_UBOOT = 0;
SYNAPTICS = 1;
};
type BadBlockConfig = struct {
type BadBlockConfigType;
/// First block in which BBT may be be found.
table_start_block uint32;
/// Last block in which BBT may be be found. It is inclusive.
table_end_block uint32;
};
/// Describes extra partition information that is not described by the partition map.
type PartitionConfig = struct {
type_guid array<uint8, GUID_LEN>;
/// The number of copies.
copy_count uint32;
/// Offset each copy resides from each other.
copy_byte_offset uint32;
};
@serializable
type Config = struct {
bad_block_config BadBlockConfig;
extra_partition_configs vector<PartitionConfig>:MAX_PARTITION_COUNT;
};