This source file includes following definitions.
- fbmem_init
- fbmem_fini
- fbmem_peek
- fbmem_poke
- fbmem_readback
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 #include <subdev/fb/regsnv04.h>
27
28 #define NV04_PFB_DEBUG_0 0x00100080
29 # define NV04_PFB_DEBUG_0_PAGE_MODE 0x00000001
30 # define NV04_PFB_DEBUG_0_REFRESH_OFF 0x00000010
31 # define NV04_PFB_DEBUG_0_REFRESH_COUNTX64 0x00003f00
32 # define NV04_PFB_DEBUG_0_REFRESH_SLOW_CLK 0x00004000
33 # define NV04_PFB_DEBUG_0_SAFE_MODE 0x00008000
34 # define NV04_PFB_DEBUG_0_ALOM_ENABLE 0x00010000
35 # define NV04_PFB_DEBUG_0_CASOE 0x00100000
36 # define NV04_PFB_DEBUG_0_CKE_INVERT 0x10000000
37 # define NV04_PFB_DEBUG_0_REFINC 0x20000000
38 # define NV04_PFB_DEBUG_0_SAVE_POWER_OFF 0x40000000
39 #define NV04_PFB_CFG0 0x00100200
40 # define NV04_PFB_CFG0_SCRAMBLE 0x20000000
41 #define NV04_PFB_CFG1 0x00100204
42 #define NV04_PFB_SCRAMBLE(i) (0x00100400 + 4 * (i))
43
44 #define NV10_PFB_REFCTRL 0x00100210
45 # define NV10_PFB_REFCTRL_VALID_1 (1 << 31)
46
47 static inline struct io_mapping *
48 fbmem_init(struct nvkm_device *dev)
49 {
50 return io_mapping_create_wc(dev->func->resource_addr(dev, 1),
51 dev->func->resource_size(dev, 1));
52 }
53
54 static inline void
55 fbmem_fini(struct io_mapping *fb)
56 {
57 io_mapping_free(fb);
58 }
59
60 static inline u32
61 fbmem_peek(struct io_mapping *fb, u32 off)
62 {
63 u8 __iomem *p = io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
64 u32 val = ioread32(p + (off & ~PAGE_MASK));
65 io_mapping_unmap_atomic(p);
66 return val;
67 }
68
69 static inline void
70 fbmem_poke(struct io_mapping *fb, u32 off, u32 val)
71 {
72 u8 __iomem *p = io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
73 iowrite32(val, p + (off & ~PAGE_MASK));
74 wmb();
75 io_mapping_unmap_atomic(p);
76 }
77
78 static inline bool
79 fbmem_readback(struct io_mapping *fb, u32 off, u32 val)
80 {
81 fbmem_poke(fb, off, val);
82 return val == fbmem_peek(fb, off);
83 }