Commit Graph

45 Commits

Author SHA1 Message Date
Alexander Motin
bce02a0ea4 mpsutil: Fix device speed reporting.
Report controller SAS phy speed only for directly attached devices.
For others try to read and report parent expander phy speed.

MFC after:	1 week
2022-05-09 18:03:24 -04:00
Alexander Motin
53c184cf06 mpsutil: fix set but not used warning
MFC after:	1 week
2022-05-09 18:03:24 -04:00
Scott Long
638e2a132e Fix formatting of the usage() output 2022-01-06 22:59:18 -07:00
Alexander Motin
f5b0083302 mpsutil: Fix data truncation by too short buffers.
Length of some string buffers was insufficient for cases of more that
99 targets per HBA or slots per enclosure.  Some others are tuned just
for better alignment.  While there also fix output formatting issues.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2021-11-29 20:20:03 -05:00
Daniel Austin
e2ea6942ab mpsutil: extend show adapter information, add NCQ control
'show adapter' now shows PCIe width and speed, IOC Speed, and the
temperature of the controller.

A new command, 'set ncq', is added.
It enables or disables SATA NCQ in the NVRAM of the card.
Its current setting is added to 'show adapter' as well.

PR:		254841
MFC after:	2 weeks
Relnotes:	perhaps
2021-05-07 15:22:22 +03:00
Alfredo Dal'Ava Junior
fc9780fd41 mprutil: add big endian support
This fix mprutil on big endian platforms, as follow up of D25785.

Flash operations are still not working, such as MPI2_FUNCTION_FW_UPLOAD
failing due to timeout.

Firmware version used during tests: 16.00.01.00

Submitted by:	Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by:	luporl, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by e-mail)
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26040
2021-04-20 19:19:47 -03:00
Alan Somers
f073ab8712 mpsutil.8: fix typos in the man page
MFC after:	2 weeks
Sponsored by:	Axcient
2021-03-25 08:43:40 -06:00
Gordon Bergling
84572415b4 mpsutil(8): Remove trailing whitespace
MFC after:	1 week
2020-12-19 13:23:26 +00:00
Juli Mallett
e9de7669c3 Improve unit parsing of mpsutil.
Previously, it used atoi(3) to parse the unit parameter, which would silently
yield a unit of 0 in the presence of an invalid unit number.  As most users of
mpsutil(8) are likely to have at least a unit 0, this is could have confusing
results.

This behaviour was particularly unintuitive if one incorrectly passed an
adapter device name, or a device path, instead of a unit number.  In addition
to using strtoumax(3) instead of atoi(3) to parse unit numbers, support
stripping a device name (e.g. mps1) or path (e.g. /dev/mps2) to just its unit
number.

Reviewed by:	scottl (earlier version)
2020-06-16 19:21:28 +00:00
Scott Long
3859e5c3c6 Add support for some IOCFacts fields that are available with mpr (12Gb)
controllers.  It's ugly due to the single codebase for mpr and mps and
not being able to share their respective headers.
2020-04-16 04:17:06 +00:00
Scott Long
39e2d6bc38 Don't keep a private copy of mpr_ioctl.h and mps_ioctl.h, since they
easily get out of sync with the real files from the driver.
2020-04-16 03:33:46 +00:00
Scott Long
69e85eb8ae Advertise the MPI Message Version that's contained in the IOCFacts message
in the sysctl block for the driver.  mpsutil/mprutil needs this so it can
know how big of a buffer to allocate when requesting the IOCFacts from the
controller.  This eliminates the kernel console messages about wrong
allocation sizes.

Reported by:	imp
2020-02-07 12:15:39 +00:00
Scott Long
b041593ae7 Touch up some of the iocfacts fields 2020-02-07 11:48:26 +00:00
Andriy Gapon
c2a13d6f24 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
2019-09-04 13:47:38 +00:00
Alexander Motin
b627cd1c20 Pass data pointers to the driver in way in expects.
Probably due to historical reasons the driver uses In/Out arguments in
odd way.  While this tool still never uses Out arguments to see that,
make the code to not trigger EINVAL in possible future uses.

MFC after:	2 weeks
2019-05-30 15:07:39 +00:00
Warner Losh
52467047aa Regularize the Netflix copyright
Use recent best practices for Copyright form at the top of
the license:
1. Remove all the All Rights Reserved clauses on our stuff. Where we
   piggybacked others, use a separate line to make things clear.
2. Use "Netflix, Inc." everywhere.
3. Use a single line for the copyright for grep friendliness.
4. Use date ranges in all places for our stuff.

Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files)
2019-02-04 21:28:25 +00:00
Eitan Adler
c739854c38 mpsutil: correct style
Reported by:	bapt
2018-05-23 09:46:21 +00:00
Eitan Adler
9059c77ef2 mpsutil: add missing braces
Obtained from:	DragonFly (c5d53f11a9510c5c79e196857a1200925fffacc8)
2018-05-23 07:38:58 +00:00
Scott Long
b3995bb872 Add a new 'debug' command tree and 'dump_reqs' command to grab and parse
command and chain frames of in-flight I/O from the driver.

Sponsored by:	Netflix
2018-03-12 05:03:32 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Scott Long
99cc4d5177 Fix some broken logic used in obtaining the certain config pages. I'm
surprised that this even pretended to work.

PR:		215793
Submitted by:	longwitz@incore.de
2017-07-27 05:31:48 +00:00
Scott Long
e8262ee824 Show more fields in the IOCFact message 2017-05-05 17:01:54 +00:00
Pedro F. Giffuni
4b6fa244b2 mpsutil(8): let calloc(3) do the multiplying. 2017-03-13 20:49:31 +00:00
Enji Cooper
64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +00:00
Baptiste Daroussin
0ce8c4a33c Plug various resources leak
While here fix a test logic

Reported by:	coverity
CID:		1332096, 1332097, 1332098, 1332099, 1332100, 1332101, 1332102
MFC after:	1 week
2016-04-20 21:32:34 +00:00
Baptiste Daroussin
4ecb514126 Plug leaks
Reported by:	Coverity
CID:		1340155 and 1340156
MFC after:	1 week
2016-04-20 21:11:49 +00:00
Ulrich Spörlein
c9e1c304c1 Fix type mismatches for malloc(3) and Co.
This is rather pedantic, as for most architectures it holds that
sizeof(type *) == sizeof(type **)

Found by:	clang static analyzer
Reviewed by:	ed
Differential Revision: https://reviews.freebsd.org/D4722
2015-12-29 11:24:41 +00:00
Baptiste Daroussin
3e8918911e mpsutil/mprutil: add flash subcommand
the flash subcommand allows to save/update firmware and bios for LSI Fusion-MPT
2/3 controllers (mps(4) and mpr(4))

Tested by:	allanjude
Reviewed by:	wblock (manpage)
Relnotes:	yes
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D4026
2015-11-17 20:42:59 +00:00
Bryan Drewery
e6b0222d60 Include libutil's headers directly from src to avoid recording a dirdeps
dependency for META MODE.
2015-10-28 16:31:04 +00:00
Bryan Drewery
985dfe52e9 Connect mpsutil for META MODE. 2015-10-28 16:22:00 +00:00
Baptiste Daroussin
4080404605 Fix a typo in the comment about the include guard
Sponsored by:	Gandi.net
2015-10-28 11:29:58 +00:00
Baptiste Daroussin
08a1f267fa Remove more of the mptutil unused code
Sponsored by:	Gandi.net
2015-10-28 11:28:46 +00:00
Baptiste Daroussin
5114c60e8a Remove some unused code from the mptutil(8)
The code from mptutil living in the same source tree the day those functions
will be implemented in the mpsutil(8) it can be copy/paste easily

Sponsored by:	Gandi.net
2015-10-28 11:25:28 +00:00
Baptiste Daroussin
76103694a0 Reduce overlinking, for now neither cam nor libutil are needed
Sponsored by:	Gandi.net
2015-10-28 11:20:55 +00:00
Baptiste Daroussin
64dbc39cd3 Do enforce "-g", DEBUG_FLAGS can be user if one want to set it
Sponsored by:	Gandi.net
2015-10-28 11:18:43 +00:00
Baptiste Daroussin
04be2b8b7a Replace the manpage with one that actually describes the utility
Sponsored by:	Gandi.net
2015-10-28 11:06:04 +00:00
Scott Long
883bb7e941 Add copyright for Netflix for the files that changed from mptutil 2015-10-27 20:56:57 +00:00
Scott Long
aa307236af Remove mps_config.c, it's unused. 2015-10-27 20:56:34 +00:00
Baptiste Daroussin
c05f3be9a5 Remove the now not needed diff used to switch the tool from mps to mpr
Sponsored by:	Gandi.net
2015-10-16 09:37:15 +00:00
Baptiste Daroussin
9b51f8578a Fix some alignement in the output
Sponsored by:	Gandi.net
2015-10-15 17:16:17 +00:00
Baptiste Daroussin
5a92b27175 Add generic storage structure for both mpr and mps to simplify code
Use correct ioctl on mpr
Prevent duplication in headers between mps_ioctl.h and mpr_ioctl.h

Sponsored by:	Gandi.net
2015-10-15 15:51:40 +00:00
Baptiste Daroussin
3f4fe35d6c Correctly print the device name of the adapter
Sponsored by:	Gandi.net
2015-10-15 15:24:13 +00:00
Baptiste Daroussin
48f31f4fef Make mpsutil open the mpr devices when named mprutil
Make mprutil a hardlink to mpsutil

Sponsored by:	Gandi.net
2015-10-15 15:19:38 +00:00
Baptiste Daroussin
125c7a1e56 Fix buildworld
Sponsored by:	gandi.net
2015-08-14 10:17:52 +00:00
Scott Long
29b76e539f Iniital hack of mpsutil 2015-08-02 03:52:51 +00:00