Skip to content
Snippets Groups Projects
Commit fa241e2f authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by Alexander Graf
Browse files

efi_selftest: test ReinstallProtocolInterface


Add a test for ReinstallProtocolInterface to the controller selftest.

As ReinstallProtocolInterface has to connect controllers to the new
interface is does not fit to the manage protocols selftest.

Signed-off-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent e861a120
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* This unit test checks the following protocol services: * This unit test checks the following protocol services:
* ConnectController, DisconnectController, * ConnectController, DisconnectController,
* InstallProtocol, UninstallProtocol, * InstallProtocol, ReinstallProtocol, UninstallProtocol,
* OpenProtocol, CloseProtcol, OpenProtocolInformation * OpenProtocol, CloseProtcol, OpenProtocolInformation
*/ */
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#define NUMBER_OF_CHILD_CONTROLLERS 4 #define NUMBER_OF_CHILD_CONTROLLERS 4
static int interface1 = 1;
static int interface2 = 2;
static struct efi_boot_services *boottime; static struct efi_boot_services *boottime;
const efi_guid_t guid_driver_binding_protocol = const efi_guid_t guid_driver_binding_protocol =
EFI_DRIVER_BINDING_PROTOCOL_GUID; EFI_DRIVER_BINDING_PROTOCOL_GUID;
...@@ -271,7 +273,7 @@ static int setup(const efi_handle_t img_handle, ...@@ -271,7 +273,7 @@ static int setup(const efi_handle_t img_handle,
/* Create controller handle */ /* Create controller handle */
ret = boottime->install_protocol_interface( ret = boottime->install_protocol_interface(
&handle_controller, &guid_controller, &handle_controller, &guid_controller,
EFI_NATIVE_INTERFACE, NULL); EFI_NATIVE_INTERFACE, &interface1);
if (ret != EFI_SUCCESS) { if (ret != EFI_SUCCESS) {
efi_st_error("InstallProtocolInterface failed\n"); efi_st_error("InstallProtocolInterface failed\n");
return EFI_ST_FAILURE; return EFI_ST_FAILURE;
...@@ -299,6 +301,7 @@ static int setup(const efi_handle_t img_handle, ...@@ -299,6 +301,7 @@ static int setup(const efi_handle_t img_handle,
* Disconnect and destroy the remaining child controllers. * Disconnect and destroy the remaining child controllers.
* *
* Connect a controller to a driver. * Connect a controller to a driver.
* Reinstall the driver protocol on the controller.
* Uninstall the driver protocol from the controller. * Uninstall the driver protocol from the controller.
*/ */
static int execute(void) static int execute(void)
...@@ -361,9 +364,35 @@ static int execute(void) ...@@ -361,9 +364,35 @@ static int execute(void)
efi_st_error("Number of children %u != %u\n", efi_st_error("Number of children %u != %u\n",
(unsigned int)count, NUMBER_OF_CHILD_CONTROLLERS); (unsigned int)count, NUMBER_OF_CHILD_CONTROLLERS);
} }
/* Try to uninstall controller protocol using the wrong interface */
ret = boottime->uninstall_protocol_interface(handle_controller,
&guid_controller,
&interface2);
if (ret == EFI_SUCCESS) {
efi_st_error(
"Interface not checked when uninstalling protocol\n");
return EFI_ST_FAILURE;
}
/* Reinstall controller protocol */
ret = boottime->reinstall_protocol_interface(handle_controller,
&guid_controller,
&interface1,
&interface2);
if (ret != EFI_SUCCESS) {
efi_st_error("Failed to reinstall protocols\n");
return EFI_ST_FAILURE;
}
/* Check number of child controllers */
ret = count_child_controllers(handle_controller, &guid_controller,
&count);
if (ret != EFI_SUCCESS || count != NUMBER_OF_CHILD_CONTROLLERS) {
efi_st_error("Number of children %u != %u\n",
(unsigned int)count, NUMBER_OF_CHILD_CONTROLLERS);
}
/* Uninstall controller protocol */ /* Uninstall controller protocol */
ret = boottime->uninstall_protocol_interface(handle_controller, ret = boottime->uninstall_protocol_interface(handle_controller,
&guid_controller, NULL); &guid_controller,
&interface2);
if (ret != EFI_SUCCESS) { if (ret != EFI_SUCCESS) {
efi_st_error("Failed to uninstall protocols\n"); efi_st_error("Failed to uninstall protocols\n");
return EFI_ST_FAILURE; return EFI_ST_FAILURE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment