2011-07-26 12:56:26 +04:00
|
|
|
/* $NetBSD: igsfbvar.h,v 1.20 2011/07/26 08:59:37 mrg Exp $ */
|
2002-03-30 22:48:55 +03:00
|
|
|
|
|
|
|
/*
|
2003-05-10 05:51:56 +04:00
|
|
|
* Copyright (c) 2002, 2003 Valeriy E. Ushakov
|
2002-03-30 22:48:55 +03:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2002-07-21 06:56:35 +04:00
|
|
|
* Integraphics Systems IGA 168x and CyberPro series.
|
2002-03-30 22:48:55 +03:00
|
|
|
*/
|
|
|
|
#ifndef _DEV_IC_IGSFBVAR_H_
|
|
|
|
#define _DEV_IC_IGSFBVAR_H_
|
|
|
|
|
2009-11-11 20:01:17 +03:00
|
|
|
#include <dev/videomode/videomode.h>
|
|
|
|
|
2002-03-30 22:48:55 +03:00
|
|
|
#define IGS_CMAP_SIZE 256 /* 256 R/G/B entries */
|
|
|
|
struct igs_hwcmap {
|
2004-11-27 01:29:36 +03:00
|
|
|
uint8_t r[IGS_CMAP_SIZE];
|
|
|
|
uint8_t g[IGS_CMAP_SIZE];
|
|
|
|
uint8_t b[IGS_CMAP_SIZE];
|
2002-03-30 22:48:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define IGS_CURSOR_MAX_SIZE 64 /* 64x64 sprite */
|
|
|
|
struct igs_hwcursor {
|
|
|
|
struct wsdisplay_curpos cc_pos;
|
|
|
|
struct wsdisplay_curpos cc_hot;
|
|
|
|
struct wsdisplay_curpos cc_size;
|
2004-11-27 01:29:36 +03:00
|
|
|
uint8_t cc_image[512]; /* save copy of image for GCURSOR */
|
|
|
|
uint8_t cc_mask[512]; /* save copy of mask for GCURSOR */
|
|
|
|
uint16_t cc_sprite[512]; /* sprite in device 2bpp format */
|
|
|
|
uint8_t cc_color[6]; /* 2 colors, 3 rgb components */
|
2002-03-30 22:48:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
struct igsfb_devconfig {
|
|
|
|
/* io space, may be memory mapped */
|
|
|
|
bus_space_tag_t dc_iot;
|
|
|
|
bus_addr_t dc_iobase;
|
|
|
|
int dc_ioflags;
|
2002-03-30 22:48:55 +03:00
|
|
|
|
|
|
|
/* io registers */
|
2003-05-10 05:51:56 +04:00
|
|
|
bus_space_handle_t dc_ioh;
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2003-06-01 03:22:26 +04:00
|
|
|
/* graphic coprocessor */
|
|
|
|
bus_space_handle_t dc_coph;
|
|
|
|
|
2002-03-30 22:48:55 +03:00
|
|
|
/* linear memory */
|
2003-05-10 05:51:56 +04:00
|
|
|
bus_space_tag_t dc_memt;
|
|
|
|
bus_addr_t dc_memaddr;
|
|
|
|
bus_size_t dc_memsz; /* size of linear address space including mmio */
|
|
|
|
int dc_memflags;
|
|
|
|
|
2003-06-01 03:22:26 +04:00
|
|
|
/* video memory size */
|
2003-05-10 05:51:56 +04:00
|
|
|
bus_size_t dc_vmemsz;
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
/* resolution */
|
2006-04-05 03:43:40 +04:00
|
|
|
int dc_width, dc_height, dc_depth, dc_stride;
|
2009-11-19 00:59:38 +03:00
|
|
|
int dc_maxdepth;
|
|
|
|
const struct videomode *dc_mode;
|
2002-07-21 06:56:35 +04:00
|
|
|
|
2009-11-11 20:01:17 +03:00
|
|
|
char dc_modestring[128];
|
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
/* part of video memory mapped for wsscreen */
|
|
|
|
bus_space_handle_t dc_fbh;
|
|
|
|
bus_size_t dc_fbsz;
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
/* 1KB of cursor sprite data */
|
|
|
|
bus_space_handle_t dc_crh;
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
/* product id: IGA 168x, CyberPro 2k &c */
|
|
|
|
int dc_id;
|
2002-03-30 22:48:55 +03:00
|
|
|
|
|
|
|
/* flags that control driver operation */
|
2003-05-10 05:51:56 +04:00
|
|
|
int dc_hwflags;
|
|
|
|
#define IGSFB_HW_BSWAP 0x1 /* endianness mismatch */
|
|
|
|
#define IGSFB_HW_BE_SELECT 0x2 /* big endian magic (cyberpro) */
|
2003-05-11 07:20:09 +04:00
|
|
|
#define IGSFB_HW_TEXT_CURSOR 0x4 /* do text cursor in hardware */
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
/* do we need to do bswap in software? */
|
|
|
|
#define IGSFB_HW_SOFT_BSWAP(dc) \
|
|
|
|
((((dc)->dc_hwflags) & (IGSFB_HW_BSWAP | IGSFB_HW_BE_SELECT)) \
|
|
|
|
== IGSFB_HW_BSWAP)
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2003-05-11 07:20:09 +04:00
|
|
|
int dc_blanked; /* screen is currently blanked */
|
|
|
|
int dc_curenb; /* cursor sprite enabled */
|
|
|
|
int dc_mapped; /* currently in mapped mode */
|
|
|
|
|
2003-06-01 03:22:26 +04:00
|
|
|
/* saved dc_ri.ri_ops.putchar */
|
|
|
|
void (*dc_ri_putchar)(void *, int, int, u_int, long);
|
|
|
|
|
2009-11-11 01:23:22 +03:00
|
|
|
/* optional MD mmap() method */
|
|
|
|
paddr_t (*dc_mmap)(void *, void *, off_t, int);
|
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
struct igs_hwcmap dc_cmap; /* software copy of colormap */
|
|
|
|
struct igs_hwcursor dc_cursor; /* software copy of cursor sprite */
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2003-05-10 20:20:23 +04:00
|
|
|
/* precomputed bit table for cursor sprite 1bpp -> 2bpp conversion */
|
2004-11-27 01:29:36 +03:00
|
|
|
uint16_t dc_bexpand[256];
|
2006-04-05 05:13:50 +04:00
|
|
|
|
2006-02-23 11:01:59 +03:00
|
|
|
/* virtual console support */
|
|
|
|
struct vcons_data dc_vd;
|
|
|
|
struct vcons_screen dc_console;
|
2002-03-30 22:48:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-05-10 05:51:56 +04:00
|
|
|
struct igsfb_softc {
|
2011-07-26 12:56:26 +04:00
|
|
|
device_t sc_dev;
|
2003-05-10 05:51:56 +04:00
|
|
|
struct igsfb_devconfig *sc_dc;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-07-21 06:56:35 +04:00
|
|
|
/*
|
|
|
|
* Access sugar for indexed registers
|
|
|
|
*/
|
2002-03-30 22:48:55 +03:00
|
|
|
|
2006-02-16 23:17:12 +03:00
|
|
|
static __inline uint8_t
|
2004-11-27 01:29:36 +03:00
|
|
|
igs_idx_read(bus_space_tag_t, bus_space_handle_t, u_int, uint8_t);
|
2006-02-16 23:17:12 +03:00
|
|
|
static __inline void
|
2004-11-27 01:29:36 +03:00
|
|
|
igs_idx_write(bus_space_tag_t, bus_space_handle_t, u_int, uint8_t, uint8_t);
|
2002-07-21 06:56:35 +04:00
|
|
|
|
2006-02-16 23:17:12 +03:00
|
|
|
static __inline uint8_t
|
2006-04-05 05:05:50 +04:00
|
|
|
igs_idx_read(bus_space_tag_t t, bus_space_handle_t h,
|
|
|
|
u_int idxport, uint8_t idx)
|
2002-07-21 06:56:35 +04:00
|
|
|
{
|
|
|
|
bus_space_write_1(t, h, idxport, idx);
|
|
|
|
return (bus_space_read_1(t, h, idxport + 1));
|
|
|
|
}
|
|
|
|
|
2006-02-16 23:17:12 +03:00
|
|
|
static __inline void
|
2006-04-05 05:05:50 +04:00
|
|
|
igs_idx_write(bus_space_tag_t t, bus_space_handle_t h,
|
|
|
|
u_int idxport, uint8_t idx, uint8_t val)
|
2002-07-21 06:56:35 +04:00
|
|
|
{
|
|
|
|
bus_space_write_1(t, h, idxport, idx);
|
|
|
|
bus_space_write_1(t, h, idxport + 1, val);
|
|
|
|
}
|
|
|
|
|
2002-09-24 22:17:24 +04:00
|
|
|
|
|
|
|
/* sugar for sequencer controller */
|
|
|
|
#define igs_seq_read(t,h,x) \
|
|
|
|
(igs_idx_read((t),(h),IGS_SEQ_IDX,(x)))
|
|
|
|
#define igs_seq_write(t,h,x,v) \
|
|
|
|
(igs_idx_write((t),(h),IGS_SEQ_IDX,(x),(v)))
|
|
|
|
|
|
|
|
|
|
|
|
/* sugar for CRT controller */
|
|
|
|
#define igs_crtc_read(t,h,x) \
|
|
|
|
(igs_idx_read((t),(h),IGS_CRTC_IDX,(x)))
|
|
|
|
#define igs_crtc_write(t,h,x,v) \
|
|
|
|
(igs_idx_write((t),(h),IGS_CRTC_IDX,(x),(v)))
|
|
|
|
|
|
|
|
|
|
|
|
/* sugar for attribute controller */
|
|
|
|
#define igs_attr_flip_flop(t,h) \
|
|
|
|
((void)bus_space_read_1((t),(h),IGS_INPUT_STATUS1));
|
|
|
|
#define igs_attr_read(t,h,x) \
|
|
|
|
(igs_idx_read((t),(h),IGS_ATTR_IDX,(x)))
|
|
|
|
|
2006-02-16 23:17:12 +03:00
|
|
|
static __inline void
|
2004-11-27 01:29:36 +03:00
|
|
|
igs_attr_write(bus_space_tag_t, bus_space_handle_t, uint8_t, uint8_t);
|
2002-09-24 22:17:24 +04:00
|
|
|
|
2006-02-16 23:17:12 +03:00
|
|
|
static __inline void
|
2006-04-05 05:05:50 +04:00
|
|
|
igs_attr_write(bus_space_tag_t t, bus_space_handle_t h,
|
|
|
|
uint8_t idx, uint8_t val)
|
2002-09-24 22:17:24 +04:00
|
|
|
{
|
|
|
|
bus_space_write_1(t, h, IGS_ATTR_IDX, idx);
|
|
|
|
bus_space_write_1(t, h, IGS_ATTR_IDX, val); /* sic, same register */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* sugar for graphics controller registers */
|
|
|
|
#define igs_grfx_read(t,h,x) (igs_idx_read((t),(h),IGS_GRFX_IDX,(x)))
|
|
|
|
#define igs_grfx_write(t,h,x,v) (igs_idx_write((t),(h),IGS_GRFX_IDX,(x),(v)))
|
|
|
|
|
|
|
|
|
|
|
|
/* sugar for extended registers */
|
2002-07-21 06:56:35 +04:00
|
|
|
#define igs_ext_read(t,h,x) (igs_idx_read((t),(h),IGS_EXT_IDX,(x)))
|
|
|
|
#define igs_ext_write(t,h,x,v) (igs_idx_write((t),(h),IGS_EXT_IDX,(x),(v)))
|
|
|
|
|
|
|
|
|
2002-09-24 22:17:24 +04:00
|
|
|
/* igsfb_subr.c */
|
2003-05-10 05:51:56 +04:00
|
|
|
int igsfb_enable(bus_space_tag_t, bus_addr_t, int);
|
|
|
|
void igsfb_hw_setup(struct igsfb_devconfig *);
|
|
|
|
void igsfb_1024x768_8bpp_60Hz(struct igsfb_devconfig *);
|
2009-11-11 20:01:17 +03:00
|
|
|
void igsfb_set_mode(struct igsfb_devconfig *, const struct videomode *, int);
|
2002-09-24 22:17:24 +04:00
|
|
|
|
|
|
|
/* igsfb.c */
|
2003-05-10 05:51:56 +04:00
|
|
|
int igsfb_cnattach_subr(struct igsfb_devconfig *);
|
|
|
|
void igsfb_attach_subr(struct igsfb_softc *, int);
|
|
|
|
|
|
|
|
|
|
|
|
extern struct igsfb_devconfig igsfb_console_dc;
|
2002-03-30 22:48:55 +03:00
|
|
|
|
|
|
|
#endif /* _DEV_IC_IGSFBVAR_H_ */
|