From nobody Fri Apr 19 08:38:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48499+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48499+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1570406568; cv=none; d=zoho.com; s=zohoarc; b=cpt81MHft4cjvEPQrEWfRA5TWJ917xIakYfP+mXVVaDDAfYJ5pdjNf+hMsiUAohynvKy+XdmUhEZSNEmvXF4M+R0rdmaQIH4+1zfCMnXA6b/YoUM+J4Vg0fLNLfNedHXYlEnpUHkRSygYRr+WPYjSYOe+o0WA1vERG/mgdj8J48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570406568; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=TZn5qmvBVc6xaXsnCxpnxhTllkOYDIQBwrquHsjz9I4=; b=XuGtv8GRyVGU2ltZrsn/TBOpjIr6ae1eaReeI4YiJxY1fGkFE1DMO3Myyp1CHs2xrYlL4YQ2k0aaZ0QwVH3BAe6+6fRr+vgXP80EWOMpm6DIytcsL9qXTaGvSoCOkElceTWiUGeLcVOh0Oq0ckpZaiG1EzEKhKptmNp53JpnGek= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48499+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1570406568505107.85681746687055; Sun, 6 Oct 2019 17:02:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id FoWEYY1788612xjCGJOXfTGh; Sun, 06 Oct 2019 17:02:47 -0700 X-Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by groups.io with SMTP; Sun, 06 Oct 2019 17:02:47 -0700 X-Received: by mail-lf1-f65.google.com with SMTP id r2so7948074lfn.8 for ; Sun, 06 Oct 2019 17:02:46 -0700 (PDT) X-Gm-Message-State: 68a1XxavLq9k0uxPzhWT3okmx1787277AA= X-Google-Smtp-Source: APXvYqyVvGu9AI41n3xnJa1bEuJRNQIxv9fg2a9PccV3oozGlyV1VVUgQRwZG005fgUE6FxTRqrTOw== X-Received: by 2002:a19:4bd7:: with SMTP id y206mr15354533lfa.9.1570406564525; Sun, 06 Oct 2019 17:02:44 -0700 (PDT) X-Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id m6sm2755149ljj.3.2019.10.06.17.02.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 06 Oct 2019 17:02:43 -0700 (PDT) From: "Marcin Wojtas" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com Subject: [edk2-devel] [edk2-platforms: PATCH] Marvell/Drivers: MvPhyDxe: Execute proper initialization callback Date: Mon, 7 Oct 2019 02:02:26 +0200 Message-Id: <1570406546-15715-1-git-send-email-mw@semihalf.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,mw@semihalf.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1570406567; bh=wcrAi8n5nbcTeyzSVOpRUCKOrMjF3e8wXihY9fdxoUU=; h=Cc:Date:From:Reply-To:Subject:To; b=tvIosOBTU8J7nLcv8f1ropQ7fAgjI6H1kdbEKJTvgck99RoiTSXz5ysHR+rCiR5nVnW 41+X3uve1QzkIpO9Lks2dCSnslRsE0yd5QIwmPIrWl42KG8ifE6qaYdtJYgSovvKO7s15 lCgGbRrwofstcym///dA8S3nPwtAdiCeB0I= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Hitherto code was executing by mistake the first possible initialization routine (valid for 88E1512 PHY), regardless the setting in gMarvellTokenSpaceGuid.PcdPhyDeviceIds. Fix this. Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.h | 3 ++- Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.c | 28 +++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.h b/Silicon/Marv= ell/Drivers/Net/MvPhyDxe/MvPhyDxe.h index 908b768..4d8aacf 100644 --- a/Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.h +++ b/Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.h @@ -49,7 +49,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 typedef enum { MV_PHY_DEVICE_1512, - MV_PHY_DEVICE_1112 + MV_PHY_DEVICE_1112, + MV_PHY_DEVICE_ID_MAX } MV_PHY_DEVICE_ID; =20 typedef diff --git a/Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.c b/Silicon/Marv= ell/Drivers/Net/MvPhyDxe/MvPhyDxe.c index 2d2aad7..6e4a715 100644 --- a/Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.c +++ b/Silicon/Marvell/Drivers/Net/MvPhyDxe/MvPhyDxe.c @@ -396,7 +396,7 @@ MvPhyInit ( PHY_DEVICE *PhyDev; UINT8 *DeviceIds; UINT8 MdioIndex; - INTN i; + UINT8 PhyId; =20 Status =3D gBS->LocateProtocol ( &gMarvellMdioProtocolGuid, @@ -415,6 +415,17 @@ MvPhyInit ( return EFI_INVALID_PARAMETER; } =20 + DeviceIds =3D PcdGetPtr (PcdPhyDeviceIds); + PhyId =3D DeviceIds[PhyIndex]; + if (PhyId >=3D MV_PHY_DEVICE_ID_MAX) { + DEBUG ((DEBUG_ERROR, + "%a, Incorrect PHY ID (0x%x) for PHY#%d\n", + __FUNCTION__, + PhyId, + PhyIndex)); + return EFI_INVALID_PARAMETER; + } + /* perform setup common for all PHYs */ PhyDev =3D AllocateZeroPool (sizeof (PHY_DEVICE)); PhyDev->Addr =3D PhySmiAddresses[PhyIndex]; @@ -427,20 +438,7 @@ MvPhyInit ( PhyConnection)); *OutPhyDev =3D PhyDev; =20 - DeviceIds =3D PcdGetPtr (PcdPhyDeviceIds); - for (i =3D 0; i < PcdGetSize (PcdPhyDeviceIds); i++) { - /* find MvPhyDevices fitting entry */ - if (MvPhyDevices[i].DevId =3D=3D DeviceIds[i]) { - ASSERT (MvPhyDevices[i].DevInit !=3D NULL); - /* proceed with PHY-specific initialization */ - return MvPhyDevices[i].DevInit (Snp, PhyDev); - } - } - - /* if we are here, no matching DevId was found */ - Status =3D EFI_INVALID_PARAMETER; - FreePool (PhyDev); - return Status; + return MvPhyDevices[PhyId].DevInit (Snp, PhyDev); } =20 EFI_STATUS --=20 2.7.4 -=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 (#48499): https://edk2.groups.io/g/devel/message/48499 Mute This Topic: https://groups.io/mt/34421607/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-