xref: /illumos-gate/usr/src/uts/common/sys/sata/adapters/ahci/ahciem.h (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright (c) 2018 Joyent, Inc.
14  */
15 
16 #ifndef _AHCIEM_H
17 #define	_AHCIEM_H
18 
19 /*
20  * Private interface to AHCI Enclosure services
21  */
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <sys/types.h>
28 
29 #define	AHCI_EM_IOC	(('a' << 24) | ('e' << 16) | ('m' << 8))
30 #define	AHCI_EM_IOC_GET	(AHCI_EM_IOC | 0x00)
31 #define	AHCI_EM_IOC_SET	(AHCI_EM_IOC | 0x01)
32 
33 #define	AHCI_EM_IOC_MAX_PORTS	32
34 
35 /*
36  * The default state for LEDs is to have ident and fault disabled and activity
37  * enabled, if in hardware control.
38  */
39 typedef enum ahci_em_led_state {
40 	AHCI_EM_LED_IDENT_ENABLE	= 1 << 0,
41 	AHCI_EM_LED_FAULT_ENABLE	= 1 << 1,
42 	AHCI_EM_LED_ACTIVITY_DISABLE	= 1 << 2
43 } ahci_em_led_state_t;
44 
45 #define	AHCI_EM_FLAG_CONTROL_ACTIVITY	0x01
46 
47 typedef struct ahci_ioc_em_get {
48 	uint_t	aiemg_nports;
49 	uint_t	aiemg_flags;
50 	uint_t	aiemg_status[AHCI_EM_IOC_MAX_PORTS];
51 } ahci_ioc_em_get_t;
52 
53 
54 /*
55  * Values set in aiems_op that control the behavior of the ioctl. If ADD is set,
56  * the listed flags are added to the current set. If, REM is set, then the flags
57  * are removed. If SET is set, then the flags are replaced.
58  */
59 #define	AHCI_EM_IOC_SET_OP_ADD		0x01
60 #define	AHCI_EM_IOC_SET_OP_REM		0x02
61 #define	AHCI_EM_IOC_SET_OP_SET		0x03
62 
63 typedef struct ahci_ioc_em_set {
64 	uint_t	aiems_port;
65 	uint_t	aiems_op;
66 	uint_t	aiems_leds;
67 	uint_t	aiems_pad;
68 } ahci_ioc_em_set_t;
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif /* _AHCIEM_H */
75