1 .\" Copyright (c) 2002, Sun Microsystems, Inc.
   2 .\" Copyright (c) 2017, Joyent, Inc.
   3 .\" The contents of this file are subject to the terms of the
   4 .\" Common Development and Distribution License (the "License").
   5 .\" You may not use this file except in compliance with the License.
   6 .\"
   7 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   8 .\" or http://www.opensolaris.org/os/licensing.
   9 .\" See the License for the specific language governing permissions
  10 .\" and limitations under the License.
  11 .\"
  12 .\" When distributing Covered Code, include this CDDL HEADER in each
  13 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  14 .\" If applicable, add the following below this CDDL HEADER, with the
  15 .\" fields enclosed by brackets "[]" replaced with your own identifying
  16 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  17 .Dd October 23, 2017
  18 .Dt HDIO 7I
  19 .Os
  20 .Sh NAME
  21 .Nm hdio
  22 .Nd SMD and IPI disk control operations
  23 .Sh SYNOPSIS
  24 .In sys/hdio.h
  25 .Sh DESCRIPTION
  26 Note \(em the SMC and IPI drivers have been discontinued.
  27 .Xr dkio 7I
  28 is now the preferred method for retrieving disk information.
  29 .Pp
  30 The SMD and IPI disk drivers supplied with this release support a set of
  31 .Xr ioctl 2
  32 requests for diagnostics and bad sector information.
  33 Basic to these
  34 .Xr ioctl 2
  35 requests are the definitions in
  36 .In sys/hdio.h .
  37 .Sh IOCTLS
  38 .Bl -tag -width HDKIOCGTYPE
  39 .It Dv HDKIOCGTYPE
  40 The argument is a pointer to a
  41 .Vt hdk_type
  42 structure (described below).
  43 This
  44 .Xr ioctl 2
  45 gets specific information from the hard disk.
  46 .It Dv HDKIOCSTYPE
  47 The argument is a pointer to a
  48 .Vt hdk_type
  49 structure (described below).
  50 This
  51 .Xr ioctl 2
  52 sets specific information about the hard disk.
  53 .El
  54 .Bd -literal -offset 2n
  55 /*
  56  * Used for drive info
  57  */
  58 struct hdk_type {
  59         ushort_t  hdkt_hsect;    /* hard sector count (read only) */
  60         ushort_t  hdkt_promrev;  /* prom revision (read only) */
  61         uchar_t   hdkt_drtype;   /* drive type (ctlr specific) */
  62         uchar_t   hdkt_drstat;   /* drive status (ctlr specific, ro) */
  63 };
  64 .Ed
  65 .Bl -tag -width HDKIOCGBAD
  66 .It Dv HDKIOCGBAD
  67 The argument is a pointer to a
  68 .Vt hdk_badmap
  69 structure (described below).
  70 This
  71 .Xr ioctl 2
  72 is used to get the bad sector map from the disk.
  73 .It Dv HDKIOCSBAD
  74 The argument is a pointer to a
  75 .Vt hdk_badmap
  76 structure (described below).
  77 This
  78 .Xr ioctl 2
  79 is used to set the bad sector map on the disk.
  80 .El
  81 .Bd -literal -offset 2n
  82 /*
  83  * Used for bad sector map
  84  */
  85 struct hdk_badmap {
  86         caddr_t hdkb_bufaddr;   /* address of user's map buffer */
  87 };
  88 .Ed
  89 .Bl -tag -width HDKIOCGDIAG
  90 .It Dv HDKIOCGDIAG
  91 The argument is a pointer to a
  92 .Vt hdk_diag
  93 structure (described below).
  94 This
  95 .Xr ioctl 2
  96 gets the most recent command that failed along with the
  97 sector and error number from the hard disk.
  98 .El
  99 .Bd -literal -offset 2n
 100 /*
 101  * Used for disk diagnostics
 102  */
 103 struct hdk_diag {
 104         ushort_t hdkd_errcmd; /* most recent command in error */
 105         daddr_t hdkd_errsect; /* most recent sector in error */
 106         uchar_t hdkd_errno;   /* most recent error number */
 107         uchar_t hdkd_severe;  /* severity of most recent error */
 108 };
 109 .Ed
 110 .Sh SEE ALSO
 111 .Xr ioctl 2 ,
 112 .Xr dkio 7I