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.web10.14124.1593576342184411896 for ; Tue, 30 Jun 2020 21:05:42 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: suse.com, ip: 62.140.7.102, mailfrom: glin@suse.com) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2054.outbound.protection.outlook.com [104.47.4.54]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-28-xvm8h0KJM5qR7LpRKYFFWA-3; Wed, 01 Jul 2020 06:05:38 +0200 X-MC-Unique: xvm8h0KJM5qR7LpRKYFFWA-3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YhSl7hmuInQxB7BrGW9uHMIgAWI+rSdCsMEn2+OBABF5aLPCbU0QLIMQ9TNTN3XI/6nhPkgGMKWLU1hbf0zrkAKMDpWqDMdzz2DuX+Ki0Xc6F70dMZPkxLydyDFhIyfr2sJvRguBjxWb+d83+QXr++sRXSozPfQQhsaY+geVGA/A612PV0I+e+A4ODTZA1LpUvx2QoO1iRWH4hGYyiVXDuPJylfLEIOPhx5Bga1tpnQ9jSspuajEmJeurWhU0cz+51R2PmISDGm0/ZrvNg8EnOWCuZlYoaGfQ3p2qwwqPvAAR4qe1kbJg/duzbz47M1eeenWorQTomiLtNdMIp+DQw== 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=CUaqJ3w/gVejBoeaw3bpzs7aLzKi2fyj6NtnBF+F+jQ=; b=X3Dq37VvYdcTyBOCHOiFWedCCmHEUfV6WXXjfaNN2/3C+qoTejfd48Ddnu1xCjUr33QpJ/z304XeArksS8I2EyYFDyYws1soTdgZvyuYDdromp1ILxepMS/AuvGk2U78hx2ve30fqUX0jj9NTPiqtOh1NTcnA/3GwQXQ3s1wl+guiAAtsV9zEgtv55SqBVnrXC7oGBV1YpzFeT78kTYOku8Qqw8h3+99c+CHK1QLVux3WyckcO78k7loPp0DOo4xwQIuhUazEB9RrxvQk4TVn0dlkVx6FCp7jBIkCVezGI8cUc/+OWI4luQkZ3XqyT1OaJvgvSYGoRndsnUz/FBwgw== 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 AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Wed, 1 Jul 2020 04:05:38 +0000 Received: from AM0PR0402MB3809.eurprd04.prod.outlook.com ([fe80::8806:715f:1409:8c6b]) by AM0PR0402MB3809.eurprd04.prod.outlook.com ([fe80::8806:715f:1409:8c6b%7]) with mapi id 15.20.3153.021; Wed, 1 Jul 2020 04:05:37 +0000 From: "Gary Lin" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [PATCH 04/11] OvmfPkg/LsiScsiDxe: Probe PCI devices and look for LsiScsi Date: Wed, 1 Jul 2020 12:04:41 +0800 Message-Id: <20200701040448.14871-5-glin@suse.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200701040448.14871-1-glin@suse.com> References: <20200701040448.14871-1-glin@suse.com> X-ClientProxiedBy: AM0PR10CA0047.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::27) 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 AM0PR10CA0047.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 04:05:36 +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: 290983d1-7c80-4eb6-92bf-08d81d7402f4 X-MS-TrafficTypeDiagnostic: AM0PR04MB4481: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ItVf5RYLuEnvQcBhnoW29u/twXWytiQybR6zalzK4MbXtfJQa8SoEGzQIhmZDUlOWvQEur7mDSRzZ0aWWDomu3e/0YzQ4eOX+lHEqX7BfO8NrJOoTuAbxxivMP3OEALKz3dxJasgLWpAUHJn8jk+BBZaev0OuifAvNis+l43pqtQPa/XfG1D6j9KJ9KoHSLjLdFSL8rLNVerfJ0Iz2X7b+xfbXg21gnUaC+0a+fHbn9+Sf+ovIYGtsmNAHjyvXAd0YLTYfBr45awfFtcWgTBpU8ebLZZ8jLCLQkiL2MwSJ7Kryaq7LxHwbpgOeQw3YstaVVMYQh/xsSMBrTY2M07Mw== 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:(366004)(136003)(376002)(39860400002)(396003)(346002)(2616005)(83380400001)(26005)(54906003)(4326008)(16526019)(1076003)(956004)(86362001)(6506007)(186003)(6666004)(66476007)(66556008)(8936002)(6486002)(52116002)(6916009)(5660300002)(8676002)(36756003)(66946007)(55236004)(316002)(6512007)(478600001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: frs3nO/TjomchDgBvOVtYr66jH+w5GRHGR1TbK03DSqLaH503DYf2TAyWd0UCEYWMaRgi57ASrv9JfNzKFh+d/BSb4gXZS3lhALKTJGez4eB2MR5fxIiVONM4223XTCbdUhgFlZayqRAHlHq+68hEVSReoiBDQFVnQMmNSlWmtzk+McTNZteRy3vS0sPa1TnJXyJHlz90fcBBXl8eXhr3+7jKQu4LT+OU0xfpUohMD7kIEgWfhbbW5Qk38E5YcwdxDcS1LN16R9vWm4RpcWK/dB3syoSf2t7iIb0lmQoT3hhotYYVRsFXRVly09RiV5E8DruWlW3iVyH3eA3dAAM20/E9q8yqyIWjLtzuvBKUCCehpZ3L8LcfSnSAoYMqJlK3kee5JTWA10hvsS9lJXKfv/6mb+KenS5dWKQzzgkZ8ai1vyVATPGiqlaMqkENCDCx1rtbnfTYt/sH9iv8QGdr/5yIFcKPdi6dMccZ6x7O+o= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 290983d1-7c80-4eb6-92bf-08d81d7402f4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR0402MB3809.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 04:05:37.9367 (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: TwEAjGMUAVqFefmpinOAy7HMkxm2Fxikh+8DJJQZJ428JoEismgNaPBVkGH37LGb X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4481 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 --- 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 444ceb78e9ca..e86c626a61aa 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