From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 16:46:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B8BC7106564A; Wed, 26 Sep 2012 16:46:44 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A39D28FC14; Wed, 26 Sep 2012 16:46:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QGki6J058872; Wed, 26 Sep 2012 16:46:44 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QGkiK2058868; Wed, 26 Sep 2012 16:46:44 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201209261646.q8QGkiK2058868@svn.freebsd.org> From: Jim Harris Date: Wed, 26 Sep 2012 16:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240965 - head/sys/dev/isci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 16:46:44 -0000 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 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 +#include + #include #include #include #include +#include #include #include @@ -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 #include #include +#include + +#include 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)); }