The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/vgavar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: vgavar.h,v 1.25 2006/08/13 20:24:51 jmcneill 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@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 <sys/callout.h>
   31 
   32 #include "opt_vga.h"
   33 
   34 struct vga_handle {
   35         struct pcdisplay_handle vh_ph;
   36         bus_space_handle_t vh_ioh_vga, vh_allmemh;
   37         int vh_mono;
   38 };
   39 #define vh_iot          vh_ph.ph_iot
   40 #define vh_memt         vh_ph.ph_memt
   41 #define vh_ioh_6845     vh_ph.ph_ioh_6845
   42 #define vh_memh         vh_ph.ph_memh
   43 
   44 struct vga_funcs {
   45         int (*vf_ioctl)(void *, u_long, caddr_t, int, struct lwp *);
   46         paddr_t (*vf_mmap)(void *, off_t, int);
   47 };
   48 
   49 struct vga_config {
   50         struct vga_handle hdl;
   51         struct vga_softc *softc;
   52 
   53         int nscreens;
   54         LIST_HEAD(, vgascreen) screens;
   55         struct vgascreen *active; /* current display */
   56         const struct wsscreen_descr *currenttype;
   57 
   58         int vc_biosmapped;
   59         bus_space_tag_t vc_biostag;
   60         bus_space_handle_t vc_bioshdl;
   61 
   62         struct vgascreen *wantedscreen;
   63         void (*switchcb)(void *, int, int);
   64         void *switchcbarg;
   65 
   66         struct callout vc_switch_callout;
   67         int vc_quirks;
   68         int vc_type;
   69         const struct vga_funcs *vc_funcs;
   70 
   71 #ifndef VGA_RASTERCONSOLE
   72         int currentfontset1, currentfontset2;
   73         int vc_nfontslots;
   74         struct egavga_font *vc_fonts[8]; /* currently loaded */
   75         TAILQ_HEAD(, egavga_font) vc_fontlist; /* LRU queue */
   76 #else
   77         int nfonts;
   78         LIST_HEAD(, vga_raster_font) vc_fontlist;
   79 #endif /* !VGA_RASTERCONSOLE */
   80 };
   81 
   82 struct vga_softc {
   83         struct device sc_dev;
   84         struct vga_config *sc_vc;
   85 };
   86 
   87 static __inline u_int8_t        _vga_attr_read(struct vga_handle *, int);
   88 static __inline void    _vga_attr_write(struct vga_handle *, int, u_int8_t);
   89 static __inline u_int8_t        _vga_ts_read(struct vga_handle *, int);
   90 static __inline void    _vga_ts_write(struct vga_handle *, int, u_int8_t);
   91 static __inline u_int8_t        _vga_gdc_read(struct vga_handle *, int);
   92 static __inline void    _vga_gdc_write(struct vga_handle *, int, u_int8_t);
   93 
   94 static __inline u_int8_t
   95 _vga_attr_read(struct vga_handle *vh, int reg)
   96 {
   97         u_int8_t res;
   98 
   99         /* reset state */
  100         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
  101 
  102         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_INDEX, reg);
  103         res = bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_DATAR);
  104 
  105         /* reset state XXX unneeded? */
  106         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
  107 
  108         /* enable */
  109         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, 0, 0x20);
  110 
  111         return (res);
  112 }
  113 
  114 static __inline void
  115 _vga_attr_write(struct vga_handle *vh, int reg, u_int8_t val)
  116 {
  117 
  118         /* reset state */
  119         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
  120 
  121         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_INDEX, reg);
  122         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_DATAW, val);
  123 
  124         /* reset state XXX unneeded? */
  125         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
  126 
  127         /* enable */
  128         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, 0, 0x20);
  129 }
  130 
  131 static __inline u_int8_t
  132 _vga_ts_read(struct vga_handle *vh, int reg)
  133 {
  134 
  135         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_INDEX, reg);
  136         return (bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_DATA));
  137 }
  138 
  139 static __inline void
  140 _vga_ts_write(struct vga_handle *vh, int reg, u_int8_t val)
  141 {
  142 
  143         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_INDEX, reg);
  144         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_DATA, val);
  145 }
  146 
  147 static __inline u_int8_t
  148 _vga_gdc_read(struct vga_handle *vh, int reg)
  149 {
  150 
  151         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_INDEX, reg);
  152         return (bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_DATA));
  153 }
  154 
  155 static __inline void
  156 _vga_gdc_write(struct vga_handle *vh, int reg, u_int8_t val)
  157 {
  158 
  159         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_INDEX, reg);
  160         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_DATA, val);
  161 }
  162 
  163 #define vga_attr_read(vh, reg) \
  164         _vga_attr_read(vh, offsetof(struct reg_vgaattr, reg))
  165 #define vga_attr_write(vh, reg, val) \
  166         _vga_attr_write(vh, offsetof(struct reg_vgaattr, reg), val)
  167 #define vga_ts_read(vh, reg) \
  168         _vga_ts_read(vh, offsetof(struct reg_vgats, reg))
  169 #define vga_ts_write(vh, reg, val) \
  170         _vga_ts_write(vh, offsetof(struct reg_vgats, reg), val)
  171 #define vga_gdc_read(vh, reg) \
  172         _vga_gdc_read(vh, offsetof(struct reg_vgagdc, reg))
  173 #define vga_gdc_write(vh, reg, val) \
  174         _vga_gdc_write(vh, offsetof(struct reg_vgagdc, reg), val)
  175 
  176 #define vga_6845_read(vh, reg) \
  177         pcdisplay_6845_read(&(vh)->vh_ph, reg)
  178 #define vga_6845_write(vh, reg, val) \
  179         pcdisplay_6845_write(&(vh)->vh_ph, reg, val)
  180 #define _vga_6845_read(vh, reg) \
  181         _pcdisplay_6845_read(&(vh)->vh_ph, reg)
  182 #define _vga_6845_write(vh, reg, val) \
  183         _pcdisplay_6845_write(&(vh)->vh_ph, reg, val)
  184 
  185 int     vga_common_probe(bus_space_tag_t, bus_space_tag_t);
  186 void    vga_common_attach(struct vga_softc *, bus_space_tag_t,
  187                           bus_space_tag_t, int, int, const struct vga_funcs *);
  188 #define VGA_QUIRK_ONEFONT       0x01
  189 #define VGA_QUIRK_NOFASTSCROLL  0x02
  190 int     vga_is_console(bus_space_tag_t, int);
  191 
  192 int     vga_cnattach(bus_space_tag_t, bus_space_tag_t, int, int);
  193 int     vga_cndetach(void);
  194 
  195 #ifndef VGA_RASTERCONSOLE
  196 struct wsscreen_descr;
  197 void    vga_loadchars(struct vga_handle *, int, int, int, int, const char *);
  198 void    vga_readoutchars(struct vga_handle *, int, int, int, int, char *);
  199 #ifdef VGA_CONSOLE_ATI_BROKEN_FONTSEL
  200 void    vga_copyfont01(struct vga_handle *);
  201 #endif
  202 void    vga_setfontset(struct vga_handle *, int, int);
  203 void    vga_setscreentype(struct vga_handle *, const struct wsscreen_descr *);
  204 #else /* !VGA_RASTERCONSOLE */
  205 void    vga_load_builtinfont(struct vga_handle *, u_int8_t *, int, int);
  206 #endif /* !VGA_RASTERCONSOLE */
  207 #ifdef VGA_RESET
  208 void    vga_reset(struct vga_handle *, void (*)(struct vga_handle *));
  209 #endif
  210 
  211 extern int vga_no_builtinfont;

Cache object: 3c67c0e1aa0ca8f70f8b3697804be1d4


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.