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#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32#ifdef	__cplusplus
33extern "C" {
34#endif
35
36/* SATA cfgadm plugin interface definitions */
37
38/*
39 * Sub-commands of DEVCTL_AP_CONTROL.
40 */
41typedef enum {
42	SATA_CFGA_GET_AP_TYPE = 1,
43	SATA_CFGA_GET_MODEL_INFO,
44	SATA_CFGA_GET_REVFIRMWARE_INFO,
45	SATA_CFGA_GET_SERIALNUMBER_INFO,
46	SATA_CFGA_RESET_PORT,
47	SATA_CFGA_RESET_DEVICE,
48	SATA_CFGA_RESET_ALL,
49	SATA_CFGA_PORT_DEACTIVATE,
50	SATA_CFGA_PORT_ACTIVATE,
51	SATA_CFGA_PORT_SELF_TEST,
52	SATA_CFGA_GET_DEVICE_PATH
53} sata_cfga_apctl_t;
54
55/* SATA cfgadm plugin interface implementation definitions */
56
57typedef struct sata_ioctl_data {
58	uint_t		cmd;			/* one of the above commands */
59	uint_t		port;			/* port */
60	uint_t		get_size;		/* get size/data flag */
61	caddr_t		buf;			/* data buffer */
62	uint_t		bufsiz;			/* data buffer size */
63	uint_t		misc_arg;		/* reserved */
64} sata_ioctl_data_t;
65
66
67/* For 32-bit app/64-bit kernel */
68typedef struct sata_ioctl_data_32 {
69	uint32_t	cmd;			/* one of the above commands */
70	uint32_t	port;			/* port */
71	uint32_t	get_size;		/* get size/data flag */
72	caddr32_t	buf;			/* data buffer */
73	uint32_t	bufsiz;			/* data buffer size */
74	uint32_t	misc_arg;		/* reserved */
75} sata_ioctl_data_32_t;
76
77/*
78 * Port encoding for ioctl "port" parameter - corresponds to
79 * scsi target encoding for sata devices
80 */
81#define	SATA_CFGA_CPORT_MASK	0x1f
82#define	SATA_CFGA_PMPORT_MASK	0xf
83#define	SATA_CFGA_PMPORT_SHIFT	0x5
84#define	SATA_CFGA_PMPORT_QUAL	0x200
85
86#ifdef	__cplusplus
87}
88#endif
89
90#endif /* _SATA_CFGADM_H */
91