1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
  14  */
  15 
  16 
  17 #ifndef _SYS_BOOTCONF_H
  18 #define _SYS_BOOTCONF_H
  19 
  20 /*
  21  * Boot time configuration information objects
  22  */
  23 
  24 #include <sys/types.h>
  25 #include <sys/memlist.h>
  26 #include <sys/ccompile.h>
  27 #include <net/if.h>                       /* for IFNAMSIZ */
  28 
  29 #ifdef __cplusplus
  30 extern "C" {
  31 #endif
  32 
  33 /*
  34  * Masks for bsys_alloc memory allocator. These overlap with the ones for intel
  35  * and sun because they're used by the common kernel.
  36  */
  37 #define BO_NO_ALIGN     0x00001000
  38 #define BO_ALIGN_DONTCARE       -1
  39 
  40 #define BO_VERSION      1       /* bootops interface revision */
  41 
  42 typedef struct bootops {
  43         uint_t  bsys_version;
  44         caddr_t (*bsys_alloc)(struct bootops *, caddr_t, size_t, int);
  45         void    (*bsys_free)(struct bootops *, caddr_t, size_t);
  46         int     (*bsys_getproplen)(struct bootops *, const char *);
  47         int     (*bsys_getprop)(struct bootops *, const char *, void *);
  48         void    (*bsys_printf)(struct bootops *, const char *, ...);
  49 } bootops_t;
  50 
  51 #define BOP_GETVERSION(bop)             ((bop)->bsys_version)
  52 #define BOP_ALLOC(bop, virthint, size, align)   \
  53                 ((bop)->bsys_alloc)(bop, virthint, size, align)
  54 #define BOP_FREE(bop, virt, size)       ((bop)->bsys_free)(bop, virt, size)
  55 #define BOP_GETPROPLEN(bop, name)       ((bop)->bsys_getproplen)(bop, name)
  56 #define BOP_GETPROP(bop, name, buf)     ((bop)->bsys_getprop)(bop, name, buf)
  57 #define BOP_PUTSARG(bop, msg, arg)      ((bop)->bsys_printf)(bop, msg, arg)
  58 
  59 /*
  60  * Boot configuration information
  61  */
  62 
  63 #define BO_MAXFSNAME    16
  64 #define BO_MAXOBJNAME   256
  65 
  66 struct bootobj {
  67         char    bo_fstype[BO_MAXFSNAME];        /* vfs type name (e.g. nfs) */
  68         char    bo_name[BO_MAXOBJNAME];         /* name of object */
  69         int     bo_flags;                       /* flags, see below */
  70         int     bo_size;                        /* number of blocks */
  71         struct vnode *bo_vp;                    /* vnode of object */
  72         char    bo_devname[BO_MAXOBJNAME];
  73         char    bo_ifname[BO_MAXOBJNAME];
  74         int     bo_ppa;
  75 };
  76 
  77 /*
  78  * flags
  79  */
  80 #define BO_VALID        0x01    /* all information in object is valid */
  81 #define BO_BUSY         0x02    /* object is busy */
  82 
  83 extern struct bootobj rootfs;
  84 extern struct bootobj swapfile;
  85 
  86 extern char *default_path;
  87 extern int modrootloaded;
  88 extern char kern_bootargs[];
  89 extern char kern_bootfile[];
  90 
  91 extern int strplumb(void);
  92 extern char *strplumb_get_netdev_path(void);
  93 extern void consconfig(void);
  94 extern void release_bootstrap(void);
  95 
  96 extern void bop_panic(const char *);
  97 extern void boot_prop_finish(void);
  98 extern void bop_printf(struct bootops *, const char *, ...);
  99 
 100 extern struct bootops *bootops;
 101 extern int netboot;
 102 extern char *dhcack;
 103 extern int dhcacklen;
 104 extern char dhcifname[IFNAMSIZ];
 105 
 106 extern char *netdev_path;
 107 
 108 #ifdef __cplusplus
 109 }
 110 #endif
 111 
 112 #endif /* _SYS_BOOTCONF_H */