From nobody Mon Feb 9 18:43:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87540+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87540+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1647272334; cv=none; d=zohomail.com; s=zohoarc; b=OvrS6pCSjaZ3YEHtTfbnhuJdJwqxgj4WW6mcRIevzMEdcQu1CBx1WKCeRAJMOywR6F0gyHlc1z2MGwIqcon8BoPWFaspmVZd5vQV2ntI9wSMGdcNmK+BQpYJM1KX7VI7AaYYgBiVUBpMnN+vH8dLj4C1lusGr/c/4PFSy9LxqnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647272334; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BusS4bOwbwUCNkGxE+3sQ4lnI6lptyvrYeTkJcdcqCk=; b=gIUtowmOcpTBwD/yxMn+kZ6oGDrPTe5VMJbDSlIb1EuUvfCpBPWFfVKETrCOAtF+eLJp3g/vSmbCmBA8qbUts3G4Onnglhz2Hs4iKuLNuT8iNimG4Nv1kcaCzzjGuDcCCTp7T9tIkraM64zYJynqR5mliGEsBoAL3urgYoUdS0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87540+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1647272334618963.0056398696739; Mon, 14 Mar 2022 08:38:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id l8sQYY1788612xDIz30kpsCr; Mon, 14 Mar 2022 08:38:54 -0700 X-Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mx.groups.io with SMTP id smtpd.web11.27839.1647272333274262389 for ; Mon, 14 Mar 2022 08:38:53 -0700 X-Received: by mail-lf1-f51.google.com with SMTP id bu29so28020448lfb.0 for ; Mon, 14 Mar 2022 08:38:53 -0700 (PDT) X-Gm-Message-State: SYQripemNSClnoUFh7Kj0XoMx1787277AA= X-Google-Smtp-Source: ABdhPJzKHQJDqj4OW+S26CjniU4SNLM5biTM5+55QmWl1pPcwsVE+uMgZrEBZEo+QdUYtHMKphzFFA== X-Received: by 2002:a05:6512:104a:b0:448:67ce:d718 with SMTP id c10-20020a056512104a00b0044867ced718mr12408608lfb.26.1647272331556; Mon, 14 Mar 2022 08:38:51 -0700 (PDT) X-Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id b8-20020ac25628000000b004484bd1be5esm3325401lff.256.2022.03.14.08.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 08:38:51 -0700 (PDT) From: "Marcin Wojtas" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, mw@semihalf.com, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, sunny.Wang@arm.com Subject: [edk2-devel] [edk2-platforms PATCH 1/8] Marvell/Drivers: Pp2Dxe: Fix Pp2SnpShutdown Date: Mon, 14 Mar 2022 16:38:30 +0100 Message-Id: <20220314153837.1885852-2-mw@semihalf.com> In-Reply-To: <20220314153837.1885852-1-mw@semihalf.com> References: <20220314153837.1885852-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mw@semihalf.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1647272334; bh=yKLjICC8108yGD345h8XmPzWQWJBZiSkTFp85m7Rsxo=; h=Cc:Date:From:Reply-To:Subject:To; b=gvb5fpI3VHEvQDi3YPB0DLaV7GIuw5scpXlC6fO/dQLShpMWPBLvdsvLl2QlZTkhcSu UPvwCE3e64w6PnpoqnN/V2PAAfoSPnHykAp3vzvvZ7a2/5CCXSzVmc+b96X9Dno3nEiP7 3UfnWlZwXAUwjtlx9mWKDtakiYsxnl4fR6s= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1647273237684100002 Content-Type: text/plain; charset="utf-8" The SnpShutdown callback requires updating the instance state and also disabling hardware interfaces. For that purpose reuse Pp2Halt routine. Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 50 +++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Silicon/Marvell/= Drivers/Net/Pp2Dxe/Pp2Dxe.c index 0872f17889..30e091f807 100644 --- a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c +++ b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c @@ -633,14 +633,12 @@ Pp2SnpReset ( return EFI_SUCCESS; } =20 +STATIC VOID -EFIAPI Pp2DxeHalt ( - IN EFI_EVENT Event, - IN VOID *Context + IN PP2DXE_CONTEXT *Pp2Context ) { - PP2DXE_CONTEXT *Pp2Context =3D Context; PP2DXE_PORT *Port =3D &Pp2Context->Port; MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; INTN Index; @@ -661,30 +659,58 @@ Pp2DxeHalt ( MvGop110PortDisable(Port); } =20 +VOID +EFIAPI +Pp2DxeHaltEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + PP2DXE_CONTEXT *Pp2Context =3D Context; + + Pp2DxeHalt (Pp2Context); +} + EFI_STATUS EFIAPI Pp2SnpShutdown ( IN EFI_SIMPLE_NETWORK_PROTOCOL *This ) { + PP2DXE_CONTEXT *Pp2Context; EFI_TPL SavedTpl; + + /* Check Snp Instance. */ + if (This =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + SavedTpl =3D gBS->RaiseTPL (TPL_CALLBACK); - PP2DXE_CONTEXT *Pp2Context =3D INSTANCE_FROM_SNP(This); - UINT32 State =3D This->Mode->State; =20 - if (State !=3D EfiSimpleNetworkInitialized) { - switch (State) { + Pp2Context =3D INSTANCE_FROM_SNP (This); + + /* Check whether the driver was started and initialized. */ + if (This->Mode->State !=3D EfiSimpleNetworkInitialized) { + switch (This->Mode->State) { case EfiSimpleNetworkStopped: - DEBUG((DEBUG_WARN, "Pp2Dxe%d: not started\n", Pp2Context->Instance)); + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not started\n", Pp2Context->Instance)= ); ReturnUnlock (SavedTpl, EFI_NOT_STARTED); case EfiSimpleNetworkStarted: - /* Fall through */ + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not initialized\n", Pp2Context->Insta= nce)); + ReturnUnlock (SavedTpl, EFI_DEVICE_ERROR); default: - DEBUG((DEBUG_ERROR, "Pp2Dxe%d: wrong state\n", Pp2Context->Instance)= ); + DEBUG ((DEBUG_WARN, + "Pp2Dxe%d: wrong state: %u\n", + Pp2Context->Instance, + This->Mode->State)); ReturnUnlock (SavedTpl, EFI_DEVICE_ERROR); } } =20 + Pp2DxeHalt (Pp2Context); + + This->Mode->State =3D EfiSimpleNetworkStarted; + ReturnUnlock (SavedTpl, EFI_SUCCESS); } =20 @@ -1458,7 +1484,7 @@ Pp2DxeInitialiseController ( Status =3D gBS->CreateEvent ( EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, - Pp2DxeHalt, + Pp2DxeHaltEvent, Pp2Context, &Pp2Context->EfiExitBootServicesEvent ); --=20 2.29.0 -=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 (#87540): https://edk2.groups.io/g/devel/message/87540 Mute This Topic: https://groups.io/mt/89776250/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-