From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [51.163.158.102]) by mx.groups.io with SMTP id smtpd.web10.10747.1594885600345833444 for ; Thu, 16 Jul 2020 00:46:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=LxAFf6d4; spf=pass (domain: suse.com, ip: 51.163.158.102, mailfrom: glin@suse.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1594885598; 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=LxAFf6d4ylIX7ylfKjPo61T9VZW0P8xIWtnZURv2nsKtnmrAWxwWrjTTns5mvhSAaEUwo8 Yox/NcZ6srnYqqjQke1TyKWxR85zADrybaUB32K8d0reX1b54wREayGrYwHIaKLoaCfUyK yssjIuj3UoZaqQf0uHKcpNmDeOzpMA8= Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2054.outbound.protection.outlook.com [104.47.9.54]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-7-d7luv6P_OZm_6rYpsr67HQ-1; Thu, 16 Jul 2020 09:46:36 +0200 X-MC-Unique: d7luv6P_OZm_6rYpsr67HQ-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjkWJ4TbuDYh/tJT9Uq3VlKz+mNyEht+ls9TI6WTolgj8Kf3gGvBpS6weo8VwWzelSWIaJA/lwcoPmdr7StJMouNWy1/Yj298PmYMWoPiTwwDgt8KbyrRyz5xkg21F6fP6yjjPCQREsC8r83DfO0lroVGcMRv9xKHZQ8SZsKuENgz/Iw7KeZoXP2jS7IjOrEomM1hdVR1V23HcDjHQJrbHNR3Am56EYDIX2U1LtaOzPMuLCJZAKee+/xcgvA3v4E+ZxszJdX++sshoHCzLeiIUEkKeXNY1lmDWqMNNQAqT2FIf0afN88sucJN89wOO7Afsy+OVC5hMlIx1Ph77JsGw== 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=Oe8gTXtxCYxyFJOzn1X9LcTui9MDJ60yWWus1cRbepJ7dYWsWi5SWQnDC9hr0SUg670WegezKzyYCH3r32V3+hdL6dQxMghZoKHoVvaedl7+OGo1nL4w2+McWuegKEMZzruet3Fo0s++MBiKRkTdtL7apoyE1BClItTtodeLgQ/kMh/S6p12/jV2Wh0ixiFxg6v/8ldPew1Z41DvCTFc9OoXr6aVU9fZSv0IUMO59tK5lUycHSBUifju3McPp6EJgUTcZEVPbaYt3QjZdcclIJPfRH9W7HyzzEbEJ/TKP/Q6MnnagJY6PSS2wGD+GV4qa7TFjb7/VTImWIZeYRz7Ig== 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 AM0PR04MB5122.eurprd04.prod.outlook.com (2603:10a6:208:ca::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.25; Thu, 16 Jul 2020 07:46:34 +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; Thu, 16 Jul 2020 07:46:34 +0000 From: "Gary Lin" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [PATCH v2 04/12] OvmfPkg/LsiScsiDxe: Probe PCI devices and look for LsiScsi Date: Thu, 16 Jul 2020 15:45:59 +0800 Message-Id: <20200716074607.18048-5-glin@suse.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200716074607.18048-1-glin@suse.com> References: <20200716074607.18048-1-glin@suse.com> X-ClientProxiedBy: AM3PR07CA0118.eurprd07.prod.outlook.com (2603:10a6:207:7::28) 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 AM3PR07CA0118.eurprd07.prod.outlook.com (2603:10a6:207:7::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17 via Frontend Transport; Thu, 16 Jul 2020 07:46:31 +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: a35528d0-e280-41b2-dd39-08d8295c5c24 X-MS-TrafficTypeDiagnostic: AM0PR04MB5122: 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: GM39JLBcByGV5XS1wu5TVABuN0WiWHTsMK44YhYls+ZV+mG76/221KgZT/8/fG7E2sHjtXZxN540px/fiG3r3k5lhK0I3Puy5vrjP5yc1s09Vv5rtx4LLjPL4+pC1iyq5yJLZTm/mdCd3ympDMrJIFFJfcJs2PMTbFaOisv/OkKKcGqsbepAHhM1LBCP/G1mYIxwAa1zCDEVaLzvF32QCkeoyALChiCYOpn/g1u6m7tvJeAssZd9IlNgoPS0yvRDA5MoGuefKWo2vrp/Sd4qv1dtqRKzWT1EvBCRGK4zKbke1s901O+A7a5EIGYorBwiuHcX1cqIUn0p0kiH88YPmQ== 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:(376002)(396003)(366004)(39860400002)(346002)(136003)(55236004)(6506007)(4326008)(8936002)(6512007)(86362001)(83380400001)(8676002)(6486002)(1076003)(52116002)(6916009)(36756003)(66946007)(66556008)(956004)(478600001)(5660300002)(6666004)(26005)(2616005)(316002)(54906003)(66476007)(16526019)(2906002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fpM14UcOSZh4kioquFD5PiPTLFubDemoYadwYjt63snc11OIyxatxvDE0KJbVhsHrrLVBq0TVJ7fuHLhGuF92N5ROd/SVvqiUxleRdcmk9DhsQiONJN/CZee+jc4TM25DBY0GBGzVaU7UcCuyn4o1Ua+x8Qfoz4HX8aXbsSaFf4PFC2icvgDKM/ZAZm0t6Sj4J3v8OoKYXv81VcXskmgJbRVORh1S8o4C+5uOMlh+rTtX1AyKDIuHJ3MMltjNQ6GMkOeUbRqTXTdP2kgdeeWjwmMA0ssxFQUnLX73yOKTvb9/m1QHzW98clgDydB3mA0D//8SXWRgCxBUxGc+OH2crCree/HwoaJB6l3/5nj5kgTYZNonbeVRA15B0XELEtUe1q+AqpV9Eql6bjr5IpagTYQIE8vnuKywBNt8ueDD1G2aRCzdNK2tFtZR1DiWINYHAtYVb+1mlDyYXOrtefOQsN11To+RM/nV3LZuhvmrWs= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: a35528d0-e280-41b2-dd39-08d8295c5c24 X-MS-Exchange-CrossTenant-AuthSource: AM0PR0402MB3809.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2020 07:46:34.1320 (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: XeuX+v51rxjq6s0UyC3farK3Zj869yZmOW37iU+775Wg+1uicXDNfo+Au7DLx86v X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5122 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