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 8014920945BF2 for ; Thu, 7 Sep 2017 22:26:15 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2017 22:29:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,360,1500966000"; d="scan'208";a="1192865809" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 07 Sep 2017 22:29:06 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 7 Sep 2017 22:29:06 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 7 Sep 2017 22:29:05 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.39]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.219]) with mapi id 14.03.0319.002; Fri, 8 Sep 2017 13:29:03 +0800 From: "Gao, Liming" To: david moheban , "edk2-devel@lists.01.org" Thread-Topic: [edk2] WARNING: No source level debug Thread-Index: AQHTKFdmVYRuP0bYQUWnC5t3RzoUsqKqdPIQ Date: Fri, 8 Sep 2017 05:29:03 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D78BB4D@shsmsx102.ccr.corp.intel.com> References: In-Reply-To: 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: WARNING: No source level debug 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: Fri, 08 Sep 2017 05:26:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please check the debuglib instance.=20 MdeModulePkg.dsc sets DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugL= ibConOut.inf. This library instance prints the debug message to Console.=20 Nt32.dsc sets DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/= PeiDxeDebugLibReportStatusCode.inf. This library instance prints the debug = message to StatusCode. The StatusCode service prints the debug message into= the different StatusCode handlers. NT32 has its WinNtOemHookStatusCodeHand= ler. So, you can see the message log.=20 Thanks Liming >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >david moheban >Sent: Friday, September 08, 2017 12:03 PM >To: edk2-devel@lists.01.org >Subject: [edk2] WARNING: No source level debug > >Hi, > >Was having trouble getting the debug messages to show in the debug log lis= t >in the developer window that launches the simulated shell window. I starte= d >out following the driver building edk2 lab pdf instructions in building on= e >of the test drivers. In the lab they have you enter the debug macro such a= s >"DEBUG (L"[mydriver] Feature unsupported\r\n") and when the Nt32Pkg is >compiled by issuing build and thus 'build run' that Debug message shows up >in the developer window and message logs. > >Later I tried my hand at making another driver and compiled it like this: >'build -p mdemodulepkg\mdemodulepkg.dsc -m mydriver\mydriver.inf'. >Next I >tried to issue a 'build run -p mdemodulepkg\mdemodulepkg.dsc' and at first >failed to run secmain vm until I copied the secmain utility manually to th= e >mdemodule build directory and then that worked. The problem I noticed was >that those 'Debug' messages werent going through with MdeModulePkg and >were >just appearing on the shell window as if you typed 'Print'. > >At first I thought maybe it was my driver code or the Inf file or header >file was missing something but running 'build -p nt32pkg' allowed all my >Debug macro messages to appear on the developer window debug logs and I >didn't get this 'Warning: No source level debug' error message in the logs= . > >Also I added to >[PCDfixedAtBuild] >gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040. >This only allowed debug messages showing up in the shell and not in the >other developer window logs as it should be. Heres my driver code though >the fault is not with the code as it works when compiled against Nt32Pkg: > >Inf File: > >[Defines] > INF_VERSION =3D 0x00010005 > BASE_NAME =3D EmptyDriver > FILE_GUID =3D 785a3ef0-9016-11e7-a9b3-acd1b8bf61e6 > MODULE_TYPE =3D UEFI_DRIVER > VERSION_STRING =3D 1.0 > ENTRY_POINT =3D EmptyDriverDriverEntryPoint > UNLOAD_IMAGE =3D EmptyDriverUnload > UEFI_HII_RESOURCE_SECTION =3D TRUE > >[Packages] > MdePkg/MdePkg.dec > MdeModulePkg/MdeModulePkg.dec > #IntelFrameworkPkg/IntelFrameworkPkg.dec > #IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec > >[Packages] > MdePkg/MdePkg.dec > MdeModulePkg/MdeModulePkg.dec > >[Sources] > EmptyDriver.h > EmptyDriver.c > ComponentName.c > ComponentName.h > > SimpleTextOutput.c > SimpleTextOutput.h > >[LibraryClasses] > UefiDriverEntryPoint > UefiBootServicesTableLib > MemoryAllocationLib > BaseMemoryLib > BaseLib > UefiLib > DevicePathLib > DebugLib > >[Protocols] > gEfiDriverBindingProtocolGuid > gEfiPciIoProtocolGuid > gEfiDriverSupportedEfiVersionProtocolGuid > gEfiHiiPackageListProtocolGuid > gEfiHiiDatabaseProtocolGuid > gEfiComponentName2ProtocolGuid > gEfiComponentNameProtocolGuid > gEfiHiiConfigAccessProtocolGuid > gEfiSimpleTextOutProtocolGuid > gEfiSerialIoProtocolGuid > gEfiSimpleTextInputExProtocolGuid > >[Guids] > >[Depex] >AFTER gFvSimpleFileSystemDxeGuid > > > >Header File: > > >#ifndef __EFI_EMPTY_DRIVER_H__ >#define __EFI_EMPTY_DRIVER_H__ > > >#include > >// >// Libraries >// >#include >#include >#include >#include >#include >#include >#include >#include > > > >// >// UEFI Driver Model Protocols >// >#include >#include >#include >#include >#include >#include >#include >#include > >// >// Consumed Protocols >// >#include >#include > >// >// Produced Protocols >// >#include >#include > > > >// >// Guids >// > >// >// Driver Version >// >#define EMPTY_DRIVER_VERSION 0x00000000 > >// >// Protocol instances >// >extern EFI_DRIVER_BINDING_PROTOCOL gEmptyDriverDriverBinding; >extern EFI_COMPONENT_NAME2_PROTOCOL >gEmptyDriverComponentName2; >extern EFI_COMPONENT_NAME_PROTOCOL gEmptyDriverComponentName; > >// >// Include files with function prototypes >// >#include "DriverBinding.h" >#include "ComponentName.h" >#include "SimpleTextOutput.h" > >#endif > > >driver.C file: >**/ > >#include "EmptyDriver.h" > > >static CHAR16* FileMemPath =3D L"\\file.efi"; > >EFI_HANDLE MainImageHandle =3D NULL; > >#define SafeFree(p) do { FreePool(p); p =3D NULL;} while(0) > > > > > >/// >/// Driver Support EFI Version Protocol instance >/// >GLOBAL_REMOVE_IF_UNREFERENCED >EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL >gEmptyDriverDriverSupportedEfiVersion =3D { > sizeof (EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL), > 0x0002001E >}; > >/// >/// Driver Binding Protocol instance >/// >EFI_DRIVER_BINDING_PROTOCOL gEmptyDriverDriverBinding =3D { > EmptyDriverDriverBindingSupported, > EmptyDriverDriverBindingStart, > EmptyDriverDriverBindingStop, > EMPTY_DRIVER_VERSION, > NULL, > NULL >}; > >/** > Unloads an image. > > @param ImageHandle Handle that identifies the image to be >unloaded. > > @retval EFI_SUCCESS The image has been unloaded. > @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. > >**/ >EFI_STATUS >EFIAPI >EmptyDriverUnload ( > IN EFI_HANDLE ImageHandle > ) >{ > EFI_STATUS Status; > EFI_HANDLE *HandleBuffer; > UINTN HandleCount; > UINTN Index; > > Status =3D EFI_SUCCESS; > // > // Retrieve array of all handles in the handle database > // > Status =3D gBS->LocateHandleBuffer ( > AllHandles, > NULL, > NULL, > &HandleCount, > &HandleBuffer > ); > if (EFI_ERROR (Status)) { > return Status; > } > > // > // Disconnect the current driver from handles in the handle database > // > for (Index =3D 0; Index < HandleCount; Index++) { > Status =3D gBS->DisconnectController (HandleBuffer[Index], gImageHandl= e, >NULL); > } > > // > // Free the array of handles > // > FreePool (HandleBuffer); > > // > // Uninstall protocols installed in the driver entry point > // > Status =3D gBS->UninstallMultipleProtocolInterfaces ( > ImageHandle, > &gEfiDriverBindingProtocolGuid, > &gEmptyDriverDriverBinding, > &gEfiComponentNameProtocolGuid, > &gEmptyDriverComponentName, > &gEfiComponentName2ProtocolGuid, >&gEmptyDriverComponentName2, > NULL > ); > if (EFI_ERROR (Status)) { > return Status; > } > > // > // Uninstall Driver Supported EFI Version Protocol onto ImageHandle > // > Status =3D gBS->UninstallMultipleProtocolInterfaces ( > ImageHandle, > &gEfiDriverSupportedEfiVersionProtocolGuid, >&gEmptyDriverDriverSupportedEfiVersion, > NULL > ); > if (EFI_ERROR (Status)) { > return Status; > } > > // > // Do any additional cleanup that is required for this driver > // > > return EFI_SUCCESS; >} > >/** > This is the declaration of an EFI image entry point. This entry point is > the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers >including > both device drivers and bus drivers. > > @param ImageHandle The firmware allocated handle for the UEFI >image. > @param SystemTable A pointer to the EFI System Table. > > @retval EFI_SUCCESS The operation completed successfully. > @retval Others An unexpected error occurred. >**/ >EFI_STATUS >EFIAPI >EmptyDriverDriverEntryPoint ( > IN EFI_HANDLE ImageHandle, > IN EFI_SYSTEM_TABLE *SystemTable > ) >{ >//#pragma warning(disable:4101) > // #pragma warning(disable:4189) >EFI_DEVICE_PATH *DevicePath; > >EFI_HANDLE DriverHandle, *Handles =3D NULL; >UINTN HandleCount =3D 0, Index =3D 0; >EFI_GUID gsguid =3D EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; >EFI_SIMPLE_FILE_SYSTEM_PROTOCOL* Volume; >EFI_FILE_HANDLE Root; >CHAR16 *DeviceStr =3D NULL; >//EFI_BOOT_SERVICES *BS =3D NULL; > > DEBUG ((EFI_D_INFO, "[EmptyDriver] About to start empty driver \r\n") = ); >EFI_STATUS Status; > > //BS =3D SystemTable->BootServices; > MainImageHandle =3D ImageHandle; > > > Status =3D EFI_SUCCESS; > > // > // Install UEFI Driver Model protocol(s). > // > Status =3D EfiLibInstallDriverBindingComponentName2 ( > ImageHandle, > SystemTable, > &gEmptyDriverDriverBinding, > ImageHandle, > &gEmptyDriverComponentName, > &gEmptyDriverComponentName2 > ); > ASSERT_EFI_ERROR (Status); > > // > // Install Driver Supported EFI Version Protocol onto ImageHandle > // > Status =3D gBS->InstallMultipleProtocolInterfaces ( > &ImageHandle, > &gEfiDriverSupportedEfiVersionProtocolGuid, >&gEmptyDriverDriverSupportedEfiVersion, > NULL > ); > ASSERT_EFI_ERROR (Status); > > Status =3D gBS->LocateHandleBuffer(ByProtocol, &gsguid, >NULL, &HandleCount, &Handles); > ASSERT_EFI_ERROR (Status); > > for (Index =3D 0; Index < HandleCount; Index++) { >// Note: The Device Path obtained from DevicePathFromHandle() should NOT >be >freed! >DevicePath =3D DevicePathFromHandle(Handles[Index]); >DeviceStr =3D ConvertDevicePathToText(DevicePath, FALSE, FALSE); >//DeviceStr =3D DevicePathToStr(DevicePath); >if (DevicePathSubType(DevicePath) !=3D HW_MEMMAP_DP) { >continue; >} >else { >break; >} >} >DEBUG ((EFI_D_ERROR, "About to load file \r\n") ); >/* >if (Index >=3D HandleCount) { >Status =3D EFI_NOT_FOUND; >goto out; >} >*/ >Status =3D gBS->LocateHandleBuffer(ByProtocol, >&gsguid, >NULL, >&HandleCount, >&Handles); >if (EFI_ERROR(Status)) { >goto out; >} >Status =3D gBS->HandleProtocol( >Handles[1], >&gsguid, >(void**)&Volume); >Root =3D NULL; >Status =3D Volume->OpenVolume(Volume, &Root); > if ((EFI_ERROR(Status)) || (Root =3D=3D NULL)) { >goto out; >} >DevicePath =3D FileDevicePath(Handles[1], FileMemPath); >if (DevicePath =3D=3D NULL) { >Status =3D EFI_DEVICE_ERROR; >goto out; >} >Status =3D gBS->LoadImage(FALSE, ImageHandle, DevicePath, NULL, 0, >&DriverHandle); >SafeFree(DevicePath); >if (EFI_ERROR(Status)) { >goto out; >} >Status =3D gBS->StartImage(DriverHandle, NULL, NULL); >if (EFI_ERROR(Status)) { >goto out; >} > >out: >SafeFree(Handles); > > return Status; >} > >/** > Tests to see if this driver supports a given controller. If a child >device is provided, > it further tests to see if this driver supports creating a handle for th= e >specified child device. > > This function checks to see if the driver specified by This supports the >device specified by > ControllerHandle. Drivers will typically use the device path attached to > ControllerHandle and/or the services from the bus I/O abstraction >attached to > ControllerHandle to determine if the driver supports ControllerHandle. >This function > may be called many times during platform initialization. In order to >reduce boot times, the tests > performed by this function must be very small, and take as little time a= s >possible to execute. This > function must not change the state of any hardware devices, and this >function must be aware that the > device specified by ControllerHandle may already be managed by the same >driver or a > different driver. This function must match its calls to AllocatePages() >with FreePages(), > AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). > Because ControllerHandle may have been previously started by the same >driver, if a protocol is > already in the opened state, then it must not be closed with >CloseProtocol(). This is required > to guarantee the state of ControllerHandle is not modified by this >function. > > @param[in] This A pointer to the >EFI_DRIVER_BINDING_PROTOCOL instance. > @param[in] ControllerHandle The handle of the controller to test. >This handle > must support a protocol interface that >supplies > an I/O abstraction to the driver. > @param[in] RemainingDevicePath A pointer to the remaining portion of a >device path. This > parameter is ignored by device drivers, >and is optional for bus > drivers. For bus drivers, if this >parameter is not NULL, then > the bus driver must determine if the bu= s >controller specified > by ControllerHandle and the child >controller specified > by RemainingDevicePath are both >supported by this > bus driver. > > @retval EFI_SUCCESS The device specified by ControllerHandl= e >and > RemainingDevicePath is supported by the >driver specified by This. > @retval EFI_ALREADY_STARTED The device specified by ControllerHandl= e >and > RemainingDevicePath is already being >managed by the driver > specified by This. > @retval EFI_ACCESS_DENIED The device specified by ControllerHandl= e >and > RemainingDevicePath is already being >managed by a different > driver or an application that requires >exclusive access. > Currently not implemented. > @retval EFI_UNSUPPORTED The device specified by ControllerHandl= e >and > RemainingDevicePath is not supported by >the driver specified by This. >**/ >EFI_STATUS >EFIAPI >EmptyDriverDriverBindingSupported ( > IN EFI_DRIVER_BINDING_PROTOCOL *This, > IN EFI_HANDLE ControllerHandle, > IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > ) >{ > > EFI_STATUS Status; >EFI_SERIAL_IO_PROTOCOL *SerialIo; >Status =3D gBS->OpenProtocol ( >ControllerHandle, >&gEfiSerialIoProtocolGuid, >(VOID **) &SerialIo, >This->DriverBindingHandle, >ControllerHandle, >EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE >); >if (EFI_ERROR (Status)) { >DEBUG ((EFI_D_INFO, "[EmptyDriver] Not Supported \r\n") ); >return Status; // Bail out if OpenProtocol returns an error >} >// We're here because OpenProtocol was a success, so clean up >gBS->CloseProtocol ( >ControllerHandle, >&gEfiSerialIoProtocolGuid, >This->DriverBindingHandle, >ControllerHandle >); > >DEBUG ((EFI_D_INFO,"[MyWizardDriver] Supported SUCCESS\r\n") ); >return EFI_SUCCESS; > > > > > //return EFI_UNSUPPORTED; >} > >/** > Starts a device controller or a bus controller. > > The Start() function is designed to be invoked from the EFI boot service >ConnectController(). > As a result, much of the error checking on the parameters to Start() has >been moved into this > common boot service. It is legal to call Start() from other locations, > but the following calling restrictions must be followed, or the system >behavior will not be deterministic. > 1. ControllerHandle must be a valid EFI_HANDLE. > 2. If RemainingDevicePath is not NULL, then it must be a pointer to a >naturally aligned > EFI_DEVICE_PATH_PROTOCOL. > 3. Prior to calling Start(), the Supported() function for the driver >specified by This must > have been called with the same calling parameters, and Supported() >must have returned EFI_SUCCESS. > > @param[in] This A pointer to the >EFI_DRIVER_BINDING_PROTOCOL instance. > @param[in] ControllerHandle The handle of the controller to start. >This handle > must support a protocol interface that >supplies > an I/O abstraction to the driver. > @param[in] RemainingDevicePath A pointer to the remaining portion of a >device path. This > parameter is ignored by device drivers, >and is optional for bus > drivers. For a bus driver, if this >parameter is NULL, then handles > for all the children of Controller are >created by this driver. > If this parameter is not NULL and the >first Device Path Node is > not the End of Device Path Node, then >only the handle for the > child device specified by the first >Device Path Node of > RemainingDevicePath is created by this >driver. > If the first Device Path Node of >RemainingDevicePath is > the End of Device Path Node, no child >handle is created by this > driver. > > @retval EFI_SUCCESS The device was started. > @retval EFI_DEVICE_ERROR The device could not be started due to = a >device error.Currently not implemented. > @retval EFI_OUT_OF_RESOURCES The request could not be completed >due >to a lack of resources. > @retval Others The driver failded to start the device. > >**/ >EFI_STATUS >EFIAPI >EmptyDriverDriverBindingStart ( > IN EFI_DRIVER_BINDING_PROTOCOL *This, > IN EFI_HANDLE ControllerHandle, > IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > ) >{ > return EFI_UNSUPPORTED; >} > >/** > Stops a device controller or a bus controller. > > The Stop() function is designed to be invoked from the EFI boot service >DisconnectController(). > As a result, much of the error checking on the parameters to Stop() has >been moved > into this common boot service. It is legal to call Stop() from other >locations, > but the following calling restrictions must be followed, or the system >behavior will not be deterministic. > 1. ControllerHandle must be a valid EFI_HANDLE that was used on a >previous call to this > same driver's Start() function. > 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a >valid > EFI_HANDLE. In addition, all of these handles must have been created >in this driver's > Start() function, and the Start() function must have called >OpenProtocol() on > ControllerHandle with an Attribute of >EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. > > @param[in] This A pointer to the >EFI_DRIVER_BINDING_PROTOCOL instance. > @param[in] ControllerHandle A handle to the device being stopped. The >handle must > support a bus specific I/O protocol for th= e >driver > to use to stop the device. > @param[in] NumberOfChildren The number of child device handles in >ChildHandleBuffer. > @param[in] ChildHandleBuffer An array of child handles to be freed. May >be NULL > if NumberOfChildren is 0. > > @retval EFI_SUCCESS The device was stopped. > @retval EFI_DEVICE_ERROR The device could not be stopped due to a >device error. > >**/ >EFI_STATUS >EFIAPI >EmptyDriverDriverBindingStop ( > IN EFI_DRIVER_BINDING_PROTOCOL *This, > IN EFI_HANDLE ControllerHandle, > IN UINTN NumberOfChildren, > IN EFI_HANDLE *ChildHandleBuffer OPTIONAL > ) >{ > return EFI_UNSUPPORTED; >} >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel