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/os/space.c
          +++ new/usr/src/uts/common/os/space.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
  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 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   * Copyright 2016 Nexenta Systems, Inc.
  26   26   */
  27   27  
  28   28  /*
  29   29   * The intent of this file is to contain any data that must remain
  30   30   * resident in the kernel.
  31   31   *
  32   32   * space_store(), space_fetch(), and space_free() have been added to
  33   33   * easily store and retrieve kernel resident data.
  34   34   * These functions are recommended rather than adding new variables to
  35   35   * this file.
  36   36   *
  37   37   * Note that it's possible for name collisions to occur.  In order to
  38   38   * prevent collisions, it's recommended that the convention in
  39   39   * PSARC/1997/389 be used.  If a collision occurs, then space_store will
  40   40   * fail.
  41   41   */
  42   42  
  43   43  #include <sys/types.h>
  44   44  #include <sys/param.h>
  45   45  #include <sys/var.h>
  46   46  #include <sys/proc.h>
  47   47  #include <sys/signal.h>
  48   48  #include <sys/utsname.h>
  49   49  #include <sys/buf.h>
  50   50  #include <sys/cred.h>
  51   51  #include <sys/vfs.h>
  52   52  #include <sys/vnode.h>
  53   53  #include <sys/sysinfo.h>
  54   54  #include <sys/t_lock.h>
  55   55  #include <sys/vmem.h>
  56   56  #include <sys/modhash.h>
  57   57  #include <sys/cmn_err.h>
  58   58  
  59   59  #include <sys/strredir.h>
  60   60  #include <sys/kbio.h>
  61   61  #include <sys/consdev.h>
  62   62  #include <sys/wscons.h>
  63   63  #include <sys/bootprops.h>
  64   64  
  65   65  struct  buf     bfreelist;      /* Head of the free list of buffers */
  66   66  
  67   67  sysinfo_t       sysinfo;
  68   68  vminfo_t        vminfo;         /* VM stats protected by sysinfolock mutex */
  69   69  
  70   70  #ifdef  lint
  71   71  int     __lintzero;             /* Alway zero for shutting up lint */
  72   72  #endif
  73   73  
  74   74  /*
  75   75   * The following describe the physical memory configuration.
  76   76   *
  77   77   *      physmem  -  The amount of physical memory configured
  78   78   *                  in pages.  ptob(physmem) is the amount
  79   79   *                  of physical memory in bytes.  Defined in
  80   80   *                  .../os/startup.c.
  81   81   *
  82   82   *      physmax  -  The highest numbered physical page in memory.
  83   83   *
  84   84   *      maxmem   -  Maximum available memory, in pages.  Defined
  85   85   *                  in main.c.
  86   86   *
  87   87   *      physinstalled
  88   88   *               -  Pages of physical memory installed;
  89   89   *                  includes use by PROM/boot not counted in
  90   90   *                  physmem.
  91   91   */
  92   92  
  93   93  pfn_t   physmax;
  94   94  pgcnt_t physinstalled;
  95   95  
  96   96  struct var v;
  97   97  
  98   98  #include <sys/systm.h>
  99   99  #include <sys/conf.h>
 100  100  #include <sys/kmem.h>
 101  101  #include <sys/sysmacros.h>
 102  102  #include <sys/bootconf.h>
 103  103  
 104  104  /*
 105  105   * Data for segkmem pages that should be resident
 106  106   */
 107  107  struct vnode kvps[KV_MAX];
 108  108  
 109  109  /*
 110  110   * Data from swapgeneric.c that must be resident.
 111  111   */
 112  112  struct vnode *rootvp;           /* vnode of the root device */
 113  113  dev_t rootdev;                  /* dev_t of the root device */
 114  114  boolean_t root_is_ramdisk;      /* root is ramdisk */
 115  115  uint32_t ramdisk_size;          /* (KB) currently set only for sparc netboots */
 116  116  
 117  117  /*
 118  118   * dhcp
 119  119   */
 120  120  #include <sys/socket.h>
 121  121  #include <sys/errno.h>
 122  122  #include <sys/sockio.h>
 123  123  #include <sys/stream.h>
 124  124  #include <sys/stropts.h>
 125  125  #include <sys/dlpi.h>
 126  126  #include <net/if.h>
 127  127  
 128  128  int netboot;
 129  129  int obpdebug;
 130  130  char *dhcack;           /* dhcp response packet */
 131  131  int dhcacklen;
 132  132  char *netdev_path;      /* Used to cache the netdev_path handed up by boot */
 133  133  char dhcifname[IFNAMSIZ];
 134  134  
 135  135  /*
 136  136   * Data from arp.c that must be resident.
 137  137   */
 138  138  #include <net/if_arp.h>
 139  139  #include <netinet/in.h>
 140  140  #include <netinet/in_var.h>
 141  141  #include <netinet/if_ether.h>
 142  142  
 143  143  ether_addr_t etherbroadcastaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 144  144  
 145  145  
 146  146  /*
 147  147   * Data from timod that must be resident
 148  148   */
 149  149  
 150  150  /*
 151  151   * state transition table for TI interface
 152  152   */
 153  153  #include <sys/tihdr.h>
 154  154  
 155  155  #define nr      127             /* not reachable */
 156  156  
 157  157  char ti_statetbl[TE_NOEVENTS][TS_NOSTATES] = {
 158  158                                  /* STATES */
 159  159          /* 0  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16 */
 160  160  
 161  161          { 1, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 162  162          {nr, nr, nr,  2, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 163  163          {nr, nr, nr,  4, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 164  164          {nr,  3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 165  165          {nr, nr, nr, nr,  3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 166  166          {nr,  0,  3, nr,  3,  3, nr, nr,  7, nr, nr, nr,  6,  7,  9, 10, 11},
 167  167          {nr, nr,  0, nr, nr,  6, nr, nr, nr, nr, nr, nr,  3, nr,  3,  3,  3},
 168  168          {nr, nr, nr, nr, nr, nr, nr, nr,  9, nr, nr, nr, nr,  3, nr, nr, nr},
 169  169          {nr, nr, nr, nr, nr, nr, nr, nr,  3, nr, nr, nr, nr,  3, nr, nr, nr},
 170  170          {nr, nr, nr, nr, nr, nr, nr, nr,  7, nr, nr, nr, nr,  7, nr, nr, nr},
 171  171          {nr, nr, nr,  5, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 172  172          {nr, nr, nr, nr, nr, nr, nr,  8, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 173  173          {nr, nr, nr, nr, nr, nr, 12, 13, nr, 14, 15, 16, nr, nr, nr, nr, nr},
 174  174          {nr, nr, nr, nr, nr, nr, nr, nr, nr,  9, nr, 11, nr, nr, nr, nr, nr},
 175  175          {nr, nr, nr, nr, nr, nr, nr, nr, nr,  9, nr, 11, nr, nr, nr, nr, nr},
 176  176          {nr, nr, nr, nr, nr, nr, nr, nr, nr, 10, nr,  3, nr, nr, nr, nr, nr},
 177  177          {nr, nr, nr,  7, nr, nr, nr,  7, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 178  178          {nr, nr, nr, nr, nr, nr,  9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 179  179          {nr, nr, nr, nr, nr, nr, nr, nr, nr,  9, 10, nr, nr, nr, nr, nr, nr},
 180  180          {nr, nr, nr, nr, nr, nr, nr, nr, nr,  9, 10, nr, nr, nr, nr, nr, nr},
 181  181          {nr, nr, nr, nr, nr, nr, nr, nr, nr, 11,  3, nr, nr, nr, nr, nr, nr},
 182  182          {nr, nr, nr, nr, nr, nr,  3, nr, nr,  3,  3,  3, nr, nr, nr, nr, nr},
 183  183          {nr, nr, nr, nr, nr, nr, nr,  3, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 184  184          {nr, nr, nr, nr, nr, nr, nr,  7, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 185  185          {nr, nr, nr,  9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 186  186          {nr, nr, nr,  3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 187  187          {nr, nr, nr,  3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 188  188          {nr, nr, nr,  3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr},
 189  189  };
 190  190  
 191  191  
 192  192  #include <sys/tty.h>
 193  193  #include <sys/ptyvar.h>
 194  194  
 195  195  static void store_fetch_initspace();
 196  196  
 197  197  /*
 198  198   * Allocate tunable structures at runtime.
 199  199   */
 200  200  void
 201  201  space_init(void)
 202  202  {
 203  203          pty_initspace();
 204  204          store_fetch_initspace();
  
    | 
      ↓ open down ↓ | 
    204 lines elided | 
    
      ↑ open up ↑ | 
  
 205  205  }
 206  206  
 207  207  int ts_dispatch_extended = -1; /* set in ts_getdptbl or set_platform_default */
 208  208  
 209  209  /*
 210  210   * Previously defined in consmsconf.c ...
 211  211   */
 212  212  dev_t kbddev = NODEV;
 213  213  dev_t mousedev = NODEV;
 214  214  dev_t stdindev = NODEV;
      215 +dev_t diagdev = NODEV;
 215  216  struct vnode *wsconsvp;
 216  217  
 217  218  dev_t fbdev = NODEV;
 218  219  struct vnode *fbvp;
 219  220  dev_info_t *fbdip;
 220  221  
 221  222  /*
 222  223   * moved from cons.c because they must be resident in the kernel.
 223  224   */
 224  225  vnode_t *rconsvp;
 225  226  dev_t   rconsdev;
 226  227  dev_t   uconsdev = NODEV;
 227  228  
 228  229  /*
 229  230   * serial virtual console vnode pointer.
 230  231   */
 231  232  vnode_t         *vsconsvp = NULL;
 232  233  
 233  234  /*
 234  235   * Flag whether console fb output is using PROM/PROM emulation
 235  236   * terminal emulator, or is using the kernel terminal emulator.
 236  237   */
 237  238  int     consmode = CONS_FW;
 238  239  
 239  240  /*
 240  241   * The following allows systems to disable use of the kernel
 241  242   * terminal emulator (retreat to PROM terminal emulator if there
 242  243   * is PROM).
 243  244   */
 244  245  int     cons_tem_disable;
 245  246  
 246  247  /*
 247  248   * consconfig() in autoconf.c sets this; it's the vnode of the distinguished
 248  249   * keyboard/frame buffer combination, aka the workstation console.
 249  250   */
 250  251  vnode_t *rwsconsvp;
 251  252  dev_t   rwsconsdev;
 252  253  
 253  254  /*
 254  255   * Platform console abort policy.
 255  256   * Platforms may override the default software policy, if such hardware
 256  257   * (e.g. keyswitches with a secure position) exists.
 257  258   */
 258  259  int abort_enable = KIOCABORTENABLE;
 259  260  
 260  261  /* from cpc.c */
 261  262  uint_t kcpc_key;        /* TSD key for CPU performance counter context */
 262  263  
 263  264  /*
 264  265   * storing and retrieving data by string key
 265  266   *
 266  267   * this mechanism allows a consumer to store and retrieve by name a pointer
 267  268   * to some space maintained by the consumer.
 268  269   * For example, a driver or module may want to have persistent data
 269  270   * over unloading/loading cycles. The pointer is typically to some
 270  271   * kmem_alloced space and it should not be pointing to data that will
 271  272   * be destroyed when the module is unloaded.
 272  273   */
 273  274  static mod_hash_t *space_hash;
 274  275  static char *space_hash_name = "space_hash";
 275  276  static size_t   space_hash_nchains = 8;
 276  277  
 277  278  static void
 278  279  store_fetch_initspace()
 279  280  {
 280  281          space_hash = mod_hash_create_strhash(space_hash_name,
 281  282              space_hash_nchains, mod_hash_null_valdtor);
 282  283          ASSERT(space_hash);
 283  284  }
 284  285  
 285  286  int
 286  287  space_store(char *key, uintptr_t ptr)
 287  288  {
 288  289          char *s;
 289  290          int rval;
 290  291          size_t l;
 291  292  
 292  293          /* some sanity checks first */
 293  294          if (key == NULL) {
 294  295                  return (-1);
 295  296          }
 296  297          l = (size_t)strlen(key);
 297  298          if (l == 0) {
 298  299                  return (-1);
 299  300          }
 300  301  
 301  302          /* increment for null terminator */
 302  303          l++;
 303  304  
 304  305          /* alloc space for the string, mod_hash_insert will deallocate */
 305  306          s = kmem_alloc(l, KM_SLEEP);
 306  307          bcopy(key, s, l);
 307  308  
 308  309          rval = mod_hash_insert(space_hash,
 309  310              (mod_hash_key_t)s, (mod_hash_val_t)ptr);
 310  311  
 311  312          switch (rval) {
 312  313          case 0:
 313  314                  break;
 314  315  #ifdef DEBUG
 315  316          case MH_ERR_DUPLICATE:
 316  317                  cmn_err(CE_WARN, "space_store: duplicate key %s", key);
 317  318                  rval = -1;
 318  319                  break;
 319  320          case MH_ERR_NOMEM:
 320  321                  cmn_err(CE_WARN, "space_store: no mem for key %s", key);
 321  322                  rval = -1;
 322  323                  break;
 323  324          default:
 324  325                  cmn_err(CE_WARN, "space_store: unspecified error for key %s",
 325  326                      key);
 326  327                  rval = -1;
 327  328                  break;
 328  329  #else
 329  330          default:
 330  331                  rval = -1;
 331  332                  break;
 332  333  #endif
 333  334          }
 334  335  
 335  336          return (rval);
 336  337  }
 337  338  
 338  339  uintptr_t
 339  340  space_fetch(char *key)
 340  341  {
 341  342          uintptr_t ptr = 0;
 342  343          mod_hash_val_t val;
 343  344          int rval;
 344  345  
 345  346          if (key) {
 346  347                  rval = mod_hash_find(space_hash, (mod_hash_key_t)key, &val);
 347  348                  if (rval == 0) {
 348  349                          ptr = (uintptr_t)val;
 349  350                  }
 350  351          }
 351  352  
 352  353          return (ptr);
 353  354  }
 354  355  
 355  356  void
 356  357  space_free(char *key)
 357  358  {
 358  359          if (key) {
 359  360                  (void) mod_hash_destroy(space_hash, (mod_hash_key_t)key);
 360  361          }
 361  362  }
 362  363  
 363  364  /*
 364  365   * Support for CRC32.  At present all calculations are done in simple
 365  366   * macros, so all we need is somewhere to declare the global lookup table.
 366  367   */
 367  368  
 368  369  #include <sys/crc32.h>
 369  370  
 370  371  const uint32_t crc32_table[256] = { CRC32_TABLE };
 371  372  
 372  373  /*
 373  374   * We need to fanout load from NIC which can overwhelm a single CPU.
 374  375   * This becomes especially important on systems having slow CPUs
 375  376   * (sun4v architecture). mac_soft_ring_enable is false on all
 376  377   * systems except sun4v. On sun4v, they get enabled by default (see
 377  378   * sun4v/os/mach_startup.c).
 378  379   */
 379  380  boolean_t       mac_soft_ring_enable = B_FALSE;
 380  381  
 381  382  /*
 382  383   * Global iscsi boot prop
 383  384   */
 384  385  ib_boot_prop_t  *iscsiboot_prop = NULL;
  
    | 
      ↓ open down ↓ | 
    160 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX