1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _NSC_IOCTL_H
  27 #define _NSC_IOCTL_H
  28 
  29 #ifdef __cplusplus
  30 extern "C" {
  31 #endif
  32 
  33 #include <sys/dkio.h>
  34 #include <sys/vtoc.h>
  35 #ifdef DKIOCPARTITION
  36 #include <sys/efi_partition.h>
  37 #endif
  38 
  39 /*
  40  * Ioctl definitions for Storage Device.
  41  */
  42 
  43 #define _NSC_(x)                        (('S'<<16)|('D'<<8)|(x))
  44 
  45 #define NSCIOC_OPEN             _NSC_(1)
  46 #define NSCIOC_RESERVE          _NSC_(2)
  47 #define NSCIOC_RELEASE          _NSC_(3)
  48 #define NSCIOC_PARTSIZE         _NSC_(4)
  49 #define NSCIOC_FREEZE           _NSC_(5)
  50 #define NSCIOC_UNFREEZE         _NSC_(6)
  51 #define NSCIOC_ISFROZEN         _NSC_(7)
  52 #define NSCIOC_POWERMSG         _NSC_(8)        /* UPS/PCU power state */
  53 #define NSCIOC_NSKERND          _NSC_(9)
  54 #define NSCIOC_GLOBAL_SIZES     _NSC_(10)       /* size of RM segs */
  55 #define NSCIOC_GLOBAL_DATA      _NSC_(11)
  56 #define NSCIOC_NVMEM_CLEAN      _NSC_(12)       /* mark nvm nsc_global clean */
  57 #define NSCIOC_NVMEM_CLEANF     _NSC_(13)       /* force mark clean */
  58 #define NSCIOC_BSIZE            _NSC_(14)       /* get partition size */
  59 
  60 
  61 /*
  62  * Structure definitions.
  63  */
  64 
  65 
  66 struct nscioc_open {
  67         char    path[NSC_MAXPATH];      /* Pathname */
  68         int     flag;                   /* Flags */
  69         int     mode;                   /* Open modes */
  70         int     pad[15];
  71 };
  72 
  73 
  74 struct nscioc_partsize {
  75         uint64_t        partsize;
  76 };
  77 
  78 
  79 struct nskernd {
  80         uint64_t data1;
  81         uint64_t data2;
  82         char    char1[NSC_MAXPATH];
  83         char    char2[NSC_MAXPATH];
  84         int     command;
  85 };
  86 
  87 
  88 struct nscioc_bsize {
  89         uint64_t vtoc;          /* (struct vtoc *) */
  90         uint64_t dki_info;      /* (struct dk_cinfo *) */
  91         uint64_t raw_fd;        /* dev_t of slice/partition */
  92         uint64_t p64;           /* (struct partition64 *) */
  93         int     efi;            /* do we have an EFI partition table? */
  94 };
  95 
  96 
  97 #ifdef _KERNEL
  98 extern int nskernd_command(intptr_t, int, int *);
  99 extern int nskern_bsize(struct nscioc_bsize *, int *);
 100 #endif
 101 
 102 #ifdef __cplusplus
 103 }
 104 #endif
 105 
 106 #endif /* _NSC_IOCTL_H */