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/chips/fb_hdw.c

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  * Mach Operating System
    3  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        fb_hdw.c,v $
   29  * Revision 2.8  93/05/15  19:38:43  mrt
   30  *      machparam.h -> machspl.h
   31  * 
   32  * Revision 2.7  93/05/10  20:07:45  rvb
   33  *      Fixed types.
   34  *      [93/05/06  10:00:11  af]
   35  * 
   36  * Revision 2.6  93/03/09  10:51:53  danner
   37  *      tc_probe() returns a vm_offset_t.
   38  *      [93/03/05            af]
   39  * 
   40  * Revision 2.5  93/02/05  08:06:43  danner
   41  *      Changes for Flamingo.
   42  *      [93/02/04  01:28:46  af]
   43  * 
   44  *      Proper spl typing.
   45  *      [92/11/30            af]
   46  * 
   47  * Revision 2.4  92/05/22  15:47:52  jfriedl
   48  *      Crear up the screen at boot time.
   49  *      [92/05/13  20:43:29  af]
   50  * 
   51  * Revision 2.3  92/02/19  16:45:47  elf
   52  *      Reflected changes in tc_enable_interrupt().
   53  *      [92/02/10  17:13:09  af]
   54  * 
   55  * Revision 2.2  91/08/24  11:51:55  af
   56  *      Created, from .. NO SPECS AT ALL.  A little experimentation
   57  *      with ddb, and a lot of past experience did the magic.
   58  *      I guess this screen driver really is portable.
   59  *      BTW, the cursor is still mirrored, ahem.
   60  *      [91/01/25            af]
   61  * 
   62  */
   63 /*
   64  *      File: fb_hdw.c
   65  *      Author: Alessandro Forin, Carnegie Mellon University
   66  *      Date:   7/91
   67  *
   68  *      Driver for the 3max Monochrome Frame Buffer Display,
   69  *      hardware-level operations.
   70  */
   71 
   72 #include <mfb.h>
   73 #if     (NMFB > 0)
   74 #include <platforms.h>
   75 
   76 #include <machine/machspl.h>
   77 #include <mach/std_types.h>
   78 #include <chips/busses.h>
   79 
   80 #include <chips/screen_defs.h>
   81 
   82 #include <chips/pm_defs.h>
   83 typedef pm_softc_t      fb_softc_t;
   84 
   85 
   86 #ifdef  DECSTATION
   87 #include <mips/PMAX/pmag_aa.h>
   88 #include <mips/PMAX/tc.h>
   89 #endif
   90 
   91 #ifdef  FLAMINGO
   92 #include <mips/PMAX/pmag_aa.h>          /* XXX fixme */
   93 #include <alpha/DEC/tc.h>
   94 #endif
   95 
   96 /*
   97  * Definition of the driver for the auto-configuration program.
   98  */
   99 
  100 int     fb_probe(), fb_intr();
  101 static void     fb_attach();
  102 
  103 vm_offset_t     fb_std[NMFB] = { 0 };
  104 struct  bus_device *fb_info[NMFB];
  105 struct  bus_driver fb_driver = 
  106         { fb_probe, 0, fb_attach, 0, fb_std, "fb", fb_info,
  107           0, 0, BUS_INTR_DISABLED};
  108 
  109 /*
  110  * Probe/Attach functions
  111  */
  112 
  113 fb_probe( /* reg, ui */)
  114 {
  115         static probed_once = 0;
  116 
  117         /*
  118          * Probing was really done sweeping the TC long ago
  119          */
  120         if (tc_probe("fb") == 0)
  121                 return 0;
  122         if (probed_once++ > 1)
  123                 printf("[mappable] ");
  124         return 1;
  125 }
  126 
  127 static void
  128 fb_attach(ui)
  129         struct bus_device *ui;
  130 {
  131         /* ... */
  132         printf(": monochrome display");
  133 }
  134 
  135 
  136 /*
  137  * Interrupt routine
  138  */
  139 
  140 fb_intr(unit,spllevel)
  141         spl_t   spllevel;
  142 {
  143         register volatile char *ack;
  144 
  145         /* acknowledge interrupt */
  146         ack = (volatile char *) fb_info[unit]->address + FB_OFFSET_IREQ;
  147         *ack = 0;
  148 
  149 #if     mips
  150         splx(spllevel);
  151 #endif
  152         lk201_led(unit);
  153 }
  154 
  155 fb_vretrace(fb, on)
  156         fb_softc_t      *fb;
  157 {
  158         int i;
  159 
  160         for (i = 0; i < NMFB; i++)
  161                 if (fb_info[i]->address == (vm_offset_t)fb->framebuffer)
  162                         break;
  163         if (i == NMFB) return;
  164 
  165         (*tc_enable_interrupt)(fb_info[i]->adaptor, on, 0);
  166 }
  167 
  168 /*
  169  * Video on/off
  170  */
  171 fb_video_on(fb, up)
  172         fb_softc_t      *fb;
  173         user_info_t     *up;
  174 {
  175         if (!fb->cursor_state)  /* video is "on" at boot */
  176                 return;
  177         bt455_video_on(fb->vdac_registers, up);
  178         bt431_cursor_on(fb->cursor_registers);
  179         fb->cursor_state = 0;
  180 }
  181 
  182 fb_video_off(fb, up)
  183         fb_softc_t      *fb;
  184         user_info_t     *up;
  185 {
  186         if (fb->cursor_state)
  187                 return;
  188         bt455_video_off(fb->vdac_registers, up);
  189         bt431_cursor_off(fb->cursor_registers);
  190         fb->cursor_state = 1;
  191 }
  192 
  193 /*
  194  * Boot time initialization: must make device
  195  * usable as console asap.
  196  */
  197 extern int
  198         fb_soft_reset(), fb_set_status(),
  199         bt431_pos_cursor(), fb_video_on(),
  200         fb_video_off(), fb_vretrace(),
  201         pm_get_status(), pm_char_paint(),
  202         pm_insert_line(), pm_remove_line(),
  203         pm_clear_bitmap(), pm_map_page();
  204 
  205 static struct screen_switch fb_sw = {
  206         screen_noop,            /* graphic_open */
  207         fb_soft_reset,          /* graphic_close */
  208         fb_set_status,          /* set_status */
  209         pm_get_status,          /* get_status */
  210         pm_char_paint,          /* char_paint */
  211         bt431_pos_cursor,       /* pos_cursor */
  212         pm_insert_line,         /* insert_line */
  213         pm_remove_line,         /* remove_line */
  214         pm_clear_bitmap,        /* clear_bitmap */
  215         fb_video_on,            /* video_on */
  216         fb_video_off,   /* video_off */
  217         fb_vretrace,            /* intr_enable */
  218         pm_map_page             /* map_page */
  219 };
  220 
  221 fb_cold_init(unit, up)
  222         user_info_t     *up;
  223 {
  224         fb_softc_t      *fb;
  225         screen_softc_t  sc = screen(unit);
  226         vm_offset_t     base = tc_probe("fb");
  227 
  228         bcopy(&fb_sw, &sc->sw, sizeof(sc->sw));
  229 #if 0
  230         sc->flags |= MONO_SCREEN;
  231 #else
  232         sc->flags |= COLOR_SCREEN;
  233 #endif
  234         sc->frame_scanline_width = 2048;
  235         sc->frame_height = 1024;
  236         sc->frame_visible_width = 1280;
  237         sc->frame_visible_height = 1024;
  238 
  239         pm_init_screen_params(sc, up);
  240         (void) screen_up(unit, up);
  241 
  242         fb = pm_alloc(unit, base+FB_OFFSET_BT431, base+FB_OFFSET_VRAM, -1);
  243         fb->vdac_registers = (char*) base + FB_OFFSET_BT455;
  244 
  245         screen_default_colors(up);
  246 
  247         fb_soft_reset(sc);
  248 
  249         /*
  250          * Clearing the screen at boot saves from scrolling
  251          * much, and speeds up booting quite a bit.
  252          */
  253         screen_blitc( unit, 'C'-'@');/* clear screen */
  254 }
  255 
  256 #endif  (NMFB > 0)

Cache object: 65bb1f9ace3d244f8655ae34ed6253dd


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