1
0

memmap.c 2.9 KB

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