summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2023-07-18 09:55:32 -0400
committerTom Rini <[email protected]>2023-07-18 09:55:32 -0400
commit890233ca5569e5787d8407596a12b9fca80952bf (patch)
tree966b9beb01a0ca57045bec4b4da2e16cb792757f /disk
parent13aa090b87a0fbdfe690011669b9fdb96bb1ccc7 (diff)
parent4dc5e26242101f9090209e659e60422634c8bbcf (diff)
Merge branch '2023-07-17-assorted-updates'
- Merge in some Kconfig dependencies fixes, typo fixes, erofs update, shell portability fix, an env save fix, better mbr+gpt support, and some android A/B enhancements.
Diffstat (limited to 'disk')
-rw-r--r--disk/Kconfig8
-rw-r--r--disk/part.c38
2 files changed, 35 insertions, 11 deletions
diff --git a/disk/Kconfig b/disk/Kconfig
index 817b7c8c76d..85496958074 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -51,7 +51,7 @@ config SPL_MAC_PARTITION
config DOS_PARTITION
bool "Enable MS Dos partition table"
- default y if DISTRO_DEFAULTS
+ default y if BOOT_DEFAULTS
default y if x86 || CMD_FAT || USB_STORAGE
select PARTITIONS
help
@@ -67,7 +67,7 @@ config SPL_DOS_PARTITION
config ISO_PARTITION
bool "Enable ISO partition table"
- default y if DISTRO_DEFAULTS
+ default y if BOOT_DEFAULTS
default y if MIPS || ARCH_TEGRA
select PARTITIONS
@@ -91,7 +91,7 @@ config SPL_AMIGA_PARTITION
config EFI_PARTITION
bool "Enable EFI GPT partition table"
- default y if DISTRO_DEFAULTS
+ default y if BOOT_DEFAULTS
default y if ARCH_TEGRA
select PARTITIONS
select LIB_UUID
@@ -139,7 +139,7 @@ config SPL_EFI_PARTITION
config PARTITION_UUIDS
bool "Enable support of UUID for partition"
depends on PARTITIONS
- default y if DISTRO_DEFAULTS
+ default y if BOOT_DEFAULTS
default y if EFI_PARTITION
select LIB_UUID
help
diff --git a/disk/part.c b/disk/part.c
index 1d2117ab71e..0a03b8213d8 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -26,6 +26,22 @@
/* Check all partition types */
#define PART_TYPE_ALL -1
+static struct part_driver *part_driver_get_type(int part_type)
+{
+ struct part_driver *drv =
+ ll_entry_start(struct part_driver, part_driver);
+ const int n_ents = ll_entry_count(struct part_driver, part_driver);
+ struct part_driver *entry;
+
+ for (entry = drv; entry != drv + n_ents; entry++) {
+ if (part_type == entry->part_type)
+ return entry;
+ }
+
+ /* Not found */
+ return NULL;
+}
+
static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc)
{
struct part_driver *drv =
@@ -44,10 +60,7 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc)
}
}
} else {
- for (entry = drv; entry != drv + n_ents; entry++) {
- if (dev_desc->part_type == entry->part_type)
- return entry;
- }
+ return part_driver_get_type(dev_desc->part_type);
}
/* Not found */
@@ -322,8 +335,8 @@ void part_print(struct blk_desc *dev_desc)
drv->print(dev_desc);
}
-int part_get_info(struct blk_desc *dev_desc, int part,
- struct disk_partition *info)
+int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type,
+ struct disk_partition *info)
{
struct part_driver *drv;
@@ -336,7 +349,12 @@ int part_get_info(struct blk_desc *dev_desc, int part,
info->type_guid[0] = 0;
#endif
- drv = part_driver_lookup_type(dev_desc);
+ if (part_type == PART_TYPE_UNKNOWN) {
+ drv = part_driver_lookup_type(dev_desc);
+ } else {
+ drv = part_driver_get_type(part_type);
+ }
+
if (!drv) {
debug("## Unknown partition table type %x\n",
dev_desc->part_type);
@@ -356,6 +374,12 @@ int part_get_info(struct blk_desc *dev_desc, int part,
return -ENOENT;
}
+int part_get_info(struct blk_desc *dev_desc, int part,
+ struct disk_partition *info)
+{
+ return part_get_info_by_type(dev_desc, part, PART_TYPE_UNKNOWN, info);
+}
+
int part_get_info_whole_disk(struct blk_desc *dev_desc,
struct disk_partition *info)
{