TianoCore EDK2 master
Loading...
Searching...
No Matches
RamDiskImpl.h
Go to the documentation of this file.
1
10#ifndef _RAM_DISK_IMPL_H_
11#define _RAM_DISK_IMPL_H_
12
13#include <Uefi.h>
14#include <Library/BaseLib.h>
16#include <Library/DebugLib.h>
17#include <Library/UefiLib.h>
22#include <Library/HiiLib.h>
25#include <Library/PrintLib.h>
26#include <Library/PcdLib.h>
28#include <Protocol/RamDisk.h>
29#include <Protocol/BlockIo.h>
30#include <Protocol/BlockIo2.h>
33#include <Protocol/AcpiTable.h>
35#include <Guid/MdeModuleHii.h>
36#include <Guid/RamDiskHii.h>
37#include <Guid/FileInfo.h>
39
40#include "RamDiskNVData.h"
41
45
46//
47// Default block size for RAM disk
48//
49#define RAM_DISK_DEFAULT_BLOCK_SIZE 512
50
51//
52// RamDiskDxe driver maintains a list of registered RAM disks.
53//
54extern LIST_ENTRY RegisteredRamDisks;
55
56//
57// Pointers to the EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL.
58//
59extern EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol;
60extern EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol;
61
62//
63// RAM Disk create method.
64//
65typedef enum _RAM_DISK_CREATE_METHOD {
66 RamDiskCreateOthers = 0,
67 RamDiskCreateHii
68} RAM_DISK_CREATE_METHOD;
69
70//
71// RamDiskDxe driver maintains a list of registered RAM disks.
72// The struct contains the list entry and the information of each RAM
73// disk
74//
75typedef struct {
76 UINTN Signature;
77
78 EFI_HANDLE Handle;
79
83 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
84
85 UINT64 StartingAddr;
86 UINT64 Size;
87 EFI_GUID TypeGuid;
88 UINT16 InstanceNumber;
89 RAM_DISK_CREATE_METHOD CreateMethod;
90 BOOLEAN InNfit;
91 EFI_QUESTION_ID CheckBoxId;
92 BOOLEAN CheckBoxChecked;
93
94 LIST_ENTRY ThisInstance;
96
97#define RAM_DISK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'D', 'S', 'K')
98#define RAM_DISK_PRIVATE_FROM_BLKIO(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo, RAM_DISK_PRIVATE_DATA_SIGNATURE)
99#define RAM_DISK_PRIVATE_FROM_BLKIO2(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo2, RAM_DISK_PRIVATE_DATA_SIGNATURE)
100#define RAM_DISK_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_PRIVATE_DATA, ThisInstance, RAM_DISK_PRIVATE_DATA_SIGNATURE)
101
105
106//
107// Tool generated IFR binary data and String package data
108//
109extern UINT8 RamDiskHiiBin[];
110extern UINT8 RamDiskDxeStrings[];
111
112typedef struct {
113 VENDOR_DEVICE_PATH VendorDevicePath;
116
117typedef struct {
118 UINTN Signature;
119
120 RAM_DISK_CONFIGURATION ConfigStore;
121
123 EFI_HANDLE DriverHandle;
124 EFI_HII_HANDLE HiiHandle;
126
127extern RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate;
128
129#define RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'C', 'F', 'G')
130#define RAM_DISK_CONFIG_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_CONFIG_PRIVATE_DATA, ConfigAccess, RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE)
131
163EFIAPI
165 IN UINT64 RamDiskBase,
166 IN UINT64 RamDiskSize,
167 IN EFI_GUID *RamDiskType,
168 IN EFI_DEVICE_PATH *ParentDevicePath OPTIONAL,
169 OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
170 );
171
188EFIAPI
190 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
191 );
192
199VOID
201 IN RAM_DISK_PRIVATE_DATA *PrivateData
202 );
203
217EFIAPI
220 IN BOOLEAN ExtendedVerification
221 );
222
249EFIAPI
252 IN UINT32 MediaId,
253 IN EFI_LBA Lba,
254 IN UINTN BufferSize,
255 OUT VOID *Buffer
256 );
257
284EFIAPI
287 IN UINT32 MediaId,
288 IN EFI_LBA Lba,
289 IN UINTN BufferSize,
290 IN VOID *Buffer
291 );
292
305EFIAPI
308 );
309
322EFIAPI
325 IN BOOLEAN ExtendedVerification
326 );
327
362EFIAPI
365 IN UINT32 MediaId,
366 IN EFI_LBA Lba,
368 IN UINTN BufferSize,
369 OUT VOID *Buffer
370 );
371
405EFIAPI
408 IN UINT32 MediaId,
409 IN EFI_LBA Lba,
411 IN UINTN BufferSize,
412 IN VOID *Buffer
413 );
414
435EFIAPI
439 );
440
454 IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
455 );
456
464VOID
466 IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
467 );
468
473VOID
475 VOID
476 );
477
506EFIAPI
509 IN CONST EFI_STRING Request,
510 OUT EFI_STRING *Progress,
511 OUT EFI_STRING *Results
512 );
513
533EFIAPI
536 IN CONST EFI_STRING Configuration,
537 OUT EFI_STRING *Progress
538 );
539
563EFIAPI
566 IN EFI_BROWSER_ACTION Action,
567 IN EFI_QUESTION_ID QuestionId,
568 IN UINT8 Type,
569 IN EFI_IFR_TYPE_VALUE *Value,
570 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
571 );
572
583FileInfo (
584 IN EFI_FILE_HANDLE FHand
585 );
586
599 IN RAM_DISK_PRIVATE_DATA *PrivateData
600 );
601
602#endif
UINT64 UINTN
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID UninstallRamDiskConfigForm(IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData)
Definition: RamDiskImpl.c:122
EFI_STATUS EFIAPI RamDiskCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
Definition: RamDiskImpl.c:583
EFI_STATUS EFIAPI RamDiskBlkIo2ReadBlocksEx(IN EFI_BLOCK_IO2_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN OUT EFI_BLOCK_IO2_TOKEN *Token, IN UINTN BufferSize, OUT VOID *Buffer)
EFI_STATUS EFIAPI RamDiskBlkIoFlushBlocks(IN EFI_BLOCK_IO_PROTOCOL *This)
EFI_STATUS RamDiskPublishNfit(IN RAM_DISK_PRIVATE_DATA *PrivateData)
EFI_STATUS EFIAPI RamDiskRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
Definition: RamDiskImpl.c:261
EFI_FILE_INFO * FileInfo(IN EFI_FILE_HANDLE FHand)
EFI_STATUS EFIAPI RamDiskRegister(IN UINT64 RamDiskBase, IN UINT64 RamDiskSize, IN EFI_GUID *RamDiskType, IN EFI_DEVICE_PATH *ParentDevicePath OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
EFI_STATUS EFIAPI RamDiskExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
Definition: RamDiskImpl.c:226
EFI_STATUS EFIAPI RamDiskBlkIoWriteBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS EFIAPI RamDiskUnregister(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
UINT8 RamDiskHiiBin[]
EFI_STATUS EFIAPI RamDiskBlkIoReadBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
VOID RamDiskInitBlockIo(IN RAM_DISK_PRIVATE_DATA *PrivateData)
EFI_STATUS EFIAPI RamDiskBlkIo2WriteBlocksEx(IN EFI_BLOCK_IO2_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN OUT EFI_BLOCK_IO2_TOKEN *Token, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS InstallRamDiskConfigForm(IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData)
Definition: RamDiskImpl.c:62
EFI_STATUS EFIAPI RamDiskBlkIo2FlushBlocksEx(IN EFI_BLOCK_IO2_PROTOCOL *This, IN OUT EFI_BLOCK_IO2_TOKEN *Token)
VOID UnregisterAllRamDisks(VOID)
Definition: RamDiskImpl.c:157
EFI_STATUS EFIAPI RamDiskBlkIoReset(IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI RamDiskBlkIo2Reset(IN EFI_BLOCK_IO2_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
UINT64 EFI_LBA
Definition: UefiBaseType.h:45
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
VOID * EFI_HII_HANDLE
Definition: Base.h:213