blob: 70e379d715efdf5f780bfab083318093d6ff3ac7 [file] [log] [blame]
/*
* Copyright (c) 2019 The Fuchsia Authors
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <common.h>
#include <mmc.h>
#include <zircon_uboot/partition_internal.h>
// Does not include 1 LBA for protective MBR for primary GPT copy.
#define GPT_SIZE_LBA 33
const char *zircon_abr_partition_name = "durable_boot";
const zircon_partition_data_t zircon_partition_map[] = {
{
.name = "bootloader",
.type = ZIRCON_PART_TYPE_BOOTLOADER,
.prioritize_over_gpt = true,
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
// Only for reading
.hw_part = MMC_PART_BOOT0,
.lba_offset = 1, // skip boot_info
},
{
.name = "bootloader_0",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_BOOT0,
.lba_offset = 1, // skip boot_info
},
{
.name = "bootloader_1",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_BOOT1,
.lba_offset = 1, // skip boot_info
},
{
.name = "boot_info_0",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_BOOT0,
.lba_offset = 0,
.lba_size = 1,
},
{
.name = "boot_info_1",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_BOOT1,
.lba_offset = 0,
.lba_size = 1,
},
{
.name = "boot0",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_BOOT0,
},
{
.name = "boot1",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_BOOT1,
},
{
.name = "gpt",
.type = ZIRCON_PART_TYPE_GPT,
.prioritize_over_gpt = true,
// Only for reading / erasing
.hw_part = MMC_PART_USER,
.lba_offset = 0,
.lba_size = GPT_SIZE_LBA + 1, // includes protective MBR
},
{
.name = "gpt_primary",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_USER,
.lba_offset = 0,
.lba_size = GPT_SIZE_LBA + 1, // includes protective MBR
},
{
.name = "gpt_backup",
.type = ZIRCON_PART_TYPE_RAW_EMMC,
.prioritize_over_gpt = true,
.hw_part = MMC_PART_USER,
.lba_offset = -GPT_SIZE_LBA,
.lba_size = GPT_SIZE_LBA,
},
// We'll use the GPT info for these partitions, just defined here to
// indicate write-while-locked is OK.
{
// Only erase for durable_boot to reset A/B/R metadata. Changing
// state otherwise should use calls like `set_active` instead of direct
// writes.
.name = "durable_boot",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_ERASE,
},
{
.name = "bootloader_a",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "bootloader_b",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "bootloader_r",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "zircon_a",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "zircon_b",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "zircon_r",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "vbmeta_a",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "vbmeta_b",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "vbmeta_r",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
},
{
.name = "fvm",
.fastboot_locked_access = ZIRCON_PARTITION_ACCESS_FLAG_WRITE,
}
};
const size_t zircon_partition_map_count = ARRAY_SIZE(zircon_partition_map);