summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h38
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
index 2b8b7015..04e947e0 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -54,12 +54,19 @@ enum nvgpu_aperture {
54 APERTURE_VIDMEM 54 APERTURE_VIDMEM
55}; 55};
56 56
57/*
58 * Forward declared opaque placeholder type that does not really exist, but
59 * helps the compiler help us about getting types right. In reality,
60 * implementors of nvgpu_sgt_ops will have some concrete type in place of this.
61 */
62struct nvgpu_sgl;
63
57struct nvgpu_sgt_ops { 64struct nvgpu_sgt_ops {
58 void *(*sgl_next)(void *sgl); 65 struct nvgpu_sgl *(*sgl_next)(struct nvgpu_sgl *sgl);
59 u64 (*sgl_phys)(void *sgl); 66 u64 (*sgl_phys)(struct nvgpu_sgl *sgl);
60 u64 (*sgl_dma)(void *sgl); 67 u64 (*sgl_dma)(struct nvgpu_sgl *sgl);
61 u64 (*sgl_length)(void *sgl); 68 u64 (*sgl_length)(struct nvgpu_sgl *sgl);
62 u64 (*sgl_gpu_addr)(struct gk20a *g, void *sgl, 69 u64 (*sgl_gpu_addr)(struct gk20a *g, struct nvgpu_sgl *sgl,
63 struct nvgpu_gmmu_attrs *attrs); 70 struct nvgpu_gmmu_attrs *attrs);
64 /* 71 /*
65 * If left NULL then iommuable is assumed to be false. 72 * If left NULL then iommuable is assumed to be false.
@@ -85,15 +92,16 @@ struct nvgpu_sgt {
85 /* 92 /*
86 * The first node in the scatter gather list. 93 * The first node in the scatter gather list.
87 */ 94 */
88 void *sgl; 95 struct nvgpu_sgl *sgl;
89}; 96};
90 97
91/* 98/*
92 * This struct holds the necessary information for describing a struct 99 * This struct holds the necessary information for describing a struct
93 * nvgpu_mem's scatter gather list. 100 * nvgpu_mem's scatter gather list.
94 * 101 *
95 * Not all nvgpu_sgt's use this particular implementation. Nor is a given OS 102 * This is one underlying implementation for nvgpu_sgl. Not all nvgpu_sgt's use
96 * required to use this at all. 103 * this particular implementation. Nor is a given OS required to use this at
104 * all.
97 */ 105 */
98struct nvgpu_mem_sgl { 106struct nvgpu_mem_sgl {
99 /* 107 /*
@@ -233,11 +241,13 @@ struct nvgpu_sgt *nvgpu_sgt_create(struct gk20a *g);
233struct nvgpu_sgt *nvgpu_sgt_create_from_mem(struct gk20a *g, 241struct nvgpu_sgt *nvgpu_sgt_create_from_mem(struct gk20a *g,
234 struct nvgpu_mem *mem); 242 struct nvgpu_mem *mem);
235 243
236void *nvgpu_sgt_get_next(struct nvgpu_sgt *sgt, void *sgl); 244struct nvgpu_sgl *nvgpu_sgt_get_next(struct nvgpu_sgt *sgt,
237u64 nvgpu_sgt_get_phys(struct nvgpu_sgt *sgt, void *sgl); 245 struct nvgpu_sgl *sgl);
238u64 nvgpu_sgt_get_dma(struct nvgpu_sgt *sgt, void *sgl); 246u64 nvgpu_sgt_get_phys(struct nvgpu_sgt *sgt, struct nvgpu_sgl *sgl);
239u64 nvgpu_sgt_get_length(struct nvgpu_sgt *sgt, void *sgl); 247u64 nvgpu_sgt_get_dma(struct nvgpu_sgt *sgt, struct nvgpu_sgl *sgl);
240u64 nvgpu_sgt_get_gpu_addr(struct gk20a *g, struct nvgpu_sgt *sgt, void *sgl, 248u64 nvgpu_sgt_get_length(struct nvgpu_sgt *sgt, struct nvgpu_sgl *sgl);
249u64 nvgpu_sgt_get_gpu_addr(struct gk20a *g, struct nvgpu_sgt *sgt,
250 struct nvgpu_sgl *sgl,
241 struct nvgpu_gmmu_attrs *attrs); 251 struct nvgpu_gmmu_attrs *attrs);
242void nvgpu_sgt_free(struct gk20a *g, struct nvgpu_sgt *sgt); 252void nvgpu_sgt_free(struct gk20a *g, struct nvgpu_sgt *sgt);
243 253