svn commit: r217877 - head/sys/dev/siis
Alexander Motin
mav at FreeBSD.org
Wed Jan 26 08:54:10 UTC 2011
Author: mav
Date: Wed Jan 26 08:54:10 2011
New Revision: 217877
URL: http://svn.freebsd.org/changeset/base/217877
Log:
Hardware supported by siis(4) allows software control over activity LEDs.
Expose that functionality to led(4) OR-ing it with regular LED activity.
Modified:
head/sys/dev/siis/siis.c
Modified: head/sys/dev/siis/siis.c
==============================================================================
--- head/sys/dev/siis/siis.c Wed Jan 26 08:39:34 2011 (r217876)
+++ head/sys/dev/siis/siis.c Wed Jan 26 08:54:10 2011 (r217877)
@@ -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;
More information about the svn-src-head
mailing list