Print this page
fakebop: use a memlist to keep track of physical memory
   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


   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  * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  15  */
  16 
  17 
  18 #ifndef _SYS_BOOTCONF_H
  19 #define _SYS_BOOTCONF_H
  20 
  21 /*
  22  * Boot time configuration information objects
  23  */
  24 
  25 #include <sys/types.h>
  26 #include <sys/memlist.h>
  27 #include <sys/ccompile.h>
  28 #include <net/if.h>                       /* for IFNAMSIZ */
  29 
  30 #ifdef __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 /*
  35  * Masks for bsys_alloc memory allocator. These overlap with the ones for intel
  36  * and sun because they're used by the common kernel.
  37  */
  38 #define BO_NO_ALIGN     0x00001000
  39 #define BO_ALIGN_DONTCARE       -1
  40 
  41 struct bsys_mem {
  42         struct memlist  physinstalled;
  43 };
  44 
  45 #define BO_VERSION      1       /* bootops interface revision */
  46 
  47 typedef struct bootops {
  48         uint_t  bsys_version;
  49         struct bsys_mem boot_mem;
  50         caddr_t (*bsys_alloc)(struct bootops *, caddr_t, size_t, int);
  51         void    (*bsys_free)(struct bootops *, caddr_t, size_t);
  52         int     (*bsys_getproplen)(struct bootops *, const char *);
  53         int     (*bsys_getprop)(struct bootops *, const char *, void *);
  54         void    (*bsys_printf)(struct bootops *, const char *, ...);
  55 } bootops_t;
  56 
  57 #define BOP_GETVERSION(bop)             ((bop)->bsys_version)
  58 #define BOP_ALLOC(bop, virthint, size, align)   \
  59                 ((bop)->bsys_alloc)(bop, virthint, size, align)
  60 #define BOP_FREE(bop, virt, size)       ((bop)->bsys_free)(bop, virt, size)
  61 #define BOP_GETPROPLEN(bop, name)       ((bop)->bsys_getproplen)(bop, name)
  62 #define BOP_GETPROP(bop, name, buf)     ((bop)->bsys_getprop)(bop, name, buf)
  63 #define BOP_PUTSARG(bop, msg, arg)      ((bop)->bsys_printf)(bop, msg, arg)
  64 
  65 /*
  66  * Boot configuration information
  67  */
  68 
  69 #define BO_MAXFSNAME    16