Parse how to write flash in uefi shell.
2013-09-05 12:26
411 查看
Step:
1. Enable
2. Read
3. Write
4. Disable
1. Enable
2. Read
3. Write
4. Disable
FI_GUID gEfiSFlashProtocolGuid = FLASH_PROTOCOL_GUID; FLASH_PROTOCOL* pFlashProtocol; EFI_PHYSICAL_ADDRESS Flash4GBMapStart; EFI_STATUS Status; UINT8 *StrBuffer; Status = pBootServices->LocateProtocol( &gEfiSFlashProtocolGuid, NULL, &pFlashProtocol); Status = pBootServices->AllocatePool(//start: allocate mem check point hear EfiBootServicesData, sizeof(UINT8) * FLASH_BLOCK_SIZE, (VOID*)&StrBuffer); if (EFI_ERROR(Status) || StrBuffer == NULL) { error code here….. } MemSet(StrBuffer, (sizeof(UINT8) * FLASH_BLOCK_SIZE), 0); Flash4GBMapStart = 0xFFFFFFFF - FLASH_SIZE + 1; //Enable DeviceWrite to read real Flash address, not memory mapping. Status = pFlashProtocol->DeviceWriteEnable();//step1. enable if (EFI_ERROR(Status)) { error code here….. } Status = pFlashProtocol->Read(//step2. Read (VOID*)Flash4GBMapStart, FLASH_BLOCK_SIZE, (VOID*)StrBuffer); *(StrBuffer+PcieLaneSettingAddr) = PcieLaneSetting; Status = pFlashProtocol->Write(//step3. Update or write (VOID*)Flash4GBMapStart, FLASH_BLOCK_SIZE, (VOID*)StrBuffer); pFlashProtocol->DeviceWriteDisable(); //step4. Disable pBootServices->FreePool(StrBuffer);//end: free memory
相关文章推荐
- Ex2010-19 How to Run the Exchange Management Shell EMS in PowerShell
- prjGetWriteINIFile - How to Read-Write INI file using VB & API - 读取/写入INI文件 - VB6 + API - SourceCode - HackerJLY
- How To Write A Simple Web Crawler In Ruby
- In the company, how to write an E-mail(在公司里,如何写好一封电子邮件)
- How to read and write JSON files in Java(Gson)
- How to write the fast code/ high performance in C#
- How To Install Flash Player In Ubuntu 10.04 Lucid Lynx,install firefox flash plugin addon for ubuntu
- How do I write a LINQ to Entities query which has the equivalent of the SQL “in” keyword?
- How to write a script in Linux
- how to write shell scripts
- [linux]How to set PATH in shell script, and keep it avaiable even after it exits
- 【转】How to append current date and timestamp to filename in shell script
- A good blog about how to write an Hadoop MapReduce program in Python
- shellinabox : How to access ssh terminal in web browser on Linux Last updated on September 27, 2013
- scala: How to write a simple HTTP GET request client in Scala (with a timeout)
- How to Write an Equality Method in Java(之三)Java中如何写equals()方法
- An ffmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines
- recursion - How to write a simple preorder DOM tree traversal algorithm in jQuery? - Stack Overflow
- how to write it in C++?
- [quote]HowTo Format Date For Display or Use In a Shell Script