From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 3C86582128 for ; Wed, 8 Feb 2017 18:16:29 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 08 Feb 2017 18:16:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,349,1484035200"; d="scan'208";a="1124047889" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2017 18:16:28 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 8 Feb 2017 18:16:28 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 8 Feb 2017 18:16:28 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Thu, 9 Feb 2017 10:16:25 +0800 From: "Gao, Liming" To: Andrew Fish , "David A. Van Arnem" CC: "edk2-devel@ml01.01.org" Thread-Topic: [edk2] Print from DXE_DRIVER Thread-Index: AQHSglg3+EfrDdMb8Ea7rn1/rj9HVKFfUEWAgAABxgCAAAQgAIAAmbxQ Date: Thu, 9 Feb 2017 02:16:24 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6D8C41@shsmsx102.ccr.corp.intel.com> References: <4a3de604-5e60-7ed2-e520-29ab6b551c33@cmlab.biz> <18d9b9ba-f95d-1445-0842-9915c72be92a@cmlab.biz> <765376CE-F36F-4A4F-9FB5-DDA7EC6B9975@apple.com> In-Reply-To: <765376CE-F36F-4A4F-9FB5-DDA7EC6B9975@apple.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: Print from DXE_DRIVER X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2017 02:16:29 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable You can use DebugLib, and link MdePkg\Library\UefiDebugLibConOut\UefiDebugL= ibConOut.inf to print error message to Console.=20 DEBUG ((DEBUG_INFO, "Hello Workd\n")); Thanks Liming -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Andr= ew Fish Sent: Thursday, February 9, 2017 9:05 AM To: David A. Van Arnem Cc: edk2-devel@ml01.01.org Subject: Re: [edk2] Print from DXE_DRIVER > On Feb 8, 2017, at 4:49 PM, David A. Van Arnem wrot= e: >=20 >=20 >=20 > On 02/08/2017 05:43 PM, Andrew Fish wrote: >>=20 >>> On Feb 8, 2017, at 2:10 PM, David A. Van Arnem > wrote: >>>=20 >=20 > >=20 >>> When I load the driver from the shell (load .efi), I get a >>> message indicating it loaded successfully, but no output from the >>> Print() messages. =20 >>=20 >> You should be able to use shell commands to see if you driver is connect= ed.=20 >=20 > dh output does show my .efi at the end which I think > indicates it is connected. >=20 dh is just showing handles and protocols not what happened with Driver Bind= ing. So likely you are seeing that your driver got loaded.=20 Run `drivers` or `devtree` to see the results of the connect. >>=20 >>> The documentation for the shell says load should test >>> both the Supported() and Start() functions, so I would expect to see th= e >>> output, but I am not sure I am using the correct library instances to >>> accomplish this. Is it possible to use Print() from a DXE_DRIVER, and >>> which library instance should I use in the UefiCpuPkg.dsc file? >>=20 >> Print() is part of the UefiLib. The PrintLib vends sprintf kinds of thin= gs.=20 >>=20 >>> If not, >>> would changing it to a UEFI_DRIVER help? Any other recommendations? >>>=20 >>=20 >> If you are publishing driver binding protocol you should be UEFI_DRIVER,= if possible.=20 >>=20 >>> If there is an example in edk2 that does this that you could point me >>> to, that would be sufficient as well. Thanks! >>>=20 >>=20 >> If you want to write directly to the UEFI Console you can try this. Pla= ce it in the entry point of your driver in case you have some bug that is p= reventing your from registering the Driver Binding Protocol.=20 >>=20 >> gST->ConOut->OutputString (gST->ConOut, L"Hello World\n\r"); >>=20 >> Make sure you use L"" vs "" as Print takes a CHAR16 and %s also default= to CHAR16 (not ASCII) >=20 Here is a write up on how Print is different than printf. https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintL= ib.h#L26 Thanks, Andrew Fish > I will try that, thank you! >=20 > Regards, > David >=20 >>=20 >>=20 >>=20 >> Thanks, >>=20 >> Andrew Fish >>=20 >>=20 >>> --=20 >>> Regards, >>> David Van Arnem >>> Development Engineer IV >>> Computer Measurement Laboratory, LLC >>>=20 >>> _______________________________________________ >>> edk2-devel mailing list >>> edk2-devel@lists.01.org >>> https://lists.01.org/mailman/listinfo/edk2-devel >>=20 >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel >>=20 >=20 > --=20 > Regards, > David Van Arnem > Development Engineer IV > Computer Measurement Laboratory, LLC _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel