3 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _FIRMWARE_UPDATE_H_
17 #define _FIRMWARE_UPDATE_H_
23 #include <Guid/FileInfo.h>
25 #include <Protocol/FirmwareVolumeBlock.h>
26 #include <Protocol/LoadedImage.h>
27 #include <Protocol/SimpleFileSystem.h>
28 #include <Protocol/Spi.h>
30 #include <Library/BaseLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/CacheMaintenanceLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/FileHandleLib.h>
35 #include <Library/HiiLib.h>
36 #include <Library/MemoryAllocationLib.h>
37 #include <Library/PcdLib.h>
38 #include <Library/PrintLib.h>
39 #include <Library/ShellLib.h>
40 #include <Library/UefiApplicationEntryPoint.h>
41 #include <Library/UefiBootServicesTableLib.h>
42 #include <Library/UefiLib.h>
43 #include <Library/UefiRuntimeServicesTableLib.h>
46 // Function Prototypes.
53 OUT UINT32
*BufferSize
59 IN EFI_PHYSICAL_ADDRESS BaseAddress
66 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
73 InternalCompareBlock (
74 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
81 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
97 IN OUT UINT32
*NumBytes
,
106 IN OUT UINT32
*NumBytes
,
127 IN EFI_HANDLE ImageHandle
,
128 IN EFI_SYSTEM_TABLE
*SystemTable
132 // Flash specific definitions.
133 // - Should we use a PCD for this information?
135 #define BLOCK_SIZE SIZE_4KB
138 // Flash region layout and update information.
141 EFI_PHYSICAL_ADDRESS Base
;
147 // MAC Address information.
149 #define MAC_ADD_STR_LEN 12
150 #define MAC_ADD_STR_SIZE (MAC_ADD_STR_LEN + 1)
151 #define MAC_ADD_BYTE_COUNT 6
152 #define MAC_ADD_TMP_STR_LEN 2
153 #define MAC_ADD_TMP_STR_SIZE (MAC_ADD_TMP_STR_LEN + 1)
156 // Command Line Data.
158 #define INPUT_STRING_LEN 255
159 #define INPUT_STRING_SIZE (INPUT_STRING_LEN + 1)
161 BOOLEAN UpdateFromFile
;
162 CHAR16 FileName
[INPUT_STRING_SIZE
];
164 UINT8 MacValue
[MAC_ADD_BYTE_COUNT
];
165 BOOLEAN FullFlashUpdate
;
169 // Prefix Opcode Index on the host SPI controller.
172 SPI_WREN
, // Prefix Opcode 0: Write Enable.
173 SPI_EWSR
, // Prefix Opcode 1: Enable Write Status Register.
174 } PREFIX_OPCODE_INDEX
;
177 // Opcode Menu Index on the host SPI controller.
180 SPI_READ_ID
, // Opcode 0: READ ID, Read cycle with address.
181 SPI_READ
, // Opcode 1: READ, Read cycle with address.
182 SPI_RDSR
, // Opcode 2: Read Status Register, No address.
183 SPI_WRDI_SFDP
, // Opcode 3: Write Disable or Discovery Parameters, No address.
184 SPI_SERASE
, // Opcode 4: Sector Erase (4KB), Write cycle with address.
185 SPI_BERASE
, // Opcode 5: Block Erase (32KB), Write cycle with address.
186 SPI_PROG
, // Opcode 6: Byte Program, Write cycle with address.
187 SPI_WRSR
, // Opcode 7: Write Status Register, No address.