TianoCore EDK2 master
Loading...
Searching...
No Matches
QemuFlash.c File Reference

Go to the source code of this file.

Macros

#define WRITE_BYTE_CMD   0x10
 
#define BLOCK_ERASE_CMD   0x20
 
#define CLEAR_STATUS_CMD   0x50
 
#define READ_STATUS_CMD   0x70
 
#define READ_DEVID_CMD   0x90
 
#define BLOCK_ERASE_CONFIRM_CMD   0xd0
 
#define READ_ARRAY_CMD   0xff
 
#define CLEARED_ARRAY_STATUS   0x00
 

Functions

STATIC volatile UINT8 * QemuFlashPtr (IN EFI_LBA Lba, IN UINTN Offset)
 
STATIC BOOLEAN QemuFlashDetected (VOID)
 
EFI_STATUS QemuFlashRead (IN EFI_LBA Lba, IN UINTN Offset, IN UINTN *NumBytes, IN UINT8 *Buffer)
 
EFI_STATUS QemuFlashWrite (IN EFI_LBA Lba, IN UINTN Offset, IN UINTN *NumBytes, IN UINT8 *Buffer)
 
EFI_STATUS QemuFlashEraseBlock (IN EFI_LBA Lba)
 
EFI_STATUS QemuFlashInitialize (VOID)
 

Variables

UINT8 * mFlashBase
 
STATIC UINTN mFdBlockSize = 0
 
STATIC UINTN mFdBlockCount = 0
 

Detailed Description

OVMF support for QEMU system firmware flash device

Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file QemuFlash.c.

Macro Definition Documentation

◆ BLOCK_ERASE_CMD

#define BLOCK_ERASE_CMD   0x20

Definition at line 18 of file QemuFlash.c.

◆ BLOCK_ERASE_CONFIRM_CMD

#define BLOCK_ERASE_CONFIRM_CMD   0xd0

Definition at line 22 of file QemuFlash.c.

◆ CLEAR_STATUS_CMD

#define CLEAR_STATUS_CMD   0x50

Definition at line 19 of file QemuFlash.c.

◆ CLEARED_ARRAY_STATUS

#define CLEARED_ARRAY_STATUS   0x00

Definition at line 25 of file QemuFlash.c.

◆ READ_ARRAY_CMD

#define READ_ARRAY_CMD   0xff

Definition at line 23 of file QemuFlash.c.

◆ READ_DEVID_CMD

#define READ_DEVID_CMD   0x90

Definition at line 21 of file QemuFlash.c.

◆ READ_STATUS_CMD

#define READ_STATUS_CMD   0x70

Definition at line 20 of file QemuFlash.c.

◆ WRITE_BYTE_CMD

#define WRITE_BYTE_CMD   0x10

Definition at line 17 of file QemuFlash.c.

Function Documentation

◆ QemuFlashDetected()

STATIC BOOLEAN QemuFlashDetected ( VOID  )

Determines if the QEMU flash memory device is present.

Return values
FALSEThe QEMU flash device is not present.
TRUEThe QEMU flash device is present.

Definition at line 51 of file QemuFlash.c.

◆ QemuFlashEraseBlock()

EFI_STATUS QemuFlashEraseBlock ( IN EFI_LBA  Lba)

Erase a QEMU Flash block

Parameters
LbaThe logical block index to erase.

Definition at line 234 of file QemuFlash.c.

◆ QemuFlashInitialize()

EFI_STATUS QemuFlashInitialize ( VOID  )

Initializes QEMU flash memory support

Return values
EFI_WRITE_PROTECTEDThe QEMU flash device is not present.
EFI_SUCCESSThe QEMU flash device is supported.

Definition at line 258 of file QemuFlash.c.

◆ QemuFlashPtr()

STATIC volatile UINT8 * QemuFlashPtr ( IN EFI_LBA  Lba,
IN UINTN  Offset 
)

Definition at line 34 of file QemuFlash.c.

◆ QemuFlashRead()

EFI_STATUS QemuFlashRead ( IN EFI_LBA  Lba,
IN UINTN  Offset,
IN UINTN NumBytes,
IN UINT8 *  Buffer 
)

Read from QEMU Flash

Parameters
[in]LbaThe starting logical block index to read from.
[in]OffsetOffset into the block at which to begin reading.
[in]NumBytesOn input, indicates the requested read size. On output, indicates the actual number of bytes read
[in]BufferPointer to the buffer to read into.

Definition at line 150 of file QemuFlash.c.

◆ QemuFlashWrite()

EFI_STATUS QemuFlashWrite ( IN EFI_LBA  Lba,
IN UINTN  Offset,
IN UINTN NumBytes,
IN UINT8 *  Buffer 
)

Write to QEMU Flash

Parameters
[in]LbaThe starting logical block index to write to.
[in]OffsetOffset into the block at which to begin writing.
[in]NumBytesOn input, indicates the requested write size. On output, indicates the actual number of bytes written
[in]BufferPointer to the data to write.

Definition at line 188 of file QemuFlash.c.

Variable Documentation

◆ mFdBlockCount

STATIC UINTN mFdBlockCount = 0

Definition at line 30 of file QemuFlash.c.

◆ mFdBlockSize

STATIC UINTN mFdBlockSize = 0

Definition at line 29 of file QemuFlash.c.

◆ mFlashBase

UINT8* mFlashBase

Definition at line 27 of file QemuFlash.c.