efi_loader: adjust definitions of variable services
The definitons of the variable services are adjusted: - use efi_uintn_t instead of unsigned long - use u16 * instead of s16 * for Unicode strings - correct definition of QueryVariableInfo - rename efi_get_next_variable to efi_get_next_variable_name Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
		
							parent
							
								
									e37aa7ada3
								
							
						
					
					
						commit
						45c66f9cdf
					
				|  | @ -214,15 +214,15 @@ struct efi_runtime_services { | ||||||
| 			uint32_t descriptor_version, | 			uint32_t descriptor_version, | ||||||
| 			struct efi_mem_desc *virtmap); | 			struct efi_mem_desc *virtmap); | ||||||
| 	efi_status_t (*convert_pointer)(unsigned long dbg, void **address); | 	efi_status_t (*convert_pointer)(unsigned long dbg, void **address); | ||||||
| 	efi_status_t (EFIAPI *get_variable)(s16 *variable_name, | 	efi_status_t (EFIAPI *get_variable)(u16 *variable_name, | ||||||
| 					    efi_guid_t *vendor, u32 *attributes, | 					    efi_guid_t *vendor, u32 *attributes, | ||||||
| 			unsigned long *data_size, void *data); | 					    efi_uintn_t *data_size, void *data); | ||||||
| 	efi_status_t (EFIAPI *get_next_variable)( | 	efi_status_t (EFIAPI *get_next_variable_name)( | ||||||
| 			unsigned long *variable_name_size, | 			efi_uintn_t *variable_name_size, | ||||||
| 			s16 *variable_name, efi_guid_t *vendor); | 			u16 *variable_name, efi_guid_t *vendor); | ||||||
| 	efi_status_t (EFIAPI *set_variable)(s16 *variable_name, | 	efi_status_t (EFIAPI *set_variable)(u16 *variable_name, | ||||||
| 					    efi_guid_t *vendor, u32 attributes, | 					    efi_guid_t *vendor, u32 attributes, | ||||||
| 			unsigned long data_size, void *data); | 					    efi_uintn_t data_size, void *data); | ||||||
| 	efi_status_t (EFIAPI *get_next_high_mono_count)( | 	efi_status_t (EFIAPI *get_next_high_mono_count)( | ||||||
| 			uint32_t *high_count); | 			uint32_t *high_count); | ||||||
| 	void (EFIAPI *reset_system)(enum efi_reset_type reset_type, | 	void (EFIAPI *reset_system)(enum efi_reset_type reset_type, | ||||||
|  | @ -239,9 +239,9 @@ struct efi_runtime_services { | ||||||
| 			u32 reset_type); | 			u32 reset_type); | ||||||
| 	efi_status_t (EFIAPI *query_variable_info)( | 	efi_status_t (EFIAPI *query_variable_info)( | ||||||
| 			u32 attributes, | 			u32 attributes, | ||||||
| 			u64 maximum_variable_storage_size, | 			u64 *maximum_variable_storage_size, | ||||||
| 			u64 remaining_variable_storage_size, | 			u64 *remaining_variable_storage_size, | ||||||
| 			u64 maximum_variable_size); | 			u64 *maximum_variable_size); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /* EFI event group GUID definitions */ | /* EFI event group GUID definitions */ | ||||||
|  |  | ||||||
|  | @ -422,15 +422,15 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, | ||||||
| 				 struct efi_system_table *systab); | 				 struct efi_system_table *systab); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| efi_status_t EFIAPI efi_get_variable(s16 *variable_name, | efi_status_t EFIAPI efi_get_variable(u16 *variable_name, efi_guid_t *vendor, | ||||||
| 		efi_guid_t *vendor, u32 *attributes, | 				     u32 *attributes, efi_uintn_t *data_size, | ||||||
| 		unsigned long *data_size, void *data); | 				     void *data); | ||||||
| efi_status_t EFIAPI efi_get_next_variable( | efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size, | ||||||
| 		unsigned long *variable_name_size, | 					       u16 *variable_name, | ||||||
| 		s16 *variable_name, efi_guid_t *vendor); | 					       efi_guid_t *vendor); | ||||||
| efi_status_t EFIAPI efi_set_variable(s16 *variable_name, | efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor, | ||||||
| 		efi_guid_t *vendor, u32 attributes, | 				     u32 attributes, efi_uintn_t data_size, | ||||||
| 		unsigned long data_size, void *data); | 				     void *data); | ||||||
| 
 | 
 | ||||||
| void *efi_bootmgr_load(struct efi_device_path **device_path, | void *efi_bootmgr_load(struct efi_device_path **device_path, | ||||||
| 		       struct efi_device_path **file_path); | 		       struct efi_device_path **file_path); | ||||||
|  |  | ||||||
|  | @ -70,17 +70,17 @@ static void parse_load_option(struct load_option *lo, void *ptr) | ||||||
| 
 | 
 | ||||||
| /* free() the result */ | /* free() the result */ | ||||||
| static void *get_var(u16 *name, const efi_guid_t *vendor, | static void *get_var(u16 *name, const efi_guid_t *vendor, | ||||||
| 		     unsigned long *size) | 		     efi_uintn_t *size) | ||||||
| { | { | ||||||
| 	efi_guid_t *v = (efi_guid_t *)vendor; | 	efi_guid_t *v = (efi_guid_t *)vendor; | ||||||
| 	efi_status_t ret; | 	efi_status_t ret; | ||||||
| 	void *buf = NULL; | 	void *buf = NULL; | ||||||
| 
 | 
 | ||||||
| 	*size = 0; | 	*size = 0; | ||||||
| 	EFI_CALL(ret = rs->get_variable((s16 *)name, v, NULL, size, buf)); | 	EFI_CALL(ret = rs->get_variable(name, v, NULL, size, buf)); | ||||||
| 	if (ret == EFI_BUFFER_TOO_SMALL) { | 	if (ret == EFI_BUFFER_TOO_SMALL) { | ||||||
| 		buf = malloc(*size); | 		buf = malloc(*size); | ||||||
| 		EFI_CALL(ret = rs->get_variable((s16 *)name, v, NULL, size, buf)); | 		EFI_CALL(ret = rs->get_variable(name, v, NULL, size, buf)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (ret != EFI_SUCCESS) { | 	if (ret != EFI_SUCCESS) { | ||||||
|  | @ -104,7 +104,7 @@ static void *try_load_entry(uint16_t n, struct efi_device_path **device_path, | ||||||
| 	u16 varname[] = L"Boot0000"; | 	u16 varname[] = L"Boot0000"; | ||||||
| 	u16 hexmap[] = L"0123456789ABCDEF"; | 	u16 hexmap[] = L"0123456789ABCDEF"; | ||||||
| 	void *load_option, *image = NULL; | 	void *load_option, *image = NULL; | ||||||
| 	unsigned long size; | 	efi_uintn_t size; | ||||||
| 
 | 
 | ||||||
| 	varname[4] = hexmap[(n & 0xf000) >> 12]; | 	varname[4] = hexmap[(n & 0xf000) >> 12]; | ||||||
| 	varname[5] = hexmap[(n & 0x0f00) >> 8]; | 	varname[5] = hexmap[(n & 0x0f00) >> 8]; | ||||||
|  | @ -147,7 +147,7 @@ void *efi_bootmgr_load(struct efi_device_path **device_path, | ||||||
| 		       struct efi_device_path **file_path) | 		       struct efi_device_path **file_path) | ||||||
| { | { | ||||||
| 	uint16_t *bootorder; | 	uint16_t *bootorder; | ||||||
| 	unsigned long size; | 	efi_uintn_t size; | ||||||
| 	void *image = NULL; | 	void *image = NULL; | ||||||
| 	int i, num; | 	int i, num; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -212,7 +212,7 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { | ||||||
| 		.ptr = &efi_runtime_services.get_variable, | 		.ptr = &efi_runtime_services.get_variable, | ||||||
| 		.patchto = &efi_device_error, | 		.patchto = &efi_device_error, | ||||||
| 	}, { | 	}, { | ||||||
| 		.ptr = &efi_runtime_services.get_next_variable, | 		.ptr = &efi_runtime_services.get_next_variable_name, | ||||||
| 		.patchto = &efi_device_error, | 		.patchto = &efi_device_error, | ||||||
| 	}, { | 	}, { | ||||||
| 		.ptr = &efi_runtime_services.set_variable, | 		.ptr = &efi_runtime_services.set_variable, | ||||||
|  | @ -444,9 +444,9 @@ efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps( | ||||||
| 
 | 
 | ||||||
| efi_status_t __efi_runtime EFIAPI efi_query_variable_info( | efi_status_t __efi_runtime EFIAPI efi_query_variable_info( | ||||||
| 			u32 attributes, | 			u32 attributes, | ||||||
| 			u64 maximum_variable_storage_size, | 			u64 *maximum_variable_storage_size, | ||||||
| 			u64 remaining_variable_storage_size, | 			u64 *remaining_variable_storage_size, | ||||||
| 			u64 maximum_variable_size) | 			u64 *maximum_variable_size) | ||||||
| { | { | ||||||
| 	return EFI_UNSUPPORTED; | 	return EFI_UNSUPPORTED; | ||||||
| } | } | ||||||
|  | @ -464,7 +464,7 @@ struct efi_runtime_services __efi_runtime_data efi_runtime_services = { | ||||||
| 	.set_virtual_address_map = &efi_set_virtual_address_map, | 	.set_virtual_address_map = &efi_set_virtual_address_map, | ||||||
| 	.convert_pointer = (void *)&efi_invalid_parameter, | 	.convert_pointer = (void *)&efi_invalid_parameter, | ||||||
| 	.get_variable = efi_get_variable, | 	.get_variable = efi_get_variable, | ||||||
| 	.get_next_variable = efi_get_next_variable, | 	.get_next_variable_name = efi_get_next_variable_name, | ||||||
| 	.set_variable = efi_set_variable, | 	.set_variable = efi_set_variable, | ||||||
| 	.get_next_high_mono_count = (void *)&efi_device_error, | 	.get_next_high_mono_count = (void *)&efi_device_error, | ||||||
| 	.reset_system = &efi_reset_system_boottime, | 	.reset_system = &efi_reset_system_boottime, | ||||||
|  |  | ||||||
|  | @ -113,7 +113,7 @@ static char *mem2hex(char *hexstr, const u8 *mem, int count) | ||||||
| 	return hexstr; | 	return hexstr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static efi_status_t efi_to_native(char *native, s16 *variable_name, | static efi_status_t efi_to_native(char *native, u16 *variable_name, | ||||||
| 				  efi_guid_t *vendor) | 				  efi_guid_t *vendor) | ||||||
| { | { | ||||||
| 	size_t len; | 	size_t len; | ||||||
|  | @ -176,9 +176,9 @@ static const char *parse_attr(const char *str, u32 *attrp) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#GetVariable.28.29 */ | /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#GetVariable.28.29 */ | ||||||
| efi_status_t EFIAPI efi_get_variable(s16 *variable_name, | efi_status_t EFIAPI efi_get_variable(u16 *variable_name, efi_guid_t *vendor, | ||||||
| 		efi_guid_t *vendor, u32 *attributes, | 				     u32 *attributes, efi_uintn_t *data_size, | ||||||
| 		unsigned long *data_size, void *data) | 				     void *data) | ||||||
| { | { | ||||||
| 	char native_name[MAX_NATIVE_VAR_NAME + 1]; | 	char native_name[MAX_NATIVE_VAR_NAME + 1]; | ||||||
| 	efi_status_t ret; | 	efi_status_t ret; | ||||||
|  | @ -250,9 +250,9 @@ efi_status_t EFIAPI efi_get_variable(s16 *variable_name, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#GetNextVariableName.28.29 */ | /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#GetNextVariableName.28.29 */ | ||||||
| efi_status_t EFIAPI efi_get_next_variable( | efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size, | ||||||
| 		unsigned long *variable_name_size, | 					       u16 *variable_name, | ||||||
| 		s16 *variable_name, efi_guid_t *vendor) | 					       efi_guid_t *vendor) | ||||||
| { | { | ||||||
| 	EFI_ENTRY("%p \"%ls\" %pUl", variable_name_size, variable_name, vendor); | 	EFI_ENTRY("%p \"%ls\" %pUl", variable_name_size, variable_name, vendor); | ||||||
| 
 | 
 | ||||||
|  | @ -260,16 +260,16 @@ efi_status_t EFIAPI efi_get_next_variable( | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#SetVariable.28.29 */ | /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#SetVariable.28.29 */ | ||||||
| efi_status_t EFIAPI efi_set_variable(s16 *variable_name, | efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor, | ||||||
| 		efi_guid_t *vendor, u32 attributes, | 				     u32 attributes, efi_uintn_t data_size, | ||||||
| 		unsigned long data_size, void *data) | 				     void *data) | ||||||
| { | { | ||||||
| 	char native_name[MAX_NATIVE_VAR_NAME + 1]; | 	char native_name[MAX_NATIVE_VAR_NAME + 1]; | ||||||
| 	efi_status_t ret = EFI_SUCCESS; | 	efi_status_t ret = EFI_SUCCESS; | ||||||
| 	char *val, *s; | 	char *val, *s; | ||||||
| 	u32 attr; | 	u32 attr; | ||||||
| 
 | 
 | ||||||
| 	EFI_ENTRY("\"%ls\" %pUl %x %lu %p", variable_name, vendor, attributes, | 	EFI_ENTRY("\"%ls\" %pUl %x %zu %p", variable_name, vendor, attributes, | ||||||
| 		  data_size, data); | 		  data_size, data); | ||||||
| 
 | 
 | ||||||
| 	if (!variable_name || !vendor) | 	if (!variable_name || !vendor) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue