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)
This commit is contained in:
parent
33a3526a8c
commit
ff4e573db6
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user