mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 18:35:42 +01:00 
			
		
		
		
	efi_loader: provide function to get last node of a device path
On a block device and its partitions the same protocols can be installed. To tell the apart we can use the type of the last node of the device path which is not the end node. The patch provides a utility function to find this last node. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
		
				
					committed by
					
						 Alexander Graf
						Alexander Graf
					
				
			
			
				
	
			
			
			
						parent
						
							4f94865b30
						
					
				
				
					commit
					65436f91c5
				
			| @@ -312,6 +312,9 @@ struct efi_device_path *efi_dp_from_eth(void); | |||||||
| struct efi_device_path *efi_dp_from_mem(uint32_t mem_type, | struct efi_device_path *efi_dp_from_mem(uint32_t mem_type, | ||||||
| 					uint64_t start_address, | 					uint64_t start_address, | ||||||
| 					uint64_t end_address); | 					uint64_t end_address); | ||||||
|  | /* Determine the last device path node that is not the end node. */ | ||||||
|  | const struct efi_device_path *efi_dp_last_node( | ||||||
|  | 			const struct efi_device_path *dp); | ||||||
| efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, | efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, | ||||||
| 				    struct efi_device_path **device_path, | 				    struct efi_device_path **device_path, | ||||||
| 				    struct efi_device_path **file_path); | 				    struct efi_device_path **file_path); | ||||||
|   | |||||||
| @@ -208,6 +208,26 @@ struct efi_object *efi_dp_find_obj(struct efi_device_path *dp, | |||||||
| 	return efiobj; | 	return efiobj; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Determine the last device path node that is not the end node. | ||||||
|  |  * | ||||||
|  |  * @dp		device path | ||||||
|  |  * @return	last node before the end node if it exists | ||||||
|  |  *		otherwise NULL | ||||||
|  |  */ | ||||||
|  | const struct efi_device_path *efi_dp_last_node(const struct efi_device_path *dp) | ||||||
|  | { | ||||||
|  | 	struct efi_device_path *ret; | ||||||
|  |  | ||||||
|  | 	if (!dp || dp->type == DEVICE_PATH_TYPE_END) | ||||||
|  | 		return NULL; | ||||||
|  | 	while (dp) { | ||||||
|  | 		ret = (struct efi_device_path *)dp; | ||||||
|  | 		dp = efi_dp_next(dp); | ||||||
|  | 	} | ||||||
|  | 	return ret; | ||||||
|  | } | ||||||
|  |  | ||||||
| /* return size not including End node: */ | /* return size not including End node: */ | ||||||
| unsigned efi_dp_size(const struct efi_device_path *dp) | unsigned efi_dp_size(const struct efi_device_path *dp) | ||||||
| { | { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user