summaryrefslogtreecommitdiff
path: root/include/part.h
AgeCommit message (Collapse)AuthorFilesLines
2022-01-19doc: replace @return by Return:Heinrich Schuchardt1-19/+19
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-15cmd: part: list all 128 GPT partitionsHeinrich Schuchardt1-1/+1
A GPT partition table typically has 128 entries. If a partition table contains a partition 128 'part list' should be able to list it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-09-30WS cleanup: remove SPACE(s) followed by TABWolfgang Denk1-1/+1
Signed-off-by: Wolfgang Denk <wd@denx.de>
2021-04-22cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitionsSean Anderson1-1/+11
This allows using dev#partlabel syntax. Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2021-02-26part: Support getting whole disk from part_get_info_by_dev_and_name_or_numSean Anderson1-1/+5
This adds an option to part_get_info_by_dev_and_name_or_num to allow callers to specify whether whole-disk partitions are fine. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-16cmd: gpt: add eMMC and GPT supportCorneliu Doban1-0/+29
Add eMMC and GPT support. - GPT partition list and command to create the GPT added to u-boot environment - eMMC boot commands added to u-boot environment - new gpt commands (enumarate and setenv) that are used by broadcom update scripts and boot commands - eMMC specific u-boot configurations with environment saved in eMMC and GPT support Signed-off-by: Corneliu Doban <cdoban@broadcom.com> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> [trini: Make gpt_setenv initialize ret to -1, given relevant return error values] Signed-off-by: Tom Rini <trini@konsulko.com>
2021-01-15disk: dos: add code for creating MBR partition layoutMarek Szyprowski1-0/+5
Add a code for creating and writing MBR partition layout. The code generates similar layout of EBRs (Exteneded Block Records) and logical volumes as Linux's fdisk utility. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
2021-01-15disk: dos: rename write_mbr_partition to write_mbr_sectorMarek Szyprowski1-2/+2
write_mbr_partition() function name is a bit misleading, so rename it to write_mbr_sector(). This is a preparation for adding code for writing a complete MBR partition layout. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
2020-05-19part: Drop disk_partition_t typedefSimon Glass1-19/+21
We should not be using typedefs and these make it harder to use forward declarations (to reduce header file inclusions). Drop the typedef. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-30part: detect EFI system partitionHeinrich Schuchardt1-1/+10
Up to now for MBR and GPT partitions the info field 'bootable' was set to 1 if either the partition was an EFI system partition or the bootable flag was set. Turn info field 'bootable' into a bit mask with separate bits for bootable and EFI system partition. This will allow us to identify the EFI system partition in the UEFI sub-system. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-24disk: part: Extend API to get partition infoRuslan Trofymenko1-0/+21
This patch adds part_get_info_by_dev_and_name_or_num() function which allows us to get partition info from its number or name. Partition of interest is specified by string like "device_num:partition_number" or "device_num#partition_name". The patch was extracted from [1]. [1] https://android-review.googlesource.com/c/platform/external/u-boot/+/729880/2 Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com> Reviewed-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-02-01spl: Kconfig: Replace CONFIG_SPL_EXT_SUPPORT to CONFIG_SPL_FS_EXT4Tien Fong Chee1-1/+1
Replace CONFIG_SPL_EXT_SUPPORT to CONFIG_SPLY_FS_EXT4 so both obj-$(CONFIG_$(SPL_)FS_EXT4) and CONFIG_IS_ENABLED(FS_EXT4) can be used to control the build in both SPL and U-Boot. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-02-01spl: Kconfig: Replace CONFIG_SPL_FAT_SUPPORT with CONFIG_SPL_FS_FATTien Fong Chee1-1/+1
Replace CONFIG_SPL_FAT_SUPPORT with CONFIG_SPL_FS_FAT so obj-$(CONFIG_$(SPL_)FS_FAT) can be used to control the build in both SPL and U-Boot. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-06disk: Provide API to get partition by name for specific typeSam Protsenko1-0/+15
There is already existing function part_get_info_by_name(). But sometimes user is particularly interested in looking for only specific partition type. This patch implements such an API that provides partition searching by name for specified partition type. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-20part: move efi_guid_tRob Clark1-1/+2
Prep work for next patch. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-15fs: add fs_readdir()Rob Clark1-0/+9
Needed to support efi file protocol. The fallback.efi loader wants to be able to read the contents of the /EFI directory to find an OS to boot. Modelled after POSIX opendir()/readdir()/closedir(). Unlike the other fs APIs, this is stateful (ie. state is held in the FS_DIR "directory stream"), to avoid re-traversing of the directory structure at each step. The directory stream must be released with closedir() when it is no longer needed. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Ɓukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-03part: efi: make gpt_fill_pte take the device descriptorMaxime Ripard1-2/+4
The gpt_fill_pte will need to access the device block size. Let's pass the device descriptor as an argument. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-05GPT: read partition table from device into a data structureAlison Chaiken1-0/+7
Make the partition table available for modification by reading it from the user-specified device into a linked list. Provide an accessor function for command-line testing. Signed-off-by: Alison Chaiken <alison@peloton-tech.com> [trini: Make this depend on CMD_GPT_RENAME, as it is the user of this code] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-08-04GPT: add accessor function for disk GUIDAlison Chaiken1-0/+15
In order to read the GPT, modify the partition name strings, and then write out a new GPT, the disk GUID is needed. While there is an existing accessor for the partition UUIDs, there is none yet for the disk GUID. Changes since v6: none. Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-08-04partitions: increase MAX_SEARCH_PARTITIONS and move to part.hAlison Chaiken1-0/+1
Move MAX_SEARCH_PARTITIONS to part.h so that functions in cmd directory can find it. At the same time, increase the value to 64 since some operating systems use many, and the resources consumed by a larger value are minimal. Changes since v6: none. Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-08-04disk_partition: introduce macros for description string lengthsAlison Chaiken1-2/+5
Changes since v6: none. Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-08-04EFI: replace number with UUID_STR_LEN macroAlison Chaiken1-2/+3
Changes since v6: none. Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-05-12disk: Return the partition number in part_get_info_by_name()Alex Deymo1-1/+2
Similar to what blk_get_device_part_str() does, this patch makes part_get_info_by_name() return the partition number in case of a match. This is useful when the partition number is needed and not just the descriptor. Signed-off-by: Alex Deymo <deymo@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-02-17SPL: add support to boot from a partition typeDalon Westergreen1-0/+3
the socfpga bootrom supports mmc booting from either a raw image starting at 0x0, or from a partition of type 0xa2. This patch adds support for locating the boot image in the first type 0xa2 partition found. Assigned a partition number of -1 will cause a search for a partition of type CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE and use it to find the u-boot image Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
2017-01-28cmd, disk: convert CONFIG_PARTITION_UUIDS, CMD_PART and CMD_GPTPatrick Delaunay1-1/+1
We convert CONFIG_PARTITION_UUIDS to Kconfig first. But in order to cleanly update all of the config files we must also update CMD_PART and CMD_GPT to also be in Kconfig in order to avoid complex logic elsewhere to update all of the config files. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2017-01-28disk: convert CONFIG_EFI_PARTITION to KconfigPatrick Delaunay1-1/+1
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
2017-01-28disk: convert CONFIG_DOS_PARTITION to KconfigPatrick Delaunay1-1/+1
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
2016-10-02disk: part: refactor generic name creation for DOS and ISOPetr Kulhavy1-0/+14
In both DOS and ISO partition tables the same code to create partition name like "hda1" was repeated. Code moved to into a new function part_set_generic_name() in part.c and optimized. Added recognition of MMC and SD types, name is like "mmcsda1". Signed-off-by: Petr Kulhavy <brain@jikos.cz> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Steve Rae <steve.rae@raedomain.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-10-02fastboot: add support for writing MBRPetr Kulhavy1-0/+23
Add special target "mbr" (otherwise configurable via CONFIG_FASTBOOT_MBR_NAME) to write MBR partition table. Partitions are now searched using the generic function which finds any partiiton by name. For MBR the partition names hda1, sda1, etc. are used. Signed-off-by: Petr Kulhavy <brain@jikos.cz> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Steve Rae <steve.rae@raedomain.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-10-02disk: part: implement generic function part_get_info_by_name()Petr Kulhavy1-12/+20
So far partition search by name has been supported only on the EFI partition table. This patch extends the search to all partition tables. Rename part_get_info_efi_by_name() to part_get_info_by_name(), move it from part_efi.c into part.c and make it a generic function which traverses all part drivers and searches all partitions (in the order given by the linked list). For this a new variable struct part_driver.max_entries is added, which limits the number of partitions searched. For EFI this was GPT_ENTRY_NUMBERS. Similarly the limit is defined for DOS, ISO, MAC and AMIGA partition tables. Signed-off-by: Petr Kulhavy <brain@jikos.cz> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Steve Rae <steve.rae@raedomain.com>
2016-05-17dm: mmc: Add support for driver-model block devicesSimon Glass1-18/+0
Add support for enabling CONFIG_BLK with MMC. This involves changing a few functions to use struct udevice and adding a MMC block device driver. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: part: Drop the get_dev() methodSimon Glass1-1/+0
This is now handled by the legacy block driver. The get_dev() method is no-longer used. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: sandbox: Drop the host_get_dev() functionSimon Glass1-2/+0
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: systemace: Drop the get_dev() functionSimon Glass1-2/+0
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: sata: Drop the get_dev() functionSimon Glass1-2/+0
This function is implemented by the legacy block functions now. Drop it. We cannot yet make sata_dev_desc[] private to common/sata.c as it is used by the SATA drivers. This will require the SATA interface to be reworked. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: scsi: Drop the get_dev() functionSimon Glass1-2/+0
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: mmc: Drop the get_dev() functionSimon Glass1-2/+0
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: ide: Drop the get_dev() functionSimon Glass1-2/+0
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: usb: Drop the get_dev() functionSimon Glass1-2/+0
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-04-12disk: part: Enable get_info pointer for CONFIG_SPL_FAT_SUPPORTMichal Simek1-1/+1
The patch "dm: part: Convert partition API use to linker lists" (sha1: 96e5b03c8ab749b6547f6a3ceb4d4b9f274211aa) is adding new dependency for enabling SPL_EXT_SUPPORT to be able to get information about DOS partition. get_info is also required for FAT support only which is used on Xilinx Zynq boards. Reported-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-03-15disk/part.c: Expose list of available block driversAlexander Graf1-0/+7
We have a pretty nice and generic interface to ask for a specific block device. However, that one is still based around the magic notion that we know the driver name. In order to be able to write fully generic disk access code, expose the currently internal list to other source files so that they can scan through all available block drivers. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2016-03-15dm: part: Rename some partition functionsSimon Glass1-11/+10
Rename three partition functions so that they start with part_. This makes it clear what they relate to. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-15dm: part: Convert partition API use to linker listsSimon Glass1-31/+48
We can use linker lists instead of explicitly declaring each function. This makes the code shorter by avoiding switch() statements and lots of header file declarations. While this does clean up the code it introduces a few code issues with SPL. SPL never needs to print partition information since this all happens from commands. SPL mostly doesn't need to obtain information about a partition either, except in a few cases. Add these cases so that the code will be dropped from each partition driver when not needed. This avoids code bloat. I think this is still a win, since it is not a bad thing to be explicit about which features are used in SPL. But others may like to weigh in. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-15dm: blk: Rename get_device_and_partition()Simon Glass1-4/+38
Rename this function to blk_get_device_part_str(). This is a better name because it makes it clear that the function returns a block device and parses a string. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-15dm: blk: Rename get_device() to blk_get_device_by_str()Simon Glass1-4/+30
The current name is too generic. The function returns a block device based on a provided string. Rename it to aid searching and make its purpose clearer. Also add a few comments. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-15dm: blk: Rename get_dev() to blk_get_dev()Simon Glass1-3/+3
The current name is too generic. Add a 'blk_' prefix to aid searching and make its purpose clearer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-15dm: blk: Add comments to a few functionsSimon Glass1-0/+30
The block interface is not well documented in the code. Pick two important functions and add comments. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-15dm: Add a new header for block devicesSimon Glass1-48/+1
At present block devices are tied up with partitions. But not all block devices have partitions within them. They are in fact separate concepts. Create a separate blk.h header file for block devices. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-15dm: part: Drop the common.h headerSimon Glass1-1/+0
We should not include <common.h> in header files. Each C file should include it if needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>