From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 807592034A7B3 for ; Thu, 26 Oct 2017 03:29:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 201647EAB3; Thu, 26 Oct 2017 10:33:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 201647EAB3 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-110.rdu2.redhat.com [10.10.120.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D9DE7F5F7; Thu, 26 Oct 2017 10:33:27 +0000 (UTC) To: Nikolay Bodunov , edk2-devel@lists.01.org References: <1508970001.253907598@f184.i.mail.ru> From: Laszlo Ersek Message-ID: <0fd89d93-255f-0d17-1eb1-23888c85a249@redhat.com> Date: Thu, 26 Oct 2017 12:33:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1508970001.253907598@f184.i.mail.ru> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 26 Oct 2017 10:33:28 +0000 (UTC) Subject: Re: Can't open PciIo protocol in both qemu (Nt32Pkg) and VirtualBox EFI X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 10:29:42 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 10/26/17 00:20, Nikolay Bodunov wrote: > > Hello > > I try to make work a code from "UEFI Driver Writer Guide", but always receive EFI_UNSUPPORTED status: > > EFI_STATUS > EFIAPI > PciDriverOnlyDriverBindingSupported ( >   IN EFI_DRIVER_BINDING_PROTOCOL  *This, >   IN EFI_HANDLE                   ControllerHandle, >   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL >   ) > { >     EFI_STATUS                       Status; >     EFI_PCI_IO_PROTOCOL        *PciIo; >     Status = gBS->OpenProtocol ( >         ControllerHandle, >         &gEfiPciIoProtocolGuid, >         (VOID **)&PciIo, >         This->DriverBindingHandle, >         ControllerHandle, >         EFI_OPEN_PROTOCOL_BY_DRIVER >         ); >     DEBUG((EFI_D_INFO, "Status is %r \r\n", Status)); >     if (EFI_ERROR (Status)) { >         return Status; >     } >     return EFI_SUCCESS; > } > > However, for example, with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL instead of  EFI_PCI_IO_PROTOCOL  OpenProtocol() works fine and returns EFI_SUCCESS. > > Driver project was created with UEFI Driver Wizard. Inf file contains gEfiPciIoProtocolGuid. > Where I could make a mistake? There's no mistake, it just means that the ControllerHandle passed to the function does not support the PciIo interface. Please read "Driver Writer’s Guide for UEFI 2.3.1", sections: - 6 UEFI Driver Categories - 7.2 UEFI Driver Model - 18 PCI Driver Design Guidelines https://github.com/tianocore/tianocore.github.io/wiki/UEFI-Driver-Writer%27s-Guide Thanks Laszlo