svga.h revision a268422de8bf1b4c0cb97987b6c329c9f6a3da4b
1#ifndef _LINUX_SVGA_H 2#define _LINUX_SVGA_H 3 4#ifdef __KERNEL__ 5 6#include <linux/pci.h> 7#include <video/vga.h> 8 9/* Terminator for register set */ 10 11#define VGA_REGSET_END_VAL 0xFF 12#define VGA_REGSET_END {VGA_REGSET_END_VAL, 0, 0} 13 14struct vga_regset { 15 u8 regnum; 16 u8 lowbit; 17 u8 highbit; 18}; 19 20/* ------------------------------------------------------------------------- */ 21 22#define SVGA_FORMAT_END_VAL 0xFFFF 23#define SVGA_FORMAT_END {SVGA_FORMAT_END_VAL, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, 0, 0, 0, 0, 0, 0} 24 25struct svga_fb_format { 26 /* var part */ 27 u32 bits_per_pixel; 28 struct fb_bitfield red; 29 struct fb_bitfield green; 30 struct fb_bitfield blue; 31 struct fb_bitfield transp; 32 u32 nonstd; 33 /* fix part */ 34 u32 type; 35 u32 type_aux; 36 u32 visual; 37 u32 xpanstep; 38 u32 xresstep; 39}; 40 41struct svga_timing_regs { 42 const struct vga_regset *h_total_regs; 43 const struct vga_regset *h_display_regs; 44 const struct vga_regset *h_blank_start_regs; 45 const struct vga_regset *h_blank_end_regs; 46 const struct vga_regset *h_sync_start_regs; 47 const struct vga_regset *h_sync_end_regs; 48 49 const struct vga_regset *v_total_regs; 50 const struct vga_regset *v_display_regs; 51 const struct vga_regset *v_blank_start_regs; 52 const struct vga_regset *v_blank_end_regs; 53 const struct vga_regset *v_sync_start_regs; 54 const struct vga_regset *v_sync_end_regs; 55}; 56 57struct svga_pll { 58 u16 m_min; 59 u16 m_max; 60 u16 n_min; 61 u16 n_max; 62 u16 r_min; 63 u16 r_max; /* r_max < 32 */ 64 u32 f_vco_min; 65 u32 f_vco_max; 66 u32 f_base; 67}; 68 69 70/* Write a value to the attribute register */ 71 72static inline void svga_wattr(u8 index, u8 data) 73{ 74 inb(0x3DA); 75 outb(index, 0x3C0); 76 outb(data, 0x3C0); 77} 78 79/* Write a value to a sequence register with a mask */ 80 81static inline void svga_wseq_mask(u8 index, u8 data, u8 mask) 82{ 83 vga_wseq(NULL, index, (data & mask) | (vga_rseq(NULL, index) & ~mask)); 84} 85 86/* Write a value to a CRT register with a mask */ 87 88static inline void svga_wcrt_mask(u8 index, u8 data, u8 mask) 89{ 90 vga_wcrt(NULL, index, (data & mask) | (vga_rcrt(NULL, index) & ~mask)); 91} 92 93static inline int svga_primary_device(struct pci_dev *dev) 94{ 95 u16 flags; 96 pci_read_config_word(dev, PCI_COMMAND, &flags); 97 return (flags & PCI_COMMAND_IO); 98} 99 100 101void svga_wcrt_multi(const struct vga_regset *regset, u32 value); 102void svga_wseq_multi(const struct vga_regset *regset, u32 value); 103 104void svga_set_default_gfx_regs(void); 105void svga_set_default_atc_regs(void); 106void svga_set_default_seq_regs(void); 107void svga_set_default_crt_regs(void); 108void svga_set_textmode_vga_regs(void); 109 110void svga_settile(struct fb_info *info, struct fb_tilemap *map); 111void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area); 112void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect); 113void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit); 114void svga_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor); 115 116int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node); 117int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node); 118void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node); 119 120int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); 121 122#endif /* __KERNEL__ */ 123#endif /* _LINUX_SVGA_H */ 124 125