Date: Wed, 26 Sep 2012 11:37:59 +0200 From: "Paul Maulberger" <Paul.Maulberger@gmx.de> To: Jim Harris <jimharris@freebsd.org> Cc: freebsd-scsi@freebsd.org Subject: Re: Intel C600 SAS Controller + locate LED (SGPIO) Message-ID: <20120926093759.299750@gmx.net> In-Reply-To: <CAJP=Hc__5sCNOxtHETMtJv70FPDi-8SoC6=ZQnYxKp-m9PuR%2Bw@mail.gmail.com> References: <20120923140816.144270@gmx.net> <CAJP=Hc__5sCNOxtHETMtJv70FPDi-8SoC6=ZQnYxKp-m9PuR%2Bw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi Jim, your patch is working very well. Thanks a lot! To support the locate and the fault led I extended your patch a little bit. Like the ahci driver every port has now a locate and a fault led device. # ls -al /dev/led total 1 dr-xr-xr-x 2 root wheel 512 Sep 26 08:39 . dr-xr-xr-x 11 root wheel 512 Sep 26 10:39 .. crw------- 1 root wheel 0, 47 Sep 26 08:43 ahcich0.fault crw------- 1 root wheel 0, 46 Sep 26 08:44 ahcich0.locate crw------- 1 root wheel 0, 49 Sep 26 08:39 ahcich1.fault crw------- 1 root wheel 0, 48 Sep 26 08:39 ahcich1.locate crw------- 1 root wheel 0, 51 Sep 26 08:39 ahcich2.fault crw------- 1 root wheel 0, 50 Sep 26 08:39 ahcich2.locate crw------- 1 root wheel 0, 53 Sep 26 08:39 ahcich3.fault crw------- 1 root wheel 0, 52 Sep 26 08:39 ahcich3.locate crw------- 1 root wheel 0, 55 Sep 26 08:39 ahcich4.fault crw------- 1 root wheel 0, 54 Sep 26 08:39 ahcich4.locate crw------- 1 root wheel 0, 57 Sep 26 08:44 ahcich5.fault crw------- 1 root wheel 0, 56 Sep 26 08:44 ahcich5.locate crw------- 1 root wheel 0, 36 Sep 26 08:39 igb0 crw------- 1 root wheel 0, 37 Sep 26 08:39 igb1 crw------- 1 root wheel 0, 38 Sep 26 08:39 isci.bus0.port0.fault crw------- 1 root wheel 0, 39 Sep 26 08:39 isci.bus0.port0.locate crw------- 1 root wheel 0, 40 Sep 26 08:42 isci.bus0.port1.fault crw------- 1 root wheel 0, 41 Sep 26 08:42 isci.bus0.port1.locate crw------- 1 root wheel 0, 42 Sep 26 08:39 isci.bus0.port2.fault crw------- 1 root wheel 0, 43 Sep 26 08:39 isci.bus0.port2.locate crw------- 1 root wheel 0, 44 Sep 26 08:39 isci.bus0.port3.fault crw------- 1 root wheel 0, 45 Sep 26 08:39 isci.bus0.port3.locate By the way the main board X9DRi-F has only one bus. The X9DR3-F has 2 buses. The patch (compared to 9.1 RC1) is attached. Is it possible to commit this patch into 9.1 or is it too late? Regards Paul Hint: If anybody is using a SC825TQ chassis and no led is blinking check ALL jumper settings of your backplane (Appendix C of http://www.supermicro.com/manuals/chassis/2U/SC825.pdf). Our backplane was wrongly configured by factory (mixture of sgpio and i2c settings). -------- Original-Nachricht -------- > Datum: Mon, 24 Sep 2012 18:01:34 -0700 > Von: Jim Harris <jimharris@freebsd.org> > An: Paul Maulberger <Paul.Maulberger@gmx.de> > CC: freebsd-scsi@freebsd.org > Betreff: Re: Intel C600 SAS Controller + locate LED (SGPIO) > On Sun, Sep 23, 2012 at 7:08 AM, Paul Maulberger <Paul.Maulberger@gmx.de> > wrote: > > Hi Folks, > > > > I like to manipulate the eight locate LED's of my internal enclosure. > The following hardware is used: > > > > Mainboard: Supermicro X9DRi-F > > http://www.supermicro.com/products/motherboard/xeon/c600/x9dri-f.cfm > > > > Chassis: SC825TQ-R740LPB > > http://www.supermicro.com/products/chassis/2U/825/SC825TQ-R740LP.cfm > > > > Cable from Intel C602 SAS controller to backplane: > > SFF-8087 to 4xSATA cable with 8-pin SGPIO connector > > > > The backplane of the chassis has the MagaRAC MG9072 chip from AMI and is > configured for SGPIO. > > > > I'm using FreeBSD 9.1 RC1. > > > > FreeBSD has a led driver to manipulate LED's: > > http://www.freebsd.org/cgi/man.cgi?query=led > > > > # ls -al /dev/led > > total 1 > > dr-xr-xr-x 2 root wheel 512 Sep 23 09:42 . > > dr-xr-xr-x 10 root wheel 512 Sep 23 09:42 .. > > crw------- 1 root wheel 0, 40 Sep 23 09:42 ahcich0.fault > > crw------- 1 root wheel 0, 39 Sep 23 09:42 ahcich0.locate > > crw------- 1 root wheel 0, 42 Sep 23 09:42 ahcich1.fault > > crw------- 1 root wheel 0, 41 Sep 23 09:42 ahcich1.locate > > crw------- 1 root wheel 0, 44 Sep 23 09:42 ahcich2.fault > > crw------- 1 root wheel 0, 43 Sep 23 09:42 ahcich2.locate > > crw------- 1 root wheel 0, 46 Sep 23 09:42 ahcich3.fault > > crw------- 1 root wheel 0, 45 Sep 23 09:42 ahcich3.locate > > crw------- 1 root wheel 0, 48 Sep 23 09:42 ahcich4.fault > > crw------- 1 root wheel 0, 47 Sep 23 09:42 ahcich4.locate > > crw------- 1 root wheel 0, 50 Sep 23 09:42 ahcich5.fault > > crw------- 1 root wheel 0, 49 Sep 23 09:42 ahcich5.locate > > crw------- 1 root wheel 0, 37 Sep 23 09:42 igb0 > > crw------- 1 root wheel 0, 38 Sep 23 09:42 igb1 > > > > Unfortunately there are no "C600" led devices. > > > > I found the functions 'scic_sgpio_*' in the file > 'sys/dev/isci/scil/scic_sgpio.h'. The function 'scic_sgpio_hardware_initialize' is called in the > file 'sys/dev/isci/scil/scic_sds_controller.c'. Although there is no call to > 'scic_sgpio_set_led_state' or 'scic_sgpio_update_led_state' in the whole > sources (/usr/src). > > > > Can somebody give me a hint how to manipulate the LED's? > > There's no way to manipulate the LEDs on the system as you have it. > LED support is not in the current isci driver. But can you try this > patch? > > http://people.freebsd.org/~jimharris/isci_led.patch > > The LEDs will show up as /dev/led/isci.busX.portY. On C60x SKUs with > 8 isci ports (which I think yours has), the isci driver will create 2 > buses of 4 ports each (to match the underlying silicon > implementation), hence the need to use bus and port numbers in the > name, rather than just port. > > Regards, > > -Jim > > > > Regards > > Paul > > _______________________________________________ > > freebsd-scsi@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-scsi > > To unsubscribe, send any mail to "freebsd-scsi-unsubscribe@freebsd.org" > _______________________________________________ > freebsd-scsi@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-scsi > To unsubscribe, send any mail to "freebsd-scsi-unsubscribe@freebsd.org" [-- Attachment #2 --] --- /usr/src/sys/dev/isci/isci.h.91rc1 2012-09-25 06:51:22.000000000 +0200 +++ /usr/src/sys/dev/isci/isci.h 2012-09-26 09:02:10.000000000 +0200 @@ -143,6 +143,13 @@ }; +struct ISCI_LED +{ + struct cdev *cdev; + SCI_CONTROLLER_HANDLE_T handle; + int index; +}; + struct ISCI_CONTROLLER { struct isci_softc *isci; @@ -169,6 +176,8 @@ uint32_t queue_depth; uint32_t sim_queue_depth; SCI_FAST_LIST_T pending_device_reset_list; + struct ISCI_LED led_fault[SCI_MAX_PHYS]; + struct ISCI_LED led_locate[SCI_MAX_PHYS]; SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl; --- /usr/src/sys/dev/isci/isci.c.91rc1 2012-09-26 10:57:47.000000000 +0200 +++ /usr/src/sys/dev/isci/isci.c 2012-09-26 09:04:32.000000000 +0200 @@ -37,12 +37,14 @@ #include <sys/malloc.h> #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 +182,7 @@ 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]; @@ -218,6 +220,16 @@ if (controller->remote_device_memory != NULL) free(controller->remote_device_memory, M_ISCI); + + /* destroy led devices */ + for (phy = 0; phy < SCI_MAX_PHYS; phy++) + { + if (controller->led_fault[phy].cdev) + led_destroy(controller->led_fault[phy].cdev); + + if (controller->led_locate[phy].cdev) + led_destroy(controller->led_locate[phy].cdev); + } } /* The SCIF controllers have been stopped, so we can now --- /usr/src/sys/dev/isci/isci_controller.c.91rc1 2012-09-25 06:52:08.000000000 +0200 +++ /usr/src/sys/dev/isci/isci_controller.c 2012-09-26 10:54:05.000000000 +0200 @@ -49,6 +49,9 @@ #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); @@ -230,10 +233,27 @@ } } +static void isci_led_fault_func(void *priv, int onoff) +{ + struct ISCI_LED *led = priv; + + /* map onoff to the fault LED */ + scic_sgpio_update_led_state(led->handle, 1 << led->index, onoff, 0, 0); +} + +static void isci_led_locate_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; @@ -313,6 +333,24 @@ isci_controller_attach_to_cam(controller); xpt_freeze_simq(controller->sim, 1); mtx_unlock(&controller->lock); + + /* create led devices */ + for (i = 0; i < SCI_MAX_PHYS; i++) + { + /* fault */ + controller->led_fault[i].handle = scic_controller_handle; + controller->led_fault[i].index = i; + sprintf(led_name, "isci.bus%d.port%d.fault", controller->index, i); + controller->led_fault[i].cdev = led_create(isci_led_fault_func, + &controller->led_fault[i], led_name); + + /* locate */ + controller->led_locate[i].handle = scic_controller_handle; + controller->led_locate[i].index = i; + sprintf(led_name, "isci.bus%d.port%d.locate", controller->index, i); + controller->led_locate[i].cdev = led_create(isci_led_locate_func, + &controller->led_locate[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?20120926093759.299750>
