您的位置:首页 > 产品设计 > UI/UE

Cstyle的UEFI导读之Load File Driver Protocol

2013-05-06 20:32 369 查看
    UEFI是通过UEFI Boot Manager来引导操作系统的,而UEFI Boot Manager通常会用到两个服务imple File System Protocol ,Load File Protocol。前者一般用在一些标准的设备中如USB, SCSI, and ATA等等,而且会作为默认的首先被UEFI Boot Manager尝试去引导操作系统的方法,如果失败就可能会使用后者。
    EFI_LOAD_FILE_PROTOCOL是遵循UEFI driver modle的,在UDK中的LoadFile.c中有参考的实现:

EFI_LOAD_FILE_PROTOCOL的实现:

1. Add global variable for the EFI_LOAD_FILE_PROTOCOL instance to LoadFile.c.
2. Implement the LoadFile() service in LoadFile.c.



typedef
EFI_STATUS
(EFIAPI *EFI_LOAD_FILE) (
    IN EFI_LOAD_FILE_PROTOCOL *This,
    IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
    IN BOOLEAN BootPolicy,    ---用来决定是普通的文件读取,还是被bootmanager用来读取boot selection引导操作系统
    IN OUT UINTN *BufferSize,
    IN VOID *Buffer OPTIONAL
);

从上面可以看出,最重要的工作在于实现LoadFile()服务,他可以屏蔽底层的数据是如何存储和实现的。

1. Verify that the FilePath represents a file accessible by this device.
2. Verify that the file specified by FilePath exists. If it does not exist, check BootPolicy to see if inexact FilePath is allowed.
3. Verify that Buffer is large enough to return the entire file by examining BufferSize parameter. If not large enough, place correct size in BufferSize and return EFI_BUFFER_TOO_SMALL

Ok,收工。
转载请注明出处Cstyle.z.zhou@gmail.com//http://blog.csdn.net/CStyle_0x007  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: