Re: svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Andriy Gapon
On 04/09/2019 16:50, Alan Somers wrote:
> On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  > wrote:
> 
> Author: avg
> Date: Wed Sep  4 13:47:38 2019
> New Revision: 351812
> URL: https://svnweb.freebsd.org/changeset/base/351812
> 
> Log:
>   mpsutil slot set status
> 
>   This code has been written as a proof of concept, but I think that it
>   can be useful in general.  It allows to set the status of an enclosure
>   slot.  Practically, this means controlling whatever slot status LEDs the
>   enclosure provides.  At present, the new command does not have sanity
>   checks or any conveniences.  That means that it is possible to issue the
>   command for an invalid slot and an enclosure.  But the worst I have seen
>   happening is either the command failing or simply being ignored.  Also,
>   at the moment, the status has to be specified as a numeric bit mask.
>   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
>   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
>   slot is by the enclosure handle and the slot number.  Both are readily
>   available from mpsutil show commands.
> 
>   So, future enhancements could include alternative ways to address a slot
>   (e.g., by a disk handle or a disk device name) and human friendly names
>   for slot statuses.
> 
>   The new command is useful alternative to 'sas2ircu locate' command.
>   First, sas2ircu is a proprietary blob.  Second, it supports setting only
>   locate / identify status bit.
> 
>   Tested on HP H220 running LSI IT firmware 20.x.
> 
>   Reviewed by:  bapt
>   MFC after:    3 weeks
>   Differential Revision:        https://reviews.freebsd.org/D20535
> 
> Added:
>   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> Modified:
>   head/usr.sbin/mpsutil/Makefile
>   head/usr.sbin/mpsutil/mps_cmd.c
>   head/usr.sbin/mpsutil/mpsutil.h
> 
> 
> Is this redundant with sesutil, or does it work on different kinds of 
> enclosures? 

This is for controllers that do not expose a SES device for a directly attached
(no expanders in between) backplane that does not have a built-in expander of
its own.

Here is some information for a context.

I have a configuration with a SAS2308 based HBA that's flashed with LSI IT
firmware version 20.00.07.00.  I think that the HBA does not support IR firmware
as it is very simple and it seems to lack NVSRAM (whatever it is).
The controller is attached to a Supermicro 743TQ backplane that's built into a
namesake chassis. The attachment is via a fan-out cable that connects one
mini-SAS (SFF-8087) port on the controller to four individual SAS/SATA ports on
the backplane plus a sideband connector that's attached to the backplane as
well.  The backplane supports two modes of operation for the sideband
connection, I2C and SGPIO.  But it seems that the controller or its firmware
supports only SGPIO.  Maybe I2C communication was considered to be an overkill
for the IT mode.  In any case, the controller does not fake a SES device for the
enclosure, so it's not available for tools like sesutil, etc.  The controller
specific tools like mpsutil and sas2ircu do see the enclosure.

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Andriy Gapon
On 04/09/2019 17:21, Allan Jude wrote:
> mpsutil's method will work on direct-attach backplanes and enclosures,
> where sesutil only works if there is an expander that provides the SES
> service.

I think that theoretically a controller (its firmware) can emulate a SES device
for a directly attached enclosure (that does not have a built-in expander too).
I believe that some controllers actually do that.  But maybe I am wrong.
And even if I am not, not all controllers do that.


-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Alan Somers
On Wed, Sep 4, 2019 at 8:21 AM Allan Jude  wrote:

> On 2019-09-04 09:50, Alan Somers wrote:
> > On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  > > wrote:
> >
> > Author: avg
> > Date: Wed Sep  4 13:47:38 2019
> > New Revision: 351812
> > URL: https://svnweb.freebsd.org/changeset/base/351812
> >
> > Log:
> >   mpsutil slot set status
> >
> >   This code has been written as a proof of concept, but I think that
> it
> >   can be useful in general.  It allows to set the status of an
> enclosure
> >   slot.  Practically, this means controlling whatever slot status
> > LEDs the
> >   enclosure provides.  At present, the new command does not have
> sanity
> >   checks or any conveniences.  That means that it is possible to
> > issue the
> >   command for an invalid slot and an enclosure.  But the worst I
> > have seen
> >   happening is either the command failing or simply being ignored.
> > Also,
> >   at the moment, the status has to be specified as a numeric bit
> mask.
> >   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h,
> they
> >   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to
> address a
> >   slot is by the enclosure handle and the slot number.  Both are
> readily
> >   available from mpsutil show commands.
> >
> >   So, future enhancements could include alternative ways to address
> > a slot
> >   (e.g., by a disk handle or a disk device name) and human friendly
> > names
> >   for slot statuses.
> >
> >   The new command is useful alternative to 'sas2ircu locate' command.
> >   First, sas2ircu is a proprietary blob.  Second, it supports
> > setting only
> >   locate / identify status bit.
> >
> >   Tested on HP H220 running LSI IT firmware 20.x.
> >
> >   Reviewed by:  bapt
> >   MFC after:3 weeks
> >   Differential Revision:https://reviews.freebsd.org/D20535
> >
> > Added:
> >   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> > Modified:
> >   head/usr.sbin/mpsutil/Makefile
> >   head/usr.sbin/mpsutil/mps_cmd.c
> >   head/usr.sbin/mpsutil/mpsutil.h
> >
> >
> > Is this redundant with sesutil, or does it work on different kinds of
> > enclosures?
>
> mpsutil's method will work on direct-attach backplanes and enclosures,
> where sesutil only works if there is an expander that provides the SES
> service.
>
> --
> Allan Jude
>

By direct-attach, do you mean SGPIO, or is there some kind of backplane
where the HDD itself controls the LEDs?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Allan Jude
On 2019-09-04 09:50, Alan Somers wrote:
> On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  > wrote:
> 
> Author: avg
> Date: Wed Sep  4 13:47:38 2019
> New Revision: 351812
> URL: https://svnweb.freebsd.org/changeset/base/351812
> 
> Log:
>   mpsutil slot set status
> 
>   This code has been written as a proof of concept, but I think that it
>   can be useful in general.  It allows to set the status of an enclosure
>   slot.  Practically, this means controlling whatever slot status
> LEDs the
>   enclosure provides.  At present, the new command does not have sanity
>   checks or any conveniences.  That means that it is possible to
> issue the
>   command for an invalid slot and an enclosure.  But the worst I
> have seen
>   happening is either the command failing or simply being ignored. 
> Also,
>   at the moment, the status has to be specified as a numeric bit mask.
>   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
>   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
>   slot is by the enclosure handle and the slot number.  Both are readily
>   available from mpsutil show commands.
> 
>   So, future enhancements could include alternative ways to address
> a slot
>   (e.g., by a disk handle or a disk device name) and human friendly
> names
>   for slot statuses.
> 
>   The new command is useful alternative to 'sas2ircu locate' command.
>   First, sas2ircu is a proprietary blob.  Second, it supports
> setting only
>   locate / identify status bit.
> 
>   Tested on HP H220 running LSI IT firmware 20.x.
> 
>   Reviewed by:  bapt
>   MFC after:    3 weeks
>   Differential Revision:        https://reviews.freebsd.org/D20535
> 
> Added:
>   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> Modified:
>   head/usr.sbin/mpsutil/Makefile
>   head/usr.sbin/mpsutil/mps_cmd.c
>   head/usr.sbin/mpsutil/mpsutil.h
> 
> 
> Is this redundant with sesutil, or does it work on different kinds of
> enclosures? 

mpsutil's method will work on direct-attach backplanes and enclosures,
where sesutil only works if there is an expander that provides the SES
service.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Alan Somers
On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  wrote:

> Author: avg
> Date: Wed Sep  4 13:47:38 2019
> New Revision: 351812
> URL: https://svnweb.freebsd.org/changeset/base/351812
>
> Log:
>   mpsutil slot set status
>
>   This code has been written as a proof of concept, but I think that it
>   can be useful in general.  It allows to set the status of an enclosure
>   slot.  Practically, this means controlling whatever slot status LEDs the
>   enclosure provides.  At present, the new command does not have sanity
>   checks or any conveniences.  That means that it is possible to issue the
>   command for an invalid slot and an enclosure.  But the worst I have seen
>   happening is either the command failing or simply being ignored.  Also,
>   at the moment, the status has to be specified as a numeric bit mask.
>   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
>   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
>   slot is by the enclosure handle and the slot number.  Both are readily
>   available from mpsutil show commands.
>
>   So, future enhancements could include alternative ways to address a slot
>   (e.g., by a disk handle or a disk device name) and human friendly names
>   for slot statuses.
>
>   The new command is useful alternative to 'sas2ircu locate' command.
>   First, sas2ircu is a proprietary blob.  Second, it supports setting only
>   locate / identify status bit.
>
>   Tested on HP H220 running LSI IT firmware 20.x.
>
>   Reviewed by:  bapt
>   MFC after:3 weeks
>   Differential Revision:https://reviews.freebsd.org/D20535
>
> Added:
>   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> Modified:
>   head/usr.sbin/mpsutil/Makefile
>   head/usr.sbin/mpsutil/mps_cmd.c
>   head/usr.sbin/mpsutil/mpsutil.h
>

Is this redundant with sesutil, or does it work on different kinds of
enclosures?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Andriy Gapon
Author: avg
Date: Wed Sep  4 13:47:38 2019
New Revision: 351812
URL: https://svnweb.freebsd.org/changeset/base/351812

Log:
  mpsutil slot set status
  
  This code has been written as a proof of concept, but I think that it
  can be useful in general.  It allows to set the status of an enclosure
  slot.  Practically, this means controlling whatever slot status LEDs the
  enclosure provides.  At present, the new command does not have sanity
  checks or any conveniences.  That means that it is possible to issue the
  command for an invalid slot and an enclosure.  But the worst I have seen
  happening is either the command failing or simply being ignored.  Also,
  at the moment, the status has to be specified as a numeric bit mask.
  The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
  are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
  slot is by the enclosure handle and the slot number.  Both are readily
  available from mpsutil show commands.
  
  So, future enhancements could include alternative ways to address a slot
  (e.g., by a disk handle or a disk device name) and human friendly names
  for slot statuses.
  
  The new command is useful alternative to 'sas2ircu locate' command.
  First, sas2ircu is a proprietary blob.  Second, it supports setting only
  locate / identify status bit.
  
  Tested on HP H220 running LSI IT firmware 20.x.
  
  Reviewed by:  bapt
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D20535

Added:
  head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
Modified:
  head/usr.sbin/mpsutil/Makefile
  head/usr.sbin/mpsutil/mps_cmd.c
  head/usr.sbin/mpsutil/mpsutil.h

Modified: head/usr.sbin/mpsutil/Makefile
==
--- head/usr.sbin/mpsutil/Makefile  Wed Sep  4 13:44:46 2019
(r351811)
+++ head/usr.sbin/mpsutil/Makefile  Wed Sep  4 13:47:38 2019
(r351812)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PROG=  mpsutil
-SRCS=  mps_cmd.c mps_debug.c mps_flash.c mps_show.c mpsutil.c
+SRCS=  mps_cmd.c mps_debug.c mps_flash.c mps_show.c mps_slot.c mpsutil.c
 MAN=   mpsutil.8
 
 WARNS?= 3

Modified: head/usr.sbin/mpsutil/mps_cmd.c
==
--- head/usr.sbin/mpsutil/mps_cmd.c Wed Sep  4 13:44:46 2019
(r351811)
+++ head/usr.sbin/mpsutil/mps_cmd.c Wed Sep  4 13:47:38 2019
(r351812)
@@ -283,6 +283,29 @@ mps_map_btdh(int fd, uint16_t *devhandle, uint16_t *bu
 }
 
 int
+mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status)
+{
+   MPI2_SEP_REQUEST req;
+   MPI2_SEP_REPLY reply;
+
+   bzero(, sizeof(req));
+   req.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
+   req.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS;
+   req.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
+   req.EnclosureHandle = handle;
+   req.Slot = slot;
+   req.SlotStatus = status;
+
+   if (mps_pass_command(fd, , sizeof(req), , sizeof(reply),
+   NULL, 0, NULL, 0, 30) != 0)
+   return (errno);
+
+   if (!IOC_STATUS_SUCCESS(reply.IOCStatus))
+   return (EIO);
+   return (0);
+}
+
+int
 mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 
PageAddress,
 MPI2_CONFIG_PAGE_HEADER *header, U16 *IOCStatus)
 {

Added: head/usr.sbin/mpsutil/mps_slot.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/mpsutil/mps_slot.cWed Sep  4 13:47:38 2019
(r351812)
@@ -0,0 +1,114 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Andriy Gapon 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+