1
0

ramdenum.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*++
  2. Copyright (c) 2014 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. ramdenum.c
  9. Abstract:
  10. This module implements support for creating a Block I/O protocol from a
  11. RAM Disk device.
  12. Author:
  13. Evan Green 3-Apr-2014
  14. Environment:
  15. Firmware
  16. --*/
  17. //
  18. // ------------------------------------------------------------------- Includes
  19. //
  20. #include <uefifw.h>
  21. //
  22. // --------------------------------------------------------------------- Macros
  23. //
  24. //
  25. // ---------------------------------------------------------------- Definitions
  26. //
  27. //
  28. // ------------------------------------------------------ Data Type Definitions
  29. //
  30. //
  31. // ----------------------------------------------- Internal Function Prototypes
  32. //
  33. //
  34. // -------------------------------------------------------------------- Globals
  35. //
  36. //
  37. // The RAM disk is embedded in the firmware image.
  38. //
  39. extern CHAR8 _binary_ramdisk_start;
  40. extern CHAR8 _binary_ramdisk_end;
  41. //
  42. // ------------------------------------------------------------------ Functions
  43. //
  44. EFI_STATUS
  45. EfipEnumerateRamDisks (
  46. VOID
  47. )
  48. /*++
  49. Routine Description:
  50. This routine enumerates any RAM disks embedded in the firmware.
  51. Arguments:
  52. None.
  53. Return Value:
  54. EFI Status code.
  55. --*/
  56. {
  57. EFI_PHYSICAL_ADDRESS Base;
  58. UINT64 Length;
  59. EFI_STATUS Status;
  60. Base = (EFI_PHYSICAL_ADDRESS)(UINTN)(&_binary_ramdisk_start);
  61. Length = (UINTN)(&_binary_ramdisk_end) - (UINTN)(&_binary_ramdisk_start);
  62. if (Length <= 0x100) {
  63. return EFI_SUCCESS;
  64. }
  65. Status = EfiCoreEnumerateRamDisk(Base, Length);
  66. return Status;
  67. }
  68. //
  69. // --------------------------------------------------------- Internal Functions
  70. //