Home | History | Annotate | Line # | Download | only in pci
tgavar.h revision 1.5
      1 /* $NetBSD: tgavar.h,v 1.5 2000/03/04 10:28:00 elric Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
      5  * All rights reserved.
      6  *
      7  * Author: Chris G. Demetriou
      8  *
      9  * Permission to use, copy, modify and distribute this software and
     10  * its documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie the
     27  * rights to redistribute these changes.
     28  */
     29 
     30 #include <dev/ic/ramdac.h>
     31 #include <dev/pci/tgareg.h>
     32 #include <dev/rcons/raster.h>
     33 #include <dev/wscons/wsconsio.h>
     34 #include <dev/wscons/wscons_raster.h>
     35 
     36 struct tga_devconfig;
     37 struct fbcmap;
     38 struct fbcursor;
     39 struct fbcurpos;
     40 
     41 struct tga_conf {
     42 	char	    *tgac_name;		/* name for this board type */
     43 
     44 	int	    tgac_phys_depth;	/* physical frame buffer depth */
     45 	vsize_t   tgac_cspace_size;	/* core space size */
     46 	vsize_t   tgac_vvbr_units;	/* what '1' in the VVBR means */
     47 
     48 	int	    tgac_ndbuf;		/* number of display buffers */
     49 	vaddr_t tgac_dbuf[2];	/* display buffer offsets/addresses */
     50 	vsize_t   tgac_dbufsz[2];	/* display buffer sizes */
     51 
     52 	int	    tgac_nbbuf;		/* number of display buffers */
     53 	vaddr_t tgac_bbuf[2];	/* back buffer offsets/addresses */
     54 	vsize_t   tgac_bbufsz[2];	/* back buffer sizes */
     55 };
     56 
     57 struct tga_devconfig {
     58 	bus_space_tag_t dc_memt;
     59 	pci_chipset_tag_t dc_pc;
     60 
     61 	pcitag_t   	 dc_pcitag;	/* PCI tag */
     62 	bus_addr_t	 dc_pcipaddr;	/* PCI phys addr. */
     63 
     64 	tga_reg_t   *dc_regs;		/* registers; XXX: need aliases */
     65 
     66 	int	    dc_tga_type;	/* the device type; see below */
     67 	const struct tga_conf *dc_tgaconf; /* device buffer configuration */
     68 
     69 	struct ramdac_funcs
     70 		    *dc_ramdac_funcs;	/* The RAMDAC functions */
     71 	struct ramdac_cookie
     72 		    *dc_ramdac_cookie;	/* the RAMDAC type; see above */
     73 
     74 	vaddr_t dc_vaddr;		/* memory space virtual base address */
     75 	paddr_t dc_paddr;		/* memory space physical base address */
     76 
     77 	int	    dc_wid;		/* width of frame buffer */
     78 	int	    dc_ht;		/* height of frame buffer */
     79 	int	    dc_rowbytes;	/* bytes in a FB scan line */
     80 
     81 	vaddr_t dc_videobase;	/* base of flat frame buffer */
     82 
     83 	struct raster	dc_raster;	/* raster description */
     84 	struct rcons	dc_rcons;	/* raster blitter control info */
     85 
     86 	int	    dc_blanked;		/* currently had video disabled */
     87 	void	    *dc_ramdac_private; /* RAMDAC private storage */
     88 
     89 	void	    (*dc_ramdac_intr) __P((void *));
     90 };
     91 
     92 struct tga_softc {
     93 	struct	device sc_dev;
     94 
     95 	struct	tga_devconfig *sc_dc;	/* device configuration */
     96 	void	*sc_intr;		/* interrupt handler info */
     97 	/* XXX should record intr fns/arg */
     98 
     99 	int nscreens;
    100 };
    101 
    102 #define	TGA_TYPE_T8_01		0	/* 8bpp, 1MB */
    103 #define	TGA_TYPE_T8_02		1	/* 8bpp, 2MB */
    104 #define	TGA_TYPE_T8_22		2	/* 8bpp, 4MB */
    105 #define	TGA_TYPE_T8_44		3	/* 8bpp, 8MB */
    106 #define	TGA_TYPE_T32_04		4	/* 32bpp, 4MB */
    107 #define	TGA_TYPE_T32_08		5	/* 32bpp, 8MB */
    108 #define	TGA_TYPE_T32_88		6	/* 32bpp, 16MB */
    109 #define	TGA_TYPE_UNKNOWN	7	/* unknown */
    110 
    111 #define	DEVICE_IS_TGA(class, id)					\
    112 	    ((PCI_VENDOR(id) == PCI_VENDOR_DEC &&			\
    113 	     PCI_PRODUCT(id) == PCI_PRODUCT_DEC_21030) ? 10 : 0)
    114 
    115 int tga_cnattach __P((bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t,
    116 		      int, int, int));
    117 
    118 int	tga_identify __P((tga_reg_t *));
    119 const struct tga_conf *tga_getconf __P((int));
    120 
    121 int     tga_builtin_set_cursor __P((struct tga_devconfig *,
    122 	    struct wsdisplay_cursor *));
    123 int     tga_builtin_get_cursor __P((struct tga_devconfig *,
    124 	    struct wsdisplay_cursor *));
    125 int     tga_builtin_set_curpos __P((struct tga_devconfig *,
    126 	    struct wsdisplay_curpos *));
    127 int     tga_builtin_get_curpos __P((struct tga_devconfig *,
    128 	    struct wsdisplay_curpos *));
    129 int     tga_builtin_get_curmax __P((struct tga_devconfig *,
    130 	    struct wsdisplay_curpos *));
    131