SMEM介绍

SMEM :shared memory,是高通平台各子系统共享信息的一种机制,通过SMEM机制,PBL可以将信息传递给SBL1,SBL1可以将信息传递给RPM、LK。下面分析一个SMEM信息传递的具体实现过程。

 

1 Platform id信息

SBL1会将board level platform id信息通过SMEM机制保存,LK在启动过程中会自动platform detect,检测当前平台board infor信息,根据检测到的board infor加载相应的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,当然也可以将OEM定制信息通过SMEM保存,在启动阶段根据不同OEM信息进行相应的特制化。

 

 

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));

 

 

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值