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/fb/fbreg.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 /*-
    2  * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer as
   10  *    the first lines of this file unmodified.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD$
   27  */
   28 
   29 #ifndef _DEV_FB_FBREG_H_
   30 #define _DEV_FB_FBREG_H_
   31 
   32 #ifdef _KERNEL
   33 
   34 #define V_MAX_ADAPTERS          8               /* XXX */
   35 
   36 /* some macros */
   37 #ifdef __i386__
   38 #define bcopy_io(s, d, c)       generic_bcopy((void *)(s), (void *)(d), (c))
   39 #define bcopy_toio(s, d, c)     generic_bcopy((void *)(s), (void *)(d), (c))
   40 #define bcopy_fromio(s, d, c)   generic_bcopy((void *)(s), (void *)(d), (c))
   41 #define bzero_io(d, c)          generic_bzero((void *)(d), (c))
   42 #define fill_io(p, d, c)        fill((p), (void *)(d), (c))
   43 #define fillw_io(p, d, c)       fillw((p), (void *)(d), (c))
   44 void generic_bcopy(const void *s, void *d, size_t c);
   45 void generic_bzero(void *d, size_t c);
   46 #elif defined(__amd64__)
   47 #define bcopy_io(s, d, c)       bcopy((void *)(s), (void *)(d), (c))
   48 #define bcopy_toio(s, d, c)     bcopy((void *)(s), (void *)(d), (c))
   49 #define bcopy_fromio(s, d, c)   bcopy((void *)(s), (void *)(d), (c))
   50 #define bzero_io(d, c)          bzero((void *)(d), (c))
   51 #define fill_io(p, d, c)        fill((p), (void *)(d), (c))
   52 #define fillw_io(p, d, c)       fillw((p), (void *)(d), (c))
   53 #elif defined(__ia64__) || defined(__sparc64__)
   54 #if defined(__ia64__)
   55 #include <machine/bus.h>
   56 #define bcopy_fromio(s, d, c)   \
   57         bus_space_read_region_1(IA64_BUS_SPACE_MEM, s, 0, (void*)(d), c)
   58 #define bcopy_io(s, d, c)       \
   59         bus_space_copy_region_1(IA64_BUS_SPACE_MEM, s, 0, d, 0, c)
   60 #define bcopy_toio(s, d, c)     \
   61         bus_space_write_region_1(IA64_BUS_SPACE_MEM, d, 0, (void*)(s), c)
   62 #define bzero_io(d, c)          \
   63         bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, 0, c)
   64 #define fill_io(p, d, c)        \
   65         bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c)
   66 #define fillw_io(p, d, c)       \
   67         bus_space_set_region_2(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c)
   68 #define readb(a)                bus_space_read_1(IA64_BUS_SPACE_MEM, a, 0)
   69 #define readw(a)                bus_space_read_2(IA64_BUS_SPACE_MEM, a, 0)
   70 #define writeb(a, v)            bus_space_write_1(IA64_BUS_SPACE_MEM, a, 0, v)
   71 #define writew(a, v)            bus_space_write_2(IA64_BUS_SPACE_MEM, a, 0, v)
   72 #define writel(a, v)            bus_space_write_4(IA64_BUS_SPACE_MEM, a, 0, v)
   73 #endif /* __ia64__ */
   74 static __inline void
   75 fillw(int val, uint16_t *buf, size_t size)
   76 {
   77         while (size--)
   78                 *buf++ = val;
   79 }
   80 #elif defined(__powerpc__)
   81 
   82 #define bcopy_io(s, d, c)       ofwfb_bcopy((void *)(s), (void *)(d), (c))
   83 #define bcopy_toio(s, d, c)     ofwfb_bcopy((void *)(s), (void *)(d), (c))
   84 #define bcopy_fromio(s, d, c)   ofwfb_bcopy((void *)(s), (void *)(d), (c))
   85 #define bzero_io(d, c)          ofwfb_bzero((void *)(d), (c))
   86 #define fillw(p, d, c)          ofwfb_fillw((p), (void *)(d), (c))
   87 #define fillw_io(p, d, c)       ofwfb_fillw((p), (void *)(d), (c))
   88 #define readw(a)                ofwfb_readw((u_int16_t *)(a))
   89 #define writew(a, v)            ofwfb_writew((u_int16_t *)(a), (v))
   90 void ofwfb_bcopy(const void *s, void *d, size_t c);
   91 void ofwfb_bzero(void *d, size_t c);
   92 void ofwfb_fillw(int pat, void *base, size_t cnt);
   93 u_int16_t ofwfb_readw(u_int16_t *addr);
   94 void ofwfb_writew(u_int16_t *addr, u_int16_t val);
   95 
   96 #else /* !__i386__ && !__amd64__ && !__ia64__ && !__sparc64__ && !__powerpc__ */
   97 #define bcopy_io(s, d, c)       memcpy_io((d), (s), (c))
   98 #define bcopy_toio(s, d, c)     memcpy_toio((d), (void *)(s), (c))
   99 #define bcopy_fromio(s, d, c)   memcpy_fromio((void *)(d), (s), (c))
  100 #define bzero_io(d, c)          memset_io((d), 0, (c))
  101 #define fill_io(p, d, c)        memset_io((d), (p), (c))
  102 #define fillw(p, d, c)          memsetw((d), (p), (c))
  103 #define fillw_io(p, d, c)       memsetw_io((d), (p), (c))
  104 #endif /* !__i386__ */
  105 
  106 /* video function table */
  107 typedef int vi_probe_t(int unit, video_adapter_t **adpp, void *arg, int flags);
  108 typedef int vi_init_t(int unit, video_adapter_t *adp, int flags);
  109 typedef int vi_get_info_t(video_adapter_t *adp, int mode, video_info_t *info);
  110 typedef int vi_query_mode_t(video_adapter_t *adp, video_info_t *info);
  111 typedef int vi_set_mode_t(video_adapter_t *adp, int mode);
  112 typedef int vi_save_font_t(video_adapter_t *adp, int page, int size, int width,
  113                            u_char *data, int c, int count);
  114 typedef int vi_load_font_t(video_adapter_t *adp, int page, int size, int width,
  115                            u_char *data, int c, int count);
  116 typedef int vi_show_font_t(video_adapter_t *adp, int page);
  117 typedef int vi_save_palette_t(video_adapter_t *adp, u_char *palette);
  118 typedef int vi_load_palette_t(video_adapter_t *adp, u_char *palette);
  119 typedef int vi_set_border_t(video_adapter_t *adp, int border);
  120 typedef int vi_save_state_t(video_adapter_t *adp, void *p, size_t size);
  121 typedef int vi_load_state_t(video_adapter_t *adp, void *p);
  122 typedef int vi_set_win_org_t(video_adapter_t *adp, off_t offset);
  123 typedef int vi_read_hw_cursor_t(video_adapter_t *adp, int *col, int *row);
  124 typedef int vi_set_hw_cursor_t(video_adapter_t *adp, int col, int row);
  125 typedef int vi_set_hw_cursor_shape_t(video_adapter_t *adp, int base,
  126                                      int height, int celsize, int blink);
  127 typedef int vi_blank_display_t(video_adapter_t *adp, int mode);
  128 /* defined in sys/fbio.h
  129 #define V_DISPLAY_ON            0
  130 #define V_DISPLAY_BLANK         1
  131 #define V_DISPLAY_STAND_BY      2
  132 #define V_DISPLAY_SUSPEND       3
  133 */
  134 typedef int vi_mmap_t(video_adapter_t *adp, vm_offset_t offset,
  135                       vm_paddr_t *paddr, int prot);
  136 typedef int vi_ioctl_t(video_adapter_t *adp, u_long cmd, caddr_t data);
  137 typedef int vi_clear_t(video_adapter_t *adp);
  138 typedef int vi_fill_rect_t(video_adapter_t *adp, int val, int x, int y,
  139                            int cx, int cy);
  140 typedef int vi_bitblt_t(video_adapter_t *adp, ...);
  141 typedef int vi_diag_t(video_adapter_t *adp, int level);
  142 typedef int vi_save_cursor_palette_t(video_adapter_t *adp, u_char *palette);
  143 typedef int vi_load_cursor_palette_t(video_adapter_t *adp, u_char *palette);
  144 typedef int vi_copy_t(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst,
  145                       int n);
  146 typedef int vi_putp_t(video_adapter_t *adp, vm_offset_t off, u_int32_t p,
  147                        u_int32_t a, int size, int bpp, int bit_ltor,
  148                        int byte_ltor);
  149 typedef int vi_putc_t(video_adapter_t *adp, vm_offset_t off, u_int8_t c,
  150                       u_int8_t a);
  151 typedef int vi_puts_t(video_adapter_t *adp, vm_offset_t off, u_int16_t *s,
  152                        int len);
  153 typedef int vi_putm_t(video_adapter_t *adp, int x, int y, u_int8_t *pixel_image,
  154                       u_int32_t pixel_mask, int size, int width);
  155 
  156 typedef struct video_switch {
  157     vi_probe_t          *probe;
  158     vi_init_t           *init;
  159     vi_get_info_t       *get_info;
  160     vi_query_mode_t     *query_mode;
  161     vi_set_mode_t       *set_mode;
  162     vi_save_font_t      *save_font;
  163     vi_load_font_t      *load_font;
  164     vi_show_font_t      *show_font;
  165     vi_save_palette_t   *save_palette;
  166     vi_load_palette_t   *load_palette;
  167     vi_set_border_t     *set_border;
  168     vi_save_state_t     *save_state;
  169     vi_load_state_t     *load_state;
  170     vi_set_win_org_t    *set_win_org;
  171     vi_read_hw_cursor_t *read_hw_cursor;
  172     vi_set_hw_cursor_t  *set_hw_cursor;
  173     vi_set_hw_cursor_shape_t *set_hw_cursor_shape;
  174     vi_blank_display_t  *blank_display;
  175     vi_mmap_t           *mmap;
  176     vi_ioctl_t          *ioctl;
  177     vi_clear_t          *clear;
  178     vi_fill_rect_t      *fill_rect;
  179     vi_bitblt_t         *bitblt;
  180     int                 (*reserved1)(void);
  181     int                 (*reserved2)(void);
  182     vi_diag_t           *diag;
  183     vi_save_cursor_palette_t    *save_cursor_palette;
  184     vi_load_cursor_palette_t    *load_cursor_palette;
  185     vi_copy_t           *copy;
  186     vi_putp_t           *putp;
  187     vi_putc_t           *putc;
  188     vi_puts_t           *puts;
  189     vi_putm_t           *putm;
  190 } video_switch_t;
  191 
  192 #define save_palette(adp, pal)                          \
  193         (*vidsw[(adp)->va_index]->save_palette)((adp), (pal))
  194 #define load_palette(adp, pal)                          \
  195         (*vidsw[(adp)->va_index]->load_palette)((adp), (pal))
  196 #define get_mode_info(adp, mode, buf)                   \
  197         (*vidsw[(adp)->va_index]->get_info)((adp), (mode), (buf))
  198 #define set_video_mode(adp, mode)                       \
  199         (*vidsw[(adp)->va_index]->set_mode)((adp), (mode))
  200 #define set_border(adp, border)                         \
  201         (*vidsw[(adp)->va_index]->set_border)((adp), (border))
  202 #define set_origin(adp, o)                              \
  203         (*vidsw[(adp)->va_index]->set_win_org)(adp, o)
  204 
  205 /* XXX - add more macros */
  206 
  207 /* video driver */
  208 typedef struct video_driver {
  209     char                *name;
  210     video_switch_t      *vidsw;
  211     int                 (*configure)(int); /* backdoor for the console driver */
  212 } video_driver_t;
  213 
  214 #define VIDEO_DRIVER(name, sw, config)                  \
  215         static struct video_driver name##_driver = {    \
  216                 #name, &sw, config                      \
  217         };                                              \
  218         DATA_SET(videodriver_set, name##_driver);
  219 
  220 /* global variables */
  221 extern struct video_switch **vidsw;
  222 
  223 /* functions for the video card driver */
  224 int             vid_register(video_adapter_t *adp);
  225 int             vid_unregister(video_adapter_t *adp);
  226 video_switch_t  *vid_get_switch(char *name);
  227 void            vid_init_struct(video_adapter_t *adp, char *name, int type,
  228                                 int unit);
  229 
  230 /* functions for the video card client */
  231 int             vid_allocate(char *driver, int unit, void *id);
  232 int             vid_release(video_adapter_t *adp, void *id);
  233 int             vid_find_adapter(char *driver, int unit);
  234 video_adapter_t *vid_get_adapter(int index);
  235 
  236 /* a backdoor for the console driver to tickle the video driver XXX */
  237 int             vid_configure(int flags);
  238 #define VIO_PROBE_ONLY  (1 << 0)        /* probe only, don't initialize */
  239 
  240 #ifdef FB_INSTALL_CDEV
  241 
  242 /* virtual frame buffer driver functions */
  243 int             fb_attach(int unit, video_adapter_t *adp,
  244                           struct cdevsw *cdevsw);
  245 int             fb_detach(int unit, video_adapter_t *adp,
  246                           struct cdevsw *cdevsw);
  247 
  248 /* generic frame buffer cdev driver functions */
  249 
  250 typedef struct genfb_softc {
  251         int             gfb_flags;      /* flag/status bits */
  252 #define FB_OPEN         (1 << 0)
  253 } genfb_softc_t;
  254 
  255 int             genfbopen(genfb_softc_t *sc, video_adapter_t *adp,
  256                           int flag, int mode, struct thread *td);
  257 int             genfbclose(genfb_softc_t *sc, video_adapter_t *adp,
  258                            int flag, int mode, struct thread *td);
  259 int             genfbread(genfb_softc_t *sc, video_adapter_t *adp,
  260                           struct uio *uio, int flag);
  261 int             genfbwrite(genfb_softc_t *sc, video_adapter_t *adp,
  262                            struct uio *uio, int flag);
  263 int             genfbioctl(genfb_softc_t *sc, video_adapter_t *adp,
  264                            u_long cmd, caddr_t arg, int flag, struct thread *td);
  265 int             genfbmmap(genfb_softc_t *sc, video_adapter_t *adp,
  266                           vm_offset_t offset, vm_offset_t *paddr, int prot);
  267 
  268 #endif /* FB_INSTALL_CDEV */
  269 
  270 /* generic low-level driver functions */
  271 
  272 void            fb_dump_adp_info(char *driver, video_adapter_t *adp, int level);
  273 void            fb_dump_mode_info(char *driver, video_adapter_t *adp,
  274                                   video_info_t *info, int level);
  275 int             fb_type(int adp_type);
  276 int             fb_commonioctl(video_adapter_t *adp, u_long cmd, caddr_t arg);
  277 
  278 #endif /* _KERNEL */
  279 
  280 #endif /* !_DEV_FB_FBREG_H_ */

Cache object: 51eed9cefc3bc32dad4560863402858d


[ 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.