xref: /rk3399_rockchip-uboot/include/part.h (revision 96e5b03c8ab749b6547f6a3ceb4d4b9f274211aa)
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 
130472fbfdSEgbert Eich #define LOG2(x) (((x & 0xaaaaaaaa) ? 1 : 0) + ((x & 0xcccccccc) ? 2 : 0) + \
140472fbfdSEgbert Eich 		 ((x & 0xf0f0f0f0) ? 4 : 0) + ((x & 0xff00ff00) ? 8 : 0) + \
150472fbfdSEgbert Eich 		 ((x & 0xffff0000) ? 16 : 0))
160472fbfdSEgbert Eich #define LOG2_INVALID(type) ((type)((sizeof(type)<<3)-1))
17ae1768a7SEgbert Eich 
18012771d8Swdenk /* Part types */
19012771d8Swdenk #define PART_TYPE_UNKNOWN	0x00
20012771d8Swdenk #define PART_TYPE_MAC		0x01
21012771d8Swdenk #define PART_TYPE_DOS		0x02
22012771d8Swdenk #define PART_TYPE_ISO		0x03
23c7de829cSwdenk #define PART_TYPE_AMIGA		0x04
2407f3d789Srichardretanubun #define PART_TYPE_EFI		0x05
25c7de829cSwdenk 
26b0fce99bSwdenk /*
27b0fce99bSwdenk  * Type string for U-Boot bootable partitions
28b0fce99bSwdenk  */
29b0fce99bSwdenk #define BOOT_PART_TYPE	"U-Boot"	/* primary boot partition type	*/
30b0fce99bSwdenk #define BOOT_PART_COMP	"PPCBoot"	/* PPCBoot compatibility type	*/
31b0fce99bSwdenk 
32012771d8Swdenk /* device types */
33012771d8Swdenk #define DEV_TYPE_UNKNOWN	0xff	/* not connected */
34012771d8Swdenk #define DEV_TYPE_HARDDISK	0x00	/* harddisk */
35012771d8Swdenk #define DEV_TYPE_TAPE		0x01	/* Tape */
36012771d8Swdenk #define DEV_TYPE_CDROM		0x05	/* CD-ROM */
37012771d8Swdenk #define DEV_TYPE_OPDISK		0x07	/* optical disk */
38012771d8Swdenk 
39012771d8Swdenk typedef struct disk_partition {
4004735e9cSFrederic Leroy 	lbaint_t	start;	/* # of first block in partition	*/
4104735e9cSFrederic Leroy 	lbaint_t	size;	/* number of blocks in partition	*/
42012771d8Swdenk 	ulong	blksz;		/* block size in bytes			*/
43012771d8Swdenk 	uchar	name[32];	/* partition name			*/
44012771d8Swdenk 	uchar	type[32];	/* string type description		*/
4540e0e568SRob Herring 	int	bootable;	/* Active/Bootable flag is set		*/
46894bfbbfSStephen Warren #ifdef CONFIG_PARTITION_UUIDS
47894bfbbfSStephen Warren 	char	uuid[37];	/* filesystem UUID as string, if exists	*/
48894bfbbfSStephen Warren #endif
497561b258SPatrick Delaunay #ifdef CONFIG_PARTITION_TYPE_GUID
507561b258SPatrick Delaunay 	char	type_guid[37];	/* type GUID as string, if exists	*/
517561b258SPatrick Delaunay #endif
52012771d8Swdenk } disk_partition_t;
53012771d8Swdenk 
54735dd97bSGrant Likely /* Misc _get_dev functions */
55df3fc526SMatthew McClintock #ifdef CONFIG_PARTITIONS
56fb1b7be9SSimon Glass /**
57db1d9e78SSimon Glass  * blk_get_dev() - get a pointer to a block device given its type and number
58fb1b7be9SSimon Glass  *
59fb1b7be9SSimon Glass  * Each interface allocates its own devices and typically struct blk_desc is
60fb1b7be9SSimon Glass  * contained with the interface's data structure. There is no global
61fb1b7be9SSimon Glass  * numbering for block devices, so the interface name must be provided.
62fb1b7be9SSimon Glass  *
63fb1b7be9SSimon Glass  * @ifname:	Interface name (e.g. "ide", "scsi")
64fb1b7be9SSimon Glass  * @dev:	Device number (0 for first device on that interface, 1 for
65fb1b7be9SSimon Glass  *		second, etc.
66fb1b7be9SSimon Glass  * @return pointer to the block device, or NULL if not available, or an
67fb1b7be9SSimon Glass  *	   error occurred.
68fb1b7be9SSimon Glass  */
69db1d9e78SSimon Glass struct blk_desc *blk_get_dev(const char *ifname, int dev);
704101f687SSimon Glass struct blk_desc *ide_get_dev(int dev);
714101f687SSimon Glass struct blk_desc *sata_get_dev(int dev);
724101f687SSimon Glass struct blk_desc *scsi_get_dev(int dev);
734101f687SSimon Glass struct blk_desc *usb_stor_get_dev(int dev);
744101f687SSimon Glass struct blk_desc *mmc_get_dev(int dev);
75fb1b7be9SSimon Glass 
76fb1b7be9SSimon Glass /**
77fb1b7be9SSimon Glass  * mmc_select_hwpart() - Select the MMC hardware partiion on an MMC device
78fb1b7be9SSimon Glass  *
79fb1b7be9SSimon Glass  * MMC devices can support partitioning at the hardware level. This is quite
80fb1b7be9SSimon Glass  * separate from the normal idea of software-based partitions. MMC hardware
81fb1b7be9SSimon Glass  * partitions must be explicitly selected. Once selected only the region of
82fb1b7be9SSimon Glass  * the device covered by that partition is accessible.
83fb1b7be9SSimon Glass  *
84fb1b7be9SSimon Glass  * The MMC standard provides for two boot partitions (numbered 1 and 2),
85fb1b7be9SSimon Glass  * rpmb (3), and up to 4 addition general-purpose partitions (4-7).
86fb1b7be9SSimon Glass  *
87fb1b7be9SSimon Glass  * @dev_num:	Block device number (struct blk_desc->dev value)
88fb1b7be9SSimon Glass  * @hwpart:	Hardware partition number to select. 0 means the raw device,
89fb1b7be9SSimon Glass  *		1 is the first partition, 2 is the second, etc.
90fb1b7be9SSimon Glass  * @return 0 if OK, other value for an error
91fb1b7be9SSimon Glass  */
92d2356284SStephen Warren int mmc_select_hwpart(int dev_num, int hwpart);
934101f687SSimon Glass struct blk_desc *systemace_get_dev(int dev);
944101f687SSimon Glass struct blk_desc *mg_disk_get_dev(int dev);
954101f687SSimon Glass struct blk_desc *host_get_dev(int dev);
964101f687SSimon Glass int host_get_dev_err(int dev, struct blk_desc **blk_devp);
97735dd97bSGrant Likely 
98012771d8Swdenk /* disk/part.c */
994101f687SSimon Glass int get_partition_info(struct blk_desc *dev_desc, int part,
1004101f687SSimon Glass 		       disk_partition_t *info);
1014101f687SSimon Glass void print_part(struct blk_desc *dev_desc);
1024101f687SSimon Glass void init_part(struct blk_desc *dev_desc);
1034101f687SSimon Glass void dev_print(struct blk_desc *dev_desc);
104ebac37cfSSimon Glass 
105ebac37cfSSimon Glass /**
106ebac37cfSSimon Glass  * blk_get_device_by_str() - Get a block device given its interface/hw partition
107ebac37cfSSimon Glass  *
108ebac37cfSSimon Glass  * Each interface allocates its own devices and typically struct blk_desc is
109ebac37cfSSimon Glass  * contained with the interface's data structure. There is no global
110ebac37cfSSimon Glass  * numbering for block devices, so the interface name must be provided.
111ebac37cfSSimon Glass  *
112ebac37cfSSimon Glass  * The hardware parition is not related to the normal software partitioning
113ebac37cfSSimon Glass  * of a device - each hardware partition is effectively a separately
114ebac37cfSSimon Glass  * accessible block device. When a hardware parition is selected on MMC the
115ebac37cfSSimon Glass  * other hardware partitions become inaccessible. The same block device is
116ebac37cfSSimon Glass  * used to access all hardware partitions, but its capacity may change when a
117ebac37cfSSimon Glass  * different hardware partition is selected.
118ebac37cfSSimon Glass  *
119ebac37cfSSimon Glass  * When a hardware partition number is given, the block device switches to
120ebac37cfSSimon Glass  * that hardware partition.
121ebac37cfSSimon Glass  *
122ebac37cfSSimon Glass  * @ifname:	Interface name (e.g. "ide", "scsi")
123ebac37cfSSimon Glass  * @dev_str:	Device and optional hw partition. This can either be a string
124ebac37cfSSimon Glass  *		containing the device number (e.g. "2") or the device number
125ebac37cfSSimon Glass  *		and hardware partition number (e.g. "2.4") for devices that
126ebac37cfSSimon Glass  *		support it (currently only MMC).
127ebac37cfSSimon Glass  * @dev_desc:	Returns a pointer to the block device on success
128ebac37cfSSimon Glass  * @return block device number (local to the interface), or -1 on error
129ebac37cfSSimon Glass  */
130ebac37cfSSimon Glass int blk_get_device_by_str(const char *ifname, const char *dev_str,
1314101f687SSimon Glass 			  struct blk_desc **dev_desc);
132e35929e4SSimon Glass 
133e35929e4SSimon Glass /**
134e35929e4SSimon Glass  * blk_get_device_part_str() - Get a block device and partition
135e35929e4SSimon Glass  *
136e35929e4SSimon Glass  * This calls blk_get_device_by_str() to look up a device. It also looks up
137e35929e4SSimon Glass  * a partition and returns information about it.
138e35929e4SSimon Glass  *
139e35929e4SSimon Glass  * @dev_part_str is in the format:
140e35929e4SSimon Glass  *	<dev>.<hw_part>:<part> where <dev> is the device number,
141e35929e4SSimon Glass  *	<hw_part> is the optional hardware partition number and
142e35929e4SSimon Glass  *	<part> is the partition number
143e35929e4SSimon Glass  *
144e35929e4SSimon Glass  * If ifname is "hostfs" then this function returns the sandbox host block
145e35929e4SSimon Glass  * device.
146e35929e4SSimon Glass  *
147e35929e4SSimon Glass  * If ifname is ubi, then this function returns 0, with @info set to a
148e35929e4SSimon Glass  * special UBI device.
149e35929e4SSimon Glass  *
150e35929e4SSimon Glass  * If @dev_part_str is NULL or empty or "-", then this function looks up
151e35929e4SSimon Glass  * the "bootdevice" environment variable and uses that string instead.
152e35929e4SSimon Glass  *
153e35929e4SSimon Glass  * If the partition string is empty then the first partition is used. If the
154e35929e4SSimon Glass  * partition string is "auto" then the first bootable partition is used.
155e35929e4SSimon Glass  *
156e35929e4SSimon Glass  * @ifname:	Interface name (e.g. "ide", "scsi")
157e35929e4SSimon Glass  * @dev_part_str:	Device and partition string
158e35929e4SSimon Glass  * @dev_desc:	Returns a pointer to the block device on success
159e35929e4SSimon Glass  * @info:	Returns partition information
160e35929e4SSimon Glass  * @allow_whole_dev:	true to allow the user to select partition 0
161e35929e4SSimon Glass  *		(which means the whole device), false to require a valid
162e35929e4SSimon Glass  *		partition number >= 1
163e35929e4SSimon Glass  * @return partition number, or -1 on error
164e35929e4SSimon Glass  *
165e35929e4SSimon Glass  */
166e35929e4SSimon Glass int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
1674101f687SSimon Glass 			    struct blk_desc **dev_desc,
16810a37fd7SStephen Warren 			    disk_partition_t *info, int allow_whole_dev);
169df3fc526SMatthew McClintock #else
170db1d9e78SSimon Glass static inline struct blk_desc *blk_get_dev(const char *ifname, int dev)
17199d2c205SRob Herring { return NULL; }
1724101f687SSimon Glass static inline struct blk_desc *ide_get_dev(int dev) { return NULL; }
1734101f687SSimon Glass static inline struct blk_desc *sata_get_dev(int dev) { return NULL; }
1744101f687SSimon Glass static inline struct blk_desc *scsi_get_dev(int dev) { return NULL; }
1754101f687SSimon Glass static inline struct blk_desc *usb_stor_get_dev(int dev) { return NULL; }
1764101f687SSimon Glass static inline struct blk_desc *mmc_get_dev(int dev) { return NULL; }
177d2356284SStephen Warren static inline int mmc_select_hwpart(int dev_num, int hwpart) { return -1; }
1784101f687SSimon Glass static inline struct blk_desc *systemace_get_dev(int dev) { return NULL; }
1794101f687SSimon Glass static inline struct blk_desc *mg_disk_get_dev(int dev) { return NULL; }
1804101f687SSimon Glass static inline struct blk_desc *host_get_dev(int dev) { return NULL; }
181012771d8Swdenk 
1824101f687SSimon Glass static inline int get_partition_info(struct blk_desc *dev_desc, int part,
183df3fc526SMatthew McClintock 				     disk_partition_t *info) { return -1; }
1844101f687SSimon Glass static inline void print_part(struct blk_desc *dev_desc) {}
1854101f687SSimon Glass static inline void init_part(struct blk_desc *dev_desc) {}
1864101f687SSimon Glass static inline void dev_print(struct blk_desc *dev_desc) {}
187ebac37cfSSimon Glass static inline int blk_get_device_by_str(const char *ifname, const char *dev_str,
1884101f687SSimon Glass 					struct blk_desc **dev_desc)
1892023e608SStephen Warren { return -1; }
190e35929e4SSimon Glass static inline int blk_get_device_part_str(const char *ifname,
19110a37fd7SStephen Warren 					   const char *dev_part_str,
1924101f687SSimon Glass 					   struct blk_desc **dev_desc,
19310a37fd7SStephen Warren 					   disk_partition_t *info,
19410a37fd7SStephen Warren 					   int allow_whole_dev)
19599d2c205SRob Herring { *dev_desc = NULL; return -1; }
196df3fc526SMatthew McClintock #endif
197012771d8Swdenk 
198*96e5b03cSSimon Glass /*
199*96e5b03cSSimon Glass  * We don't support printing partition information in SPL and only support
200*96e5b03cSSimon Glass  * getting partition information in a few cases.
201*96e5b03cSSimon Glass  */
202*96e5b03cSSimon Glass #ifdef CONFIG_SPL_BUILD
203*96e5b03cSSimon Glass # define part_print_ptr(x)	NULL
204*96e5b03cSSimon Glass # if defined(CONFIG_SPL_EXT_SUPPORT) || \
205*96e5b03cSSimon Glass 	defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
206*96e5b03cSSimon Glass #  define part_get_info_ptr(x)	x
207*96e5b03cSSimon Glass # else
208*96e5b03cSSimon Glass #  define part_get_info_ptr(x)	NULL
209*96e5b03cSSimon Glass # endif
210*96e5b03cSSimon Glass #else
211*96e5b03cSSimon Glass #define part_print_ptr(x)	x
212*96e5b03cSSimon Glass #define part_get_info_ptr(x)	x
213012771d8Swdenk #endif
214012771d8Swdenk 
215012771d8Swdenk 
216*96e5b03cSSimon Glass struct part_driver {
217*96e5b03cSSimon Glass 	const char *name;
218*96e5b03cSSimon Glass 	int part_type;
219012771d8Swdenk 
220*96e5b03cSSimon Glass 	/**
221*96e5b03cSSimon Glass 	 * get_info() - Get information about a partition
222*96e5b03cSSimon Glass 	 *
223*96e5b03cSSimon Glass 	 * @dev_desc:	Block device descriptor
224*96e5b03cSSimon Glass 	 * @part:	Partition number (1 = first)
225*96e5b03cSSimon Glass 	 * @info:	Returns partition information
226*96e5b03cSSimon Glass 	 */
227*96e5b03cSSimon Glass 	int (*get_info)(struct blk_desc *dev_desc, int part,
2284101f687SSimon Glass 			disk_partition_t *info);
229*96e5b03cSSimon Glass 
230*96e5b03cSSimon Glass 	/**
231*96e5b03cSSimon Glass 	 * print() - Print partition information
232*96e5b03cSSimon Glass 	 *
233*96e5b03cSSimon Glass 	 * @dev_desc:	Block device descriptor
234*96e5b03cSSimon Glass 	 */
235*96e5b03cSSimon Glass 	void (*print)(struct blk_desc *dev_desc);
236*96e5b03cSSimon Glass 
237*96e5b03cSSimon Glass 	/**
238*96e5b03cSSimon Glass 	 * test() - Test if a device contains this partition type
239*96e5b03cSSimon Glass 	 *
240*96e5b03cSSimon Glass 	 * @dev_desc:	Block device descriptor
241*96e5b03cSSimon Glass 	 * @return 0 if the block device appears to contain this partition
242*96e5b03cSSimon Glass 	 *	   type, -ve if not
243*96e5b03cSSimon Glass 	 */
244*96e5b03cSSimon Glass 	int (*test)(struct blk_desc *dev_desc);
245*96e5b03cSSimon Glass };
246*96e5b03cSSimon Glass 
247*96e5b03cSSimon Glass /* Declare a new U-Boot partition 'driver' */
248*96e5b03cSSimon Glass #define U_BOOT_PART_TYPE(__name)					\
249*96e5b03cSSimon Glass 	ll_entry_declare(struct part_driver, __name, part_driver)
250c7de829cSwdenk 
25107f3d789Srichardretanubun #ifdef CONFIG_EFI_PARTITION
25240684ddbSLukasz Majewski #include <part_efi.h>
25307f3d789Srichardretanubun /* disk/part_efi.c */
25460bf9416SSteve Rae /**
25560bf9416SSteve Rae  * get_partition_info_efi_by_name() - Find the specified GPT partition table entry
25660bf9416SSteve Rae  *
25760bf9416SSteve Rae  * @param dev_desc - block device descriptor
25860bf9416SSteve Rae  * @param gpt_name - the specified table entry name
25960bf9416SSteve Rae  * @param info - returns the disk partition info
26060bf9416SSteve Rae  *
26160bf9416SSteve Rae  * @return - '0' on match, '-1' on no match, otherwise error
26260bf9416SSteve Rae  */
2634101f687SSimon Glass int get_partition_info_efi_by_name(struct blk_desc *dev_desc,
26460bf9416SSteve Rae 	const char *name, disk_partition_t *info);
26540684ddbSLukasz Majewski 
26640684ddbSLukasz Majewski /**
26740684ddbSLukasz Majewski  * write_gpt_table() - Write the GUID Partition Table to disk
26840684ddbSLukasz Majewski  *
26940684ddbSLukasz Majewski  * @param dev_desc - block device descriptor
27040684ddbSLukasz Majewski  * @param gpt_h - pointer to GPT header representation
27140684ddbSLukasz Majewski  * @param gpt_e - pointer to GPT partition table entries
27240684ddbSLukasz Majewski  *
27340684ddbSLukasz Majewski  * @return - zero on success, otherwise error
27440684ddbSLukasz Majewski  */
2754101f687SSimon Glass int write_gpt_table(struct blk_desc *dev_desc,
27640684ddbSLukasz Majewski 		  gpt_header *gpt_h, gpt_entry *gpt_e);
27740684ddbSLukasz Majewski 
27840684ddbSLukasz Majewski /**
27940684ddbSLukasz Majewski  * gpt_fill_pte(): Fill the GPT partition table entry
28040684ddbSLukasz Majewski  *
28140684ddbSLukasz Majewski  * @param gpt_h - GPT header representation
28240684ddbSLukasz Majewski  * @param gpt_e - GPT partition table entries
28340684ddbSLukasz Majewski  * @param partitions - list of partitions
28440684ddbSLukasz Majewski  * @param parts - number of partitions
28540684ddbSLukasz Majewski  *
28640684ddbSLukasz Majewski  * @return zero on success
28740684ddbSLukasz Majewski  */
28840684ddbSLukasz Majewski int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
28940684ddbSLukasz Majewski 		disk_partition_t *partitions, int parts);
29040684ddbSLukasz Majewski 
29140684ddbSLukasz Majewski /**
29240684ddbSLukasz Majewski  * gpt_fill_header(): Fill the GPT header
29340684ddbSLukasz Majewski  *
29440684ddbSLukasz Majewski  * @param dev_desc - block device descriptor
29540684ddbSLukasz Majewski  * @param gpt_h - GPT header representation
29640684ddbSLukasz Majewski  * @param str_guid - disk guid string representation
29740684ddbSLukasz Majewski  * @param parts_count - number of partitions
29840684ddbSLukasz Majewski  *
29940684ddbSLukasz Majewski  * @return - error on str_guid conversion error
30040684ddbSLukasz Majewski  */
3014101f687SSimon Glass int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h,
30240684ddbSLukasz Majewski 		char *str_guid, int parts_count);
30340684ddbSLukasz Majewski 
30440684ddbSLukasz Majewski /**
30540684ddbSLukasz Majewski  * gpt_restore(): Restore GPT partition table
30640684ddbSLukasz Majewski  *
30740684ddbSLukasz Majewski  * @param dev_desc - block device descriptor
30840684ddbSLukasz Majewski  * @param str_disk_guid - disk GUID
30940684ddbSLukasz Majewski  * @param partitions - list of partitions
31040684ddbSLukasz Majewski  * @param parts - number of partitions
31140684ddbSLukasz Majewski  *
31240684ddbSLukasz Majewski  * @return zero on success
31340684ddbSLukasz Majewski  */
3144101f687SSimon Glass int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid,
31540684ddbSLukasz Majewski 		disk_partition_t *partitions, const int parts_count);
3160ff7e585SSteve Rae 
3170ff7e585SSteve Rae /**
3180ff7e585SSteve Rae  * is_valid_gpt_buf() - Ensure that the Primary GPT information is valid
3190ff7e585SSteve Rae  *
3200ff7e585SSteve Rae  * @param dev_desc - block device descriptor
3210ff7e585SSteve Rae  * @param buf - buffer which contains the MBR and Primary GPT info
3220ff7e585SSteve Rae  *
3230ff7e585SSteve Rae  * @return - '0' on success, otherwise error
3240ff7e585SSteve Rae  */
3254101f687SSimon Glass int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf);
3260ff7e585SSteve Rae 
3270ff7e585SSteve Rae /**
3280ff7e585SSteve Rae  * write_mbr_and_gpt_partitions() - write MBR, Primary GPT and Backup GPT
3290ff7e585SSteve Rae  *
3300ff7e585SSteve Rae  * @param dev_desc - block device descriptor
3310ff7e585SSteve Rae  * @param buf - buffer which contains the MBR and Primary GPT info
3320ff7e585SSteve Rae  *
3330ff7e585SSteve Rae  * @return - '0' on success, otherwise error
3340ff7e585SSteve Rae  */
3354101f687SSimon Glass int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf);
336cef68bf9SLukasz Majewski 
337cef68bf9SLukasz Majewski /**
338cef68bf9SLukasz Majewski  * gpt_verify_headers() - Function to read and CRC32 check of the GPT's header
339cef68bf9SLukasz Majewski  *                        and partition table entries (PTE)
340cef68bf9SLukasz Majewski  *
341cef68bf9SLukasz Majewski  * As a side effect if sets gpt_head and gpt_pte so they point to GPT data.
342cef68bf9SLukasz Majewski  *
343cef68bf9SLukasz Majewski  * @param dev_desc - block device descriptor
344cef68bf9SLukasz Majewski  * @param gpt_head - pointer to GPT header data read from medium
345cef68bf9SLukasz Majewski  * @param gpt_pte - pointer to GPT partition table enties read from medium
346cef68bf9SLukasz Majewski  *
347cef68bf9SLukasz Majewski  * @return - '0' on success, otherwise error
348cef68bf9SLukasz Majewski  */
3494101f687SSimon Glass int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
350cef68bf9SLukasz Majewski 		       gpt_entry **gpt_pte);
351cef68bf9SLukasz Majewski 
352cef68bf9SLukasz Majewski /**
353cef68bf9SLukasz Majewski  * gpt_verify_partitions() - Function to check if partitions' name, start and
354cef68bf9SLukasz Majewski  *                           size correspond to '$partitions' env variable
355cef68bf9SLukasz Majewski  *
356cef68bf9SLukasz Majewski  * This function checks if on medium stored GPT data is in sync with information
357cef68bf9SLukasz Majewski  * provided in '$partitions' environment variable. Specificially, name, start
358cef68bf9SLukasz Majewski  * and size of the partition is checked.
359cef68bf9SLukasz Majewski  *
360cef68bf9SLukasz Majewski  * @param dev_desc - block device descriptor
361cef68bf9SLukasz Majewski  * @param partitions - partition data read from '$partitions' env variable
362cef68bf9SLukasz Majewski  * @param parts - number of partitions read from '$partitions' env variable
363cef68bf9SLukasz Majewski  * @param gpt_head - pointer to GPT header data read from medium
364cef68bf9SLukasz Majewski  * @param gpt_pte - pointer to GPT partition table enties read from medium
365cef68bf9SLukasz Majewski  *
366cef68bf9SLukasz Majewski  * @return - '0' on success, otherwise error
367cef68bf9SLukasz Majewski  */
3684101f687SSimon Glass int gpt_verify_partitions(struct blk_desc *dev_desc,
369cef68bf9SLukasz Majewski 			  disk_partition_t *partitions, int parts,
370cef68bf9SLukasz Majewski 			  gpt_header *gpt_head, gpt_entry **gpt_pte);
37107f3d789Srichardretanubun #endif
37207f3d789Srichardretanubun 
373012771d8Swdenk #endif /* _PART_H */
374