memmap.c 2.5 KB

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