之前学习的lk阶段点亮LCD的流程算是比较经典,但是高通已经推出了很多种基于UEFI方案的启动架构。
所以需要对这块比较新的技术进行学习。
同事遇到了一个UEFI阶段LCD显示异常,而kernel正常的问题;但我解决不了。
分析在高通UEFI架构中,通过Protocol来调用对应的功能。因此实际上的函数调用并不是显式的,而是包裹在Protocol中进行。
高通UEFI显示有关的文件有:
BOOT.XF.4.1/boot_images/QcomPkg/Drivers/displayDxe/displayDxe.cBOOT.XF.4.1/boot_images/QcomPkg/Application/QcomChargerApp/QcomChargerAppdisplay.cBOOT.XF.4.1/boot_images/QcomPkg/Application/QcomChargerApp/QcomChargerAppdisplay.hBOOT.XF.4.1/boot_images/QcomPkg/Drivers/displayDxe/displayDxe.cBOOT.XF.4.1/boot_images/QcomPkg/Drivers/displayDxe/displayDxe.hBOOT.XF.4.1/boot_images/QcomPkg/Drivers/displayDxe/displayDxe.infBOOT.XF.4.1/boot_images/QcomPkg/Drivers/displayDxe/displayPwrCtrlProtocol.cBOOT.XF.4.1/boot_images/QcomPkg/Drivers/displayDxe/displayPwrProtocol.c BOOT.XF.4.1/boot_images/QcomPkg/Include/library/Bootdisplay.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/displaylib.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/displayUtils.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/ExternaldisplayDriver.hBOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayPwr.hBOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayPwrCtrl.hBOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayUtils.h BOOT.XF.4.1/boot_images/QcomPkg/library/Bootdisplaylib/Bootdisplay.cBOOT.XF.4.1/boot_images/QcomPkg/library/Bootdisplaylib/Bootdisplaylib.infBOOT.XF.4.1/boot_images/QcomPkg/library/displaylib/displaylib.cBOOT.XF.4.1/boot_images/QcomPkg/library/displaylib/displaylib.infBOOT.XF.4.1/boot_images/QcomPkg/library/Externaldisplaylib/Extdisplay_driver.cBOOT.XF.4.1/boot_images/QcomPkg/library/Externaldisplaylib/Externaldisplaylib.decBOOT.XF.4.1/boot_images/QcomPkg/library/Externaldisplaylib/Externaldisplaylib.infBOOT.XF.4.1/boot_images/QcomPkg/library/Externaldisplaylib/ExternaldisplaylibStub.infBOOT.XF.4.1/boot_images/QcomPkg/Include/library/HALMdplib.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/Mdplib.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/MDPperipherals.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/MDPPlatformlib.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/MDPSystem.hBOOT.XF.4.1/boot_images/QcomPkg/Include/library/MDPTypes.hBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/displayUtils.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPClocks.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPClocksBoot.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPConfig.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPEDID.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/Mdplib.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/Mdplib.infBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MdplibBoot.infBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/Mdplib_i.hBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPPanel.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPperipherals.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPSystem.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPSystemBoot.cBOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/MDPVersion.cBOOT.XF.4.1/boot_images/QcomPkg/library/Nulllibs/MDPPlatformlibNull/MDPPlatformlibNull.cBOOT.XF.4.1/boot_images/QcomPkg/library/Nulllibs/MDPPlatformlibNull/MDPPlatformlibNull.infBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/AgattiPkg/library/MDPPlatformlib/MDPPlatformlib.cBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/AgattiPkg/library/MDPPlatformlib/MDPPlatformlib.infBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/AgattiPkg/library/MDPPlatformlib/MDPPlatformlibPanelCommon.cBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/AgattiPkg/library/MDPPlatformlib/MDPPlatformlibPanelCommon.hBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/AgattiPkg/library/MDPPlatformlib/MDPPlatformlibPanelConfig.hBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/AgattiPkg/library/MDPPlatformlibBoot/MDPPlatformlib.cBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/AgattiPkg/library/MDPPlatformlibBoot/MDPPlatformlibBoot.infBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/library/MDPPlatformlib/MDPPlatformlib.cBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/library/MDPPlatformlib/MDPPlatformlib.infBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/library/MDPPlatformlib/MDPPlatformlibPanelCommon.cBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/library/MDPPlatformlib/MDPPlatformlibPanelCommon.hBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/library/MDPPlatformlib/MDPPlatformlibPanelConfig.hBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/library/MDPPlatformlibBoot/MDPPlatformlib.cBOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/library/MDPPlatformlibBoot/MDPPlatformlibBoot.inf
对外的Protocol有关文件:
BOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayPwr.hBOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayPwrCtrl.hBOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayUtils.h
Protocol接口学习UEFI,比较关键的是:
0、了解UEFI是如何实现的
1、了解XXX_PROTOCol
定义中有什么接口可以使用:方便我们找到实现的原型
2、找到对应的XXX_PROTOCol_GUID
是多少:方便我们找到哪里调用了对应的接口
路径:BOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayPwr.h
声明了对应的EFI_disPLAY_POWER_PROTOCol_GUID,但没有调用。
/* Protocol GUID deFinition *//** @ingroup efi_displayPwr_protocol */#define EFI_disPLAY_POWER_PROTOCol_GUID \ {0xf352021d, 0x9593, 0x4432, {0xbf, 0x4, 0x67, 0xb9, 0xf3, 0xb7, 0x60, 0x8}}/*=========================================================================== PROTOCol INTERFACE===========================================================================*//** @ingroup efi_displayUtils_protocol @par Summary Qualcomm display Utils Protocol interface. @par Parameters @inputprotoparams{} */struct _EFI_QCOM_disPLAY_UTILS_PROTOCol{ UINT64 Revision; EFI_disPLAY_UTILS_SET_PROPERTY displayUtilsSetProperty; EFI_disPLAY_UTILS_GET_PROPERTY displayUtilsGetProperty; EFI_disPLAY_UTILS_RENDER_logo displayUtilsRenderlogo; EFI_disPLAY_UTILS_SET_MODE displayUtilsSetMode; EFI_disPLAY_UTILS_SET_VARIABLE displayUtilsSetvariable; EFI_disPLAY_UTILS_GET_VARIABLE displayUtilsGetvariable;};
EFIdisplayPwrCtrl.h路径:BOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayPwrCtrl.h
这里的接口并没有被AP侧调用,甚至都没有声明。
/* Protocol GUID deFinition *//** @ingroup efi_displayPwrCtrl_protocol */#define EFI_disPLAYPWRCTRL_PROTOCol_GUID \ {0x7bfa4293, 0x7aa4, 0x4375, {0xb6, 0x3c, 0xb6, 0xaa, 0xb7, 0x86, 0xc4, 0x3c}}// {68C3B70D-0F96-4006-99F6-0FD211F5F2B2}#define EFI_UI_ACTIVE_EVENT_GUID \ { 0x68c3b70d, 0xf96, 0x4006, { 0x99, 0xf6, 0xf, 0xd2, 0x11, 0xf5, 0xf2, 0xb2 } };// {30D39942-9556-4887-A943-BC63805D9D43}#define EFI_UI_IDLE_EVENT_GUID \ {0x30d39942, 0x9556, 0x4887, { 0xa9, 0x43, 0xbc, 0x63, 0x80, 0x5d, 0x9d, 0x43 }};/*=========================================================================== PROTOCol INTERFACE===========================================================================*//** @ingroup efi_displayPwrCtrl_protocol @par Summary Qualcomm display Power Control Protocol interface. @par Parameters @inputprotoparams{} */struct _EFI_QCOM_disPLAY_PWR_CTRL_PROTOCol{ UINT64 Revision; EFI_disPLAY_PANEL_POWER_CONTRol displayPanelPowerControl; EFI_disPLAY_PANEL_POWER_STATUS displayPanelPowerStatus; EFI_disPLAY_BACKliGHT_BRIGHTnesS_LEVEL_CONTRol displayBacklightBrightnessLevelControl; EFI_disPLAY_BACKliGHT_BRIGHTnesS_LEVEL_STATUS displayBacklightBrightnessLevelStatus;};
EFIdisplayUtils.h路径:BOOT.XF.4.1/boot_images/QcomPkg/Include/Protocol/EFIdisplayUtils.h
/* Protocol GUID deFinition *//** @ingroup efi_displayUtils_protocol */// {c0dd69ac-76ba-11e6-ab24-1fc7f5575f19}#define EFI_disPLAYUTILS_PROTOCol_GUID \ {0xc0dd69ac, 0x76ba, 0x11e6, {0xab, 0x24, 0x1f, 0xc7, 0xf5, 0x57, 0x5f, 0x19}}/** Protocol declaration.*/typedef struct _EFI_QCOM_disPLAY_UTILS_PROTOCol EFI_QCOM_disPLAY_UTILS_PROTOCol;/** display Utils property types*/typedef enum{ EFI_disPLAY_UTILS_DEVICE_TREE_ADDR = 0x0, /**< Device tree base address: (Type: VOID*) */ EFI_disPLAY_UTILS_PANEL_OVERRIDE, /**< Panel overrIDe string (Type: CHAR8*) */ EFI_disPLAY_UTILS_SUPPORTED_PANELS, /**< Newline separated List of supported panels (Type: CHAR16*) */ EFI_disPLAY_UTILS_PANEL_CONfig, /**< Panel raw configuration */ EFI_disPLAY_UTILS_DYNAMIC_REFRESH, /**< Dynamic refresh settings (Type: UINT32*) */} EFI_disPLAY_UTILS_PROPERTY_TYPE;/*=========================================================================== PROTOCol INTERFACE===========================================================================*//** @ingroup efi_displayUtils_protocol @par Summary Qualcomm display Utils Protocol interface. @par Parameters @inputprotoparams{} */struct _EFI_QCOM_disPLAY_UTILS_PROTOCol{ UINT64 Revision; EFI_disPLAY_UTILS_SET_PROPERTY displayUtilsSetProperty; EFI_disPLAY_UTILS_GET_PROPERTY displayUtilsGetProperty; EFI_disPLAY_UTILS_RENDER_logo displayUtilsRenderlogo; EFI_disPLAY_UTILS_SET_MODE displayUtilsSetMode; EFI_disPLAY_UTILS_SET_VARIABLE displayUtilsSetvariable; EFI_disPLAY_UTILS_GET_VARIABLE displayUtilsGetvariable;};
EFI_disPLAYUTILS_PROTOCol_GUID
在AP侧中的FASTBOOT模式被调用了,用于判断是否支持显示画面。
bootable/bootloader/edk2/QcomModulePkg/library/Fastbootlib/FastbootCmds.c
STATIC UINT8is_display_supported ( VOID ){ EFI_STATUS Status = EFI_SUCCESS; EfiQcomdisplayUtilsProtocol *pdisplayUtilProtocol; EFI_GUID displayUtilGUID = EFI_disPLAYUTILS_PROTOCol_GUID; EFI_disPLAY_UTILS_PANEL_CONfig_ParaMS PanelConfig; UINT32 Index = 0; UINT32 ParamSize = sizeof (PanelConfig); PanelConfig.uPanelindex = Index; if (EFI_SUCCESS == gBS->LocateProtocol (&displayUtilGUID, NulL, (VOID **)&pdisplayUtilProtocol)) { Status = pdisplayUtilProtocol->displayUtilsGetProperty ( EFI_disPLAY_UTILS_PANEL_CONfig, (VOID*)&PanelConfig, &ParamSize); if ( Status == EFI_NOT_FOUND ) { DEBUG ((EFI_D_VERBOSE, "display is not supported\n")); return 0; } } DEBUG ((EFI_D_VERBOSE, "display is enabled\n")); return 1;}
对应接口的实现下面我们具体看看EFI_QCOM_disPLAY_UTILS_PROTOCol
这个实现。
BOOT.XF.4.1/boot_images/QcomPkg/library/Mdplib/displayUtils.c
/* display Utils Protocol Implementation */EFI_QCOM_disPLAY_UTILS_PROTOCol gQcomdisplayUtilsProtocolimplementation = { disPLAY_UTILS_REVISION, display_Utils_SetProperty, display_Utils_GetProperty, display_Utils_Renderlogo, display_Utils_SetMode, display_Utils_Setvariable, display_Utils_Getvariable};
执行流程displayDxeInitialize显示驱动执环境的初始化
BOOT.XF.4.1\boot_images\QcomPkg\Drivers\displayDxe\displayDxe.c
/********************************************************************************************************************** Public APIs**//** Initialize the state information for the display Dxe @param ImageHandle of the loaded driver @param Systemtable Pointer to the System table @retval EFI_SUCCESS Protocol registered @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure @retval EFI_DEVICE_ERROR HarDWare problems**/EFI_STATUSEFIAPIdisplayDxeInitialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYstem_table *Systemtable){ EFI_STATUS eStatus = EFI_SUCCESS; EFI_GUID sOutputGUID = EFI_GRAPHICS_OUTPUT_PROTOCol_GUID; EFI_HANDLE hUEFIdisplayHandle = NulL; MDP_InitParamsType sInitParam; EFI_GUID UIActiveEventGuID = EFI_UI_ACTIVE_EVENT_GUID; EFI_GUID UIIDleEventGuID = EFI_UI_IDLE_EVENT_GUID; // Clear out global structures MDP_OSAL_MEMZERO(&gModeInfo, sizeof(displayDxe_ModeInfo)); MDP_OSAL_MEMZERO(&sInitParam, sizeof(MDP_InitParamsType)); /* Register for an ExitBootServicesEvent */ // 创建了一些事件(略): 创建一个事件,然后设定一个条件,使得条件满足的时候就执行这个事件 // ... // 初始化有关的 时钟、电源 if (EFI_SUCCESS != displayPwr_InitLPMSupport(TRUE)) { DEBUG((EFI_D_WARN, "displayDxe: Failed to register LPM CB!\n")); } // Initialize Apps BootLoader (ABL) interface // It checks for panel overrIDe, if any, set by ABL and sets up parameters which will be used by MDPInit if (MDP_STATUS_OK != MDPSetProperty(MDP_disPLAY_PRIMARY, MDP_disPLAY_PROPERTY_ABL_INTERFACE_INIT, NulL)) { DEBUG((EFI_D_INFO, "displayDxe: Failed to initialize ABL!\n")); } // Initialize the MDP if (MDP_STATUS_OK != MDPInit(&sInitParam, MDP_INIT_FLAG_MMU_INIT)) { DEBUG ((EFI_D_INFO, "displayDxe: MDP init Failed!\n")); eStatus = EFI_DEVICE_ERROR; } else { MDP_PowerParamsType sPowerParams; MDP_DetectParamType sDetectParams; MDP_PropertIEsParamType sdisplayProp; MDP_OSAL_MEMZERO(&sdisplayProp, sizeof(MDP_PropertIEsParamType)); MDP_OSAL_MEMZERO(&sPowerParams, sizeof(MDP_PowerParamsType)); sPowerParams.bPowerOn = TRUE; sdisplayProp.bdisplayPwrState = TRUE; ////////////////// // Main display // ////////////////// // If the primary is supported initialize it if (TRUE == sInitParam.aSupporteddisplays[MDP_disPLAY_PRIMARY]) { if (MDP_STATUS_OK != MDPPower(MDP_disPLAY_PRIMARY, &sPowerParams, 0x0)) { DEBUG ((EFI_D_INFO, "displayDxe: Primary panel power up Failed!\n")); } else { MDP_OSAL_MEMZERO(&sDetectParams, sizeof(MDP_DetectParamType)); // Default reporting of primary display if (MDP_STATUS_OK != MDPDetect(MDP_disPLAY_PRIMARY, &sDetectParams, 0x0)) { eStatus = EFI_DEVICE_ERROR; } else if (TRUE == sDetectParams.bdisplayDetected) { eStatus = displayDxeSelectMode(MDP_disPLAY_PRIMARY, &sDetectParams); // Set the primary display to on if (MDP_STATUS_OK != MDPSetProperty(MDP_disPLAY_PRIMARY, MDP_disPLAY_PROPERTY_POWER_STATE, &sdisplayProp)) { eStatus = EFI_DEVICE_ERROR; } } } } // If we not have detected a valID mode on both primary and external display report error if ((0 == gModeInfo.uNumModes[MDP_disPLAY_PRIMARY]) && (0 == gModeInfo.uNumModes[MDP_disPLAY_EXTERNAL])) { eStatus = EFI_DEVICE_ERROR; } else { // Default at some dummy mode gModeInfo.sCurrentModeInfo.Version = GRAPHICS_OUTPUT_PROTOCol_REVISION; gModeInfo.sCurrentModeInfo.PixelFormat = disPLAYDXE_DEFAulT_PIXEL_FORMAT; gModeInfo.sCurrentModeInfo.HorizontalResolution = 0; gModeInfo.sCurrentModeInfo.VerticalResolution = 0; gModeInfo.sCurrentModeInfo.Pixelinformation.RedMask = disPLAYDXE_RED_MASK; gModeInfo.sCurrentModeInfo.Pixelinformation.GreenMask = disPLAYDXE_GREEN_MASK; gModeInfo.sCurrentModeInfo.Pixelinformation.BlueMask = disPLAYDXE_BLUE_MASK; gModeInfo.sCurrentModeInfo.Pixelinformation.ReservedMask = disPLAYDXE_Alpha_MASK; gModeInfo.sCurrentModeInfo.PixelsPerScanline = 0; // Setup the protocol information, set the current mode to an invalID mode forcing a set mode gModeInfo.sProtocolinfo.MaxMode = 1; gModeInfo.sProtocolinfo.Mode = (UINT32)-1; gModeInfo.sProtocolinfo.SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_informatION); gModeInfo.sProtocolinfo.Info = &gModeInfo.sCurrentModeInfo; gModeInfo.bExtSupported = sInitParam.aSupporteddisplays[MDP_disPLAY_EXTERNAL]; // Install display protocols only if panel is detected. // Make a new handle with EFI Graphics Protocol if (EFI_SUCCESS != (eStatus = gBS->InstallMultipleProtocolinterfaces (&hUEFIdisplayHandle, &gEfIDevicePathProtocolGuID, &displayDevicePath, &sOutputGUID, &gdisplayDxeOutputProtocol, &gQcomdisplayPwrCtrlProtocolGuID, &gdisplayPwrCtrlProtocolimplementation, &gEfidisplayPowerStateProtocolGuID, &gdisplayPwrProtocolimplementation, &gQcomdisplayUtilsProtocolGuID, &gQcomdisplayUtilsProtocolimplementation, NulL))) { DEBUG ((EFI_D_INFO, "displayDxe: InstallMultipleProtocolinterfaces Failed!\n")); } } } if (eStatus == EFI_SUCCESS) { if(EFI_SUCCESS != GetConfigValue ("EnabledisplayThread", &gModeInfo.uMultiThreadded)) { gModeInfo.uMultiThreadded = 0; } // Spawn off thread to enable mode set if we are in a threadded environment if (gModeInfo.uMultiThreadded ) { InitLock ("dispInit", &gModeInfo.hModeLock); if(InitLock == NulL) { // If single cpu core is configured, the priority of this thread should be higher than UEFI dxe thread if (NulL != (gModeInfo.hdispThread = ThreadCreate ("disp", &SetModeThread, 0, UEFI_THREAD_PRIORITY + 1, DEFAulT_STACK_SIZE * 3))) { if (MDP_STATUS_OK != MDP_SetMultiThreadState(TRUE)) { DEBUG ((EFI_D_WARN, "displayDxe: Failed to set multiThread state to be enabled!\n")); // disable multi threadding gModeInfo.uMultiThreadded = 0; } else { ThreadDetach (gModeInfo.hdispThread); ThreadResume (gModeInfo.hdispThread); } } else { // disable multi threadding gModeInfo.uMultiThreadded = 0; } } else { // disable multi threadding gModeInfo.uMultiThreadded = 0; } } } return eStatus;}
todo
总结以上是内存溢出为你收集整理的todo高通Android UEFI中的LCD分析(1):启动流程分析全部内容,希望文章能够帮你解决todo高通Android UEFI中的LCD分析(1):启动流程分析所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)