23 #ifndef __NOUVEAU_HW_H__
24 #define __NOUVEAU_HW_H__
31 #define MASK(field) ( \
32 (0xffffffff >> (31 - ((1 ? field) - (0 ? field)))) << (0 ? field))
34 #define XLATE(src, srclowbit, outfield) ( \
35 (((src) >> (srclowbit)) << (0 ? outfield)) & MASK(outfield))
57 int *burst,
int *lwm);
66 val = nv_rd32(device, reg);
70 static inline void NVWriteCRTC(
struct drm_device *dev,
76 nv_wr32(device, reg, val);
86 val = nv_rd32(device, reg);
90 static inline void NVWriteRAMDAC(
struct drm_device *dev,
96 nv_wr32(device, reg, val);
109 static inline void nv_write_tmds(
struct drm_device *dev,
119 static inline void NVWriteVgaCrtc(
struct drm_device *dev,
173 if (head && nv_device(drm->
device)->card_type == NV_40)
176 val = nv_rd08(device, reg);
180 static inline void NVWritePRMVIO(
struct drm_device *dev,
188 if (head && nv_device(drm->
device)->card_type == NV_40)
191 nv_wr08(device, reg, value);
194 static inline void NVSetEnablePalette(
struct drm_device *dev,
int head,
bool enable)
201 static inline bool NVGetEnablePalette(
struct drm_device *dev,
int head)
208 static inline void NVWriteVgaAttr(
struct drm_device *dev,
212 if (NVGetEnablePalette(dev, head))
227 if (NVGetEnablePalette(dev, head))
238 static inline void NVVgaSeqReset(
struct drm_device *dev,
int head,
bool start)
248 NVVgaSeqReset(dev, head,
true);
253 NVVgaSeqReset(dev, head,
false);
255 NVSetEnablePalette(dev, head, protect);
264 if (nv_device(drm->
device)->chipset == 0x11)
272 nv_lock_vga_crtc_base(
struct drm_device *dev,
int head,
bool lock)
275 bool waslocked = cr11 & 0x80;
287 nv_lock_vga_crtc_shadow(
struct drm_device *dev,
int head,
int lock)
312 NVLockVgaCrtcs(
struct drm_device *dev,
bool lock)
320 if (nv_device(drm->
device)->chipset == 0x11 && !nv_heads_tied(dev))
329 #define NV04_CURSOR_SIZE 32
331 #define NV10_CURSOR_SIZE 64
333 static inline int nv_cursor_width(
struct drm_device *dev)
341 nv_fix_nv40_hw_cursor(
struct drm_device *dev,
int head)
359 if (nv_device(drm->
device)->card_type == NV_04) {
367 (cre_heb & ~0x40) | ((offset >> 18) & 0x40));
372 nv_show_cursor(
struct drm_device *dev,
int head,
bool show)
384 if (nv_device(drm->
device)->card_type == NV_40)
385 nv_fix_nv40_hw_cursor(dev, head);
400 if (nv_device(drm->
device)->card_type == NV_04)
401 mask = 128 / bpp - 1;
403 mask = 512 / bpp - 1;
405 return (width + mask) & ~mask;