该系列文章总目录链接与各部分简介: Android Qcom Display学习(零)
https://www.guidgenerator.com/online-guid-generator.aspx
什么是UEFI
高通平台UEFI有关介绍
高通605平台屏调试(4):UEFI初始化流程
Android SDM660开机流程- UEFI XBL 代码流程分析
第一次接触到UEFI(Unified Extensible Firmware Interfacen ,统一可扩展固件接口)是实习的时候,主要是服务器的底层,当时以为只有服务器或者PC主机的Bootloader才是UEFI,现在也忘的差不多了,在高通平台上继续学习一下
高通UEFI主要分为XBL和ABL两部分组成。
XBL负责芯片驱动及充电等核心应用功能,XBL核心是none-HLOS boot_image代码的一部分,属于高通私有代码。
ABL包括芯片无关的应用,ABL则在开源Linux Android代码树里,负责Linux加载启动及fastboot等功能组件。
高通UEFI启动流程:SEC(安全验证) DXE(驱动执行环境) BDS(启动设备选择) RT(OS Loader)
Display
高通UEFI研究[五]
【Android SDM660源码分析】- 03 - UEFI XBL GraphicsOutput BMP图片显示流程
LCD Porting的原则:先点亮Kernel,再点亮UEFI。
amss/BOOT.XF.4.1/boot_images/QcomPkg/Drivers/DisplayDxe/DisplayDxe.inf DisplayDxe.c
amss/BOOT.XF.4.1/boot_images/QcomPkg/Library/MDPLib/MDPLib.c DisplayUtils.c
(1)ABL fastboot override list boverride
(2)XBL dynamic detect panel id bDetectPanel
(3)SW RENDER bSWRender 比如DISP_MODE_PANEL_NONE DISP_MODE_SKIP_BOOTLOADER
SetupPlatformPanelConfig判断是否是SW RENDER(3)或者override panel(1)或者default panel(2);
default panel中pDetectPanel = TRUE才触发DynamicDSIPanelDetection,(1)(3)有一个满足都不会执行
ENTRY_POINT = DisplayDxeInitialize
MDPSetProperty(MDP_DISPLAY_PRIMARY, MDP_DISPLAY_PROPERTY_ABL_INTERFACE_INIT, NULL)
Display_Utils_Initialize();/* 初始化ABL Later中Display的配置内容 */
checkTargetPanelSupport(); /* 获取支持的面板列表 */
MDPPlatformConfigure(MDP_DISPLAY_PRIMARY, MDPPLATFORM_CONFIG_GETPANELDTINFO, &sPlatformParams) ↓↓↓
CheckPanelOverride(); /* 检查是否fastboot oem panel name手动设置新的面板,默认不处理 bPanelOverride */
pDisplayContext->bOverride = ParsePanelOverrideCommand(panelOverrideStr, &pDisplayContext->sDisplayParams);↓↓↓
MDPInit(&sInitParam, MDP_INIT_FLAG_MMU_INIT) /* MDPInit获取当前屏的硬件配置和屏的信息 */
MDPPlatformConfigure(MDP_DISPLAY_PRIMARY, MDPPLATFORM_CONFIG_SW_RENDERER, &sPlatformParams) ↓↓↓
FALSE == bSWRender /* SW_RENERER模式是没有屏的情况下,使用了一个默认的最低配置 */
MDPPlatformConfigure(MDP_DISPLAY_PRIMARY, MDPPLATFORM_CONFIG_GETPLATFORMINFO, &sPlatformParams)
MDPPower(MDP_DISPLAY_PRIMARY, &sPowerParams, 0x0)
MDPPlatformConfigure(eDisplayId, MDPPLATFORM_CONFIG_POWERUP, &sPlatformParams)
pPanel_PowerUp(eDisplayId, &sPanelPowerCtrl)
pPanel_Peripheral_Power(eDisplayId, &sPanelPowerCtrl)
gBS->LocateProtocol(&gEfiTLMMProtocolGuid, NULL, (void **)&TLMMProtocol)
gBS->LocateProtocol(&gQcomPmicGpioProtocolGuid, NULL, (VOID **)&PmicGpioProtocol)
MDPDetect(MDP_DISPLAY_PRIMARY, &sDetectParams, 0x0)
MDPDetectPanel(eDisplayId, pDisplayInfo)
MDPPlatformConfigure(eDisplayId, MDPPLATFORM_CONFIG_GETPANELCONFIG, &sPlatformParams)
Display_Utils_SetPanelConfiguration(eSelectedPanel);
UpdatePanelConfiguration(eSelected, pConfigStr); /* 使用QcomTokenSpace GUID 配置全局变量 */
MDP_SetBootServiceVariable(DISPVAR_PANEL_CONFIGURATION, pConfigStr, AsciiStrLen(pConfigStr)+1, 0)/* 将字符串送给ABL */
amss/BOOT.XF.4.1/boot_images/QcomPkg/SocPkg/KamortaPkg/Library/MDPPlatformLib/MDPPlatformLib.c
基本所有Display相关的配置都是通过MDPPlatformConfigure这个函数去执行的,通过不同的MDPPlatformConfigType
MDPPlatformConfigure
ePlatformConfig = PlatformConfigRemap(&sPlatformInfo, eConfig); //SWRender Remap为MDPPLATFORM_CONFIG_BYPASS跳过硬件操作
ReadPlatformIDAndChipID(&sPlatformInfo.sEFIPlatformType, &sPlatformInfo.sEFIChipSetId, &sPlatformInfo.sEFIChipSetFamily)
MDP_Display_GetVariable_Integer (PANEL_OVERRIDE_STRINGNAME, &uPanelOverride) /* 修改 uPanelOverride可以实现固定panel */
MDPPLATFORM_CONFIG_GETPANELDTINFO:
PlatformDSIDetectParams *pPanelList = &uefiPanelList[0]; ↓↓↓
TRUE == bDetectPanel /* 如果之前检测过到屏幕则会跳过这个函数 这里也可以通过固定panel 确保在fastBootPanelList中*/
sPlatformPanel.eSelectedPanel = MDPPLATFORM_PANEL_FT8006M_720P_VIDEO;
else /* 如果没有识别过则需要动态检测 mipi读取panel id */
DynamicDSIPanelDetection(&sPlatformPanel, &uPanelID, pPanelList, uPanelCnt)
DSIDriver_MinimalInit() // DSI Init最小初始化
MDPPlatformConfigure(MDP_DISPLAY_PRIMARY, MDPPLATFORM_CONFIG_RESETPANEL, &sMDPPlatformParam)//Reset
pPlatformPanel->eSelectedPanel = pPanelList[uPanelIndex].eSelectedPanel;
log:
Going to call DynamicDSIPanelDetection
address:0x2 uRetryCount: 1, readSize:2, readback[0]=0xA5 readback[1]=0x0
expectedReadback[0]=0xA5 readback[0]=0xA5
detect successfully!
Detected panel id:00A50000
Detected panel is FT8006M 720P video
SelectedPanel=36
FindPanelIndex(&sPlatformPanel) /* 找到MDPPlatformPanelFunctionTable table 中的id,获取powerdown等函数 */
GetPanelXmlConfig(&sPlatformPanel) /* 获取xml中的内容 */
MDPPLATFORM_CONFIG_SW_RENDERER:
SetupPlatformPanelConfig(eDisplayId, &sPlatformPanel, &sPlatformInfo, &bDetectPanel);/* CDT:board id配置panel */
Panel_CheckOverride(eDisplayId, pPlatformPanel, pPlatformInfo) /* 根据fastBootPanelList 检测override */
ParsePanelOverrideCommand(panelOverrideStr, &pDisplayContext->sDisplayParams);
pStr = AsciiStrStr((char *) pOverride, PANEL_CMD_MARKER_PRIM);
/*panel override from ABL fastboot oem select-display-panel prim:jdi_1080p_video:sec:sharp_1080p_cmd */
AsciiStrnCpy(pDisplayParams->sPrimary.shortName,pStr, len);
pDisplayParams->sPrimary.psDTInfo = LookupPanelByName(pDisplayParams->sPrimary.shortName);/*fastBootPanelList*/
else
*pDetectPanel = TRUE; /* 如果没有被override,并且不是SW Render */
log:
DisplayDxe: SetupPlatformPanelConfig the pDetectPanel is true.
MDPPLATFORM_CONFIG_GETPLATFORMINFO:
MDP_OSAL_MEMCPY(&pPlatformParams->sPlatformInfo, &sPlatformInfo, sizeof(MDPPlatformInfo));/* 返回平台信息 */
MDPPLATFORM_CONFIG_POWERUP:
sMDPPlatformPanelFunction[sPlatformPanel.uSelectedPanelIndex].pPanel_PowerUp(eDisplayId, &sPanelPowerCtrl)
一些关键结构体
MDPPlatformPanelFunctionTable sMDPPlatformPanelFunction[MDPPLATFORM_PANEL_MAX] =
{
{
MDPPLATFORM_PANEL_HX8399_1080P_VIDEO, // ePanelSelected
"Panel_truly_ft8006m_720p_vid.xml", // pPanelXmlConfig
Panel_Default_PowerUp, // pPanel_PowerUp
Panel_Default_PowerDown, // pPanel_PowerDown
Panel_Default_Reset, // pPanel_Reset
Panel_Default_Peripheral_Power, // pPanel_Peripheral_Power
Panel_Default_Brightness_Enable, // pPanel_Brightness_Enable
Panel_Default_Brightness_Level // pPanel_Brightness_Level
},
typedef enum {
MDPPLATFORM_PANEL_NONE =0x0, /* No panel specified */
...
MDPPLATFORM_PANEL_FT8006M_720P_VIDEO, /* 36 */ /* FT8006M 720P video mode dsi panel */
MDPPLATFORM_PANEL_MAX
} MDPPlatformPanelType;
const PanelDTInfoType fastBootPanelList[] = // fastboot override 所支持的panel
{
/*ft8006m 720p video*/
PANEL_CREATE_ENTRY("ft8006m_720p_techstar_video", MDPPLATFORM_PANEL_FT8006M_720P_VIDEO,
"qcom,mdss_dsi_ft8006m_720p_techstar_video:", DISP_INTF_DSI, DISP_TOPOLOGY_CONFIG_NONE,
DISP_TIMING_CONFIG_NONE, PLL_OVERRIDE_NONE, DISP_MODE_SINGLE_DSI, DISP_MODE_SINGLE_DSI, DISP_MODE_SINGLE_DSI),
};
static PlatformDSIDetectParams uefiPanelList[] = {
{
{
0x06, // DSC READ, no parameters
0x05, // total number of retry on failures
{
{{0x02, 0x00}, // command with no parameters
{0xA5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // address to read ID1 1st parmeter
}
},
0x04, // Lane remap order {0, 1, 2, 3}
NULL, // pointer to the panel configuration
0, // uPanelCfgSize
MDPPLATFORM_PANEL_FT8006M_720P_VIDEO, // eSelectedPanel index
1 // set Clock now
},
{
0x06, // uCmdType
0x05, // total number of retry on failures
{
{{0xDA, 0x00},
{0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, // address to read ID1
{{0xDB, 0x00},
{0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, // address to read ID2
{{0xDC, 0x00},
{0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}} // address to read ID3
},
0x4, // Lane remap order {0, 1, 2, 3}
NULL, // psPanelCfg (panel configuration)
0, // uPanelCfgSize
MDPPLATFORM_PANEL_HX8399_1080P_VIDEO, // eSelectedPanel
1 // uFlags
},
},
uefiPanelList中的配置可以查阅DataSheet 关键字:RDID1: Read ID1等