SMEM介绍
SMEM :shared memory,是高通平臺(tái)各子系統(tǒng)共享信息的一種機(jī)制,通過SMEM機(jī)制,PBL可以將信息傳遞給SBL1,SBL1可以將信息傳遞給RPM、LK。下面分析一個(gè)SMEM信息傳遞的具體實(shí)現(xiàn)過程。
?
1 Platform id信息
SBL1會(huì)將board level platform id信息通過SMEM機(jī)制保存,LK在啟動(dòng)過程中會(huì)自動(dòng)platform detect,檢測當(dāng)前平臺(tái)board infor信息,根據(jù)檢測到的board infor加載相應(yīng)的device tree
?
SBL1:從emmc中讀取platform id等CDT信息,并保存到約定的smem中
voidboot_config_data_table_init(bl_shared_data_type* bl_shared_data)
{
? /*populate configuration data table's info*/
? config_data_table_info.size =config_data_table_size;
? config_data_table_info.cdt_ptr =config_data_table; //platform id & ddr default parameter
?
?boot_update_config_data_table(&config_data_table_info);
?
? /*put a pointer to the table info into sblshared data so next sbl can access it*/
?bl_shared_data->sbl_shared_data->config_data_table_info =&config_data_table_info;
}
?
LK通過讀取smem獲取platform infor信息
static void platform_detect()
{
????????????? ret= smem_read_alloc_entry(SMEM_BOARD_INFO_LOCATION,
??????????????????????????? &board_info_v8,
??????????????????????????? board_info_len);
?
????????????? board.platform= board_info_v8.board_info_v3.msm_id;
????????????? board.platform_version= board_info_v8.board_info_v3.msm_version;
????????????? board.platform_hw= board_info_v8.board_info_v3.hw_platform;
????????????? board.platform_subtype= board_info_v8.platform_subtype;
}
?
同理,SBL1可通過SMEM將DDR default parameter傳遞給RPM,當(dāng)然也可以將OEM定制信息通過SMEM保存,在啟動(dòng)階段根據(jù)不同OEM信息進(jìn)行相應(yīng)的特制化。
?
?
2 如何在SBL1和LK間通過SMEM傳遞客制化信息
step1. Add a new enum (i.e?SMEM_OEM_MAGIC_INFO = XXX)in?smem_mem_type?
?
step 2. After the?boot_smem_init() is called, you use?smem_alloc()?to allocate the SMEM space for your data,i.e:
- smem_oem_magic_ptr = (uint32 *) smem_alloc( SMEM_OEM_MAGIC_INFO, sizeof(uint32));
step3. On lk side add a new enum (i.e?SMEM_OEM_MAGIC_INFO =XXX) in?smem_mem_type_t
?
step4. In lk code, you can usethe?smem_read_alloc_entry()?to read data which is passed from SBL1,i.e:
- smem_read_alloc_entry( SMEM_OEM_MAGIC_INFO,&apps_oem_magic_info, sizeof(?uint32));
總結(jié)
- 上一篇: msm8916 dt选用规则
- 下一篇: 简谈高通Trustzone的实现