From nobody Thu Dec 26 14:30:07 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1504824087274542.1812410025816; Thu, 7 Sep 2017 15:41:27 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8AECD20945612; Thu, 7 Sep 2017 15:38:33 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 763B621D492FD for ; Thu, 7 Sep 2017 15:38:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA0FD4E334; Thu, 7 Sep 2017 22:41:22 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-54.rdu2.redhat.com [10.10.120.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39D9D5D967; Thu, 7 Sep 2017 22:41:21 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AA0FD4E334 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com From: Laszlo Ersek To: edk2-devel-01 Date: Fri, 8 Sep 2017 00:41:07 +0200 Message-Id: <20170907224116.895-2-lersek@redhat.com> In-Reply-To: <20170907224116.895-1-lersek@redhat.com> References: <20170907224116.895-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 07 Sep 2017 22:41:22 +0000 (UTC) Subject: [edk2] [PATCH 01/10] MdeModulePkg/AtaAtapiPassThru: cache EnabledPciAttributes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiewen Yao , Brijesh Singh , Eric Dong , Star Zeng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Both AtaAtapiPassThruStart() and AtaAtapiPassThruStop() fetch the supported attributes of the device, just so they can toggle the IO+MMIO+BusMaster subset. After we compute this bitmask in AtaAtapiPassThruStart(), we can cache it for later, and save the fetch in AtaAtapiPassThruStop(). Cc: Ard Biesheuvel Cc: Brijesh Singh Cc: Eric Dong Cc: Jiewen Yao Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h | 1 + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 32 ++++++++----= -------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h b/Mde= ModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h index 4f327dc30b60..85e5a5553953 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h @@ -98,10 +98,11 @@ typedef struct { =20 // // The attached device list // LIST_ENTRY DeviceList; + UINT64 EnabledPciAttributes; UINT64 OriginalPciAttributes; =20 // // For AtaPassThru protocol, using the following bytes to record the pre= vious call in // GetNextPort()/GetNextDevice(). diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/Mde= ModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c index 795443ef74f6..b7fdb8dd4876 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c @@ -92,10 +92,11 @@ ATA_ATAPI_PASS_THRU_INSTANCE gAtaAtapiPassThruInstanceT= emplate =3D { }, { // DeviceList NULL, NULL }, + 0, // EnabledPciAttributes 0, // OriginalAttributes 0, // PreviousPort 0, // PreviousPortMultiplier 0, // PreviousTargetId 0, // PreviousLun @@ -668,11 +669,11 @@ AtaAtapiPassThruStart ( { EFI_STATUS Status; EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit; ATA_ATAPI_PASS_THRU_INSTANCE *Instance; EFI_PCI_IO_PROTOCOL *PciIo; - UINT64 Supports; + UINT64 EnabledPciAttributes; UINT64 OriginalPciAttributes; =20 Status =3D EFI_SUCCESS; IdeControllerInit =3D NULL; Instance =3D NULL; @@ -720,18 +721,18 @@ AtaAtapiPassThruStart ( =20 Status =3D PciIo->Attributes ( PciIo, EfiPciIoAttributeOperationSupported, 0, - &Supports + &EnabledPciAttributes ); if (!EFI_ERROR (Status)) { - Supports &=3D (UINT64)EFI_PCI_DEVICE_ENABLE; + EnabledPciAttributes &=3D (UINT64)EFI_PCI_DEVICE_ENABLE; Status =3D PciIo->Attributes ( PciIo, EfiPciIoAttributeOperationEnable, - Supports, + EnabledPciAttributes, NULL ); } =20 if (EFI_ERROR (Status)) { @@ -747,10 +748,11 @@ AtaAtapiPassThruStart ( } =20 Instance->ControllerHandle =3D Controller; Instance->IdeControllerInit =3D IdeControllerInit; Instance->PciIo =3D PciIo; + Instance->EnabledPciAttributes =3D EnabledPciAttributes; Instance->OriginalPciAttributes =3D OriginalPciAttributes; Instance->AtaPassThru.Mode =3D &Instance->AtaPassThruMode; Instance->ExtScsiPassThru.Mode =3D &Instance->ExtScsiPassThruMode; InitializeListHead(&Instance->DeviceList); InitializeListHead(&Instance->NonBlockingTaskList); @@ -857,11 +859,10 @@ AtaAtapiPassThruStop ( EFI_STATUS Status; ATA_ATAPI_PASS_THRU_INSTANCE *Instance; EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru; EFI_PCI_IO_PROTOCOL *PciIo; EFI_AHCI_REGISTERS *AhciRegisters; - UINT64 Supports; =20 DEBUG ((EFI_D_INFO, "=3D=3DAtaAtapiPassThru Stop=3D=3D Controller =3D %x= \n", Controller)); =20 Status =3D gBS->OpenProtocol ( Controller, @@ -950,25 +951,16 @@ AtaAtapiPassThruStop ( } =20 // // Disable this ATA host controller. // - Status =3D PciIo->Attributes ( - PciIo, - EfiPciIoAttributeOperationSupported, - 0, - &Supports - ); - if (!EFI_ERROR (Status)) { - Supports &=3D (UINT64)EFI_PCI_DEVICE_ENABLE; - PciIo->Attributes ( - PciIo, - EfiPciIoAttributeOperationDisable, - Supports, - NULL - ); - } + PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationDisable, + Instance->EnabledPciAttributes, + NULL + ); =20 // // Restore original PCI attributes // Status =3D PciIo->Attributes ( --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel