msm_memshare.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef _LINUX_MEM_SHARE_H
  14. #define _LINUX_MEM_SHARE_H
  15. #define MEM_SHARE_SERVICE_SVC_ID 0x00000034
  16. #define MEM_SHARE_SERVICE_INS_ID 1
  17. #define MEM_SHARE_SERVICE_VERS 1
  18. #define MEMORY_CMA 1
  19. #define MEMORY_NON_CMA 0
  20. #define MAX_CLIENTS 10
  21. #define GPS 0
  22. #define CHECK 0
  23. #define FREE 1
  24. #define MEMSHARE_GUARD_BYTES (4*1024)
  25. struct mem_blocks {
  26. /* Client Id information */
  27. uint32_t client_id;
  28. /* Peripheral associated with client */
  29. uint32_t peripheral;
  30. /* Sequence Id */
  31. uint32_t sequence_id;
  32. /* CMA or Non-CMA region */
  33. uint32_t memory_type;
  34. /* Guaranteed Memory */
  35. uint32_t guarantee;
  36. /* Memory alloted or not */
  37. uint32_t allotted;
  38. /* Memory allocation request received or not */
  39. uint32_t alloc_request;
  40. /* Size required for client */
  41. uint32_t size;
  42. /*
  43. * start address of the memory block reserved by server memory
  44. * subsystem to client
  45. */
  46. phys_addr_t phy_addr;
  47. /* Virtual address for the physical address allocated */
  48. void *virtual_addr;
  49. /* Release memory only when XPU is released*/
  50. uint8_t free_memory;
  51. /* Need Hypervisor mapping*/
  52. uint8_t hyp_mapping;
  53. /* Status flag which checks if ramdump file is created*/
  54. int file_created;
  55. };
  56. int memshare_alloc(struct device *dev,
  57. unsigned int block_size,
  58. struct mem_blocks *pblk);
  59. void memshare_free(unsigned int block_size,
  60. struct mem_blocks *pblk);
  61. #endif /* _LINUX_MEM_SHARE_H */