1012771d8Swdenk /* 242dfe7a1Swdenk * (C) Copyright 2000-2004 3012771d8Swdenk * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4012771d8Swdenk * 51a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 6012771d8Swdenk */ 7012771d8Swdenk #ifndef _PART_H 8012771d8Swdenk #define _PART_H 9735dd97bSGrant Likely 101a73661bSSimon Glass #include <blk.h> 116e592385Swdenk #include <ide.h> 12012771d8Swdenk 13d96a9804SAlexander Graf struct block_drvr { 14d96a9804SAlexander Graf char *name; 15d96a9804SAlexander Graf struct blk_desc* (*get_dev)(int dev); 16d96a9804SAlexander Graf int (*select_hwpart)(int dev_num, int hwpart); 17d96a9804SAlexander Graf }; 18d96a9804SAlexander Graf 190472fbfdSEgbert Eich #define LOG2(x) (((x & 0xaaaaaaaa) ? 1 : 0) + ((x & 0xcccccccc) ? 2 : 0) + \ 200472fbfdSEgbert Eich ((x & 0xf0f0f0f0) ? 4 : 0) + ((x & 0xff00ff00) ? 8 : 0) + \ 210472fbfdSEgbert Eich ((x & 0xffff0000) ? 16 : 0)) 220472fbfdSEgbert Eich #define LOG2_INVALID(type) ((type)((sizeof(type)<<3)-1)) 23ae1768a7SEgbert Eich 24012771d8Swdenk /* Part types */ 25012771d8Swdenk #define PART_TYPE_UNKNOWN 0x00 26012771d8Swdenk #define PART_TYPE_MAC 0x01 27012771d8Swdenk #define PART_TYPE_DOS 0x02 28012771d8Swdenk #define PART_TYPE_ISO 0x03 29c7de829cSwdenk #define PART_TYPE_AMIGA 0x04 3007f3d789Srichardretanubun #define PART_TYPE_EFI 0x05 31c7de829cSwdenk 32b0fce99bSwdenk /* 33b0fce99bSwdenk * Type string for U-Boot bootable partitions 34b0fce99bSwdenk */ 35b0fce99bSwdenk #define BOOT_PART_TYPE "U-Boot" /* primary boot partition type */ 36b0fce99bSwdenk #define BOOT_PART_COMP "PPCBoot" /* PPCBoot compatibility type */ 37b0fce99bSwdenk 38012771d8Swdenk /* device types */ 39012771d8Swdenk #define DEV_TYPE_UNKNOWN 0xff /* not connected */ 40012771d8Swdenk #define DEV_TYPE_HARDDISK 0x00 /* harddisk */ 41012771d8Swdenk #define DEV_TYPE_TAPE 0x01 /* Tape */ 42012771d8Swdenk #define DEV_TYPE_CDROM 0x05 /* CD-ROM */ 43012771d8Swdenk #define DEV_TYPE_OPDISK 0x07 /* optical disk */ 44012771d8Swdenk 45012771d8Swdenk typedef struct disk_partition { 4604735e9cSFrederic Leroy lbaint_t start; /* # of first block in partition */ 4704735e9cSFrederic Leroy lbaint_t size; /* number of blocks in partition */ 48012771d8Swdenk ulong blksz; /* block size in bytes */ 49012771d8Swdenk uchar name[32]; /* partition name */ 50012771d8Swdenk uchar type[32]; /* string type description */ 5140e0e568SRob Herring int bootable; /* Active/Bootable flag is set */ 52894bfbbfSStephen Warren #ifdef CONFIG_PARTITION_UUIDS 53894bfbbfSStephen Warren char uuid[37]; /* filesystem UUID as string, if exists */ 54894bfbbfSStephen Warren #endif 557561b258SPatrick Delaunay #ifdef CONFIG_PARTITION_TYPE_GUID 567561b258SPatrick Delaunay char type_guid[37]; /* type GUID as string, if exists */ 577561b258SPatrick Delaunay #endif 58012771d8Swdenk } disk_partition_t; 59012771d8Swdenk 60735dd97bSGrant Likely /* Misc _get_dev functions */ 61df3fc526SMatthew McClintock #ifdef CONFIG_PARTITIONS 62fb1b7be9SSimon Glass /** 63db1d9e78SSimon Glass * blk_get_dev() - get a pointer to a block device given its type and number 64fb1b7be9SSimon Glass * 65fb1b7be9SSimon Glass * Each interface allocates its own devices and typically struct blk_desc is 66fb1b7be9SSimon Glass * contained with the interface's data structure. There is no global 67fb1b7be9SSimon Glass * numbering for block devices, so the interface name must be provided. 68fb1b7be9SSimon Glass * 69fb1b7be9SSimon Glass * @ifname: Interface name (e.g. "ide", "scsi") 70fb1b7be9SSimon Glass * @dev: Device number (0 for first device on that interface, 1 for 71fb1b7be9SSimon Glass * second, etc. 72fb1b7be9SSimon Glass * @return pointer to the block device, or NULL if not available, or an 73fb1b7be9SSimon Glass * error occurred. 74fb1b7be9SSimon Glass */ 75db1d9e78SSimon Glass struct blk_desc *blk_get_dev(const char *ifname, int dev); 764101f687SSimon Glass struct blk_desc *ide_get_dev(int dev); 774101f687SSimon Glass struct blk_desc *sata_get_dev(int dev); 784101f687SSimon Glass struct blk_desc *scsi_get_dev(int dev); 794101f687SSimon Glass struct blk_desc *usb_stor_get_dev(int dev); 804101f687SSimon Glass struct blk_desc *mmc_get_dev(int dev); 81fb1b7be9SSimon Glass 82fb1b7be9SSimon Glass /** 83fb1b7be9SSimon Glass * mmc_select_hwpart() - Select the MMC hardware partiion on an MMC device 84fb1b7be9SSimon Glass * 85fb1b7be9SSimon Glass * MMC devices can support partitioning at the hardware level. This is quite 86fb1b7be9SSimon Glass * separate from the normal idea of software-based partitions. MMC hardware 87fb1b7be9SSimon Glass * partitions must be explicitly selected. Once selected only the region of 88fb1b7be9SSimon Glass * the device covered by that partition is accessible. 89fb1b7be9SSimon Glass * 90fb1b7be9SSimon Glass * The MMC standard provides for two boot partitions (numbered 1 and 2), 91fb1b7be9SSimon Glass * rpmb (3), and up to 4 addition general-purpose partitions (4-7). 92fb1b7be9SSimon Glass * 93fb1b7be9SSimon Glass * @dev_num: Block device number (struct blk_desc->dev value) 94fb1b7be9SSimon Glass * @hwpart: Hardware partition number to select. 0 means the raw device, 95fb1b7be9SSimon Glass * 1 is the first partition, 2 is the second, etc. 96fb1b7be9SSimon Glass * @return 0 if OK, other value for an error 97fb1b7be9SSimon Glass */ 98d2356284SStephen Warren int mmc_select_hwpart(int dev_num, int hwpart); 994101f687SSimon Glass struct blk_desc *systemace_get_dev(int dev); 1004101f687SSimon Glass struct blk_desc *mg_disk_get_dev(int dev); 1014101f687SSimon Glass struct blk_desc *host_get_dev(int dev); 1024101f687SSimon Glass int host_get_dev_err(int dev, struct blk_desc **blk_devp); 103735dd97bSGrant Likely 104012771d8Swdenk /* disk/part.c */ 1053e8bd469SSimon Glass int part_get_info(struct blk_desc *dev_desc, int part, disk_partition_t *info); 1063e8bd469SSimon Glass void part_print(struct blk_desc *dev_desc); 1073e8bd469SSimon Glass void part_init(struct blk_desc *dev_desc); 1084101f687SSimon Glass void dev_print(struct blk_desc *dev_desc); 109ebac37cfSSimon Glass 110ebac37cfSSimon Glass /** 111ebac37cfSSimon Glass * blk_get_device_by_str() - Get a block device given its interface/hw partition 112ebac37cfSSimon Glass * 113ebac37cfSSimon Glass * Each interface allocates its own devices and typically struct blk_desc is 114ebac37cfSSimon Glass * contained with the interface's data structure. There is no global 115ebac37cfSSimon Glass * numbering for block devices, so the interface name must be provided. 116ebac37cfSSimon Glass * 117ebac37cfSSimon Glass * The hardware parition is not related to the normal software partitioning 118ebac37cfSSimon Glass * of a device - each hardware partition is effectively a separately 119ebac37cfSSimon Glass * accessible block device. When a hardware parition is selected on MMC the 120ebac37cfSSimon Glass * other hardware partitions become inaccessible. The same block device is 121ebac37cfSSimon Glass * used to access all hardware partitions, but its capacity may change when a 122ebac37cfSSimon Glass * different hardware partition is selected. 123ebac37cfSSimon Glass * 124ebac37cfSSimon Glass * When a hardware partition number is given, the block device switches to 125ebac37cfSSimon Glass * that hardware partition. 126ebac37cfSSimon Glass * 127ebac37cfSSimon Glass * @ifname: Interface name (e.g. "ide", "scsi") 128ebac37cfSSimon Glass * @dev_str: Device and optional hw partition. This can either be a string 129ebac37cfSSimon Glass * containing the device number (e.g. "2") or the device number 130ebac37cfSSimon Glass * and hardware partition number (e.g. "2.4") for devices that 131ebac37cfSSimon Glass * support it (currently only MMC). 132ebac37cfSSimon Glass * @dev_desc: Returns a pointer to the block device on success 133ebac37cfSSimon Glass * @return block device number (local to the interface), or -1 on error 134ebac37cfSSimon Glass */ 135ebac37cfSSimon Glass int blk_get_device_by_str(const char *ifname, const char *dev_str, 1364101f687SSimon Glass struct blk_desc **dev_desc); 137e35929e4SSimon Glass 138e35929e4SSimon Glass /** 139e35929e4SSimon Glass * blk_get_device_part_str() - Get a block device and partition 140e35929e4SSimon Glass * 141e35929e4SSimon Glass * This calls blk_get_device_by_str() to look up a device. It also looks up 142e35929e4SSimon Glass * a partition and returns information about it. 143e35929e4SSimon Glass * 144e35929e4SSimon Glass * @dev_part_str is in the format: 145e35929e4SSimon Glass * <dev>.<hw_part>:<part> where <dev> is the device number, 146e35929e4SSimon Glass * <hw_part> is the optional hardware partition number and 147e35929e4SSimon Glass * <part> is the partition number 148e35929e4SSimon Glass * 149e35929e4SSimon Glass * If ifname is "hostfs" then this function returns the sandbox host block 150e35929e4SSimon Glass * device. 151e35929e4SSimon Glass * 152e35929e4SSimon Glass * If ifname is ubi, then this function returns 0, with @info set to a 153e35929e4SSimon Glass * special UBI device. 154e35929e4SSimon Glass * 155e35929e4SSimon Glass * If @dev_part_str is NULL or empty or "-", then this function looks up 156e35929e4SSimon Glass * the "bootdevice" environment variable and uses that string instead. 157e35929e4SSimon Glass * 158e35929e4SSimon Glass * If the partition string is empty then the first partition is used. If the 159e35929e4SSimon Glass * partition string is "auto" then the first bootable partition is used. 160e35929e4SSimon Glass * 161e35929e4SSimon Glass * @ifname: Interface name (e.g. "ide", "scsi") 162e35929e4SSimon Glass * @dev_part_str: Device and partition string 163e35929e4SSimon Glass * @dev_desc: Returns a pointer to the block device on success 164e35929e4SSimon Glass * @info: Returns partition information 165e35929e4SSimon Glass * @allow_whole_dev: true to allow the user to select partition 0 166e35929e4SSimon Glass * (which means the whole device), false to require a valid 167e35929e4SSimon Glass * partition number >= 1 168e35929e4SSimon Glass * @return partition number, or -1 on error 169e35929e4SSimon Glass * 170e35929e4SSimon Glass */ 171e35929e4SSimon Glass int blk_get_device_part_str(const char *ifname, const char *dev_part_str, 1724101f687SSimon Glass struct blk_desc **dev_desc, 17310a37fd7SStephen Warren disk_partition_t *info, int allow_whole_dev); 174d96a9804SAlexander Graf extern const struct block_drvr block_drvr[]; 175df3fc526SMatthew McClintock #else 176db1d9e78SSimon Glass static inline struct blk_desc *blk_get_dev(const char *ifname, int dev) 17799d2c205SRob Herring { return NULL; } 1784101f687SSimon Glass static inline struct blk_desc *ide_get_dev(int dev) { return NULL; } 1794101f687SSimon Glass static inline struct blk_desc *sata_get_dev(int dev) { return NULL; } 1804101f687SSimon Glass static inline struct blk_desc *scsi_get_dev(int dev) { return NULL; } 1814101f687SSimon Glass static inline struct blk_desc *usb_stor_get_dev(int dev) { return NULL; } 1824101f687SSimon Glass static inline struct blk_desc *mmc_get_dev(int dev) { return NULL; } 183d2356284SStephen Warren static inline int mmc_select_hwpart(int dev_num, int hwpart) { return -1; } 1844101f687SSimon Glass static inline struct blk_desc *systemace_get_dev(int dev) { return NULL; } 1854101f687SSimon Glass static inline struct blk_desc *mg_disk_get_dev(int dev) { return NULL; } 1864101f687SSimon Glass static inline struct blk_desc *host_get_dev(int dev) { return NULL; } 187012771d8Swdenk 1883e8bd469SSimon Glass static inline int part_get_info(struct blk_desc *dev_desc, int part, 189df3fc526SMatthew McClintock disk_partition_t *info) { return -1; } 1903e8bd469SSimon Glass static inline void part_print(struct blk_desc *dev_desc) {} 1913e8bd469SSimon Glass static inline void part_init(struct blk_desc *dev_desc) {} 1924101f687SSimon Glass static inline void dev_print(struct blk_desc *dev_desc) {} 193ebac37cfSSimon Glass static inline int blk_get_device_by_str(const char *ifname, const char *dev_str, 1944101f687SSimon Glass struct blk_desc **dev_desc) 1952023e608SStephen Warren { return -1; } 196e35929e4SSimon Glass static inline int blk_get_device_part_str(const char *ifname, 19710a37fd7SStephen Warren const char *dev_part_str, 1984101f687SSimon Glass struct blk_desc **dev_desc, 19910a37fd7SStephen Warren disk_partition_t *info, 20010a37fd7SStephen Warren int allow_whole_dev) 20199d2c205SRob Herring { *dev_desc = NULL; return -1; } 202df3fc526SMatthew McClintock #endif 203012771d8Swdenk 20496e5b03cSSimon Glass /* 20596e5b03cSSimon Glass * We don't support printing partition information in SPL and only support 20696e5b03cSSimon Glass * getting partition information in a few cases. 20796e5b03cSSimon Glass */ 20896e5b03cSSimon Glass #ifdef CONFIG_SPL_BUILD 20996e5b03cSSimon Glass # define part_print_ptr(x) NULL 210*d9b2678eSMichal Simek # if defined(CONFIG_SPL_EXT_SUPPORT) || defined(CONFIG_SPL_FAT_SUPPORT) || \ 21196e5b03cSSimon Glass defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION) 21296e5b03cSSimon Glass # define part_get_info_ptr(x) x 21396e5b03cSSimon Glass # else 21496e5b03cSSimon Glass # define part_get_info_ptr(x) NULL 21596e5b03cSSimon Glass # endif 21696e5b03cSSimon Glass #else 21796e5b03cSSimon Glass #define part_print_ptr(x) x 21896e5b03cSSimon Glass #define part_get_info_ptr(x) x 219012771d8Swdenk #endif 220012771d8Swdenk 221012771d8Swdenk 22296e5b03cSSimon Glass struct part_driver { 22396e5b03cSSimon Glass const char *name; 22496e5b03cSSimon Glass int part_type; 225012771d8Swdenk 22696e5b03cSSimon Glass /** 22796e5b03cSSimon Glass * get_info() - Get information about a partition 22896e5b03cSSimon Glass * 22996e5b03cSSimon Glass * @dev_desc: Block device descriptor 23096e5b03cSSimon Glass * @part: Partition number (1 = first) 23196e5b03cSSimon Glass * @info: Returns partition information 23296e5b03cSSimon Glass */ 23396e5b03cSSimon Glass int (*get_info)(struct blk_desc *dev_desc, int part, 2344101f687SSimon Glass disk_partition_t *info); 23596e5b03cSSimon Glass 23696e5b03cSSimon Glass /** 23796e5b03cSSimon Glass * print() - Print partition information 23896e5b03cSSimon Glass * 23996e5b03cSSimon Glass * @dev_desc: Block device descriptor 24096e5b03cSSimon Glass */ 24196e5b03cSSimon Glass void (*print)(struct blk_desc *dev_desc); 24296e5b03cSSimon Glass 24396e5b03cSSimon Glass /** 24496e5b03cSSimon Glass * test() - Test if a device contains this partition type 24596e5b03cSSimon Glass * 24696e5b03cSSimon Glass * @dev_desc: Block device descriptor 24796e5b03cSSimon Glass * @return 0 if the block device appears to contain this partition 24896e5b03cSSimon Glass * type, -ve if not 24996e5b03cSSimon Glass */ 25096e5b03cSSimon Glass int (*test)(struct blk_desc *dev_desc); 25196e5b03cSSimon Glass }; 25296e5b03cSSimon Glass 25396e5b03cSSimon Glass /* Declare a new U-Boot partition 'driver' */ 25496e5b03cSSimon Glass #define U_BOOT_PART_TYPE(__name) \ 25596e5b03cSSimon Glass ll_entry_declare(struct part_driver, __name, part_driver) 256c7de829cSwdenk 25707f3d789Srichardretanubun #ifdef CONFIG_EFI_PARTITION 25840684ddbSLukasz Majewski #include <part_efi.h> 25907f3d789Srichardretanubun /* disk/part_efi.c */ 26060bf9416SSteve Rae /** 2613e8bd469SSimon Glass * part_get_info_efi_by_name() - Find the specified GPT partition table entry 26260bf9416SSteve Rae * 26360bf9416SSteve Rae * @param dev_desc - block device descriptor 26460bf9416SSteve Rae * @param gpt_name - the specified table entry name 26560bf9416SSteve Rae * @param info - returns the disk partition info 26660bf9416SSteve Rae * 26760bf9416SSteve Rae * @return - '0' on match, '-1' on no match, otherwise error 26860bf9416SSteve Rae */ 2693e8bd469SSimon Glass int part_get_info_efi_by_name(struct blk_desc *dev_desc, 27060bf9416SSteve Rae const char *name, disk_partition_t *info); 27140684ddbSLukasz Majewski 27240684ddbSLukasz Majewski /** 27340684ddbSLukasz Majewski * write_gpt_table() - Write the GUID Partition Table to disk 27440684ddbSLukasz Majewski * 27540684ddbSLukasz Majewski * @param dev_desc - block device descriptor 27640684ddbSLukasz Majewski * @param gpt_h - pointer to GPT header representation 27740684ddbSLukasz Majewski * @param gpt_e - pointer to GPT partition table entries 27840684ddbSLukasz Majewski * 27940684ddbSLukasz Majewski * @return - zero on success, otherwise error 28040684ddbSLukasz Majewski */ 2814101f687SSimon Glass int write_gpt_table(struct blk_desc *dev_desc, 28240684ddbSLukasz Majewski gpt_header *gpt_h, gpt_entry *gpt_e); 28340684ddbSLukasz Majewski 28440684ddbSLukasz Majewski /** 28540684ddbSLukasz Majewski * gpt_fill_pte(): Fill the GPT partition table entry 28640684ddbSLukasz Majewski * 28740684ddbSLukasz Majewski * @param gpt_h - GPT header representation 28840684ddbSLukasz Majewski * @param gpt_e - GPT partition table entries 28940684ddbSLukasz Majewski * @param partitions - list of partitions 29040684ddbSLukasz Majewski * @param parts - number of partitions 29140684ddbSLukasz Majewski * 29240684ddbSLukasz Majewski * @return zero on success 29340684ddbSLukasz Majewski */ 29440684ddbSLukasz Majewski int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e, 29540684ddbSLukasz Majewski disk_partition_t *partitions, int parts); 29640684ddbSLukasz Majewski 29740684ddbSLukasz Majewski /** 29840684ddbSLukasz Majewski * gpt_fill_header(): Fill the GPT header 29940684ddbSLukasz Majewski * 30040684ddbSLukasz Majewski * @param dev_desc - block device descriptor 30140684ddbSLukasz Majewski * @param gpt_h - GPT header representation 30240684ddbSLukasz Majewski * @param str_guid - disk guid string representation 30340684ddbSLukasz Majewski * @param parts_count - number of partitions 30440684ddbSLukasz Majewski * 30540684ddbSLukasz Majewski * @return - error on str_guid conversion error 30640684ddbSLukasz Majewski */ 3074101f687SSimon Glass int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h, 30840684ddbSLukasz Majewski char *str_guid, int parts_count); 30940684ddbSLukasz Majewski 31040684ddbSLukasz Majewski /** 31140684ddbSLukasz Majewski * gpt_restore(): Restore GPT partition table 31240684ddbSLukasz Majewski * 31340684ddbSLukasz Majewski * @param dev_desc - block device descriptor 31440684ddbSLukasz Majewski * @param str_disk_guid - disk GUID 31540684ddbSLukasz Majewski * @param partitions - list of partitions 31640684ddbSLukasz Majewski * @param parts - number of partitions 31740684ddbSLukasz Majewski * 31840684ddbSLukasz Majewski * @return zero on success 31940684ddbSLukasz Majewski */ 3204101f687SSimon Glass int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid, 32140684ddbSLukasz Majewski disk_partition_t *partitions, const int parts_count); 3220ff7e585SSteve Rae 3230ff7e585SSteve Rae /** 3240ff7e585SSteve Rae * is_valid_gpt_buf() - Ensure that the Primary GPT information is valid 3250ff7e585SSteve Rae * 3260ff7e585SSteve Rae * @param dev_desc - block device descriptor 3270ff7e585SSteve Rae * @param buf - buffer which contains the MBR and Primary GPT info 3280ff7e585SSteve Rae * 3290ff7e585SSteve Rae * @return - '0' on success, otherwise error 3300ff7e585SSteve Rae */ 3314101f687SSimon Glass int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf); 3320ff7e585SSteve Rae 3330ff7e585SSteve Rae /** 3340ff7e585SSteve Rae * write_mbr_and_gpt_partitions() - write MBR, Primary GPT and Backup GPT 3350ff7e585SSteve Rae * 3360ff7e585SSteve Rae * @param dev_desc - block device descriptor 3370ff7e585SSteve Rae * @param buf - buffer which contains the MBR and Primary GPT info 3380ff7e585SSteve Rae * 3390ff7e585SSteve Rae * @return - '0' on success, otherwise error 3400ff7e585SSteve Rae */ 3414101f687SSimon Glass int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf); 342cef68bf9SLukasz Majewski 343cef68bf9SLukasz Majewski /** 344cef68bf9SLukasz Majewski * gpt_verify_headers() - Function to read and CRC32 check of the GPT's header 345cef68bf9SLukasz Majewski * and partition table entries (PTE) 346cef68bf9SLukasz Majewski * 347cef68bf9SLukasz Majewski * As a side effect if sets gpt_head and gpt_pte so they point to GPT data. 348cef68bf9SLukasz Majewski * 349cef68bf9SLukasz Majewski * @param dev_desc - block device descriptor 350cef68bf9SLukasz Majewski * @param gpt_head - pointer to GPT header data read from medium 351cef68bf9SLukasz Majewski * @param gpt_pte - pointer to GPT partition table enties read from medium 352cef68bf9SLukasz Majewski * 353cef68bf9SLukasz Majewski * @return - '0' on success, otherwise error 354cef68bf9SLukasz Majewski */ 3554101f687SSimon Glass int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, 356cef68bf9SLukasz Majewski gpt_entry **gpt_pte); 357cef68bf9SLukasz Majewski 358cef68bf9SLukasz Majewski /** 359cef68bf9SLukasz Majewski * gpt_verify_partitions() - Function to check if partitions' name, start and 360cef68bf9SLukasz Majewski * size correspond to '$partitions' env variable 361cef68bf9SLukasz Majewski * 362cef68bf9SLukasz Majewski * This function checks if on medium stored GPT data is in sync with information 363cef68bf9SLukasz Majewski * provided in '$partitions' environment variable. Specificially, name, start 364cef68bf9SLukasz Majewski * and size of the partition is checked. 365cef68bf9SLukasz Majewski * 366cef68bf9SLukasz Majewski * @param dev_desc - block device descriptor 367cef68bf9SLukasz Majewski * @param partitions - partition data read from '$partitions' env variable 368cef68bf9SLukasz Majewski * @param parts - number of partitions read from '$partitions' env variable 369cef68bf9SLukasz Majewski * @param gpt_head - pointer to GPT header data read from medium 370cef68bf9SLukasz Majewski * @param gpt_pte - pointer to GPT partition table enties read from medium 371cef68bf9SLukasz Majewski * 372cef68bf9SLukasz Majewski * @return - '0' on success, otherwise error 373cef68bf9SLukasz Majewski */ 3744101f687SSimon Glass int gpt_verify_partitions(struct blk_desc *dev_desc, 375cef68bf9SLukasz Majewski disk_partition_t *partitions, int parts, 376cef68bf9SLukasz Majewski gpt_header *gpt_head, gpt_entry **gpt_pte); 37707f3d789Srichardretanubun #endif 37807f3d789Srichardretanubun 379012771d8Swdenk #endif /* _PART_H */ 380