Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 91 lines (83 sloc) 3.796 kB
b96dab7 gdev: refactored code and cleaned up files
Shinpei Kato authored
1 /*
2 * Copyright 2011 Shinpei Kato
3 *
4 * University of California, Santa Cruz
5 * Systems Research Lab.
6 *
7 * All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29 #ifndef __GDEV_ARCH_H__
30 #define __GDEV_ARCH_H__
31
32 #include "gdev_conf.h"
33 #include "gdev_time.h"
34
35 struct gdev_device; /* prototype declaration */
36
37 /**
38 * Gdev types: they are not exposed to end users.
39 */
40 typedef struct gdev_vas gdev_vas_t;
41 typedef struct gdev_ctx gdev_ctx_t;
42 typedef struct gdev_mem gdev_mem_t;
43
44 /**
45 * architecture-dependent compute functions.
46 */
47 int gdev_compute_setup(struct gdev_device *gdev);
48 uint32_t gdev_launch(gdev_ctx_t *ctx, struct gdev_kernel *kern);
49 uint32_t gdev_memcpy(gdev_ctx_t *ctx, uint64_t dst_addr, uint64_t src_addr, uint32_t size, int async);
50 uint32_t gdev_read32(gdev_mem_t *mem, uint64_t addr);
51 void gdev_write32(gdev_mem_t *mem, uint64_t addr, uint32_t val);
52 int gdev_read(gdev_mem_t *mem, void *buf, uint64_t addr, uint32_t size);
53 int gdev_write(gdev_mem_t *mem, uint64_t addr, const void *buf, uint32_t size);
54 int gdev_poll(gdev_ctx_t *ctx, uint32_t seq, struct gdev_time *timeout);
55 int gdev_query(struct gdev_device *gdev, uint32_t type, uint64_t *result);
56
57 /**
58 * architecture-dependent resource management functions.
59 */
60 struct gdev_device *gdev_dev_open(int minor);
61 void gdev_dev_close(struct gdev_device *gdev);
62 gdev_vas_t *gdev_vas_new(struct gdev_device *gdev, uint64_t size, void *handle);
63 void gdev_vas_free(gdev_vas_t *vas);
64 gdev_ctx_t *gdev_ctx_new(struct gdev_device *gdev, gdev_vas_t *vas);
65 void gdev_ctx_free(gdev_ctx_t *ctx);
66 int gdev_ctx_get_cid(gdev_ctx_t *ctx);
67 gdev_mem_t *gdev_mem_alloc(gdev_vas_t *vas, uint64_t size, int type);
68 void gdev_mem_free(gdev_mem_t *mem);
69 void gdev_mem_gc(gdev_vas_t *vas);
70 int gdev_shmem_evict(gdev_ctx_t *ctx, gdev_mem_t *mem);
71 int gdev_shmem_evict_all(gdev_ctx_t *ctx, gdev_vas_t *vas);
72 int gdev_shmem_reload(gdev_ctx_t *ctx, gdev_mem_t *mem);
73 int gdev_shmem_reload_all(gdev_ctx_t *ctx, gdev_vas_t *vas);
74 gdev_mem_t *gdev_shmem_request(gdev_vas_t *vas, gdev_mem_t *mem, uint64_t size);
75 void gdev_shmem_lock(gdev_mem_t *mem);
76 void gdev_shmem_unlock(gdev_mem_t *mem);
77 void gdev_shmem_lock_all(gdev_vas_t *vas);
78 void gdev_shmem_unlock_all(gdev_vas_t *vas);
79 int gdev_swap_create(struct gdev_device *gdev, uint32_t size);
80 void gdev_swap_destroy(struct gdev_device *gdev);
81 void gdev_vas_list_add(gdev_vas_t *vas);
82 void gdev_vas_list_del(gdev_vas_t *vas);
83 void gdev_mem_list_add(gdev_mem_t *mem, int type);
84 void gdev_mem_list_del(gdev_mem_t *mem);
85 gdev_mem_t *gdev_mem_lookup(gdev_vas_t *vas, uint64_t addr, int type);
86 void *gdev_mem_get_buf(gdev_mem_t *mem);
87 uint64_t gdev_mem_get_addr(gdev_mem_t *mem);
88 uint64_t gdev_mem_get_size(gdev_mem_t *mem);
89
90 #endif
Something went wrong with that request. Please try again.