summaryrefslogtreecommitdiff
path: root/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_mem_mmu.h
blob: a199fd66b5a67332456d39f80daaa7e51edffa10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (C) 2010-2011 ARM Limited. All rights reserved.
 * 
 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
 * 
 * A copy of the licence is included with the program, and can also be obtained from Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef __MALI_KERNEL_MEM_MMU_H__
#define __MALI_KERNEL_MEM_MMU_H__

#include "mali_kernel_session_manager.h"

/**
 * Lookup a MMU core by ID.
 * @param id ID of the MMU to find
 * @return NULL if ID not found or valid, non-NULL if a core was found.
 */
void* mali_memory_core_mmu_lookup(u32 id);

/**
 * Activate a user session with its address space on the given MMU.
 * If the session can't be activated due to that the MMU is busy and
 * a callback pointer is given, the callback will be called once the MMU becomes idle.
 * If the same callback pointer is registered multiple time it will only be called once.
 * Nested activations are supported.
 * Each call must be matched by a call to @see mali_memory_core_mmu_release_address_space_reference
 *
 * @param mmu The MMU to activate the address space on
 * @param mali_session_data The user session object which address space to activate
 * @param callback Pointer to the function to call when the MMU becomes idle
 * @param callback_arg Argument given to the callback
 * @return 0 if the address space was activated, -EBUSY if the MMU was busy, -EFAULT in all other cases.
 */
int mali_memory_core_mmu_activate_page_table(void* mmu_ptr, struct mali_session_data * mali_session_data, void(*callback)(void*), void * callback_argument);

/**
 * Release a reference to the current active address space.
 * Once the last reference is released any callback(s) registered will be called before the function returns
 *
 * @note Caution must be shown calling this function with locks held due to that callback can be called
 * @param mmu The mmu to release a reference to the active address space of
 */
void mali_memory_core_mmu_release_address_space_reference(void* mmu);

/**
 * Soft reset of MMU - needed after power up
 *
 * @param mmu_ptr The MMU pointer registered with the relevant core
 */
void mali_kernel_mmu_reset(void * mmu_ptr);

void mali_kernel_mmu_force_bus_reset(void * mmu_ptr);

/**
 * Unregister a previously registered callback.
 * @param mmu The MMU to unregister the callback on
 * @param callback The function to unregister
 */
void mali_memory_core_mmu_unregister_callback(void* mmu, void(*callback)(void*));



#endif /* __MALI_KERNEL_MEM_MMU_H__ */