From nobody Sat Nov 2 14:40:14 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.zoho.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 1488924937478707.7462721233851; Tue, 7 Mar 2017 14:15:37 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F106E80365; Tue, 7 Mar 2017 14:15:35 -0800 (PST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id C0F8B80361 for ; Tue, 7 Mar 2017 14:15:34 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ADCB2344; Tue, 7 Mar 2017 14:15:34 -0800 (PST) Received: from u200856.usa.arm.com (u201426.usa.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 578F23F3E1; Tue, 7 Mar 2017 14:15:34 -0800 (PST) X-Original-To: edk2-devel@lists.01.org From: Jeremy Linton To: edk2-devel@lists.01.org Date: Tue, 7 Mar 2017 16:15:11 -0600 Message-Id: <20170307221512.5180-7-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170307221512.5180-1-jeremy.linton@arm.com> References: <20170307221512.5180-1-jeremy.linton@arm.com> Subject: [edk2] [PATCH v4 6/6] EmbeddedPkg: SiI3132: Enable SCSI pass-through protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ryan.harkin@linaro.org, ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org 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" Now that everything is in place, lets export the protocol, build the module, and remove the ATAPI unsupported flags. Now when we detect an ATAPI device on a port we flag it as such. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeremy Linton --- EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c | 52 ++++++++++++++----= ---- .../Drivers/SataSiI3132Dxe/SataSiI3132Dxe.inf | 2 + 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c b/EmbeddedPkg= /Drivers/SataSiI3132Dxe/SataSiI3132.c index f494655..b98231c 100644 --- a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c +++ b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132.c @@ -1,7 +1,7 @@ /** @file * PCIe Sata support for the Silicon Image I3132 * -* Copyright (c) 2011-2015, ARM Limited. All rights reserved. +* Copyright (c) 2011-2017, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the B= SD License @@ -16,6 +16,7 @@ #include "SataSiI3132.h" =20 #include +#include =20 #include #include @@ -88,7 +89,6 @@ SataSiI3132Constructor ( ) { SATA_SI3132_INSTANCE *Instance; - EFI_ATA_PASS_THRU_MODE *AtaPassThruMode; =20 if (!SataSiI3132Instance) { return EFI_INVALID_PARAMETER; @@ -102,16 +102,15 @@ SataSiI3132Constructor ( Instance->Signature =3D SATA_SII3132_SIGNATURE; Instance->PciIo =3D PciIo; =20 - AtaPassThruMode =3D (EFI_ATA_PASS_THRU_MODE*)AllocatePool (sizeof (EFI_A= TA_PASS_THRU_MODE)); - AtaPassThruMode->Attributes =3D EFI_ATA_PASS_THRU_ATTRIBUTES_PHYSICAL | = EFI_ATA_PASS_THRU_ATTRIBUTES_LOGICAL; - AtaPassThruMode->IoAlign =3D 0x1000; + Instance->AtaPassThruMode.Attributes =3D EFI_ATA_PASS_THRU_ATTRIBUTES_PH= YSICAL | EFI_ATA_PASS_THRU_ATTRIBUTES_LOGICAL; + Instance->AtaPassThruMode.IoAlign =3D 0x4; =20 // Initialize SiI3132 ports SataSiI3132PortConstructor (Instance, 0); SataSiI3132PortConstructor (Instance, 1); =20 // Set ATA Pass Thru Protocol - Instance->AtaPassThruProtocol.Mode =3D AtaPassThruMode; + Instance->AtaPassThruProtocol.Mode =3D &Instance->AtaPassThru= Mode; Instance->AtaPassThruProtocol.PassThru =3D SiI3132AtaPassThru; Instance->AtaPassThruProtocol.GetNextPort =3D SiI3132GetNextPort; Instance->AtaPassThruProtocol.GetNextDevice =3D SiI3132GetNextDevice; @@ -120,6 +119,20 @@ SataSiI3132Constructor ( Instance->AtaPassThruProtocol.ResetPort =3D SiI3132ResetPort; Instance->AtaPassThruProtocol.ResetDevice =3D SiI3132ResetDevice; =20 + Instance->ExtScsiPassThruMode.Attributes =3D EFI_EXT_SCSI_PASS_THRU_ATTR= IBUTES_PHYSICAL | + EFI_EXT_SCSI_PASS_THRU_ATTRIB= UTES_LOGICAL; + Instance->ExtScsiPassThruMode.IoAlign =3D 0x4; + + // Set SCSI Pass Thru Protocol + Instance->ExtScsiPassThru.Mode =3D &Instance->ExtScsiPass= ThruMode; + Instance->ExtScsiPassThru.PassThru =3D SiI3132ScsiPassThru; + Instance->ExtScsiPassThru.GetNextTargetLun =3D SiI3132GetNextTargetLu= n; + Instance->ExtScsiPassThru.BuildDevicePath =3D SiI3132ScsiBuildDevice= Path; + Instance->ExtScsiPassThru.GetTargetLun =3D SiI3132GetTargetLun; + Instance->ExtScsiPassThru.ResetChannel =3D SiI3132ResetChannel; + Instance->ExtScsiPassThru.ResetTargetLun =3D SiI3132ResetTargetLun; + Instance->ExtScsiPassThru.GetNextTarget =3D SiI3132GetNextTarget; + *SataSiI3132Instance =3D Instance; =20 return EFI_SUCCESS; @@ -165,7 +178,9 @@ SataSiI3132PortInitialization ( UINT32 Signature; EFI_STATUS Status; EFI_PCI_IO_PROTOCOL* PciIo; + BOOLEAN Atapi; =20 + Atapi =3D FALSE; Status =3D SiI3132HwResetPort (Port); if (EFI_ERROR (Status)) { return Status; @@ -177,33 +192,33 @@ SataSiI3132PortInitialization ( Status =3D SATA_PORT_READ32 (Port->RegBase + SII3132_PORT_SSTATUS_REG, &= Value32); if (!EFI_ERROR (Status) && (Value32 & 0x3)) { // Do a soft reset to see if it is a port multiplier - SATA_TRACE ("SataSiI3132PortInitialization: soft reset - it is a port = multiplier\n"); + SATA_TRACE ("SataSiI3132PortInitialization: soft reset - is it a port = multiplier?\n"); Status =3D SiI3132SoftResetCommand (Port, &Signature); if (!EFI_ERROR (Status)) { if (Signature =3D=3D SII3132_PORT_SIGNATURE_PMP) { - SATA_TRACE ("SataSiI3132PortInitialization(): a Port Multiplier is= present"); + DEBUG ((DEBUG_ERROR, "SataSiI3132PortInitialization(): a Port Mult= iplier is present")); if (FeaturePcdGet (PcdSataSiI3132FeaturePMPSupport)) { ASSERT (0); // Not supported yet } else { return EFI_UNSUPPORTED; } } else if (Signature =3D=3D SII3132_PORT_SIGNATURE_ATAPI) { - ASSERT (0); // Not supported yet SATA_TRACE ("SataSiI3132PortInitialization(): an ATAPI device is p= resent"); - return EFI_UNSUPPORTED; + Atapi =3D TRUE; } else if (Signature =3D=3D SII3132_PORT_SIGNATURE_ATA) { SATA_TRACE ("SataSiI3132PortInitialization(): an ATA device is pre= sent"); } else { - SATA_TRACE ("SataSiI3132PortInitialization(): Present device unkno= wn!"); + DEBUG ((DEBUG_ERROR, "SataSiI3132PortInitialization(): Present dev= ice unknown!")); ASSERT (0); // Not supported return EFI_UNSUPPORTED; } =20 // Create Device Device =3D (SATA_SI3132_DEVICE*)AllocatePool (sizeof (SAT= A_SI3132_DEVICE)); - Device->Index =3D Port->Index; //TODO: Could need to be fixed wh= en SATA Port Multiplier support + Device->Index =3D 0; //TODO: When port multiplers are supported = this is the multiplier index Device->Port =3D Port; Device->BlockSize =3D 0; + Device->Atapi =3D Atapi; =20 // Attached the device to the Sata Port InsertTailList (&Port->Devices, &Device->Link); @@ -432,13 +447,12 @@ SataSiI3132DriverBindingStart ( return Status; } =20 - // Install Ata Pass Thru Protocol - Status =3D gBS->InstallProtocolInterface ( - &Controller, - &gEfiAtaPassThruProtocolGuid, - EFI_NATIVE_INTERFACE, - &(SataSiI3132Instance->AtaPassThruProtocol) - ); + Status =3D gBS->InstallMultipleProtocolInterfaces (&Controller, + &gEfiAtaPassThruProtoco= lGuid, + &(SataSiI3132Instance->= AtaPassThruProtocol), + &gEfiExtScsiPassThruPro= tocolGuid, + &(SataSiI3132Instance->= ExtScsiPassThru), + NULL); if (EFI_ERROR (Status)) { goto FREE_POOL; } diff --git a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132Dxe.inf b/Embedd= edPkg/Drivers/SataSiI3132Dxe/SataSiI3132Dxe.inf index 69aaab3..eb6e2bd 100644 --- a/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132Dxe.inf +++ b/EmbeddedPkg/Drivers/SataSiI3132Dxe/SataSiI3132Dxe.inf @@ -35,10 +35,12 @@ SataSiI3132.c ComponentName.c SiI3132AtaPassThru.c + SiI3132ScsiPassThru.c =20 [Protocols] gEfiPciIoProtocolGuid # Consumed gEfiAtaPassThruProtocolGuid # Produced + gEfiExtScsiPassThruProtocolGuid # Produced =20 [Pcd] gEmbeddedTokenSpaceGuid.PcdSataSiI3132FeaturePMPSupport --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel