abl如何调用xbl里面的protocol

参考:高通文档
How to use SMEM in ABL?
For previous platform, Android LK was used for bootloader, while in recent platforms
UEFI is used to replace the old Android LK bootloader.
There are two parts of UEFI modules, one is in boot_images which is called UEFI core;
another is in Linux Android open-source code which is called ABL. ABL is an application
of UEFI, so the protocols defined in UEFI core from ABL can be used directly to access
hardware information such as: DAL, SDCC, and so on.
Follow the following steps to get the information from SMEM set by XBLLoader:
Copy header file from boot_images to LA
boot_images/QcomPkg/SDM845Pkg/Include/smem_type.h ->
bootable/bootloader/edk2/ QcomModulePkg/Include/smem_type.h
boot_images/QcomPkg/Include/EFISmem.h ->
bootable/bootloader/edk2/QcomModulePkg/Include/ Protocol/EFISmem.h
Copy gEfiSMEMProtocolGuid from boot_images/QcomPkg/QcomPkg.dec to
bootable/bootloader/ edk2/QcomModulePkg/QcomModulePkg.dec

Shared Memory

gEfiSMEMProtocolGuid = { 0xf4e5c7d0, 0xd239, 0x47cb, { 0xaa, 0xcd, 0x7f,
0x66, 0xef, 0x76, 0x32, 0x38 } }
Use EFI_SMEM_PROTOCOL in ABL
#include <Protocol/EFISmem.h>
#include <smem_type.h>
STATIC UINT8 AccessSmem(UINT32 *Args){
EFI_SMEM_PROTOCOL *smemProtocol;
UINT32 *vendor0;
UINT32 size; EFI_STATUS Status;
Status = gBS->LocateProtocol(&gEfiSMEMProtocolGuid, NULL, (VOID **)
&smemProtocol); if (Status != EFI_SUCCESS){
DEBUG((EFI_D_ERROR, “Error locating the smem protocol\n”)); return
Status;}
status = smem_protocol->SmemGetAddr(SMEM_ID_VENDOR0, &size, (void
**)&vendor0); if(status != EFI_SUCCESS){
DEBUG((EFI_D_ERROR, “SmemGetAddr(SMEM_ID_VENDOR0) returned %d\n”,
status)); return status;}
return Status;}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值