From patchwork Fri May 11 10:09:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 911885 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40j5Rn0GwRz9s19 for ; Fri, 11 May 2018 20:09:40 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A90CDC2232A; Fri, 11 May 2018 10:09:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 625B9C2209A; Fri, 11 May 2018 10:09:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 834ACC22292; Fri, 11 May 2018 10:09:32 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 1FCBAC21FA1 for ; Fri, 11 May 2018 10:09:32 +0000 (UTC) Received: from localhost.localdomain ([89.204.154.43]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M0h9K-1eRzhk3Auk-00uqwG; Fri, 11 May 2018 12:09:30 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Fri, 11 May 2018 12:09:20 +0200 Message-Id: <20180511100923.29659-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511100923.29659-1-xypron.glpk@gmx.de> References: <20180511100923.29659-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K1:T3x7cPkDKDNeKFTeJIFvptPN+puthclkMp7jMpPH8XpMsc5lPrR 3sBZ7guptd/vmQyIk8RPPX8Qep5KBImhoMvGtT7DTt78AW5V+CcRtpLfoT7i5j1bwYewf9T +uInDZ5XNM/WYTYDB3lO3wMHXqKuqXhGdL2j9FmJtny4BTJJfZqxAW1sHBaIh0KB6scr3Xq 6FOU6CTmIKjEkjn5iHfog== X-UI-Out-Filterresults: notjunk:1; V01:K0:8K2Zl79VhKc=:cgS1glxFIJlGRZlGbkooE5 uB7YG6jwGV5/5JnCMk6fCCbokN7WRnYyw0Gu8Gdmdlln2Iu8xEy+rGYgRMoGza6yZ6tykh0+j 6u1vXtXjMT+t8WmA1ChUXIPEvTvAMG8uWBh/QVMHgRJ+FJswcyWIHM6m7i6NJrQiwmEYa35jO nymOEhK4FXU5f3Rq5ywgEkY3KpRiFPixKG7Y19eWWsvWQeVxY5bRTmYWmLcCMNNfaSPUzraCA caRCro/tT9BpW8vrP5EKLT9zDfs2OFPuaLHj3qg/yiPvco1DxvmB5nWxvEC0enHnrBf1kiNM+ ChQx6cdt4YWcS9iD2NCltVmc85a++inz5IJIF+LBJ6FGcTAeZWt0MGuP0i+fNTN6lQUIMOjHk m0pHjJ3yV+qeCcwwDx0F/Hcl5DuwabxWZihMFnPwHJpuhs+02A0rqIlKj9A8h3dXQ24BORku6 DjmfpXg/83nsgD3tNKJmfyCwklmh7mmf/yHzWeGAT33695rZaAPI7ZXooh+Dht7WFbJZj+J9d nGPxsPNZ7lO5MYYsESWaXbYtHu9u/moDzO5c1t9lAMUEjra28DKw+IDMBKgSoMkMOvwBrou+i E3Kx4TxfWaPh0zvvxdRbFT9+xcUwvtMbGWquLh6nXph14Y+V1LHfdupcw6TmeF1E3PdDboPqE Z2d0YWbbtkFehorft8CpYWc+OxQVK18x808d/EgJbcw2Q2Mi5pMHggFRAo9ZFBqOQE6+HkyjQ 6e0Y2TGQuOrphy5E0QMgWXsbMlOgpBFq3EM8wQhHuPN2x+FvQzN0Mis22AM= Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/4] efi_selftest: correct efi_selftest_manageprotocols X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Pass the correct interface when uninstalling a protocol. Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/efi_selftest_manageprotocols.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_selftest/efi_selftest_manageprotocols.c b/lib/efi_selftest/efi_selftest_manageprotocols.c index 3e4755c25e9..44b8da3ba5d 100644 --- a/lib/efi_selftest/efi_selftest_manageprotocols.c +++ b/lib/efi_selftest/efi_selftest_manageprotocols.c @@ -335,7 +335,7 @@ static int execute(void) return EFI_ST_FAILURE; } ret = boottime->uninstall_protocol_interface(handle1, &guid3, - &interface1); + &interface3); if (ret != EFI_SUCCESS) { efi_st_error("UninstallProtocolInterface failed\n"); return EFI_ST_FAILURE; From patchwork Fri May 11 10:09:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 911887 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40j5Tf029Hz9s16 for ; Fri, 11 May 2018 20:11:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 699C6C222DC; Fri, 11 May 2018 10:10:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2CC89C2233F; Fri, 11 May 2018 10:09:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E8D2CC22292; Fri, 11 May 2018 10:09:32 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id 853DBC21FA1 for ; Fri, 11 May 2018 10:09:32 +0000 (UTC) Received: from localhost.localdomain ([89.204.154.43]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M1nbu-1eT5dJ0uSY-00tl0a; Fri, 11 May 2018 12:09:31 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Fri, 11 May 2018 12:09:21 +0200 Message-Id: <20180511100923.29659-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511100923.29659-1-xypron.glpk@gmx.de> References: <20180511100923.29659-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K1:0qDjS+0k7RnBuOB5yzeJlZmyMxu5d7z6aNRjYwcf+5IYFsGDM/o zGo+UqRJMURM+lP1PJczVEh1VkBq9IPO5zoSuAUzMjHVmWch+0prwU4aIjfNhQBRkIwdEYs vaEcOuoAV/xoXlDlP/+NLc6EDDy046ypUkIKp8dN6L/fSutAp52u0GDyXFBXyEODk0Iv67j tvPj/F//dEH3+u4A4xxYQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:/I6TsurDmb0=:xE4fynFUN+Q/RCh/XthGI0 0cruz/l1F7k8UTE+2SuByuCY1TccI4tOmHDvoTq/UejLs0baDQynDSekQ1h4ciJGRj4q/OYXt 6NA+pa/lduL6T4OSAA2WZQJ7YDJpNQTFugPTQKGfSJLrPCjQymf6lRFCsjHJ47cnb8Z8YBM+H k46CRZtOx0Afois56D9/qI4zsr0EpS3180txkaMMcmW6hennOIEPY9HOzFDgA5DArx8LxOBif PCTGnOhWzVu/ZoHijUbknP1AKXKTMphiLoIimMNFKHstxqbt3v93cITBRERGQl89wirDHtsWp BadQHy+pj2f8PC/QAevXezRif4bbHjGNJ7JMcY4gcGek/kaZ8ws/5KNoScOprpvXuCTqMyZi3 lzEdJ8ni/DxvGssGobvLt0ez6i3/gWecDi6piWtQn5XrvYHtLhuNP7PFnkEqgveo3UcbMDzDK iniYvL9RK799ZJ4Xffs2iGYgax7fXervCACbl5cuG6p8z0TkP5oYDfh50SWfvLfSpkPPHMOrP tDggmb7D5AGrA/Pn036TvsiVFVL4cgUi/ctukJ6J9ARzM39xFFqv2mt1xwswFpZW5lVttIZA3 OD8NZp/yqzeucoeO36MTeP6X/d2LneTf/o/GUcF1PhmGeWSRnc/wOGBrsdybfBTEeFLONW3MR V9/PEo3UDEjy67F/8js4vhJV2ZJrBImTnOcM9IHrKjKDSIxjBLE2Gq4CqYOc5q0NxlQPmAvLN svdfNPzazG4JV5U1xZ9rWUOdWsE3dnzT23KgkPbDi54XDGckOjuK7Vu47N4= Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/4] efi_loader: check interface when uninstalling protocol X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The interface has to be checked in UninstallProtocolInterface. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 5e4089df621..bfaef29d3e6 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -494,6 +494,8 @@ efi_status_t efi_remove_protocol(const efi_handle_t handle, return ret; if (guidcmp(handler->guid, protocol)) return EFI_INVALID_PARAMETER; + if (handler->protocol_interface != protocol_interface) + return EFI_INVALID_PARAMETER; list_del(&handler->link); free(handler); return EFI_SUCCESS; From patchwork Fri May 11 10:09:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 911888 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40j5V13kbYz9s16 for ; Fri, 11 May 2018 20:11:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 336AEC22346; Fri, 11 May 2018 10:10:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id F0472C2230A; Fri, 11 May 2018 10:09:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1CF7CC21FA1; Fri, 11 May 2018 10:09:33 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id B8476C222BF for ; Fri, 11 May 2018 10:09:32 +0000 (UTC) Received: from localhost.localdomain ([89.204.154.43]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LpsIh-1ecoQ82sBb-00fgXN; Fri, 11 May 2018 12:09:31 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Fri, 11 May 2018 12:09:22 +0200 Message-Id: <20180511100923.29659-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511100923.29659-1-xypron.glpk@gmx.de> References: <20180511100923.29659-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K1:eC3WQwhxhTghRhe3LeIHGz9/MhJqGbuiz4CPmpw7fowcUCWFuOP x4OrpsbdoEWWlIjSbHx+g874DTmMKjcIk8hZ5T2gRL5hEKnQPJaSdkL7vWI8Vs2/bAvgAdf 3vtViF8REOL+n07ItEVi24vPhP8gaw5booFdoFHiLtvheQfz8J/jniNIGsz9bgK3YTU7h6L tEPPx0iwa6d3TKTpx9www== X-UI-Out-Filterresults: notjunk:1; V01:K0:KEfNZuji4M0=:breqsmW1zIfBRHiiquxshR DUBln3hR77V+Mj0ECcoMXYG1i9Lcfr/Szi9w38OB5hKqwWVQEgyXmDvnTZnwFyMeb8tDAc26I jLW6kD4Cvnn5vR8eucB3lDcQ0d0yoQUKoyahz2D5u3br+4vUm9g/U7Ksp48D0HGM8922x+MOk n12uMwr5in75kF7W/yQ0hLfqGa6OYp7PNRQZUtDJN/LJ2chjgAGPodBeITBCuFXyzB/xZZ4Ao tHQq8nkIXprPlqK9a++6yh0yB4E9RlkxD9Nj3LVjYCigZh0XRy2YGYkN8ild77SswbCPEpvvX 0w2Iym2If70MH6LDIVdMBPlKphR4JVhXLD7WNNNO/6sM0hwxerNazdgovMNW+/cAz7whdIr0s uWz9SrCIfz2kUPVf8U4Xzw0ok2B/WwcEmrPTCJ6BPFs9rIAulsZd+7Gs5tTKUKuBft61q6kIJ 5jHyy/A7ltUnxPc2pSnhruUFdCAvKJCh2DmFBkm8An18N+TYugVDPeKYKn4tWBUX5kxT8idhr 0z0jZfC2vobdv/DeqgoL1gfZouwT2cRB7TG9dnY31GPiKYXaNCmZzGxkgPswBk0sWSS7VeMhm l2u+BmgT6RBGQzuSEVyCJu38VI/PUdRkwfI6K7Fx6RJzOsA5gjV65gTBEWl3qtwj51RjaJ6xj Mwd2Fg9itgNue/8DO+PUasxE8gsUgAzZiDztdE3dto0iL8bJSZ3E36OTPiMYH1yV5LrRz7gLl H8rhDBB0ojET7p/P7bzpaPbdYsj+A/g5IhoU0I5m7qahemmV2EUlPILZW1Y= Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH 3/4] efi_loader: implement ReinstallProtocolInterface X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The ReinstallProtocolInterface boot time service is implemented. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 66 +++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index bfaef29d3e6..8abbdfcec4c 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1022,29 +1022,6 @@ out: return EFI_EXIT(r); } -/* - * Reinstall protocol interface. - * - * This function implements the ReinstallProtocolInterface service. - * See the Unified Extensible Firmware Interface (UEFI) specification - * for details. - * - * @handle handle on which the protocol shall be - * reinstalled - * @protocol GUID of the protocol to be installed - * @old_interface interface to be removed - * @new_interface interface to be installed - * @return status code - */ -static efi_status_t EFIAPI efi_reinstall_protocol_interface( - efi_handle_t handle, const efi_guid_t *protocol, - void *old_interface, void *new_interface) -{ - EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, old_interface, - new_interface); - return EFI_EXIT(EFI_ACCESS_DENIED); -} - /* * Get all drivers associated to a controller. * The allocated buffer has to be freed with free(). @@ -2775,6 +2752,49 @@ out: return EFI_EXIT(ret); } +/* + * Reinstall protocol interface. + * + * This function implements the ReinstallProtocolInterface service. + * See the Unified Extensible Firmware Interface (UEFI) specification + * for details. + * + * The old interface is uninstalled. The new interface is installed. + * Drivers are connected. + * + * @handle handle on which the protocol shall be + * reinstalled + * @protocol GUID of the protocol to be installed + * @old_interface interface to be removed + * @new_interface interface to be installed + * @return status code + */ +static efi_status_t EFIAPI efi_reinstall_protocol_interface( + efi_handle_t handle, const efi_guid_t *protocol, + void *old_interface, void *new_interface) +{ + efi_status_t ret; + + EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, old_interface, + new_interface); + ret = EFI_CALL(efi_uninstall_protocol_interface(handle, protocol, + old_interface)); + if (ret != EFI_SUCCESS) + goto out; + ret = EFI_CALL(efi_install_protocol_interface(&handle, protocol, + EFI_NATIVE_INTERFACE, + new_interface)); + if (ret != EFI_SUCCESS) + goto out; + /* + * The returned status code has to be ignored. + * Do not create an error if no suitable driver for the handle exists. + */ + EFI_CALL(efi_connect_controller(handle, NULL, NULL, true)); +out: + return EFI_EXIT(ret); +} + /* * Get all child controllers associated to a driver. * The allocated buffer has to be freed with free(). From patchwork Fri May 11 10:09:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 911889 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40j5VT2hrLz9s02 for ; Fri, 11 May 2018 20:12:01 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 12BDFC222BF; Fri, 11 May 2018 10:10:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9C392C22338; Fri, 11 May 2018 10:09:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 957E7C21FA1; Fri, 11 May 2018 10:09:33 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 3EB24C2209A for ; Fri, 11 May 2018 10:09:33 +0000 (UTC) Received: from localhost.localdomain ([89.204.154.43]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M1Fe4-1eSXfY0esK-00tD2o; Fri, 11 May 2018 12:09:32 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Fri, 11 May 2018 12:09:23 +0200 Message-Id: <20180511100923.29659-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511100923.29659-1-xypron.glpk@gmx.de> References: <20180511100923.29659-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K1:Z2s1DzngFi3tMsqjcdEmjCQ8U82CvLaLPrf0KvObTOZUenKCPzY XqTPSXdOqbVUHYvkYVORNIfM8851knytp9LFGd3JJFGsQD8Xe0Ss2zjeXoBZbiFp8EKDgnv N3B964QgytMLOHGw52QLJrmqPj+MhZumQ+8Sbh7nzka8gmIlEZjomNs0JawEYHc9OJUfp6u gfbQBXSOI43cP86gacrHA== X-UI-Out-Filterresults: notjunk:1; V01:K0:NHxsBWLX6Xo=:5/Vvt38JP+ivDXMA0zlyff NofOazwPHVxNmlHdt7llntLqG4V+PrgoP495j/elbRyAhIdym+rOQ7/QvQ7wAvaJBjC/WkjNo SVQ2LasbNi1DuCEjISYy2pjTxOZ26+JkCx+i5qH5s3TLzw79r7nOIX7Q5SQ6ksVSRmVHLRodb Pf9uOJ23JC2kgxtBlC3Kv2lU1OUqzD2NvDsm5ESclcMfeAdsq5oZxOCFuVb2YX8h2uwaaKifs chM9F0/Ge/71LLHS7U37lxD+rArKNl17O+uyGH5TumLzJf5/QT1NVXEpKv5F/UrosRQ5MU6is 83C9pvVmdusRYttnBX9juWPmZdnXvuHhN2OgGYhQYSLM4APLHVKeTtoNRTnKPN+URvpN9Mcju 9/bRo9Sik6QQhI4KJJGcE9LIi+Mto36+7FwSsPWanLm4VjRABf73SjUNrxN6yznjUSxcsVq06 F2XX4k7obg8i4jqMV1KjYonPAUQtbik0SXBDRDmnbbIeFy1Por9YR/8y9Cn6bZOdJXhqt7Cri nAjPnpXJFTC7aJGYxH+88KQrAgsWWWuzHfK8QGSmwsPHZlb1PljFkF0u5DjOkplTovuQ3VLHr uzT7Qm+4mZ88xWk5xFjqripWUyeFe6fBwSSf4yK6uocuddzEBsoSckr26TwGj+YJt/5nBvmrd lJzIn5yMZdSJDbu25bL8wqI1rWUrzL7ORchsbXVdaKiUtVi9dN8apZxrR+g4ogYrtBNlRWzVs iRdfjXKFyQWDg+DDG7cR+fg0weOqAtxmZ/43seW93sjgOaDtBVP8aT7VFFE= Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH 4/4] efi_selftest: test ReinstallProtocolInterface X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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: Heinrich Schuchardt --- lib/efi_selftest/efi_selftest_controllers.c | 35 +++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_controllers.c b/lib/efi_selftest/efi_selftest_controllers.c index e30c11b1e45..ceefa03444f 100644 --- a/lib/efi_selftest/efi_selftest_controllers.c +++ b/lib/efi_selftest/efi_selftest_controllers.c @@ -6,7 +6,7 @@ * * This unit test checks the following protocol services: * ConnectController, DisconnectController, - * InstallProtocol, UninstallProtocol, + * InstallProtocol, ReinstallProtocol, UninstallProtocol, * OpenProtocol, CloseProtcol, OpenProtocolInformation */ @@ -14,6 +14,8 @@ #define NUMBER_OF_CHILD_CONTROLLERS 4 +static int interface1 = 1; +static int interface2 = 2; static struct efi_boot_services *boottime; const efi_guid_t guid_driver_binding_protocol = EFI_DRIVER_BINDING_PROTOCOL_GUID; @@ -271,7 +273,7 @@ static int setup(const efi_handle_t img_handle, /* Create controller handle */ ret = boottime->install_protocol_interface( &handle_controller, &guid_controller, - EFI_NATIVE_INTERFACE, NULL); + EFI_NATIVE_INTERFACE, &interface1); if (ret != EFI_SUCCESS) { efi_st_error("InstallProtocolInterface failed\n"); return EFI_ST_FAILURE; @@ -299,6 +301,7 @@ static int setup(const efi_handle_t img_handle, * Disconnect and destroy the remaining child controllers. * * Connect a controller to a driver. + * Reinstall the driver protocol on the controller. * Uninstall the driver protocol from the controller. */ static int execute(void) @@ -361,9 +364,35 @@ static int execute(void) efi_st_error("Number of children %u != %u\n", (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 */ ret = boottime->uninstall_protocol_interface(handle_controller, - &guid_controller, NULL); + &guid_controller, + &interface2); if (ret != EFI_SUCCESS) { efi_st_error("Failed to uninstall protocols\n"); return EFI_ST_FAILURE;