physheap_config.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*************************************************************************/ /*!
  2. @File physheap_config.h
  3. @Title Physical heap Config API
  4. @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
  5. @Description Physical heap configs are created in the system layer and
  6. stored against each device node for use in the Services Server
  7. common layer.
  8. @License Dual MIT/GPLv2
  9. The contents of this file are subject to the MIT license as set out below.
  10. Permission is hereby granted, free of charge, to any person obtaining a copy
  11. of this software and associated documentation files (the "Software"), to deal
  12. in the Software without restriction, including without limitation the rights
  13. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14. copies of the Software, and to permit persons to whom the Software is
  15. furnished to do so, subject to the following conditions:
  16. The above copyright notice and this permission notice shall be included in
  17. all copies or substantial portions of the Software.
  18. Alternatively, the contents of this file may be used under the terms of
  19. the GNU General Public License Version 2 ("GPL") in which case the provisions
  20. of GPL are applicable instead of those above.
  21. If you wish to allow use of your version of this file only under the terms of
  22. GPL, and not to allow others to use your version of this file under the terms
  23. of the MIT license, indicate your decision by deleting the provisions above
  24. and replace them with the notice and other provisions required by GPL as set
  25. out in the file called "GPL-COPYING" included in this distribution. If you do
  26. not delete the provisions above, a recipient may use your version of this file
  27. under the terms of either the MIT license or GPL.
  28. This License is also included in this distribution in the file called
  29. "MIT-COPYING".
  30. EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
  31. PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  32. BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  33. PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
  34. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  35. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  36. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  37. */ /**************************************************************************/
  38. #ifndef PHYSHEAP_CONFIG_H
  39. #define PHYSHEAP_CONFIG_H
  40. #include "img_types.h"
  41. #include "pvrsrv_memallocflags.h"
  42. #include "pvrsrv_memalloc_physheap.h"
  43. typedef IMG_UINT32 PHYS_HEAP_USAGE_FLAGS;
  44. #define PHYS_HEAP_USAGE_GPU_LOCAL (1<<PVRSRV_PHYS_HEAP_GPU_LOCAL)
  45. #define PHYS_HEAP_USAGE_CPU_LOCAL (1<<PVRSRV_PHYS_HEAP_CPU_LOCAL)
  46. #define PHYS_HEAP_USAGE_FW_MAIN (1<<PVRSRV_PHYS_HEAP_FW_MAIN)
  47. #define PHYS_HEAP_USAGE_FW_CONFIG (1<<PVRSRV_PHYS_HEAP_FW_CONFIG)
  48. #define PHYS_HEAP_USAGE_EXTERNAL (1<<PVRSRV_PHYS_HEAP_EXTERNAL)
  49. #define PHYS_HEAP_USAGE_GPU_PRIVATE (1<<PVRSRV_PHYS_HEAP_GPU_PRIVATE)
  50. #define PHYS_HEAP_USAGE_GPU_COHERENT (1<<PVRSRV_PHYS_HEAP_GPU_COHERENT)
  51. #define PHYS_HEAP_USAGE_GPU_SECURE (1<<PVRSRV_PHYS_HEAP_GPU_SECURE)
  52. #define PHYS_HEAP_USAGE_FW_CODE (1<<PVRSRV_PHYS_HEAP_FW_CODE)
  53. #define PHYS_HEAP_USAGE_FW_PRIV_DATA (1<<PVRSRV_PHYS_HEAP_FW_PRIV_DATA)
  54. #define PHYS_HEAP_USAGE_WRAP (1<<30)
  55. #define PHYS_HEAP_USAGE_DISPLAY (1<<31)
  56. typedef void (*CpuPAddrToDevPAddr)(IMG_HANDLE hPrivData,
  57. IMG_UINT32 ui32NumOfAddr,
  58. IMG_DEV_PHYADDR *psDevPAddr,
  59. IMG_CPU_PHYADDR *psCpuPAddr);
  60. typedef void (*DevPAddrToCpuPAddr)(IMG_HANDLE hPrivData,
  61. IMG_UINT32 ui32NumOfAddr,
  62. IMG_CPU_PHYADDR *psCpuPAddr,
  63. IMG_DEV_PHYADDR *psDevPAddr);
  64. /*! Structure used to hold function pointers used for run-time physical address
  65. * translation by Services. Gives flexibility to allow the CPU and GPU to see
  66. * the same pool of physical RAM and different physical bus addresses.
  67. * Both fields must be valid functions even if the conversion is simple.
  68. */
  69. typedef struct _PHYS_HEAP_FUNCTIONS_
  70. {
  71. /*! Translate CPU physical address to device physical address */
  72. CpuPAddrToDevPAddr pfnCpuPAddrToDevPAddr;
  73. /*! Translate device physical address to CPU physical address */
  74. DevPAddrToCpuPAddr pfnDevPAddrToCpuPAddr;
  75. } PHYS_HEAP_FUNCTIONS;
  76. /*! Type conveys the class of physical heap to instantiate within Services
  77. * for the physical pool of memory. */
  78. typedef enum _PHYS_HEAP_TYPE_
  79. {
  80. PHYS_HEAP_TYPE_UNKNOWN = 0, /*!< Not a valid value for any config */
  81. PHYS_HEAP_TYPE_UMA, /*!< Heap represents OS managed physical memory heap
  82. i.e. system RAM. Unified Memory Architecture
  83. physmem_osmem PMR factory */
  84. PHYS_HEAP_TYPE_LMA, /*!< Heap represents physical memory pool managed by
  85. Services i.e. carve out from system RAM or local
  86. card memory. Local Memory Architecture
  87. physmem_lma PMR factory */
  88. PHYS_HEAP_TYPE_DMA, /*!< Heap represents a physical memory pool managed by
  89. Services, alias of LMA and is only used on
  90. VZ non-native system configurations for
  91. a heap used for PHYS_HEAP_USAGE_FW_MAIN tagged
  92. buffers */
  93. #if defined(SUPPORT_WRAP_EXTMEMOBJECT)
  94. PHYS_HEAP_TYPE_WRAP, /*!< Heap used to group UM buffers given
  95. to Services. Integrity OS port only. */
  96. #endif
  97. } PHYS_HEAP_TYPE;
  98. /*! Structure used to describe a physical Heap supported by a system. A
  99. * system layer module can declare multiple physical heaps for different
  100. * purposes. At a minimum a system must provide one physical heap tagged for
  101. * PHYS_HEAP_USAGE_GPU_LOCAL use.
  102. * A heap represents a discrete pool of physical memory and how it is managed,
  103. * as well as associating other properties and address translation logic.
  104. * The structure fields sStartAddr, sCardBase and uiSize must be given valid
  105. * values for LMA and DMA physical heaps types.
  106. */
  107. typedef struct _PHYS_HEAP_CONFIG_
  108. {
  109. PHYS_HEAP_TYPE eType; /*!< Class of heap and PMR factory used */
  110. IMG_CHAR* pszPDumpMemspaceName; /*!< Name given to the heap's symbolic memory
  111. space in a PDUMP enabled driver */
  112. PHYS_HEAP_FUNCTIONS* psMemFuncs; /*!< Physical address translation functions */
  113. IMG_CPU_PHYADDR sStartAddr; /*!< CPU Physical base address of memory region */
  114. IMG_DEV_PHYADDR sCardBase; /*!< Device physical base address of memory
  115. region as seen from the PoV of the GPU */
  116. IMG_UINT64 uiSize; /*!< Size of memory region in bytes */
  117. IMG_HANDLE hPrivData; /*!< System layer private data shared with
  118. psMemFuncs */
  119. PHYS_HEAP_USAGE_FLAGS ui32UsageFlags; /*!< Supported uses flags, conveys the type of
  120. buffers the physical heap can be used for */
  121. } PHYS_HEAP_CONFIG;
  122. #endif