mpt-status-1.2.0/0040755000076500007650000000000010522170626012374 5ustar ratzratzmpt-status-1.2.0/contrib/0040755000076500007650000000000010517617524014043 5ustar ratzratzmpt-status-1.2.0/contrib/mpt-status.spec0100644000076500007650000000230010451321765017024 0ustar ratzratzSummary: MPT Fusion based raid inquiry tool for LSI Logic HBAs Name: mpt-status Version: 1.2.0 Release: 0 License: GPL Group: Applications/System URL: http://www.drugphish.ch/~ratz/mpt-status/ Packager: Rich Edelman (rich.edelman@openwave.com) Vendor: OpenWave Systems Source: mpt-status-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description mpt-status requests information about raid status for LSI Logic SCSI controllers. %prep %setup %build %{__make} %install %{__rm} -rf %{buildroot} %{__install} -D -m0755 mpt-status %{buildroot}%{_sbindir}/mpt-status %clean %{__rm} -rf %{buildroot} %files %defattr(-, root, root, 0755) %doc doc/* %{_sbindir}/mpt-status %changelog * Fri Jun 30 2006 Roberto Nibali (ratz@drugphish.ch) - Changed release version * Fri Jun 30 2006 Rich Edelman (rich.edelman@openwave.com) - Upgraded to version 1.2.0-RC7 - Changed Makefile to use /lib/modules/`uname -r`/build as the KERNEL_PATH directory, instead of /usr/src/linux. This should make building this package across different distributions easier. (Patch mpt-status-fix-kernel-path.diff) * Thu Jul 14 2005 Jean-Philippe CIVADE - 1.1.3-0 - Initial package. mpt-status-1.2.0/contrib/mpt-status.spec-RH-JPC0100644000076500007650000000156010423205411017740 0ustar ratzratzSummary: MPT Fusion raid inquiry tool Name: mpt-status Version: 1.1.4 Release: 0 License: GPL Group: Applications/System URL: http://www.drugphish.ch/~ratz/mpt-status/ Packager: Jean-Philippe CIVADE (jp.civade@100p100.net) Vendor: None Source: http://www.drugphish.ch/~ratz/mpt-status/mpt-status-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description mpt-status give informations about raid status for LSI Fusion controllers. This is quite a modified version to the original mpt-status-1.0 package. %prep %setup %build %{__make} %install %{__rm} -rf %{buildroot} %{__install} -D -m0755 mpt-status %{buildroot}%{_sbindir}/mpt-status %clean %{__rm} -rf %{buildroot} %files %defattr(-, root, root, 0755) %doc doc/* %{_sbindir}/mpt-status %changelog * Thu Jul 14 2005 Jean-Philippe CIVADE - 1.1.3-0 - Initial package. mpt-status-1.2.0/contrib/mpt-status.spec-SL10.00100644000076500007650000000404310423205411017631 0ustar ratzratz# # spec file for package mpt-status (Version 1.1.5 ) # # Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # Copyright (c) 2006 Roberto Nibali. # # Please submit bugfixes or comments via http://bugs.opensuse.org # # norootforbuild # neededforbuild BuildRequires: aaa_base acl attr bash bind-utils bison bzip2 coreutils cpio cpp cracklib cvs cyrus-sasl db devs diffutils e2fsprogs file filesystem fillup findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff gzip info insserv kbd less libacl libattr libgcc libselinux libstdc++ libxcrypt m4 make man mktemp module-init-tools ncurses ncurses-devel net-tools netcfg openldap2-client openssl pam pam-modules patch permissions popt procinfo procps psmisc pwdutils rcs readline sed strace syslogd sysvinit tar tcpd texinfo timezone unzip util-linux vim zlib zlib-devel autoconf automake binutils gcc gdbm gettext libtool perl rpm Name: mpt-status License: GPL Group: Hardware/Other Autoreqprov: on Version: 1.1.5 Release: rn-1.0 Summary: program showing status of LSI RAID controllers URL: http://www.drugphish.ch/~ratz/mpt-status/ Source: %{name}-%{version}.tar.gz #Patch: %{name}-%{version}.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description This program shows status of the physical and logical drives attached to a generic LSI RAID ((mptlinux, fusion, mpt, ioc) controller. Authors: -------- Matt Braithwaite [Version <= 1.0] Roberto Nibali [Current maintainer (Version >= 1.0)] %prep %setup #%patch %build make CFLAGS="$RPM_OPT_FLAGS -o mpt_status" %install mkdir $RPM_BUILD_ROOT/usr mkdir $RPM_BUILD_ROOT/usr/sbin install -m 755 mpt-status $RPM_BUILD_ROOT%{_sbindir} %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_sbindir}/* %changelog -n mpt-status * Mon Aug 01 2005 - anicka@suse.cz - package created (#65766) mpt-status-1.2.0/contrib/mpt-status.spec-SLES90100644000076500007650000000362610423205411017661 0ustar ratzratz# # spec file for package mpt-status (Version 1.0 ) # # Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # Please submit bugfixes or comments via http://bugs.opensuse.org # # norootforbuild # neededforbuild BuildRequires: aaa_base acl attr bash bind-utils bison bzip2 coreutils cpio cpp cracklib cvs cyrus-sasl db devs diffutils e2fsprogs file filesystem fillup findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff gzip info insserv kbd less libacl libattr libgcc libselinux libstdc++ libxcrypt m4 make man mktemp module-init-tools ncurses ncurses-devel net-tools netcfg openldap2-client openssl pam pam-modules patch permissions popt procinfo procps psmisc pwdutils rcs readline sed strace syslogd sysvinit tar tcpd texinfo timezone unzip util-linux vim zlib zlib-devel autoconf automake binutils gcc gdbm gettext libtool perl rpm Name: mpt-status License: GPL Group: Hardware/Other Autoreqprov: on Version: 1.0 Release: 2.3 Summary: program showing status of LSI 1030 RAID controller URL: http://www.red-bean.com/~mab/mpt-status.html Source: %{name}-%{version}.tar.bz2 Patch: %{name}-%{version}.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description This program shows status of the physical and logical drives attached to LSI 1030 RAID ((mptlinux, fusion, mpt, ioc) controller. Authors: -------- Matt Braithwaite %prep %setup %patch %build make CFLAGS="$RPM_OPT_FLAGS -o mpt_status" %install mkdir $RPM_BUILD_ROOT/usr mkdir $RPM_BUILD_ROOT/usr/bin install -m 755 mpt-status $RPM_BUILD_ROOT%{_bindir} %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_bindir}/* %changelog -n mpt-status * Mon Aug 01 2005 - anicka@suse.cz - package created (#65766) mpt-status-1.2.0/contrib/sizes.c0100644000076500007650000000051610517617524015343 0ustar ratzratz#include #include /* This was once used to help debugging 32/64 bit issues with mpt-status. */ int main(void) { printf("int: %d\n" "char ptr: %d\n" "void ptr: %d\n" "long: %d\n" "char: %d\n", sizeof(int), sizeof(char *), sizeof(void *), sizeof(long), sizeof(char) ); exit(EXIT_SUCCESS); } mpt-status-1.2.0/doc/0040755000076500007650000000000010523336136013142 5ustar ratzratzmpt-status-1.2.0/doc/AUTHORS0100644000076500007650000000024610522055170014204 0ustar ratzratzInitial hard work: Matthew Braithwaite New author (see Changelog): Roberto Nibali, ratz mpt-status-1.2.0/doc/Changelog0100644000076500007650000002424310522167410014752 0ustar ratzratz2006-11-01, ratz [ratz@drugphish.ch]: o man/mpt-status.8 - merged contributions from Jean Delvare - updated with missing sections o doc/* - merged typo/spelling fixes from Jean Delvare - tidy up 64bit information since this problem is solved now o mpt-status.c - removed MPT_STATUS_DEBUG, since this was an unfinished duplicate version of --debug. 2006-10-26, ratz [ratz@drugphish.ch]: o man/{README,mpt-status.8} - added man page written by Steffen Joeris for the Debian project. o Makefile - integrated preliminary support for the man page installation and uninstallation through make install, resp. make uninstall - fixed once again the KERNEL_PATH stuff after Jean Delvare from Suse mentioned that it broke Suse builds. This time it should work for both, Suse and Redhat (Fedora). o mpt-status.c - added detection if no RAID is configured on HBA. This only works with the "--newstyle" or "-n" option for safety reasons and has not yet been tested. 2006-10-25, ratz [ratz@drugphish.ch]: o Makefile - fixed brokenness due to previously applied patch from Rich :) The point is that LSI-related headers are in the source and not the include directory of the build symlink. o mpt-status.c - Suse packages are compiled with additional flags to detect possibly problematic code. The checker complained about a call to system() with unchecked return value in mpt-status. Applied patch from Jean Delvare. 2006-06-29, ratz [ratz@drugphish.ch]: o Makefile - applied patch from Rich Edelman to set KERNEL_PATH more intelligently o contrib/contrib/mpt-status.spec - generic spec file from Rich Edelman with patch support - changed quite a lot again actually regarding wording and also removed the patch section o contrib/*diff - remove obsolete diff from tree regarding sanitation 2006-04-20- 2006-05-02, ratz [ratz@drugphish.ch]: * Version: 1.2.0-RC7 (not released), after 3 almost complete rewrites too many changes happened in between the last two weeks to list them properly. Kernel header sanitizing might not be possible after all. o mpt-status.c - proper support for 64-bit nodes - added support for spare disk information - added preliminary support for the sync percentage information o doc/TODO - updated 2006-04-20, ratz [ratz@drugphish.ch]: o mpt-status.c - reworked physical disk section - integrated the exit status patch submitted by Leandro Santi 2006-04-16, ratz [ratz@drugphish.ch]: o mpt-status.c - merged Steffen Joeris patch to support integrating mpt-status into the KFreeBSD project. 2006-03-09, ratz [ratz@drugphish.ch]: o mpt-status.c - Martin Hamant reported an issue regarding the IOC unit, which did not work for more than 1 controller. Fix it, by setting ioc_unit as part of the address unit passed over to readpage. 2006-03-06, ratz [ratz@drugphish.ch]: o mpt-status.c - removed SGE debugging lines - added checkForLibraryMode() which reads the __MPT_STATUS_LIB environment variable and if set will initialize the library functionality of mpt-status. - changed the output to please Martin Hamant and to also ease up the scriptability. 2006-03-05, ratz [ratz@drugphish.ch]: o doc/Changelog - fixed overly long line o mpt-status.c - added human readable output for IM, IME, IS, which is nothing else than RAID0, RAID1E and RAID1. 2006-03-04, ratz [ratz@drugphish.ch]: * Version: 1.1.5 [released] (Codename: Sebnem) o doc/README - major overhaul regarding distribution availability and installation process o doc/FAQ - added a possible FAQ document containing parts of an email I wrote to explain the output of mpt-status o doc/ReleaseNotes - wrote Problems, Upgrade, Outlook sections o incl/sles.h - added preliminary work to kernel header sanitation done by SuSE o mpt-status.c - made the struct divisior 32/64 bit safe - removed irritating compile warning for type signedness since too many people complained about it and before the kernel headers are not sanitized, there is no point in trying to address this deficiency - preliminary work done for IOCpage5_t support (hotspare) - fixed missing signedness casts o contrib/sizes.c - added a little tool to check the machine's type sizes o contrib/*.spec* - added various untested spec files 2006-02-11, ratz [ratz@drugphish.ch]: o Makefile - Added support for DESTDIR, patch kindly submitted by Petter Reinholdtsen 2006-01-22, ratz [ratz@drugphish.ch]: o mpt-status.{ch} - s/log_id/vol_id/ in the first line if -s is submitted - added --probe_id which will probe for the first scsi id - fixed a long standing bug resulting in a coredump when using the -d parameter - moved print_status_only, id_of_primary_device, ioc_unit into global context, so there is no need to pass those variables through the stack all the time - reorganized long_options and usage to be in alphabetical order - fixed read_page to actually work on LSI-SAS1064 controllers o doc/* - major cleanup and improved documentation 2005-11-14, ratz [ratz@drugphish.ch]: o mpt-status.c - removed Nietsche, added "--autoload" which will try to exec /sbin/modprobe mptctl. 2005-11-12, ratz [ratz@drugphish.ch]: * Version: 1.1.4 [released] 2005-11-11, ratz [ratz@drugphish.ch]: o doc/DeveloperNotes - Added information from the mpt(4) man page of OpenBSD o mpt-status.h - Fixed VERSION string o mpt-status.c - Merged patch by Thomas Richer to allow setting the ioc unit - Added Copyright note - Removed the modprobe call since this is braindead. Not all people have mpt loaded as module. Making it easy to use does not mean making it dumb. - Rewrote the primitive parameter passing on command line to more sophisticated GNU style option parsing. - Added some more switches, check them out with --help The --nietzsche_kills switch is only so I won't forget how to use long options without short options. - Reorganized include headers to have a legitimate C code ;). --> Check news://comp.std.c for some crazy stuff on C - Style cleanup - Function prototypes are static now, since we're using it only in one context. - Added the '-v' parameter which can be used after a Houston problem to get some more output on the warnings. - Added the '-q' flag to really quiet down things. 2005-07-16, ratz [ratz@drugphish.ch]: o Makefile - Incorporated patch to auto-detect redhat, done by Matti Hiljanen o doc/INSTALL - Removed RH specific entry, since RH is now auto-detected o doc/THANKS - Matti earned his stars ;) o contrib/mpt-status.spec - Added preliminary support for RPM building, work done by Jean-Philippe Civade. 2005-07-15, ratz [ratz@drugphish.ch]: * Version: 1.1.3 [released] o mpt-status.h - incorporated compile fixes for redhat based distros from Jean-Philippe Civade. Added the REDHAT define because only redhat distros seem to expose the undefined __user and __kernel problem. The impact on the correct ioctl passing is unknown. I should sanitize the LSI related headers and create user space headers. It's not like they change their API like their underwear. o Makefile - added DFLAGS for redhat parameter passing - fixed install target, bug found by Jean-Philippe Civade - fixed uninstall target - added preliminary support for compiling on 64bit platforms. Tested only on sparc64. o doc/README - proper split between README and INSTALL o doc/INSTALL - added redhat related compilation instructions - added "howto install redhat kernel sources rpm" document written by Jean-Philippe Civade. - explained the install and uninstall process o doc/THANKS - initial import: this is to thank all the people contributing to this software. o doc/ReleaseNotes - initial import: I consider them important, even though it's just a very simple tool ... so far ;) 2005-06-16, ratz [ratz@drugphish.ch]: * Version: 1.1.3 o doc/Changelog - corrected date format o mpt-status.h - added for better 2.6.x compilation support - Lindent'ed o mpt-status.c - Lindent'ed - added comment regarding compilation warning 2005-06-09, ratz [ratz@drugphish.ch]: * Version: 1.1.2 o mpt-status.c - removed some local headers and put into mpt-status.h o mpt-status.h - added local headers o Makefile - introduced KERNEL_PATH which can be submitted to the make command, so no more editing is needed. Use as follows: make KERNEL_PATH=/path/to/kernel/source - introduced PREFIX which is a pseudo prefix semantics as seen with autoconf tools for install and uninstall targets - added install and uninstall targets. o README -> doc/README - moved to doc folder where all documentation should reside o doc/INSTALL - added to shortly document the installation procedure 2005-05-19, ratz [ratz@tac.ch]: * Version: 1.1.1 o incl - created directory and moved pci-utils related header files o Makefile - adapted to new header location - added distclean target which equals to the clean target o README - tidy up to be presentable o Changelog - started primitive changelog o TODO - added some todos I've also sent Matt o AUTHORS - created and added my name ;). 2005-05-18, ratz [ratz@tac.ch]: * Version: 1.1.0 o mpt-status.c - improved output handling - documented scsi id issue for address parameter in read_page() - made main() ISO C91 standard compliant - switched position of state versus flags for easy shell parsing - added -i option to specify scsi id of primary disk of array - added -h option for little help - added UID=0 check - added VERSION (1.1.0) info - added print_usage(), print_version() - added scsi_id output for physical disk status output, so you at least know which disk to rip out of the chassis once it failed. - s/exit(1)/exit(EXIT_FAILURE)/g - s/bzero/memset/g and of course the 3rd argument - s/return 0/exit(EXIT_SUCCESS)/ - s/vol/vol_id/g o pci.h, config.h, header.h - added from pci-utils package o README - started README with some unimportant information o Makefile - added LDFLAGS for static linking - added CC = gcc to be able to compile it under uclibc - added -W -O for more warnings mpt-status-1.2.0/doc/COPYING0100644000076500007650000004311010423205411014157 0ustar ratzratz GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. mpt-status-1.2.0/doc/DeveloperNotes0100644000076500007650000001027510522055065016023 0ustar ratzratzRegarding 64bit --------------- http://www-128.ibm.com/developerworks/linux/library/l-port64.html From the OpenBSD mpt(4) man page: The LSI Logic SCSI and Fibre Channel controllers contain firmware that presents a multiprotocol service layer based on the LSI Logic Fusion-MPT architecture. The firmware isolates the host drivers from the hardware and controls the device side of the message passing interface to the host device drivers. The firmware manages all phases of an I/O request and optimizes the interrupt management for the system. For Fibre Channel, the firmware also manages all FC-2 through FC-4 services, which minimizes the amount of Fibre Channel unique services required with the host driv- er. The MPI (Message Passing Interface) definition includes a register-level transport mechanism and a messaging protocol. A system doorbell and mes- sage queues define the MPI transport interface. Inbound Message Frames (MF), allocated in host memory, identify I/O operations to be performed by the IO Controller (IOC). These operations are queued on the Request Queue by the host driver. Outbound Message Frames, also in host memory, track I/O operations as they complete. These frames are queued on the Reply Queue by the IOC. A doorbell mechanism is provided for IOC config- uration, reset management, and IOC status. You can now specify the scsi_id of the primary disk of an array. This is in case you've got an array but your primary disk is not physically in the slot 0 in your chassis (scsi id 0) but in another one. The following excerpt from the source code should clarify what I mean: This represents the id of the primary disk of an array. If you have following setup, the ID of the primary disk would be 1. +---+---+---+---+---+---+---+---+---- SCSI ID | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ... +---+---+---+---+---+---+---+---+---- \ \ \___ Array: Secondary Disk \ \______ Array: Spare Disk \_________ Array: Primary Disk In the following setup without a Spare Disk, the ID of the primary disk would be 2. +---+---+---+---+---+---+---+---+---- SCSI ID | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ... +---+---+---+---+---+---+---+---+---- \ \___ Array: Secondary Disk \______ Array: Primary Disk Random Notes ------------ The includes pci.h, config.h, header.h are from pciutils. Most distros might have a pciutils-devel package or something similar. Directory structure ------------------- ./doc/AUTHORS : This file lists the authors of the mpt-status code ./doc/Changelog : Keeps track of the changes in prosa ./doc/COPYING : The GNU v2 License copy ./doc/INSTALL : The installation documents ./doc/README : This document ./doc/ReleaseNotes : The actual release notes, read them carefully ./doc/TODO : Stuff that needs to be done ./doc/THANKS : A small thank you endroit for the contributors ./doc/DeveloperNotes : Some information on the message API of mpt ./incl/config.h : Include file from pciutils ./incl/header.h : Include file from pciutils ./incl/pci.h : Include file from pciutils ./Makefile : Used to build the mpt-status binary ./mpt-status.c : The mighty tool itself ./mpt-status.h : The main include file for mpt-status ./contrib/mpt-status.spec Kernel Header Sanitation ------------------------ ks_to_us_header() { # Voodoo to partially fix broken upstream headers. # Issues with this function should go to plasmaroo. sed -i \ -e "s/\([ "$'\t'"]\)\(u\|s\)\(8\|16\|32\|64\)\([ "$'\t'"]\)/\1__\2\3\4/g;" \ -e 's/ \(u\|s\)\(8\|16\|32\|64\)$/ __\1\2/g' \ -e 's/\([(, ]\)\(u\|s\)64\([, )]\)/\1__\264\3/g' \ -e "s/^\(u\|s\)\(8\|16\|32\|64\)\([ "$'\t'"]\)/__\1\2\3/g;" \ -e "s/ inline / __inline__ /g" \ "$@"; } After having diffed the 2.4.x and 2.6.x kernel trees with regard to the MPT, I'm quite convinced that a kernel header sanitation will not work in the end. mpt-status-1.2.0/doc/FAQ0100644000076500007650000000442710522054720013473 0ustar ratzratzmpt-status frequently asked questions (FAQ) =========================================== Eventually this should turn into a FAQ document, but right now there are not too many questions, so I just put some emails into it. --------------------------------------------- > Let's take examples from the README. > > ioc0 vol 0 type IM, 2 phy, 68 GB, flags ENABLED, state OPTIMAL > ioc0 phy 0 IBM-ESXS MAS3735NC FN C901, 68 GB, state ONLINE > ioc0 phy 1 IBM-ESXS ST373453LC FN B85D, 68 GB, state ONLINE This is the output of the old program, I've removed this output from the README in the upcoming 1.1.5 version. > > SR2400:~# ./mpt-status -i 0 > ioc0 vol_id 0 type IS, 0 phy, 0 GB, state OPTIMAL, flags NONE This means that you do not have your disks in slot 0 of your SCSI controller. > > SR2400:~# ./mpt-status -i 1 > ioc0 vol_id 1 type IM, 2 phy, 68 GB, state OPTIMAL, flags ENABLED > ioc0 phy 0 scsi_id 1 SEAGATE ST373207LC 0003, 68 GB, state ONLINE, flags NONE > ioc0 phy 1 scsi_id 3 SEAGATE ST373207LC 0003, 68 GB, state ONLINE, flags NONE Excellent. The next version of mpt-status should guide you and detect the slot id (you have id 1) automatically. > Here are my questions. > 1) Could you tell me from example #1, #2 and #3 where can you see the Raid Level of each hard disk? The raid level is not visible, would you like to get this information as well? Or do you want to extract the health state of each disk? > 2) Could you give the meaning of these abbreviations? Maybe: > FN=? This is the vendor's product revision level of the hard disk. Taking your examples #1 and #3, we gather following information: #1: ioc0 phy 0 IBM-ESXS MAS3735NC FN C901, 68 GB, state ONLINE #3: ioc0 phy 0 scsi_id 1 SEAGATE ST373207LC 0003, 68 GB, state ONLINE, flags NONE IBM-ESXS: the vendor id SEAGATE: the vendor id MAS3735NC: the product id ST373207LC: the product id FN C901: the product revision level 0003: the product revision level So, as you can see, FN is part of the product revision level of this IBM hard disk. > IS=? Integrated Striping (RAID 0) > IM=? Integrated Mirroring (RAID 1) and there is also IME, which means Integrated Mirroring + Enhanced (RAID 1E). --------------------------------------------- mpt-status-1.2.0/doc/INSTALL0100644000076500007650000000577110520056127014176 0ustar ratzratzHow can I compile mpt-status ---------------------------- Simply go with make and if your kernel sources are not located at /usr/src/linux, try make KERNEL_PATH=/path/to/your/kernel/src If this does not work, send me (Roberto Nibali) an email with the output and I try to fix it. You might also need to tweak the Makefile shipped with this package. IMPORTANT: Try to compile mpt-status on a machine with the same kernel headers on which kernel version the resulting mpt-status binary will run on. If you compile mpt-status with 2.6.x headers and deploy the binary on a 2.4.x kernel based system, it might be that the tool will try to fetch the wrong pages and this can result in major havoc! How can I install mpt-status ---------------------------- Simply go with (as user root) make install This will install the mpt-status binary into /usr/sbin. If you need another path, you can prefix the installation path by setting PREFIX like follows: make PREFIX=/my/prefix/path To check if the mpt-status binary is installed into the correct path, invoke make -n install and carefully check the output. If you're a distro packager or you otherwise need to create a package relative to the final path, you have the possibility to specify the DESTDIR variable. Following install call: make DESTDIR=/var/tmp/package install would install the mpt-status binary into /var/tmp/package/usr/sbin/mpt-status You can now also install the man page by invoking make install_doc This will install the mpt-status.8 man page. How can I uninstall mpt-status ------------------------------ Simply go with (as user root) make uninstall If you previously installed mpt-status into a prefixed directory you also have to provide this prefix to the uninstall target, like so: make PREFIX=/my/prefix/path uninstall Since this is only one simple binary, the uninstall target is almost ridiculous so for real hardcore hackers, you might also use ... rm: \rm -f /path/to/mpt-status or if you so wish: make -n uninstall | sh You can now also uninstall the man page by invoking make uninstall_doc This will uninstall the mpt-status.8 man page. If you don't have the kernel sources package installed (Redhat based info) -------------------------------------------------------------------------- This applies to FC3/FC4 and RH ES4 (*). 1. Do "up2date --get-source kernel" 2. Kernel src rpm is now in /var/spool/up2date. Install it with "rpm -Uvh /var/spool/up2date/kernel-.src.rpm" 3. Do "cd /usr/src/redhat/SPECS/" 4. Do "rpmbuild -bp --target=i686 kernel-2.6.spec" 5. Last, you can move the source in the /usr/src/redhat/BUILD/kernel- directory to the /usr/src tree; while not strictly necessary, we suggest that you do this to match the generally-available documentation. 6. cd /usr/src/redhat/BUILD/kernel- /usr/src/ 7. mv linux- /usr/src/ 8. cd /usr/src 9. ln -s ./linux- linux [* http://fedora.redhat.com/docs/release-notes/fc4/errata/#sn-kernel] mpt-status-1.2.0/doc/README0100644000076500007650000001213310522331451014011 0ustar ratzratzAbout ----- The mpt-status software is a query tool to access the running configuration and status of LSI SCSI HBAs. This is a completely rewritten version of the original mpt-status-1.0 tool written by Matt Braithwaite. mpt-status allows you to monitor the health and status of your RAID setup. Currently supported and tested HBAs are: LSI 1030 SCSI RAID storage controller LSI SAS1064 SCSI RAID storage controller LSI SAS1068 SCSI RAID storage controller LSI SAS 3442-R SCSI RAID storage controller Since the tool is using the MPI (message passing interface) changes are high that the basic information regarding RAID status will be available for all LSI based controllers. Just give it a try and report back. Requirements ------------ You should have mptbase and mptctl loaded or compiled into the kernel. If you are to compile mpt-status by yourself, make sure you have the kernel source installed, or else it will fail. This deficiency will hopefully be addressed soon. Reported working hardware configuration --------------------------------------- Sun Fire X4100 Sun Fire X4200 Sun Fire V20z Sun Fire V40z Dell PE2600 Intel Server with SE7520BD2S boards HP ProLiant DL320 G4 IBM eServer BladeCenter LS20 Where can I get this fine piece of software? -------------------------------------------- Homepage of maintained version: http://www.drugphish.ch/~ratz/mpt-status/ The original version of this tool is not maintained anymore by its author. He was kind enough to put a link to the current mpt-status home. Thanks, Matt. Distro related support ---------------------- To my avail following distributions have mpt-status included: Distro | Status | URL --------+-----------+--------------------------------------------------------- Debian | OK | http://packages.debian.org/unstable/admin/mpt-status --------+-----------+--------------------------------------------------------- Suse | NOK (old) | http://www.novell.com/products/linuxpackages/professional/mpt-status.html | NOK (old) | http://www.novell.com/products/linuxpackages/enterpriseserver/SP3/ia64/mpt-status.html --------+-----------+--------------------------------------------------------- Support for following distros can be found through google and rpm searches (status unknown): PLD Turbolinux I have provided spec (for RPM) files for OpenSuse and Red Hat, however they are mostly untested. Have a look into the contrib sub directory. How can I compile, install or uninstall mpt-status? --------------------------------------------------- Read doc/INSTALL for further information on building mpt-status. Basically you should be fine invoking make A simple (as root) make install should install the binary to $PREFIX/sbin, and can be uninstalled as follows: make uninstall What does this software provide you? ------------------------------------ For now it should be improved regarding compilation on different systems, also different kernels. But the output has changed as well. Example: SR2400:~# ./mpt-status -i 1 ioc0 vol_id 1 type IM, 2 phy, 68 GB, state OPTIMAL, flags ENABLED ioc0 phy 0 scsi_id 1 SEAGATE ST373207LC 0003, 68 GB, state ONLINE, flags NONE ioc0 phy 1 scsi_id 3 SEAGATE ST373207LC 0003, 68 GB, state ONLINE, flags NONE [root@redhatAS-3-U4-X86_64 mpt-status-1.1.5-new]# ./mpt-status You seem to have no SCSI disks attached to your HBA or you have them on a different scsi_id. To get your SCSI id, run: mpt-status -p [root@redhatAS-3-U4-X86_64 mpt-status-1.1.5-new]# ./mpt-status -p Found SCSI id=2, use ''mpt-status -i 2`` to get more information. [root@redhatAS-3-U4-X86_64 mpt-status-1.1.5-new]# ./mpt-status -i 2 ioc0 vol_id 2 type IM, 2 phy, 67 GB, state OPTIMAL, flags ENABLED ioc0 phy 1 scsi_id 4 FUJITSU MAV2073RCSUN72G 0301, 68 GB, state ONLINE, flags NONE ioc0 phy 0 scsi_id 3 FUJITSU MAV2073RCSUN72G 0301, 68 GB, state ONLINE, flags NONE [root@redhatAS-3-U4-X86_64 mpt-status-1.1.5-new]# ./mpt-status -i 2 -s vol_id 2 OPTIMAL phys_id 1 ONLINE phys_id 0 ONLINE A new style output has made it into the sources, however due to backwards compatibility reasons it's not on per default. You can enable the new style output by invoking mpt-status as follows: mpt-status --newstyle There is also a debug mode since the mpt-status-1.2.0 release. Hardware, Software and Distribution Compatibility ------------------------------------------------- The mpt-status software is known and reported to compile and work on following Linux distributions: SuSE : 9.0, 9.1, 9.2, 9.3, 10.0, 10.1, 10.2, SLES8, SLES9, SLES10 Redhat : 7.3, 9.0, RHEL3, RHEL4, FC1, FC2, FC3, FC4, FC5 Debian : all so far Ubuntu : edgy Gentoo : 2005.x ulibc-based : all Kernels: Linux: 2.4.x, 2.6.x Architectures: i386 x86_64 List of Hardware configuration ------------------------------ This list should eventually be exported somewhere so decision makers and hardware buyers can easily find out if their hardware is a) supported and b) can be monitored. If you have successfully running mpt-status on a platform not mentioned below, please send me following output: dmesg -s 1000000 (best after having rebooted your machine) lspci -v dmidecode mpt-status-1.2.0/doc/ReleaseNotes0100644000076500007650000000542310522123170015446 0ustar ratzratzRelease Notes mpt-status 1.2.0 (2006-11-03) ============================== Codename: [True master of soccer. If you don't know anything about him, read up on him at http://en.wikipedia.org/wiki/Zinedine_Zidane. Despite the fact that I'm Italian and I'm proud that we have won the championship, I'd like to dedicate this release to my hard-working French contributors. Merci beaucoup et tout est bien qui finit bien.] About ----- The mpt-status software is a query tool to access the running configuration and status of LSI SCSI HBAs. This is a completely rewritten version of the original mpt-status-1.0 tool written by Matt Braithwaite. mpt-status allows you to monitor the health and status of your RAID setup. Currently supported and tested HBAs are: LSI 1030 SCSI RAID storage controller LSI SAS1064 SCSI RAID storage controller LSI SAS1068 SCSI RAID storage controller LSI SAS 3442-R SCSI RAID storage controller Since the tool is using the MPI (message passing interface) changes are high that the basic information regarding RAID status will be available for all LSI based controllers. Just give it a try and report back. Requirements ------------ You should have mptbase and mptctl loaded or compiled into the kernel. If you are to compile mpt-status by yourself, make sure you have the kernel source installed, or else it will fail. This deficiency will hopefully be addressed soon. General Information ------------------- This is the first release with proper 64bit support and mostly clean interface querying. On top of that numerous contributions have been merged, please see the Changelog for further information. As a last minute addition I've decided to bundle the mpt-status.8 man page into the release drop. This was written and contributed by Steffen Joeris, the Debian maintainer for mpt-status. Preliminary work has been done on integrating S.M.A.R.T information in the report output. This would allow one to monitor for failing hardware and preemptively replace it without business interruption. This information can be queried via the --newstyle/-n parameter. The new style parameter also provides you with the percentage status of the synchronisation after a degradation. Problems -------- None. Reported working hardware configuration --------------------------------------- Sun Fire X4100 Sun Fire X4200 Sun Fire V20z Sun Fire V40z Dell PE2600 Intel Server with SE7520BD2S boards HP ProLiant DL320 G4 IBM eServer BladeCenter LS20 Upgrade ------- You can upgrade mpt-status without any problems. This has been widely tested by a broad user base. Outlook ------- I will take another look at the output format and see if I can improve it. The other thing is to take a look at integrating more LSI related products or give better indication on how to use the closed-source CLI tools. mpt-status-1.2.0/doc/THANKS0100644000076500007650000000316110522057462014054 0ustar ratzratzThis file is to thank all the contributors of this software. There is no specific order or preference, it's only a little tool anyway ;). +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Klaus Ade Johnstad: - Offered me remote access to hardware to develop and test mpt-status. Jean-Philippe Civade: - Various little fixes regarding Redhat based distros and a small document contribution on kernel source building - Initial RPM spec Matti Hiljanen: - Added Redhat auto-detection Stefan Richter: - Patch to allow setting IOC unit. Petter Reinholdtsen: - Patch to Makefile to allow setting DESTDIR, which helps distro packagers. Jimmy Stewpot: - Generously offered my access to his hardware so I could develop and test the auto-probing feature. Max Shaposhnikov: - Has given me 2 months access to his Opteron system and was very helpful when I rendered his system unusable. Hopefully I get the 64bit stuff working on his nodes. Steffen Joeris: - Support for the KFreeBSD project Leandro Santi: - Added support for meaningful exit status Rich Edelman: - Improved KERNEL_PATH to be distro independent & added generic RPM spec file support Jean Delvare: - Provided cleanup patch to quieten possible problematic code. - Helpful Suse Contact for mpt-status integration into SLES and OpenSuse. - Documentation cleanups and valuable man page additions +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If I have forgotten you or to list any of your contribution, please drop me an email and I will add you to this hall of fame list. mpt-status-1.2.0/doc/TODO0100644000076500007650000000162310425713341013627 0ustar ratzratzThis file is a wishlist compiled out of various people's ideas. It should eventually be prioritized into "important, normal, nice to have". o find out the remaining pieces of magic around the kernel structs and document them accordingly o get in contact with LSI for feedback and support o check if there is really the need for other RAID types and add support for them. A diff from the 2.4.x to the 2.6.x kernel in this header: #define MPI_RAID_VOL_TYPE_IS (0x00) #define MPI_RAID_VOL_TYPE_IME (0x01) #define MPI_RAID_VOL_TYPE_IM (0x02) +#define MPI_RAID_VOL_TYPE_RAID_5 (0x03) +#define MPI_RAID_VOL_TYPE_RAID_6 (0x04) +#define MPI_RAID_VOL_TYPE_RAID_10 (0x05) +#define MPI_RAID_VOL_TYPE_RAID_50 (0x06) +#define MPI_RAID_VOL_TYPE_UNKNOWN (0xFF) mpt-status-1.2.0/incl/0040755000076500007650000000000010423205412013311 5ustar ratzratzmpt-status-1.2.0/incl/config.h0100644000076500007650000000040110423205412014717 0ustar ratzratz#define ARCH_I386 #define OS_LINUX #define HAVE_PM_LINUX_PROC #define HAVE_LINUX_BYTEORDER_H #define PATH_PROC_BUS_PCI "/proc/bus/pci" #define HAVE_PM_INTEL_CONF #define HAVE_PM_DUMP #define PATH_PCI_IDS "/usr/share/pci.ids" #define PCILIB_VERSION "2.1.11" mpt-status-1.2.0/incl/header.h0100644000076500007650000005050110423205412014710 0ustar ratzratz/* * $Id: header.h,v 1.9 2002/12/26 20:24:50 mj Exp $ * * The PCI Library -- PCI Header Structure (extracted from ) * * Copyright (c) 1997--2002 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ /* * Under PCI, each device has 256 bytes of configuration address space, * of which the first 64 bytes are standardized as follows: */ #define PCI_VENDOR_ID 0x00 /* 16 bits */ #define PCI_DEVICE_ID 0x02 /* 16 bits */ #define PCI_COMMAND 0x04 /* 16 bits */ #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ #define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ #define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ #define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ #define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ #define PCI_COMMAND_SERR 0x100 /* Enable SERR */ #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ #define PCI_STATUS 0x06 /* 16 bits */ #define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ #define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ #define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ #define PCI_STATUS_DEVSEL_FAST 0x000 #define PCI_STATUS_DEVSEL_MEDIUM 0x200 #define PCI_STATUS_DEVSEL_SLOW 0x400 #define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ #define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ #define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ #define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ #define PCI_REVISION_ID 0x08 /* Revision ID */ #define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ #define PCI_CLASS_DEVICE 0x0a /* Device class */ #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ #define PCI_HEADER_TYPE 0x0e /* 8 bits */ #define PCI_HEADER_TYPE_NORMAL 0 #define PCI_HEADER_TYPE_BRIDGE 1 #define PCI_HEADER_TYPE_CARDBUS 2 #define PCI_BIST 0x0f /* 8 bits */ #define PCI_BIST_CODE_MASK 0x0f /* Return result */ #define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ #define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ /* * Base addresses specify locations in memory or I/O space. * Decoded size can be determined by writing a value of * 0xffffffff to the register, and reading it back. Only * 1 bits are decoded. */ #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ #define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ #define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ #define PCI_BASE_ADDRESS_SPACE_IO 0x01 #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) #define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) /* bit 1 is reserved if address_space = 1 */ /* Header type 0 (normal devices) */ #define PCI_CARDBUS_CIS 0x28 #define PCI_SUBSYSTEM_VENDOR_ID 0x2c #define PCI_SUBSYSTEM_ID 0x2e #define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ #define PCI_ROM_ADDRESS_ENABLE 0x01 #define PCI_ROM_ADDRESS_MASK (~0x7ffUL) #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ /* 0x35-0x3b are reserved */ #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ #define PCI_MIN_GNT 0x3e /* 8 bits */ #define PCI_MAX_LAT 0x3f /* 8 bits */ /* Header type 1 (PCI-to-PCI bridges) */ #define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ #define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ #define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ #define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ #define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ #define PCI_IO_LIMIT 0x1d #define PCI_IO_RANGE_TYPE_MASK 0x0f /* I/O bridging type */ #define PCI_IO_RANGE_TYPE_16 0x00 #define PCI_IO_RANGE_TYPE_32 0x01 #define PCI_IO_RANGE_MASK ~0x0f #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ #define PCI_MEMORY_LIMIT 0x22 #define PCI_MEMORY_RANGE_TYPE_MASK 0x0f #define PCI_MEMORY_RANGE_MASK ~0x0f #define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ #define PCI_PREF_MEMORY_LIMIT 0x26 #define PCI_PREF_RANGE_TYPE_MASK 0x0f #define PCI_PREF_RANGE_TYPE_32 0x00 #define PCI_PREF_RANGE_TYPE_64 0x01 #define PCI_PREF_RANGE_MASK ~0x0f #define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ #define PCI_PREF_LIMIT_UPPER32 0x2c #define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ #define PCI_IO_LIMIT_UPPER16 0x32 /* 0x34 same as for htype 0 */ /* 0x35-0x3b is reserved */ #define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ /* 0x3c-0x3d are same as for htype 0 */ #define PCI_BRIDGE_CONTROL 0x3e #define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ #define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ #define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ #define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ #define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ #define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ /* Header type 2 (CardBus bridges) */ /* 0x14-0x15 reserved */ #define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ #define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ #define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ #define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ #define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ #define PCI_CB_MEMORY_BASE_0 0x1c #define PCI_CB_MEMORY_LIMIT_0 0x20 #define PCI_CB_MEMORY_BASE_1 0x24 #define PCI_CB_MEMORY_LIMIT_1 0x28 #define PCI_CB_IO_BASE_0 0x2c #define PCI_CB_IO_BASE_0_HI 0x2e #define PCI_CB_IO_LIMIT_0 0x30 #define PCI_CB_IO_LIMIT_0_HI 0x32 #define PCI_CB_IO_BASE_1 0x34 #define PCI_CB_IO_BASE_1_HI 0x36 #define PCI_CB_IO_LIMIT_1 0x38 #define PCI_CB_IO_LIMIT_1_HI 0x3a #define PCI_CB_IO_RANGE_MASK ~0x03 /* 0x3c-0x3d are same as for htype 0 */ #define PCI_CB_BRIDGE_CONTROL 0x3e #define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ #define PCI_CB_BRIDGE_CTL_SERR 0x02 #define PCI_CB_BRIDGE_CTL_ISA 0x04 #define PCI_CB_BRIDGE_CTL_VGA 0x08 #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 #define PCI_CB_SUBSYSTEM_ID 0x42 #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ /* 0x48-0x7f reserved */ /* Capability lists */ #define PCI_CAP_LIST_ID 0 /* Capability ID */ #define PCI_CAP_ID_PM 0x01 /* Power Management */ #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ #define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ #define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ #define PCI_CAP_SIZEOF 4 /* Power Management Registers */ #define PCI_PM_CAP_VER_MASK 0x0007 /* Version (2=PM1.1) */ #define PCI_PM_CAP_PME_CLOCK 0x0008 /* Clock required for PME generation */ #define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization required */ #define PCI_PM_CAP_AUX_C_MASK 0x01c0 /* Maximum aux current required in D3cold */ #define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ #define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ #define PCI_PM_CAP_PME_D0 0x0800 /* PME can be asserted from D0 */ #define PCI_PM_CAP_PME_D1 0x1000 /* PME can be asserted from D1 */ #define PCI_PM_CAP_PME_D2 0x2000 /* PME can be asserted from D2 */ #define PCI_PM_CAP_PME_D3_HOT 0x4000 /* PME can be asserted from D3hot */ #define PCI_PM_CAP_PME_D3_COLD 0x8000 /* PME can be asserted from D3cold */ #define PCI_PM_CTRL 4 /* PM control and status register */ #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* PM table data index */ #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* PM table data scaling factor */ #define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ #define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions */ #define PCI_PM_PPB_B2_B3 0x40 /* If bridge enters D3hot, bus enters: 0=B3, 1=B2 */ #define PCI_PM_BPCC_ENABLE 0x80 /* Secondary bus is power managed */ #define PCI_PM_DATA_REGISTER 7 /* PM table contents read here */ #define PCI_PM_SIZEOF 8 /* AGP registers */ #define PCI_AGP_VERSION 2 /* BCD version number */ #define PCI_AGP_RFU 3 /* Rest of capability flags */ #define PCI_AGP_STATUS 4 /* Status register */ #define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ #define PCI_AGP_STATUS_ISOCH 0x10000 /* Isochronous transactions supported */ #define PCI_AGP_STATUS_ARQSZ_MASK 0xe000 /* log2(optimum async req size in bytes) - 4 */ #define PCI_AGP_STATUS_CAL_MASK 0x1c00 /* Calibration cycle timing */ #define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ #define PCI_AGP_STATUS_ITA_COH 0x0100 /* In-aperture accesses always coherent */ #define PCI_AGP_STATUS_GART64 0x0080 /* 64-bit GART entries supported */ #define PCI_AGP_STATUS_HTRANS 0x0040 /* If 0, core logic can xlate host CPU accesses thru aperture */ #define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing cycles supported */ #define PCI_AGP_STATUS_FW 0x0010 /* Fast write transfers supported */ #define PCI_AGP_STATUS_AGP3 0x0008 /* AGP3 mode supported */ #define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported (RFU in AGP3 mode) */ #define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported (8x in AGP3 mode) */ #define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported (4x in AGP3 mode) */ #define PCI_AGP_COMMAND 8 /* Control register */ #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ #define PCI_AGP_COMMAND_ARQSZ_MASK 0xe000 /* log2(optimum async req size in bytes) - 4 */ #define PCI_AGP_COMMAND_CAL_MASK 0x1c00 /* Calibration cycle timing */ #define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ #define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ #define PCI_AGP_COMMAND_GART64 0x0080 /* 64-bit GART entries enabled */ #define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow generation of 64-bit addr cycles */ #define PCI_AGP_COMMAND_FW 0x0010 /* Enable FW transfers */ #define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate (RFU in AGP3 mode) */ #define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate (8x in AGP3 mode) */ #define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate (4x in AGP3 mode) */ #define PCI_AGP_SIZEOF 12 /* Slot Identification */ #define PCI_SID_ESR 2 /* Expansion Slot Register */ #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ /* Message Signalled Interrupts registers */ #define PCI_MSI_FLAGS 2 /* Various flags */ #define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ #define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ #define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ #define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ #define PCI_MSI_RFU 3 /* Rest of capability flags */ #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ /* PCI-X */ #define PCI_PCIX_COMMAND 2 /* Command register offset */ #define PCI_PCIX_COMMAND_DPERE 0x0001 /* Data Parity Error Recover Enable */ #define PCI_PCIX_COMMAND_ERO 0x0002 /* Enable Relaxed Ordering */ #define PCI_PCIX_COMMAND_MAX_MEM_READ_BYTE_COUNT 0x000c /* Maximum Memory Read Byte Count */ #define PCI_PCIX_COMMAND_MAX_OUTSTANDING_SPLIT_TRANS 0x0070 #define PCI_PCIX_COMMAND_RESERVED 0xf80 #define PCI_PCIX_STATUS 4 /* Status register offset */ #define PCI_PCIX_STATUS_FUNCTION 0x00000007 #define PCI_PCIX_STATUS_DEVICE 0x000000f8 #define PCI_PCIX_STATUS_BUS 0x0000ff00 #define PCI_PCIX_STATUS_64BIT 0x00010000 #define PCI_PCIX_STATUS_133MHZ 0x00020000 #define PCI_PCIX_STATUS_SC_DISCARDED 0x00040000 /* Split Completion Discarded */ #define PCI_PCIX_STATUS_UNEXPECTED_SC 0x00080000 /* Unexpected Split Completion */ #define PCI_PCIX_STATUS_DEVICE_COMPLEXITY 0x00100000 /* 0 = simple device, 1 = bridge device */ #define PCI_PCIX_STATUS_DESIGNED_MAX_MEM_READ_BYTE_COUNT 0x00600000 /* 0 = 512 bytes, 1 = 1024, 2 = 2048, 3 = 4096 */ #define PCI_PCIX_STATUS_DESIGNED_MAX_OUTSTANDING_SPLIT_TRANS 0x03800000 #define PCI_PCIX_STATUS_DESIGNED_MAX_CUMULATIVE_READ_SIZE 0x1c000000 #define PCI_PCIX_STATUS_RCVD_SC_ERR_MESS 0x20000000 /* Received Split Completion Error Message */ #define PCI_PCIX_STATUS_RESERVED 0xc0000000 #define PCI_PCIX_SIZEOF 4 /* PCI-X Bridges */ #define PCI_PCIX_BRIDGE_SEC_STATUS 2 /* Secondary bus status register offset */ #define PCI_PCIX_BRIDGE_SEC_STATUS_64BIT 0x0001 #define PCI_PCIX_BRIDGE_SEC_STATUS_133MHZ 0x0002 #define PCI_PCIX_BRIDGE_SEC_STATUS_SC_DISCARDED 0x0004 /* Split Completion Discarded on secondary bus */ #define PCI_PCIX_BRIDGE_SEC_STATUS_UNEXPECTED_SC 0x0008 /* Unexpected Split Completion on secondary bus */ #define PCI_PCIX_BRIDGE_SEC_STATUS_SC_OVERRUN 0x0010 /* Split Completion Overrun on secondary bus */ #define PCI_PCIX_BRIDGE_SEC_STATUS_SPLIT_REQUEST_DELAYED 0x0020 #define PCI_PCIX_BRIDGE_SEC_STATUS_CLOCK_FREQ 0x01c0 #define PCI_PCIX_BRIDGE_SEC_STATUS_RESERVED 0xfe00 #define PCI_PCIX_BRIDGE_STATUS 4 /* Primary bus status register offset */ #define PCI_PCIX_BRIDGE_STATUS_FUNCTION 0x00000007 #define PCI_PCIX_BRIDGE_STATUS_DEVICE 0x000000f8 #define PCI_PCIX_BRIDGE_STATUS_BUS 0x0000ff00 #define PCI_PCIX_BRIDGE_STATUS_64BIT 0x00010000 #define PCI_PCIX_BRIDGE_STATUS_133MHZ 0x00020000 #define PCI_PCIX_BRIDGE_STATUS_SC_DISCARDED 0x00040000 /* Split Completion Discarded */ #define PCI_PCIX_BRIDGE_STATUS_UNEXPECTED_SC 0x00080000 /* Unexpected Split Completion */ #define PCI_PCIX_BRIDGE_STATUS_SC_OVERRUN 0x00100000 /* Split Completion Overrun */ #define PCI_PCIX_BRIDGE_STATUS_SPLIT_REQUEST_DELAYED 0x00200000 #define PCI_PCIX_BRIDGE_STATUS_RESERVED 0xffc00000 #define PCI_PCIX_BRIDGE_UPSTREAM_SPLIT_TRANS_CTRL 8 /* Upstream Split Transaction Register offset */ #define PCI_PCIX_BRIDGE_DOWNSTREAM_SPLIT_TRANS_CTRL 12 /* Downstream Split Transaction Register offset */ #define PCI_PCIX_BRIDGE_STR_CAPACITY 0x0000ffff #define PCI_PCIX_BRIDGE_STR_COMMITMENT_LIMIT 0xffff0000 #define PCI_PCIX_BRIDGE_SIZEOF 12 /* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded * in a single byte as follows: * * 7:3 = slot * 2:0 = function */ #define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) /* Device classes and subclasses */ #define PCI_CLASS_NOT_DEFINED 0x0000 #define PCI_CLASS_NOT_DEFINED_VGA 0x0001 #define PCI_BASE_CLASS_STORAGE 0x01 #define PCI_CLASS_STORAGE_SCSI 0x0100 #define PCI_CLASS_STORAGE_IDE 0x0101 #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 #define PCI_CLASS_STORAGE_RAID 0x0104 #define PCI_CLASS_STORAGE_OTHER 0x0180 #define PCI_BASE_CLASS_NETWORK 0x02 #define PCI_CLASS_NETWORK_ETHERNET 0x0200 #define PCI_CLASS_NETWORK_TOKEN_RING 0x0201 #define PCI_CLASS_NETWORK_FDDI 0x0202 #define PCI_CLASS_NETWORK_ATM 0x0203 #define PCI_CLASS_NETWORK_OTHER 0x0280 #define PCI_BASE_CLASS_DISPLAY 0x03 #define PCI_CLASS_DISPLAY_VGA 0x0300 #define PCI_CLASS_DISPLAY_XGA 0x0301 #define PCI_CLASS_DISPLAY_OTHER 0x0380 #define PCI_BASE_CLASS_MULTIMEDIA 0x04 #define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 #define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 #define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 #define PCI_BASE_CLASS_MEMORY 0x05 #define PCI_CLASS_MEMORY_RAM 0x0500 #define PCI_CLASS_MEMORY_FLASH 0x0501 #define PCI_CLASS_MEMORY_OTHER 0x0580 #define PCI_BASE_CLASS_BRIDGE 0x06 #define PCI_CLASS_BRIDGE_HOST 0x0600 #define PCI_CLASS_BRIDGE_ISA 0x0601 #define PCI_CLASS_BRIDGE_EISA 0x0602 #define PCI_CLASS_BRIDGE_MC 0x0603 #define PCI_CLASS_BRIDGE_PCI 0x0604 #define PCI_CLASS_BRIDGE_PCMCIA 0x0605 #define PCI_CLASS_BRIDGE_NUBUS 0x0606 #define PCI_CLASS_BRIDGE_CARDBUS 0x0607 #define PCI_CLASS_BRIDGE_OTHER 0x0680 #define PCI_BASE_CLASS_COMMUNICATION 0x07 #define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 #define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 #define PCI_BASE_CLASS_SYSTEM 0x08 #define PCI_CLASS_SYSTEM_PIC 0x0800 #define PCI_CLASS_SYSTEM_DMA 0x0801 #define PCI_CLASS_SYSTEM_TIMER 0x0802 #define PCI_CLASS_SYSTEM_RTC 0x0803 #define PCI_CLASS_SYSTEM_OTHER 0x0880 #define PCI_BASE_CLASS_INPUT 0x09 #define PCI_CLASS_INPUT_KEYBOARD 0x0900 #define PCI_CLASS_INPUT_PEN 0x0901 #define PCI_CLASS_INPUT_MOUSE 0x0902 #define PCI_CLASS_INPUT_OTHER 0x0980 #define PCI_BASE_CLASS_DOCKING 0x0a #define PCI_CLASS_DOCKING_GENERIC 0x0a00 #define PCI_CLASS_DOCKING_OTHER 0x0a01 #define PCI_BASE_CLASS_PROCESSOR 0x0b #define PCI_CLASS_PROCESSOR_386 0x0b00 #define PCI_CLASS_PROCESSOR_486 0x0b01 #define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 #define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 #define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 #define PCI_CLASS_PROCESSOR_CO 0x0b40 #define PCI_BASE_CLASS_SERIAL 0x0c #define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 #define PCI_CLASS_SERIAL_ACCESS 0x0c01 #define PCI_CLASS_SERIAL_SSA 0x0c02 #define PCI_CLASS_SERIAL_USB 0x0c03 #define PCI_CLASS_SERIAL_FIBER 0x0c04 #define PCI_CLASS_OTHERS 0xff /* Several ID's we need in the library */ #define PCI_VENDOR_ID_INTEL 0x8086 #define PCI_VENDOR_ID_COMPAQ 0x0e11 mpt-status-1.2.0/incl/mpt-sanitized.h0100644000076500007650000001353110423205412016252 0ustar ratzratz#define MPI_FUNCTION_CONFIG (0x04) #define MPI_CONFIG_ACTION_PAGE_HEADER (0x00) #define MPI_CONFIG_PAGETYPE_RAID_VOLUME (0x08) #define MPI_CONFIG_ACTION_PAGE_READ_CURRENT (0x01) #define MPI_RAIDVOLPAGE0_PAGEVERSION (0x01) #define MPI_RAIDVOL0_STATUS_FLAG_ENABLED (0x01) #define MPI_RAIDVOL0_STATUS_FLAG_QUIESCED (0x02) #define MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS (0x04) #define MPI_RAIDVOL0_STATUS_FLAG_VOLUME_INACTIVE (0x08) #define MPI_RAIDVOL0_STATUS_STATE_OPTIMAL (0x00) #define MPI_RAIDVOL0_STATUS_STATE_DEGRADED (0x01) #define MPI_RAIDVOL0_STATUS_STATE_FAILED (0x02) #define MPI_CONFIG_PAGETYPE_RAID_PHYSDISK (0x0A) #define MPI_RAIDPHYSDISKPAGE0_PAGEVERSION (0x00) #define MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC (0x01) #define MPI_PHYSDISK0_STATUS_FLAG_QUIESCED (0x02) #define MPI_PHYSDISK0_STATUS_ONLINE (0x00) #define MPI_PHYSDISK0_STATUS_MISSING (0x01) #define MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE (0x02) #define MPI_PHYSDISK0_STATUS_FAILED (0x03) #define MPI_PHYSDISK0_STATUS_FAILED_REQUESTED (0x06) #define MPI_PHYSDISK0_STATUS_INITIALIZING (0x04) #define MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED (0x05) #define MPI_PHYSDISK0_STATUS_FAILED_REQUESTED (0x06) #define MPI_PHYSDISK0_STATUS_OTHER_OFFLINE (0xFF) #define MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX (1) #define MPT_MAGIC_NUMBER 'm' #define MPTCOMMAND _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command) typedef struct ConfigPageHeader_t { uint8_t PageVersion; /* 00h */ uint8_t PageLength; /* 01h */ uint8_t PageNumber; /* 02h */ uint8_t PageType; /* 03h */ } ConfigPageHeader_t; typedef struct SGESimpleUnion_t { uint32_t FlagsLength; union { uint32_t Address32; uint64_t Address64; } u; } SGESimpleUnion_t; typedef struct SGEChainUnion_t { uint16_t Length; uint8_t NextChainOffset; uint8_t Flags; union { uint32_t Address32; uint64_t Address64; } u; } SGEChainUnion_t; typedef struct SGEIOUnion_t { union { SGESimpleUnion_t Simple; SGEChainUnion_t Chain; } u; } SGEIOUnion_t; typedef struct Config_t { uint8_t Action; /* 00h */ uint8_t Reserved; /* 01h */ uint8_t ChainOffset; /* 02h */ uint8_t Function; /* 03h */ uint16_t ExtPageLength; /* 04h */ uint8_t ExtPageType; /* 06h */ uint8_t MsgFlags; /* 07h */ uint32_t MsgContext; /* 08h */ uint8_t Reserved2[8]; /* 0Ch */ ConfigPageHeader_t Header; /* 14h */ uint32_t PageAddress; /* 18h */ SGEIOUnion_t PageBufferSGE; /* 1Ch */ } Config_t; typedef struct ConfigReply_t { uint8_t Action; /* 00h */ uint8_t Reserved; /* 01h */ uint8_t MsgLength; /* 02h */ uint8_t Function; /* 03h */ uint16_t ExtPageLength; /* 04h */ uint8_t ExtPageType; /* 06h */ uint8_t MsgFlags; /* 07h */ uint32_t MsgContext; /* 08h */ uint8_t Reserved2[2]; /* 0Ch */ uint16_t IOCStatus; /* 0Eh */ uint32_t IOCLogInfo; /* 10h */ ConfigPageHeader_t Header; /* 14h */ } ConfigReply_t; typedef struct RaidVol0Status_t { uint8_t Flags; /* 00h */ uint8_t State; /* 01h */ uint16_t Reserved; /* 02h */ } RaidVol0Status_t; typedef struct RaidVol0Settings { uint16_t Settings; /* 00h */ uint8_t HotSparePool; /* 01h *//* MPI_RAID_HOT_SPARE_POOL_ */ uint8_t Reserved; /* 02h */ } RaidVol0Settings; typedef struct RaidVol0PhysDisk_t { uint16_t Reserved; /* 00h */ uint8_t PhysDiskMap; /* 02h */ uint8_t PhysDiskNum; /* 03h */ } RaidVol0PhysDisk_t; typedef struct RaidVolumePage0_t { ConfigPageHeader_t Header; /* 00h */ uint8_t VolumeID; /* 04h */ uint8_t VolumeBus; /* 05h */ uint8_t VolumeIOC; /* 06h */ uint8_t VolumeType; /* 07h *//* MPI_RAID_VOL_TYPE_ */ RaidVol0Status_t VolumeStatus; /* 08h */ RaidVol0Settings VolumeSettings; /* 0Ch */ uint32_t MaxLBA; /* 10h */ uint32_t Reserved1; /* 14h */ uint32_t StripeSize; /* 18h */ uint32_t Reserved2; /* 1Ch */ uint32_t Reserved3; /* 20h */ uint8_t NumPhysDisks; /* 24h */ uint8_t Reserved4; /* 25h */ uint16_t Reserved5; /* 26h */ RaidVol0PhysDisk_t PhysDisk[MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX]; /* 28h */ } RaidVolumePage0_t; typedef struct RaidPhysDiskSettings_t { uint8_t SepID; /* 00h */ uint8_t SepBus; /* 01h */ uint8_t HotSparePool; /* 02h *//* MPI_RAID_HOT_SPARE_POOL_ */ uint8_t PhysDiskSettings; /* 03h */ } RaidPhysDiskSettings_t; typedef struct RaidPhysDisk0InquiryData { uint8_t VendorID[8]; /* 00h */ uint8_t ProductID[16]; /* 08h */ uint8_t ProductRevLevel[4]; /* 18h */ uint8_t Info[32]; /* 1Ch */ } RaidPhysDisk0InquiryData; typedef struct RaidPhysDiskStatus_t { uint8_t Flags; /* 00h */ uint8_t State; /* 01h */ uint16_t Reserved; /* 02h */ } RaidPhysDiskStatus_t; typedef struct RaidPhysDisk0ErrorData_t { uint8_t ErrorCdbByte; /* 00h */ uint8_t ErrorSenseKey; /* 01h */ uint16_t Reserved; /* 02h */ uint16_t ErrorCount; /* 04h */ uint8_t ErrorASC; /* 06h */ uint8_t ErrorASCQ; /* 07h */ uint16_t SmartCount; /* 08h */ uint8_t SmartASC; /* 0Ah */ uint8_t SmartASCQ; /* 0Bh */ } RaidPhysDisk0ErrorData_t; typedef struct RaidPhysDiskPage0_t { ConfigPageHeader_t Header; /* 00h */ uint8_t PhysDiskID; /* 04h */ uint8_t PhysDiskBus; /* 05h */ uint8_t PhysDiskIOC; /* 06h */ uint8_t PhysDiskNum; /* 07h */ RaidPhysDiskSettings_t PhysDiskSettings; /* 08h */ uint32_t Reserved1; /* 0Ch */ uint32_t Reserved2; /* 10h */ uint32_t Reserved3; /* 14h */ uint8_t DiskIdentifier[16]; /* 18h */ RaidPhysDisk0InquiryData InquiryData; /* 28h */ RaidPhysDiskStatus_t PhysDiskStatus; /* 64h */ uint32_t MaxLBA; /* 68h */ RaidPhysDisk0ErrorData_t ErrorData; /* 6Ch */ } RaidPhysDiskPage0_t; typedef struct mpt_ioctl_header { unsigned int iocnum; /* IOC unit number */ unsigned int port; /* IOC port number */ int maxDataSize; /* Maximum Num. bytes to transfer on read */ } mpt_ioctl_header; struct mpt_ioctl_command { mpt_ioctl_header hdr; int timeout; /* optional (seconds) */ char *replyFrameBufPtr; char *dataInBufPtr; char *dataOutBufPtr; char *senseDataPtr; int maxReplyBytes; int dataInSize; int dataOutSize; int maxSenseBytes; int dataSgeOffset; char MF[1]; }; mpt-status-1.2.0/incl/pci.h0100644000076500007650000001271710423205412014242 0ustar ratzratz/* * $Id: pci.h,v 1.12 2003/01/04 11:04:39 mj Exp $ * * The PCI Library * * Copyright (c) 1997--2002 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ #ifndef _PCI_LIB_H #define _PCI_LIB_H #include "config.h" #include "header.h" /* * Types */ #ifdef OS_LINUX #include typedef __u8 byte; typedef __u8 u8; typedef __u16 word; typedef __u16 u16; typedef __u32 u32; #endif #ifdef OS_FREEBSD #include typedef u_int8_t byte; typedef u_int8_t u8; typedef u_int16_t word; typedef u_int16_t u16; typedef u_int32_t u32; #endif #ifdef OS_NETBSD #include typedef u_int8_t byte; typedef u_int8_t u8; typedef u_int16_t word; typedef u_int16_t u16; typedef u_int32_t u32; #endif #ifdef OS_AIX #include typedef u_int8_t byte; typedef u_int8_t u8; typedef u_int16_t word; typedef u_int16_t u16; typedef u_int32_t u32; #endif #ifdef HAVE_LONG_ADDRESS typedef unsigned long long pciaddr_t; #else typedef unsigned long pciaddr_t; #endif /* * PCI Access Structure */ struct pci_methods; struct nl_entry; enum pci_access_type { /* Known access methods, remember to update access.c as well */ PCI_ACCESS_AUTO, /* Autodetection (params: none) */ PCI_ACCESS_PROC_BUS_PCI, /* Linux /proc/bus/pci (params: path) */ PCI_ACCESS_I386_TYPE1, /* i386 ports, type 1 (params: none) */ PCI_ACCESS_I386_TYPE2, /* i386 ports, type 2 (params: none) */ PCI_ACCESS_FBSD_DEVICE, /* FreeBSD /dev/pci (params: path) */ PCI_ACCESS_AIX_DEVICE, /* /dev/pci0, /dev/bus0, etc. */ PCI_ACCESS_NBSD_LIBPCI, /* NetBSD libpci */ PCI_ACCESS_DUMP, /* Dump file (params: filename) */ PCI_ACCESS_MAX }; struct pci_access { /* Options you can change: */ unsigned int method; /* Access method */ char *method_params[PCI_ACCESS_MAX]; /* Parameters for the methods */ int writeable; /* Open in read/write mode */ int buscentric; /* Bus-centric view of the world */ char *id_file_name; /* Name of ID list file */ int numeric_ids; /* Don't resolve device IDs to names */ int debugging; /* Turn on debugging messages */ /* Functions you can override: */ void (*error)(char *msg, ...); /* Write error message and quit */ void (*warning)(char *msg, ...); /* Write a warning message */ void (*debug)(char *msg, ...); /* Write a debugging message */ struct pci_dev *devices; /* Devices found on this bus */ /* Fields used internally: */ struct pci_methods *methods; char *nl_list; /* Name list cache */ struct nl_entry **nl_hash; int fd; /* proc: fd */ int fd_rw; /* proc: fd opened read-write */ struct pci_dev *cached_dev; /* proc: device the fd is for */ int fd_pos; /* proc: current position */ }; /* Initialize PCI access */ struct pci_access *pci_alloc(void); void pci_init(struct pci_access *); void pci_cleanup(struct pci_access *); /* Scanning of devices */ void pci_scan_bus(struct pci_access *acc); struct pci_dev *pci_get_dev(struct pci_access *acc, int bus, int dev, int func); /* Raw access to specified device */ void pci_free_dev(struct pci_dev *); /* * Devices */ struct pci_dev { struct pci_dev *next; /* Next device in the chain */ word bus; /* Higher byte can select host bridges */ byte dev, func; /* Device and function */ /* These fields are set by pci_fill_info() */ int known_fields; /* Set of info fields already known */ word vendor_id, device_id; /* Identity of the device */ int irq; /* IRQ number */ pciaddr_t base_addr[6]; /* Base addresses */ pciaddr_t size[6]; /* Region sizes */ pciaddr_t rom_base_addr; /* Expansion ROM base address */ pciaddr_t rom_size; /* Expansion ROM size */ /* Fields used internally: */ struct pci_access *access; struct pci_methods *methods; byte *cache; /* Cached information */ int cache_len; int hdrtype; /* Direct methods: header type */ void *aux; /* Auxillary data */ }; #define PCI_ADDR_IO_MASK (~(pciaddr_t) 0x3) #define PCI_ADDR_MEM_MASK (~(pciaddr_t) 0xf) byte pci_read_byte(struct pci_dev *, int pos); /* Access to configuration space */ word pci_read_word(struct pci_dev *, int pos); u32 pci_read_long(struct pci_dev *, int pos); int pci_read_block(struct pci_dev *, int pos, byte *buf, int len); int pci_write_byte(struct pci_dev *, int pos, byte data); int pci_write_word(struct pci_dev *, int pos, word data); int pci_write_long(struct pci_dev *, int pos, u32 data); int pci_write_block(struct pci_dev *, int pos, byte *buf, int len); int pci_fill_info(struct pci_dev *, int flags); /* Fill in device information */ #define PCI_FILL_IDENT 1 #define PCI_FILL_IRQ 2 #define PCI_FILL_BASES 4 #define PCI_FILL_ROM_BASE 8 #define PCI_FILL_SIZES 16 #define PCI_FILL_RESCAN 0x10000 void pci_setup_cache(struct pci_dev *, byte *cache, int len); /* * Filters */ struct pci_filter { int bus, slot, func; /* -1 = ANY */ int vendor, device; }; void pci_filter_init(struct pci_access *, struct pci_filter *); char *pci_filter_parse_slot(struct pci_filter *, char *); char *pci_filter_parse_id(struct pci_filter *, char *); int pci_filter_match(struct pci_filter *, struct pci_dev *); /* * Device names */ char *pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, u32 arg1, u32 arg2, u32 arg3, u32 arg4); void pci_free_name_list(struct pci_access *a); #define PCI_LOOKUP_VENDOR 1 #define PCI_LOOKUP_DEVICE 2 #define PCI_LOOKUP_CLASS 4 #define PCI_LOOKUP_SUBSYSTEM 8 #define PCI_LOOKUP_PROGIF 16 #define PCI_LOOKUP_NUMERIC 0x10000 #endif mpt-status-1.2.0/Makefile0100644000076500007650000000206210522167506014034 0ustar ratzratzPROG := mpt-status PREFIX := /usr KERNEL_PATH := /usr/src/linux KERNEL_PATH_B := /lib/modules/`uname -r`/build KERNEL_PATH_S := /lib/modules/`uname -r`/source CFLAGS := -Iincl -Wall -W -O2 \ -I${KERNEL_PATH}/drivers/message/fusion \ -I${KERNEL_PATH_B}/drivers/message/fusion \ -I${KERNEL_PATH_S}/drivers/message/fusion DFLAGS := #-DSANITIZED_KERNEL_HEADERS LDFLAGS := DESTDIR := MANDIR := /usr/share/man CC := gcc INSTALL := install -D ARCH := $(shell uname -m) ifeq "${ARCH}" "sparc64" CFLAGS := -Iincl -Wall -W -O2 -m64 -pipe \ -mcpu=ultrasparc -mcmodel=medlow endif ${PROG}: ${PROG}.c ${PROG}.h ${CC} ${DFLAGS} ${CFLAGS} -o $@ $< ${LDFLAGS} install: ${PROG} ${INSTALL} -s -o root -g root -m 0500 $< \ ${DESTDIR}${PREFIX}/sbin install_doc: man/${PROG}.8 ${INSTALL} -o root -g root -m 0644 $< \ ${DESTDIR}${MANDIR}/man8 gzip -9 ${DESTDIR}${MANDIR}/man8/${PROG}.8 uninstall: \rm -f ${DESTDIR}${PREFIX}/sbin/${PROG} uninstall_doc: \rm -f ${DESTDIR}${MANDIR}/man8/${PROG}.8.gz clean: \rm -f ${PROG} distclean: clean \rm -f core* *~ mpt-status-1.2.0/mpt-status.c0100644000076500007650000011110310522062477014657 0ustar ratzratz/* This is a program to print the status of an LSI 1030 RAID or LSI SAS1064 SCSI controller. Copyright (C) 2004 CNET Networks, Inc. Copyright (C) 2005-2006 Roberto Nibali Copyright (C) 2006 by LSI Logic This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include "mpt-status.h" #define ARG_M_A 0x0001 static int m = 0; static int quiet_mode = 0; static int verbose_mode = 0; static int debug = 0; static int debug_level = 0; static int auto_load = 0; static int probe_id = 0; static int mpt_exit_mask = MPT_EXIT_OKAY; static int print_status_only = PRINT_STATUS_ONLY; static int id_of_primary_device = 0; static int ioc_unit = 0; static int newstyle = 0; static int sync_state[2] = { 0, 0 }; static int sel; static const struct option long_options[] = { { "autoload", no_argument, &sel, ARG_M_A }, { "controller", required_argument, NULL, 'u' }, { "debug", optional_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { "newstyle", no_argument, NULL, 'n' }, { "probe_id", no_argument, NULL, 'p' }, { "quiet", no_argument, NULL, 'q' }, { "set_id", required_argument, NULL, 'i' }, { "status_only", no_argument, NULL, 's' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, { 0, no_argument, NULL, 0 }, }; static const char* const short_options = "d:hi:npqsu:vV"; static const char* const usage_template = "Usage: %s [ options ]\n" "\n" " --autoload This will try to automatically load the \n" " mptctl kernel module\n" " -d, --debug [] Enable debugging and set level optionally\n" " NOTE: This is not fully implemented yet\n" " -h, --help Print this help information page\n" " -n, --newstyle Use the new style output. This parameter was\n" " introduced to retain backwards compatibility\n" " If not set, you get the old style output\n" " -p, --probe_id Use this to probe SCSI id's when not on id 0\n" " -q, --quiet Do not display any warnings or boring info\n" " -i, --set_id Set id of primary device (check README)\n" " -s, --status_only Only print the status information. This can\n" " be used for easy scripting\n" " -u, --controller Set the IOC unit (controller)\n" " -v, --verbose Print verbose information, such as warnings\n" " -V, --version Print version information\n" "\n" " You can write ``-o arg'' or ``--option arg'' or ``--option=arg''\n" " Note that for some parameters only the long format is supported.\n" "\n" " For more information, please refer to mpt-status(8).\n" "\n" "\n"; static char *VolumeTypes[] = { "IS", "IME", "IM" }; static char *VolumeTypesHuman[] = { "RAID-0", "RAID-1E", "RAID-1" }; mpiIoctlBlk_t *mpiBlkPtr = NULL; unsigned char g_command[BIG]; char g_data[4*BIG]; char g_reply[BIG]; int g_bigEndian = 0; static int resync_on = 0; /* function declaration */ static unsigned int cpu_to_le32 (unsigned int); static unsigned short le16_to_cpu(unsigned short); static void freeMem(void); static int allocDataFrame(int); static int allocReplyFrame(void); static void mpt_exit(int); static int mpt_printf(const char *format, ...); static int mpt_fprintf(FILE *, const char *, ...); static void print_usage(const char *); static void print_version(void); static int read_page2(uint); //static int hasVolume(void); static void GetVolumeInfo(void); static void GetPhysDiskInfo(RaidVol0PhysDisk_t *, int); static void GetHotSpareInfo(void); static void GetResyncPercentageSilent(RaidVol0PhysDisk_t *, unsigned char *, int); static void GetResyncPercentage(RaidVol0PhysDisk_t *, unsigned char *, int); static void do_init(void); /* internal-functions declaration */ static void __check_endianess(void); static void __print_volume_advanced(RaidVolumePage0_t *); static void __print_volume_classic(RaidVolumePage0_t *); static void __print_physdisk_advanced(RaidPhysDiskPage0_t *, int); static void __print_physdisk_classic(RaidPhysDiskPage0_t *); static void __check_endianess(void) { int i = 1; char *p = (char *) &i; if (p[0] != 1) { // Lowest address contains the least significant byte g_bigEndian = 1; } } static unsigned int cpu_to_le32(unsigned int x) { if (g_bigEndian) { unsigned int y; y = (x & 0xFF00) << 8; y |= (x & 0xFF) << 24; y |= (x & 0xFF0000) >> 8; y |= (x & 0xFF000000) >> 24; return y; } return x; } static unsigned short le16_to_cpu(unsigned short x) { if (g_bigEndian) { unsigned short y = (((x & 0xFF00) >> 8) | ((x & 0xFF) << 8)); return y; } return x; } static void freeMem(void) { if (mpiBlkPtr->replyFrameBufPtr) mpiBlkPtr->replyFrameBufPtr = NULL; if (mpiBlkPtr->dataOutBufPtr) mpiBlkPtr->dataOutBufPtr = NULL; if (mpiBlkPtr->dataInBufPtr) mpiBlkPtr->dataInBufPtr = NULL; mpiBlkPtr = NULL; } static int allocDataFrame(int dir) { if (dir == DATA_DIR_OUT) { if (mpiBlkPtr->dataOutSize > (4*BIG)) return 1; mpiBlkPtr->dataOutBufPtr = (char *)&g_data; memset(mpiBlkPtr->dataOutBufPtr, 0, mpiBlkPtr->dataOutSize); } else if (dir == DATA_DIR_IN) { if (mpiBlkPtr->dataInSize > (4*BIG)) return 1; mpiBlkPtr->dataInBufPtr = (char *)&g_data; memset(mpiBlkPtr->dataInBufPtr, 0, mpiBlkPtr->dataInSize); } return 0; } static int allocReplyFrame(void) { mpiBlkPtr->replyFrameBufPtr = (char *) &g_reply; memset (mpiBlkPtr->replyFrameBufPtr, 0, REPLY_SIZE); mpiBlkPtr->maxReplyBytes = REPLY_SIZE; return 0; } mpiIoctlBlk_t *allocIoctlBlk(uint numBytes) { int blksize = sizeof(mpiIoctlBlk_t) + numBytes; if (blksize >= BIG) { return NULL; } mpiBlkPtr = (mpiIoctlBlk_t *) &g_command; memset(mpiBlkPtr, 0, blksize); if (allocReplyFrame()) { printf("allocReplyFrame call failed\n"); freeMem(); return NULL; } return mpiBlkPtr; } static void mpt_exit(int status) { /* this function is suboptimal in that it masks too many semantic information into one int */ if (status & MPT_EXIT_FREEMEM) { freeMem(); } if (status & MPT_EXIT_NOCLOSE) { close(m); } exit(mpt_exit_mask |= status); } static int mpt_printf(const char *format, ...) { int result; va_list ap; if (quiet_mode) return 0; va_start(ap, format); result = vprintf(format, ap); va_end(ap); return result; } static int mpt_fprintf(FILE *fp, const char *format, ...) { int result; va_list ap; if (quiet_mode) return 0; va_start(ap, format); result = vfprintf(fp, format, ap); va_end(ap); return result; } static int mpt_debug(const char *format, ...) { int result; va_list ap; if (!debug) return 0; /* debug_level is also set at this point */ va_start(ap, format); result = vprintf(format, ap); va_end(ap); return result; } static void print_usage(const char *progname) { mpt_printf(usage_template, progname); } static void print_version(void) { mpt_printf("mpt-status version : %s\n", VERSION); /* Next version (needs mptbase.h) mpt_printf("Driver header version: %s\n", MPT_LINUX_VERSION_COMMON); */ } static int __probe_scsi_id2(void) { Config_t *ConfigRequest; ConfigReply_t *pReply = NULL; RaidVolumePage0_t *pRVP0 = NULL; uint numBytes; int status; int id; int scsi_id; for (scsi_id = 0; scsi_id < 16; scsi_id++) { mpt_printf("Checking for SCSI ID:%d\n", scsi_id); numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof(SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) { return -1; } ConfigRequest = (Config_t *) mpiBlkPtr->MF; mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; mpiBlkPtr->dataInBufPtr = mpiBlkPtr->dataOutBufPtr = NULL; mpiBlkPtr->dataSgeOffset = (sizeof (Config_t) - sizeof(SGE_IO_UNION))/4; pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_RAID_VOLUME; ConfigRequest->Header.PageNumber = ioc_unit; ConfigRequest->PageAddress = scsi_id; status = read_page2(MPT_FLAGS_KEEP_MEM); if (status != 0 || pReply->Header.PageLength == 0) { freeMem(); return -1; } mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { mpt_printf("Increase data buffer size"); freeMem(); return -1; } ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; ConfigRequest->Header.PageLength = pReply->Header.PageLength; id = 0; // volume id: only one volume for now (vol_ids) /* The following PageAddress does not make too much sense */ ConfigRequest->PageAddress = scsi_id | id; status = read_page2(MPT_FLAGS_KEEP_MEM); pRVP0 = (RaidVolumePage0_t *) mpiBlkPtr->dataInBufPtr; if ((status == 0) && (pRVP0->NumPhysDisks > 0)) { /* We have found a Volume with some physical disks */ freeMem(); return scsi_id; } } freeMem(); return -1; } static int read_page2(uint flags) { MPIDefaultReply_t *pReply = NULL; int CmdBlkSize; int status = -1; CmdBlkSize = sizeof(mpiIoctlBlk_t) + ((mpiBlkPtr->dataSgeOffset)*4) + 8; mpiBlkPtr->hdr.iocnum = ioc_unit; mpiBlkPtr->hdr.port = 0; if (ioctl(m, (unsigned long) MPTCOMMAND, (char *) mpiBlkPtr) != 0) { perror("ioctl"); mpt_exit(MPT_EXIT_UNKNOWN); } else { pReply = (MPIDefaultReply_t *) mpiBlkPtr->replyFrameBufPtr; if ((pReply) && (pReply->MsgLength > 0)) { pReply->IOCStatus = le16_to_cpu(pReply->IOCStatus); status = pReply->IOCStatus & MPI_IOCSTATUS_MASK; } else { status = 0; } } if ((flags & MPT_FLAGS_KEEP_MEM) == 0) { freeMem(); } return status; } /* Will be needed for detecting if a HBA has its SCSI disks configured as RAID static int hasVolume(void) { Config_t *ConfigRequest; ConfigReply_t *pReply = NULL; IOCPage2_t *pIOC2 = NULL; uint numBytes; uint numVolumes = 0; int status; unsigned bus = id_of_primary_device; numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof(SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) { return numVolumes; } ConfigRequest = (Config_t *) mpiBlkPtr->MF; mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; mpiBlkPtr->dataInBufPtr = mpiBlkPtr->dataOutBufPtr = NULL; mpiBlkPtr->dataSgeOffset = (sizeof (Config_t) - sizeof(SGE_IO_UNION))/4; pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_IOC; ConfigRequest->Header.PageNumber = ioc_unit; ConfigRequest->PageAddress = bus; status = read_page2(MPT_FLAGS_KEEP_MEM); if (status != 0 || pReply->Header.PageLength == 0) { freeMem(); return numVolumes; } mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { mpt_printf("Increase data buffer size"); freeMem(); return numVolumes; } ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; ConfigRequest->Header.PageLength = pReply->Header.PageLength; ConfigRequest->PageAddress = bus; status = read_page2(MPT_FLAGS_KEEP_MEM); pIOC2 = (IOCPage2_t *) mpiBlkPtr->dataInBufPtr; if (status == 0){ numVolumes = pIOC2->NumActiveVolumes; } freeMem(); return numVolumes; } */ /* This function is only written to get the information of Volume 0 */ static void GetVolumeInfo(void) { Config_t *ConfigRequest; ConfigReply_t *pReply = NULL; RaidVolumePage0_t *pRVP0 = NULL; RaidVol0PhysDisk_t disk_num[16]; unsigned char pdisk_vol[16]; uint numBytes; int status; int i, id; int pdisk_cnt = 0; unsigned bus = id_of_primary_device; numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof(SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) { return; } ConfigRequest = (Config_t *) mpiBlkPtr->MF; mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; mpiBlkPtr->dataInBufPtr = mpiBlkPtr->dataOutBufPtr = NULL; mpiBlkPtr->dataSgeOffset = (sizeof (Config_t) - sizeof(SGE_IO_UNION))/4; pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_RAID_VOLUME; ConfigRequest->Header.PageNumber = ioc_unit; //orig: ConfigRequest->PageAddress = cpu_to_le32((bus << 8) | 0); mpt_debug("DEBUG: cpu_to_le32=%d htonl=%d ntohl=%d\n", cpu_to_le32((bus << 8) | 0), htonl((bus << 8) | 0), ntohl((bus << 8) | 0)); ConfigRequest->PageAddress = bus; status = read_page2(MPT_FLAGS_KEEP_MEM); if (status != 0 || pReply->Header.PageLength == 0) { freeMem(); return; } mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { mpt_printf("Increase data buffer size"); freeMem(); return; } ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; ConfigRequest->Header.PageLength = pReply->Header.PageLength; id = 0; // volume id: only one volume for now (vol_ids) //orig: ConfigRequest->PageAddress = cpu_to_le32((bus << 8) | id); /* Something is fishy here */ mpt_debug("DEBUG: cpu_to_le32=%d htonl=%d ntohl=%d\n", cpu_to_le32(bus | id), htonl(bus | id), ntohl(bus | id)); ConfigRequest->PageAddress = bus | id; status = read_page2(MPT_FLAGS_KEEP_MEM); pRVP0 = (RaidVolumePage0_t *) mpiBlkPtr->dataInBufPtr; if ((status == 0) && (pRVP0->NumPhysDisks > 0)){ if (newstyle == 0) { __print_volume_classic(pRVP0); } else { __print_volume_advanced(pRVP0); } for (i = pdisk_cnt; i < pdisk_cnt + pRVP0->NumPhysDisks; i++) { disk_num[i].PhysDiskNum = pRVP0->PhysDisk[i].PhysDiskNum; disk_num[i].PhysDiskMap = pRVP0->PhysDisk[i].PhysDiskMap; pdisk_vol[i] = pRVP0->VolumeID; } pdisk_cnt += pRVP0->NumPhysDisks; } else if (pRVP0->NumPhysDisks == 0) { mpt_printf("%s\n", wrong_scsi_id); mpt_exit(MPT_EXIT_UNKNOWN); } freeMem(); /* this should be woven into the GetPhysDiskInfo part correctly */ if (newstyle) /* && resync_on) */ { GetResyncPercentageSilent((RaidVol0PhysDisk_t *) &disk_num, (unsigned char *) &pdisk_vol, pdisk_cnt); } if (pdisk_cnt > 0) { GetPhysDiskInfo((RaidVol0PhysDisk_t *) &disk_num, pdisk_cnt); } /* this should be woven into the GetPhysDiskInfo part correctly */ if (newstyle) { GetHotSpareInfo(); } /* this should be woven into the GetPhysDiskInfo part correctly */ if (newstyle) /* && resync_on) */ { GetResyncPercentage((RaidVol0PhysDisk_t *) &disk_num, (unsigned char *) &pdisk_vol, pdisk_cnt); } return; } static void GetPhysDiskInfo(RaidVol0PhysDisk_t *pDisk, int count) { Config_t *ConfigRequest; ConfigReply_t *pReply = NULL; uint numBytes; int status; int i; numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof (SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) return; ConfigRequest = (Config_t *) mpiBlkPtr->MF; mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; mpiBlkPtr->dataInBufPtr = mpiBlkPtr->dataOutBufPtr = NULL; mpiBlkPtr->dataSgeOffset = (sizeof (Config_t) - sizeof(SGE_IO_UNION))/4; pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_RAID_PHYSDISK; ConfigRequest->Header.PageNumber = ioc_unit; ConfigRequest->PageAddress = cpu_to_le32((uint)pDisk[0].PhysDiskNum); status = read_page2(MPT_FLAGS_KEEP_MEM); if ((status == 0) && (pReply->Header.PageLength > 0)) { mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { mpt_printf("Increase data buffer size"); freeMem(); return; } } ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; ConfigRequest->Header.PageLength = pReply->Header.PageLength; for (i = 0; i < count; i++){ ConfigRequest->PageAddress = cpu_to_le32((uint)pDisk[i].PhysDiskNum); status = read_page2(MPT_FLAGS_KEEP_MEM); if (status == 0) { RaidPhysDiskPage0_t *pRPD0 = (RaidPhysDiskPage0_t *) mpiBlkPtr->dataInBufPtr; if (newstyle == 0) { __print_physdisk_classic(pRPD0); } else { __print_physdisk_advanced(pRPD0, 0); } } else { //mpt_printf("\t\tNot Available.\n"); } } freeMem(); return; } static void GetHotSpareInfo(void) { Config_t *ConfigRequest; ConfigReply_t *pReply = NULL; IOCPage5_t *pPg5 = NULL; uint numBytes; int status; uint num_spares = 0; numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof (SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) return; ConfigRequest = (Config_t *) mpiBlkPtr->MF; mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; mpiBlkPtr->dataInBufPtr = mpiBlkPtr->dataOutBufPtr = NULL; mpiBlkPtr->dataSgeOffset = (sizeof (Config_t) - sizeof(SGE_IO_UNION))/4; pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageNumber = 5; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_IOC; ConfigRequest->PageAddress = 0; status = read_page2(MPT_FLAGS_KEEP_MEM); if (status != 0 || pReply->Header.PageLength == 0) { freeMem(); return; } mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { mpt_printf("Increase data buffer size"); freeMem(); return; } ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; ConfigRequest->Header.PageLength = pReply->Header.PageLength; status = read_page2(MPT_FLAGS_KEEP_MEM); pPg5 = (IOCPage5_t *) mpiBlkPtr->dataInBufPtr; if ((status == 0) && (pPg5->NumHotSpares > 0)){ num_spares = pPg5->NumHotSpares; { // Get Phys Disk Information Ioc5HotSpare_t disk_num[num_spares]; unsigned int i; for (i = 0; i < num_spares; i++) { disk_num[i].PhysDiskNum = pPg5->HotSpare[i].PhysDiskNum; disk_num[i].HotSparePool = pPg5->HotSpare[i].HotSparePool; } freeMem(); /* Do not reference pPg5 any more */ numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof (SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) return; ConfigRequest = (Config_t *) mpiBlkPtr->MF; mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; mpiBlkPtr->dataInBufPtr = mpiBlkPtr->dataOutBufPtr = NULL; mpiBlkPtr->dataSgeOffset = (sizeof (Config_t) - sizeof(SGE_IO_UNION))/4; pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_RAID_PHYSDISK; ConfigRequest->PageAddress = cpu_to_le32((uint)disk_num[0].PhysDiskNum); status = read_page2(MPT_FLAGS_KEEP_MEM); if ((status == 0) && (pReply->Header.PageLength > 0)) { mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { mpt_printf("Increase data buffer size"); freeMem(); return; } } ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; ConfigRequest->Header.PageLength = pReply->Header.PageLength; for (i = 0; i < num_spares; i++){ ConfigRequest->PageAddress = cpu_to_le32((uint)disk_num[i].PhysDiskNum); status = read_page2(MPT_FLAGS_KEEP_MEM); if (status == 0) { RaidPhysDiskPage0_t *pRPD0 = (RaidPhysDiskPage0_t *) mpiBlkPtr->dataInBufPtr; __print_physdisk_advanced(pRPD0, 1); } } } } freeMem(); return; } static void GetResyncPercentageSilent(RaidVol0PhysDisk_t *pDisk, unsigned char *pVol, int count) { MpiRaidActionRequest_t *pRequest; uint blks_done; uint numBytes; int i; uint tot_blks, blks_left; int status; numBytes = (sizeof(MpiRaidActionRequest_t) - sizeof(SGE_IO_UNION)) + sizeof (SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) return; pRequest = (MpiRaidActionRequest_t *) mpiBlkPtr->MF; mpiBlkPtr->dataSgeOffset = (sizeof (MpiRaidActionRequest_t) - sizeof(SGE_IO_UNION))/4; mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; pRequest->Action = MPI_RAID_ACTION_INDICATOR_STRUCT; pRequest->Function = MPI_FUNCTION_RAID_ACTION; pRequest->MsgContext = -1; pRequest->ActionDataWord = 0; /* action data is 0 */ for (i = 0; i < count; i++) { pRequest->VolumeID = (u8) pVol[i]; pRequest->PhysDiskNum = pDisk[i].PhysDiskNum; status = read_page2(MPT_FLAGS_KEEP_MEM); if (status == 0) { // pDisk[i].PhysDiskNum == scsi_id uint *pdata = (uint *) mpiBlkPtr->replyFrameBufPtr; pdata += 6; tot_blks = *pdata; pdata++; pdata++; blks_left = *pdata; pdata++; blks_done = tot_blks - blks_left; //mpt_printf("scsi_id:%d", pDisk[i].PhysDiskNum); if (blks_left == 0) { sync_state[pDisk[i].PhysDiskNum%2] = 100; } else { sync_state[pDisk[i].PhysDiskNum%2] = ((blks_done >> 6)*100)/(tot_blks >> 6); } } } freeMem(); return; } static void GetResyncPercentage(RaidVol0PhysDisk_t *pDisk, unsigned char *pVol, int count) { MpiRaidActionRequest_t *pRequest; uint blks_done; uint numBytes; int i; uint tot_blks, blks_left; int status; numBytes = (sizeof(MpiRaidActionRequest_t) - sizeof(SGE_IO_UNION)) + sizeof (SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) return; pRequest = (MpiRaidActionRequest_t *) mpiBlkPtr->MF; mpiBlkPtr->dataSgeOffset = (sizeof (MpiRaidActionRequest_t) - sizeof(SGE_IO_UNION))/4; /* Initialize data in/data out sizes: Change below if need to */ mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; pRequest->Action = MPI_RAID_ACTION_INDICATOR_STRUCT; pRequest->Function = MPI_FUNCTION_RAID_ACTION; pRequest->MsgContext = -1; pRequest->ActionDataWord = 0; /* action data is 0 */ for (i = 0; i < count; i++ ) { pRequest->VolumeID = (u8) pVol[i]; pRequest->PhysDiskNum = pDisk[i].PhysDiskNum; status = read_page2(MPT_FLAGS_KEEP_MEM); if (status == 0) { // pDisk[i].PhysDiskNum == scsi_id uint *pdata = (uint *) mpiBlkPtr->replyFrameBufPtr; mpt_debug("DEBUG: *pdata=%d\n", *pdata); pdata += 6; tot_blks = *pdata; mpt_debug("DEBUG: tot_blks=%d\n", tot_blks); pdata++; pdata++; blks_left = *pdata; mpt_debug("DEBUG: blks_left=%d\n", blks_left); pdata++; blks_done = tot_blks - blks_left; mpt_printf("scsi_id:%d", pDisk[i].PhysDiskNum); if (blks_left == 0) { mpt_printf(" 100%%\n"); } else { mpt_printf(" %d%%\n", ((blks_done >> 6)*100)/(tot_blks >> 6)); } } } freeMem(); return; } static void __print_volume_advanced(RaidVolumePage0_t *page) { if (1 == print_status_only) { mpt_printf("vol_id:%d", page->VolumeID); } else { mpt_printf("ioc:%d vol_id:%d type:%s raidlevel:%s num_disks:%d size(GB):%d", page->VolumeIOC, page->VolumeID, page->VolumeType < sizeof(VolumeTypes) ? VolumeTypes[page->VolumeType] : "unknown", page->VolumeType < sizeof(VolumeTypes) ? VolumeTypesHuman[page->VolumeType] : "", page->NumPhysDisks, page->MaxLBA / (2 * 1024 * 1024)); mpt_printf(" state:"); } if (page->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_OPTIMAL) { mpt_exit_mask |= MPT_EXIT_VOL_OPTIMAL; mpt_printf(" OPTIMAL"); } else if (page->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_DEGRADED) { mpt_exit_mask |= MPT_EXIT_VOL_DEGRADED; mpt_printf(" DEGRADED"); } else if (page->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_FAILED) { mpt_exit_mask |= MPT_EXIT_VOL_FAILED; mpt_printf(" FAILED"); } else { mpt_exit_mask |= MPT_EXIT_UNKNOWN; mpt_printf(" UNKNOWN"); } if (1 != print_status_only) { mpt_printf(" flags:"); if (page->VolumeStatus.Flags != 0) { if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_ENABLED) mpt_printf(" ENABLED"); if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_QUIESCED) mpt_printf(" QUIESCED"); if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) { mpt_printf(" RESYNC_IN_PROGRESS"); resync_on = 1; } if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_VOLUME_INACTIVE) mpt_printf(" VOLUME_INACTIVE"); } else { mpt_printf(" NONE"); } } /* since mpt_printf() returns without output when quiet mode is enabled we need to explicitly write that CR */ printf("\n"); /* CONFIG_PAGE_HEADER Header; // 00h U8 VolumeID; // 04h U8 VolumeBus; // 05h U8 VolumeIOC; // 06h U8 VolumeType; // 07h RAID_VOL0_STATUS VolumeStatus; // 08h RAID_VOL0_SETTINGS VolumeSettings; // 0Ch U32 MaxLBA; // 10h U32 Reserved1; // 14h U32 StripeSize; // 18h U32 Reserved2; // 1Ch U32 Reserved3; // 20h U8 NumPhysDisks; // 24h U8 DataScrubRate; // 25h U8 ResyncRate; // 26h U8 InactiveStatus; // 27h RAID_VOL0_PHYS_DISK PhysDisk[MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX]; */ //mpt_debug(VolumeID); } static void __print_volume_classic(RaidVolumePage0_t *page) { /* This function will go away for the next big release */ if (1 == print_status_only) { mpt_printf("log_id %d", page->VolumeID); } else { mpt_printf("ioc%d vol_id %d type %s, %d phy, %d GB", page->VolumeIOC, page->VolumeID, sizeof(VolumeTypes) ? VolumeTypes[page->VolumeType] : "unknown", page->NumPhysDisks, page->MaxLBA / (2 * 1024 * 1024)); mpt_printf(", state"); } if (page->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_OPTIMAL) { mpt_exit_mask |= MPT_EXIT_VOL_OPTIMAL; mpt_printf(" OPTIMAL"); } else if (page->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_DEGRADED) { mpt_exit_mask |= MPT_EXIT_VOL_DEGRADED; mpt_printf(" DEGRADED"); } else if (page->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_FAILED) { mpt_exit_mask |= MPT_EXIT_VOL_FAILED; mpt_printf(" FAILED"); } else { mpt_exit_mask |= MPT_EXIT_UNKNOWN; mpt_printf(" UNKNOWN"); } if (1 != print_status_only) { mpt_printf(", flags"); if (page->VolumeStatus.Flags != 0) { if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_ENABLED) mpt_printf(" ENABLED"); if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_QUIESCED) mpt_printf(" QUIESCED"); if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) { mpt_printf(" RESYNC_IN_PROGRESS"); resync_on = 1; } if (page->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_VOLUME_INACTIVE) mpt_printf(" VOLUME_INACTIVE"); } else { mpt_printf(" NONE"); } } /* since mpt_printf() returns without output when quiet mode is enabled we need to explicitly write that CR */ printf("\n"); } static void __print_physdisk_advanced(RaidPhysDiskPage0_t *phys, int spare) { char vendor[BIG]; char productid[BIG]; char rev[BIG]; memset(vendor, 0, sizeof(vendor)); memset(productid, 0, sizeof(productid)); memset(rev, 0, sizeof(rev)); strncpy(vendor, (void *) phys->InquiryData.VendorID, sizeof(phys->InquiryData.VendorID)); strncpy(productid, (void *) phys->InquiryData.ProductID, sizeof(phys->InquiryData.ProductID)); strncpy(rev, (void *) phys->InquiryData.ProductRevLevel, sizeof(phys->InquiryData.ProductRevLevel)); if (1 == print_status_only) { printf("%s:%d", spare == 1 ? "spare_id" : "phys_id", phys->PhysDiskNum); } else { printf("ioc:%d %s:%d scsi_id:%d vendor:%s product_id:%s revision:%s size(GB):%d", phys->PhysDiskIOC, spare == 1 ? "spare_id" : "phys_id", phys->PhysDiskNum, phys->PhysDiskID, vendor, productid, rev, phys->MaxLBA / (2 * 1024 * 1024)); printf(" state:"); } if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_ONLINE) { mpt_exit_mask |= MPT_EXIT_OKAY; printf(" ONLINE"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_MISSING) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" MISSING"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" NOT_COMPATIBLE"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_FAILED) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" FAILED"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_INITIALIZING) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; printf(" INITIALIZING"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; printf(" OFFLINE_REQUESTED"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_FAILED_REQUESTED) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" FAILED_REQUESTED"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_OTHER_OFFLINE) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; printf(" OTHER_OFFLINE"); } else { mpt_exit_mask |= MPT_EXIT_UNKNOWN; mpt_printf(" UNKNOWN"); } if (1 != print_status_only) { mpt_printf(" flags:"); if (phys->PhysDiskStatus.Flags) { if (phys->PhysDiskStatus.Flags & MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC) mpt_printf(" OUT_OF_SYNC"); if (phys->PhysDiskStatus.Flags & MPI_PHYSDISK0_STATUS_FLAG_QUIESCED) mpt_printf(" QUIESCED"); } else { mpt_printf(" NONE"); } /* SYNC RATE */ //mpt_printf(" sync_state: %d%%", GetResyncPercentageDisk(phys)); /* this is such a gross hack it's almost unbelieveable ... it will be fixed in the next release */ if (spare != 1) { mpt_printf(" sync_state: %d", sync_state[phys->PhysDiskID%2]); } else { mpt_printf(" sync_state: n/a"); } /* ASC/ASCQ information */ mpt_printf(" ASC/ASCQ:0x%02x/0x%02x SMART ASC/ASCQ:0x%02x/0x%02x", phys->ErrorData.ErrorASC, phys->ErrorData.ErrorASCQ, phys->ErrorData.SmartASC, phys->ErrorData.SmartASCQ); } /* since mpt_printf() returns without output when quiet mode is enabled we need to explicitly write that CR */ printf("\n"); } static void __print_physdisk_classic(RaidPhysDiskPage0_t *phys) { /* This function will go away for the next big release */ char vendor[BIG]; char productid[BIG]; char rev[BIG]; memset(vendor, 0, sizeof(vendor)); memset(productid, 0, sizeof(productid)); memset(rev, 0, sizeof(rev)); strncpy(vendor, (void *) phys->InquiryData.VendorID, sizeof(phys->InquiryData.VendorID)); strncpy(productid, (void *) phys->InquiryData.ProductID, sizeof(phys->InquiryData.ProductID)); strncpy(rev, (void *) phys->InquiryData.ProductRevLevel, sizeof(phys->InquiryData.ProductRevLevel)); if (1 == print_status_only) { printf("phys_id %d", phys->PhysDiskNum); } else { printf("ioc%d phy %d scsi_id %d %s %s %s, %d GB", phys->PhysDiskIOC, phys->PhysDiskNum, phys->PhysDiskID, vendor, productid, rev, phys->MaxLBA / (2 * 1024 * 1024)); printf(", state"); } if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_ONLINE) { mpt_exit_mask |= MPT_EXIT_OKAY; printf(" ONLINE"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_MISSING) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" MISSING"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" NOT_COMPATIBLE"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_FAILED) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" FAILED"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_INITIALIZING) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; printf(" INITIALIZING"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; printf(" OFFLINE_REQUESTED"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_FAILED_REQUESTED) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; printf(" FAILED_REQUESTED"); } else if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_OTHER_OFFLINE) { mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; printf(" OTHER_OFFLINE"); } else { mpt_exit_mask |= MPT_EXIT_UNKNOWN; mpt_printf(" UNKNOWN"); } if (1 != print_status_only) { mpt_printf(", flags"); if (phys->PhysDiskStatus.Flags) { if (phys->PhysDiskStatus.Flags & MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC) mpt_printf(" OUT_OF_SYNC"); if (phys->PhysDiskStatus.Flags & MPI_PHYSDISK0_STATUS_FLAG_QUIESCED) mpt_printf(" QUIESCED"); } else { mpt_printf(" NONE"); } } /* since mpt_printf() returns without output when quiet mode is enabled we need to explicitly write that CR */ printf("\n"); } static void do_init(void) { int save_errno; int status; if (auto_load > 0) { status = system("/sbin/modprobe mptctl"); if (status < 0 || 0 != WEXITSTATUS(status)) { mpt_fprintf(stderr, "Failed to load mptctl\n"); mpt_exit(MPT_EXIT_UNKNOWN|MPT_EXIT_NOCLOSE); } } m = open("/dev/mptctl", O_RDWR); if (-1 == m) { save_errno = errno; perror("open /dev/mptctl"); if (save_errno == EACCES) { mpt_fprintf(stderr, " Need root to run this program\n"); } else if (save_errno == ENOENT) { mpt_fprintf(stderr, " Try: mknod /dev/mptctl c 10 220\n"); } else if (save_errno == ENODEV) { mpt_fprintf(stderr, " Are you sure your controller" " is supported by mptlinux?\n"); } mpt_fprintf(stderr, "Make sure mptctl is loaded into the kernel\n"); mpt_exit(MPT_EXIT_UNKNOWN|MPT_EXIT_NOCLOSE); } } int main(int argc, char *argv[]) { int next_option; int option_index; char *progname = argv[0]; do { next_option = getopt_long(argc, argv, short_options, long_options, &option_index); switch (next_option) { case 'd': debug = 1; debug_level = strtoul(optarg, NULL, 10); break; case 'h': print_usage(progname); mpt_exit(MPT_EXIT_OKAY); break; case 'i': id_of_primary_device = strtoul(optarg, NULL, 10); break; case 'n': newstyle = 1; break; case 'p': probe_id = 1; break; case 'q': quiet_mode = 1; break; case 's': print_status_only = 1; break; case 'u': ioc_unit = strtoul(optarg, NULL, 10); break; case 'v': verbose_mode = 1; break; case 'V': print_version(); mpt_exit(MPT_EXIT_OKAY); break; case 0: if (sel == ARG_M_A) { auto_load++; } break; case -1: // Done with options break; default: print_usage(progname); mpt_exit(MPT_EXIT_UNKNOWN); break; } } while (next_option != -1); do_init(); if (newstyle > 0) { __check_endianess(); if (probe_id > 0) { id_of_primary_device = __probe_scsi_id2(); } /* This will be enabled and properly coded after the release if (hasVolume() > 0) { GetVolumeInfo(); } else { mpt_printf("No RAID is configured\n"); mpt_exit(MPT_EXIT_UNKNOWN); } */ GetVolumeInfo(); } else { /* this is the old style setup */ if (probe_id > 0) { id_of_primary_device = __probe_scsi_id2(); if (-1 == id_of_primary_device) { mpt_printf("Nothing found, contact the author\n"); mpt_exit(MPT_EXIT_UNKNOWN); } else { printf("Found SCSI id=%d, use ''mpt-status " "-i %d`` to get more information.\n", id_of_primary_device, id_of_primary_device); mpt_exit(MPT_EXIT_OKAY); } } GetVolumeInfo(); } return mpt_exit_mask; } mpt-status-1.2.0/mpt-status.h0100644000076500007650000000276710520066234014674 0ustar ratzratz#ifndef _MPT_STATUS_H #define _MPT_STATUS_H #include #ifdef __linux__ #include #endif #ifdef SANITIZED_KERNEL_HEADERS #include "mpt-sanitized.h" #else #ifndef __user #define __user #endif #ifndef __kernel #define __kernel #endif #include "pci.h" // config.h and header.h from pciutils package #include "lsi/mpi_type.h" #include "lsi/mpi.h" #include "lsi/mpi_ioc.h" #include "lsi/mpi_cnfg.h" #include "lsi/mpi_raid.h" #include "mptctl.h" //#include "mptbase.h" #endif // SANITIZED_KERNEL_HEADERS #define VERSION "1.2.0" #define BIG 1024 #define REALLYBIG 10240 #define PRINT_STATUS_ONLY 0 #define REPLY_SIZE 128 #define MPT_EXIT_OKAY (0) #define MPT_EXIT_VOL_OPTIMAL (0) #define MPT_EXIT_VOL_FAILED (1 << 1) #define MPT_EXIT_VOL_DEGRADED (1 << 2) #define MPT_EXIT_VOL_RESYNC (1 << 3) #define MPT_EXIT_PHYSDISK_ERROR (1 << 4) #define MPT_EXIT_PHYSDISK_WARN (1 << 5) #define MPT_EXIT_UNKNOWN (1 << 0) #define MPT_EXIT_NOCLOSE (1 << 10) #define MPT_EXIT_FREEMEM (1 << 11) #define DATA_DIR_NONE 0 #define DATA_DIR_IN 1 #define DATA_DIR_OUT 2 #define MPT_FLAGS_FREE_MEM 0x00 #define MPT_FLAGS_KEEP_MEM 0x01 #define MPT_FLAGS_DUMP_REPLY 0x02 #define MPT_FLAGS_DUMP_DATA 0x04 static char *wrong_scsi_id = "\nYou seem to have no SCSI disks attached to your HBA or you have\n" "them on a different scsi_id. To get your SCSI id, run:\n\n" " mpt-status -p\n"; typedef struct mpt_ioctl_command mpiIoctlBlk_t; #endif /* End of mpt-status.h */ mpt-status-1.2.0/man/0040755000076500007650000000000010522170351013142 5ustar ratzratzmpt-status-1.2.0/man/mpt-status.80100644000076500007650000000573510522170351015363 0ustar ratzratz.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH MPT-STATUS 8 "November 2006" .SH NAME mpt-status \- retrieve configuration and health status from LSI hardware RAID controllers .SH SYNOPSIS .B mpt-status [ options ] .SH DESCRIPTION The mpt-status software is a query tool to access the running configuration and status of LSI SCSI HBAs. mpt-status allows you to monitor the health and status of your RAID setup. .SH OPTIONS .TP .B \~ \^ \-\-autoload This will try to automatically load the mptctl kernel module. .TP .B \-u \-\-controller Set the IOC unit (controller). .TP .B \-h \-\-help Print some help information. .TP .B \-n \-\-newstyle Use the new style output. This parameter was introduced to retain backwards compatibility. If not set, you get the old style output. It is very likely that the output of the newstyle format will change heavily in the future, so do not rely on it when writing plugins for monitoring software, for example. .TP .B \-i \-\-set_id Set id of primary device (check README). .TP .B \-p \-\-probe_id Use this to probe SCSI id's when not on id 0. .TP .B \-q \-\-quiet Do not display any warnings. .TP .B \-s \-\-status_only Only print the status information. This can be used for easy scripting .TP .B \-v \-\-verbose Print verbose information, such as warnings .TP .B \-V \-\-version Print version information .TP .B \-d \-\-debug [] Enable debugging and set level optionally. NOTE: This is not fully implemented yet. .SH DIAGNOSTICS The program's exit(2) status is meant to be interpreted as a bit mask. If everything went well, zero is returned. If not (i.e. if for example an error or unknown condition is detected), the bits of the return value shall be interpreted as: .TS r r l ___ r r l. Bit Value Meaning 0 1 Abnormal condition / unknown error 1 2 A logical volume has failed 2 4 A logical volume is degraded 3 8 A logical volume is resyncing 4 16 At least one physical disk failed 5 32 At least one physical disk is in warning condition .TE .SH REPORTING BUGS Report bugs to your linux distribution or software vendor, if mpt-status was bundled on your installation. If you have been compiling mpt-status from the vanilla sources and experience problems, redirect them to preferably or . .SH BUGS Besides design bugs, gross software engineering and missing features, this software is considered pretty stable and can be used in production environments. .SH FILES .I /dev/mptctl .SH SEE ALSO LSI Logic provides CLI tools for megaraid controllers which you can find on their webpage, following http://www.lsil.com/cm/DownloadSearch.do .SH AUTHOR mpt-status was written by Roberto Nibali . .PP This manual page was written by Steffen Joeris , for the Debian project (but may be used by others). mpt-status-1.2.0/man/README0100644000076500007650000000106110520055727014024 0ustar ratzratzThis is the man page written by Steffen Joeris for the Debian project. I have shamelessly taken this from his patchset against mpt-status, which can be found here: http://packages.debian.org/unstable/admin/mpt-status The reasons I've done this, is that according to the man page I'm allowed to do so and there's absolutely no point in some other distribution not having a man page. It's all about the marginal unity of the distributions. I'd like to thank Steffen Joeris for his work (because the last time I've written a man page was probably in 1996).