• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_OS_H__
3 #define __NVKM_OS_H__
4 #include <nvif/os.h>
5 
6 #ifdef __BIG_ENDIAN
7 #define ioread16_native ioread16be
8 #define iowrite16_native iowrite16be
9 #define ioread32_native  ioread32be
10 #define iowrite32_native iowrite32be
11 #else
12 #define ioread16_native ioread16
13 #define iowrite16_native iowrite16
14 #define ioread32_native  ioread32
15 #define iowrite32_native iowrite32
16 #endif
17 
18 #define iowrite64_native(v,p) do {                                             \
19 	u32 __iomem *_p = (u32 __iomem *)(p);				       \
20 	u64 _v = (v);							       \
21 	iowrite32_native(lower_32_bits(_v), &_p[0]);			       \
22 	iowrite32_native(upper_32_bits(_v), &_p[1]);			       \
23 } while(0)
24 
25 struct nvkm_blob {
26 	void *data;
27 	u32 size;
28 };
29 
30 static inline void
nvkm_blob_dtor(struct nvkm_blob * blob)31 nvkm_blob_dtor(struct nvkm_blob *blob)
32 {
33 	kfree(blob->data);
34 	blob->data = NULL;
35 	blob->size = 0;
36 }
37 #endif
38