1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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
This commit is contained in:
Jim Harris 2012-09-26 16:46:44 +00:00
parent b04e4c122b
commit 37274fc04c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240965
3 changed files with 37 additions and 1 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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 ISCI_CONTROLLER *controller,
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(struct ISCI_CONTROLLER *controller)
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));
}