From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web12.1123.1662747060217728711 for ; Fri, 09 Sep 2022 11:11:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=nTCbKDyf; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: maciej.czajkowski@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662747060; x=1694283060; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JZ8WRhvGKR2UXlQWhzyOO2tdb8+1MbrwMsl7HrMdLK4=; b=nTCbKDyfamtOTly/Z8VZ5660evf/4ETrYQyPPQpplh+oV6Fmr71uR5re fiywhxsoajdczPOMfzYLE3H0YLsCdcJJ04MvC17b2O5+CZDF4WP54IXWs 8p9HBLuzuMoJoeyEGsepfjwCUur0MO2Ffn1i4efViBtgpPDbtnjOgTC9h 0NdBHpM6S1UXMTJGCRXo7fT+JRkBWIcH85gFRNt8e/kAm0QwENjjIlz41 q1W924lzWa7OXk54mtfF/PEdFwWwHR2/4YC2fWGoQVo5LSm8FwpnwMZIi qgrS4u16o0cb1qC/N/4Lhjjg80MuSnP/BQH/w2KHIRq3KAX+9bm7F3o6L Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10465"; a="277930782" X-IronPort-AV: E=Sophos;i="5.93,303,1654585200"; d="scan'208";a="277930782" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2022 11:10:59 -0700 X-IronPort-AV: E=Sophos;i="5.93,303,1654585200"; d="scan'208";a="677265505" Received: from mczajkow-mobl.ger.corp.intel.com ([10.252.59.2]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2022 11:10:58 -0700 From: "Maciej Czajkowski" To: devel@edk2.groups.io Cc: Hao A Wu , Ray Ni Subject: [PATCH v1] MdeModulePkg/AhciPei: Fix MMIO base assignment Date: Fri, 9 Sep 2022 20:10:55 +0200 Message-Id: <20220909181055.1237-1-maciej.czajkowski@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4041 There is a mistake in getting MMIO base using PciDevicePpi that can lead to the data corruption. Cc: Hao A Wu Cc: Ray Ni Signed-off-by: Maciej Czajkowski --- MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c b/MdeModulePkg/Bus/Ata/= AhciPei/AhciPei.c index 98dd732a4023..47367f43f73a 100644 --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c @@ -405,7 +405,7 @@ AtaAhciInitPrivateDataFromPciDevice ( { EFI_STATUS Status; PCI_TYPE00 PciData; - UINTN MmioBase; + UINT32 MmioBase; EFI_DEVICE_PATH_PROTOCOL *DevicePath; UINTN DevicePathLength; UINT64 EnabledPciAttributes; @@ -454,12 +454,13 @@ AtaAhciInitPrivateDataFromPciDevice ( &PciDevice->PciIo, EfiPciIoWidthUint32, 0x24, - sizeof (UINTN), + 1, &MmioBase ); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } + MmioBase &=3D 0xFFFFFFF0; = DevicePathLength =3D GetDevicePathSize (PciDevice->DevicePath); DevicePath =3D PciDevice->DevicePath; -- = 2.27.0.windows.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu usta= wy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w trans= akcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited.