1
0

ramdenum.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. ramdenum.c
  5. Abstract:
  6. This module implements support for creating a Block I/O protocol from a
  7. RAM Disk device.
  8. Author:
  9. Chris Stevens 19-Mar-2015
  10. Environment:
  11. Firmware
  12. --*/
  13. //
  14. // ------------------------------------------------------------------- Includes
  15. //
  16. #include <uefifw.h>
  17. //
  18. // --------------------------------------------------------------------- Macros
  19. //
  20. //
  21. // ---------------------------------------------------------------- Definitions
  22. //
  23. //
  24. // ------------------------------------------------------ Data Type Definitions
  25. //
  26. //
  27. // ----------------------------------------------- Internal Function Prototypes
  28. //
  29. //
  30. // -------------------------------------------------------------------- Globals
  31. //
  32. //
  33. // The RAM disk is embedded in the firmware image.
  34. //
  35. extern CHAR8 _binary_ramdisk_start;
  36. extern CHAR8 _binary_ramdisk_end;
  37. //
  38. // ------------------------------------------------------------------ Functions
  39. //
  40. EFI_STATUS
  41. EfipEnumerateRamDisks (
  42. VOID
  43. )
  44. /*++
  45. Routine Description:
  46. This routine enumerates any RAM disks embedded in the firmware.
  47. Arguments:
  48. None.
  49. Return Value:
  50. EFI Status code.
  51. --*/
  52. {
  53. EFI_PHYSICAL_ADDRESS Base;
  54. UINT64 Length;
  55. EFI_STATUS Status;
  56. Base = (EFI_PHYSICAL_ADDRESS)(UINTN)(&_binary_ramdisk_start);
  57. Length = (UINTN)(&_binary_ramdisk_end) - (UINTN)(&_binary_ramdisk_start);
  58. if (Length <= 0x100) {
  59. return EFI_SUCCESS;
  60. }
  61. Status = EfiCoreEnumerateRamDisk(Base, Length);
  62. return Status;
  63. }
  64. //
  65. // --------------------------------------------------------- Internal Functions
  66. //