Hardware supported by siis(4) allows software control over activity LEDs.

Expose that functionality to led(4) OR-ing it with regular LED activity.
This commit is contained in:
Alexander Motin 2011-01-26 08:54:10 +00:00
parent 025e2c1221
commit a59641a90d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217877

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <dev/led/led.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include "siis.h"
@ -65,6 +66,7 @@ static int siis_ch_suspend(device_t dev);
static int siis_ch_resume(device_t dev);
static void siis_ch_intr_locked(void *data);
static void siis_ch_intr(void *data);
static void siis_ch_led(void *priv, int onoff);
static void siis_begin_transaction(device_t dev, union ccb *ccb);
static void siis_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error);
static void siis_execute_transaction(struct siis_slot *slot);
@ -516,6 +518,7 @@ siis_ch_attach(device_t dev)
goto err3;
}
mtx_unlock(&ch->mtx);
ch->led = led_create(siis_ch_led, dev, device_get_nameunit(dev));
return (0);
err3:
@ -536,6 +539,7 @@ siis_ch_detach(device_t dev)
{
struct siis_channel *ch = device_get_softc(dev);
led_destroy(ch->led);
mtx_lock(&ch->mtx);
xpt_async(AC_LOST_DEVICE, ch->path, NULL);
xpt_free_path(ch->path);
@ -625,6 +629,21 @@ static driver_t siisch_driver = {
};
DRIVER_MODULE(siisch, siis, siisch_driver, siis_devclass, 0, 0);
static void
siis_ch_led(void *priv, int onoff)
{
device_t dev;
struct siis_channel *ch;
dev = (device_t)priv;
ch = device_get_softc(dev);
if (onoff == 0)
ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_LED_ON);
else
ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_LED_ON);
}
struct siis_dc_cb_args {
bus_addr_t maddr;
int error;