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.
![](https://img-blog.csdn.net/20130506203114029)
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
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
相关文章推荐
- Cstyle的UEFI导读之UEFI Driver and Controller Name用Component Name Protocol实现
- Cstyle的UEFI导读之Mass Storage Driver Stack
- Cstyle的UEFI导读:第20.0篇 IGD OpRegion interface && IGD OpRegion PROTOCOL
- Cstyle的UEFI导读之Driver中的私有数据结构
- Cstyle的UEFI导读之USB Driver Stack
- Cstyle的UEFI导读之Text Console Driver Stack
- Cstyle的UEFI导读之PCI Driver Stack
- Cstyle的UEFI导读之ATA Driver Stack
- Cstyle的UEFI导读之User Credential Driver Stack
- Cstyle的UEFI导读:第20.0篇 IGD OpRegion interface && IGD OpRegion PROTOCOL
- Bad version number in .class file (unable to load class com.microsoft.sqlserver.jdbc.SQLServerDriver
- Cstyle的UEFI导读:第18.0篇 NVRAM的工作原理(上)
- Cstyle的UEFI导读:第19.0篇 SMM在UEFI当中的实现
- 【我所认知的BIOS】—> uEFI AHCI Driver(3) — 无处不在的protocol
- 《Cstyle的UEFI导读》系列专题博客
- UEFI应用与编程--EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
- Cstyle的UEFI导读之DXE---Event && Timer (上篇:实战篇)
- 【我所认知的BIOS】—> uEFI AHCI Driver(4) — 第一个Protocol真难搞
- Cstyle的UEFI导读之PEI --- Notify && Callback
- Cstyle的UEFI导读之Override Protocol