Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Apr 2011 16:51:17 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r220853 - stable/8/sys/dev/siis
Message-ID:  <201104191651.p3JGpHvY015122@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Apr 19 16:51:17 2011
New Revision: 220853
URL: http://svn.freebsd.org/changeset/base/220853

Log:
  MFC r217877, r217883:
  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:
  stable/8/sys/dev/siis/siis.c
  stable/8/sys/dev/siis/siis.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/siis/siis.c
==============================================================================
--- stable/8/sys/dev/siis/siis.c	Tue Apr 19 16:46:51 2011	(r220852)
+++ stable/8/sys/dev/siis/siis.c	Tue Apr 19 16:51:17 2011	(r220853)
@@ -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;

Modified: stable/8/sys/dev/siis/siis.h
==============================================================================
--- stable/8/sys/dev/siis/siis.h	Tue Apr 19 16:46:51 2011	(r220852)
+++ stable/8/sys/dev/siis/siis.h	Tue Apr 19 16:51:17 2011	(r220853)
@@ -371,6 +371,7 @@ struct siis_channel {
 	struct ata_dma		dma;            /* DMA data */
 	struct cam_sim		*sim;
 	struct cam_path		*path;
+	struct cdev		*led;		/* Activity led led(4) cdev. */
 	int			quirks;
 	int			pm_level;	/* power management level */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104191651.p3JGpHvY015122>