blob: 1e5bf9f0a886fe665261e6dbca84f271e71c5dbb (
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
|
#include "android/base/memory/LazyInstance.h"
#include "android/emulation/GoldfishDma.h"
#include "android/emulation/DmaMap.h"
#include "android/emulation/android_pipe_host.h"
#include "android/utils/assert.h"
#include "android/utils/debug.h"
#include "android/utils/system.h"
static void android_goldfish_dma_add_buffer(void* pipe, uint64_t guest_paddr, uint64_t sz) {
android::DmaMap::get()->addBuffer(pipe, guest_paddr, sz);
}
static void android_goldfish_dma_remove_buffer(uint64_t guest_paddr) {
android::DmaMap::get()->removeBuffer(guest_paddr);
}
static void* android_goldfish_dma_get_host_addr(uint64_t guest_paddr) {
return android::DmaMap::get()->getHostAddr(guest_paddr);
}
static void android_goldfish_dma_invalidate_host_mappings() {
android::DmaMap::get()->invalidateHostMappings();
}
static void android_goldfish_dma_unlock(uint64_t guest_paddr) {
void* hwpipe = android::DmaMap::get()->getPipeInstance(guest_paddr);
android_pipe_host_signal_wake(hwpipe, PIPE_WAKE_UNLOCK_DMA);
}
static void android_goldfish_dma_reset_host_mappings() {
android::DmaMap::get()->resetHostMappings();
}
GoldfishDmaOps android_goldfish_dma_ops = {
.add_buffer = android_goldfish_dma_add_buffer,
.remove_buffer = android_goldfish_dma_remove_buffer,
.get_host_addr = android_goldfish_dma_get_host_addr,
.invalidate_host_mappings = android_goldfish_dma_invalidate_host_mappings,
.unlock = android_goldfish_dma_unlock,
.reset_host_mappings = android_goldfish_dma_reset_host_mappings,
};
|