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/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c
          +++ new/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  
    | 
      ↓ open down ↓ | 
    16 lines elided | 
    
      ↑ open up ↑ | 
  
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   27  /*
  30   28   * PROM interface
  31   29   */
  32   30  
  33   31  #include <sys/types.h>
  34   32  #include <unistd.h>
  35   33  #include <string.h>
  36   34  #include <stdlib.h>
  37   35  
  38   36  #define _KERNEL
  39   37  #define _BOOT
  40   38  #include <sys/promif.h>
  41   39  #undef _BOOT
  42   40  #undef _KERNEL
  43   41  
  44   42  #include <mdb/mdb_debug.h>
  45   43  #include <mdb/mdb_err.h>
  46   44  #include <kmdb/kmdb_promif_impl.h>
  47   45  #include <kmdb/kmdb_kdi.h>
  48   46  #include <mdb/mdb_string.h>
  49   47  #include <mdb/mdb.h>
  50   48  
  51   49  #ifndef sun4v
  52   50  int kmdb_prom_preserve_kctx = 0;
  53   51  #endif /* sun4v */
  54   52  
  55   53  ssize_t
  56   54  kmdb_prom_obp_writer(caddr_t buf, size_t len)
  57   55  {
  58   56          return (prom_write(prom_stdout_ihandle(), buf, len, 0, 0));
  59   57  }
  60   58  
  61   59  ihandle_t
  62   60  kmdb_prom_get_handle(char *name)
  63   61  {
  64   62          if (strcmp(name, "stdin") == 0)
  65   63                  return (prom_stdin_ihandle());
  66   64          else if (strcmp(name, "stdout") == 0 || strcmp(name, "stderr") == 0)
  67   65                  return (prom_stdout_ihandle());
  68   66          else
  69   67                  return (-1);
  70   68  }
  71   69  
  72   70  /*ARGSUSED*/
  73   71  char *
  74   72  kmdb_prom_get_ddi_prop(kmdb_auxv_t *kav, char *propname)
  75   73  {
  76   74          pnode_t node;
  77   75          ssize_t len;
  78   76          char *val;
  79   77  
  80   78          if ((node = prom_finddevice("/options")) == NULL)
  81   79                  return (NULL);
  82   80  
  83   81          if ((len = prom_getproplen(node, propname)) < 0)
  84   82                  return (NULL);
  85   83  
  86   84          val = mdb_alloc(len + 1, UM_SLEEP);
  87   85  
  88   86          if (prom_bounded_getprop(node, propname, val, len) != len) {
  89   87                  mdb_free(val, len);
  90   88                  return (NULL);
  91   89          }
  92   90          val[len] = '\0';
  93   91  
  94   92          return (val);
  95   93  }
  96   94  
  97   95  void
  98   96  kmdb_prom_free_ddi_prop(char *val)
  
    | 
      ↓ open down ↓ | 
    60 lines elided | 
    
      ↑ open up ↑ | 
  
  99   97  {
 100   98          strfree(val);
 101   99  }
 102  100  
 103  101  int
 104  102  kmdb_prom_getprop(pnode_t node, char *name, caddr_t value)
 105  103  {
 106  104          return (prom_getprop(node, name, value));
 107  105  }
 108  106  
      107 +/*ARGSUSED*/
      108 +void
      109 +kmdb_prom_get_tem_size(kmdb_auxv_t *kav, ushort_t *rows, ushort_t *cols)
      110 +{
      111 +        /* We fall back to defaults for now. */
      112 +}
      113 +
 109  114  typedef struct walk_cpu_data {
 110  115          int (*wcd_cb)(pnode_t, void *, void *);
 111  116          void *wcd_arg;
 112  117  } walk_cpu_data_t;
 113  118  
 114  119  static int
 115  120  walk_cpus_cb(pnode_t node, void *arg, void *result)
 116  121  {
 117  122          walk_cpu_data_t *wcd = arg;
 118  123  
 119  124          /*
 120  125           * Sun4v doesn't support port_id on guest.
 121  126           */
 122  127  #ifndef sun4v
 123  128          int port_id;
 124  129  #endif  /* sun4v */
 125  130  
 126  131          if (!prom_devicetype(node, OBP_CPU))
 127  132                  return (PROM_WALK_CONTINUE);
 128  133  
 129  134  #ifndef sun4v
 130  135          if ((prom_getprop(node, "portid", (caddr_t)&port_id) == -1) &&
 131  136              (prom_getprop(node, "upa-portid", (caddr_t)&port_id) == -1) &&
 132  137              (prom_getprop(node, "cpuid", (caddr_t)&port_id) == -1)) {
 133  138                  warn("cpu node %x has no identifying properties\n",
 134  139                      node);
 135  140                  return (PROM_WALK_CONTINUE);
 136  141          }
 137  142  #endif  /* sun4v */
 138  143  
 139  144          if (wcd->wcd_cb(node, wcd->wcd_arg, result) != 0)
 140  145                  return (PROM_WALK_TERMINATE);
 141  146  
 142  147          return (PROM_WALK_CONTINUE);
 143  148  }
 144  149  
 145  150  void
 146  151  kmdb_prom_walk_cpus(int (*cb)(pnode_t, void *, void *), void *arg, void *result)
 147  152  {
 148  153          walk_cpu_data_t wcd;
 149  154  
 150  155          wcd.wcd_cb = cb;
 151  156          wcd.wcd_arg = arg;
 152  157  
 153  158          prom_walk_devs(prom_rootnode(), walk_cpus_cb, &wcd, result);
 154  159  }
 155  160  
 156  161  void
 157  162  kmdb_prom_enter_mon(void)
 158  163  {
 159  164          prom_enter_mon();
 160  165  }
 161  166  
 162  167  #ifndef sun4v
 163  168  pnode_t
 164  169  kmdb_prom_getcpu_propnode(pnode_t node)
 165  170  {
 166  171          int val;
 167  172          pnode_t pnode;
 168  173          char name[OBP_MAXPROPNAME];
 169  174  
 170  175  
 171  176          /*
 172  177           * Check for the CMT case where cpu nodes are "strand" nodes
 173  178           * In this case, the "cpu node" properties are contained in
 174  179           * its parent "core" node.
 175  180           */
 176  181          if (prom_getprop(node, "portid", (caddr_t)&val) == -1 &&
 177  182              prom_getprop(node, "upa-portid", (caddr_t)&val) == -1 &&
 178  183              prom_getprop((pnode = prom_parentnode(node)), "name", name) != -1 &&
 179  184              strcmp(name, "core") == 0)
 180  185                  return (pnode);
 181  186  
 182  187          return (node);
 183  188  }
 184  189  #endif  /* sun4v */
 185  190  
 186  191  void
 187  192  kmdb_prom_exit_to_mon(void)
 188  193  {
 189  194          prom_exit_to_mon();
 190  195  }
 191  196  
 192  197  void
 193  198  kmdb_prom_interpret(const char *str)
 194  199  {
 195  200          prom_interpret((char *)str, 0, 0, 0, 0, 0);
 196  201  }
 197  202  
 198  203  /*ARGSUSED*/
 199  204  int
 200  205  kmdb_prom_translate_virt(uintptr_t virt, physaddr_t *pap)
 201  206  {
 202  207          extern int prom_translate_virt(caddr_t, int *, u_longlong_t *, int *);
 203  208  
 204  209          int valid, mode;
 205  210          uintptr_t vabase = virt & ~(mdb.m_pagesize - 1);
 206  211          uintptr_t off = virt - vabase;
 207  212          u_longlong_t pa;
 208  213  
 209  214          mdb_dprintf(MDB_DBG_DPI, "using OBP for vtop of %p\n", (void *)virt);
 210  215  
 211  216          if (prom_translate_virt((caddr_t)vabase, &valid, &pa, &mode) != 0)
 212  217                  return (set_errno(EMDB_NOMAP));
 213  218  
 214  219          *pap = pa + off;
 215  220          return (0);
 216  221  }
 217  222  
 218  223  /*ARGSUSED*/
 219  224  int
 220  225  kmdb_prom_stdout_is_framebuffer(kmdb_auxv_t *kav)
 221  226  {
 222  227          return (prom_stdout_is_framebuffer());
 223  228  }
 224  229  
 225  230  #ifndef sun4v
 226  231  #define PROM_KCTX_PRESERVED_PROPNAME    "context0-page-size-preserved"
 227  232  void
 228  233  kmdb_prom_preserve_kctx_init(void)
 229  234  {
 230  235          pnode_t pnode;
 231  236          int     val;
 232  237  
 233  238          pnode = (pnode_t)prom_getphandle(prom_mmu_ihandle());
 234  239          if (prom_getprop(pnode, PROM_KCTX_PRESERVED_PROPNAME,
 235  240              (caddr_t)&val) == 0) {
 236  241                  kmdb_prom_preserve_kctx = 1;
 237  242          }
 238  243  }
 239  244  #endif /* sun4v */
  
    | 
      ↓ open down ↓ | 
    121 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX