Skip to contentSkip to conversation

disk: add TegraPT support

PATCH Superseded Svyatoslav Ryhel 1 participant 2 messages Aug 1, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover disk: add TegraPT support

Production Tegra20/30/114/124/132 devices use Nvidia's own partition table, which makes them a bit complicated to deal with. Luckily, it is compatible with the existing EFI partition already available in U-Boot, apart from the fact that it cannot pass Protective MBR check.

In order to address this without unwanted code additions, I have come up with this solution.

Svyatoslav Ryhel (1):
disk: add TegraPT support

 disk/Kconfig    |  8 ++++++++
 disk/part_efi.c | 13 +++++++++++++
 2 files changed, 21 insertions(+)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 disk: add TegraPT support

TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if CONFIG_TEGRA_PARTITION is enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.

---
 disk/Kconfig    |  8 ++++++++
 disk/part_efi.c | 13 +++++++++++++
 2 files changed, 21 insertions(+)
disk/Kconfig +8 -0
index ffa835eb35..75a849ec8c 100644
@@ -49,6 +49,14 @@ config SPL_MAC_PARTITION
 	default y if MAC_PARTITION
 	select SPL_PARTITIONS
 
+config TEGRA_PARTITION
+	bool "Enable Nvidia Tegra partition table"
+	select PARTITIONS
+	select EFI_PARTITION
+	help
+	  Say Y here if you would like to use U-Boot on a device with
+	  Nvidia Tegra partition table.
+
 config DOS_PARTITION
 	bool "Enable MS Dos partition table"
 	default y if BOOT_DEFAULTS
disk/part_efi.c +13 -0
index b1a03bd165..3afc871409 100644
@@ -318,6 +318,19 @@ static int part_test_efi(struct blk_desc *desc)
 	/* Read legacy MBR from block 0 and validate it */
 	if ((blk_dread(desc, 0, 1, (ulong *)legacymbr) != 1)
 		|| (is_pmbr_valid(legacymbr) != 1)) {
+
+		/*
+		 * TegraPT is compatible with EFI part but it
+		 * cannot pass Protective MBR check. Skip it
+		 * if CONFIG_TEGRA_PARTITION is enabled and
+		 * device is question is eMMC.
+		 */
+		if (IS_ENABLED(CONFIG_TEGRA_PARTITION))
+			if (!is_pmbr_valid(legacymbr) &&
+			    desc->uclass_id == UCLASS_MMC &&
+			    !desc->devnum)
+				return 0;
+
 		return -1;
 	}
 	return 0;
Signature · 1 line
2.43.0