高通平臺lcm型號通過cmdline向驅動傳遞引數的過程-module_param_string
阿新 • • 發佈:2019-02-14
高通平臺在lk裡識別的屏之後,會通過cmdline向核心傳遞引數
1 cat /proc/cmdline
mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_nt35532_fhd_video:1:none:cfg:single_dsi 2 drivers\video\msm\mdss\Mdss_mdp.c 在這個函式中用module_param_string來註冊引數module_param_string(panel, mdss_mdp_panel, MDSS_MAX_PANEL_LEN, 0);
展開這個巨集定義
__module_param_call的巨集定義為#define module_param_string(name, string, len, perm) \ static const struct kparam_string __param_string_##name \ = { len, string }; \ __module_param_call(MODULE_PARAM_PREFIX, name, \ ¶m_ops_string, \ .str = &__param_string_##name, perm, -1, 0);\ __MODULE_PARM_TYPE(name, "string")
根據這些巨集,最終展開的為#define __module_param_call(prefix, name, ops, arg, perm, level, flags) \ /* Default value instead of permissions? */ \ static const char __param_str_##name[] = prefix #name; \ static struct kernel_param __moduleparam_const __param_##name \ __used \ __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \ level, flags, { arg } }
kernel連線時會將param放到_param段中 MODULE_PARAM_PREFIX的巨集定義為static const char __param_str_panel[] = MODULE_PARAM_PREFIX panel; \ static struct kernel_param __moduleparam_const __param_panel \ __used __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) = { .name = __param_str_panel, .ops = ¶m_ops_string, .perm = VERIFY_OCTAL_PERMISSIONS(0), .level = -1, .flags = 0, .str = &__param_string_panel }
#ifdef MODULE
#define MODULE_PARAM_PREFIX /* empty */
#else
#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
#endif
是模組編譯的為空,不是模組編譯的話為 "模組名."檢視Makefile
obj-$(CONFIG_FB_MSM_MDSS) += mdss-mdp.o
可知模組名為mdss-mdp
所以kernel傳引數的時候,引數名為 mdss-mdp.panel
3 kernel對cmdline的解析
請參考http://blog.csdn.net/skyflying2012/article/details/41142801