Step:

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), );
Flash4GBMapStart = 0xFFFFFFFF - FLASH_SIZE + ; //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

Parse how to write flash in uefi shell.的更多相关文章

  1. UEFI Shell命令操作总结

    什么是UEFI ShellUEFI Shell是一种特殊对待UEFI_APPLICATION.提供用户和UEFI系统之间的一个接口.它有很强大的功能,但是正常启动计算机系统时,不会用到UEFI She ...

  2. UEFI Shell --常用命令解释

    UEFI Shell解释 UEFI Shell 是一个提供用户和UEFI系统之间的接口,进入UEFI Shell可以对计算机系统进行配置 命令解释: 单独的help就可以输出所有指令,不做特殊说明,内 ...

  3. UEFI+GPT引导实践篇(二):UEFI引导安装64位Win7/Win8

    下文是在联想Y480笔记本上以UEFI方式启动安装Windows8的全过程,安装Windows7过程基本相同.注意,如果你的电脑硬盘是MBR分区结构,安装过程中将要删除硬盘上所有数据,请安装前备份硬盘 ...

  4. UEFI模式下安装Win 7系统

    转载自:http://huayi898.blog.163.com/blog/static/2581351620144442319155/ 下载win7_64bit原版官方系统 1.用软碟通制作U盘启动 ...

  5. UEFI BIOS Rootkit Analysis

    catalog . BIOS简介 . UEFI BIOS . EFI编程简介 . UEFI Rootkit 1. BIOS简介 BIOS("Basic Input Output System ...

  6. uefi下如何启动linux?

    1. 有两种方式 1.1 直接从uefi shell启动linux内核 1.2 从uefi shell启动grub,然后再从grub启动linux内核 2. 需要哪些东西? 2.1 linux内核 2 ...

  7. uefi是如何启动linux内核的?

    答:uefi启动linux内核有两条路径: 1. uefi直接进入uefi shell来启动linux内核 2. uefi直接进入uefi shell启动grub启动器,然后进入grub shell启 ...

  8. 笔记三(UEFI详解)

    1.SEC 安全验证 SEC(Security Phase)阶段是平台初始化的第一个阶段,计算机系统加电后进入这个阶段. 1)接收并处理系统启动和重启信号:系统加点信号.系统重启信号.系统运行过程中的 ...

  9. x86 构架的 Arduino 开发板Intel Galileo

    RobotPeak是上海的一家硬件创业团队,团队致力于民用机器人平台系统.机器人操作系统(ROS)以及相关设备的设计研发,并尝试将日新月异的机器人技术融入人们的日常生活与娱乐当中.同时,RobotPe ...

随机推荐

  1. 解决sklearn 随机森林数据不平衡的方法

    Handle Imbalanced Classes In Random Forest   Preliminaries # Load libraries from sklearn.ensemble im ...

  2. php分享十五:php的命令行操作

    一:像命令行传参数方法: 1: 使用$argc $argv 用法: /usr/local/php/bin/php ./getopt.php 123  456 2:使用getopt函数() http:/ ...

  3. linux c select函数使用求解释

          代码非常easy,就是发送c语言发送http请求.但 i= read(sockfd, buf, BUFSIZE-1); 能够正常执行,  替换为i= Read(sockfd, buf, B ...

  4. PHP use关键字概述

    PHP中的use关键字的用法. 很多开源系统如osCommerce框架中,都会在其源码中找到use这个关键字,如osCommerce框架中就在index.php文件中出现了这段源码:use osCom ...

  5. 【Unity】11.2 刚体(Rigidbody)

    分类:Unity.C#.VS2015 创建日期:2016-05-02 一.简介 Rigidbody(刚体)组件可使游戏对象在物理系统的控制下来运动,刚体可接受外力与扭矩力,使游戏对象像在真实世界中那样 ...

  6. OpenStack大规模部署详解

    https://blog.csdn.net/karamos/article/details/80130443 0.前言今年的2月22日,OpenStack发布了15个版本Ocata. 走过了7年的发展 ...

  7. sql server2000导出表结构说明

    SELECT 表名 then d.name else '' end, 表说明 then isnull(f.value,'') else '' end, 字段序号=a.colorder, 字段名=a.n ...

  8. Django model中的Class Meta

    1.Meta元数据 代码示例: class Foo(models.Model): bar = models.CharField(maxlength=30) class Meta: # ... Meta ...

  9. 每日英语:The best time for coffee is 10:30 a.m.

    For many of us, it is the rocket fuel that gets us going first thing in the morning. But one expert ...

  10. 每日英语:Marriage makes our children richer — Here's why

    Young people from less-privileged homes are more likely to graduate from college and earn more if ra ...