xref: /illumos-gate/usr/src/uts/common/io/pciex/pcieb_ioctl.h (revision e7a617a7b674323dacb8a0d3ac64c275c7a72b0c)
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 2019 Joyent, Inc.
14  */
15 
16 #ifndef _IO_PCIE_PCIEB_IOCTL_H
17 #define	_IO_PCIE_PCIEB_IOCTL_H
18 
19 /*
20  * These are private ioctls for PCIe bridges that are currently consumed by the
21  * 'pcieb' command. These should be used until we figure out how best to
22  * represent PCIe links in the traditional cfgadm and devctl frameworks.
23  */
24 
25 #include <sys/stdint.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #define	PCIEB_IOCTL	(('p' << 24) | ('c' << 16) | ('b' << 8))
32 
33 /*
34  * This requests that we retrain the link that the PCIe bridge has to its
35  * downstream component.
36  */
37 #define	PCIEB_IOCTL_RETRAIN	(PCIEB_IOCTL | 0x01)
38 
39 /*
40  * Get and set the current target speed for a bridge. The target speed of the
41  * bridge will have an impact on the values that end up being used by its
42  * downstream components.
43  */
44 #define	PCIEB_IOCTL_GET_TARGET_SPEED	(PCIEB_IOCTL | 0x02)
45 #define	PCIEB_IOCTL_SET_TARGET_SPEED	(PCIEB_IOCTL | 0x03)
46 
47 typedef struct pcieb_ioctl_target_speed {
48 	uint32_t	pits_flags;
49 	uint32_t	pits_speed;
50 } pcieb_ioctl_target_speed_t;
51 
52 #define	PCIEB_FLAGS_ADMIN_SET		0x01
53 
54 #define	PCIEB_LINK_SPEED_UNKNOWN	0x00
55 #define	PCIEB_LINK_SPEED_GEN1		0x01
56 #define	PCIEB_LINK_SPEED_GEN2		0x02
57 #define	PCIEB_LINK_SPEED_GEN3		0x03
58 #define	PCIEB_LINK_SPEED_GEN4		0x04
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif /* _IO_PCIE_PCIEB_IOCTL_H */
65