From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [62.140.7.102]) by mx.groups.io with SMTP id smtpd.web12.5964.1594966321502790405 for ; Thu, 16 Jul 2020 23:12:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=QMc/HFav; spf=pass (domain: suse.com, ip: 62.140.7.102, mailfrom: glin@suse.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1594966319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7EdDSC3Pd7qv7lkkwL3V8IkkL4YWnfLYrAet/BC2FYs=; b=QMc/HFav/9a4sSDvOwUJBFv26JSnTg+lKid5FEv0nky0op4qx2TSWJApuB7PHhfxhRUMmN ptbsH1K8DxO+cbazpIRrn4bgjOrgIliogkZH0SqBwNVz6aMDnh8jz+Omw+9Gmq2CcOkUPB LMEkpAqmlvVWofeuhS2GY69h3YKJUN0= Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2107.outbound.protection.outlook.com [104.47.17.107]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-22-pohjias8NSumd80cRhQfsA-1; Fri, 17 Jul 2020 08:11:58 +0200 X-MC-Unique: pohjias8NSumd80cRhQfsA-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1cjueNk06e0yCalYcFZHpeT965uMS3fz4QTkm3d3wvJIW0I7AddBGPx66cysA5AgWhxSf00gxl6XbAUAk0fPhjqw7PrLQTThey+8+MGoS6dc8WSU0iybLYjC/1XOd+DeSIoOqsJ9MvAY20jytMEzyPyOnRLW2n5ro/62b4iETeYzkQzWbuyUtpyVAI9GoKwXLpupgJnL76Sr/B9zqJ1yqLX5LAN92doqgH5mEwnHLS5uQWkwFl277fMRSq12mkZUeQUxRR/TBWu945vgqelHuTdNrlQdOGeyVmrU/EpHMe6KEG5pP6C6hWlDD65VJZoNdEExhe+7knQ/pLhfQHOzA== 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=7EdDSC3Pd7qv7lkkwL3V8IkkL4YWnfLYrAet/BC2FYs=; b=H9siIyOUWm0KajZ97XQ7fwdxWCkfykrLMXldkUrNJBR4Sd1biU9jgXT6gbP/NDfg4ivd+sW/PjyvIxm2ylZ8aCMLSQbb+q7Dd2gpXZhKUMiZ5yXgdJW504l0dI9gRrn83FO1s7FNBmyphhiyWjuq2L/TIobw2PQPr/lI3HdqQ1ASYVrK//uy9yGUVt+9UiK1XYVvgIqKhm/BHC+PeEXX9MbGbfaxRk0+t6yDRKvjAH4gN4cfq6kK6wCFpfXrDhNzMSCd3jW6gqyVmsgmhvc5+hlp0u5i6hL01uUQJpfVH6roZeOlvxnK/DEmgKZXy4ZVWsJZIjFBh9qucsovJ1DKVA== 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 AM0PR0402MB3809.eurprd04.prod.outlook.com (2603:10a6:208:10::30) by AM0PR04MB4740.eurprd04.prod.outlook.com (2603:10a6:208:c8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 17 Jul 2020 06:11:57 +0000 Received: from AM0PR0402MB3809.eurprd04.prod.outlook.com ([fe80::a14c:d441:c8a9:77ba]) by AM0PR0402MB3809.eurprd04.prod.outlook.com ([fe80::a14c:d441:c8a9:77ba%6]) with mapi id 15.20.3174.026; Fri, 17 Jul 2020 06:11:57 +0000 From: "Gary Lin" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [PATCH v3 04/11] OvmfPkg/LsiScsiDxe: Probe PCI devices and look for LsiScsi Date: Fri, 17 Jul 2020 14:11:23 +0800 Message-Id: <20200717061130.8881-5-glin@suse.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200717061130.8881-1-glin@suse.com> References: <20200717061130.8881-1-glin@suse.com> X-ClientProxiedBy: AM0PR04CA0138.eurprd04.prod.outlook.com (2603:10a6:208:55::43) To AM0PR0402MB3809.eurprd04.prod.outlook.com (2603:10a6:208:10::30) Return-Path: glin@suse.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from GaryWorkstation.suse.cz (60.251.47.115) by AM0PR04CA0138.eurprd04.prod.outlook.com (2603:10a6:208:55::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18 via Frontend Transport; Fri, 17 Jul 2020 06:11:55 +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: e0a48260-df12-4597-622f-08d82a184f2d X-MS-TrafficTypeDiagnostic: AM0PR04MB4740: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1loOCt7JBjjjEZHDz+IQvBzXrf7psV9rzioI9QuWT6z0/TR+SL24BoDka2O1n9oEBm14KQkNUs5ufD0XES6sKVz2WmJKFAJmhVlRhPJg7Xl4smGslKFs6fmWKviGQ76ceR1XGqh1SE/nI0LAjdUvJlg9CKsaQW1KwtzIBiwL71zlNgHhDgC2uVesSzoImkcFRF1rtiLcG2E3o6b7Os2U69JuCn5BPqunjp367Dx+3GTQjwbWi+6hiPguhTSi531AGbWlZdkMlLSzZxCwm8GTN5RK/dsGNRyeU+fQy6YagHcxCBfR6G5b+mDRanR3GYKq84croaIq0lMy8bRvUpb7nQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR0402MB3809.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(39860400002)(136003)(396003)(376002)(346002)(366004)(55236004)(2906002)(186003)(1076003)(16526019)(66556008)(6506007)(66946007)(6486002)(8936002)(66476007)(54906003)(86362001)(6916009)(8676002)(26005)(83380400001)(5660300002)(6512007)(316002)(6666004)(52116002)(478600001)(956004)(36756003)(2616005)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: mYrs/qJ615mFfjsmy/AJlIS7T+Tbgsgfxf54e+q/NBRb2IveZkyEWfqqrMY0HfOHAd31JmCGzPp3DjImfMXLmj83oulkNseQQsdvZWjVQtKL/fD+wNmv+z8dTk3H/nPY46RSoqc/2mMiiJthdH1VVbuJi6/+Nu1/2AwHjtEPVndrpBWmbfup+ofVScjAtvWg2p1LLdNXsuDN26/iIGuwH0bes8KWOYbEu+yxiLAHLHmUgC6g5vy8ivJ9j3RxZAS6SwgZFsV4X159/iEFcLHnvX+gdSUegtO0pKT2tig0Nlg8k3KknSNpWrffN/EB1iUKi2VRr2S/KDHyL42/KcwrOUBdiEi1gXRuGU2J3TNPuxWrdOsNrDEJlBGPuWRcF3SUxRv1QTdDbsRqef6uhl3nzd2LWVXXLb6Z/2g49zfGK8L560eiOgTAHfELW68EcwbSGqZKTlUfGCO3wCW7FDqMi4NiuZaPsy88pNbVLHU1cTc= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0a48260-df12-4597-622f-08d82a184f2d X-MS-Exchange-CrossTenant-AuthSource: AM0PR0402MB3809.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2020 06:11:57.3478 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s01x+7l78sKpMjkky9Tvk4HGbukHwrlTP9So+HkX7fJVXLX2UcwuoK9Am3Msb80R X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4740 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Implement LsiScsiControllerSupported() to probe the PCI ID and look for LSI 53C895A. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Gary Lin Reviewed-by: Laszlo Ersek --- OvmfPkg/Include/IndustryStandard/LsiScsi.h | 20 +++++++++ OvmfPkg/LsiScsiDxe/LsiScsi.c | 48 +++++++++++++++++++++- OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf | 6 +++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 OvmfPkg/Include/IndustryStandard/LsiScsi.h diff --git a/OvmfPkg/Include/IndustryStandard/LsiScsi.h b/OvmfPkg/Include/I= ndustryStandard/LsiScsi.h new file mode 100644 index 000000000000..c09e864a1f39 --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/LsiScsi.h @@ -0,0 +1,20 @@ +/** @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 +#endif // _LSI_SCSI_H_=0D diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.c b/OvmfPkg/LsiScsiDxe/LsiScsi.c index 62daa3ab99bf..5bca85bd75eb 100644 --- a/OvmfPkg/LsiScsiDxe/LsiScsi.c +++ b/OvmfPkg/LsiScsiDxe/LsiScsi.c @@ -9,7 +9,12 @@ =0D **/=0D =0D +#include =0D +#include =0D +#include =0D #include =0D +#include =0D +#include =0D #include =0D =0D #include "LsiScsi.h"=0D @@ -31,7 +36,48 @@ LsiScsiControllerSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL=0D )=0D {=0D - return EFI_UNSUPPORTED;=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 diff --git a/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf b/OvmfPkg/LsiScsiDxe/LsiScsi= Dxe.inf index 5cb15c456549..7ce11fcc6a03 100644 --- a/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf +++ b/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf @@ -22,7 +22,13 @@ [Sources] =0D [Packages]=0D MdePkg/MdePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D =0D [LibraryClasses]=0D + BaseLib=0D + UefiBootServicesTableLib=0D UefiDriverEntryPoint=0D UefiLib=0D +=0D +[Protocols]=0D + gEfiPciIoProtocolGuid ## TO_START=0D --=20 2.25.1