summaryrefslogtreecommitdiff
path: root/disk
AgeCommit message (Collapse)Author
2026-03-10disk: fix DOS_PARTITION dependenciesHeinrich Schuchardt
* The symbol for the x86 architecture is CONFIG_X86 and not CONFIG_x86. * Correct the description. The partition type is called MBR. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-02-15disk: part_dos: Refactor to allow retrieving raw MBR partition dataJavier Martinez Canillas
Refactor the part_get_info_extended() helper function (which already recursively traverses DOS partitions) to optionally return the raw MBR partition structure (dos_partition_t). This allows other subsystems, such as EFI, to retrieve the partition details in the legacy MBR format. Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2026-02-15disk: part_dos: Document part_get_info_extended() helper functionJavier Martinez Canillas
The function receives many parameters but these are not documented. Add a description for these to make it easier to follow what it does. Suggested-by: Heinrich Schuchardt <[email protected]> Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2026-02-15disk: part_efi: Remove redundant struct partition definitionJavier Martinez Canillas
Now that dos_partition_t and struct partition are identical, the duplicated data structure definition in the part_efi.h header can just be removed. This results in a single, shared definition for MBR partition table entries, instead of having the same definition in two different places. Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2026-02-15disk: part_dos: Align dos_partition_t with struct partitionJavier Martinez Canillas
The dos_partition_t struct defined in part_dos.h is nearly identical to the struct partition defined in part_efi.h. They differ primarily in how define their starting sector and number of sectors fields. The former uses unsigned char arrays while the latter uses __le32 types. Using __le32 is preferable, as it removes the ambiguity and potential misuse of a raw byte array. This also aligns the structure with how the Linux kernel defines it nowadays, which is the original source of it. To prepare for future consolidation where one of the data structures can be removed, this change aligns both definitions and updates all accessors for dos_partition_t. Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2026-02-15disk: part_dos: Move header to the main include directoryJavier Martinez Canillas
There are two different struct definitions for MBR partition table entries: one in part_dos.h and a nearly identical one in part_efi.h. To enable future consolidation of these two structures, move part_dos.h to the main include directory. This makes it accessible from other parts of the codebase, such as part_efi.h, and is the first step toward removing the redundant definition. Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2026-02-04disk: part: fix partition search boundariesMikhail Kshevetskiy
GPT disk partition with max available number (ex: /dev/mmcblk128) can't be read/write from U-Boot using read/write command. Here is an example: => mmc part Partition Map for mmc device 0 -- Partition Type: EFI Part Start LBA End LBA Name Attributes Type GUID Partition GUID 1 0x00001000 0x000013ff "env1" attrs: 0x0000000000000000 type: 0fc63daf-8483-4772-8e79-3d69d8477de4 guid: 5452574f-2211-4433-5566-778899aabb02 2 0x00001400 0x000017ff "env2" attrs: 0x0000000000000000 type: 0fc63daf-8483-4772-8e79-3d69d8477de4 guid: 5452574f-2211-4433-5566-778899aabb03 ................. 8 0x00158000 0x0034bfff "apps" attrs: 0x0000000000000000 type: 0fc63daf-8483-4772-8e79-3d69d8477de4 guid: 5452574f-2211-4433-5566-778899aabb09 128 0x00000420 0x00000fff "fip" attrs: 0x0000000000000000 type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b guid: 5452574f-2211-4433-5566-778899aabb01 => read mmc 0#fip ${loadaddr} 0 4 Could not find "fip" partition ** Bad device specification mmc 0#fip ** ** Bad device specification mmc 0#fip ** Couldn't find partition mmc 0#fip The error is caused by invalid boundary checks. This patch fixes an issue. Fixes: 43fd4bcefd4e ("disk: part: implement generic function part_get_info_by_uuid()") Fixes: 56670d6fb83f ("disk: part: use common api to lookup part driver") Signed-off-by: Mikhail Kshevetskiy <[email protected]> Acked-by: Quentin Schulz <[email protected]> Reviewed-By: Michael Trimarchi <[email protected]>
2025-12-18Merge tag 'u-boot-socfpga-next-20251217' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-socfpga into next This pull request brings together a set of fixes and enhancements across the SoCFPGA platform family, with a focus on MMC/SPL robustness, EFI boot enablement, and Agilex5 SD/eMMC support. CI: https://source.denx.de/u-boot/custodians/u-boot-socfpga/-/pipelines/28776 Highlights: * SPL / MMC: o Fix Kconfig handling for SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE o Correct raw sector calculations and respect explicit sector values when loading U-Boot from MMC in SPL o Adjust raw MMC loading logic for SoCFPGA platforms * EFI boot: o Permit EFI booting on SoCFPGA platforms o Disable mkeficapsule tool build for Arria 10 where unsupported * Agilex5: o Upgrade SDHCI controller from SD4HC to SD6HC o Enable MMC and Cadence SDHCI support in defconfig o Add dedicated eMMC device tree and defconfig for Agilex5 SoCDK o Revert incorrect GPIO configuration for SDIO_SEL o Refine U-Boot DT handling for SD and eMMC boot variants * SPI: o Allow disabling the DesignWare SPI driver in SPL via Kconfig * Board / configuration fixes: o Enable random MAC address generation for Cyclone V o Fix DE0-Nano-SoC boot configuration o Remove obsolete or conflicting options from multiple legacy SoCFPGA defconfigs
2025-12-17configs: socfpga: Permit EFI bootingJan Kiszka
Commit f369e1564cf4 turned those off because the SPL size grew too large. It also argued that those boards would never support EFI booting. The former is correct, therefore keep CONFIG_SPL_EFI_PARTITION off. CONFIG_SPL_ISO_PARTITION is default off. What is not correct is that those boards are limited to legacy boot - you just need a hybrid partition table to make both the bootrom and UEFI happy. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Tien Fong Chee <[email protected]>
2025-11-18disk/part.c: ensure strings in struct disk_partition are valid after ↵Rasmus Villemoes
successful get_info Not all ->get_info implementations necessarily populate all the string members of struct disk_partition. Currently, only part_get_info_by_type() (and thereby part_get_info) ensure that the uuid strings are initialized; part_get_info_by_type() and part_get_info_by_uuid() do not. In fact, the latter could lead to a false positive match - if the ->get_info backend does not populate info->uuid, stale contents in info could cause the strncasecmp() to succeed. None of the functions currently ensure that the ->name and ->type strings are initialized. Instead of forcing all callers of any of these functions to pre-initialize info, or all implementations of the ->get_info method to ensure there are valid C strings in all four fields, create a small helper function and factor all invocations of ->get_info through that. This also consolidates the -ENOSYS check and standardizes on using log_debug() for reporting absence, instead of the current mix of PRINTF and log_debug(). It does mean we have to special-case -ENOSYS in the error cases inside the loops in the _by_uuid() and _by_name() functions, but it's still a net win in #LOC. Acked-by: Quentin Schulz <[email protected]> Signed-off-by: Rasmus Villemoes <[email protected]> Tested-by: Anshul Dalal <[email protected]>
2025-10-14part: Export part_driver_lookup_type for external useJavier Tia
Make part_driver_lookup_type non-static so it can be used outside part.c. This allows external callers to determine the appropriate partition driver for a block device, enabling more flexible handling of partition types. Add a prototype and kernel-doc comment in part.h to document the function contract. Provide a stub inline implementation returning NULL when partition support is disabled, ensuring build consistency across configurations. Signed-off-by: Javier Tia <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2025-07-10disk/part_dos.c: Make use of LBAF for printing lbaint_tTom Rini
When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness. Signed-off-by: Tom Rini <[email protected]>
2025-07-03disk: efi: expose the part_get_gpt_pte() helper functionJavier Martinez Canillas
This function will be used by the EFI application disk support code to provide data required by the EFI_PARTITION_INFORMATION_PROTOCOL. Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2025-07-03disk: efi: Move logic to get a GPT entry into a helper functionJavier Martinez Canillas
Factor out the logic to get the Partition Table Entry (PTE) of a given partition into a helper function, since it could be used by other code. Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2025-06-02Merge patch series "Audit include list for include/[a-m]*.h"Tom Rini
Tom Rini <[email protected]> says: Hey all, Related to my other series I've posted recently on cleaning up some headers, this series here is the result of at least lightly auditing the #includes used in include/[a-m]*.h. This ignores subdirectories, as at least in part I think the top-level includes we've constructed are the most likely places to have some extra transitive include paths. I'm sure there's exceptions and I'll likely audit deeper once this first pass is done. This only gets as far as "include/m*.h" because I didn't want this to get too big. This also sets aside <miiphy.h> and <phy.h>. While miiphy.h does not directly need <phy.h> there are *so* many users and I think I had half of the tree just about not building when I first tried. It might be worth further investigation, but it might just be OK as-is. Link: https://lore.kernel.org/r/[email protected]
2025-06-02include/ide.h: Cleanup usageTom Rini
At this point in time, <ide.h> provides the IDE_BUS macro and the function prototype for ide_set_reset, which is used with IDE_RESET. The only files which should include this header are the ones that either use that macro or that function. Remove <blk.h> from <ide.h> and remove <ide.h> from places which do not need it. Signed-off-by: Tom Rini <[email protected]>
2025-05-29disk: part: implement generic function part_get_info_by_uuid()Varadarajan Narayanan
Add function to search for a partition by UUID as partition names may not be unique. Signed-off-by: Varadarajan Narayanan <[email protected]> Acked-by: Casey Connolly <[email protected]>
2024-11-20disk: expose partition type flagsCaleb Connolly
GPT partition tables include two bytes worth of vendor defined attributes, per partition. ChromeOS and Qualcomm both use these (with different encoding!) to handle A/B slot switching with a retry counter. Expose these via the disk_partition struct so that they can be parsed by the relevant board code. This will be used on Qualcomm boards to determine which slot we're booting on so that we can flash capsule updates to the correct one. Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-10-29disk: Mark static functions in part_efi.cIlias Apalodimas
Mark all the functions that are only defined locally as static and quiesce W=1 warnings Signed-off-by: Ilias Apalodimas <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]> [trini: Add __maybe_unused as it's now seen as unused in some cases] Signed-off-by: Tom Rini <[email protected]>
2024-10-13Merge branch 'staging' of https://source.denx.de/u-boot/custodians/u-boot-tegraTom Rini
Assorted Tegra enhancements. Merged with the recent XPL_BUILD changes, resolve some whitespace issues and fix the name of the new apalis-tk1 env file by Tom. Signed-off-by: Tom Rini <[email protected]>
2024-10-13disk: add TegraPT supportSvyatoslav Ryhel
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. Signed-off-by: Svyatoslav Ryhel <[email protected]>
2024-10-11global: Rename SPL_TPL_ to PHASE_Simon Glass
Use PHASE_ as the symbol to select a particular XPL build. This means that SPL_TPL_ is no-longer set. Update the comment in bootstage to refer to this symbol, instead of SPL_ Signed-off-by: Simon Glass <[email protected]>
2024-10-11global: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILDSimon Glass
Complete this rename for all directories outside arch/ board/ drivers/ and include/ Use the new symbol to refer to any 'SPL' build, including TPL and VPL Signed-off-by: Simon Glass <[email protected]>
2024-09-12include: export uuid.hCaleb Connolly
Move this header to include/u-boot/ so that it can be used by external tools. Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
2024-08-08disk: don't try search for partition type if already setAlexey Romanov
Block devices can already set partition type at initialization stage, so, in this case is no point in searching for partition type. Signed-off-by: Alexey Romanov <[email protected]> Reviewed-by: Heiko Schocher <[email protected]> Signed-off-by: Michael Trimarchi <[email protected]>
2024-08-08disk: support MTD partitionsAlexey Romanov
Add new MTD partition driver, which can be useful with mtdblock driver combination. Signed-off-by: Alexey Romanov <[email protected]> Signed-off-by: Michael Trimarchi <[email protected]>
2024-07-15disk: Remove duplicate newlinesMarek Vasut
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-07-05Fix Kconfig coding style from spaces to tabAnand Moon
Adjust indentation from spaces to tab (+optional two spaces) as in coding style with command like: $ sed -e 's/^ /\t/' -i */Kconfig Signed-off-by: Anand Moon <[email protected]>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-06part: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "part/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <[email protected]>
2024-04-12disk: simplify print_part_header()Heinrich Schuchardt
Using uclass_get_name() reduces the code size. Signed-off-by: Heinrich Schuchardt <[email protected]>
2024-04-12part: Check all partitions in part_get_info_by_name()Sam Protsenko
In part_get_info_by_name() the inability to get some partition info shouldn't be a reason for dropping out of the loop. That might happen e.g. if the partition is hidden or unused. An example of such case are Samsung devices, where they use the "unused" GUID type (00000000-0000-0000-0000-000000000000) to indicate that the partition should be hidden from the OS. Such partitions might not be seen in "part list" output, which creates "gaps" in numbering in between of the visible partitions: Part Start LBA End LBA Name 1 0x00000400 0x0000a3ff "efs" 5 0x00026420 0x00026c1f "dtbo" 12 0x0003f390 0x0074738f "super" In that case, the loop in part_get_info_by_name() would break after partition #1, so any attempt to obtain "dtbo" or "super" partition will fail. Fix that by continuing to iterate over the remaining partitions to make sure none of the visible ones is missed. That makes "part" command (e.g. "part start", "part size") able to work with such tables. Fixes: 87b8530fe244 ("disk: part: implement generic function part_get_info_by_name()") Signed-off-by: Sam Protsenko <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2023-12-21global: Drop common.h inclusionTom Rini
In order to make it easier to move on to dropping common.h from code directly, remove common.h inclusion from the rest of the header file which had been including it. Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2023-10-24cmd: mbr: Allow 4 MBR partitions without need for extendedAlexander Gendin
Current code allows up to 3 MBR partitions without extended one. If more than 3 partitions are required, then extended partition(s) must be used. This commit allows up to 4 primary MBR partitions without the need for extended partition. Add mbr test unit. In order to run the test manually, mmc6.img file of size 12 MiB or greater is required in the same directory as u-boot. Test also runs automatically via ./test/py/test.py tool. Running mbr test is only supported in sandbox mode. Signed-off-by: Alex Gendin <[email protected]> [ And due to some further changes for testing ] Signed-off-by: Simon Glass <[email protected]>
2023-10-24rockchip: dm: prepare rkmtd UCLASSJohan Jonker
Prepare a rkmtd UCLASS in use for writing Rockchip boot blocks in combination with existing userspace tools and rockusb command. Signed-off-by: Johan Jonker <[email protected]> Reviewed-by: Kever Yang <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-10-10disk: part: Handle blkmap device in print_part_header()Bin Meng
Print out the blkmap device type when showing partition header for a blkmap device. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-10-10disk: part: Print out the unknown device uclass idBin Meng
It's helpful to output the device uclass id for unknown devices during the debugging process. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-09-24common: Drop linux/printk.h from common headerSimon Glass
This old patch was marked as deferred. Bring it back to life, to continue towards the removal of common.h Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <[email protected]>
2023-09-11part: rename disk_partition_type_uuid()Heinrich Schuchardt
Rename disk_partition_type_uuid to disk_partition_type_guid. Provide function descriptions for the getter and setter. Fixes: bcd645428c34 ("part: Add accessors for struct disk_partition type_uuid") Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-08-25part: efi: Add debugging for the signature checkSimon Glass
Add a little more debugging for the initial signature check. Drop the pointless check for NULL. Also set a log category while we are here. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: Add accessors for struct disk_partition type_uuidSimon Glass
This field is only present when a CONFIG is set. To avoid annoying #ifdefs in the source code, add accessors. Update all code to use it. Note that the accessor is optional. It can be omitted if it is known that the option is enabled. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: Add accessors for struct disk_partition uuidSimon Glass
This field is only present when a CONFIG is set. To avoid annoying #ifdefs in the source code, add accessors. Update all code to use it. Note that the accessor is optional. It can be omitted if it is known that the option is enabled. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: Add comments for static functionsSimon Glass
Some internal functions could do with a few comments, to explain what they do. Add these, to make the code easier to follow. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: nac: Use desc instead of dev_descSimon Glass
The dev_ prefix is a hangover from the pre-driver model days. The device is now a different thing, with driver model. Update the mac code to just use 'desc'. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: iso: Use desc instead of dev_descSimon Glass
The dev_ prefix is a hangover from the pre-driver model days. The device is now a different thing, with driver model. Update the iso code to just use 'desc'. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: efi: Use desc instead of dev_descSimon Glass
The dev_ prefix is a hangover from the pre-driver model days. The device is now a different thing, with driver model. Update the efi code to just use 'desc'. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: dos: Use desc instead of dev_descSimon Glass
The dev_ prefix is a hangover from the pre-driver model days. The device is now a different thing, with driver model. Update the dos code to just use 'desc'. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: amiga: Use desc instead of dev_descSimon Glass
The dev_ prefix is a hangover from the pre-driver model days. The device is now a different thing, with driver model. Update the amiga code to just use 'desc'. Signed-off-by: Simon Glass <[email protected]>
2023-08-25part: Use desc instead of dev_descSimon Glass
The dev_ prefix is a hangover from the pre-driver model days. The device is now a different thing, with driver model. Update the partition code to just use 'desc', as is done with driver model. Signed-off-by: Simon Glass <[email protected]>