From c8b9641a9146b13d34824f99c3d22c8c0c3a06bd Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 9 Nov 2011 20:22:25 +1000 Subject: drm/nouveau/hwsq: remove some magic, give proper opcode names Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/nouveau_hwsq.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/drm/nouveau/nouveau_hwsq.h') diff --git a/drivers/gpu/drm/nouveau/nouveau_hwsq.h b/drivers/gpu/drm/nouveau/nouveau_hwsq.h index d59a3b3ff64..697687593a8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hwsq.h +++ b/drivers/gpu/drm/nouveau/nouveau_hwsq.h @@ -57,9 +57,26 @@ hwsq_fini(struct hwsq_ucode *hwsq) } static inline void -hwsq_unkn(struct hwsq_ucode *hwsq, u8 v0) +hwsq_usec(struct hwsq_ucode *hwsq, u8 usec) { - *hwsq->ptr.u08++ = v0; + u32 shift = 0; + while (usec & ~3) { + usec >>= 2; + shift++; + } + + *hwsq->ptr.u08++ = (shift << 2) | usec; +} + +static inline void +hwsq_setf(struct hwsq_ucode *hwsq, u8 flag, int val) +{ + flag += 0x80; + if (val >= 0) + flag += 0x20; + if (val >= 1) + flag += 0x20; + *hwsq->ptr.u08++ = flag; } static inline void -- cgit v1.2.3-70-g09d2