fvp_private.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice, this
  8. * list of conditions and the following disclaimer.
  9. *
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. * this list of conditions and the following disclaimer in the documentation
  12. * and/or other materials provided with the distribution.
  13. *
  14. * Neither the name of ARM nor the names of its contributors may be used
  15. * to endorse or promote products derived from this software without specific
  16. * prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  22. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. * POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef __FVP_PRIVATE_H__
  31. #define __FVP_PRIVATE_H__
  32. #include <bakery_lock.h>
  33. #include <bl_common.h>
  34. #include <cpu_data.h>
  35. #include <platform_def.h>
  36. typedef volatile struct mailbox {
  37. unsigned long value
  38. __attribute__((__aligned__(CACHE_WRITEBACK_GRANULE)));
  39. } mailbox_t;
  40. /*******************************************************************************
  41. * This structure represents the superset of information that is passed to
  42. * BL31 e.g. while passing control to it from BL2 which is bl31_params
  43. * and bl31_plat_params and its elements
  44. ******************************************************************************/
  45. typedef struct bl2_to_bl31_params_mem {
  46. bl31_params_t bl31_params;
  47. image_info_t bl31_image_info;
  48. image_info_t bl32_image_info;
  49. image_info_t bl33_image_info;
  50. entry_point_info_t bl33_ep_info;
  51. entry_point_info_t bl32_ep_info;
  52. entry_point_info_t bl31_ep_info;
  53. } bl2_to_bl31_params_mem_t;
  54. #if USE_COHERENT_MEM
  55. /*
  56. * These are wrapper macros to the Coherent Memory Bakery Lock API.
  57. */
  58. #define fvp_lock_init(_lock_arg) bakery_lock_init(_lock_arg)
  59. #define fvp_lock_get(_lock_arg) bakery_lock_get(_lock_arg)
  60. #define fvp_lock_release(_lock_arg) bakery_lock_release(_lock_arg)
  61. #else
  62. /*******************************************************************************
  63. * Constants to specify how many bakery locks this platform implements. These
  64. * are used if the platform chooses not to use coherent memory for bakery lock
  65. * data structures.
  66. ******************************************************************************/
  67. #define FVP_MAX_BAKERIES 1
  68. #define FVP_PWRC_BAKERY_ID 0
  69. /*******************************************************************************
  70. * Definition of structure which holds platform specific per-cpu data. Currently
  71. * it holds only the bakery lock information for each cpu. Constants to
  72. * specify how many bakeries this platform implements and bakery ids are
  73. * specified in fvp_def.h
  74. ******************************************************************************/
  75. typedef struct fvp_cpu_data {
  76. bakery_info_t pcpu_bakery_info[FVP_MAX_BAKERIES];
  77. } fvp_cpu_data_t;
  78. /* Macro to define the offset of bakery_info_t in fvp_cpu_data_t */
  79. #define FVP_CPU_DATA_LOCK_OFFSET __builtin_offsetof\
  80. (fvp_cpu_data_t, pcpu_bakery_info)
  81. /*******************************************************************************
  82. * Helper macros for bakery lock api when using the above fvp_cpu_data_t for
  83. * bakery lock data structures. It assumes that the bakery_info is at the
  84. * beginning of the platform specific per-cpu data.
  85. ******************************************************************************/
  86. #define fvp_lock_init(_lock_arg) /* No init required */
  87. #define fvp_lock_get(_lock_arg) bakery_lock_get(_lock_arg, \
  88. CPU_DATA_PLAT_PCPU_OFFSET + \
  89. FVP_CPU_DATA_LOCK_OFFSET)
  90. #define fvp_lock_release(_lock_arg) bakery_lock_release(_lock_arg, \
  91. CPU_DATA_PLAT_PCPU_OFFSET + \
  92. FVP_CPU_DATA_LOCK_OFFSET)
  93. /*
  94. * Ensure that the size of the FVP specific per-cpu data structure and the size
  95. * of the memory allocated in generic per-cpu data for the platform are the same.
  96. */
  97. CASSERT(PLAT_PCPU_DATA_SIZE == sizeof(fvp_cpu_data_t), \
  98. fvp_pcpu_data_size_mismatch);
  99. #endif /* __USE_COHERENT_MEM__ */
  100. /*******************************************************************************
  101. * Function and variable prototypes
  102. ******************************************************************************/
  103. void fvp_configure_mmu_el1(unsigned long total_base,
  104. unsigned long total_size,
  105. unsigned long,
  106. unsigned long,
  107. unsigned long,
  108. unsigned long);
  109. void fvp_configure_mmu_el3(unsigned long total_base,
  110. unsigned long total_size,
  111. unsigned long,
  112. unsigned long,
  113. unsigned long,
  114. unsigned long);
  115. int fvp_config_setup(void);
  116. void fvp_cci_init(void);
  117. void fvp_cci_enable(void);
  118. void fvp_gic_init(void);
  119. /* Declarations for fvp_topology.c */
  120. int fvp_setup_topology(void);
  121. /* Declarations for fvp_io_storage.c */
  122. void fvp_io_setup(void);
  123. /* Declarations for fvp_security.c */
  124. void fvp_security_setup(void);
  125. /* Gets the SPR for BL32 entry */
  126. uint32_t fvp_get_spsr_for_bl32_entry(void);
  127. /* Gets the SPSR for BL33 entry */
  128. uint32_t fvp_get_spsr_for_bl33_entry(void);
  129. #endif /* __FVP_PRIVATE_H__ */