summaryrefslogtreecommitdiff
path: root/disk
Commit message (Collapse)AuthorAgeFilesLines
* disk: efi: GUIDs should be constHeinrich Schuchardt2019-01-181-1/+1
| | | | | | | Make system_guid const. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* blk: Introduce IF_TYPE_VIRTIOTuomas Tynkkynen2018-11-141-0/+6
| | | | | | | | This adds a new block interface type for VirtIO block devices. Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Rename GPT_HEADER_SIGNATURE to avoid conflictSimon Glass2018-10-091-3/+3
| | | | | | | | The current name conflicts with the Chrome OS verified boot library, which prevents it being built. That library uses a string whereas U-Boot uses a 64-bit hex value. Rename this in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
* Remove <inttypes.h> includes and PRI* usages in printf() entirelyMasahiro Yamada2018-09-101-1/+0
| | | | | | | | | | | | | | | | In int-ll64.h, we always use the following typedefs: typedef unsigned int u32; typedef unsigned long uintptr_t; typedef unsigned long long u64; This does not need to match to the compiler's <inttypes.h>. Do not include it. The use of PRI* makes the code super-ugly. You can simply use "l" for printing uintptr_t, "ll" for u64, and no modifier for u32. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* disk: part: Don't show redundant error messageSam Protsenko2018-08-101-1/+1
| | | | | | | | | | | | | Underlying API should already print some meaningful error message, so this one is just brings more noise. E.g. we can see log like this: MMC: no card present ** Bad device mmc 0 ** Obviously, second error message is unwanted. Let's only print it in case when DEBUG is defined to keep log short and clear. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
* efi_loader: avoid initializer element is not constantHeinrich Schuchardt2018-06-141-2/+7
| | | | | | | | | | | | | | | | When building with -pedantic the current definition of EFI_GUID() causes an error 'initializer element is not constant'. Currently EFI_GUID() is used both as an anonymous constant and as an intializer. A conversion to efi_guid_t is not allowable when using EFI_GUID() as an initializer. But it is needed when using it as an anonymous constant. We should not use EFI_GUID() for anything but an initializer. So let's introduce a variable where needed and remove the conversion. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* disk: efi: Correct backing up the MBR boot codeSam Protsenko2018-06-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | In commit e163a931af34 ("cmd: gpt: backup boot code before writing MBR") there was added the procedure for storing old boot code when doing "gpt write". But instead of storing just backup code, the whole MBR was stored, and only specific fields were replaced further, keeping everything else intact. That's obviously not what we want. Fix the code to actually store only old boot code and zero out everything else. This fixes next testing case: => mmc write $loadaddr 0x0 0x7b => gpt write mmc 1 $partitions In case when $loadaddr address and further memory contains 0xff, the board was bricked (ROM-code probably didn't like partition entries that were clobbered with 0xff). With this patch applied, commands above don't brick the board. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Cc: Alejandro Hernandez <ajhernandez@ti.com> Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-0711-23/+11
| | | | | | | | | | | | | | | | | | | | 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>
* spl: disk: usb: Add dependencies to sprintf/strto*Alex Kiernan2018-04-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | If SPL serial support is disabled nothing brings in sprintf, snprintf or simple_strtoul: env/built-in.o: In function `regex_callback': env/attr.c:128: undefined reference to `sprintf' disk/built-in.o: In function `blk_get_device_by_str': disk/part.c:386: undefined reference to `simple_strtoul' disk/part.c:395: undefined reference to `simple_strtoul' disk/built-in.o: In function `blk_get_device_part_str': disk/part.c:522: undefined reference to `simple_strtoul' disk/built-in.o: In function `part_set_generic_name': disk/part.c:704: undefined reference to `sprintf' drivers/built-in.o: In function `init_peripheral_ep': drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf' drivers/built-in.o: In function `musb_core_init': drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf' Add those dependencies here. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
* Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini2018-04-271-2/+0
| | | | | | | | We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
* part: Disable CONFIG_SPL_ISO_PARTITION by defaultAlexander Graf2018-04-161-1/+0
| | | | | | | | | | | | | | | | We enabled CONFIG_ISO_PARTITION by default for distro boot, so that U-Boot could load distro images that usually get shipped as iso images. These images usually come with a board agnostic boot environment. However, there is very little point in having ISO support enabled (for anyone really) in SPL, as the whole idea of SPL is to load U-Boot proper which again is board specific. So the fact that we enable ISO support in U-Boot proper does not mean at all that we want ISO support in U-Boot SPL. Hence, let's remove the Kconfig dependency. Along the way, let's also clean up all those default configs that disabled SPL ISO support. Signed-off-by: Alexander Graf <agraf@suse.de>
* disk: part: use common api to lookup part driverKever Yang2018-03-131-20/+17
| | | | | | | | | Do not need to scan disk every time when we get part info by name. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> [trini: Fix build in !CONFIG_HAVE_BLOCK_DEVICE case] Signed-off-by: Tom Rini <trini@konsulko.com>
* disk: part: scan the disk if the part_type is unknownKever Yang2018-03-131-6/+18
| | | | | | | | | If a DUT do not have partition table, and we write one with 'gpt write' cmd, we should able to list the partition with 'part list' cmd. It's reasonable to scan the disk again if the initial part_type is unknown in case we just write a new one into disk. Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
* Move most CONFIG_HAVE_BLOCK_DEVICE to KconfigAdam Ford2018-02-086-12/+12
| | | | | | | | | | | config_fallbacks.h has some logic that sets HAVE_BLOCK_DEVICE based on a list of enabled options. Moving HAVE_BLOCK_DEVICE to Kconfig allows us to drastically shrink the logic in config_fallbacks.h Signed-off-by: Adam Ford <aford173@gmail.com> [trini: Rename HAVE_BLOCK_DEVICE to CONFIG_BLOCK_DEVICE] Signed-off-by: Tom Rini <trini@konsulko.com>
* Convert LIB_UUID to KconfigAdam Ford2018-02-081-0/+2
| | | | | | | | | config_fallback.h has some logic that checks a variety of options and selects LIB_UUID if it hasn't already been selected. This will all LIB_UUID in Kconfig and select this option for the list of options to allow us to remove the logic from fallbacks Signed-off-by: Adam Ford <aford173@gmail.com>
* part: Allocate only one legacy_mbr bufferAlexey Brodkin2018-02-071-1/+1
| | | | | | | | | | | | | | Commit ff98cb90514d ("part: extract MBR signature from partitions") blindly switched allocated by ALLOC_CACHE_ALIGN_BUFFER buffer type from "unsigned char" to "legacy_mbr" which caused allocation of size = (typeof(legacy_mbr) * dev_desc->blksize) instead of just space enough for "legacy_mbr" structure. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Peter Jones <pjones@redhat.com> Cc: Alexander Graf <agraf@suse.de> Cc: Tom Rini <trini@konsulko.com>
* Merge git://git.denx.de/u-boot-sunxiTom Rini2017-12-191-0/+14
|\
| * part: efi: Add default number of partition entries for sunxiMaxime Ripard2017-12-071-0/+1
| | | | | | | | | | | | | | | | | | The SPL must be located at 8kB (16 sectors) offset. That's right in the middle of the GPT, so we need to define a smaller amount of partitions to accomodate for that location. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
| * part: efi: Add a Kconfig option for the number of partition entriesMaxime Ripard2017-12-071-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | On some SoCs, the SPL needs to be located right in the middle of the GPT partition entries. One way to work around that is to create partition entries for a smaller number of partitions to accomodate with where the SPL will be. Create a Kconfig option to allow to do that. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* | disk: efi: correct the allocation size for mbr header in stackPatrick Delaunay2017-11-291-2/+2
|/ | | | | | | | | | use ALLOC_CACHE_ALIGN_BUFFER_PAD for mbr header allocation in stack to fix alloc issue in is_gpt_valid() this patch fix also issue for GPT partition handling with blocksize != 512 in set_protective_mbr() Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* disk: part_dos: fix part_get_info_extended() functionShawn Guo2017-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The check in part_get_info_extended() for a successful partition searching misses a condition for extended partition. In case of (ext_part_sector == 0), we should anyway mark the partition as found, even if it's an extended partition, i.e. (is_extended(pt->sys_ind) == 0). Otherwise, the extended partition (type 0x0f) will never be identified, and the following recursive call to part_get_info_extended() will get a wrong 'part_num' and 'which_part' parameter. In the end, all those partitions in extended table will not be identified. Let's add the missing OR condition of (ext_part_sector == 0) for is_extended() check to fix the problem. The issue is discovered by running fastboot flash to an extended partition on eMMC. $ fastboot flash mmcsda5 cache.img target reported max download size of 536870912 bytes sending 'mmcsda5' (18796 KB)... OKAY [ 2.144s] writing 'mmcsda5'... FAILED (remote: cannot find partition) finished. total time: 2.261s Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
* gpt: Use cache aligned buffers for gpt_h and gpt_eLukasz Majewski2017-11-061-7/+9
| | | | | | | | | | | | | | | | | | | | | Before this patch one could receive following errors when executing "gpt write" command on machine with cache enabled: display5 factory > gpt write mmc ${mmcdev} ${partitions} Writing GPT: CACHE: Misaligned operation at range [4ef8f7f0, 4ef8f9f0] CACHE: Misaligned operation at range [4ef8f9f8, 4ef939f8] CACHE: Misaligned operation at range [4ef8f9f8, 4ef939f8] CACHE: Misaligned operation at range [4ef8f7f0, 4ef8f9f0] success! To alleviate this problem - the calloc()s have been replaced with malloc_cache_aligned() and memset(). After those changes the buffers are properly aligned (with both start address and size) to SoC cache line. Signed-off-by: Lukasz Majewski <lukma@denx.de>
* disk: efi: correct the overlap check on GPT header and PTEPatrick Delaunay2017-10-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the partition starting at 0x4400 is refused with overlap error: $> gpt write mmc 0 "name=test,start=0x4400,size=0" Writing GPT: Partition overlap error! even if the 0x4400 is the first available offset for LBA35 with default value: - MBR=LBA1 - GPT header=LBA2 - PTE= 32 LBAs (128 entry), 3 to 34 And the command to have one partition for all the disk failed also : $> gpt write mmc 0 "name=test,size=0" After the patch : $> gpt write mmc 0 "name=test,size=0" Writing GPT: success! $> part list mmc 0 Partition Map for MMC device 0 -- Partition Type: EFI Part Start LBA End LBA Name Attributes Type GUID Partition GUID 1 0x00000022 0x01ce9fde "test" attrs: 0x0000000000000000 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 type: data guid: b4b84b8a-04e3-4000-0036-aff5c9c495b1 And 0x22 = 34 LBA => offset = 0x4400 is accepted as expected Reviewed-by: Łukasz Majewski <lukma@denx.de> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* iso: Reduce verbosity on test and info callsAlexander Graf2017-10-161-2/+2
| | | | | | | | | | | | | | The test and info callbacks into the partition callback struct are used by the "part list" command on the command line. That command is used by the distro script. With verb=1 set, "part list" thus throws a lot of warnings about partitions it can't find when an upper layer searches for partitions. So let's reduce verbosity to bring it to the same level of noise as the other partition targets. Signed-off-by: Alexander Graf <agraf@suse.de>
* part_efi: In is_gpt_valid() check argument validity before allocationTom Rini2017-10-161-2/+3
| | | | | | | | | While this goes somewhat against normal coding style we should ensure that dev_desc is not NULL before we dereference it in allocation of legacy_mbr. Reported-by: Coverity (CID: 167292) Signed-off-by: Tom Rini <trini@konsulko.com>
* disk: Provide API to get partition by name for specific typeSam Protsenko2017-10-061-2/+13
| | | | | | | | | | 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>
* disk: part_dos: Use the original allocation scheme for the SPL caseFabio Estevam2017-10-051-0/+10
| | | | | | | | | | | | | | | | | | Since commit ff98cb90514d ("part: extract MBR signature from partitions") SPL boot on i.MX6 starts to fail: U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19) Trying to boot from MMC1 (keep in loop) Use the original allocation scheme for the SPL case, so that MX6 boards can boot again. This is a temporary solution to avoid the boot regression. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Rob Clark <robdclark@gmail.com> Tested-by: Peter Robinson <pbrobinson@gmail.com>
* treewide: replace with error() with pr_err()Masahiro Yamada2017-10-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | U-Boot widely uses error() as a bit noisier variant of printf(). This macro causes name conflict with the following line in include/linux/compiler-gcc.h: # define __compiletime_error(message) __attribute__((error(message))) This prevents us from using __compiletime_error(), and makes it difficult to fully sync BUILD_BUG macros with Linux. (Notice Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().) Let's convert error() into now treewide-available pr_err(). Done with the help of Coccinelle, excluing tools/ directory. The semantic patch I used is as follows: // <smpl> @@@@ -error +pr_err (...) // </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Re-run Coccinelle] Signed-off-by: Tom Rini <trini@konsulko.com>
* part: extract MBR signature from partitionsPeter Jones2017-09-202-3/+29
| | | | | | | | | | | | EFI client programs need the signature information from the partition table to determine the disk a partition is on, so we need to fill that in here. Signed-off-by: Peter Jones <pjones@redhat.com> [separated from efi_loader part, and fixed build-errors for non- CONFIG_EFI_PARTITION case] Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* EFI: find EFI system partition by legacy MBR partition typeAndre Przywara2017-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UEFI spec allows an EFI system partition (ESP, with the bootloader or kernel EFI apps on it) to reside on a disk using a "legacy" MBR partitioning scheme. But in contrast to actual legacy disks the ESP is not marked as "bootable" using bit 7 in byte 0 of the legacy partition entry, but is instead using partition *type* 0xef (in contrast to 0x0b or 0x0c for a normal FAT partition). The EFI spec isn't 100% clear on this, but it even seems to discourage the use of the bootable flag for ESPs. Also it seems that some EFI implementations (EDK2?) even seem to ignore partitions marked as bootable (probably since they believe they contain legacy boot code). The Debian installer [1] (*not* mini.iso), for instance, contains such an MBR, where none of the two partitions are marked bootable, but the ESP has clearly type 0xef. Now U-Boot cannot find the ESP on such a disk (USB flash drive) and fails to load the EFI grub and thus the installer. Since it all boils down to the distro bootcmds eventually calling "part list -bootable" to find potential boot partitions, it seems logical to just add this "partition type is 0xef" condition to the is_bootable() implementation. This allows the bog standard arm64 Debian-testing installer to boot from an USB pen drive on Allwinner A64 boards (Pine64, BananaPi-M64). (Ubuntu and other distribution installers don't have a legacy MBR, so U-Boot falls back to El Torito there). [1] https://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/arm64/iso-cd/ Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* fs: add fs_readdir()Rob Clark2017-09-151-12/+19
| | | | | | | | | | | | | | | | 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>
* part: mac: Suppress the error message after reading ddbBin Meng2017-09-071-5/+1
| | | | | | | Change to use 'debug' to output the error message if it fails to read the driver descriptor block. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* disk: part: fix typoHeinrich Schuchardt2017-09-031-3/+9
| | | | | | | | %s/Desriptor/Descriptor/g Fix lines over 80 characters with said typo. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* part: efi: Disable overlap checkMaxime Ripard2017-09-031-7/+21
| | | | | | | | | | | | | | | | | | | | The current code checks that no partitions overlap with the GPT partition table using the offset of the first LBA usable for that partition. This works fine, unless you have a partition entry that is further away than it usually is and you want to create partitions in the gap between the GPT header and the GPT partition entries, for example to reflash a bootloader that needs to be set there. Rework the test to something a bit smarter that checks whether a partition would overlap with either the GPT header or the partition entries, no matter where it is on the disk. Partitions that do not have a start LBA specified will still start at the first LBA usable set in the GPT header, to avoid weird behaviours. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* part: efi: make gpt_fill_pte take the device descriptorMaxime Ripard2017-09-031-3/+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>
* part: efi: rework the partition start and size in gpt_fill_pteMaxime Ripard2017-09-031-6/+8
| | | | | | | | | | | The start variable is only used inside a loop, and is never affected inside it, so it's a purely local variable. In the same way the partition size is accessed several times, so we can store it in a variable. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* part: efi: Fix offsetMaxime Ripard2017-09-031-3/+7
| | | | | | | | | | | Both the config option and the DT options specify the offset to set the GPT at in bytes, yet the code treats those values as block numbers. Fix that. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* disk: part: align buffer so it can be used with DMA enabled driversStefan Agner2017-08-261-1/+1
| | | | | | | | | | | | When using ISO partitions with a DMA enabled block device driver reading the ISO partition leads to unaligned DMA operations: CACHE: Misaligned operation at range [bffb7da8, bffb85a8] Align the buffer to make sure we pass a buffer which works for DMA operations. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* env: Rename getenv/_f() to env_get()Simon Glass2017-08-162-3/+3
| | | | | | | | | | | We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: blk: part: Add UCLASS_NVME and IF_TYPE_NVMEZhikang Zhang2017-08-131-1/+5
| | | | | | | | | | This adds a new uclass id and block interface type for NVMe. Signed-off-by: Zhikang Zhang <zhikang.zhang@nxp.com> Signed-off-by: Wenbin Song <wenbin.song@nxp.com> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jon Nettleton <jon@solid-run.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* GPT: add accessor function for disk GUIDAlison Chaiken2017-08-041-0/+31
| | | | | | | | | | | 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>
* partitions: increase MAX_SEARCH_PARTITIONS and move to part.hAlison Chaiken2017-08-041-1/+0
| | | | | | | | | | | 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>
* EFI: replace number with UUID_STR_LEN macroAlison Chaiken2017-08-041-1/+1
| | | | | | Changes since v6: none. Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
* disk: Return the partition number in part_get_info_by_name()Alex Deymo2017-05-111-1/+1
| | | | | | | | | | 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>
* SPARC: RemoveTom Rini2017-04-051-3/+2
| | | | | | | The SPARC architecture is currently unmaintained, remove. Cc: Francois Retief <fgretief@spaceteq.co.za> Signed-off-by: Tom Rini <trini@konsulko.com>
* part_efi: support padding between the GPT header and partition entriesPhilipp Tomsich2017-03-202-4/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | Some architectures require their SPL loader at a fixed address within the first 16KB of the disk. To avoid an overlap with the partition entries of the EFI partition table, the first safe offset (in bytes, from the start of the device) for the entries can be set through CONFIG_EFI_PARTITION_ENTRIES_OFF (via Kconfig) When formatting a device with an EFI partition table, we may need to leave a gap between the GPT header (always in LBA 1) and the partition entries. The GPT header already contains a field to specify the on-disk location, which has so far always been set to LBA 2. With this change, a configurable offset will be translated into a LBA address indicating where to put the entries. Now also allows an override via device-tree using a config-node (see doc/device-tree-bindings/config.txt for documentation). Tested (exporting an internal MMC formatted with this) against Linux, MacOS X and Windows. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: __maybe_unused on config_offset to avoid warning] Signed-off-by: Tom Rini <trini@konsulko.com>
* gpt: Fix uuid string formatVincent Tinelli2017-03-171-1/+1
| | | | | | | Change GPT UUID string format from UUID to GUID per specification. Signed-off-by: Vincent Tinelli <vincent.tinelli@intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* SPL: add support to boot from a partition typeDalon Westergreen2017-02-171-0/+1
| | | | | | | | | | | | | 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>
* cmd: gpt: backup boot code before writing MBRVincent Tinelli2017-02-081-0/+7
| | | | | | | | | | | | | On some cases the first 440 bytes of MBR are used to keep an additional information for ROM boot loader. 'gpt write' command doesn't preserve that area and makes boot code gone. Preserve boot code area when run 'gpt write' command. Signed-off-by: Vincent Tinelli <vincent.tinelli@intel.com> Signed-off-by: Brennan Ashton <brn@deako.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* disk: convert CONFIG_PARTITION_TYPE_GUID to KconfigPatrick Delaunay2017-01-281-0/+8
| | | | | Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>