summaryrefslogtreecommitdiffstats
path: root/sys/dev/isci
diff options
context:
space:
mode:
authorjimharris <jimharris@FreeBSD.org>2012-10-10 18:01:56 +0000
committerjimharris <jimharris@FreeBSD.org>2012-10-10 18:01:56 +0000
commitff4e573db66b9029ee9511d02936b28007c14675 (patch)
treefe028dce0b12591ef8e9abdbdd533bc09b1cbb8d /sys/dev/isci
parent33a3526a8ca99f30cbe9b0681c798346b920c6c1 (diff)
downloadFreeBSD-src-ff4e573db66b9029ee9511d02936b28007c14675.zip
FreeBSD-src-ff4e573db66b9029ee9511d02936b28007c14675.tar.gz
Add support for locate LED.
While here, change ISCI_LED to ISCI_PHY since conceptually the hardware ties the LEDs to a phy and the LEDs for a given phy cannot be controlled independently. Submitted by: Paul Maulberger <Paul.Maulberger at gmx.de> (with modifications)
Diffstat (limited to 'sys/dev/isci')
-rw-r--r--sys/dev/isci/isci.c10
-rw-r--r--sys/dev/isci/isci.h9
-rw-r--r--sys/dev/isci/isci_controller.c38
3 files changed, 42 insertions, 15 deletions
diff --git a/sys/dev/isci/isci.c b/sys/dev/isci/isci.c
index 0d4ae44..cd20ba1 100644
--- a/sys/dev/isci/isci.c
+++ b/sys/dev/isci/isci.c
@@ -223,9 +223,13 @@ 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);
+ for (phy = 0; phy < SCI_MAX_PHYS; phy++) {
+ if (controller->phys[phy].cdev_fault)
+ led_destroy(controller->phys[phy].cdev_fault);
+
+ if (controller->phys[phy].cdev_locate)
+ led_destroy(controller->phys[phy].cdev_locate);
+ }
while (1) {
sci_pool_get(controller->unmap_buffer_pool, unmap_buffer);
diff --git a/sys/dev/isci/isci.h b/sys/dev/isci/isci.h
index 006d33a..1dc8e93 100644
--- a/sys/dev/isci/isci.h
+++ b/sys/dev/isci/isci.h
@@ -143,11 +143,14 @@ struct ISCI_INTERRUPT_INFO
};
-struct ISCI_LED
+struct ISCI_PHY
{
- struct cdev *cdev;
+ struct cdev *cdev_fault;
+ struct cdev *cdev_locate;
SCI_CONTROLLER_HANDLE_T handle;
int index;
+ int led_fault;
+ int led_locate;
};
struct ISCI_CONTROLLER
@@ -176,7 +179,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];
+ struct ISCI_PHY phys[SCI_MAX_PHYS];
SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl;
diff --git a/sys/dev/isci/isci_controller.c b/sys/dev/isci/isci_controller.c
index 2b112b2..32a3394 100644
--- a/sys/dev/isci/isci_controller.c
+++ b/sys/dev/isci/isci_controller.c
@@ -274,12 +274,24 @@ void isci_controller_construct(struct ISCI_CONTROLLER *controller,
sci_pool_initialize(controller->unmap_buffer_pool);
}
-static void isci_led_func(void *priv, int onoff)
+static void isci_led_fault_func(void *priv, int onoff)
{
- struct ISCI_LED *led = priv;
+ struct ISCI_PHY *phy = priv;
+
+ /* map onoff to the fault LED */
+ phy->led_fault = onoff;
+ scic_sgpio_update_led_state(phy->handle, 1 << phy->index,
+ phy->led_fault, phy->led_locate, 0);
+}
+
+static void isci_led_locate_func(void *priv, int onoff)
+{
+ struct ISCI_PHY *phy = priv;
/* map onoff to the locate LED */
- scic_sgpio_update_led_state(led->handle, 1 << led->index, 0, onoff, 0);
+ phy->led_locate = onoff;
+ scic_sgpio_update_led_state(phy->handle, 1 << phy->index,
+ phy->led_fault, phy->led_locate, 0);
}
SCI_STATUS isci_controller_initialize(struct ISCI_CONTROLLER *controller)
@@ -368,12 +380,20 @@ SCI_STATUS isci_controller_initialize(struct ISCI_CONTROLLER *controller)
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);
+ controller->phys[i].handle = scic_controller_handle;
+ controller->phys[i].index = i;
+
+ /* fault */
+ controller->phys[i].led_fault = 0;
+ sprintf(led_name, "isci.bus%d.port%d.fault", controller->index, i);
+ controller->phys[i].cdev_fault = led_create(isci_led_fault_func,
+ &controller->phys[i], led_name);
+
+ /* locate */
+ controller->phys[i].led_locate = 0;
+ sprintf(led_name, "isci.bus%d.port%d.locate", controller->index, i);
+ controller->phys[i].cdev_locate = led_create(isci_led_locate_func,
+ &controller->phys[i], led_name);
}
return (scif_controller_initialize(controller->scif_controller_handle));
OpenPOWER on IntegriCloud