From nobody Mon Feb 9 15:09:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+62658+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+62658+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1594885601420189.51517561152752; Thu, 16 Jul 2020 00:46:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id g51ZYY1788612xzYTqAyetxT; Thu, 16 Jul 2020 00:46:41 -0700 X-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 X-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 X-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 X-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: [edk2-devel] [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> 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) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-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-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-Message-Info: GM39JLBcByGV5XS1wu5TVABuN0WiWHTsMK44YhYls+ZV+mG76/221KgZT/8/fG7E2sHjtXZxN540px/fiG3r3k5lhK0I3Puy5vrjP5yc1s09Vv5rtx4LLjPL4+pC1iyq5yJLZTm/mdCd3ympDMrJIFFJfcJs2PMTbFaOisv/OkKKcGqsbepAHhM1LBCP/G1mYIxwAa1zCDEVaLzvF32QCkeoyALChiCYOpn/g1u6m7tvJeAssZd9IlNgoPS0yvRDA5MoGuefKWo2vrp/Sd4qv1dtqRKzWT1EvBCRGK4zKbke1s901O+A7a5EIGYorBwiuHcX1cqIUn0p0kiH88YPmQ== 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 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,glin@suse.com X-Gm-Message-State: ouVN8IVQA2BAIZuyerqJDnNAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1594885601; bh=oh4BwxgGhLRUJ/sjgM3+g1BItWxbxTwbqqSp7xx0NuY=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=jVDqXDZUEZbyPkvLeRwsZgQi6PHGsM9OWXU4ZWIcBo8G2BMYo/7UZYju1yDGAnWxW+S 2Ir32qLu/PFKW8kK/7c1k2xrltwS9GaqH9Sb0Ed4Ry4VKwS3TbyMFWl+3zDmeAmP0SKsK fbrQ478p0GUpkQYHWXbIHriAPC/nn/kVWZg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 + + Macros and type definitions for LSI 53C895A SCSI devices. + + Copyright (C) 2020, SUSE LLC. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _LSI_SCSI_H_ +#define _LSI_SCSI_H_ + +// +// Device ID +// +#define LSI_LOGIC_PCI_VENDOR_ID 0x1000 +#define LSI_53C895A_PCI_DEVICE_ID 0x0012 + +#endif // _LSI_SCSI_H_ 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 @@ =20 **/ =20 +#include +#include +#include #include +#include +#include #include =20 #include "LsiScsi.h" @@ -31,7 +36,48 @@ LsiScsiControllerSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ) { - return EFI_UNSUPPORTED; + EFI_STATUS Status; + EFI_PCI_IO_PROTOCOL *PciIo; + PCI_TYPE00 Pci; + + Status =3D gBS->OpenProtocol ( + ControllerHandle, + &gEfiPciIoProtocolGuid, + (VOID **)&PciIo, + This->DriverBindingHandle, + ControllerHandle, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint32, + 0, + sizeof (Pci) / sizeof (UINT32), + &Pci + ); + if (EFI_ERROR (Status)) { + goto Done; + } + + if (Pci.Hdr.VendorId =3D=3D LSI_LOGIC_PCI_VENDOR_ID && + Pci.Hdr.DeviceId =3D=3D LSI_53C895A_PCI_DEVICE_ID) { + Status =3D EFI_SUCCESS; + } else { + Status =3D EFI_UNSUPPORTED; + } + +Done: + gBS->CloseProtocol ( + ControllerHandle, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + return Status; } =20 EFI_STATUS 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] =20 [Packages] MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec =20 [LibraryClasses] + BaseLib + UefiBootServicesTableLib UefiDriverEntryPoint UefiLib + +[Protocols] + gEfiPciIoProtocolGuid ## TO_START --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#62658): https://edk2.groups.io/g/devel/message/62658 Mute This Topic: https://groups.io/mt/75537207/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-