Print this page
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
    loader: pxe receive cleanup
    9475 libefi: Do not return only if ReceiveFilter
    installboot: should support efi system partition
    8931 boot1.efi: scan all display modes rather than
    loader: spinconsole updates
    loader: gfx experiment to try GOP Blt() function.
    sha1 build test
    loader: add sha1 hash calculation
    common/sha1: update for loader build
    loader: biosdisk rework
    uts: 32-bit kernel FB needs mapping in low memory
    uts: add diag-device
    uts: boot console mirror with diag-device
    uts: enable very early console on ttya
    kmdb: add diag-device as input/output device
    uts: test VGA memory exclusion from mapping
    uts: clear boot mapping and protect boot pages test
    uts: add dboot map debug printf
    uts: need to release FB pages in release_bootstrap()
    uts: add screenmap ioctl
    uts: update sys/queue.h
    loader: add illumos uts/common to include path
    loader: tem/gfx font cleanup
    loader: vbe checks
    uts: gfx_private set KD_TEXT when KD_RESETTEXT is
    uts: gfx 8-bit update
    loader: gfx 8-bit fix
    loader: always set media size from partition.
    uts: MB2 support for 32-bit kernel
    loader: x86 should have tem 80x25
    uts: x86 should have tem 80x25
    uts: font update
    loader: font update
    uts: tem attributes
    loader: tem.c comment added
    uts: use font module
    loader: add font module
    loader: build rules for new font setup
    uts: gfx_private update for new font structure
    uts: early boot update for new font structure
    uts: font update
    uts: font build rules update for new fonts
    uts: tem update to new font structure
    loader: module.c needs to include tem_impl.h
    uts: gfx_private 8x16 font rework
    uts: make font_lookup public
    loader: font rework
    uts: font rework
    9259 libefi: efi_alloc_and_read should check for PMBR
    uts: tem utf-8 support
    loader: implement tem utf-8 support
    loader: tem should be able to display UTF-8
    7784 uts: console input should support utf-8
    7796 uts: ldterm default to utf-8
    uts: do not reset serial console
    uts: set up colors even if tem is not console
    uts: add type for early boot properties
    uts: gfx_private experiment with drm and vga
    uts: gfx_private should use setmode drm callback.
    uts: identify FB types and set up gfx_private based
    loader: replace gop and vesa with framebuffer
    uts: boot needs simple tem to support mdb
    uts: boot_keyboard should emit esc sequences for
    uts: gfx_private FB showuld be written by line
    kmdb: set terminal window size
    uts: gfx_private needs to keep track of early boot FB
    pnglite: move pnglite to usr/src/common
    loader: gfx_fb
    ficl-sys: add gfx primitives
    loader: add illumos.png logo
    ficl: add fb-putimage
    loader: add png support
    loader: add alpha blending for gfx_fb
    loader: use term-drawrect for menu frame
    ficl: add simple gfx words
    uts: provide fb_info via fbgattr dev_specific array.
    uts: gfx_private add alpha blending
    uts: update sys/ascii.h
    uts: tem OSC support (incomplete)
    uts: implement env module support and use data from
    uts: tem get colors from early boot data
    loader: use crc32 from libstand (libz)
    loader: optimize for size
    loader: pass tem info to the environment
    loader: import tem for loader console
    loader: UEFI loader needs to set ISADIR based on
    loader: need UEFI32 support
    8918 loader.efi: add vesa edid support
    uts: tem_safe_pix_clear_prom_output() should only
    uts: tem_safe_pix_clear_entire_screen() should use
    uts: tem_safe_check_first_time() should query cursor
    uts: tem implement cls callback & visual_io v4
    uts: gfx_vgatext use block cursor for vgatext
    uts: gfx_private implement cls callback & visual_io
    uts: gfx_private bitmap framebuffer implementation
    uts: early start frame buffer console support
    uts: font functions should check the input char
    uts: font rendering should support 16/24/32bit depths
    uts: use smallest font as fallback default.
    uts: update terminal dimensions based on selected
    7834 uts: vgatext should use gfx_private
    uts: add spacing property to 8859-1.bdf
    terminfo: add underline for sun-color
    terminfo: sun-color has 16 colors
    uts: add font load callback type
    loader: do not repeat int13 calls with error 0x20 and
    8905 loader: add skein/edonr support
    8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Revert "NEX-16819 loader UEFI support"
This reverts commit ec06b9fc617b99234e538bf2e7e4d02a24993e0c.
Reverting due to failures in the zfs-tests and the sharefs-tests
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
    loader: pxe receive cleanup
    9475 libefi: Do not return only if ReceiveFilter
    installboot: should support efi system partition
    8931 boot1.efi: scan all display modes rather than
    loader: spinconsole updates
    loader: gfx experiment to try GOP Blt() function.
    sha1 build test
    loader: add sha1 hash calculation
    common/sha1: update for loader build
    loader: biosdisk rework
    uts: 32-bit kernel FB needs mapping in low memory
    uts: add diag-device
    uts: boot console mirror with diag-device
    uts: enable very early console on ttya
    kmdb: add diag-device as input/output device
    uts: test VGA memory exclusion from mapping
    uts: clear boot mapping and protect boot pages test
    uts: add dboot map debug printf
    uts: need to release FB pages in release_bootstrap()
    uts: add screenmap ioctl
    uts: update sys/queue.h
    loader: add illumos uts/common to include path
    loader: tem/gfx font cleanup
    loader: vbe checks
    uts: gfx_private set KD_TEXT when KD_RESETTEXT is
    uts: gfx 8-bit update
    loader: gfx 8-bit fix
    loader: always set media size from partition.
    uts: MB2 support for 32-bit kernel
    loader: x86 should have tem 80x25
    uts: x86 should have tem 80x25
    uts: font update
    loader: font update
    uts: tem attributes
    loader: tem.c comment added
    uts: use font module
    loader: add font module
    loader: build rules for new font setup
    uts: gfx_private update for new font structure
    uts: early boot update for new font structure
    uts: font update
    uts: font build rules update for new fonts
    uts: tem update to new font structure
    loader: module.c needs to include tem_impl.h
    uts: gfx_private 8x16 font rework
    uts: make font_lookup public
    loader: font rework
    uts: font rework
    libefi: efi_alloc_and_read should check for PMBR
    uts: tem utf-8 support
    loader: implement tem utf-8 support
    loader: tem should be able to display UTF-8
    7784 uts: console input should support utf-8
    7796 uts: ldterm default to utf-8
    uts: do not reset serial console
    uts: set up colors even if tem is not console
    uts: add type for early boot properties
    uts: gfx_private experiment with drm and vga
    uts: gfx_private should use setmode drm callback.
    uts: identify FB types and set up gfx_private based
    loader: replace gop and vesa with framebuffer
    uts: boot needs simple tem to support mdb
    uts: boot_keyboard should emit esc sequences for
    uts: gfx_private FB showuld be written by line
    kmdb: set terminal window size
    uts: gfx_private needs to keep track of early boot FB
    pnglite: move pnglite to usr/src/common
    loader: gfx_fb
    ficl-sys: add gfx primitives
    loader: add illumos.png logo
    ficl: add fb-putimage
    loader: add png support
    loader: add alpha blending for gfx_fb
    loader: use term-drawrect for menu frame
    ficl: add simple gfx words
    uts: provide fb_info via fbgattr dev_specific array.
    uts: gfx_private add alpha blending
    uts: update sys/ascii.h
    uts: tem OSC support (incomplete)
    uts: implement env module support and use data from
    uts: tem get colors from early boot data
    loader: use crc32 from libstand (libz)
    loader: optimize for size
    loader: pass tem info to the environment
    loader: import tem for loader console
    loader: UEFI loader needs to set ISADIR based on
    loader: need UEFI32 support
    8918 loader.efi: add vesa edid support
    uts: tem_safe_pix_clear_prom_output() should only
    uts: tem_safe_pix_clear_entire_screen() should use
    uts: tem_safe_check_first_time() should query cursor
    uts: tem implement cls callback & visual_io v4
    uts: gfx_vgatext use block cursor for vgatext
    uts: gfx_private implement cls callback & visual_io
    uts: gfx_private bitmap framebuffer implementation
    uts: early start frame buffer console support
    uts: font functions should check the input char
    uts: font rendering should support 16/24/32bit depths
    uts: use smallest font as fallback default.
    uts: update terminal dimensions based on selected
    7834 uts: vgatext should use gfx_private
    uts: add spacing property to 8859-1.bdf
    terminfo: add underline for sun-color
    terminfo: sun-color has 16 colors
    uts: add font load callback type
    loader: do not repeat int13 calls with error 0x20 and
    8905 loader: add skein/edonr support
    8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/tem.c
          +++ new/usr/src/uts/common/io/tem.c
↓ open down ↓ 113 lines elided ↑ open up ↑
 114  114  _NOTE(MUTEX_PROTECTS_DATA(tems.ts_lock, tems))
 115  115  
 116  116  extern struct mod_ops mod_miscops;
 117  117  
 118  118  static struct modlmisc  modlmisc = {
 119  119          &mod_miscops,   /* modops */
 120  120          "ANSI Terminal Emulator", /* name */
 121  121  };
 122  122  
 123  123  static struct modlinkage modlinkage = {
 124      -        MODREV_1, (void *)&modlmisc, NULL
      124 +        MODREV_1, { (void *)&modlmisc, NULL }
 125  125  };
 126  126  
 127  127  int
 128  128  _init(void)
 129  129  {
 130  130          int ret;
 131  131          ret = mod_install(&modlinkage);
 132  132          if (ret != 0)
 133  133                  return (ret);
 134  134          ret = ldi_ident_from_mod(&modlinkage, &term_li);
↓ open down ↓ 67 lines elided ↑ open up ↑
 202  202          tem_safe_terminal_emulate(tem, buf, len, credp, CALLED_FROM_NORMAL);
 203  203  
 204  204          mutex_exit(&tem->tvs_lock);
 205  205          mutex_exit(&tems.ts_lock);
 206  206  }
 207  207  
 208  208  static void
 209  209  tem_internal_init(struct tem_vt_state *ptem, cred_t *credp,
 210  210      boolean_t init_color, boolean_t clear_screen)
 211  211  {
 212      -        int i, j;
 213      -        int width, height;
 214      -        int total;
      212 +        unsigned i, j, width, height;
      213 +        text_attr_t attr;
 215  214          text_color_t fg;
 216  215          text_color_t bg;
 217      -        size_t  tc_size = sizeof (text_color_t);
 218  216  
 219  217          ASSERT(MUTEX_HELD(&tems.ts_lock) && MUTEX_HELD(&ptem->tvs_lock));
 220  218  
 221  219          if (tems.ts_display_mode == VIS_PIXEL) {
 222  220                  ptem->tvs_pix_data_size = tems.ts_pix_data_size;
 223  221                  ptem->tvs_pix_data =
 224  222                      kmem_alloc(ptem->tvs_pix_data_size, KM_SLEEP);
 225  223          }
 226  224  
 227      -        ptem->tvs_outbuf_size = tems.ts_c_dimension.width;
 228      -        ptem->tvs_outbuf =
 229      -            (unsigned char *)kmem_alloc(ptem->tvs_outbuf_size, KM_SLEEP);
      225 +        ptem->tvs_outbuf_size = tems.ts_c_dimension.width *
      226 +            sizeof (*ptem->tvs_outbuf);
      227 +        ptem->tvs_outbuf = kmem_alloc(ptem->tvs_outbuf_size, KM_SLEEP);
 230  228  
 231  229          width = tems.ts_c_dimension.width;
 232  230          height = tems.ts_c_dimension.height;
 233      -        ptem->tvs_screen_buf_size = width * height;
 234      -        ptem->tvs_screen_buf =
 235      -            (unsigned char *)kmem_alloc(width * height, KM_SLEEP);
      231 +        ptem->tvs_screen_history_size = height;
 236  232  
 237      -        total = width * height * tc_size;
 238      -        ptem->tvs_fg_buf = (text_color_t *)kmem_alloc(total, KM_SLEEP);
 239      -        ptem->tvs_bg_buf = (text_color_t *)kmem_alloc(total, KM_SLEEP);
 240      -        ptem->tvs_color_buf_size = total;
      233 +        ptem->tvs_screen_buf_size = width * ptem->tvs_screen_history_size *
      234 +            sizeof (*ptem->tvs_screen_buf);
      235 +        ptem->tvs_screen_buf = kmem_alloc(ptem->tvs_screen_buf_size, KM_SLEEP);
      236 +        ptem->tvs_screen_rows = kmem_alloc(ptem->tvs_screen_history_size *
      237 +            sizeof (term_char_t *), KM_SLEEP);
 241  238  
 242  239          tem_safe_reset_display(ptem, credp, CALLED_FROM_NORMAL,
 243  240              clear_screen, init_color);
 244  241  
 245  242          ptem->tvs_utf8_left = 0;
 246  243          ptem->tvs_utf8_partial = 0;
 247  244  
 248      -        tem_safe_get_color(ptem, &fg, &bg, TEM_ATTR_SCREEN_REVERSE);
 249      -        for (i = 0; i < height; i++)
      245 +        /* Get default attributes and fill up the screen buffer. */
      246 +        tem_safe_get_attr(ptem, &fg, &bg, &attr, TEM_ATTR_SCREEN_REVERSE);
      247 +        for (i = 0; i < ptem->tvs_screen_history_size; i++) {
      248 +                ptem->tvs_screen_rows[i] = &ptem->tvs_screen_buf[i * width];
      249 +
 250  250                  for (j = 0; j < width; j++) {
 251      -                        ptem->tvs_screen_buf[i * width + j] = ' ';
 252      -                        ptem->tvs_fg_buf[(i * width +j) * tc_size] = fg;
 253      -                        ptem->tvs_bg_buf[(i * width +j) * tc_size] = bg;
      251 +                        ptem->tvs_screen_rows[i][j].tc_fg_color = fg;
      252 +                        ptem->tvs_screen_rows[i][j].tc_bg_color = bg;
      253 +                        ptem->tvs_screen_rows[i][j].tc_char =
      254 +                            TEM_ATTR(attr) | ' ';
 254  255  
 255  256                  }
      257 +        }
 256  258  
 257      -        ptem->tvs_initialized  = 1;
      259 +        ptem->tvs_initialized = B_TRUE;
 258  260  }
 259  261  
 260  262  int
 261  263  tem_initialized(tem_vt_state_t tem_arg)
 262  264  {
 263  265          struct tem_vt_state *ptem = (struct tem_vt_state *)tem_arg;
 264  266          int ret;
 265  267  
 266  268          mutex_enter(&ptem->tvs_lock);
 267      -        ret = ptem->tvs_initialized;
      269 +        ret = ptem->tvs_initialized == B_TRUE? 1 : 0;
 268  270          mutex_exit(&ptem->tvs_lock);
 269  271  
 270  272          return (ret);
 271  273  }
 272  274  
 273  275  tem_vt_state_t
 274  276  tem_init(cred_t *credp)
 275  277  {
 276  278          struct tem_vt_state *ptem;
 277  279  
↓ open down ↓ 3 lines elided ↑ open up ↑
 281  283          mutex_enter(&tems.ts_lock);
 282  284          mutex_enter(&ptem->tvs_lock);
 283  285  
 284  286          ptem->tvs_isactive = B_FALSE;
 285  287          ptem->tvs_fbmode = KD_TEXT;
 286  288  
 287  289          /*
 288  290           * A tem is regarded as initialized only after tem_internal_init(),
 289  291           * will be set at the end of tem_internal_init().
 290  292           */
 291      -        ptem->tvs_initialized = 0;
      293 +        ptem->tvs_initialized = B_FALSE;
 292  294  
 293  295  
 294  296          if (!tems.ts_initialized) {
 295  297                  /*
 296  298                   * Only happens during early console configuration.
 297  299                   */
 298  300                  tem_add(ptem);
 299  301                  mutex_exit(&ptem->tvs_lock);
 300  302                  mutex_exit(&tems.ts_lock);
 301  303                  return ((tem_vt_state_t)ptem);
↓ open down ↓ 26 lines elided ↑ open up ↑
 328  330  tem_free_buf(struct tem_vt_state *tem)
 329  331  {
 330  332          ASSERT(tem != NULL && MUTEX_HELD(&tem->tvs_lock));
 331  333  
 332  334          if (tem->tvs_outbuf != NULL)
 333  335                  kmem_free(tem->tvs_outbuf, tem->tvs_outbuf_size);
 334  336          if (tem->tvs_pix_data != NULL)
 335  337                  kmem_free(tem->tvs_pix_data, tem->tvs_pix_data_size);
 336  338          if (tem->tvs_screen_buf != NULL)
 337  339                  kmem_free(tem->tvs_screen_buf, tem->tvs_screen_buf_size);
 338      -        if (tem->tvs_fg_buf != NULL)
 339      -                kmem_free(tem->tvs_fg_buf, tem->tvs_color_buf_size);
 340      -        if (tem->tvs_bg_buf != NULL)
 341      -                kmem_free(tem->tvs_bg_buf, tem->tvs_color_buf_size);
      340 +        if (tem->tvs_screen_rows != NULL) {
      341 +                kmem_free(tem->tvs_screen_rows, tem->tvs_screen_history_size *
      342 +                    sizeof (term_char_t *));
      343 +        }
 342  344  }
 343  345  
 344  346  void
 345  347  tem_destroy(tem_vt_state_t tem_arg, cred_t *credp)
 346  348  {
 347  349          struct tem_vt_state *tem = (struct tem_vt_state *)tem_arg;
 348  350  
 349  351          mutex_enter(&tems.ts_lock);
 350  352          mutex_enter(&tem->tvs_lock);
 351  353  
↓ open down ↓ 99 lines elided ↑ open up ↑
 451  453          if ((tems.ts_fb_polledio = temargs.polledio) == NULL) {
 452  454                  cmn_err(CE_WARN, "terminal emulator: fb doesn't support polled "
 453  455                      "I/O");
 454  456                  ret = tems_failed(credp, B_TRUE);
 455  457                  mutex_exit(&tems.ts_lock);
 456  458                  return (ret);
 457  459          }
 458  460  
 459  461          /* other sanity checks */
 460  462          if (!((temargs.depth == 4) || (temargs.depth == 8) ||
      463 +            (temargs.depth == 15) || (temargs.depth == 16) ||
 461  464              (temargs.depth == 24) || (temargs.depth == 32))) {
 462  465                  cmn_err(CE_WARN, "terminal emulator: unsupported depth");
 463  466                  ret = tems_failed(credp, B_TRUE);
 464  467                  mutex_exit(&tems.ts_lock);
 465  468                  return (ret);
 466  469          }
 467  470  
 468  471          if ((temargs.mode != VIS_TEXT) && (temargs.mode != VIS_PIXEL)) {
 469  472                  cmn_err(CE_WARN, "terminal emulator: unsupported mode");
 470  473                  ret = tems_failed(credp, B_TRUE);
↓ open down ↓ 47 lines elided ↑ open up ↑
 518  521                      tems.ts_p_dimension.height != tp->height)
 519  522                          result |= TEMS_DIMENSION_DIFF;
 520  523          }
 521  524  
 522  525          return (result);
 523  526  }
 524  527  
 525  528  static void
 526  529  tems_setup_terminal(struct vis_devinit *tp, size_t height, size_t width)
 527  530  {
      531 +        bitmap_data_t *font_data;
 528  532          int i;
 529      -        int old_blank_buf_size = tems.ts_c_dimension.width;
      533 +        int old_blank_buf_size = tems.ts_c_dimension.width *
      534 +            sizeof (*tems.ts_blank_line);
 530  535  
 531  536          ASSERT(MUTEX_HELD(&tems.ts_lock));
 532  537  
 533  538          tems.ts_pdepth = tp->depth;
 534  539          tems.ts_linebytes = tp->linebytes;
 535  540          tems.ts_display_mode = tp->mode;
      541 +        tems.ts_color_map = tp->color_map;
 536  542  
 537  543          switch (tp->mode) {
 538  544          case VIS_TEXT:
 539  545                  tems.ts_p_dimension.width = 0;
 540  546                  tems.ts_p_dimension.height = 0;
 541  547                  tems.ts_c_dimension.width = tp->width;
 542  548                  tems.ts_c_dimension.height = tp->height;
 543  549                  tems.ts_callbacks = &tem_safe_text_callbacks;
 544  550  
 545  551                  break;
↓ open down ↓ 15 lines elided ↑ open up ↑
 561  567  
 562  568                  tems.ts_callbacks = &tem_safe_pix_callbacks;
 563  569  
 564  570                  /*
 565  571                   * set_font() will select a appropriate sized font for
 566  572                   * the number of rows and columns selected.  If we don't
 567  573                   * have a font that will fit, then it will use the
 568  574                   * default builtin font and adjust the rows and columns
 569  575                   * to fit on the screen.
 570  576                   */
 571      -                set_font(&tems.ts_font,
 572      -                    &tems.ts_c_dimension.height,
      577 +                font_data = set_font(&tems.ts_c_dimension.height,
 573  578                      &tems.ts_c_dimension.width,
 574  579                      tems.ts_p_dimension.height,
 575  580                      tems.ts_p_dimension.width);
 576  581  
      582 +                for (i = 0; i < VFNT_MAPS; i++) {
      583 +                        tems.ts_font.vf_map[i] =
      584 +                            font_data->font->vf_map[i];
      585 +                        tems.ts_font.vf_map_count[i] =
      586 +                            font_data->font->vf_map_count[i];
      587 +                }
      588 +                tems.ts_font.vf_bytes = font_data->font->vf_bytes;
      589 +                tems.ts_font.vf_width = font_data->font->vf_width;
      590 +                tems.ts_font.vf_height = font_data->font->vf_height;
      591 +
 577  592                  tems.ts_p_offset.y = (tems.ts_p_dimension.height -
 578      -                    (tems.ts_c_dimension.height * tems.ts_font.height)) / 2;
      593 +                    (tems.ts_c_dimension.height * tems.ts_font.vf_height)) / 2;
 579  594                  tems.ts_p_offset.x = (tems.ts_p_dimension.width -
 580      -                    (tems.ts_c_dimension.width * tems.ts_font.width)) / 2;
      595 +                    (tems.ts_c_dimension.width * tems.ts_font.vf_width)) / 2;
 581  596  
 582  597                  tems.ts_pix_data_size =
 583      -                    tems.ts_font.width * tems.ts_font.height;
      598 +                    tems.ts_font.vf_width * tems.ts_font.vf_height;
 584  599  
 585  600                  tems.ts_pix_data_size *= 4;
 586  601  
 587  602                  tems.ts_pdepth = tp->depth;
 588  603  
 589  604                  break;
 590  605          }
 591  606  
 592  607          /* Now virtual cls also uses the blank_line buffer */
 593  608          if (tems.ts_blank_line)
 594  609                  kmem_free(tems.ts_blank_line, old_blank_buf_size);
 595  610  
 596      -        tems.ts_blank_line = (unsigned char *)
 597      -            kmem_alloc(tems.ts_c_dimension.width, KM_SLEEP);
 598      -        for (i = 0; i < tems.ts_c_dimension.width; i++)
 599      -                tems.ts_blank_line[i] = ' ';
      611 +        tems.ts_blank_line = kmem_alloc(tems.ts_c_dimension.width *
      612 +            sizeof (*tems.ts_blank_line), KM_SLEEP);
 600  613  }
 601  614  
 602  615  /*
 603  616   * This is a callback function that we register with the frame
 604  617   * buffer driver layered underneath.  It gets invoked from
 605  618   * the underlying frame buffer driver to reconfigure the terminal
 606  619   * emulator to a new screen size and depth in conjunction with
 607  620   * framebuffer videomode changes.
 608  621   * Here we keep the foreground/background color and attributes,
 609  622   * which may be different with the initial settings, so that
↓ open down ↓ 62 lines elided ↑ open up ↑
 672  685          cb_arg = tems.ts_modechg_arg;
 673  686  
 674  687          /*
 675  688           * Release the lock while doing callback.
 676  689           */
 677  690          mutex_exit(&tems.ts_lock);
 678  691          cb(cb_arg);
 679  692  }
 680  693  
 681  694  /*
      695 + * This function is used to clear entire screen via the underlying framebuffer
      696 + * driver.
      697 + */
      698 +int
      699 +tems_cls_layered(struct vis_consclear *pda,
      700 +    cred_t *credp)
      701 +{
      702 +        int rval;
      703 +
      704 +        (void) ldi_ioctl(tems.ts_hdl, VIS_CONSCLEAR,
      705 +            (intptr_t)pda, FKIOCTL, credp, &rval);
      706 +        return (rval);
      707 +}
      708 +
      709 +/*
 682  710   * This function is used to display a rectangular blit of data
 683  711   * of a given size and location via the underlying framebuffer driver.
 684  712   * The blit can be as small as a pixel or as large as the screen.
 685  713   */
 686  714  void
 687      -tems_display_layered(
 688      -        struct vis_consdisplay *pda,
 689      -        cred_t *credp)
      715 +tems_display_layered(struct vis_consdisplay *pda,
      716 +    cred_t *credp)
 690  717  {
 691  718          int rval;
 692  719  
 693  720          (void) ldi_ioctl(tems.ts_hdl, VIS_CONSDISPLAY,
 694  721              (intptr_t)pda, FKIOCTL, credp, &rval);
 695  722  }
 696  723  
 697  724  /*
 698  725   * This function is used to invoke a block copy operation in the
 699  726   * underlying framebuffer driver.  Rectangle copies are how scrolling
 700  727   * is implemented, as well as horizontal text shifting escape seqs.
 701  728   * such as from vi when deleting characters and words.
 702  729   */
 703  730  void
 704      -tems_copy_layered(
 705      -        struct vis_conscopy *pma,
 706      -        cred_t *credp)
      731 +tems_copy_layered(struct vis_conscopy *pma,
      732 +    cred_t *credp)
 707  733  {
 708  734          int rval;
 709  735  
 710  736          (void) ldi_ioctl(tems.ts_hdl, VIS_CONSCOPY,
 711  737              (intptr_t)pma, FKIOCTL, credp, &rval);
 712  738  }
 713  739  
 714  740  /*
 715  741   * This function is used to show or hide a rectangluar monochrom
 716  742   * pixel inverting, text block cursor via the underlying framebuffer.
 717  743   */
 718  744  void
 719      -tems_cursor_layered(
 720      -        struct vis_conscursor *pca,
 721      -        cred_t *credp)
      745 +tems_cursor_layered(struct vis_conscursor *pca,
      746 +    cred_t *credp)
 722  747  {
 723  748          int rval;
 724  749  
 725  750          (void) ldi_ioctl(tems.ts_hdl, VIS_CONSCURSOR,
 726  751              (intptr_t)pca, FKIOCTL, credp, &rval);
 727  752  }
 728  753  
 729  754  static void
 730  755  tem_kdsetmode(int mode, cred_t *credp)
 731  756  {
↓ open down ↓ 10 lines elided ↑ open up ↑
 742  767          struct vis_cmap cm;
 743  768          int rval;
 744  769  
 745  770          if (called_from == CALLED_FROM_STANDALONE)
 746  771                  return;
 747  772  
 748  773          switch (tems.ts_pdepth) {
 749  774          case 8:
 750  775                  cm.index = 0;
 751  776                  cm.count = 16;
 752      -                cm.red   = cmap4_to_24.red;   /* 8-bits (1/3 of TrueColor 24) */
 753      -                cm.blue  = cmap4_to_24.blue;  /* 8-bits (1/3 of TrueColor 24) */
 754      -                cm.green = cmap4_to_24.green; /* 8-bits (1/3 of TrueColor 24) */
      777 +                /* 8-bits (1/3 of TrueColor 24) */
      778 +                cm.red   = (uint8_t *)cmap4_to_24.red;
      779 +                /* 8-bits (1/3 of TrueColor 24) */
      780 +                cm.blue  = (uint8_t *)cmap4_to_24.blue;
      781 +                /* 8-bits (1/3 of TrueColor 24) */
      782 +                cm.green = (uint8_t *)cmap4_to_24.green;
 755  783                  (void) ldi_ioctl(tems.ts_hdl, VIS_PUTCMAP, (intptr_t)&cm,
 756  784                      FKIOCTL, credp, &rval);
 757  785                  break;
 758  786          }
 759  787  }
 760  788  
 761  789  void
 762  790  tem_get_size(ushort_t *r, ushort_t *c, ushort_t *x, ushort_t *y)
 763  791  {
 764  792          mutex_enter(&tems.ts_lock);
↓ open down ↓ 20 lines elided ↑ open up ↑
 785  813   * different screen height and width with our kernel console.
 786  814   */
 787  815  static void
 788  816  tem_prom_scroll_up(struct tem_vt_state *tem, int nrows, cred_t *credp,
 789  817      enum called_from called_from)
 790  818  {
 791  819          struct vis_conscopy     ma;
 792  820          int     ncols, width;
 793  821  
 794  822          /* copy */
 795      -        ma.s_row = nrows * tems.ts_font.height;
      823 +        ma.s_row = nrows * tems.ts_font.vf_height;
 796  824          ma.e_row = tems.ts_p_dimension.height - 1;
 797  825          ma.t_row = 0;
 798  826  
 799  827          ma.s_col = 0;
 800  828          ma.e_col = tems.ts_p_dimension.width - 1;
 801  829          ma.t_col = 0;
 802  830  
 803  831          tems_safe_copy(&ma, credp, called_from);
 804  832  
 805  833          /* clear */
 806      -        width = tems.ts_font.width;
      834 +        width = tems.ts_font.vf_width;
 807  835          ncols = (tems.ts_p_dimension.width + (width - 1))/ width;
 808  836  
 809  837          tem_safe_pix_cls_range(tem, 0, nrows, tems.ts_p_offset.y,
 810  838              0, ncols, 0, B_TRUE, credp, called_from);
 811  839  }
 812  840  
 813  841  #define PROM_DEFAULT_FONT_HEIGHT        22
 814  842  #define PROM_DEFAULT_WINDOW_TOP         0x8a
 815  843  
 816  844  /*
↓ open down ↓ 11 lines elided ↑ open up ↑
 828  856          int     scroll_up_lines;
 829  857  
 830  858          plat_tem_get_prom_font_size(&prom_charheight, &prom_window_top);
 831  859          if (prom_charheight == 0)
 832  860                  prom_charheight = PROM_DEFAULT_FONT_HEIGHT;
 833  861          if (prom_window_top == 0)
 834  862                  prom_window_top = PROM_DEFAULT_WINDOW_TOP;
 835  863  
 836  864          tem_y = (prom_row + 1) * prom_charheight + prom_window_top -
 837  865              tems.ts_p_offset.y;
 838      -        tem_row = (tem_y + tems.ts_font.height - 1) /
 839      -            tems.ts_font.height - 1;
      866 +        tem_row = (tem_y + tems.ts_font.vf_height - 1) /
      867 +            tems.ts_font.vf_height - 1;
 840  868  
 841  869          if (tem_row < 0) {
 842  870                  tem_row = 0;
 843  871          } else if (tem_row >= (tems.ts_c_dimension.height - 1)) {
 844  872                  /*
 845  873                   * Scroll up the prom outputs if the PROM cursor's position is
 846  874                   * below our tem's lower boundary.
 847  875                   */
 848  876                  scroll_up_lines = tem_row -
 849  877                      (tems.ts_c_dimension.height - 1);
↓ open down ↓ 57 lines elided ↑ open up ↑
 907  935   * PROM, so that our kernel console can keep the same visual behaviour.
 908  936   */
 909  937  static void
 910  938  tems_get_initial_color(tem_color_t *pcolor)
 911  939  {
 912  940          boolean_t inverse, inverse_screen;
 913  941          unsigned short  flags = 0;
 914  942  
 915  943          pcolor->fg_color = DEFAULT_ANSI_FOREGROUND;
 916  944          pcolor->bg_color = DEFAULT_ANSI_BACKGROUND;
      945 +#ifndef _HAVE_TEM_FIRMWARE
      946 +        plat_tem_get_colors(&pcolor->fg_color, &pcolor->bg_color);
      947 +#endif
 917  948  
 918      -        if (plat_stdout_is_framebuffer()) {
 919      -                tems_get_inverses(&inverse, &inverse_screen);
 920      -                if (inverse)
 921      -                        flags |= TEM_ATTR_REVERSE;
 922      -                if (inverse_screen)
 923      -                        flags |= TEM_ATTR_SCREEN_REVERSE;
      949 +        tems_get_inverses(&inverse, &inverse_screen);
      950 +        if (inverse)
      951 +                flags |= TEM_ATTR_REVERSE;
      952 +        if (inverse_screen)
      953 +                flags |= TEM_ATTR_SCREEN_REVERSE;
 924  954  
 925      -                if (flags != 0) {
 926      -                        /*
 927      -                         * If either reverse flag is set, the screen is in
 928      -                         * white-on-black mode.  We set the bold flag to
 929      -                         * improve readability.
 930      -                         */
 931      -                        flags |= TEM_ATTR_BOLD;
 932      -                } else {
 933      -                        /*
 934      -                         * Otherwise, the screen is in black-on-white mode.
 935      -                         * The SPARC PROM console, which starts in this mode,
 936      -                         * uses the bright white background colour so we
 937      -                         * match it here.
 938      -                         */
 939      -                        if (pcolor->bg_color == ANSI_COLOR_WHITE)
 940      -                                flags |= TEM_ATTR_BRIGHT_BG;
 941      -                }
      955 +        if (flags != 0) {
      956 +                /*
      957 +                 * If either reverse flag is set, the screen is in
      958 +                 * white-on-black mode.  We set the bold flag to
      959 +                 * improve readability.
      960 +                 */
      961 +                flags |= TEM_ATTR_BOLD;
      962 +        } else {
      963 +                /*
      964 +                 * Otherwise, the screen is in black-on-white mode.
      965 +                 * The SPARC PROM console, which starts in this mode,
      966 +                 * uses the bright white background colour so we
      967 +                 * match it here.
      968 +                 */
      969 +                if (pcolor->bg_color == ANSI_COLOR_WHITE)
      970 +                        flags |= TEM_ATTR_BRIGHT_BG;
 942  971          }
 943  972  
 944  973          pcolor->a_flags = flags;
 945  974  }
 946  975  
 947  976  uchar_t
 948  977  tem_get_fbmode(tem_vt_state_t tem_arg)
 949  978  {
 950  979          struct tem_vt_state *tem = (struct tem_vt_state *)tem_arg;
 951  980  
↓ open down ↓ 80 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX