1 | /** @file
|
---|
2 | OVMF support for QEMU system firmware flash device
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef __QEMU_FLASH_H__
|
---|
11 | #define __QEMU_FLASH_H__
|
---|
12 |
|
---|
13 | #include <Protocol/FirmwareVolumeBlock.h>
|
---|
14 |
|
---|
15 | extern UINT8 *mFlashBase;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | Read from QEMU Flash
|
---|
19 |
|
---|
20 | @param[in] Lba The starting logical block index to read from.
|
---|
21 | @param[in] Offset Offset into the block at which to begin reading.
|
---|
22 | @param[in] NumBytes On input, indicates the requested read size. On
|
---|
23 | output, indicates the actual number of bytes read
|
---|
24 | @param[in] Buffer Pointer to the buffer to read into.
|
---|
25 |
|
---|
26 | **/
|
---|
27 | EFI_STATUS
|
---|
28 | QemuFlashRead (
|
---|
29 | IN EFI_LBA Lba,
|
---|
30 | IN UINTN Offset,
|
---|
31 | IN UINTN *NumBytes,
|
---|
32 | IN UINT8 *Buffer
|
---|
33 | );
|
---|
34 |
|
---|
35 |
|
---|
36 | /**
|
---|
37 | Write to QEMU Flash
|
---|
38 |
|
---|
39 | @param[in] Lba The starting logical block index to write to.
|
---|
40 | @param[in] Offset Offset into the block at which to begin writing.
|
---|
41 | @param[in] NumBytes On input, indicates the requested write size. On
|
---|
42 | output, indicates the actual number of bytes written
|
---|
43 | @param[in] Buffer Pointer to the data to write.
|
---|
44 |
|
---|
45 | **/
|
---|
46 | EFI_STATUS
|
---|
47 | QemuFlashWrite (
|
---|
48 | IN EFI_LBA Lba,
|
---|
49 | IN UINTN Offset,
|
---|
50 | IN UINTN *NumBytes,
|
---|
51 | IN UINT8 *Buffer
|
---|
52 | );
|
---|
53 |
|
---|
54 |
|
---|
55 | /**
|
---|
56 | Erase a QEMU Flash block
|
---|
57 |
|
---|
58 | @param Lba The logical block index to erase.
|
---|
59 |
|
---|
60 | **/
|
---|
61 | EFI_STATUS
|
---|
62 | QemuFlashEraseBlock (
|
---|
63 | IN EFI_LBA Lba
|
---|
64 | );
|
---|
65 |
|
---|
66 |
|
---|
67 | /**
|
---|
68 | Initializes QEMU flash memory support
|
---|
69 |
|
---|
70 | @retval EFI_WRITE_PROTECTED The QEMU flash device is not present.
|
---|
71 | @retval EFI_SUCCESS The QEMU flash device is supported.
|
---|
72 |
|
---|
73 | **/
|
---|
74 | EFI_STATUS
|
---|
75 | QemuFlashInitialize (
|
---|
76 | VOID
|
---|
77 | );
|
---|
78 |
|
---|
79 |
|
---|
80 | VOID
|
---|
81 | QemuFlashConvertPointers (
|
---|
82 | VOID
|
---|
83 | );
|
---|
84 |
|
---|
85 | VOID
|
---|
86 | QemuFlashBeforeProbe (
|
---|
87 | IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
---|
88 | IN UINTN FdBlockSize,
|
---|
89 | IN UINTN FdBlockCount
|
---|
90 | );
|
---|
91 |
|
---|
92 | /**
|
---|
93 | Write to QEMU Flash
|
---|
94 |
|
---|
95 | @param[in] Ptr Pointer to the location to write.
|
---|
96 | @param[in] Value The value to write.
|
---|
97 |
|
---|
98 | **/
|
---|
99 | VOID
|
---|
100 | QemuFlashPtrWrite (
|
---|
101 | IN volatile UINT8 *Ptr,
|
---|
102 | IN UINT8 Value
|
---|
103 | );
|
---|
104 |
|
---|
105 | #endif
|
---|
106 |
|
---|