1
0

memmap.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. memmap.c
  5. Abstract:
  6. This module implements support for returning the initial memory map on the
  7. TI BeagleBone Black.
  8. Author:
  9. Evan Green 19-Dec-2014
  10. Environment:
  11. Firmware
  12. --*/
  13. //
  14. // ------------------------------------------------------------------- Includes
  15. //
  16. #include <uefifw.h>
  17. #include "bbonefw.h"
  18. #include <minoca/soc/am335x.h>
  19. //
  20. // ---------------------------------------------------------------- Definitions
  21. //
  22. #define BEAGLEBONE_BLACK_BOARD_MEMORY_MAP_SIZE \
  23. (sizeof(EfiBeagleBoneBlackMemoryMap) / \
  24. sizeof(EfiBeagleBoneBlackMemoryMap[0]))
  25. //
  26. // ------------------------------------------------------ Data Type Definitions
  27. //
  28. //
  29. // ----------------------------------------------- Internal Function Prototypes
  30. //
  31. //
  32. // -------------------------------------------------------------------- Globals
  33. //
  34. //
  35. // Define the initial memory map.
  36. //
  37. EFI_MEMORY_DESCRIPTOR EfiBeagleBoneBlackMemoryMap[] = {
  38. {
  39. EfiConventionalMemory,
  40. 0,
  41. BEAGLE_BONE_BLACK_RAM_START,
  42. 0,
  43. BEAGLE_BONE_BLACK_RAM_SIZE / EFI_PAGE_SIZE,
  44. 0
  45. },
  46. {
  47. EfiRuntimeServicesData,
  48. 0,
  49. AM335_PRCM_REGISTERS,
  50. 0,
  51. EFI_SIZE_TO_PAGES(AM335_PRCM_SIZE),
  52. EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
  53. },
  54. {
  55. EfiRuntimeServicesData,
  56. 0,
  57. AM335_RTC_BASE,
  58. 0,
  59. EFI_SIZE_TO_PAGES(AM335_RTC_SIZE),
  60. EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
  61. },
  62. };
  63. //
  64. // ------------------------------------------------------------------ Functions
  65. //
  66. EFI_STATUS
  67. EfiPlatformGetInitialMemoryMap (
  68. EFI_MEMORY_DESCRIPTOR **Map,
  69. UINTN *MapSize
  70. )
  71. /*++
  72. Routine Description:
  73. This routine returns the initial platform memory map to the EFI core. The
  74. core maintains this memory map. The memory map returned does not need to
  75. take into account the firmare image itself or stack, the EFI core will
  76. reserve those regions automatically.
  77. Arguments:
  78. Map - Supplies a pointer where the array of memory descriptors constituting
  79. the initial memory map is returned on success. The EFI core will make
  80. a copy of these descriptors, so they can be in read-only or
  81. temporary memory.
  82. MapSize - Supplies a pointer where the number of elements in the initial
  83. memory map will be returned on success.
  84. Return Value:
  85. EFI status code.
  86. --*/
  87. {
  88. *Map = EfiBeagleBoneBlackMemoryMap;
  89. *MapSize = BEAGLEBONE_BLACK_BOARD_MEMORY_MAP_SIZE;
  90. return EFI_SUCCESS;
  91. }
  92. //
  93. // --------------------------------------------------------- Internal Functions
  94. //