xref: /illumos-gate/usr/src/uts/common/sys/sata/sata_cfgadm.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
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 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SATA_CFGADM_H
28 #define	_SATA_CFGADM_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /* SATA cfgadm plugin interface definitions */
35 
36 /*
37  * Sub-commands of DEVCTL_AP_CONTROL.
38  */
39 typedef enum {
40 	SATA_CFGA_GET_AP_TYPE = 1,
41 	SATA_CFGA_GET_MODEL_INFO,
42 	SATA_CFGA_GET_REVFIRMWARE_INFO,
43 	SATA_CFGA_GET_SERIALNUMBER_INFO,
44 	SATA_CFGA_RESET_PORT,
45 	SATA_CFGA_RESET_DEVICE,
46 	SATA_CFGA_RESET_ALL,
47 	SATA_CFGA_PORT_DEACTIVATE,
48 	SATA_CFGA_PORT_ACTIVATE,
49 	SATA_CFGA_PORT_SELF_TEST,
50 	SATA_CFGA_GET_DEVICE_PATH
51 } sata_cfga_apctl_t;
52 
53 /* SATA cfgadm plugin interface implementation definitions */
54 
55 typedef struct sata_ioctl_data {
56 	uint_t		cmd;			/* one of the above commands */
57 	uint_t		port;			/* port */
58 	uint_t		get_size;		/* get size/data flag */
59 	caddr_t		buf;			/* data buffer */
60 	uint_t		bufsiz;			/* data buffer size */
61 	uint_t		misc_arg;		/* reserved */
62 } sata_ioctl_data_t;
63 
64 
65 /* For 32-bit app/64-bit kernel */
66 typedef struct sata_ioctl_data_32 {
67 	uint32_t	cmd;			/* one of the above commands */
68 	uint32_t	port;			/* port */
69 	uint32_t	get_size;		/* get size/data flag */
70 	caddr32_t	buf;			/* data buffer */
71 	uint32_t	bufsiz;			/* data buffer size */
72 	uint32_t	misc_arg;		/* reserved */
73 } sata_ioctl_data_32_t;
74 
75 /*
76  * Port encoding for ioctl "port" parameter - corresponds to
77  * scsi target encoding for sata devices
78  */
79 #define	SATA_CFGA_CPORT_MASK	0x1f
80 #define	SATA_CFGA_PMPORT_MASK	0xf
81 #define	SATA_CFGA_PMPORT_SHIFT	0x5
82 #define	SATA_CFGA_PMPORT_QUAL	0x200
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif /* _SATA_CFGADM_H */
89