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