From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m4a0073g.houston.softwaregrp.com (m4a0073g.houston.softwaregrp.com [15.124.2.131]) by mx.groups.io with SMTP id smtpd.web12.16795.1591956341227210825 for ; Fri, 12 Jun 2020 03:05:48 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: suse.com, ip: 15.124.2.131, mailfrom: glin@suse.com) Received: FROM m4a0073g.houston.softwaregrp.com (15.120.17.146) BY m4a0073g.houston.softwaregrp.com WITH ESMTP; Fri, 12 Jun 2020 10:03:25 +0000 Received: from M9W0067.microfocus.com (2002:f79:be::f79:be) by M4W0334.microfocus.com (2002:f78:1192::f78:1192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 12 Jun 2020 10:05:20 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (15.124.72.14) by M9W0067.microfocus.com (15.121.0.190) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Fri, 12 Jun 2020 10:05:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YWeabPBZLvJr0WwLK2G0fj40H+uyC0FWcQxxQuNMb1D+QyR/oPsQdi5ymOnVRlYHLH/t3w8WwHtHIuwSoZ53sQklSUF1RGxOhv3HQrE9tulvFWL7BcNIrMSLIqRCYG2oURkEGv/lKfO4EFUyM68+sO5mxBmvVCxqrNlUJ1o/mPtrSEni6ocaHL85TNI53A1WBXBy6kxNbt7z0wX/dbizffjKAMjI334f26e0zicmwnlcrMja02FwswTUfFWx9hg2U7TFpP0z65TcTSMvdrVwLSejDQkn0Byslyjt63X5CQUNDtHQ/pncSR6t4IL22FA5jJ1h6LOrD9NzEaPOV+vVrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J+H8DwENEdc4k729TitBLMXkhK27VijOAB9qbUdAwkI=; b=TzZaxU9VQlDc/Z9iQ0qEzGhqoKBMnp6Gilo0NSPXitjZ7eOWvqnCiTiYcLw++gGsKkjqZ5LQNEHJ/fYJQwJIM/y44BBhNvxaMiYoqDQF3m918tH4wWYtUEqsBxAg/cNqwMxSuxn3IWj8lcufM0c643G4G+ffyxjPOAWfM27cNpuITKTa18G+znA9PUPG+vWwv7WJgAgNqWFbpChUTbUT0TaZ5rSAfYDs54D1jyBJflLnKl4D01WP8Un4lqUxm92IrgHwGWiJdVJa2dZnSnx/QY8Vuzs+BkceIi+chxWrsdqVD79x5zUeATVWdqYFXXhWRqzvG8em7uModqC4ZAbnGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=suse.com; Received: from SN1PR18MB2237.namprd18.prod.outlook.com (2603:10b6:802:24::17) by SA0PR18MB3679.namprd18.prod.outlook.com (2603:10b6:806:97::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19; Fri, 12 Jun 2020 10:05:18 +0000 Received: from SN1PR18MB2237.namprd18.prod.outlook.com ([fe80::29e9:11:e0eb:f96e]) by SN1PR18MB2237.namprd18.prod.outlook.com ([fe80::29e9:11:e0eb:f96e%3]) with mapi id 15.20.3066.023; Fri, 12 Jun 2020 10:05:18 +0000 From: "Gary Lin" To: CC: Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [RFC PATCH 1/1] OvmfPkg: Introduce LSI 53C895A SCSI Controller Driver Date: Fri, 12 Jun 2020 18:04:51 +0800 Message-ID: <20200612100451.12832-1-glin@suse.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: AM0P190CA0025.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::35) To SN1PR18MB2237.namprd18.prod.outlook.com (2603:10b6:802:24::17) Return-Path: GLin@suse.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from GaryWorkstation.suse.cz (60.251.47.115) by AM0P190CA0025.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Fri, 12 Jun 2020 10:05:15 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [60.251.47.115] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14a316c4-b39e-4040-1926-08d80eb81bce X-MS-TrafficTypeDiagnostic: SA0PR18MB3679: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /mcL4X5G+fDU6vs5lZoxOGRj+jEWmzgaxYHZygov/v6aw+P+9lE/MJUHyBMiDcPtYfOKeiKYxH7T4vIYP+RPdLIyu2karKYtKs4BwTwlB784ulu/+fmw5qyJaPdl9xNWfGpZG2r+M0XhH6v5ls2kb1A2Ykmm0UbA+d9oICw4l+HGOklejV/rj5ybYnYe45HEWzQ1vUjGNFBxiS/iurKfjXHHdajgpy35p5wvMs9zrpACTT81JhWZ5fpxP8OkY4nI7S65itkZT/sM1SAqwxWWc+tBrrHyaLxXiH4saBRM42LQyuxnzjUvVzaNR/Dpax5oLN9btSx/wDj1NsdEiYKFrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN1PR18MB2237.namprd18.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(36756003)(6916009)(316002)(54906003)(86362001)(6512007)(6486002)(66476007)(66556008)(66946007)(5660300002)(19627235002)(4326008)(478600001)(956004)(2616005)(83380400001)(30864003)(2906002)(8676002)(6666004)(8936002)(6506007)(55236004)(52116002)(186003)(26005)(1076003)(16526019)(579004)(559001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PBADY2+sqtml2ixFOoQpW5PQnxIiW5B4vqcGT2mQTdl/ejnHV1N3VEoe0S46LXioFcrNowweuYyGcStrB9AnIN1brs98EBravZcfkw99UFqRvggp8oyPTcx0JvR5uEQrBgjZUEvNsXfbrExEoO9fBzo835XEFLGZnkBV0sbMevMjqO2tCYuJKxtvboYN92ELpewtGIyE11OMUMThmuEbdzSMgevM6qvXVJ0fHpJZMuaOIeXjdLOrtmvHnIk5X+lY53Ff7IMm0yu0vv1mr86Nkr4u212eP9jQaV12/k2lKNv1BnQb/MYmSjhcC1Un0EmxEoxgg+P1APLG+wQmYlpCtLtw8DF9zR2+VDkaUJkokPLEW8yPdsysuPTIw2+UcYZe7DgrCGM9u+rlaw8aBdE+7VebEn4Sqh8CTA/njbsBMlICEVh4L+W2kLxlHa0j5y/795ji8LrC/kQ77ht63B77aRFIC8O8fhGgqVmhntwrgCY= X-MS-Exchange-CrossTenant-Network-Message-Id: 14a316c4-b39e-4040-1926-08d80eb81bce X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 10:05:18.5823 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sdytf8JpgsuuA/Ej5fZUekdJyO9COHRxqNjvPD2VfoF/CsJfmOyWH4TGHGFaQNQG X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR18MB3679 X-OriginatorOrg: suse.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This commit introduces the driver for LSI 53C895A SCSI Controller which, so that OVMF can access the devices attached to the emulated "lsi" SCSI controller. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Gary Lin --- Although lsi is now considered obsolete in QEMU, I wrote this driver mainly for learning the UEFI SCSI driver and ... FUN! The majority of the code is actually borrowed from VirtioScsci and MptScsi, and I mainly focus on LsiScsiPassThru(). If it's fine to add this driver into OvmfPkg, I'll start to split this patch into smaller pieces to make it easier to review. =20 --- OvmfPkg/Include/IndustryStandard/LsiScsi.h | 80 ++ OvmfPkg/LsiScsiDxe/LsiScsi.c | 1120 ++++++++++++++++++++ OvmfPkg/LsiScsiDxe/LsiScsi.h | 199 ++++ OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf | 45 + OvmfPkg/OvmfPkg.dec | 9 + OvmfPkg/OvmfPkgIa32.dsc | 4 + OvmfPkg/OvmfPkgIa32.fdf | 3 + OvmfPkg/OvmfPkgIa32X64.dsc | 4 + OvmfPkg/OvmfPkgIa32X64.fdf | 3 + OvmfPkg/OvmfPkgX64.dsc | 4 + OvmfPkg/OvmfPkgX64.fdf | 3 + 11 files changed, 1474 insertions(+) create mode 100644 OvmfPkg/Include/IndustryStandard/LsiScsi.h create mode 100644 OvmfPkg/LsiScsiDxe/LsiScsi.c create mode 100644 OvmfPkg/LsiScsiDxe/LsiScsi.h create mode 100644 OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf diff --git a/OvmfPkg/Include/IndustryStandard/LsiScsi.h b/OvmfPkg/Include/I= ndustryStandard/LsiScsi.h new file mode 100644 index 000000000000..cbf049c18310 --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/LsiScsi.h @@ -0,0 +1,80 @@ +/** @file=0D +=0D + Macros and type definitions for LSI 53C895A SCSI devices.=0D +=0D + Copyright (C) 2020, SUSE LLC.=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef _LSI_SCSI_H_=0D +#define _LSI_SCSI_H_=0D +=0D +//=0D +// Device ID=0D +//=0D +#define LSI_LOGIC_PCI_VENDOR_ID 0x1000=0D +#define LSI_53C895A_PCI_DEVICE_ID 0x0012=0D +=0D +//=0D +// LSI 53C895A Registers=0D +//=0D +#define LSI_REG_DSTAT 0x0C=0D +#define LSI_REG_ISTAT0 0x14=0D +#define LSI_REG_DSP 0x2C=0D +#define LSI_REG_SIST0 0x42=0D +#define LSI_REG_SIST1 0x43=0D +=0D +//=0D +// The status bits for DMA Status (DSTAT)=0D +//=0D +#define LSI_DSTAT_IID 0x01=0D +#define LSI_DSTAT_R 0x02=0D +#define LSI_DSTAT_SIR 0x04=0D +#define LSI_DSTAT_SSI 0x08=0D +#define LSI_DSTAT_ABRT 0x10=0D +#define LSI_DSTAT_BF 0x20=0D +#define LSI_DSTAT_MDPE 0x40=0D +#define LSI_DSTAT_DFE 0x80=0D +=0D +//=0D +// The status bits for Interrupt Status Zero (ISTAT0)=0D +//=0D +#define LSI_ISTAT0_DIP 0x01=0D +#define LSI_ISTAT0_SIP 0x02=0D +#define LSI_ISTAT0_INTF 0x04=0D +#define LSI_ISTAT0_CON 0x08=0D +#define LSI_ISTAT0_SEM 0x10=0D +#define LSI_ISTAT0_SIGP 0x20=0D +#define LSI_ISTAT0_SRST 0x40=0D +#define LSI_ISTAT0_ABRT 0x80=0D +=0D +//=0D +// LSI 53C895A Script Instructions=0D +//=0D +#define LSI_INS_TYPE_BLK 0x00000000=0D +#define LSI_INS_TYPE_IO 0x40000000=0D +#define LSI_INS_TYPE_TC 0x80000000=0D +=0D +#define LSI_INS_BLK_SCSIP_DAT_OUT 0x00000000=0D +#define LSI_INS_BLK_SCSIP_DAT_IN 0x01000000=0D +#define LSI_INS_BLK_SCSIP_CMD 0x02000000=0D +#define LSI_INS_BLK_SCSIP_STAT 0x03000000=0D +#define LSI_INS_BLK_SCSIP_MSG_OUT 0x06000000=0D +#define LSI_INS_BLK_SCSIP_MSG_IN 0x07000000=0D +=0D +#define LSI_INS_IO_OPC_SEL 0x00000000=0D +#define LSI_INS_IO_OPC_WAIT_RESEL 0x10000000=0D +=0D +#define LSI_INS_TC_CP 0x00020000=0D +#define LSI_INS_TC_JMP 0x00080000=0D +#define LSI_INS_TC_RA 0x00800000=0D +=0D +#define LSI_INS_TC_OPC_JMP 0x00000000=0D +#define LSI_INS_TC_OPC_INT 0x18000000=0D +=0D +#define LSI_INS_TC_SCSIP_DAT_OUT 0x00000000=0D +#define LSI_INS_TC_SCSIP_MSG_IN 0x07000000=0D +=0D +#endif // _LSI_SCSI_H_=0D diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.c b/OvmfPkg/LsiScsiDxe/LsiScsi.c new file mode 100644 index 000000000000..a226a0e789da --- /dev/null +++ b/OvmfPkg/LsiScsiDxe/LsiScsi.c @@ -0,0 +1,1120 @@ +/** @file=0D +=0D + This driver produces Extended SCSI Pass Thru Protocol instances for=0D + LSI 53C895A SCSI devices.=0D +=0D + Copyright (C) 2020, SUSE LLC.=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include "LsiScsi.h"=0D +=0D +STATIC=0D +EFI_STATUS=0D +Out8 (=0D + IN LSI_SCSI_DEV *Dev,=0D + IN UINT32 Addr,=0D + IN UINT8 Data=0D + )=0D +{=0D + return Dev->PciIo->Io.Write (=0D + Dev->PciIo,=0D + EfiPciIoWidthUint8,=0D + PCI_BAR_IDX0,=0D + Addr,=0D + 1,=0D + &Data=0D + );=0D +}=0D +=0D +STATIC=0D +EFI_STATUS=0D +Out32 (=0D + IN LSI_SCSI_DEV *Dev,=0D + IN UINT32 Addr,=0D + IN UINT32 Data=0D + )=0D +{=0D + return Dev->PciIo->Io.Write (=0D + Dev->PciIo,=0D + EfiPciIoWidthUint32,=0D + PCI_BAR_IDX0,=0D + Addr,=0D + 1,=0D + &Data=0D + );=0D +}=0D +=0D +STATIC=0D +EFI_STATUS=0D +In8 (=0D + IN LSI_SCSI_DEV *Dev,=0D + IN UINT32 Addr,=0D + OUT UINT8 *Data=0D + )=0D +{=0D + return Dev->PciIo->Io.Read (=0D + Dev->PciIo,=0D + EfiPciIoWidthUint8,=0D + PCI_BAR_IDX0,=0D + Addr,=0D + 1,=0D + Data=0D + );=0D +}=0D +=0D +STATIC=0D +EFI_STATUS=0D +LsiScsiReset (=0D + IN LSI_SCSI_DEV *Dev=0D + )=0D +{=0D + return Out8 (Dev, LSI_REG_ISTAT0, LSI_ISTAT0_SRST);=0D +}=0D +=0D +STATIC=0D +EFI_STATUS=0D +ReportHostAdapterOverrunError (=0D + OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet=0D + )=0D +{=0D + Packet->SenseDataLength =3D 0;=0D + Packet->HostAdapterStatus =3D=0D + EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;=0D + Packet->TargetStatus =3D EFI_EXT_SCSI_STATUS_TARGET_GOOD;=0D + return EFI_BAD_BUFFER_SIZE;=0D +}=0D +=0D +/**=0D +=0D + Check the request packet from the Extended SCSI Pass Thru Protocol. The= =0D + request packet is modified, to be forwarded outwards by LsiScsiPassThru(= ),=0D + if invalid or unsupported parameters are detected.=0D +=0D + @param[in] Dev The LSI 53C895A SCSI device the packet targets.= =0D +=0D + @param[in] Target The SCSI target controlled by the LSI 53C895A SC= SI=0D + device.=0D +=0D + @param[in] Lun The Logical Unit Number under the SCSI target.=0D +=0D + @param[in out] Packet The Extended SCSI Pass Thru Protocol packet.=0D +=0D +=0D + @retval EFI_SUCCESS The Extended SCSI Pass Thru Protocol packet was val= id.=0D +=0D + @return Otherwise, invalid or unsupported parameters were=0D + detected. Status codes are meant for direct forward= ing=0D + by the EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru()=0D + implementation.=0D +=0D + **/=0D +STATIC=0D +EFI_STATUS=0D +LsiScsiCheckRequest (=0D + IN LSI_SCSI_DEV *Dev,=0D + IN UINT8 Target,=0D + IN UINT64 Lun,=0D + IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet=0D + )=0D +{=0D + if (Target > Dev->MaxTarget || Lun > Dev->MaxLun ||=0D + Packet->DataDirection > EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL ||= =0D + //=0D + // Trying to receive, but destination pointer is NULL, or contradict= ing=0D + // transfer direction=0D + //=0D + (Packet->InTransferLength > 0 &&=0D + (Packet->InDataBuffer =3D=3D NULL ||=0D + Packet->DataDirection =3D=3D EFI_EXT_SCSI_DATA_DIRECTION_WRITE=0D + )=0D + ) ||=0D +=0D + //=0D + // Trying to send, but source pointer is NULL, or contradicting tran= sfer=0D + // direction=0D + //=0D + (Packet->OutTransferLength > 0 &&=0D + (Packet->OutDataBuffer =3D=3D NULL ||=0D + Packet->DataDirection =3D=3D EFI_EXT_SCSI_DATA_DIRECTION_READ=0D + )=0D + )=0D + ) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + if (Packet->DataDirection =3D=3D EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTION= AL ||=0D + (Packet->InTransferLength > 0 && Packet->OutTransferLength > 0) ||=0D + Packet->CdbLength > sizeof Dev->Dma->Cdb) {=0D + return EFI_UNSUPPORTED;=0D + }=0D +=0D + if (Packet->InTransferLength > sizeof Dev->Dma->Data) {=0D + Packet->InTransferLength =3D sizeof Dev->Dma->Data;=0D + return ReportHostAdapterOverrunError (Packet);=0D + }=0D + if (Packet->OutTransferLength > sizeof Dev->Dma->Data) {=0D + Packet->OutTransferLength =3D sizeof Dev->Dma->Data;=0D + return ReportHostAdapterOverrunError (Packet);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D +=0D + Interpret the request packet from the Extended SCSI Pass Thru Protocol a= nd=0D + compose the script to submit the command and data to the contorller.=0D +=0D + @param[in] Dev The LSI 53C895A SCSI device the packet targets.= =0D +=0D + @param[in] Target The SCSI target controlled by the LSI 53C895A SC= SI=0D + device.=0D +=0D + @param[in] Lun The Logical Unit Number under the SCSI target.=0D +=0D + @param[in out] Packet The Extended SCSI Pass Thru Protocol packet.=0D +=0D +=0D + @retval EFI_SUCCESS The Extended SCSI Pass Thru Protocol packet was val= id.=0D +=0D + @return Otherwise, invalid or unsupported parameters were=0D + detected. Status codes are meant for direct forward= ing=0D + by the EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru()=0D + implementation.=0D +=0D + **/=0D +STATIC=0D +EFI_STATUS=0D +LsiScsiProcessRequest (=0D + IN LSI_SCSI_DEV *Dev,=0D + IN UINT8 Target,=0D + IN UINT64 Lun,=0D + IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet=0D + )=0D +{=0D + EFI_STATUS Status;=0D + UINT32 *Script;=0D + UINT8 *Cdb;=0D + UINT8 *MsgOut;=0D + UINT8 *MsgIn;=0D + UINT8 *ScsiStatus;=0D + UINT8 *Data;=0D + UINT8 DStat;=0D + UINT8 SIst0;=0D + UINT8 SIst1;=0D +=0D + Script =3D Dev->Dma->Script;=0D + Cdb =3D Dev->Dma->Cdb;=0D + Data =3D Dev->Dma->Data;=0D + MsgIn =3D Dev->Dma->MsgIn;=0D + MsgOut =3D &Dev->Dma->MsgOut;=0D + ScsiStatus =3D &Dev->Dma->Status;=0D +=0D + *ScsiStatus =3D 0xFF;=0D +=0D + SetMem (Cdb, sizeof Dev->Dma->Cdb, 0x00);=0D + CopyMem (Cdb, Packet->Cdb, Packet->CdbLength);=0D +=0D + //=0D + // Compose the script to transfer data between the host and the device.= =0D + //=0D + // Reference:=0D + // LSI53C895A PCI to Ultra2 SCSI Controller Version 2.2=0D + // - Chapter 5 SCSI SCRIPT Instruction Set=0D + //=0D + // All instructions used here consist of 2 32bit words. The first word=0D + // contains the command to execute. The second word is loaded into the=0D + // DMA SCRIPTS Pointer Save (DSPS) register as either the DMA address=0D + // for data transmission or the address/offset for the jump command.=0D + // Some commands, such as the selection of the target, don't need to=0D + // transfer data through DMA or jump to another instruction, then DSPS=0D + // has to be zero.=0D + //=0D + // The controller starts to execute the script once the DMA Script=0D + // Pointer (DSP) register is set.=0D + //=0D + SetMem (Script, sizeof Dev->Dma->Script, 0x00);=0D +=0D + //=0D + // Select target.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_IO | LSI_INS_IO_OPC_SEL | (UINT32)Target << 1= 6;=0D + *Script++ =3D 0x00000000;=0D +=0D + //=0D + // Select lun.=0D + //=0D + *MsgOut =3D 0x80 | (UINT8) Lun; // 0x80: Identify bit=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_MSG_OUT | \=0D + sizeof Dev->Dma->MsgOut;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, MsgOut);=0D +=0D + //=0D + // Send the SCSI Command.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_CMD | \=0D + sizeof Dev->Dma->Cdb;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, Cdb);=0D +=0D + //=0D + // Handle disconnect=0D + //=0D + // Check whether the current SCSI phase is "Message In" or not.=0D + // If not, try to enter the "Message In" phase to reconnect to the=0D + // device.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_TC | LSI_INS_TC_OPC_JMP | \=0D + LSI_INS_TC_SCSIP_MSG_IN | LSI_INS_TC_RA | \=0D + LSI_INS_TC_CP;=0D + *Script++ =3D 0x00000018;=0D + //=0D + // Read "Message" from the initiator to trigger reselect.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_MSG_IN | \=0D + sizeof Dev->Dma->MsgIn;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, MsgIn);=0D + //=0D + // Wait reselect.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_IO | LSI_INS_IO_OPC_WAIT_RESEL;=0D + *Script++ =3D 0x00000000;=0D + //=0D + // Read "Message" from the initiator again.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_MSG_IN | \=0D + sizeof Dev->Dma->MsgIn;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, MsgIn);=0D +=0D + //=0D + // Set the DMA command for the read/write operations.=0D + //=0D + if (Packet->DataDirection =3D=3D EFI_EXT_SCSI_DATA_DIRECTION_READ &&=0D + Packet->InTransferLength > 0) {=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_DAT_IN | \=0D + Packet->InTransferLength;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, Data);=0D + } else if (Packet->DataDirection =3D=3D EFI_EXT_SCSI_DATA_DIRECTION_WRIT= E &&=0D + Packet->OutTransferLength > 0) {=0D + // LsiScsiCheckRequest() guarantees that OutTransferLength is no=0D + // larger than sizeof Dev->Dma->Data, so we can safely copy the=0D + // the data to Dev->Dma->Data.=0D + CopyMem (Data, Packet->OutDataBuffer, Packet->OutTransferLength);=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_DAT_OUT | \=0D + Packet->OutTransferLength;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, Data);=0D + }=0D +=0D + //=0D + // Get the SCSI status.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_STAT | \=0D + sizeof Dev->Dma->Status;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, Status);=0D +=0D + //=0D + // Get the SCSI message.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_BLK | LSI_INS_BLK_SCSIP_MSG_IN | \=0D + sizeof Dev->Dma->MsgIn;=0D + *Script++ =3D LSI_SCSI_DMA_ADDR_LOW (Dev, MsgIn);=0D +=0D + //=0D + // Raise the interrupt to end the script.=0D + //=0D + *Script++ =3D LSI_INS_TYPE_TC | LSI_INS_TC_OPC_INT | \=0D + LSI_INS_TC_SCSIP_DAT_OUT | LSI_INS_TC_JMP;=0D + *Script++ =3D 0x00000000;=0D +=0D + //=0D + // Make sure the script doesn't exceed the size.=0D + //=0D + ASSERT (Script < Dev->Dma->Script + sizeof Dev->Dma->Script);=0D +=0D + //=0D + // Execute the script.=0D + //=0D + Status =3D Out32 (Dev, LSI_REG_DSP, LSI_SCSI_DMA_ADDR_LOW(Dev, Script));= =0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + //=0D + // Poll the device registers (DSTAT, SIST0, and SIST1) until the SIR=0D + // bit sets.=0D + //=0D + for(;;) {=0D + Status =3D In8 (Dev, LSI_REG_DSTAT, &DStat);=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D + Status =3D In8 (Dev, LSI_REG_SIST0, &SIst0);=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D + Status =3D In8 (Dev, LSI_REG_SIST1, &SIst1);=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D +=0D + if (SIst0 !=3D 0 || SIst1 !=3D 0) {=0D + goto Error;=0D + }=0D +=0D + //=0D + // Check the SIR (SCRIPTS Interrupt Instruction Received) bit.=0D + //=0D + if (DStat & LSI_DSTAT_SIR) {=0D + break;=0D + }=0D +=0D + gBS->Stall (Dev->StallPerPollUsec);=0D + }=0D +=0D + //=0D + // Check if everything is good.=0D + // SCSI Message Code 0x00: COMMAND COMPLETE=0D + // SCSI Status Code 0x00: Good=0D + //=0D + if (MsgIn[0] =3D=3D 0 && *ScsiStatus =3D=3D 0) {=0D + //=0D + // Copy Data to InDataBuffer if necessary.=0D + //=0D + if (Packet->DataDirection =3D=3D EFI_EXT_SCSI_DATA_DIRECTION_READ) {=0D + CopyMem (Packet->InDataBuffer, Data, Packet->InTransferLength);=0D + }=0D +=0D + //=0D + // The controller doesn't return sense data when replying "TEST UNIT R= EADY",=0D + // so we have to set SenseDataLength to 0 to notify ScsiIo to issue=0D + // "REQUEST SENSE" for the sense data.=0D + //=0D + if (Cdb[0] =3D=3D 0x00) {=0D + Packet->SenseDataLength =3D 0;=0D + }=0D + Packet->HostAdapterStatus =3D EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;=0D + Packet->TargetStatus =3D EFI_EXT_SCSI_STATUS_TARGET_GOOD;=0D +=0D + return EFI_SUCCESS;=0D + }=0D +=0D +Error:=0D + DEBUG((DEBUG_VERBOSE, "%a: dstat: %02X, sist0: %02X, sist1: %02X\n",=0D + __FUNCTION__, DStat, SIst0, SIst1));=0D + //=0D + // Update the request packet to reflect the status.=0D + //=0D + if (*ScsiStatus !=3D 0xFF) {=0D + Packet->TargetStatus =3D *ScsiStatus;=0D + } else {=0D + Packet->TargetStatus =3D EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED;=0D + }=0D + Packet->HostAdapterStatus =3D EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER;=0D + Packet->InTransferLength =3D 0;=0D + Packet->OutTransferLength =3D 0;=0D + Packet->SenseDataLength =3D 0;=0D +=0D + return EFI_DEVICE_ERROR;=0D +}=0D +=0D +//=0D +// The next seven functions implement EFI_EXT_SCSI_PASS_THRU_PROTOCOL=0D +// for the LSI 53C895A SCSI Controller. Refer to UEFI Spec 2.3.1 + Errata = C,=0D +// sections=0D +// - 14.1 SCSI Driver Model Overview,=0D +// - 14.7 Extended SCSI Pass Thru Protocol.=0D +//=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiPassThru (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN UINT8 *Target,=0D + IN UINT64 Lun,=0D + IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,=0D + IN EFI_EVENT Event OPTIONAL=0D + )=0D +{=0D + EFI_STATUS Status;=0D + LSI_SCSI_DEV *Dev;=0D +=0D + Dev =3D LSI_SCSI_FROM_PASS_THRU (This);=0D + Status =3D LsiScsiCheckRequest (Dev, *Target, Lun, Packet);=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + Status =3D LsiScsiProcessRequest (Dev, *Target, Lun, Packet);=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetNextTargetLun (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN OUT UINT8 **TargetPointer,=0D + IN OUT UINT64 *Lun=0D + )=0D +{=0D + LSI_SCSI_DEV *Dev;=0D + UINTN Idx;=0D + UINT8 *Target;=0D + UINT16 LastTarget;=0D +=0D + //=0D + // the TargetPointer input parameter is unnecessarily a pointer-to-point= er=0D + //=0D + Target =3D *TargetPointer;=0D +=0D + //=0D + // Search for first non-0xFF byte. If not found, return first target & L= UN.=0D + //=0D + for (Idx =3D 0; Idx < TARGET_MAX_BYTES && Target[Idx] =3D=3D 0xFF; ++Idx= )=0D + ;=0D + if (Idx =3D=3D TARGET_MAX_BYTES) {=0D + SetMem (Target, TARGET_MAX_BYTES, 0x00);=0D + *Lun =3D 0;=0D + return EFI_SUCCESS;=0D + }=0D +=0D + CopyMem (&LastTarget, Target, sizeof LastTarget);=0D +=0D + //=0D + // increment (target, LUN) pair if valid on input=0D + //=0D + Dev =3D LSI_SCSI_FROM_PASS_THRU (This);=0D + if (LastTarget > Dev->MaxTarget || *Lun > Dev->MaxLun) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + if (*Lun < Dev->MaxLun) {=0D + ++*Lun;=0D + return EFI_SUCCESS;=0D + }=0D +=0D + if (LastTarget < Dev->MaxTarget) {=0D + *Lun =3D 0;=0D + ++LastTarget;=0D + CopyMem (Target, &LastTarget, sizeof LastTarget);=0D + return EFI_SUCCESS;=0D + }=0D +=0D + return EFI_NOT_FOUND;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiBuildDevicePath (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN UINT8 *Target,=0D + IN UINT64 Lun,=0D + IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath=0D + )=0D +{=0D + UINT16 TargetValue;=0D + LSI_SCSI_DEV *Dev;=0D + SCSI_DEVICE_PATH *ScsiDevicePath;=0D +=0D + if (DevicePath =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + CopyMem (&TargetValue, Target, sizeof TargetValue);=0D + Dev =3D LSI_SCSI_FROM_PASS_THRU (This);=0D + if (TargetValue > Dev->MaxTarget || Lun > Dev->MaxLun || Lun > 0xFFFF) {= =0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + ScsiDevicePath =3D AllocatePool (sizeof *ScsiDevicePath);=0D + if (ScsiDevicePath =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D +=0D + ScsiDevicePath->Header.Type =3D MESSAGING_DEVICE_PATH;=0D + ScsiDevicePath->Header.SubType =3D MSG_SCSI_DP;=0D + ScsiDevicePath->Header.Length[0] =3D (UINT8) sizeof *ScsiDevicePath;=0D + ScsiDevicePath->Header.Length[1] =3D (UINT8) (sizeof *ScsiDevicePath >> = 8);=0D + ScsiDevicePath->Pun =3D TargetValue;=0D + ScsiDevicePath->Lun =3D (UINT16) Lun;=0D +=0D + *DevicePath =3D &ScsiDevicePath->Header;=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetTargetLun (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,=0D + OUT UINT8 **TargetPointer,=0D + OUT UINT64 *Lun=0D + )=0D +{=0D + SCSI_DEVICE_PATH *ScsiDevicePath;=0D + LSI_SCSI_DEV *Dev;=0D + UINT8 *Target;=0D +=0D + if (DevicePath =3D=3D NULL || TargetPointer =3D=3D NULL || *TargetPointe= r =3D=3D NULL ||=0D + Lun =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + if (DevicePath->Type !=3D MESSAGING_DEVICE_PATH ||=0D + DevicePath->SubType !=3D MSG_SCSI_DP) {=0D + return EFI_UNSUPPORTED;=0D + }=0D +=0D + ScsiDevicePath =3D (SCSI_DEVICE_PATH *) DevicePath;=0D + Dev =3D LSI_SCSI_FROM_PASS_THRU (This);=0D + if (ScsiDevicePath->Pun > Dev->MaxTarget ||=0D + ScsiDevicePath->Lun > Dev->MaxLun) {=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + //=0D + // This device support 8 targets only, so it's enough to set the LSB=0D + // of Target.=0D + //=0D + Target =3D *TargetPointer;=0D + *Target =3D (UINT8)ScsiDevicePath->Pun;=0D + *Lun =3D ScsiDevicePath->Lun;=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiResetChannel (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiResetTargetLun (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN UINT8 *Target,=0D + IN UINT64 Lun=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetNextTarget (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN OUT UINT8 **TargetPointer=0D + )=0D +{=0D + LSI_SCSI_DEV *Dev;=0D + UINTN Idx;=0D + UINT8 *Target;=0D + UINT16 LastTarget;=0D +=0D + //=0D + // the TargetPointer input parameter is unnecessarily a pointer-to-point= er=0D + //=0D + Target =3D *TargetPointer;=0D +=0D + //=0D + // Search for first non-0xFF byte. If not found, return first target.=0D + //=0D + for (Idx =3D 0; Idx < TARGET_MAX_BYTES && Target[Idx] =3D=3D 0xFF; ++Idx= )=0D + ;=0D + if (Idx =3D=3D TARGET_MAX_BYTES) {=0D + SetMem (Target, TARGET_MAX_BYTES, 0x00);=0D + return EFI_SUCCESS;=0D + }=0D +=0D + CopyMem (&LastTarget, Target, sizeof LastTarget);=0D +=0D + //=0D + // increment target if valid on input=0D + //=0D + Dev =3D LSI_SCSI_FROM_PASS_THRU (This);=0D + if (LastTarget > Dev->MaxTarget) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + if (LastTarget < Dev->MaxTarget) {=0D + ++LastTarget;=0D + CopyMem (Target, &LastTarget, sizeof LastTarget);=0D + return EFI_SUCCESS;=0D + }=0D +=0D + return EFI_NOT_FOUND;=0D +}=0D +=0D +STATIC=0D +VOID=0D +EFIAPI=0D +LsiScsiExitBoot (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + )=0D +{=0D + LSI_SCSI_DEV *Dev;=0D +=0D + Dev =3D Context;=0D + DEBUG ((DEBUG_VERBOSE, "%a: Context=3D0x%p\n", __FUNCTION__, Context));= =0D + LsiScsiReset (Dev);=0D +}=0D +=0D +//=0D +// Probe, start and stop functions of this driver, called by the DXE core = for=0D +// specific devices.=0D +//=0D +// The following specifications document these interfaces:=0D +// - Driver Writer's Guide for UEFI 2.3.1 v1.01, 9 Driver Binding Protocol= =0D +// - UEFI Spec 2.3.1 + Errata C, 10.1 EFI Driver Binding Protocol=0D +//=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiControllerSupported (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_PCI_IO_PROTOCOL *PciIo;=0D + PCI_TYPE00 Pci;=0D +=0D + Status =3D gBS->OpenProtocol (=0D + ControllerHandle,=0D + &gEfiPciIoProtocolGuid,=0D + (VOID **)&PciIo,=0D + This->DriverBindingHandle,=0D + ControllerHandle,=0D + EFI_OPEN_PROTOCOL_BY_DRIVER=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + Status =3D PciIo->Pci.Read (=0D + PciIo,=0D + EfiPciIoWidthUint32,=0D + 0,=0D + sizeof (Pci) / sizeof (UINT32),=0D + &Pci=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto Done;=0D + }=0D +=0D + if (Pci.Hdr.VendorId =3D=3D LSI_LOGIC_PCI_VENDOR_ID &&=0D + Pci.Hdr.DeviceId =3D=3D LSI_53C895A_PCI_DEVICE_ID) {=0D + Status =3D EFI_SUCCESS;=0D + } else {=0D + Status =3D EFI_UNSUPPORTED;=0D + }=0D +=0D +Done:=0D + gBS->CloseProtocol (=0D + ControllerHandle,=0D + &gEfiPciIoProtocolGuid,=0D + This->DriverBindingHandle,=0D + ControllerHandle=0D + );=0D + return Status;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiControllerStart (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL=0D + )=0D +{=0D + EFI_STATUS Status;=0D + LSI_SCSI_DEV *Dev;=0D + UINTN Pages;=0D + UINTN BytesMapped;=0D +=0D + Dev =3D AllocateZeroPool (sizeof (*Dev));=0D + if (Dev =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D +=0D + Dev->Signature =3D LSI_SCSI_DEV_SIGNATURE;=0D +=0D + Dev->MaxTarget =3D PcdGet8 (PcdLsiScsiMaxTargetLimit);=0D + Dev->MaxLun =3D PcdGet8 (PcdLsiScsiMaxLunLimit);=0D + Dev->StallPerPollUsec =3D PcdGet32 (PcdLsiScsiStallPerPollUsec);=0D +=0D + Status =3D gBS->OpenProtocol (=0D + ControllerHandle,=0D + &gEfiPciIoProtocolGuid,=0D + (VOID **)&Dev->PciIo,=0D + This->DriverBindingHandle,=0D + ControllerHandle,=0D + EFI_OPEN_PROTOCOL_BY_DRIVER=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto FreePool;=0D + }=0D +=0D + Status =3D Dev->PciIo->Attributes (=0D + Dev->PciIo,=0D + EfiPciIoAttributeOperationGet,=0D + 0,=0D + &Dev->OrigPciAttrs=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto CloseProtocol;=0D + }=0D +=0D + //=0D + // Enable I/O Space & Bus-Mastering=0D + //=0D + Status =3D Dev->PciIo->Attributes (=0D + Dev->PciIo,=0D + EfiPciIoAttributeOperationEnable,=0D + (EFI_PCI_IO_ATTRIBUTE_IO |=0D + EFI_PCI_IO_ATTRIBUTE_BUS_MASTER),=0D + NULL=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto CloseProtocol;=0D + }=0D +=0D + //=0D + // Signal device supports 64-bit DMA addresses=0D + //=0D + Status =3D Dev->PciIo->Attributes (=0D + Dev->PciIo,=0D + EfiPciIoAttributeOperationEnable,=0D + EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE,=0D + NULL=0D + );=0D + if (EFI_ERROR (Status)) {=0D + //=0D + // Warn user that device will only be using 32-bit DMA addresses.=0D + //=0D + // Note that this does not prevent the device/driver from working=0D + // and therefore we only warn and continue as usual.=0D + //=0D + DEBUG ((=0D + DEBUG_WARN,=0D + "%a: failed to enable 64-bit DMA addresses\n",=0D + __FUNCTION__=0D + ));=0D + }=0D +=0D + //=0D + // Create buffers for data transfer=0D + //=0D + Pages =3D EFI_SIZE_TO_PAGES (sizeof (*Dev->Dma));=0D + Status =3D Dev->PciIo->AllocateBuffer (=0D + Dev->PciIo,=0D + AllocateAnyPages,=0D + EfiBootServicesData,=0D + Pages,=0D + (VOID **)&Dev->Dma,=0D + EFI_PCI_ATTRIBUTE_MEMORY_CACHED=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto RestoreAttributes;=0D + }=0D +=0D + BytesMapped =3D EFI_PAGES_TO_SIZE (Pages);=0D + Status =3D Dev->PciIo->Map (=0D + Dev->PciIo,=0D + EfiPciIoOperationBusMasterCommonBuffer,=0D + Dev->Dma,=0D + &BytesMapped,=0D + &Dev->DmaPhysical,=0D + &Dev->DmaMapping=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto FreeBuffer;=0D + }=0D +=0D + if (BytesMapped !=3D EFI_PAGES_TO_SIZE (Pages)) {=0D + Status =3D EFI_OUT_OF_RESOURCES;=0D + goto Unmap;=0D + }=0D +=0D + Status =3D LsiScsiReset (Dev);=0D + if (EFI_ERROR (Status)) {=0D + goto Unmap;=0D + }=0D +=0D + Status =3D gBS->CreateEvent (=0D + EVT_SIGNAL_EXIT_BOOT_SERVICES,=0D + TPL_CALLBACK,=0D + &LsiScsiExitBoot,=0D + Dev,=0D + &Dev->ExitBoot=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto UninitDev;=0D + }=0D +=0D + //=0D + // Host adapter channel, doesn't exist=0D + //=0D + Dev->PassThruMode.AdapterId =3D MAX_UINT32;=0D + Dev->PassThruMode.Attributes =3D=0D + EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL |=0D + EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL;=0D +=0D + Dev->PassThru.Mode =3D &Dev->PassThruMode;=0D + Dev->PassThru.PassThru =3D &LsiScsiPassThru;=0D + Dev->PassThru.GetNextTargetLun =3D &LsiScsiGetNextTargetLun;=0D + Dev->PassThru.BuildDevicePath =3D &LsiScsiBuildDevicePath;=0D + Dev->PassThru.GetTargetLun =3D &LsiScsiGetTargetLun;=0D + Dev->PassThru.ResetChannel =3D &LsiScsiResetChannel;=0D + Dev->PassThru.ResetTargetLun =3D &LsiScsiResetTargetLun;=0D + Dev->PassThru.GetNextTarget =3D &LsiScsiGetNextTarget;=0D +=0D + Status =3D gBS->InstallProtocolInterface (=0D + &ControllerHandle,=0D + &gEfiExtScsiPassThruProtocolGuid,=0D + EFI_NATIVE_INTERFACE,=0D + &Dev->PassThru=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto CloseExitBoot;=0D + }=0D +=0D + return EFI_SUCCESS;=0D +=0D +CloseExitBoot:=0D + gBS->CloseEvent (Dev->ExitBoot);=0D +=0D +UninitDev:=0D + LsiScsiReset (Dev);=0D +=0D +Unmap:=0D + Dev->PciIo->Unmap (=0D + Dev->PciIo,=0D + Dev->DmaMapping=0D + );=0D +=0D +FreeBuffer:=0D + Dev->PciIo->FreeBuffer (=0D + Dev->PciIo,=0D + Pages,=0D + Dev->Dma=0D + );=0D +=0D +RestoreAttributes:=0D + Dev->PciIo->Attributes (=0D + Dev->PciIo,=0D + EfiPciIoAttributeOperationSet,=0D + Dev->OrigPciAttrs,=0D + NULL=0D + );=0D +=0D +CloseProtocol:=0D + gBS->CloseProtocol (=0D + ControllerHandle,=0D + &gEfiPciIoProtocolGuid,=0D + This->DriverBindingHandle,=0D + ControllerHandle=0D + );=0D +=0D +FreePool:=0D + FreePool (Dev);=0D +=0D + return Status;=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiControllerStop (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN UINTN NumberOfChildren,=0D + IN EFI_HANDLE *ChildHandleBuffer=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;=0D + LSI_SCSI_DEV *Dev;=0D +=0D + Status =3D gBS->OpenProtocol (=0D + ControllerHandle,=0D + &gEfiExtScsiPassThruProtocolGuid,=0D + (VOID **)&PassThru,=0D + This->DriverBindingHandle,=0D + ControllerHandle,=0D + EFI_OPEN_PROTOCOL_GET_PROTOCOL // Lookup only=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + Dev =3D LSI_SCSI_FROM_PASS_THRU (PassThru);=0D +=0D + Status =3D gBS->UninstallProtocolInterface (=0D + ControllerHandle,=0D + &gEfiExtScsiPassThruProtocolGuid,=0D + &Dev->PassThru=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + gBS->CloseEvent (Dev->ExitBoot);=0D +=0D + LsiScsiReset (Dev);=0D +=0D + Dev->PciIo->Unmap (=0D + Dev->PciIo,=0D + Dev->DmaMapping=0D + );=0D +=0D + Dev->PciIo->FreeBuffer (=0D + Dev->PciIo,=0D + EFI_SIZE_TO_PAGES (sizeof (*Dev->Dma)),=0D + Dev->Dma=0D + );=0D +=0D + Dev->PciIo->Attributes (=0D + Dev->PciIo,=0D + EfiPciIoAttributeOperationSet,=0D + Dev->OrigPciAttrs,=0D + NULL=0D + );=0D +=0D + gBS->CloseProtocol (=0D + ControllerHandle,=0D + &gEfiPciIoProtocolGuid,=0D + This->DriverBindingHandle,=0D + ControllerHandle=0D + );=0D +=0D + FreePool (Dev);=0D +=0D + return Status;=0D +}=0D +=0D +//=0D +// The static object that groups the Supported() (ie. probe), Start() and= =0D +// Stop() functions of the driver together. Refer to UEFI Spec 2.3.1 + Err= ata=0D +// C, 10.1 EFI Driver Binding Protocol.=0D +//=0D +STATIC=0D +EFI_DRIVER_BINDING_PROTOCOL gDriverBinding =3D {=0D + &LsiScsiControllerSupported,=0D + &LsiScsiControllerStart,=0D + &LsiScsiControllerStop,=0D + 0x10, // Version, must be in [0x10 .. 0xFFFFFFEF] for IHV-developed driv= ers=0D + NULL, // ImageHandle, to be overwritten by=0D + // EfiLibInstallDriverBindingComponentName2() in LsiScsiEntryPoint= ()=0D + NULL // DriverBindingHandle, ditto=0D +};=0D +=0D +=0D +//=0D +// The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL a= nd=0D +// EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's = name=0D +// in English, for display on standard console devices. This is recommende= d for=0D +// UEFI drivers that follow the UEFI Driver Model. Refer to the Driver Wri= ter's=0D +// Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.=0D +//=0D +// Device type names ("LSI 53C895A SCSI Controller") are not formatted bec= ause=0D +// the driver supports only that device type. Therefore the driver name=0D +// suffices for unambiguous identification.=0D +//=0D +=0D +STATIC=0D +EFI_UNICODE_STRING_TABLE mDriverNameTable[] =3D {=0D + { "eng;en", L"LSI 53C895A SCSI Controller Driver" },=0D + { NULL, NULL }=0D +};=0D +=0D +STATIC=0D +EFI_COMPONENT_NAME_PROTOCOL gComponentName;=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetDriverName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **DriverName=0D + )=0D +{=0D + return LookupUnicodeString2 (=0D + Language,=0D + This->SupportedLanguages,=0D + mDriverNameTable,=0D + DriverName,=0D + (BOOLEAN)(This =3D=3D &gComponentName) // Iso639Language=0D + );=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetDeviceName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN EFI_HANDLE DeviceHandle,=0D + IN EFI_HANDLE ChildHandle,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **ControllerName=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +STATIC=0D +EFI_COMPONENT_NAME_PROTOCOL gComponentName =3D {=0D + &LsiScsiGetDriverName,=0D + &LsiScsiGetDeviceName,=0D + "eng" // SupportedLanguages, ISO 639-2 language codes=0D +};=0D +=0D +STATIC=0D +EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 =3D {=0D + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &LsiScsiGetDriverName,=0D + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &LsiScsiGetDeviceName,=0D + "en" // SupportedLanguages, RFC 4646 language codes=0D +};=0D +=0D +//=0D +// Entry point of this driver=0D +//=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiEntryPoint (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + return EfiLibInstallDriverBindingComponentName2 (=0D + ImageHandle,=0D + SystemTable,=0D + &gDriverBinding,=0D + ImageHandle, // The handle to install onto=0D + &gComponentName,=0D + &gComponentName2=0D + );=0D +}=0D diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.h b/OvmfPkg/LsiScsiDxe/LsiScsi.h new file mode 100644 index 000000000000..1a16ef9f7795 --- /dev/null +++ b/OvmfPkg/LsiScsiDxe/LsiScsi.h @@ -0,0 +1,199 @@ +/** @file=0D +=0D + Internal definitions for the LSI 53C895A SCSI driver, which produces=0D + Extended SCSI Pass Thru Protocol instances for LSI 53C895A SCSI devices.= =0D +=0D + Copyright (C) 2020, SUSE LLC.=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef _LSI_SCSI_DXE_H_=0D +#define _LSI_SCSI_DXE_H_=0D +=0D +typedef struct {=0D + //=0D + // Allocate 32 UINT32 entries for the script and it's sufficient for=0D + // 16 instructions.=0D + //=0D + UINT32 Script[32];=0D + //=0D + // The max size of CDB is 32.=0D + //=0D + UINT8 Cdb[32];=0D + //=0D + // Allocate 64KB for read/write buffer.=0D + //=0D + UINT8 Data[0x10000];=0D + //=0D + // For SCSI Message In phase=0D + //=0D + UINT8 MsgIn[2];=0D + //=0D + // For SCSI Message Out phase=0D + //=0D + UINT8 MsgOut;=0D + //=0D + // For SCSI Status phase=0D + //=0D + UINT8 Status;=0D +} LSI_SCSI_DMA_BUFFER;=0D +=0D +typedef struct {=0D + UINT32 Signature;=0D + UINT64 OrigPciAttrs;=0D + EFI_EVENT ExitBoot;=0D + EFI_PCI_IO_PROTOCOL *PciIo;=0D + UINT8 MaxTarget;=0D + UINT8 MaxLun;=0D + UINT32 StallPerPollUsec;=0D + LSI_SCSI_DMA_BUFFER *Dma;=0D + EFI_PHYSICAL_ADDRESS DmaPhysical;=0D + VOID *DmaMapping;=0D + EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;=0D + EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;=0D +} LSI_SCSI_DEV;=0D +=0D +#define LSI_SCSI_DEV_SIGNATURE SIGNATURE_32 ('L','S','I','S')=0D +=0D +#define LSI_SCSI_FROM_PASS_THRU(PassThruPtr) \=0D + CR (PassThruPtr, LSI_SCSI_DEV, PassThru, LSI_SCSI_DEV_SIGNATURE)=0D +=0D +#define LSI_SCSI_DMA_ADDR_LOW(Dev, MemberName) \=0D + ((UINT32)(Dev->DmaPhysical + OFFSET_OF (LSI_SCSI_DMA_BUFFER, MemberName)= ))=0D +=0D +=0D +//=0D +// Probe, start and stop functions of this driver, called by the DXE core = for=0D +// specific devices.=0D +//=0D +// The following specifications document these interfaces:=0D +// - Driver Writer's Guide for UEFI 2.3.1 v1.01, 9 Driver Binding Protocol= =0D +// - UEFI Spec 2.3.1 + Errata C, 10.1 EFI Driver Binding Protocol=0D +//=0D +=0D +STATIC=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiControllerSupported (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiControllerStart (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiControllerStop (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN UINTN NumberOfChildren,=0D + IN EFI_HANDLE *ChildHandleBuffer=0D + );=0D +=0D +=0D +//=0D +// The next seven functions implement EFI_EXT_SCSI_PASS_THRU_PROTOCOL=0D +// for the LSI 53C895A SCSI Controller. Refer to UEFI Spec 2.3.1 + Errata = C,=0D +// sections=0D +// - 14.1 SCSI Driver Model Overview,=0D +// - 14.7 Extended SCSI Pass Thru Protocol.=0D +//=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiPassThru (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN UINT8 *Target,=0D + IN UINT64 Lun,=0D + IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,=0D + IN EFI_EVENT Event OPTIONAL=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetNextTargetLun (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN OUT UINT8 **TargetPointer,=0D + IN OUT UINT64 *Lun=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiBuildDevicePath (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN UINT8 *Target,=0D + IN UINT64 Lun,=0D + IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetTargetLun (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,=0D + OUT UINT8 **TargetPointer,=0D + OUT UINT64 *Lun=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiResetChannel (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiResetTargetLun (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN UINT8 *Target,=0D + IN UINT64 Lun=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetNextTarget (=0D + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,=0D + IN OUT UINT8 **TargetPointer=0D + );=0D +=0D +=0D +//=0D +// The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL a= nd=0D +// EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's = name=0D +// in English, for display on standard console devices. This is recommende= d for=0D +// UEFI drivers that follow the UEFI Driver Model. Refer to the Driver Wri= ter's=0D +// Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.=0D +//=0D +// Device type names ("LSI 53C895A SCSI Controller") are not formatted bec= ause=0D +// the driver supports only that device type. Therefore the driver name=0D +// suffices for unambiguous identification.=0D +//=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetDriverName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **DriverName=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +LsiScsiGetDeviceName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN EFI_HANDLE DeviceHandle,=0D + IN EFI_HANDLE ChildHandle,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **ControllerName=0D + );=0D +=0D +#endif // _LSI_SCSI_DXE_H_=0D diff --git a/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf b/OvmfPkg/LsiScsiDxe/LsiScsi= Dxe.inf new file mode 100644 index 000000000000..10f7f0eebd0e --- /dev/null +++ b/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf @@ -0,0 +1,45 @@ +## @file=0D +# This driver produces Extended SCSI Pass Thru Protocol instances for=0D +# LSI 53C895A SCSI devices.=0D +#=0D +# Copyright (C) 2020, SUSE LLC.=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 1.29=0D + BASE_NAME =3D LsiScsiDxe=0D + FILE_GUID =3D EB4EB21f-5A3D-40BE-8BD2-F1B0E38E5744= =0D + MODULE_TYPE =3D UEFI_DRIVER=0D + VERSION_STRING =3D 1.0=0D + ENTRY_POINT =3D LsiScsiEntryPoint=0D +=0D +[Sources]=0D + LsiScsi.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + BaseMemoryLib=0D + DebugLib=0D + MemoryAllocationLib=0D + PcdLib=0D + UefiBootServicesTableLib=0D + UefiDriverEntryPoint=0D + UefiLib=0D +=0D +[Protocols]=0D + gEfiExtScsiPassThruProtocolGuid ## BY_START=0D + gEfiPciIoProtocolGuid ## TO_START=0D +=0D +[FixedPcd]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdLsiScsiMaxTargetLimit ## CONSUMES=0D + gUefiOvmfPkgTokenSpaceGuid.PcdLsiScsiMaxLunLimit ## CONSUMES=0D +=0D +[Pcd]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdLsiScsiStallPerPollUsec ## CONSUMES=0D diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 65bb2bb0eb4c..ddf81f2bbcb8 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -174,6 +174,15 @@ [PcdsFixedAtBuild] ## Microseconds to stall between polling for MptScsi request result=0D gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x40=0D =0D + ## Set the *inclusive* number of targets and LUNs that LsiScsi exposes f= or=0D + # scan by ScsiBusDxe.=0D + gUefiOvmfPkgTokenSpaceGuid.PcdLsiScsiMaxTargetLimit|7|UINT8|0x3b=0D + gUefiOvmfPkgTokenSpaceGuid.PcdLsiScsiMaxLunLimit|0|UINT8|0x3c=0D +=0D + ## Microseconds to stall between polling for LsiScsi request result=0D + gUefiOvmfPkgTokenSpaceGuid.PcdLsiScsiStallPerPollUsec|5|UINT32|0x3d=0D +=0D +=0D gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|= 0x8=0D gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|= 0x9=0D gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize|0x0|UINT32|0xa=0D diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index d0df9cbbfb2b..ea1940fc354b 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -50,6 +50,7 @@ [Defines] #=0D DEFINE PVSCSI_ENABLE =3D TRUE=0D DEFINE MPT_SCSI_ENABLE =3D TRUE=0D + DEFINE LSI_SCSI_ENABLE =3D TRUE=0D =0D #=0D # Flash size selection. Setting FD_SIZE_IN_KB on the command line direct= ly to=0D @@ -775,6 +776,9 @@ [Components] !endif=0D !if $(MPT_SCSI_ENABLE) =3D=3D TRUE=0D OvmfPkg/MptScsiDxe/MptScsiDxe.inf=0D +!endif=0D +!if $(LSI_SCSI_ENABLE) =3D=3D TRUE=0D + OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf=0D !endif=0D MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf=0D diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index e2b759aa8d05..2b9a6b58015f 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -236,6 +236,9 @@ [FV.DXEFV] !if $(MPT_SCSI_ENABLE) =3D=3D TRUE=0D INF OvmfPkg/MptScsiDxe/MptScsiDxe.inf=0D !endif=0D +!if $(LSI_SCSI_ENABLE) =3D=3D TRUE=0D +INF OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf=0D +!endif=0D =0D !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon= figDxe.inf=0D diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index b3ae62fee92b..2cc8cb8053c6 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -49,6 +49,7 @@ [Defines] #=0D DEFINE PVSCSI_ENABLE =3D TRUE=0D DEFINE MPT_SCSI_ENABLE =3D TRUE=0D + DEFINE LSI_SCSI_ENABLE =3D TRUE=0D =0D #=0D # Flash size selection. Setting FD_SIZE_IN_KB on the command line direct= ly to=0D @@ -789,6 +790,9 @@ [Components.X64] !endif=0D !if $(MPT_SCSI_ENABLE) =3D=3D TRUE=0D OvmfPkg/MptScsiDxe/MptScsiDxe.inf=0D +!endif=0D +!if $(LSI_SCSI_ENABLE) =3D=3D TRUE=0D + OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf=0D !endif=0D MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf=0D diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index bfca1eff9e83..83ff6aef2e8c 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -237,6 +237,9 @@ [FV.DXEFV] !if $(MPT_SCSI_ENABLE) =3D=3D TRUE=0D INF OvmfPkg/MptScsiDxe/MptScsiDxe.inf=0D !endif=0D +!if $(LSI_SCSI_ENABLE) =3D=3D TRUE=0D +INF OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf=0D +!endif=0D =0D !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon= figDxe.inf=0D diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index f7fe75ebf531..2708ce0d2df5 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -49,6 +49,7 @@ [Defines] #=0D DEFINE PVSCSI_ENABLE =3D TRUE=0D DEFINE MPT_SCSI_ENABLE =3D TRUE=0D + DEFINE LSI_SCSI_ENABLE =3D TRUE=0D =0D #=0D # Flash size selection. Setting FD_SIZE_IN_KB on the command line direct= ly to=0D @@ -785,6 +786,9 @@ [Components] !endif=0D !if $(MPT_SCSI_ENABLE) =3D=3D TRUE=0D OvmfPkg/MptScsiDxe/MptScsiDxe.inf=0D +!endif=0D +!if $(LSI_SCSI_ENABLE) =3D=3D TRUE=0D + OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf=0D !endif=0D MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf=0D diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index bfca1eff9e83..83ff6aef2e8c 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -237,6 +237,9 @@ [FV.DXEFV] !if $(MPT_SCSI_ENABLE) =3D=3D TRUE=0D INF OvmfPkg/MptScsiDxe/MptScsiDxe.inf=0D !endif=0D +!if $(LSI_SCSI_ENABLE) =3D=3D TRUE=0D +INF OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf=0D +!endif=0D =0D !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon= figDxe.inf=0D --=20 2.25.1