mirror of https://github.com/xqemu/xqemu.git
vga.h: remove unused stuff and reformat
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
b134886a9e
commit
0dad6c35fc
322
hw/vga.h
322
hw/vga.h
|
@ -17,34 +17,6 @@
|
|||
#ifndef __linux_video_vga_h__
|
||||
#define __linux_video_vga_h__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/io.h>
|
||||
#ifndef CONFIG_AMIGA
|
||||
#include <asm/vga.h>
|
||||
#else
|
||||
/*
|
||||
* FIXME
|
||||
* Ugh, we don't have PCI space, so map readb() and friends to use Zorro space
|
||||
* for MMIO accesses. This should make cirrusfb work again on Amiga
|
||||
*/
|
||||
#undef inb_p
|
||||
#undef inw_p
|
||||
#undef outb_p
|
||||
#undef outw
|
||||
#undef readb
|
||||
#undef writeb
|
||||
#undef writew
|
||||
#define inb_p(port) 0
|
||||
#define inw_p(port) 0
|
||||
#define outb_p(port, val) do { } while (0)
|
||||
#define outw(port, val) do { } while (0)
|
||||
#define readb z_readb
|
||||
#define writeb z_writeb
|
||||
#define writew z_writew
|
||||
#endif
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
|
||||
/* Some of the code below is taken from SVGAlib. The original,
|
||||
unmodified copyright notice for that code is below. */
|
||||
/* VGAlib version 1.2 - (c) 1993 Tommy Frandsen */
|
||||
|
@ -184,298 +156,4 @@
|
|||
/* VGA graphics controller bit masks */
|
||||
#define VGA_GR06_GRAPHICS_MODE 0x01
|
||||
|
||||
/* macro for composing an 8-bit VGA register index and value
|
||||
* into a single 16-bit quantity */
|
||||
#define VGA_OUT16VAL(v, r) (((v) << 8) | (r))
|
||||
|
||||
/* decide whether we should enable the faster 16-bit VGA register writes */
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define VGA_OUTW_WRITE
|
||||
#endif
|
||||
|
||||
/* VGA State Save and Restore */
|
||||
#define VGA_SAVE_FONT0 1 /* save/restore plane 2 fonts */
|
||||
#define VGA_SAVE_FONT1 2 /* save/restore plane 3 fonts */
|
||||
#define VGA_SAVE_TEXT 4 /* save/restore plane 0/1 fonts */
|
||||
#define VGA_SAVE_FONTS 7 /* save/restore all fonts */
|
||||
#define VGA_SAVE_MODE 8 /* save/restore video mode */
|
||||
#define VGA_SAVE_CMAP 16 /* save/restore color map/DAC */
|
||||
|
||||
struct vgastate {
|
||||
void __iomem *vgabase; /* mmio base, if supported */
|
||||
unsigned long membase; /* VGA window base, 0 for default - 0xA000 */
|
||||
__u32 memsize; /* VGA window size, 0 for default 64K */
|
||||
__u32 flags; /* what state[s] to save (see VGA_SAVE_*) */
|
||||
__u32 depth; /* current fb depth, not important */
|
||||
__u32 num_attr; /* number of att registers, 0 for default */
|
||||
__u32 num_crtc; /* number of crt registers, 0 for default */
|
||||
__u32 num_gfx; /* number of gfx registers, 0 for default */
|
||||
__u32 num_seq; /* number of seq registers, 0 for default */
|
||||
void *vidstate;
|
||||
};
|
||||
|
||||
extern int save_vga(struct vgastate *state);
|
||||
extern int restore_vga(struct vgastate *state);
|
||||
|
||||
/*
|
||||
* generic VGA port read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_io_r (unsigned short port)
|
||||
{
|
||||
return inb_p(port);
|
||||
}
|
||||
|
||||
static inline void vga_io_w (unsigned short port, unsigned char val)
|
||||
{
|
||||
outb_p(val, port);
|
||||
}
|
||||
|
||||
static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
|
||||
unsigned char val)
|
||||
{
|
||||
outw(VGA_OUT16VAL (val, reg), port);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
|
||||
{
|
||||
return readb (regbase + port);
|
||||
}
|
||||
|
||||
static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val)
|
||||
{
|
||||
writeb (val, regbase + port);
|
||||
}
|
||||
|
||||
static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port,
|
||||
unsigned char reg, unsigned char val)
|
||||
{
|
||||
writew (VGA_OUT16VAL (val, reg), regbase + port);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_r (void __iomem *regbase, unsigned short port)
|
||||
{
|
||||
if (regbase)
|
||||
return vga_mm_r (regbase, port);
|
||||
else
|
||||
return vga_io_r (port);
|
||||
}
|
||||
|
||||
static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val)
|
||||
{
|
||||
if (regbase)
|
||||
vga_mm_w (regbase, port, val);
|
||||
else
|
||||
vga_io_w (port, val);
|
||||
}
|
||||
|
||||
|
||||
static inline void vga_w_fast (void __iomem *regbase, unsigned short port,
|
||||
unsigned char reg, unsigned char val)
|
||||
{
|
||||
if (regbase)
|
||||
vga_mm_w_fast (regbase, port, reg, val);
|
||||
else
|
||||
vga_io_w_fast (port, reg, val);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VGA CRTC register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rcrt (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_CRT_IC, reg);
|
||||
return vga_r (regbase, VGA_CRT_DC);
|
||||
}
|
||||
|
||||
static inline void vga_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_w_fast (regbase, VGA_CRT_IC, reg, val);
|
||||
#else
|
||||
vga_w (regbase, VGA_CRT_IC, reg);
|
||||
vga_w (regbase, VGA_CRT_DC, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rcrt (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_CRT_IC, reg);
|
||||
return vga_io_r (VGA_CRT_DC);
|
||||
}
|
||||
|
||||
static inline void vga_io_wcrt (unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_io_w_fast (VGA_CRT_IC, reg, val);
|
||||
#else
|
||||
vga_io_w (VGA_CRT_IC, reg);
|
||||
vga_io_w (VGA_CRT_DC, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_CRT_IC, reg);
|
||||
return vga_mm_r (regbase, VGA_CRT_DC);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_mm_w_fast (regbase, VGA_CRT_IC, reg, val);
|
||||
#else
|
||||
vga_mm_w (regbase, VGA_CRT_IC, reg);
|
||||
vga_mm_w (regbase, VGA_CRT_DC, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VGA sequencer register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rseq (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_SEQ_I, reg);
|
||||
return vga_r (regbase, VGA_SEQ_D);
|
||||
}
|
||||
|
||||
static inline void vga_wseq (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_w_fast (regbase, VGA_SEQ_I, reg, val);
|
||||
#else
|
||||
vga_w (regbase, VGA_SEQ_I, reg);
|
||||
vga_w (regbase, VGA_SEQ_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rseq (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_SEQ_I, reg);
|
||||
return vga_io_r (VGA_SEQ_D);
|
||||
}
|
||||
|
||||
static inline void vga_io_wseq (unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_io_w_fast (VGA_SEQ_I, reg, val);
|
||||
#else
|
||||
vga_io_w (VGA_SEQ_I, reg);
|
||||
vga_io_w (VGA_SEQ_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_SEQ_I, reg);
|
||||
return vga_mm_r (regbase, VGA_SEQ_D);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wseq (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_mm_w_fast (regbase, VGA_SEQ_I, reg, val);
|
||||
#else
|
||||
vga_mm_w (regbase, VGA_SEQ_I, reg);
|
||||
vga_mm_w (regbase, VGA_SEQ_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
/*
|
||||
* VGA graphics controller register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rgfx (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_GFX_I, reg);
|
||||
return vga_r (regbase, VGA_GFX_D);
|
||||
}
|
||||
|
||||
static inline void vga_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_w_fast (regbase, VGA_GFX_I, reg, val);
|
||||
#else
|
||||
vga_w (regbase, VGA_GFX_I, reg);
|
||||
vga_w (regbase, VGA_GFX_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rgfx (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_GFX_I, reg);
|
||||
return vga_io_r (VGA_GFX_D);
|
||||
}
|
||||
|
||||
static inline void vga_io_wgfx (unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_io_w_fast (VGA_GFX_I, reg, val);
|
||||
#else
|
||||
vga_io_w (VGA_GFX_I, reg);
|
||||
vga_io_w (VGA_GFX_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_GFX_I, reg);
|
||||
return vga_mm_r (regbase, VGA_GFX_D);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
#ifdef VGA_OUTW_WRITE
|
||||
vga_mm_w_fast (regbase, VGA_GFX_I, reg, val);
|
||||
#else
|
||||
vga_mm_w (regbase, VGA_GFX_I, reg);
|
||||
vga_mm_w (regbase, VGA_GFX_D, val);
|
||||
#endif /* VGA_OUTW_WRITE */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VGA attribute controller register read/write
|
||||
*/
|
||||
|
||||
static inline unsigned char vga_rattr (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_w (regbase, VGA_ATT_IW, reg);
|
||||
return vga_r (regbase, VGA_ATT_R);
|
||||
}
|
||||
|
||||
static inline void vga_wattr (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
vga_w (regbase, VGA_ATT_IW, reg);
|
||||
vga_w (regbase, VGA_ATT_W, val);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_io_rattr (unsigned char reg)
|
||||
{
|
||||
vga_io_w (VGA_ATT_IW, reg);
|
||||
return vga_io_r (VGA_ATT_R);
|
||||
}
|
||||
|
||||
static inline void vga_io_wattr (unsigned char reg, unsigned char val)
|
||||
{
|
||||
vga_io_w (VGA_ATT_IW, reg);
|
||||
vga_io_w (VGA_ATT_W, val);
|
||||
}
|
||||
|
||||
static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_ATT_IW, reg);
|
||||
return vga_mm_r (regbase, VGA_ATT_R);
|
||||
}
|
||||
|
||||
static inline void vga_mm_wattr (void __iomem *regbase, unsigned char reg, unsigned char val)
|
||||
{
|
||||
vga_mm_w (regbase, VGA_ATT_IW, reg);
|
||||
vga_mm_w (regbase, VGA_ATT_W, val);
|
||||
}
|
||||
|
||||
#endif /* __linux_video_vga_h__ */
|
||||
|
|
Loading…
Reference in New Issue