• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   This program and the accompanying materials are licensed and made available
7   under the terms and conditions of the BSD License which accompanies this
8   distribution.  The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef __QEMU_FLASH_H__
17 #define __QEMU_FLASH_H__
18 
19 #include <Protocol/FirmwareVolumeBlock.h>
20 
21 extern UINT8 *mFlashBase;
22 
23 /**
24   Read from QEMU Flash
25 
26   @param[in] Lba      The starting logical block index to read from.
27   @param[in] Offset   Offset into the block at which to begin reading.
28   @param[in] NumBytes On input, indicates the requested read size. On
29                       output, indicates the actual number of bytes read
30   @param[in] Buffer   Pointer to the buffer to read into.
31 
32 **/
33 EFI_STATUS
34 QemuFlashRead (
35   IN        EFI_LBA                              Lba,
36   IN        UINTN                                Offset,
37   IN        UINTN                                *NumBytes,
38   IN        UINT8                                *Buffer
39   );
40 
41 
42 /**
43   Write to QEMU Flash
44 
45   @param[in] Lba      The starting logical block index to write to.
46   @param[in] Offset   Offset into the block at which to begin writing.
47   @param[in] NumBytes On input, indicates the requested write size. On
48                       output, indicates the actual number of bytes written
49   @param[in] Buffer   Pointer to the data to write.
50 
51 **/
52 EFI_STATUS
53 QemuFlashWrite (
54   IN        EFI_LBA                              Lba,
55   IN        UINTN                                Offset,
56   IN        UINTN                                *NumBytes,
57   IN        UINT8                                *Buffer
58   );
59 
60 
61 /**
62   Erase a QEMU Flash block
63 
64   @param Lba    The logical block index to erase.
65 
66 **/
67 EFI_STATUS
68 QemuFlashEraseBlock (
69   IN   EFI_LBA      Lba
70   );
71 
72 
73 /**
74   Initializes QEMU flash memory support
75 
76   @retval EFI_WRITE_PROTECTED   The QEMU flash device is not present.
77   @retval EFI_SUCCESS           The QEMU flash device is supported.
78 
79 **/
80 EFI_STATUS
81 QemuFlashInitialize (
82   VOID
83   );
84 
85 
86 VOID
87 QemuFlashConvertPointers (
88   VOID
89   );
90 
91 #endif
92 
93