xref: /openbmc/linux/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
17946340fSRex Zhu /*
27946340fSRex Zhu  * Copyright 2016 Advanced Micro Devices, Inc.
37946340fSRex Zhu  *
47946340fSRex Zhu  * Permission is hereby granted, free of charge, to any person obtaining a
57946340fSRex Zhu  * copy of this software and associated documentation files (the "Software"),
67946340fSRex Zhu  * to deal in the Software without restriction, including without limitation
77946340fSRex Zhu  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87946340fSRex Zhu  * and/or sell copies of the Software, and to permit persons to whom the
97946340fSRex Zhu  * Software is furnished to do so, subject to the following conditions:
107946340fSRex Zhu  *
117946340fSRex Zhu  * The above copyright notice and this permission notice shall be included in
127946340fSRex Zhu  * all copies or substantial portions of the Software.
137946340fSRex Zhu  *
147946340fSRex Zhu  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
157946340fSRex Zhu  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167946340fSRex Zhu  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
177946340fSRex Zhu  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
187946340fSRex Zhu  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
197946340fSRex Zhu  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
207946340fSRex Zhu  * OTHER DEALINGS IN THE SOFTWARE.
217946340fSRex Zhu  *
227946340fSRex Zhu  * Author: Monk.liu@amd.com
237946340fSRex Zhu  */
247946340fSRex Zhu 
257946340fSRex Zhu #ifndef AMDGPU_CSA_MANAGER_H
267946340fSRex Zhu #define AMDGPU_CSA_MANAGER_H
277946340fSRex Zhu 
288469868dSRex Zhu #define AMDGPU_CSA_SIZE		(128 * 1024)
297946340fSRex Zhu 
307946340fSRex Zhu uint32_t amdgpu_get_total_csa_size(struct amdgpu_device *adev);
317946340fSRex Zhu uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev);
327946340fSRex Zhu int amdgpu_allocate_static_csa(struct amdgpu_device *adev, struct amdgpu_bo **bo,
337946340fSRex Zhu 				u32 domain, uint32_t size);
347946340fSRex Zhu int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
357946340fSRex Zhu 			  struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va,
367946340fSRex Zhu 			  uint64_t csa_addr, uint32_t size);
37*5daff15cSLang Yu int amdgpu_unmap_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
38*5daff15cSLang Yu 			    struct amdgpu_bo *bo, struct amdgpu_bo_va *bo_va,
39*5daff15cSLang Yu 			    uint64_t csa_addr);
407946340fSRex Zhu void amdgpu_free_static_csa(struct amdgpu_bo **bo);
417946340fSRex Zhu 
427946340fSRex Zhu #endif
43