Date: Wed, 26 Sep 2012 16:46:44 +0000 (UTC) From: Jim Harris <jimharris@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r240965 - head/sys/dev/isci Message-ID: <201209261646.q8QGkiK2058868@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jimharris Date: Wed Sep 26 16:46:44 2012 New Revision: 240965 URL: http://svn.freebsd.org/changeset/base/240965 Log: Create led(4) device nodes mapped to isci(4) SGPIO locate LEDs. Device nodes are in the format /dev/led/isci.busX.portY.locate. Sponsored by: Intel Requested by: Paul Maulberger <paul dot maulberger at gmx dot de> MFC after: 1 week Modified: head/sys/dev/isci/isci.c head/sys/dev/isci/isci.h head/sys/dev/isci/isci_controller.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Wed Sep 26 14:29:15 2012 (r240964) +++ head/sys/dev/isci/isci.c Wed Sep 26 16:46:44 2012 (r240965) @@ -38,11 +38,14 @@ __FBSDID("$FreeBSD$"); #include <cam/cam_periph.h> +#include <dev/led/led.h> + #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> #include <dev/isci/scil/scic_logger.h> #include <dev/isci/scil/scic_library.h> +#include <dev/isci/scil/scic_sgpio.h> #include <dev/isci/scil/scic_user_callback.h> #include <dev/isci/scil/scif_controller.h> @@ -180,7 +183,7 @@ static int isci_detach(device_t device) { struct isci_softc *isci = DEVICE2SOFTC(device); - int i; + int i, phy; for (i = 0; i < isci->controller_count; i++) { struct ISCI_CONTROLLER *controller = &isci->controllers[i]; @@ -220,6 +223,10 @@ isci_detach(device_t device) if (controller->remote_device_memory != NULL) free(controller->remote_device_memory, M_ISCI); + for (phy = 0; phy < SCI_MAX_PHYS; phy++) + if (controller->led[phy].cdev) + led_destroy(controller->led[phy].cdev); + while (1) { sci_pool_get(controller->unmap_buffer_pool, unmap_buffer); if (unmap_buffer == NULL) Modified: head/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Wed Sep 26 14:29:15 2012 (r240964) +++ head/sys/dev/isci/isci.h Wed Sep 26 16:46:44 2012 (r240965) @@ -143,6 +143,13 @@ struct ISCI_INTERRUPT_INFO }; +struct ISCI_LED +{ + struct cdev *cdev; + SCI_CONTROLLER_HANDLE_T handle; + int index; +}; + struct ISCI_CONTROLLER { struct isci_softc *isci; @@ -169,6 +176,7 @@ struct ISCI_CONTROLLER uint32_t queue_depth; uint32_t sim_queue_depth; SCI_FAST_LIST_T pending_device_reset_list; + struct ISCI_LED led[SCI_MAX_PHYS]; SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl; Modified: head/sys/dev/isci/isci_controller.c ============================================================================== --- head/sys/dev/isci/isci_controller.c Wed Sep 26 14:29:15 2012 (r240964) +++ head/sys/dev/isci/isci_controller.c Wed Sep 26 16:46:44 2012 (r240965) @@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$"); #include <dev/isci/scil/scif_remote_device.h> #include <dev/isci/scil/scif_domain.h> #include <dev/isci/scil/scif_user_callback.h> +#include <dev/isci/scil/scic_sgpio.h> + +#include <dev/led/led.h> void isci_action(struct cam_sim *sim, union ccb *ccb); void isci_poll(struct cam_sim *sim); @@ -271,10 +274,19 @@ void isci_controller_construct(struct IS sci_pool_initialize(controller->unmap_buffer_pool); } +static void isci_led_func(void *priv, int onoff) +{ + struct ISCI_LED *led = priv; + + /* map onoff to the locate LED */ + scic_sgpio_update_led_state(led->handle, 1 << led->index, 0, onoff, 0); +} + SCI_STATUS isci_controller_initialize(struct ISCI_CONTROLLER *controller) { SCIC_USER_PARAMETERS_T scic_user_parameters; SCI_CONTROLLER_HANDLE_T scic_controller_handle; + char led_name[64]; unsigned long tunable; int i; @@ -355,6 +367,15 @@ SCI_STATUS isci_controller_initialize(st xpt_freeze_simq(controller->sim, 1); mtx_unlock(&controller->lock); + for (i = 0; i < SCI_MAX_PHYS; i++) { + controller->led[i].handle = scic_controller_handle; + controller->led[i].index = i; + sprintf(led_name, "isci.bus%d.port%d.locate", + controller->index, i); + controller->led[i].cdev = led_create(isci_led_func, + &controller->led[i], led_name); + } + return (scif_controller_initialize(controller->scif_controller_handle)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209261646.q8QGkiK2058868>