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/sfb_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) 1992 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:        sfb_hdw.c,v $
   29  * Revision 2.7  93/08/03  12:30:59  mrt
   30  *      Remember probe address, else early interrupts will kill us.
   31  *      [93/07/29  23:52:12  af]
   32  * 
   33  *      Fixed types.
   34  *      [93/05/06  10:01:16  af]
   35  * 
   36  * Revision 2.6  93/05/15  19:39:44  mrt
   37  *      machparam.h -> machspl.h
   38  * 
   39  * Revision 2.5  93/05/10  20:08:51  rvb
   40  *      Fixed types.
   41  *      [93/05/06  10:01:16  af]
   42  * 
   43  * Revision 2.4  93/03/17  17:10:36  mrt
   44  *      Use sparse space addresses for bt459 on flamingo.
   45  *      [93/03/10            af]
   46  * 
   47  * Revision 2.3  93/03/09  10:52:26  danner
   48  *      Post-debugging lint.
   49  *      [93/03/05            af]
   50  * 
   51  * Revision 2.2  93/02/05  08:07:23  danner
   52  *      Works on Flamingo too.  Protos.
   53  *      [93/02/04  01:36:44  af]
   54  * 
   55  *      Created.
   56  *      [92/12/10  15:44:39  af]
   57  * 
   58  */
   59 /*
   60  *      File: sfb_hdw.c
   61  *      Author: Alessandro Forin, Carnegie Mellon University
   62  *      Date:   11/92
   63  *
   64  *      Driver for the Smart Color Frame Buffer Display,
   65  *      hardware-level operations.
   66  */
   67 
   68 #include <sfb.h>
   69 #if     (NSFB > 0)
   70 #include <platforms.h>
   71 
   72 #include <machine/machspl.h>
   73 #include <mach/std_types.h>
   74 #include <chips/busses.h>
   75 #include <chips/screen_defs.h>
   76 #include <chips/pm_defs.h>
   77 #include <machine/machspl.h>
   78 
   79 typedef pm_softc_t      sfb_softc_t;
   80 
   81 #ifdef  DECSTATION
   82 #include <mips/PMAX/pmagb_ba.h>
   83 #include <mips/PMAX/tc.h>
   84 #endif
   85 
   86 #ifdef  FLAMINGO
   87 #include <mips/PMAX/pmagb_ba.h>         /* XXXX fixme */
   88 #include <alpha/DEC/tc.h>
   89 #define sparsify(x)     ((1L << 28) | (((x) & 0x7ffffff) << 1) | \
   90                          ((x) & ~0x7ffffffL))
   91 #endif
   92 
   93 #ifndef sparsify
   94 #define sparsify(x) x
   95 #endif
   96 
   97 /*
   98  * Definition of the driver for the auto-configuration program.
   99  */
  100 
  101 int     sfb_probe(), sfb_intr();
  102 void    sfb_attach();
  103 
  104 vm_offset_t     sfb_std[NSFB] = { 0 };
  105 struct  bus_device *sfb_info[NSFB];
  106 struct  bus_driver sfb_driver = 
  107         { sfb_probe, 0, sfb_attach, 0, sfb_std, "sfb", sfb_info,
  108           0, 0, BUS_INTR_DISABLED};
  109 
  110 /*
  111  * Probe/Attach functions
  112  */
  113 
  114 sfb_probe(
  115         vm_offset_t     addr,
  116         struct bus_device *device)
  117 {
  118         static probed_once = 0;
  119 
  120         /*
  121          * Probing was really done sweeping the TC long ago
  122          */
  123         if (tc_probe("sfb") == 0)
  124                 return 0;
  125         if (probed_once++ > 1) {
  126                 printf("[mappable] ");
  127                 device->address = addr;
  128         }
  129         return 1;
  130 }
  131 
  132 void sfb_attach(
  133         struct bus_device *ui)
  134 {
  135         /* ... */
  136         printf(": smart frame buffer");
  137 }
  138 
  139 
  140 /*
  141  * Interrupt routine
  142  */
  143 
  144 sfb_intr(
  145         int     unit,
  146         spl_t   spllevel)
  147 {
  148         register volatile char *ack;
  149 
  150         /* acknowledge interrupt */
  151         ack = (volatile char *) sfb_info[unit]->address + SFB_OFFSET_ICLR;
  152         *ack = 0;
  153 
  154 #if     mips
  155         splx(spllevel);
  156 #endif
  157         lk201_led(unit);
  158 }
  159 
  160 sfb_vretrace(
  161         sfb_softc_t     *sfb,
  162         boolean_t       on)
  163 {
  164         sfb_regs        *regs;
  165 
  166         regs = (sfb_regs *) ((char *)sfb->framebuffer - SFB_OFFSET_VRAM + SFB_OFFSET_REGS);
  167 
  168         regs->intr_enable = (on) ? 1 : 0;
  169 }
  170 
  171 /*
  172  * Boot time initialization: must make device
  173  * usable as console asap.
  174  */
  175 #define sfb_set_status                  cfb_set_status
  176 
  177 extern int
  178         sfb_soft_reset(), sfb_set_status(),
  179         sfb_pos_cursor(), bt459_video_on(),
  180         bt459_video_off(), sfb_vretrace(),
  181         pm_get_status(), pm_char_paint(),
  182         pm_insert_line(), pm_remove_line(),
  183         pm_clear_bitmap(), pm_map_page();
  184 
  185 static struct screen_switch sfb_sw = {
  186         screen_noop,            /* graphic_open */
  187         sfb_soft_reset,         /* graphic_close */
  188         sfb_set_status,         /* set_status */
  189         pm_get_status,          /* get_status */
  190         pm_char_paint,          /* char_paint */
  191         sfb_pos_cursor,         /* pos_cursor */
  192         pm_insert_line,         /* insert_line */
  193         pm_remove_line,         /* remove_line */
  194         pm_clear_bitmap,        /* clear_bitmap */
  195         bt459_video_on,         /* video_on */
  196         bt459_video_off,        /* video_off */
  197         sfb_vretrace,           /* intr_enable */
  198         pm_map_page             /* map_page */
  199 };
  200 
  201 sfb_cold_init(
  202         int             unit,
  203         user_info_t     *up)
  204 {
  205         sfb_softc_t     *sfb;
  206         screen_softc_t  sc = screen(unit);
  207         vm_offset_t     base = tc_probe("sfb");
  208         int             hor_p, ver_p;
  209         boolean_t       makes_sense;
  210 
  211         bcopy(&sfb_sw, &sc->sw, sizeof(sc->sw));
  212         sc->flags |= COLOR_SCREEN;
  213 
  214         /*
  215          * I am confused here by the documentation.  One document
  216          * sez there are three boards:
  217          *      "PMAGB-BA" can do 1280x1024 @66Hz or @72Hz
  218          *      "PMAGB-BC" can do 1024x864  @60Hz or 1280x1024 @72Hz
  219          *      "PMAGB-BE" can do 1024x768  @72Hz or 1280x1024 @72Hz
  220          * Another document sez things differently:
  221          *      "PMAGB-BB" can do 1024x768  @72Hz
  222          *      "PMAGB-BD" can do 1024x864  @60Hz or 1280x1024 @72Hz
  223          *
  224          * I would be inclined to believe the first one, which came
  225          * with an actual piece of hardware attached (a PMAGB-BA).
  226          * But I could swear I got a first board (which blew up
  227          * instantly) and it was calling itself PMAGB-BB...
  228          *
  229          * Since I have not seen any other hardware I will make
  230          * this code as hypothetical as I can.  Should work :-))
  231          */
  232 
  233         makes_sense = FALSE;
  234 
  235         {
  236                 sfb_regs        *regs;
  237 
  238                 regs = (sfb_regs *) ((char *)base + SFB_OFFSET_REGS);
  239                 hor_p = (regs->vhor_setup & 0x1ff) * 4;
  240                 ver_p = regs->vvert_setup & 0x7ff;
  241 
  242                 if (((hor_p == 1280) && (ver_p == 1024)) ||
  243                     ((hor_p == 1024) && (ver_p == 864)) ||
  244                     ((hor_p == 1024) && (ver_p == 768)))
  245                         makes_sense = TRUE;
  246         }       
  247 
  248         if (makes_sense) {
  249                 sc->frame_scanline_width = hor_p;
  250                 sc->frame_height = ver_p;
  251                 sc->frame_visible_width = hor_p;
  252                 sc->frame_visible_height = ver_p;
  253         } else {
  254                 sc->frame_scanline_width = 1280;
  255                 sc->frame_height = 1024;
  256                 sc->frame_visible_width = 1280;
  257                 sc->frame_visible_height = 1024;
  258         }
  259 
  260         pm_init_screen_params(sc,up);
  261         (void) screen_up(unit, up);
  262 
  263         sfb = pm_alloc( unit, sparsify(base + SFB_OFFSET_BT459),
  264                         base + SFB_OFFSET_VRAM, -1);
  265 
  266         screen_default_colors(up);
  267 
  268         sfb_soft_reset(sc);
  269 
  270         /*
  271          * Clearing the screen at boot saves from scrolling
  272          * much, and speeds up booting quite a bit.
  273          */
  274         screen_blitc( unit, 'C'-'@');/* clear screen */
  275 }
  276 
  277 #if     0       /* this is how you find out about a new screen */
  278 fill(addr,n,c)
  279         char *addr;
  280 {
  281         while (n-- > 0) *addr++ = c;
  282 }
  283 #endif
  284 
  285 
  286 #endif  (NSFB > 0)

Cache object: 69c665ca292be8bb1a678647dd391573


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