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