13#if EFI_STORAGE_INT_FLASH == TRUE
30flashaddr_t SettingStorageFlash::getIdAddress(
size_t id) {
40bool SettingStorageFlash::isReady() {
44bool SettingStorageFlash::isIdSupported(
size_t id) {
45 return (getIdAddress(
id) != 0);
48StorageStatus SettingStorageFlash::store(
size_t id,
const uint8_t *ptr,
size_t size) {
55 efiPrintf(
"Flash: Writing storage ID %d @0x%x... %d bytes",
id,
addr,
size);
68 efiPrintf(
"Flash: failed to erase flash at 0x%08x: %d",
addr, err);
75 efiPrintf(
"Flash: failed to write flash at 0x%08x: %d",
addr, err);
81 int elapsed_Ms = US2MS(NT2US(endNt - startNt));
88 efiPrintf(
"SD: Write done after %d mS", elapsed_Ms);
100 efiPrintf(
"Flash: Reading storage ID %d @0x%x ... %d bytes",
id,
addr,
size);
104 efiPrintf(
"Flash: Reading done");
bool mcuCanFlashWhileRunning()
virtual StorageStatus read(size_t id, uint8_t *ptr, size_t size)=0
virtual StorageStatus store(size_t id, const uint8_t *ptr, size_t size)=0
virtual bool isIdSupported(size_t id)=0
virtual StorageStatus format()=0
return FLASH_RETURN_SUCCESS
int intFlashErase(flashaddr_t address, size_t size)
Erase the sectors containing the span of size bytes starting at address.
uintptr_t flashaddr_t
Address in the flash memory.
int intFlashWrite(flashaddr_t address, const char *buffer, size_t size)
Copy data from a buffer to the flash memory.
uintptr_t getFlashAddrFirstCopy(void)
int intFlashRead(flashaddr_t source, char *destination, size_t size)
Copy data from the flash memory to a destination.
uintptr_t getFlashAddrSecondCopy(void)
bool storageRegisterStorage(StorageType type, SettingStorageBase *storage)
@ EFI_SETTINGS_BACKUP_RECORD_ID
static SettingStorageFlash storageFlash