Commit dd646942 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/device: type-safe register accessor macros

These require an explit struct nvkm_device pointer, unlike the previous
macros which take a void *, and assume it's any old nvkm_subdev.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 8699745a
......@@ -147,6 +147,20 @@ struct nvkm_device {
struct nvkm_device *nvkm_device_find(u64 name);
int nvkm_device_list(u64 *name, int size);
/* privileged register interface accessor macros */
#define nvkm_rd08(d,a) ioread8((d)->engine.subdev.mmio + (a))
#define nvkm_rd16(d,a) ioread16_native((d)->engine.subdev.mmio + (a))
#define nvkm_rd32(d,a) ioread32_native((d)->engine.subdev.mmio + (a))
#define nvkm_wr08(d,a,v) iowrite8((v), (d)->engine.subdev.mmio + (a))
#define nvkm_wr16(d,a,v) iowrite16_native((v), (d)->engine.subdev.mmio + (a))
#define nvkm_wr32(d,a,v) iowrite32_native((v), (d)->engine.subdev.mmio + (a))
#define nvkm_mask(d,a,m,v) ({ \
struct nvkm_device *_device = (d); \
u32 _addr = (a), _temp = nvkm_rd32(_device, _addr); \
nvkm_wr32(_device, _addr, (_temp & ~(m)) | (v)); \
_temp; \
})
struct nvkm_device *nv_device(void *obj);
static inline bool
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment