From nobody Mon Feb 9 19:04:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59090+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59090+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1589208955; cv=none; d=zohomail.com; s=zohoarc; b=I5QmDspZWoPHWuF6BEhIppFR/XK3a4YeMmQYkWnetSpM2CDiSkvTXd05fPuxo8LIshA4CI9sx8S7cVhVFe+VKmCPy1A56h5Cx3NsomRZbtrPfIEcFwYrY9zQyAmR4tpWrF4UXKkEp6hmF1SFbkjSxHNnW2X8yw3AyUFJ7TeujsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589208955; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=Y9j/KkE+Osepy7CgiydE84xlNC1mhm6wFN+eXxq4GpM=; b=NkD6F0D4c0ug4ArAIByMCFSzOObpfYcRMYYY9QnYigynvBOplqf3p1uov8Np3NWFuiaActqpHbq2tLqugmDN4JzKXJgaJnKQ6ChN8GOz+4a9Gwp+1wT24S2EPjPnbN7q9nkb9yDWGioZwVeE+lg+QqNMmnfQLo7XHP7Ig95GVMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59090+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589208955752379.23326002958197; Mon, 11 May 2020 07:55:55 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QpjDYY1788612x7XnlLk13ND; Mon, 11 May 2020 07:55:55 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.13643.1589208954829014118 for ; Mon, 11 May 2020 07:55:54 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81FBC1045; Mon, 11 May 2020 07:55:54 -0700 (PDT) X-Received: from e123331-lin.nice.arm.com (unknown [10.37.8.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 032073F68F; Mon, 11 May 2020 07:55:52 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Pete Batard , Jared McNeill , Andrei Warkentin , Samer El-Haj-Mahmoud , Jeremy Linton Subject: [edk2-devel] [PATCH edk2-platforms v4 8/9] Silicon/Broadcom/BcmGenetDxe: add unload support Date: Mon, 11 May 2020 16:55:26 +0200 Message-Id: <20200511145527.23453-9-ard.biesheuvel@arm.com> In-Reply-To: <20200511145527.23453-1-ard.biesheuvel@arm.com> References: <20200511145527.23453-1-ard.biesheuvel@arm.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@arm.com X-Gm-Message-State: 03TzBtdQeSMbaKsBiLj76jimx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589208955; bh=Lfpo1AUPYar4FGh0yIkDuVrLAZiOKYe9LpKMZE4iJ1U=; h=Cc:Date:From:Reply-To:Subject:To; b=nbgY2zaxH9WcHNezjuhjnv92P3WV+2dMoTCp2pRTpO0E100osOJX8Us7MCC1wGW+poP mbd90Fl7SEceoYJU1nZZwDgtATWqDKJUAiiVyTYoEh36+d8m5SxM6dIYE2PIqJSe/hCn3 LIgLdEcxOXp8EvWbTbS2JNPgdtzokMbwSls= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add unload support to the GENET driver Signed-off-by: Ard Biesheuvel --- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf | 1 + Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c | 60 ++++++++++++= ++++++++ 2 files changed, 61 insertions(+) diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf b/Sil= icon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf index e3e4ebbddb93..3e98983c6b07 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf @@ -16,6 +16,7 @@ [Defines] MODULE_TYPE =3D UEFI_DRIVER VERSION_STRING =3D 1.0 ENTRY_POINT =3D GenetEntryPoint + UNLOAD_IMAGE =3D GenetUnload =20 [Sources] ComponentName.c diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c b/Sil= icon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c index 630a92ef210b..238b336d55f6 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c @@ -340,3 +340,63 @@ GenetEntryPoint ( =20 return EFI_SUCCESS; } + +/** + Unload function of GENET UEFI Driver. + + @param ImageHandle The allocated handle for the EFI image + + @retval EFI_SUCCESS The driver was unloaded successfully + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. + +**/ +EFI_STATUS +EFIAPI +GenetUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN HandleCount; + UINTN Index; + + // + // Retrieve all USB I/O handles in the handle database + // + Status =3D gBS->LocateHandleBuffer (ByProtocol, + &gBcmGenetPlatformDeviceProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Disconnect the driver from the handles in the handle database + // + for (Index =3D 0; Index < HandleCount; Index++) { + Status =3D gBS->DisconnectController (HandleBuffer[Index], + gImageHandle, + NULL); + } + + // + // Free the handle array + // + gBS->FreePool (HandleBuffer); + + // + // Uninstall protocols installed by the driver in its entrypoint + // + Status =3D EfiLibUninstallDriverBindingComponentName2 ( + &mGenetDriverBinding, + &gGenetComponentName, + &gGenetComponentName2 + ); + + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59090): https://edk2.groups.io/g/devel/message/59090 Mute This Topic: https://groups.io/mt/74137458/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-