|  | @@ -100,6 +100,81 @@ static const char * efi_status ( EFI_STATUS efirc ) {
 | 
		
	
		
			
			| 100 | 100 |  	}
 | 
		
	
		
			
			| 101 | 101 |  }
 | 
		
	
		
			
			| 102 | 102 |  
 | 
		
	
		
			
			|  | 103 | +/**
 | 
		
	
		
			
			|  | 104 | + * Convert EFI boolean to text
 | 
		
	
		
			
			|  | 105 | + *
 | 
		
	
		
			
			|  | 106 | + * @v boolean		Boolean value
 | 
		
	
		
			
			|  | 107 | + * @ret text		Boolean value text
 | 
		
	
		
			
			|  | 108 | + */
 | 
		
	
		
			
			|  | 109 | +static const char * efi_boolean ( BOOLEAN boolean ) {
 | 
		
	
		
			
			|  | 110 | +
 | 
		
	
		
			
			|  | 111 | +	return ( boolean ? "TRUE" : "FALSE" );
 | 
		
	
		
			
			|  | 112 | +}
 | 
		
	
		
			
			|  | 113 | +
 | 
		
	
		
			
			|  | 114 | +/**
 | 
		
	
		
			
			|  | 115 | + * Wrap InstallProtocolInterface()
 | 
		
	
		
			
			|  | 116 | + *
 | 
		
	
		
			
			|  | 117 | + */
 | 
		
	
		
			
			|  | 118 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 119 | +efi_install_protocol_interface_wrapper ( EFI_HANDLE *handle, EFI_GUID *protocol,
 | 
		
	
		
			
			|  | 120 | +					 EFI_INTERFACE_TYPE interface_type,
 | 
		
	
		
			
			|  | 121 | +					 VOID *interface ) {
 | 
		
	
		
			
			|  | 122 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 123 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 124 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 125 | +
 | 
		
	
		
			
			|  | 126 | +	DBGC ( colour, "InstallProtocolInterface ( %s, %s, %d, %p ) ",
 | 
		
	
		
			
			|  | 127 | +	       efi_handle_name ( *handle ), efi_guid_ntoa ( protocol ),
 | 
		
	
		
			
			|  | 128 | +	       interface_type, interface );
 | 
		
	
		
			
			|  | 129 | +	efirc = bs->InstallProtocolInterface ( handle, protocol, interface_type,
 | 
		
	
		
			
			|  | 130 | +					       interface );
 | 
		
	
		
			
			|  | 131 | +	DBGC ( colour, "= %s ( %s ) -> %p\n",
 | 
		
	
		
			
			|  | 132 | +	       efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
 | 
		
	
		
			
			|  | 133 | +	return efirc;
 | 
		
	
		
			
			|  | 134 | +}
 | 
		
	
		
			
			|  | 135 | +
 | 
		
	
		
			
			|  | 136 | +/**
 | 
		
	
		
			
			|  | 137 | + * Wrap ReinstallProtocolInterface()
 | 
		
	
		
			
			|  | 138 | + *
 | 
		
	
		
			
			|  | 139 | + */
 | 
		
	
		
			
			|  | 140 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 141 | +efi_reinstall_protocol_interface_wrapper ( EFI_HANDLE handle,
 | 
		
	
		
			
			|  | 142 | +					   EFI_GUID *protocol,
 | 
		
	
		
			
			|  | 143 | +					   VOID *old_interface,
 | 
		
	
		
			
			|  | 144 | +					   VOID *new_interface ) {
 | 
		
	
		
			
			|  | 145 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 146 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 147 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 148 | +
 | 
		
	
		
			
			|  | 149 | +	DBGC ( colour, "ReinstallProtocolInterface ( %s, %s, %p, %p ) ",
 | 
		
	
		
			
			|  | 150 | +	       efi_handle_name ( handle ), efi_guid_ntoa ( protocol ),
 | 
		
	
		
			
			|  | 151 | +	       old_interface, new_interface );
 | 
		
	
		
			
			|  | 152 | +	efirc = bs->ReinstallProtocolInterface ( handle, protocol,
 | 
		
	
		
			
			|  | 153 | +						 old_interface, new_interface );
 | 
		
	
		
			
			|  | 154 | +	DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
 | 
		
	
		
			
			|  | 155 | +	return efirc;
 | 
		
	
		
			
			|  | 156 | +}
 | 
		
	
		
			
			|  | 157 | +
 | 
		
	
		
			
			|  | 158 | +/**
 | 
		
	
		
			
			|  | 159 | + * Wrap UninstallProtocolInterface()
 | 
		
	
		
			
			|  | 160 | + *
 | 
		
	
		
			
			|  | 161 | + */
 | 
		
	
		
			
			|  | 162 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 163 | +efi_uninstall_protocol_interface_wrapper ( EFI_HANDLE handle,
 | 
		
	
		
			
			|  | 164 | +					   EFI_GUID *protocol,
 | 
		
	
		
			
			|  | 165 | +					   VOID *interface ) {
 | 
		
	
		
			
			|  | 166 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 167 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 168 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 169 | +
 | 
		
	
		
			
			|  | 170 | +	DBGC ( colour, "UninstallProtocolInterface ( %s, %s, %p ) ",
 | 
		
	
		
			
			|  | 171 | +	       efi_handle_name ( handle ), efi_guid_ntoa ( protocol ),
 | 
		
	
		
			
			|  | 172 | +	       interface );
 | 
		
	
		
			
			|  | 173 | +	efirc = bs->UninstallProtocolInterface ( handle, protocol, interface );
 | 
		
	
		
			
			|  | 174 | +	DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
 | 
		
	
		
			
			|  | 175 | +	return efirc;
 | 
		
	
		
			
			|  | 176 | +}
 | 
		
	
		
			
			|  | 177 | +
 | 
		
	
		
			
			| 103 | 178 |  /**
 | 
		
	
		
			
			| 104 | 179 |   * Wrap HandleProtocol()
 | 
		
	
		
			
			| 105 | 180 |   *
 | 
		
	
	
		
			
			|  | @@ -111,7 +186,7 @@ efi_handle_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
 | 
		
	
		
			
			| 111 | 186 |  	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			| 112 | 187 |  	EFI_STATUS efirc;
 | 
		
	
		
			
			| 113 | 188 |  
 | 
		
	
		
			
			| 114 |  | -	DBGC ( colour, "HandleProtocol ( %s, %s, ... ) ",
 | 
		
	
		
			
			|  | 189 | +	DBGC ( colour, "HandleProtocol ( %s, %s ) ",
 | 
		
	
		
			
			| 115 | 190 |  	       efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
 | 
		
	
		
			
			| 116 | 191 |  	efirc = bs->HandleProtocol ( handle, protocol, interface );
 | 
		
	
		
			
			| 117 | 192 |  	DBGC ( colour, "= %s ( %p ) -> %p\n",
 | 
		
	
	
		
			
			|  | @@ -129,14 +204,26 @@ efi_locate_handle_wrapper ( EFI_LOCATE_SEARCH_TYPE search_type,
 | 
		
	
		
			
			| 129 | 204 |  			    UINTN *buffer_size, EFI_HANDLE *buffer ) {
 | 
		
	
		
			
			| 130 | 205 |  	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			| 131 | 206 |  	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 207 | +	unsigned int i;
 | 
		
	
		
			
			| 132 | 208 |  	EFI_STATUS efirc;
 | 
		
	
		
			
			| 133 | 209 |  
 | 
		
	
		
			
			| 134 |  | -	DBGC ( colour, "LocateHandle ( %d, %s, ..., %zd, ... ) ", search_type,
 | 
		
	
		
			
			| 135 |  | -	       efi_guid_ntoa ( protocol ), ( ( size_t ) *buffer_size ) );
 | 
		
	
		
			
			|  | 210 | +	DBGC ( colour, "LocateHandle ( %s, %s, %p, %zd ) ",
 | 
		
	
		
			
			|  | 211 | +	       efi_locate_search_type_name ( search_type ),
 | 
		
	
		
			
			|  | 212 | +	       efi_guid_ntoa ( protocol ), search_key,
 | 
		
	
		
			
			|  | 213 | +	       ( ( size_t ) *buffer_size ) );
 | 
		
	
		
			
			| 136 | 214 |  	efirc = bs->LocateHandle ( search_type, protocol, search_key,
 | 
		
	
		
			
			| 137 | 215 |  				   buffer_size, buffer );
 | 
		
	
		
			
			| 138 |  | -	DBGC ( colour, "= %s ( %zd ) -> %p\n",
 | 
		
	
		
			
			| 139 |  | -	       efi_status ( efirc ), ( ( size_t ) *buffer_size ), retaddr );
 | 
		
	
		
			
			|  | 216 | +	DBGC ( colour, "= %s ( %zd", efi_status ( efirc ),
 | 
		
	
		
			
			|  | 217 | +	       ( ( size_t ) *buffer_size ) );
 | 
		
	
		
			
			|  | 218 | +	if ( efirc == 0 ) {
 | 
		
	
		
			
			|  | 219 | +		DBGC ( colour, ", {" );
 | 
		
	
		
			
			|  | 220 | +		for ( i = 0; i < ( *buffer_size / sizeof ( buffer[0] ) ); i++ ){
 | 
		
	
		
			
			|  | 221 | +			DBGC ( colour, "%s%s", ( i ? ", " : " " ),
 | 
		
	
		
			
			|  | 222 | +			       efi_handle_name ( buffer[i] ) );
 | 
		
	
		
			
			|  | 223 | +		}
 | 
		
	
		
			
			|  | 224 | +		DBGC ( colour, " }" );
 | 
		
	
		
			
			|  | 225 | +	}
 | 
		
	
		
			
			|  | 226 | +	DBGC ( colour, " ) -> %p\n", retaddr );
 | 
		
	
		
			
			| 140 | 227 |  	return efirc;
 | 
		
	
		
			
			| 141 | 228 |  }
 | 
		
	
		
			
			| 142 | 229 |  
 | 
		
	
	
		
			
			|  | @@ -152,7 +239,7 @@ efi_locate_device_path_wrapper ( EFI_GUID *protocol,
 | 
		
	
		
			
			| 152 | 239 |  	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			| 153 | 240 |  	EFI_STATUS efirc;
 | 
		
	
		
			
			| 154 | 241 |  
 | 
		
	
		
			
			| 155 |  | -	DBGC ( colour, "LocateDevicePath ( %s, %s, ... ) ",
 | 
		
	
		
			
			|  | 242 | +	DBGC ( colour, "LocateDevicePath ( %s, %s ) ",
 | 
		
	
		
			
			| 156 | 243 |  	       efi_guid_ntoa ( protocol ), efi_devpath_text ( *device_path ) );
 | 
		
	
		
			
			| 157 | 244 |  	efirc = bs->LocateDevicePath ( protocol, device_path, device );
 | 
		
	
		
			
			| 158 | 245 |  	DBGC ( colour, "= %s ( %s, ",
 | 
		
	
	
		
			
			|  | @@ -174,9 +261,9 @@ efi_load_image_wrapper ( BOOLEAN boot_policy, EFI_HANDLE parent_image_handle,
 | 
		
	
		
			
			| 174 | 261 |  	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			| 175 | 262 |  	EFI_STATUS efirc;
 | 
		
	
		
			
			| 176 | 263 |  
 | 
		
	
		
			
			| 177 |  | -	DBGC ( colour, "LoadImage ( %d, %s, ", boot_policy,
 | 
		
	
		
			
			|  | 264 | +	DBGC ( colour, "LoadImage ( %s, %s, ", efi_boolean ( boot_policy ),
 | 
		
	
		
			
			| 178 | 265 |  	       efi_handle_name ( parent_image_handle ) );
 | 
		
	
		
			
			| 179 |  | -	DBGC ( colour, "%s, %p, %#llx, ... ) ",
 | 
		
	
		
			
			|  | 266 | +	DBGC ( colour, "%s, %p, %#llx ) ",
 | 
		
	
		
			
			| 180 | 267 |  	       efi_devpath_text ( device_path ), source_buffer,
 | 
		
	
		
			
			| 181 | 268 |  	       ( ( unsigned long long ) source_size ) );
 | 
		
	
		
			
			| 182 | 269 |  	efirc = bs->LoadImage ( boot_policy, parent_image_handle, device_path,
 | 
		
	
	
		
			
			|  | @@ -193,6 +280,69 @@ efi_load_image_wrapper ( BOOLEAN boot_policy, EFI_HANDLE parent_image_handle,
 | 
		
	
		
			
			| 193 | 280 |  	return efirc;
 | 
		
	
		
			
			| 194 | 281 |  }
 | 
		
	
		
			
			| 195 | 282 |  
 | 
		
	
		
			
			|  | 283 | +/**
 | 
		
	
		
			
			|  | 284 | + * Wrap StartImage()
 | 
		
	
		
			
			|  | 285 | + *
 | 
		
	
		
			
			|  | 286 | + */
 | 
		
	
		
			
			|  | 287 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 288 | +efi_start_image_wrapper ( EFI_HANDLE image_handle, UINTN *exit_data_size,
 | 
		
	
		
			
			|  | 289 | +			  CHAR16 **exit_data ) {
 | 
		
	
		
			
			|  | 290 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 291 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 292 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 293 | +
 | 
		
	
		
			
			|  | 294 | +	DBGC ( colour, "StartImage ( %s ) ", efi_handle_name ( image_handle ) );
 | 
		
	
		
			
			|  | 295 | +	efirc = bs->StartImage ( image_handle, exit_data_size, exit_data );
 | 
		
	
		
			
			|  | 296 | +	DBGC ( colour, "= %s", efi_status ( efirc ) );
 | 
		
	
		
			
			|  | 297 | +	if ( ( efirc != 0 ) && exit_data && *exit_data_size )
 | 
		
	
		
			
			|  | 298 | +		DBGC ( colour, " ( \"%ls\" )", *exit_data );
 | 
		
	
		
			
			|  | 299 | +	DBGC ( colour, " -> %p\n", retaddr );
 | 
		
	
		
			
			|  | 300 | +	if ( ( efirc != 0 ) && exit_data && *exit_data_size )
 | 
		
	
		
			
			|  | 301 | +		DBGC_HD ( colour, *exit_data, *exit_data_size );
 | 
		
	
		
			
			|  | 302 | +	return efirc;
 | 
		
	
		
			
			|  | 303 | +}
 | 
		
	
		
			
			|  | 304 | +
 | 
		
	
		
			
			|  | 305 | +/**
 | 
		
	
		
			
			|  | 306 | + * Wrap Exit()
 | 
		
	
		
			
			|  | 307 | + *
 | 
		
	
		
			
			|  | 308 | + */
 | 
		
	
		
			
			|  | 309 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 310 | +efi_exit_wrapper ( EFI_HANDLE image_handle, EFI_STATUS exit_status,
 | 
		
	
		
			
			|  | 311 | +		   UINTN exit_data_size, CHAR16 *exit_data ) {
 | 
		
	
		
			
			|  | 312 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 313 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 314 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 315 | +
 | 
		
	
		
			
			|  | 316 | +	if ( ( exit_status != 0 ) && exit_data && exit_data_size )
 | 
		
	
		
			
			|  | 317 | +		DBGC_HD ( colour, exit_data, exit_data_size );
 | 
		
	
		
			
			|  | 318 | +	DBGC ( colour, "Exit ( %s, %s",
 | 
		
	
		
			
			|  | 319 | +	       efi_handle_name ( image_handle ), efi_status ( exit_status ) );
 | 
		
	
		
			
			|  | 320 | +	if ( ( exit_status != 0 ) && exit_data && exit_data_size )
 | 
		
	
		
			
			|  | 321 | +		DBGC ( colour, ", \"%ls\"", exit_data );
 | 
		
	
		
			
			|  | 322 | +	DBGC ( colour, " ) " );
 | 
		
	
		
			
			|  | 323 | +	efirc = bs->Exit ( image_handle, exit_status, exit_data_size,
 | 
		
	
		
			
			|  | 324 | +			   exit_data );
 | 
		
	
		
			
			|  | 325 | +	DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
 | 
		
	
		
			
			|  | 326 | +	return efirc;
 | 
		
	
		
			
			|  | 327 | +}
 | 
		
	
		
			
			|  | 328 | +
 | 
		
	
		
			
			|  | 329 | +/**
 | 
		
	
		
			
			|  | 330 | + * Wrap UnloadImage()
 | 
		
	
		
			
			|  | 331 | + *
 | 
		
	
		
			
			|  | 332 | + */
 | 
		
	
		
			
			|  | 333 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 334 | +efi_unload_image_wrapper ( EFI_HANDLE image_handle ) {
 | 
		
	
		
			
			|  | 335 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 336 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 337 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 338 | +
 | 
		
	
		
			
			|  | 339 | +	DBGC ( colour, "UnloadImage ( %s ) ",
 | 
		
	
		
			
			|  | 340 | +	       efi_handle_name ( image_handle ) );
 | 
		
	
		
			
			|  | 341 | +	efirc = bs->UnloadImage ( image_handle );
 | 
		
	
		
			
			|  | 342 | +	DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
 | 
		
	
		
			
			|  | 343 | +	return efirc;
 | 
		
	
		
			
			|  | 344 | +}
 | 
		
	
		
			
			|  | 345 | +
 | 
		
	
		
			
			| 196 | 346 |  /**
 | 
		
	
		
			
			| 197 | 347 |   * Wrap ExitBootServices()
 | 
		
	
		
			
			| 198 | 348 |   *
 | 
		
	
	
		
			
			|  | @@ -211,6 +361,60 @@ efi_exit_boot_services_wrapper ( EFI_HANDLE image_handle, UINTN map_key ) {
 | 
		
	
		
			
			| 211 | 361 |  	return efirc;
 | 
		
	
		
			
			| 212 | 362 |  }
 | 
		
	
		
			
			| 213 | 363 |  
 | 
		
	
		
			
			|  | 364 | +/**
 | 
		
	
		
			
			|  | 365 | + * Wrap ConnectController()
 | 
		
	
		
			
			|  | 366 | + *
 | 
		
	
		
			
			|  | 367 | + */
 | 
		
	
		
			
			|  | 368 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 369 | +efi_connect_controller_wrapper ( EFI_HANDLE controller_handle,
 | 
		
	
		
			
			|  | 370 | +				 EFI_HANDLE *driver_image_handle,
 | 
		
	
		
			
			|  | 371 | +				 EFI_DEVICE_PATH_PROTOCOL *remaining_path,
 | 
		
	
		
			
			|  | 372 | +				 BOOLEAN recursive ) {
 | 
		
	
		
			
			|  | 373 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 374 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 375 | +	EFI_HANDLE *tmp;
 | 
		
	
		
			
			|  | 376 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 377 | +
 | 
		
	
		
			
			|  | 378 | +	DBGC ( colour, "ConnectController ( %s, {",
 | 
		
	
		
			
			|  | 379 | +	       efi_handle_name ( controller_handle ) );
 | 
		
	
		
			
			|  | 380 | +	if ( driver_image_handle ) {
 | 
		
	
		
			
			|  | 381 | +		for ( tmp = driver_image_handle ; *tmp ; tmp++ ) {
 | 
		
	
		
			
			|  | 382 | +			DBGC ( colour, "%s%s",
 | 
		
	
		
			
			|  | 383 | +			       ( ( tmp == driver_image_handle ) ? " " : ", " ),
 | 
		
	
		
			
			|  | 384 | +			       efi_handle_name ( *tmp ) );
 | 
		
	
		
			
			|  | 385 | +		}
 | 
		
	
		
			
			|  | 386 | +	}
 | 
		
	
		
			
			|  | 387 | +	DBGC ( colour, " }, %s, %s ) ", efi_devpath_text ( remaining_path ),
 | 
		
	
		
			
			|  | 388 | +	       efi_boolean ( recursive ) );
 | 
		
	
		
			
			|  | 389 | +	efirc = bs->ConnectController ( controller_handle, driver_image_handle,
 | 
		
	
		
			
			|  | 390 | +					remaining_path, recursive );
 | 
		
	
		
			
			|  | 391 | +	DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
 | 
		
	
		
			
			|  | 392 | +	return efirc;
 | 
		
	
		
			
			|  | 393 | +}
 | 
		
	
		
			
			|  | 394 | +
 | 
		
	
		
			
			|  | 395 | +/**
 | 
		
	
		
			
			|  | 396 | + * Wrap DisconnectController()
 | 
		
	
		
			
			|  | 397 | + *
 | 
		
	
		
			
			|  | 398 | + */
 | 
		
	
		
			
			|  | 399 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 400 | +efi_disconnect_controller_wrapper ( EFI_HANDLE controller_handle,
 | 
		
	
		
			
			|  | 401 | +				    EFI_HANDLE driver_image_handle,
 | 
		
	
		
			
			|  | 402 | +				    EFI_HANDLE child_handle ) {
 | 
		
	
		
			
			|  | 403 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 404 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 405 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 406 | +
 | 
		
	
		
			
			|  | 407 | +	DBGC ( colour, "DisconnectController ( %s",
 | 
		
	
		
			
			|  | 408 | +	       efi_handle_name ( controller_handle ) );
 | 
		
	
		
			
			|  | 409 | +	DBGC ( colour, ", %s", efi_handle_name ( driver_image_handle ) );
 | 
		
	
		
			
			|  | 410 | +	DBGC ( colour, ", %s ) ", efi_handle_name ( child_handle ) );
 | 
		
	
		
			
			|  | 411 | +	efirc = bs->DisconnectController ( controller_handle,
 | 
		
	
		
			
			|  | 412 | +					   driver_image_handle,
 | 
		
	
		
			
			|  | 413 | +					   child_handle );
 | 
		
	
		
			
			|  | 414 | +	DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
 | 
		
	
		
			
			|  | 415 | +	return efirc;
 | 
		
	
		
			
			|  | 416 | +}
 | 
		
	
		
			
			|  | 417 | +
 | 
		
	
		
			
			| 214 | 418 |  /**
 | 
		
	
		
			
			| 215 | 419 |   * Wrap OpenProtocol()
 | 
		
	
		
			
			| 216 | 420 |   *
 | 
		
	
	
		
			
			|  | @@ -223,11 +427,11 @@ efi_open_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
 | 
		
	
		
			
			| 223 | 427 |  	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			| 224 | 428 |  	EFI_STATUS efirc;
 | 
		
	
		
			
			| 225 | 429 |  
 | 
		
	
		
			
			| 226 |  | -	DBGC ( colour, "OpenProtocol ( %s, %s, ..., ",
 | 
		
	
		
			
			|  | 430 | +	DBGC ( colour, "OpenProtocol ( %s, %s, ",
 | 
		
	
		
			
			| 227 | 431 |  	       efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
 | 
		
	
		
			
			| 228 | 432 |  	DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
 | 
		
	
		
			
			| 229 |  | -	DBGC ( colour, "%s, %#x ) ",
 | 
		
	
		
			
			| 230 |  | -	       efi_handle_name ( controller_handle ), attributes );
 | 
		
	
		
			
			|  | 433 | +	DBGC ( colour, "%s, %s ) ", efi_handle_name ( controller_handle ),
 | 
		
	
		
			
			|  | 434 | +	       efi_open_attributes_name ( attributes ) );
 | 
		
	
		
			
			| 231 | 435 |  	efirc = bs->OpenProtocol ( handle, protocol, interface, agent_handle,
 | 
		
	
		
			
			| 232 | 436 |  				   controller_handle, attributes );
 | 
		
	
		
			
			| 233 | 437 |  	DBGC ( colour, "= %s ( %p ) -> %p\n",
 | 
		
	
	
		
			
			|  | @@ -235,6 +439,90 @@ efi_open_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
 | 
		
	
		
			
			| 235 | 439 |  	return efirc;
 | 
		
	
		
			
			| 236 | 440 |  }
 | 
		
	
		
			
			| 237 | 441 |  
 | 
		
	
		
			
			|  | 442 | +/**
 | 
		
	
		
			
			|  | 443 | + * Wrap CloseProtocol()
 | 
		
	
		
			
			|  | 444 | + *
 | 
		
	
		
			
			|  | 445 | + */
 | 
		
	
		
			
			|  | 446 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 447 | +efi_close_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
 | 
		
	
		
			
			|  | 448 | +			     EFI_HANDLE agent_handle,
 | 
		
	
		
			
			|  | 449 | +			     EFI_HANDLE controller_handle ) {
 | 
		
	
		
			
			|  | 450 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 451 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 452 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 453 | +
 | 
		
	
		
			
			|  | 454 | +	DBGC ( colour, "CloseProtocol ( %s, %s, ",
 | 
		
	
		
			
			|  | 455 | +	       efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
 | 
		
	
		
			
			|  | 456 | +	DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
 | 
		
	
		
			
			|  | 457 | +	DBGC ( colour, "%s ) ", efi_handle_name ( controller_handle ) );
 | 
		
	
		
			
			|  | 458 | +	efirc = bs->CloseProtocol ( handle, protocol, agent_handle,
 | 
		
	
		
			
			|  | 459 | +				    controller_handle );
 | 
		
	
		
			
			|  | 460 | +	DBGC ( colour, "= %s -> %p\n",
 | 
		
	
		
			
			|  | 461 | +	       efi_status ( efirc ), retaddr );
 | 
		
	
		
			
			|  | 462 | +	return efirc;
 | 
		
	
		
			
			|  | 463 | +}
 | 
		
	
		
			
			|  | 464 | +
 | 
		
	
		
			
			|  | 465 | +/**
 | 
		
	
		
			
			|  | 466 | + * Wrap ProtocolsPerHandle()
 | 
		
	
		
			
			|  | 467 | + *
 | 
		
	
		
			
			|  | 468 | + */
 | 
		
	
		
			
			|  | 469 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 470 | +efi_protocols_per_handle_wrapper ( EFI_HANDLE handle,
 | 
		
	
		
			
			|  | 471 | +				   EFI_GUID ***protocol_buffer,
 | 
		
	
		
			
			|  | 472 | +				   UINTN *protocol_buffer_count ) {
 | 
		
	
		
			
			|  | 473 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 474 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 475 | +	unsigned int i;
 | 
		
	
		
			
			|  | 476 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 477 | +
 | 
		
	
		
			
			|  | 478 | +	DBGC ( colour, "ProtocolsPerHandle ( %s ) ",
 | 
		
	
		
			
			|  | 479 | +	       efi_handle_name ( handle ) );
 | 
		
	
		
			
			|  | 480 | +	efirc = bs->ProtocolsPerHandle ( handle, protocol_buffer,
 | 
		
	
		
			
			|  | 481 | +					 protocol_buffer_count );
 | 
		
	
		
			
			|  | 482 | +	DBGC ( colour, "= %s", efi_status ( efirc ) );
 | 
		
	
		
			
			|  | 483 | +	if ( efirc == 0 ) {
 | 
		
	
		
			
			|  | 484 | +		DBGC ( colour, " ( {" );
 | 
		
	
		
			
			|  | 485 | +		for ( i = 0 ; i < *protocol_buffer_count ; i++ ) {
 | 
		
	
		
			
			|  | 486 | +			DBGC ( colour, "%s%s", ( i ? ", " : " " ),
 | 
		
	
		
			
			|  | 487 | +			       efi_guid_ntoa ( (*protocol_buffer)[i] ) );
 | 
		
	
		
			
			|  | 488 | +		}
 | 
		
	
		
			
			|  | 489 | +		DBGC ( colour, " } )" );
 | 
		
	
		
			
			|  | 490 | +	}
 | 
		
	
		
			
			|  | 491 | +	DBGC ( colour, " -> %p\n", retaddr );
 | 
		
	
		
			
			|  | 492 | +	return efirc;
 | 
		
	
		
			
			|  | 493 | +}
 | 
		
	
		
			
			|  | 494 | +
 | 
		
	
		
			
			|  | 495 | +/**
 | 
		
	
		
			
			|  | 496 | + * Wrap LocateHandleBuffer()
 | 
		
	
		
			
			|  | 497 | + *
 | 
		
	
		
			
			|  | 498 | + */
 | 
		
	
		
			
			|  | 499 | +static EFI_STATUS EFIAPI
 | 
		
	
		
			
			|  | 500 | +efi_locate_handle_buffer_wrapper ( EFI_LOCATE_SEARCH_TYPE search_type,
 | 
		
	
		
			
			|  | 501 | +				   EFI_GUID *protocol, VOID *search_key,
 | 
		
	
		
			
			|  | 502 | +				   UINTN *no_handles, EFI_HANDLE **buffer ) {
 | 
		
	
		
			
			|  | 503 | +	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 | 
		
	
		
			
			|  | 504 | +	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			|  | 505 | +	unsigned int i;
 | 
		
	
		
			
			|  | 506 | +	EFI_STATUS efirc;
 | 
		
	
		
			
			|  | 507 | +
 | 
		
	
		
			
			|  | 508 | +	DBGC ( colour, "LocateHandleBuffer ( %s, %s, %p ) ",
 | 
		
	
		
			
			|  | 509 | +	       efi_locate_search_type_name ( search_type ),
 | 
		
	
		
			
			|  | 510 | +	       efi_guid_ntoa ( protocol ), search_key );
 | 
		
	
		
			
			|  | 511 | +	efirc = bs->LocateHandleBuffer ( search_type, protocol, search_key,
 | 
		
	
		
			
			|  | 512 | +					 no_handles, buffer );
 | 
		
	
		
			
			|  | 513 | +	DBGC ( colour, "= %s", efi_status ( efirc ) );
 | 
		
	
		
			
			|  | 514 | +	if ( efirc == 0 ) {
 | 
		
	
		
			
			|  | 515 | +		DBGC ( colour, " ( %d, {", ( ( unsigned int ) *no_handles ) );
 | 
		
	
		
			
			|  | 516 | +		for ( i = 0 ; i < *no_handles ; i++ ) {
 | 
		
	
		
			
			|  | 517 | +			DBGC ( colour, "%s%s", ( i ? ", " : " " ),
 | 
		
	
		
			
			|  | 518 | +			       efi_handle_name ( (*buffer)[i] ) );
 | 
		
	
		
			
			|  | 519 | +		}
 | 
		
	
		
			
			|  | 520 | +		DBGC ( colour, " } )" );
 | 
		
	
		
			
			|  | 521 | +	}
 | 
		
	
		
			
			|  | 522 | +	DBGC ( colour, " -> %p\n", retaddr );
 | 
		
	
		
			
			|  | 523 | +	return efirc;
 | 
		
	
		
			
			|  | 524 | +}
 | 
		
	
		
			
			|  | 525 | +
 | 
		
	
		
			
			| 238 | 526 |  /**
 | 
		
	
		
			
			| 239 | 527 |   * Wrap LocateProtocol()
 | 
		
	
		
			
			| 240 | 528 |   *
 | 
		
	
	
		
			
			|  | @@ -246,7 +534,7 @@ efi_locate_protocol_wrapper ( EFI_GUID *protocol, VOID *registration,
 | 
		
	
		
			
			| 246 | 534 |  	void *retaddr = __builtin_return_address ( 0 );
 | 
		
	
		
			
			| 247 | 535 |  	EFI_STATUS efirc;
 | 
		
	
		
			
			| 248 | 536 |  
 | 
		
	
		
			
			| 249 |  | -	DBGC ( colour, "LocateProtocol ( %s, %p, ... ) ",
 | 
		
	
		
			
			|  | 537 | +	DBGC ( colour, "LocateProtocol ( %s, %p ) ",
 | 
		
	
		
			
			| 250 | 538 |  	       efi_guid_ntoa ( protocol ), registration );
 | 
		
	
		
			
			| 251 | 539 |  	efirc = bs->LocateProtocol ( protocol, registration, interface );
 | 
		
	
		
			
			| 252 | 540 |  	DBGC ( colour, "= %s ( %p ) -> %p\n",
 | 
		
	
	
		
			
			|  | @@ -277,12 +565,30 @@ efi_locate_protocol_wrapper ( EFI_GUID *protocol, VOID *registration,
 | 
		
	
		
			
			| 277 | 565 |  		 sizeof ( efi_systab_wrapper ) );
 | 
		
	
		
			
			| 278 | 566 |  	memcpy ( &efi_bs_wrapper, bs, sizeof ( efi_bs_wrapper ) );
 | 
		
	
		
			
			| 279 | 567 |  	efi_systab_wrapper.BootServices	= &efi_bs_wrapper;
 | 
		
	
		
			
			|  | 568 | +	efi_bs_wrapper.InstallProtocolInterface
 | 
		
	
		
			
			|  | 569 | +		= efi_install_protocol_interface_wrapper;
 | 
		
	
		
			
			|  | 570 | +	efi_bs_wrapper.ReinstallProtocolInterface
 | 
		
	
		
			
			|  | 571 | +		= efi_reinstall_protocol_interface_wrapper;
 | 
		
	
		
			
			|  | 572 | +	efi_bs_wrapper.UninstallProtocolInterface
 | 
		
	
		
			
			|  | 573 | +		= efi_uninstall_protocol_interface_wrapper;
 | 
		
	
		
			
			| 280 | 574 |  	efi_bs_wrapper.HandleProtocol	= efi_handle_protocol_wrapper;
 | 
		
	
		
			
			| 281 | 575 |  	efi_bs_wrapper.LocateHandle	= efi_locate_handle_wrapper;
 | 
		
	
		
			
			| 282 | 576 |  	efi_bs_wrapper.LocateDevicePath	= efi_locate_device_path_wrapper;
 | 
		
	
		
			
			| 283 | 577 |  	efi_bs_wrapper.LoadImage	= efi_load_image_wrapper;
 | 
		
	
		
			
			|  | 578 | +	efi_bs_wrapper.StartImage	= efi_start_image_wrapper;
 | 
		
	
		
			
			|  | 579 | +	efi_bs_wrapper.Exit		= efi_exit_wrapper;
 | 
		
	
		
			
			|  | 580 | +	efi_bs_wrapper.UnloadImage	= efi_unload_image_wrapper;
 | 
		
	
		
			
			| 284 | 581 |  	efi_bs_wrapper.ExitBootServices	= efi_exit_boot_services_wrapper;
 | 
		
	
		
			
			|  | 582 | +	efi_bs_wrapper.ConnectController
 | 
		
	
		
			
			|  | 583 | +		= efi_connect_controller_wrapper;
 | 
		
	
		
			
			|  | 584 | +	efi_bs_wrapper.DisconnectController
 | 
		
	
		
			
			|  | 585 | +		= efi_disconnect_controller_wrapper;
 | 
		
	
		
			
			| 285 | 586 |  	efi_bs_wrapper.OpenProtocol	= efi_open_protocol_wrapper;
 | 
		
	
		
			
			|  | 587 | +	efi_bs_wrapper.CloseProtocol	= efi_close_protocol_wrapper;
 | 
		
	
		
			
			|  | 588 | +	efi_bs_wrapper.ProtocolsPerHandle
 | 
		
	
		
			
			|  | 589 | +		= efi_protocols_per_handle_wrapper;
 | 
		
	
		
			
			|  | 590 | +	efi_bs_wrapper.LocateHandleBuffer
 | 
		
	
		
			
			|  | 591 | +		= efi_locate_handle_buffer_wrapper;
 | 
		
	
		
			
			| 286 | 592 |  	efi_bs_wrapper.LocateProtocol	= efi_locate_protocol_wrapper;
 | 
		
	
		
			
			| 287 | 593 |  
 | 
		
	
		
			
			| 288 | 594 |  	/* Open loaded image protocol */
 |