xref: /illumos-gate/usr/src/man/man4i/hdio.4i (revision 06ca4e396ecc93ed45a333664a51558b7e84e8f5)
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 4I
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
26Note \(em the SMC and IPI drivers have been discontinued.
27.Xr dkio 4I
28is now the preferred method for retrieving disk information.
29.Pp
30The SMD and IPI disk drivers supplied with this release support a set of
31.Xr ioctl 2
32requests for diagnostics and bad sector information.
33Basic to these
34.Xr ioctl 2
35requests are the definitions in
36.In sys/hdio.h .
37.Sh IOCTLS
38.Bl -tag -width HDKIOCGTYPE
39.It Dv HDKIOCGTYPE
40The argument is a pointer to a
41.Vt hdk_type
42structure (described below).
43This
44.Xr ioctl 2
45gets specific information from the hard disk.
46.It Dv HDKIOCSTYPE
47The argument is a pointer to a
48.Vt hdk_type
49structure (described below).
50This
51.Xr ioctl 2
52sets specific information about the hard disk.
53.El
54.Bd -literal -offset 2n
55/*
56 * Used for drive info
57 */
58struct 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
67The argument is a pointer to a
68.Vt hdk_badmap
69structure (described below).
70This
71.Xr ioctl 2
72is used to get the bad sector map from the disk.
73.It Dv HDKIOCSBAD
74The argument is a pointer to a
75.Vt hdk_badmap
76structure (described below).
77This
78.Xr ioctl 2
79is 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 */
85struct 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
91The argument is a pointer to a
92.Vt hdk_diag
93structure (described below).
94This
95.Xr ioctl 2
96gets the most recent command that failed along with the
97sector and error number from the hard disk.
98.El
99.Bd -literal -offset 2n
100/*
101 * Used for disk diagnostics
102 */
103struct 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 4I
113