Print this page
Adding AoE support to nza-kernel

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/autoconf.c
          +++ new/usr/src/uts/common/os/autoconf.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  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   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  24   25   */
  25   26  
  26   27  /*
  27   28   * This file contains ddi functions needed during boot and DR.
  28   29   * Many functions in swapgeneric.c can be moved here.
  29   30   *
  30   31   * The object file is currently linked into unix.
  31   32   */
  32   33  
  33   34  #include <sys/bootconf.h>
↓ open down ↓ 34 lines elided ↑ open up ↑
  68   69   * Forward declarations
  69   70   */
  70   71  static void impl_create_root_class(void);
  71   72  static void create_devinfo_tree(void);
  72   73  
  73   74  #if defined(__x86)
  74   75  char *bootpath_prop = NULL;
  75   76  char *fstype_prop = NULL;
  76   77  #endif
  77   78  
       79 +char *aoepath_prop = NULL;
       80 +
  78   81  /*
  79   82   * Setup the DDI but don't necessarily init the DDI.  This will happen
  80   83   * later once /boot is released.
  81   84   */
  82   85  void
  83   86  setup_ddi(void)
  84   87  {
  85   88          impl_ddi_init_nodeid();
  86   89          impl_create_root_class();
  87   90          create_devinfo_tree();
↓ open down ↓ 95 lines elided ↑ open up ↑
 183  186          /*
 184  187           * The `platform' or `implementation architecture' name has been
 185  188           * translated by boot to be proper for file system use.  It is
 186  189           * the `name' of the platform actually booted.  Note the assumption
 187  190           * is that the name will `fit' in the buffer platform (which is
 188  191           * of size SYS_NMLN, which is far bigger than will actually ever
 189  192           * be needed).
 190  193           */
 191  194          (void) BOP_GETPROP(bootops, "impl-arch-name", platform);
 192  195  
      196 +        /*
      197 +         * If boot-aoepath is defined, assume it's AoE boot and set bootpath to
      198 +         * aoeblk/blkdev device corresponding to specified shelf.slot numbers.
      199 +         */
      200 +        size = (size_t)BOP_GETPROPLEN(bootops, "boot-aoepath");
      201 +        if (size != -1) {
      202 +                char    aoedev[MAXPATHLEN];
      203 +                char    *delim;
      204 +                int     shelf, slot;
      205 +
      206 +                aoepath_prop = kmem_zalloc(size, KM_SLEEP);
      207 +                (void) BOP_GETPROP(bootops, "boot-aoepath", aoepath_prop);
      208 +                /*
      209 +                 * If boot-aoepath is set to "auto", device will be
      210 +                 * configured later during AoE autoconfiguration.
      211 +                 */
      212 +                if (strcmp(aoepath_prop, "auto") != 0) {
      213 +                        if ((delim = strchr(aoepath_prop, '.')) != NULL)
      214 +                                *delim++ = '\0';
      215 +                        if (ddi_strtol(aoepath_prop, (char **)NULL, 10,
      216 +                            (long *)&shelf) != 0)
      217 +                                shelf = 0;
      218 +                        if (delim == NULL ||
      219 +                            ddi_strtol(delim, (char **)NULL, 10,
      220 +                            (long *)&slot) != 0)
      221 +                                slot = 0;
      222 +                        /* FIXME aoeblk@0,0 ?! */
      223 +                        (void) snprintf(aoedev, MAXPATHLEN,
      224 +                            "/aoe/aoeblk@0,0/blkdev@%d,%d",
      225 +                            shelf, slot);
      226 +                        setbootpath(aoedev);
      227 +                }
      228 +        }
      229 +
 193  230  #if defined(__x86)
 194  231          /*
 195  232           * Retrieve and honor the bootpath and optional fstype properties
 196  233           */
 197  234          size = (size_t)BOP_GETPROPLEN(bootops, "bootpath");
 198  235          if (size != -1) {
 199  236                  bootpath_prop = kmem_zalloc(size, KM_SLEEP);
 200  237                  (void) BOP_GETPROP(bootops, "bootpath", bootpath_prop);
 201  238                  setbootpath(bootpath_prop);
 202  239          }
↓ open down ↓ 285 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX