#include <Library/FileExplorerLib.h>\r
#include <Library/DevicePathLib.h>\r
#include <Library/PrintLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/DxeServicesLib.h>\r
#include <Protocol/RamDisk.h>\r
#include <Protocol/BlockIo.h>\r
+#include <Protocol/BlockIo2.h>\r
#include <Protocol/HiiConfigAccess.h>\r
#include <Protocol/SimpleFileSystem.h>\r
+#include <Protocol/AcpiTable.h>\r
+#include <Protocol/AcpiSystemDescriptionTable.h>\r
#include <Guid/MdeModuleHii.h>\r
#include <Guid/RamDiskHii.h>\r
#include <Guid/FileInfo.h>\r
+#include <IndustryStandard/Acpi61.h>\r
\r
#include "RamDiskNVData.h"\r
\r
// RamDiskDxe driver maintains a list of registered RAM disks.\r
//\r
extern LIST_ENTRY RegisteredRamDisks;\r
-extern UINTN ListEntryNum;\r
+\r
+//\r
+// Pointers to the EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL.\r
+//\r
+extern EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol;\r
+extern EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol;\r
\r
//\r
// RAM Disk create method.\r
EFI_HANDLE Handle;\r
\r
EFI_BLOCK_IO_PROTOCOL BlockIo;\r
+ EFI_BLOCK_IO2_PROTOCOL BlockIo2;\r
EFI_BLOCK_IO_MEDIA Media;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
\r
EFI_GUID TypeGuid;\r
UINT16 InstanceNumber;\r
RAM_DISK_CREATE_METHOD CreateMethod;\r
+ BOOLEAN InNfit;\r
+ EFI_QUESTION_ID CheckBoxId;\r
+ BOOLEAN CheckBoxChecked;\r
\r
LIST_ENTRY ThisInstance;\r
} RAM_DISK_PRIVATE_DATA;\r
\r
#define RAM_DISK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'D', 'S', 'K')\r
#define RAM_DISK_PRIVATE_FROM_BLKIO(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo, RAM_DISK_PRIVATE_DATA_SIGNATURE)\r
+#define RAM_DISK_PRIVATE_FROM_BLKIO2(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo2, RAM_DISK_PRIVATE_DATA_SIGNATURE)\r
#define RAM_DISK_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_PRIVATE_DATA, ThisInstance, RAM_DISK_PRIVATE_DATA_SIGNATURE)\r
\r
///\r
typedef struct {\r
UINTN Signature;\r
\r
+ RAM_DISK_CONFIGURATION ConfigStore;\r
+\r
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
EFI_HANDLE DriverHandle;\r
EFI_HII_HANDLE HiiHandle;\r
#define RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'C', 'F', 'G')\r
#define RAM_DISK_CONFIG_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_CONFIG_PRIVATE_DATA, ConfigAccess, RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE)\r
\r
-#define RAM_DISK_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (RAM_DISK_CONFIGURATION, RamDiskList))\r
-\r
/**\r
Register a RAM disk with specified address, size and type.\r
\r
IN EFI_BLOCK_IO_PROTOCOL *This\r
);\r
\r
+/**\r
+ Resets the block device hardware.\r
+\r
+ @param[in] This The pointer of EFI_BLOCK_IO2_PROTOCOL.\r
+ @param[in] ExtendedVerification The flag about if extend verificate.\r
+\r
+ @retval EFI_SUCCESS The device was reset.\r
+ @retval EFI_DEVICE_ERROR The block device is not functioning correctly\r
+ and could not be reset.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RamDiskBlkIo2Reset (\r
+ IN EFI_BLOCK_IO2_PROTOCOL *This,\r
+ IN BOOLEAN ExtendedVerification\r
+ );\r
+\r
+/**\r
+ Reads the requested number of blocks from the device.\r
+\r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[in] MediaId The media ID that the read request is for.\r
+ @param[in] Lba The starting logical block address to read\r
+ from on the device.\r
+ @param[in, out] Token A pointer to the token associated with the\r
+ transaction.\r
+ @param[in] BufferSize The size of the Buffer in bytes. This must be\r
+ a multiple of the intrinsic block size of the\r
+ device.\r
+ @param[out] Buffer A pointer to the destination buffer for the\r
+ data. The caller is responsible for either\r
+ having implicit or explicit ownership of the\r
+ buffer.\r
+\r
+ @retval EFI_SUCCESS The read request was queued if Token->Event\r
+ is not NULL. The data was read correctly from\r
+ the device if the Token->Event is NULL.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while attempting\r
+ to perform the read operation.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
+ @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r
+ the intrinsic block size of the device.\r
+ @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not\r
+ valid, or the buffer is not on proper\r
+ alignment.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r
+ lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RamDiskBlkIo2ReadBlocksEx (\r
+ IN EFI_BLOCK_IO2_PROTOCOL *This,\r
+ IN UINT32 MediaId,\r
+ IN EFI_LBA Lba,\r
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
+ IN UINTN BufferSize,\r
+ OUT VOID *Buffer\r
+ );\r
+\r
+/**\r
+ Writes a specified number of blocks to the device.\r
+\r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[in] MediaId The media ID that the write request is for.\r
+ @param[in] Lba The starting logical block address to be\r
+ written. The caller is responsible for\r
+ writing to only legitimate locations.\r
+ @param[in, out] Token A pointer to the token associated with the\r
+ transaction.\r
+ @param[in] BufferSize The size in bytes of Buffer. This must be a\r
+ multiple of the intrinsic block size of the\r
+ device.\r
+ @param[in] Buffer A pointer to the source buffer for the data.\r
+\r
+ @retval EFI_SUCCESS The write request was queued if Event is not\r
+ NULL. The data was written correctly to the\r
+ device if the Event is NULL.\r
+ @retval EFI_WRITE_PROTECTED The device cannot be written to.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while attempting\r
+ to perform the write operation.\r
+ @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r
+ the intrinsic block size of the device.\r
+ @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not\r
+ valid, or the buffer is not on proper\r
+ alignment.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r
+ lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RamDiskBlkIo2WriteBlocksEx (\r
+ IN EFI_BLOCK_IO2_PROTOCOL *This,\r
+ IN UINT32 MediaId,\r
+ IN EFI_LBA Lba,\r
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
+ IN UINTN BufferSize,\r
+ IN VOID *Buffer\r
+ );\r
+\r
+/**\r
+ Flushes all modified data to a physical block device.\r
+\r
+ @param[in] This Indicates a pointer to the calling context.\r
+ @param[in, out] Token A pointer to the token associated with the\r
+ transaction.\r
+\r
+ @retval EFI_SUCCESS The flush request was queued if Event is not\r
+ NULL. All outstanding data was written\r
+ correctly to the device if the Event is NULL.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while attempting\r
+ to write data.\r
+ @retval EFI_WRITE_PROTECTED The device cannot be written to.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r
+ lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RamDiskBlkIo2FlushBlocksEx (\r
+ IN EFI_BLOCK_IO2_PROTOCOL *This,\r
+ IN OUT EFI_BLOCK_IO2_TOKEN *Token\r
+ );\r
+\r
/**\r
This function publish the RAM disk configuration Form.\r
\r
IN UINT64 Attributes\r
);\r
\r
+\r
+/**\r
+ Publish the RAM disk NVDIMM Firmware Interface Table (NFIT) to the ACPI\r
+ table.\r
+\r
+ @param[in] PrivateData Points to RAM disk private data.\r
+\r
+ @retval EFI_SUCCESS The RAM disk NFIT has been published.\r
+ @retval others The RAM disk NFIT has not been published.\r
+\r
+**/\r
+EFI_STATUS\r
+RamDiskPublishNfit (\r
+ IN RAM_DISK_PRIVATE_DATA *PrivateData\r
+ );\r
+\r
#endif\r