• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   The header file of RamDiskDxe driver.
3 
4   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _RAM_DISK_IMPL_H_
16 #define _RAM_DISK_IMPL_H_
17 
18 #include <Uefi.h>
19 #include <Library/BaseLib.h>
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/UefiLib.h>
23 #include <Library/UefiDriverEntryPoint.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/UefiHiiServicesLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/HiiLib.h>
28 #include <Library/FileExplorerLib.h>
29 #include <Library/DevicePathLib.h>
30 #include <Library/PrintLib.h>
31 #include <Library/PcdLib.h>
32 #include <Library/DxeServicesLib.h>
33 #include <Protocol/RamDisk.h>
34 #include <Protocol/BlockIo.h>
35 #include <Protocol/BlockIo2.h>
36 #include <Protocol/HiiConfigAccess.h>
37 #include <Protocol/SimpleFileSystem.h>
38 #include <Protocol/AcpiTable.h>
39 #include <Protocol/AcpiSystemDescriptionTable.h>
40 #include <Guid/MdeModuleHii.h>
41 #include <Guid/RamDiskHii.h>
42 #include <Guid/FileInfo.h>
43 #include <IndustryStandard/Acpi61.h>
44 
45 #include "RamDiskNVData.h"
46 
47 ///
48 /// RAM disk general definitions and declarations
49 ///
50 
51 //
52 // Block size for RAM disk
53 //
54 #define RAM_DISK_BLOCK_SIZE 512
55 
56 //
57 // Iterate through the double linked list. NOT delete safe
58 //
59 #define EFI_LIST_FOR_EACH(Entry, ListHead)    \
60   for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
61 
62 //
63 // Iterate through the double linked list. This is delete-safe.
64 // Do not touch NextEntry
65 //
66 #define EFI_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead)            \
67   for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\
68       Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink)
69 
70 //
71 // RamDiskDxe driver maintains a list of registered RAM disks.
72 //
73 extern  LIST_ENTRY                RegisteredRamDisks;
74 
75 //
76 // Pointers to the EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL.
77 //
78 extern  EFI_ACPI_TABLE_PROTOCOL   *mAcpiTableProtocol;
79 extern  EFI_ACPI_SDT_PROTOCOL     *mAcpiSdtProtocol;
80 
81 //
82 // RAM Disk create method.
83 //
84 typedef enum _RAM_DISK_CREATE_METHOD {
85   RamDiskCreateOthers             = 0,
86   RamDiskCreateHii
87 } RAM_DISK_CREATE_METHOD;
88 
89 //
90 // RamDiskDxe driver maintains a list of registered RAM disks.
91 // The struct contains the list entry and the information of each RAM
92 // disk
93 //
94 typedef struct {
95   UINTN                           Signature;
96 
97   EFI_HANDLE                      Handle;
98 
99   EFI_BLOCK_IO_PROTOCOL           BlockIo;
100   EFI_BLOCK_IO2_PROTOCOL          BlockIo2;
101   EFI_BLOCK_IO_MEDIA              Media;
102   EFI_DEVICE_PATH_PROTOCOL        *DevicePath;
103 
104   UINT64                          StartingAddr;
105   UINT64                          Size;
106   EFI_GUID                        TypeGuid;
107   UINT16                          InstanceNumber;
108   RAM_DISK_CREATE_METHOD          CreateMethod;
109   BOOLEAN                         InNfit;
110   EFI_QUESTION_ID                 CheckBoxId;
111   BOOLEAN                         CheckBoxChecked;
112 
113   LIST_ENTRY                      ThisInstance;
114 } RAM_DISK_PRIVATE_DATA;
115 
116 #define RAM_DISK_PRIVATE_DATA_SIGNATURE     SIGNATURE_32 ('R', 'D', 'S', 'K')
117 #define RAM_DISK_PRIVATE_FROM_BLKIO(a)      CR (a, RAM_DISK_PRIVATE_DATA, BlockIo, RAM_DISK_PRIVATE_DATA_SIGNATURE)
118 #define RAM_DISK_PRIVATE_FROM_BLKIO2(a)     CR (a, RAM_DISK_PRIVATE_DATA, BlockIo2, RAM_DISK_PRIVATE_DATA_SIGNATURE)
119 #define RAM_DISK_PRIVATE_FROM_THIS(a)       CR (a, RAM_DISK_PRIVATE_DATA, ThisInstance, RAM_DISK_PRIVATE_DATA_SIGNATURE)
120 
121 ///
122 /// RAM disk HII-related definitions and declarations
123 ///
124 
125 //
126 // Tool generated IFR binary data and String package data
127 //
128 extern  UINT8                     RamDiskHiiBin[];
129 extern  UINT8                     RamDiskDxeStrings[];
130 
131 typedef struct {
132   VENDOR_DEVICE_PATH              VendorDevicePath;
133   EFI_DEVICE_PATH_PROTOCOL        End;
134 } HII_VENDOR_DEVICE_PATH;
135 
136 typedef struct {
137   UINTN                           Signature;
138 
139   RAM_DISK_CONFIGURATION          ConfigStore;
140 
141   EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;
142   EFI_HANDLE                      DriverHandle;
143   EFI_HII_HANDLE                  HiiHandle;
144 } RAM_DISK_CONFIG_PRIVATE_DATA;
145 
146 extern RAM_DISK_CONFIG_PRIVATE_DATA    mRamDiskConfigPrivateDataTemplate;
147 
148 #define RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE   SIGNATURE_32 ('R', 'C', 'F', 'G')
149 #define RAM_DISK_CONFIG_PRIVATE_FROM_THIS(a)     CR (a, RAM_DISK_CONFIG_PRIVATE_DATA, ConfigAccess, RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE)
150 
151 /**
152   Register a RAM disk with specified address, size and type.
153 
154   @param[in]  RamDiskBase    The base address of registered RAM disk.
155   @param[in]  RamDiskSize    The size of registered RAM disk.
156   @param[in]  RamDiskType    The type of registered RAM disk. The GUID can be
157                              any of the values defined in section 9.3.6.9, or a
158                              vendor defined GUID.
159   @param[in]  ParentDevicePath
160                              Pointer to the parent device path. If there is no
161                              parent device path then ParentDevicePath is NULL.
162   @param[out] DevicePath     On return, points to a pointer to the device path
163                              of the RAM disk device.
164                              If ParentDevicePath is not NULL, the returned
165                              DevicePath is created by appending a RAM disk node
166                              to the parent device path. If ParentDevicePath is
167                              NULL, the returned DevicePath is a RAM disk device
168                              path without appending. This function is
169                              responsible for allocating the buffer DevicePath
170                              with the boot service AllocatePool().
171 
172   @retval EFI_SUCCESS             The RAM disk is registered successfully.
173   @retval EFI_INVALID_PARAMETER   DevicePath or RamDiskType is NULL.
174                                   RamDiskSize is 0.
175   @retval EFI_ALREADY_STARTED     A Device Path Protocol instance to be created
176                                   is already present in the handle database.
177   @retval EFI_OUT_OF_RESOURCES    The RAM disk register operation fails due to
178                                   resource limitation.
179 
180 **/
181 EFI_STATUS
182 EFIAPI
183 RamDiskRegister (
184   IN UINT64                       RamDiskBase,
185   IN UINT64                       RamDiskSize,
186   IN EFI_GUID                     *RamDiskType,
187   IN EFI_DEVICE_PATH              *ParentDevicePath     OPTIONAL,
188   OUT EFI_DEVICE_PATH_PROTOCOL    **DevicePath
189   );
190 
191 /**
192   Unregister a RAM disk specified by DevicePath.
193 
194   @param[in] DevicePath      A pointer to the device path that describes a RAM
195                              Disk device.
196 
197   @retval EFI_SUCCESS             The RAM disk is unregistered successfully.
198   @retval EFI_INVALID_PARAMETER   DevicePath is NULL.
199   @retval EFI_UNSUPPORTED         The device specified by DevicePath is not a
200                                   valid ramdisk device path and not supported
201                                   by the driver.
202   @retval EFI_NOT_FOUND           The RAM disk pointed by DevicePath doesn't
203                                   exist.
204 
205 **/
206 EFI_STATUS
207 EFIAPI
208 RamDiskUnregister (
209   IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath
210   );
211 
212 /**
213   Initialize the BlockIO protocol of a RAM disk device.
214 
215   @param[in] PrivateData     Points to RAM disk private data.
216 
217 **/
218 VOID
219 RamDiskInitBlockIo (
220   IN     RAM_DISK_PRIVATE_DATA    *PrivateData
221   );
222 
223 /**
224   Reset the Block Device.
225 
226   @param[in] This            Indicates a pointer to the calling context.
227   @param[in] ExtendedVerification
228                              Driver may perform diagnostics on reset.
229 
230   @retval EFI_SUCCESS             The device was reset.
231   @retval EFI_DEVICE_ERROR        The device is not functioning properly and
232                                   could not be reset.
233 
234 **/
235 EFI_STATUS
236 EFIAPI
237 RamDiskBlkIoReset (
238   IN EFI_BLOCK_IO_PROTOCOL        *This,
239   IN BOOLEAN                      ExtendedVerification
240   );
241 
242 /**
243   Read BufferSize bytes from Lba into Buffer.
244 
245   @param[in]  This           Indicates a pointer to the calling context.
246   @param[in]  MediaId        Id of the media, changes every time the media is
247                              replaced.
248   @param[in]  Lba            The starting Logical Block Address to read from.
249   @param[in]  BufferSize     Size of Buffer, must be a multiple of device block
250                              size.
251   @param[out] Buffer         A pointer to the destination buffer for the data.
252                              The caller is responsible for either having
253                              implicit or explicit ownership of the buffer.
254 
255   @retval EFI_SUCCESS             The data was read correctly from the device.
256   @retval EFI_DEVICE_ERROR        The device reported an error while performing
257                                   the read.
258   @retval EFI_NO_MEDIA            There is no media in the device.
259   @retval EFI_MEDIA_CHANGED       The MediaId does not matched the current
260                                   device.
261   @retval EFI_BAD_BUFFER_SIZE     The Buffer was not a multiple of the block
262                                   size of the device.
263   @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not
264                                   valid, or the buffer is not on proper alignment.
265 
266 **/
267 EFI_STATUS
268 EFIAPI
269 RamDiskBlkIoReadBlocks (
270   IN EFI_BLOCK_IO_PROTOCOL        *This,
271   IN UINT32                       MediaId,
272   IN EFI_LBA                      Lba,
273   IN UINTN                        BufferSize,
274   OUT VOID                        *Buffer
275   );
276 
277 /**
278   Write BufferSize bytes from Lba into Buffer.
279 
280   @param[in] This            Indicates a pointer to the calling context.
281   @param[in] MediaId         The media ID that the write request is for.
282   @param[in] Lba             The starting logical block address to be written.
283                              The caller is responsible for writing to only
284                              legitimate locations.
285   @param[in] BufferSize      Size of Buffer, must be a multiple of device block
286                              size.
287   @param[in] Buffer          A pointer to the source buffer for the data.
288 
289   @retval EFI_SUCCESS             The data was written correctly to the device.
290   @retval EFI_WRITE_PROTECTED     The device can not be written to.
291   @retval EFI_DEVICE_ERROR        The device reported an error while performing
292                                   the write.
293   @retval EFI_NO_MEDIA            There is no media in the device.
294   @retval EFI_MEDIA_CHNAGED       The MediaId does not matched the current
295                                   device.
296   @retval EFI_BAD_BUFFER_SIZE     The Buffer was not a multiple of the block
297                                   size of the device.
298   @retval EFI_INVALID_PARAMETER   The write request contains LBAs that are not
299                                   valid, or the buffer is not on proper alignment.
300 
301 **/
302 EFI_STATUS
303 EFIAPI
304 RamDiskBlkIoWriteBlocks (
305   IN EFI_BLOCK_IO_PROTOCOL        *This,
306   IN UINT32                       MediaId,
307   IN EFI_LBA                      Lba,
308   IN UINTN                        BufferSize,
309   IN VOID                         *Buffer
310   );
311 
312 /**
313   Flush the Block Device.
314 
315   @param[in] This            Indicates a pointer to the calling context.
316 
317   @retval EFI_SUCCESS             All outstanding data was written to the device.
318   @retval EFI_DEVICE_ERROR        The device reported an error while writting
319                                   back the data
320   @retval EFI_NO_MEDIA            There is no media in the device.
321 
322 **/
323 EFI_STATUS
324 EFIAPI
325 RamDiskBlkIoFlushBlocks (
326   IN EFI_BLOCK_IO_PROTOCOL        *This
327   );
328 
329 /**
330   Resets the block device hardware.
331 
332   @param[in] This                 The pointer of EFI_BLOCK_IO2_PROTOCOL.
333   @param[in] ExtendedVerification The flag about if extend verificate.
334 
335   @retval EFI_SUCCESS             The device was reset.
336   @retval EFI_DEVICE_ERROR        The block device is not functioning correctly
337                                   and could not be reset.
338 
339 **/
340 EFI_STATUS
341 EFIAPI
342 RamDiskBlkIo2Reset (
343   IN EFI_BLOCK_IO2_PROTOCOL       *This,
344   IN BOOLEAN                      ExtendedVerification
345   );
346 
347 /**
348   Reads the requested number of blocks from the device.
349 
350   @param[in]      This            Indicates a pointer to the calling context.
351   @param[in]      MediaId         The media ID that the read request is for.
352   @param[in]      Lba             The starting logical block address to read
353                                   from on the device.
354   @param[in, out] Token           A pointer to the token associated with the
355                                   transaction.
356   @param[in]      BufferSize      The size of the Buffer in bytes. This must be
357                                   a multiple of the intrinsic block size of the
358                                   device.
359   @param[out]     Buffer          A pointer to the destination buffer for the
360                                   data. The caller is responsible for either
361                                   having implicit or explicit ownership of the
362                                   buffer.
363 
364   @retval EFI_SUCCESS             The read request was queued if Token->Event
365                                   is not NULL. The data was read correctly from
366                                   the device if the Token->Event is NULL.
367   @retval EFI_DEVICE_ERROR        The device reported an error while attempting
368                                   to perform the read operation.
369   @retval EFI_NO_MEDIA            There is no media in the device.
370   @retval EFI_MEDIA_CHANGED       The MediaId is not for the current media.
371   @retval EFI_BAD_BUFFER_SIZE     The BufferSize parameter is not a multiple of
372                                   the intrinsic block size of the device.
373   @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not
374                                   valid, or the buffer is not on proper
375                                   alignment.
376   @retval EFI_OUT_OF_RESOURCES    The request could not be completed due to a
377                                   lack of resources.
378 
379 **/
380 EFI_STATUS
381 EFIAPI
382 RamDiskBlkIo2ReadBlocksEx (
383   IN     EFI_BLOCK_IO2_PROTOCOL   *This,
384   IN     UINT32                   MediaId,
385   IN     EFI_LBA                  Lba,
386   IN OUT EFI_BLOCK_IO2_TOKEN      *Token,
387   IN     UINTN                    BufferSize,
388      OUT VOID                     *Buffer
389   );
390 
391 /**
392   Writes a specified number of blocks to the device.
393 
394   @param[in]      This            Indicates a pointer to the calling context.
395   @param[in]      MediaId         The media ID that the write request is for.
396   @param[in]      Lba             The starting logical block address to be
397                                   written. The caller is responsible for
398                                   writing to only legitimate locations.
399   @param[in, out] Token           A pointer to the token associated with the
400                                   transaction.
401   @param[in]      BufferSize      The size in bytes of Buffer. This must be a
402                                   multiple of the intrinsic block size of the
403                                   device.
404   @param[in]      Buffer          A pointer to the source buffer for the data.
405 
406   @retval EFI_SUCCESS             The write request was queued if Event is not
407                                   NULL. The data was written correctly to the
408                                   device if the Event is NULL.
409   @retval EFI_WRITE_PROTECTED     The device cannot be written to.
410   @retval EFI_NO_MEDIA            There is no media in the device.
411   @retval EFI_MEDIA_CHANGED       The MediaId is not for the current media.
412   @retval EFI_DEVICE_ERROR        The device reported an error while attempting
413                                   to perform the write operation.
414   @retval EFI_BAD_BUFFER_SIZE     The BufferSize parameter is not a multiple of
415                                   the intrinsic block size of the device.
416   @retval EFI_INVALID_PARAMETER   The write request contains LBAs that are not
417                                   valid, or the buffer is not on proper
418                                   alignment.
419   @retval EFI_OUT_OF_RESOURCES    The request could not be completed due to a
420                                   lack of resources.
421 
422 **/
423 EFI_STATUS
424 EFIAPI
425 RamDiskBlkIo2WriteBlocksEx (
426   IN     EFI_BLOCK_IO2_PROTOCOL   *This,
427   IN     UINT32                   MediaId,
428   IN     EFI_LBA                  Lba,
429   IN OUT EFI_BLOCK_IO2_TOKEN      *Token,
430   IN     UINTN                    BufferSize,
431   IN     VOID                     *Buffer
432   );
433 
434 /**
435   Flushes all modified data to a physical block device.
436 
437   @param[in]      This            Indicates a pointer to the calling context.
438   @param[in, out] Token           A pointer to the token associated with the
439                                   transaction.
440 
441   @retval EFI_SUCCESS             The flush request was queued if Event is not
442                                   NULL. All outstanding data was written
443                                   correctly to the device if the Event is NULL.
444   @retval EFI_DEVICE_ERROR        The device reported an error while attempting
445                                   to write data.
446   @retval EFI_WRITE_PROTECTED     The device cannot be written to.
447   @retval EFI_NO_MEDIA            There is no media in the device.
448   @retval EFI_MEDIA_CHANGED       The MediaId is not for the current media.
449   @retval EFI_OUT_OF_RESOURCES    The request could not be completed due to a
450                                   lack of resources.
451 
452 **/
453 EFI_STATUS
454 EFIAPI
455 RamDiskBlkIo2FlushBlocksEx (
456   IN     EFI_BLOCK_IO2_PROTOCOL   *This,
457   IN OUT EFI_BLOCK_IO2_TOKEN      *Token
458   );
459 
460 /**
461   This function publish the RAM disk configuration Form.
462 
463   @param[in, out]  ConfigPrivateData
464                              Points to RAM disk configuration private data.
465 
466   @retval EFI_SUCCESS             HII Form is installed successfully.
467   @retval EFI_OUT_OF_RESOURCES    Not enough resource for HII Form installation.
468   @retval Others                  Other errors as indicated.
469 
470 **/
471 EFI_STATUS
472 InstallRamDiskConfigForm (
473   IN OUT RAM_DISK_CONFIG_PRIVATE_DATA       *ConfigPrivateData
474   );
475 
476 /**
477   This function removes RAM disk configuration Form.
478 
479   @param[in, out]  ConfigPrivateData
480                              Points to RAM disk configuration private data.
481 
482 **/
483 VOID
484 UninstallRamDiskConfigForm (
485   IN OUT RAM_DISK_CONFIG_PRIVATE_DATA       *ConfigPrivateData
486   );
487 
488 /**
489   Unregister all registered RAM disks.
490 
491 **/
492 VOID
493 UnregisterAllRamDisks (
494   VOID
495   );
496 
497 /**
498   This function allows a caller to extract the current configuration for one
499   or more named elements from the target driver.
500 
501   @param[in]  This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
502   @param[in]  Request        A null-terminated Unicode string in
503                              <ConfigRequest> format.
504   @param[out] Progress       On return, points to a character in the Request
505                              string. Points to the string's null terminator if
506                              request was successful. Points to the most recent
507                              '&' before the first failing name/value pair (or
508                              the beginning of the string if the failure is in
509                              the first name/value pair) if the request was not
510                              successful.
511   @param[out] Results        A null-terminated Unicode string in
512                              <ConfigAltResp> format which has all values filled
513                              in for the names in the Request string. String to
514                              be allocated by the called function.
515 
516   @retval EFI_SUCCESS             The Results is filled with the requested
517                                   values.
518   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the results.
519   @retval EFI_INVALID_PARAMETER   Request is illegal syntax, or unknown name.
520   @retval EFI_NOT_FOUND           Routing data doesn't match any storage in
521                                   this driver.
522 
523 **/
524 EFI_STATUS
525 EFIAPI
526 RamDiskExtractConfig (
527   IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
528   IN CONST EFI_STRING                       Request,
529        OUT EFI_STRING                       *Progress,
530        OUT EFI_STRING                       *Results
531   );
532 
533 /**
534   This function processes the results of changes in configuration.
535 
536   @param[in]  This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
537   @param[in]  Configuration  A null-terminated Unicode string in <ConfigResp>
538                              format.
539   @param[out] Progress       A pointer to a string filled in with the offset of
540                              the most recent '&' before the first failing
541                              name/value pair (or the beginning of the string if
542                              the failure is in the first name/value pair) or
543                              the terminating NULL if all was successful.
544 
545   @retval EFI_SUCCESS             The Results is processed successfully.
546   @retval EFI_INVALID_PARAMETER   Configuration is NULL.
547   @retval EFI_NOT_FOUND           Routing data doesn't match any storage in
548                                   this driver.
549 
550 **/
551 EFI_STATUS
552 EFIAPI
553 RamDiskRouteConfig (
554   IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
555   IN CONST EFI_STRING                       Configuration,
556        OUT EFI_STRING                       *Progress
557   );
558 
559 /**
560   This function processes the results of changes in configuration.
561 
562   @param[in]  This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
563   @param[in]  Action         Specifies the type of action taken by the browser.
564   @param[in]  QuestionId     A unique value which is sent to the original
565                              exporting driver so that it can identify the type
566                              of data to expect.
567   @param[in]  Type           The type of value for the question.
568   @param[in]  Value          A pointer to the data being sent to the original
569                              exporting driver.
570   @param[out] ActionRequest  On return, points to the action requested by the
571                              callback function.
572 
573   @retval EFI_SUCCESS             The callback successfully handled the action.
574   @retval EFI_OUT_OF_RESOURCES    Not enough storage is available to hold the
575                                   variable and its data.
576   @retval EFI_DEVICE_ERROR        The variable could not be saved.
577   @retval EFI_UNSUPPORTED         The specified Action is not supported by the
578                                   callback.
579 
580 **/
581 EFI_STATUS
582 EFIAPI
583 RamDiskCallback (
584   IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
585   IN     EFI_BROWSER_ACTION                 Action,
586   IN     EFI_QUESTION_ID                    QuestionId,
587   IN     UINT8                              Type,
588   IN     EFI_IFR_TYPE_VALUE                 *Value,
589      OUT EFI_BROWSER_ACTION_REQUEST         *ActionRequest
590   );
591 
592 
593 /**
594   This function gets the file information from an open file descriptor,
595   and stores it in a buffer allocated from pool.
596 
597   @param[in] FHand           File Handle.
598 
599   @return    A pointer to a buffer with file information or NULL is returned.
600 
601 **/
602 EFI_FILE_INFO *
603 FileInfo (
604   IN EFI_FILE_HANDLE                        FHand
605   );
606 
607 
608 /**
609   This function will open a file or directory referenced by DevicePath.
610 
611   This function opens a file with the open mode according to the file path. The
612   Attributes is valid only for EFI_FILE_MODE_CREATE.
613 
614   @param[in, out] FilePath   On input, the device path to the file.
615                              On output, the remaining device path.
616   @param[out]     FileHandle Pointer to the file handle.
617   @param[in]      OpenMode   The mode to open the file with.
618   @param[in]      Attributes The file's file attributes.
619 
620   @retval EFI_SUCCESS             The information was set.
621   @retval EFI_INVALID_PARAMETER   One of the parameters has an invalid value.
622   @retval EFI_UNSUPPORTED         Could not open the file path.
623   @retval EFI_NOT_FOUND           The specified file could not be found on the
624                                   device or the file system could not be found
625                                   on the device.
626   @retval EFI_NO_MEDIA            The device has no medium.
627   @retval EFI_MEDIA_CHANGED       The device has a different medium in it or
628                                   the medium is no longer supported.
629   @retval EFI_DEVICE_ERROR        The device reported an error.
630   @retval EFI_VOLUME_CORRUPTED    The file system structures are corrupted.
631   @retval EFI_WRITE_PROTECTED     The file or medium is write protected.
632   @retval EFI_ACCESS_DENIED       The file was opened read only.
633   @retval EFI_OUT_OF_RESOURCES    Not enough resources were available to open
634                                   the file.
635   @retval EFI_VOLUME_FULL         The volume is full.
636 **/
637 EFI_STATUS
638 EFIAPI
639 OpenFileByDevicePath(
640   IN OUT EFI_DEVICE_PATH_PROTOCOL           **FilePath,
641   OUT EFI_FILE_HANDLE                       *FileHandle,
642   IN UINT64                                 OpenMode,
643   IN UINT64                                 Attributes
644   );
645 
646 
647 /**
648   Publish the RAM disk NVDIMM Firmware Interface Table (NFIT) to the ACPI
649   table.
650 
651   @param[in] PrivateData          Points to RAM disk private data.
652 
653   @retval EFI_SUCCESS             The RAM disk NFIT has been published.
654   @retval others                  The RAM disk NFIT has not been published.
655 
656 **/
657 EFI_STATUS
658 RamDiskPublishNfit (
659   IN RAM_DISK_PRIVATE_DATA        *PrivateData
660   );
661 
662 #endif
663