xref: /titanic_44/usr/src/man/man9e/mac_capab_led.9e (revision 4d21059036851b1ba8fa33650d3167e890333d39)
1*4d210590SRobert Mustacchi.\"
2*4d210590SRobert Mustacchi.\" This file and its contents are supplied under the terms of the
3*4d210590SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0.
4*4d210590SRobert Mustacchi.\" You may only use this file in accordance with the terms of version
5*4d210590SRobert Mustacchi.\" 1.0 of the CDDL.
6*4d210590SRobert Mustacchi.\"
7*4d210590SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this
8*4d210590SRobert Mustacchi.\" source.  A copy of the CDDL is also available via the Internet at
9*4d210590SRobert Mustacchi.\" http://www.illumos.org/license/CDDL.
10*4d210590SRobert Mustacchi.\"
11*4d210590SRobert Mustacchi.\"
12*4d210590SRobert Mustacchi.\" Copyright (c) 2017, Joyent, Inc.
13*4d210590SRobert Mustacchi.\"
14*4d210590SRobert Mustacchi.Dd Feb 21, 2017
15*4d210590SRobert Mustacchi.Dt MAC_CAPAB_LED 9E
16*4d210590SRobert Mustacchi.Os
17*4d210590SRobert Mustacchi.Sh NAME
18*4d210590SRobert Mustacchi.Nm mac_capab_led ,
19*4d210590SRobert Mustacchi.Nm mcl_set
20*4d210590SRobert Mustacchi.Nd MAC LED capability
21*4d210590SRobert Mustacchi.Sh SYNOPSIS
22*4d210590SRobert Mustacchi.In sys/mac_provider.h
23*4d210590SRobert Mustacchi.Vt typedef struct mac_capab_led mac_capab_led_t;
24*4d210590SRobert Mustacchi.Vt typedef enum mac_led_mode mac_led_mode_t;
25*4d210590SRobert Mustacchi.Ft int
26*4d210590SRobert Mustacchi.Fo mcl_set
27*4d210590SRobert Mustacchi.Fa "void *driver"
28*4d210590SRobert Mustacchi.Fa "mac_led_mode_t mode"
29*4d210590SRobert Mustacchi.Fa "uint_t flags"
30*4d210590SRobert Mustacchi.Fc
31*4d210590SRobert Mustacchi.Sh INTERFACE LEVEL
32*4d210590SRobert Mustacchi.Sy Evolving -
33*4d210590SRobert MustacchiThis interface is still evolving.
34*4d210590SRobert MustacchiAPI and ABI stability is not guaranteed.
35*4d210590SRobert Mustacchi.Sh PARAMETERS
36*4d210590SRobert Mustacchi.Bl -tag -width Fa
37*4d210590SRobert Mustacchi.It Fa driver
38*4d210590SRobert MustacchiA pointer to the driver's private data that was passed in via the
39*4d210590SRobert Mustacchi.Sy m_pdata
40*4d210590SRobert Mustacchimember of the
41*4d210590SRobert Mustacchi.Xr mac_register 9S
42*4d210590SRobert Mustacchistructure to the
43*4d210590SRobert Mustacchi.Xr mac_register 9F
44*4d210590SRobert Mustacchifunction.
45*4d210590SRobert Mustacchi.It Fa mode
46*4d210590SRobert MustacchiA value that indicates how the driver should drive the LEDs.
47*4d210590SRobert MustacchiSee the
48*4d210590SRobert Mustacchi.Sx LED MODES
49*4d210590SRobert Mustacchisection for a list of supported modes.
50*4d210590SRobert Mustacchi.It Fa flags
51*4d210590SRobert MustacchiReserved for future use.
52*4d210590SRobert Mustacchi.El
53*4d210590SRobert Mustacchi.Sh DESCRIPTION
54*4d210590SRobert MustacchiThe
55*4d210590SRobert Mustacchi.Sy MAC_CAPAB_LED
56*4d210590SRobert Mustacchicapability allows GLDv3 device drivers to expose an interface for
57*4d210590SRobert Mustacchicontrolling the LEDs on the device.
58*4d210590SRobert MustacchiThis allows the system to control the LEDs to assist system
59*4d210590SRobert Mustacchiadministrators in finding and identifying specific physical devices in
60*4d210590SRobert Mustacchithe system.
61*4d210590SRobert Mustacchi.Pp
62*4d210590SRobert MustacchiImplementing this capability is optional.
63*4d210590SRobert MustacchiFor more information on how to handle capabilities and how to indicate
64*4d210590SRobert Mustacchithat a capability is not supported, see
65*4d210590SRobert Mustacchi.Xr mc_getcapab 9E .
66*4d210590SRobert Mustacchi.Pp
67*4d210590SRobert MustacchiThis capability should be implemented if the device in question provides
68*4d210590SRobert Mustacchia way to manipulate its LEDs.
69*4d210590SRobert MustacchiGenerally the LEDs on a device default to indicating link status and
70*4d210590SRobert Mustacchiactivity.
71*4d210590SRobert MustacchiHowever, they can often be turned off or set to a specific pattern for
72*4d210590SRobert Mustacchiidentification purposes.
73*4d210590SRobert Mustacchi.Ss LED MODES
74*4d210590SRobert MustacchiThe system has a notion of different LED modes.
75*4d210590SRobert MustacchiEach LED mode suggests a different way that a device driver should drive
76*4d210590SRobert Mustacchithe indicator LEDs on the device.
77*4d210590SRobert MustacchiWhile we generally want all such LED modes to be as uniform
78*4d210590SRobert Mustacchias possible, there is a limit to such similarities due to the
79*4d210590SRobert Mustacchicapabilities of NICs.
80*4d210590SRobert MustacchiEach mode is a member of the
81*4d210590SRobert Mustacchi.Vt mac_led_mode_t
82*4d210590SRobert Mustacchienumeration.
83*4d210590SRobert MustacchiThe currently defined modes are:
84*4d210590SRobert Mustacchi.Bl -tag -width Dv -offset indent
85*4d210590SRobert Mustacchi.It Dv MAC_LED_DEFAULT
86*4d210590SRobert MustacchiThis mode indicates that the device's default behavior should be used.
87*4d210590SRobert MustacchiThis is usually some form of link status and activity.
88*4d210590SRobert MustacchiIt is device specific and usually is the default behavior after a device
89*4d210590SRobert Mustacchiis powered on.
90*4d210590SRobert Mustacchi.It Dv MAC_LED_OFF
91*4d210590SRobert MustacchiThis mode indicates that the device's LEDs should be turned off and not
92*4d210590SRobert Mustacchiemit any light.
93*4d210590SRobert Mustacchi.It Dv MAC_LED_ON
94*4d210590SRobert MustacchiThis mode indicates that the device's LEDs should be turned on and
95*4d210590SRobert Mustacchiremain solid.
96*4d210590SRobert Mustacchi.It Dv MAC_LED_IDENT
97*4d210590SRobert MustacchiThis mode indicates that the driver should emit some form of
98*4d210590SRobert Mustacchiidentification pattern.
99*4d210590SRobert MustacchiWe suggest that devices indicate some form of solid blinking light that
100*4d210590SRobert Mustacchiis on and off at alternating units of time, for example, every 200
101*4d210590SRobert Mustacchimilliseconds.
102*4d210590SRobert MustacchiIf it is possible to use an alternate color from the normal link up and
103*4d210590SRobert Mustacchiactivity lighting, that is recommended.
104*4d210590SRobert Mustacchi.El
105*4d210590SRobert Mustacchi.Ss MAC Capability Structure
106*4d210590SRobert MustacchiWhen the device driver's
107*4d210590SRobert Mustacchi.Xr mc_getcapab 9E
108*4d210590SRobert Mustacchifunction entry point is called with the capability set to
109*4d210590SRobert Mustacchi.Dv MAC_CAPAB_LED ,
110*4d210590SRobert Mustacchithen the value of the capability structure is the following structure:
111*4d210590SRobert Mustacchi.Bd -literal -offset indent
112*4d210590SRobert Mustacchitypedef struct mac_capab_led {
113*4d210590SRobert Mustacchi	uint_t		mcl_flags;
114*4d210590SRobert Mustacchi	mac_led_mode_t	mcl_modes;
115*4d210590SRobert Mustacchi	int		(*mcl_set)(void *driver, mac_led_mode_t mode,
116*4d210590SRobert Mustacchi			    uint_t flags);
117*4d210590SRobert Mustacchi} mac_capab_led_t;
118*4d210590SRobert Mustacchi.Ed
119*4d210590SRobert Mustacchi.Pp
120*4d210590SRobert MustacchiIf the driver supports the
121*4d210590SRobert Mustacchi.Dv MAC_CAPAB_LED
122*4d210590SRobert Mustacchicapability, it should fill in this structure, based on the following
123*4d210590SRobert Mustacchirules:
124*4d210590SRobert Mustacchi.Bl -tag -width Vt
125*4d210590SRobert Mustacchi.It Fa mcl_flags
126*4d210590SRobert MustacchiThe
127*4d210590SRobert Mustacchi.Fa mcl_flags
128*4d210590SRobert Mustacchimember is used to negotiate extensions with the driver.
129*4d210590SRobert MustacchiMAC will set the value of
130*4d210590SRobert Mustacchi.Fa mcl_flags
131*4d210590SRobert Mustacchito include all of the currently known extensions.
132*4d210590SRobert MustacchiThe driver should intersect this list with the set that they actually
133*4d210590SRobert Mustacchisupport.
134*4d210590SRobert MustacchiAt this time, no such features are defined and the driver should set the
135*4d210590SRobert Mustacchimember to
136*4d210590SRobert Mustacchi.Sy 0 .
137*4d210590SRobert Mustacchi.It Fa mcl_modes
138*4d210590SRobert MustacchiThe
139*4d210590SRobert Mustacchi.Fa mcl_modes
140*4d210590SRobert Mustacchimember represents the support modes of the device driver.
141*4d210590SRobert MustacchiThe device driver should set
142*4d210590SRobert Mustacchi.Vt mcl_modes
143*4d210590SRobert Mustacchito the bitwise-inclusive-OR of the LED modes listed in
144*4d210590SRobert Mustacchi.Sx LED MODES .
145*4d210590SRobert Mustacchi.Pp
146*4d210590SRobert MustacchiIf the driver does not support anything other than the default behavior
147*4d210590SRobert Mustacchiof
148*4d210590SRobert Mustacchi.Dv MAC_LED_DEFAULT ,
149*4d210590SRobert Mustacchithen the device driver should not indicate that it supports this
150*4d210590SRobert Mustacchicapability.
151*4d210590SRobert Mustacchi.It Fa mcl_set
152*4d210590SRobert MustacchiThe
153*4d210590SRobert Mustacchi.Fa mcl_set
154*4d210590SRobert Mustacchientry point will be called by the MAC framework when it needs the device
155*4d210590SRobert Mustacchidriver to change how it is driving its LEDs.
156*4d210590SRobert MustacchiEach call will ask the driver to change the display mode to the
157*4d210590SRobert Mustacchispecified mode.
158*4d210590SRobert MustacchiThe driver does not have to multiplex requests for multiple modes or
159*4d210590SRobert Mustacchikeep track of what has been requested, that is taken care of by the
160*4d210590SRobert Mustacchisystem itself.
161*4d210590SRobert Mustacchi.Pp
162*4d210590SRobert MustacchiThe driver should first validate that
163*4d210590SRobert Mustacchi.Fa mode
164*4d210590SRobert Mustacchiis a mode that it supports.
165*4d210590SRobert MustacchiWhile the device reports the set of supported modes as a
166*4d210590SRobert Mustacchibitwise-inclusive-OR, the driver should only receive a single value in
167*4d210590SRobert Mustacchi.Fa mode .
168*4d210590SRobert MustacchiThe value of the
169*4d210590SRobert Mustacchi.Fa flags
170*4d210590SRobert Mustacchiargument is reserved for future use.
171*4d210590SRobert MustacchiDrivers must check that the value of flags is zero and if not, return
172*4d210590SRobert Mustacchi.Er EINVAL .
173*4d210590SRobert Mustacchi.Pp
174*4d210590SRobert MustacchiWhen this entry point is first called on a driver, it should snapshot
175*4d210590SRobert Mustacchiits device registers such that it knows how to restore the default
176*4d210590SRobert Mustacchibehavior.
177*4d210590SRobert MustacchiBecause each method of programming the LEDs is different, it
178*4d210590SRobert Mustacchiis up to the driver itself to take care of this, the broader framework
179*4d210590SRobert Mustacchicannot take care of it.
180*4d210590SRobert Mustacchi.Pp
181*4d210590SRobert MustacchiIf for some reason the driver is asked to program the same mode that it
182*4d210590SRobert Mustacchiis already driving, then it need not do anything and should simply
183*4d210590SRobert Mustacchireturn success.
184*4d210590SRobert Mustacchi.Pp
185*4d210590SRobert MustacchiOnce the driver successfully changes the LED driving mode, it should
186*4d210590SRobert Mustacchireturn
187*4d210590SRobert Mustacchi.Sy 0 .
188*4d210590SRobert MustacchiOtherwise, it should return the appropriate error number.
189*4d210590SRobert MustacchiFor a full list of error numbers, see
190*4d210590SRobert Mustacchi.Xr Intro 2 .
191*4d210590SRobert MustacchiCommon values are:
192*4d210590SRobert Mustacchi.Bl -tag -width Er -offset width
193*4d210590SRobert Mustacchi.It Er EINVAL
194*4d210590SRobert Mustacchi.Fa flag
195*4d210590SRobert Mustacchicontains an unknown value.
196*4d210590SRobert Mustacchi.It Er ENOTSUP
197*4d210590SRobert Mustacchi.Fa mode
198*4d210590SRobert Mustacchiis unsupported.
199*4d210590SRobert Mustacchi.Fa flags
200*4d210590SRobert Mustacchicontains an unsupported or unknown value.
201*4d210590SRobert Mustacchi.It Er EIO
202*4d210590SRobert MustacchiAn I/O error occurred while trying to program the device's registers.
203*4d210590SRobert MustacchiThis could be because a command timed out or an FM-aware driver
204*4d210590SRobert Mustacchiencountered an error.
205*4d210590SRobert Mustacchi.El
206*4d210590SRobert Mustacchi.Pp
207*4d210590SRobert MustacchiThe broader framework will guarantee that only a single call to the
208*4d210590SRobert Mustacchi.Fa mcl_set
209*4d210590SRobert Mustacchifunction is ongoing at any time.
210*4d210590SRobert MustacchiIf other parts of the driver refer to the data used by the
211*4d210590SRobert Mustacchi.Fa mcl_set
212*4d210590SRobert Mustacchifunction, then the driver must ensure that it is performing sufficient
213*4d210590SRobert Mustacchilocking of its data.
214*4d210590SRobert Mustacchi.El
215*4d210590SRobert Mustacchi.Sh CONTEXT
216*4d210590SRobert MustacchiThe
217*4d210590SRobert Mustacchi.Ft mcl_set
218*4d210590SRobert Mustacchientry point will only be called from
219*4d210590SRobert Mustacchi.Sy user
220*4d210590SRobert Mustacchior
221*4d210590SRobert Mustacchi.Sy kernel
222*4d210590SRobert Mustacchicontext.
223*4d210590SRobert MustacchiIt will never be called from interrupt context.
224*4d210590SRobert Mustacchi.Sh SEE ALSO
225*4d210590SRobert Mustacchi.Xr Intro 2 ,
226*4d210590SRobert Mustacchi.Xr mac 9E ,
227*4d210590SRobert Mustacchi.Xr mc_getcapab 9E ,
228*4d210590SRobert Mustacchi.Xr mac_register 9F
229