[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: etch backport of mpt-status 1.2.0-4



Hi
> > I would very much like to see mpt-status 1.2.0-4 (currently in testing)
> > backported to etch as it allows you to monitor a number of RAID cards not
> > supported by the version of mpt-status in etch.
>
> Wouldn't you want to have it in a stable release update? If the changes are
> small, that would certainly be worth considering...
You want to approve this patch for a stable upload? Come on, surprise me ;)

Cheers
Steffen
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/Makefile /tmp/CUWG8NXatu/mpt-status-1.2.0/Makefile
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/Makefile	2006-03-04 13:18:43.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/Makefile	2006-11-01 19:02:30.000000000 +0000
@@ -1,41 +1,46 @@
 PROG		:= mpt-status
-KERNEL_PATH	:= /usr/src/linux
 PREFIX		:= /usr
-CFLAGS		:= -I${KERNEL_PATH}/drivers/message/fusion -Iincl -Wall -W -O2
-DFLAGS		:=
+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
+INSTALL		:= install -D
 ARCH		:= $(shell uname -m)
-REDHAT		:= $(shell if [ -e /etc/redhat-release ]; \
-				then echo "true"; else echo "false"; fi)
 
-ifeq "${REDHAT}" "true"
-	DFLAGS	:= ${FLAGS} -DREDHAT
-endif
 ifeq "${ARCH}" "sparc64"
-	CFLAGS	:= -I${KERNEL_PATH}/drivers/message/fusion -Iincl -Wall -W -O2 \
-		   -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
+	CFLAGS	:= -Iincl -Wall -W -O2 -m64 -pipe \
+			-mcpu=ultrasparc -mcmodel=medlow
 endif
-# This part is for the 1.2.0 version of mpt-status
-#ifeq "${ARCH}" "x86_64"
-#	CFLAGS	:= -I${KERNEL_PATH}/drivers/message/fusion -Iincl -Wall -W -O2 \
-#		   -m64
-#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} -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*
+	\rm -f core* *~
 
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/contrib/mpt-status-1.0.diff /tmp/CUWG8NXatu/mpt-status-1.2.0/contrib/mpt-status-1.0.diff
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/contrib/mpt-status-1.0.diff	2006-02-12 17:23:14.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/contrib/mpt-status-1.0.diff	1970-01-01 00:00:00.000000000 +0000
@@ -1,228 +0,0 @@
---- mpt-status.c
-+++ mpt-status.c
-@@ -25,17 +25,14 @@
- #include <errno.h>
- #include <stdint.h>
- #include <stdlib.h>
--#include <pci/pci.h>
-+#include <sys/pci.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <stdio.h>
- #include <sys/ioctl.h>
- 
--#include "mptctl.h"
--#include "lsi/mpi_type.h"
--#include "lsi/mpi.h"
--#include "lsi/mpi_ioc.h"
--#include "lsi/mpi_cnfg.h"
-+#include <stdint.h>
-+#include "mpt-status.h"
- 
- #define BIG 1024
- #define REALLYBIG 10240
---- mpt-status.h
-+++ mpt-status.h
-@@ -0,0 +1,202 @@
-+#ifndef _MPT_STATUS_H_
-+#define _MPT_STATUS_H_
-+
-+#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];
-+};
-+#endif				/* _MPT_STATUS_H_ */
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/contrib/mpt-status.spec /tmp/CUWG8NXatu/mpt-status-1.2.0/contrib/mpt-status.spec
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/contrib/mpt-status.spec	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/contrib/mpt-status.spec	2006-06-30 22:21:41.000000000 +0000
@@ -0,0 +1,47 @@
+Summary: 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 <jp.civade@100p100.net> - 1.1.3-0
+- Initial package.
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/contrib/sizes.c /tmp/CUWG8NXatu/mpt-status-1.2.0/contrib/sizes.c
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/contrib/sizes.c	2006-02-12 16:09:58.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/contrib/sizes.c	2006-10-25 08:24:52.000000000 +0000
@@ -1,6 +1,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+/* 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"
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/changelog /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/changelog
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/changelog	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/changelog	2007-08-01 11:27:53.000000000 +0000
@@ -1,10 +1,40 @@
-mpt-status (1.1.6-13) unstable; urgency=high
+mpt-status (1.2.0-4) unstable; urgency=high
 
-  * Severity set to high as it fixes an RC bug
-  * Add dependency against mailx as it is needed by the init script
-    to deliver mails in case of failure (Closes: #411746)
+  * High urgency for RC bugfix
+  * Fix FTBFS with 20-compiler.patch to remove include for
+    linux/compiler.h from the header file, which is no longer available
+    with the switch to linux-libc-dev (Closes: #423789)
+    Thanks to Steve Langasek for the patch
+  * Change arch field to any as it might also be useful for other archs
+  * Bump debhelper level to 5
+
+ -- Steffen Joeris <white@debian.org>  Mon, 14 May 2007 21:12:10 +1000
+
+mpt-status (1.2.0-3) unstable; urgency=low
+
+  * Upload to unstable (Closes: #390923)
+
+ -- Steffen Joeris <white@debian.org>  Mon, 23 Apr 2007 07:01:26 +1000
+
+mpt-status (1.2.0-2) experimental; urgency=low
+
+  * Add dependency against mailx which is needed by the init script
+    to report failures (see #411746)
+
+ -- Steffen Joeris <white@debian.org>  Thu, 22 Feb 2007 00:01:03 +1100
+
+mpt-status (1.2.0-1) experimental; urgency=low
+
+  * New upstream release
+   - Fixed version string (Closes: #390921)
+  * Drop 20-nonlinux.patch as it got included by upstream
+  * Include mpi_raid.h from kernel source package to debian/includes
+  * Include patch to improve the output of mpt-statusd and internal
+    functions, thanks to Jochen Pawletta
+  * Drop debian/mpt-status.8 manpage as it is now included by upstream
+  * Thanks to Petter Reinholdtsen for testing and hardware access
 
- -- Steffen Joeris <white@debian.org>  Wed, 21 Feb 2007 23:41:05 +1100
+ -- Steffen Joeris <white@debian.org>  Wed, 17 Jan 2007 17:23:34 +0100
 
 mpt-status (1.1.6-12) unstable; urgency=medium
 
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/compat /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/compat
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/compat	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/compat	2007-08-01 11:27:53.000000000 +0000
@@ -1 +1 @@
-4
+5
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/control /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/control
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/control	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/control	2007-08-01 11:27:53.000000000 +0000
@@ -2,11 +2,11 @@
 Section: admin
 Priority: extra
 Maintainer: Steffen Joeris <white@debian.org>
-Build-Depends: cdbs, debhelper (>= 4.1.0), pciutils-dev
+Build-Depends: cdbs, debhelper (>= 5), pciutils-dev
 Standards-Version: 3.7.2
 
 Package: mpt-status
-Architecture: i386 ia64 amd64 kfreebsd-i386 knetbsd-i386 kfreebsd-amd64
+Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base, daemon, mailx
 Description: get RAID status out of mpt (and other) HW RAID controllers
  The mpt-status software is a query tool to access the running
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/includes/mpi_raid.h /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/includes/mpi_raid.h
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/includes/mpi_raid.h	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/includes/mpi_raid.h	2007-08-01 11:27:53.000000000 +0000
@@ -0,0 +1,245 @@
+/*
+ *  Copyright (c) 2001-2005 LSI Logic Corporation.
+ *
+ *
+ *           Name:  mpi_raid.h
+ *          Title:  MPI RAID message and structures
+ *  Creation Date:  February 27, 2001
+ *
+ *    mpi_raid.h Version:  01.05.02
+ *
+ *  Version History
+ *  ---------------
+ *
+ *  Date      Version   Description
+ *  --------  --------  ------------------------------------------------------
+ *  02-27-01  01.01.01  Original release for this file.
+ *  03-27-01  01.01.02  Added structure offset comments.
+ *  08-08-01  01.02.01  Original release for v1.2 work.
+ *  09-28-01  01.02.02  Major rework for MPI v1.2 Integrated RAID changes.
+ *  10-04-01  01.02.03  Added ActionData defines for
+ *                      MPI_RAID_ACTION_DELETE_VOLUME action.
+ *  11-01-01  01.02.04  Added define for MPI_RAID_ACTION_ADATA_DO_NOT_SYNC.
+ *  03-14-02  01.02.05  Added define for MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT.
+ *  05-07-02  01.02.06  Added define for MPI_RAID_ACTION_ACTIVATE_VOLUME,
+ *                      MPI_RAID_ACTION_INACTIVATE_VOLUME, and
+ *                      MPI_RAID_ACTION_ADATA_INACTIVATE_ALL.
+ *  07-12-02  01.02.07  Added structures for Mailbox request and reply.
+ *  11-15-02  01.02.08  Added missing MsgContext field to MSG_MAILBOX_REQUEST.
+ *  04-01-03  01.02.09  New action data option flag for
+ *                      MPI_RAID_ACTION_DELETE_VOLUME.
+ *  05-11-04  01.03.01  Original release for MPI v1.3.
+ *  08-19-04  01.05.01  Original release for MPI v1.5.
+ *  01-15-05  01.05.02  Added defines for the two new RAID Actions for
+ *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
+ *  --------------------------------------------------------------------------
+ */
+
+#ifndef MPI_RAID_H
+#define MPI_RAID_H
+
+
+/******************************************************************************
+*
+*        R A I D    M e s s a g e s
+*
+*******************************************************************************/
+
+
+/****************************************************************************/
+/* RAID Action Request                                                      */
+/****************************************************************************/
+
+typedef struct _MSG_RAID_ACTION
+{
+    U8                      Action;             /* 00h */
+    U8                      Reserved1;          /* 01h */
+    U8                      ChainOffset;        /* 02h */
+    U8                      Function;           /* 03h */
+    U8                      VolumeID;           /* 04h */
+    U8                      VolumeBus;          /* 05h */
+    U8                      PhysDiskNum;        /* 06h */
+    U8                      MsgFlags;           /* 07h */
+    U32                     MsgContext;         /* 08h */
+    U32                     Reserved2;          /* 0Ch */
+    U32                     ActionDataWord;     /* 10h */
+    SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */
+} MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,
+  MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;
+
+
+/* RAID Action request Action values */
+
+#define MPI_RAID_ACTION_STATUS                      (0x00)
+#define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)
+#define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)
+#define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)
+#define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)
+#define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)
+#define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)
+#define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)
+#define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)
+#define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)
+#define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)
+#define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)
+#define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)
+#define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)
+#define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)
+#define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)
+#define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)
+#define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)
+#define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
+#define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
+
+/* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
+#define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
+#define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)
+
+/* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */
+#define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)
+#define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)
+
+#define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
+#define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
+
+/* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
+#define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
+
+/* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */
+#define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)
+
+/* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */
+#define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)
+
+
+
+/* RAID Action reply message */
+
+typedef struct _MSG_RAID_ACTION_REPLY
+{
+    U8                      Action;             /* 00h */
+    U8                      Reserved;           /* 01h */
+    U8                      MsgLength;          /* 02h */
+    U8                      Function;           /* 03h */
+    U8                      VolumeID;           /* 04h */
+    U8                      VolumeBus;          /* 05h */
+    U8                      PhysDiskNum;        /* 06h */
+    U8                      MsgFlags;           /* 07h */
+    U32                     MsgContext;         /* 08h */
+    U16                     ActionStatus;       /* 0Ch */
+    U16                     IOCStatus;          /* 0Eh */
+    U32                     IOCLogInfo;         /* 10h */
+    U32                     VolumeStatus;       /* 14h */
+    U32                     ActionData;         /* 18h */
+} MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,
+  MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;
+
+
+/* RAID Volume reply ActionStatus values */
+
+#define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)
+#define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)
+#define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)
+#define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)
+
+
+/* RAID Volume reply RAID Volume Indicator structure */
+
+typedef struct _MPI_RAID_VOL_INDICATOR
+{
+    U64                     TotalBlocks;        /* 00h */
+    U64                     BlocksRemaining;    /* 08h */
+} MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,
+  MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;
+
+
+/****************************************************************************/
+/* SCSI IO RAID Passthrough Request                                         */
+/****************************************************************************/
+
+typedef struct _MSG_SCSI_IO_RAID_PT_REQUEST
+{
+    U8                      PhysDiskNum;        /* 00h */
+    U8                      Reserved1;          /* 01h */
+    U8                      ChainOffset;        /* 02h */
+    U8                      Function;           /* 03h */
+    U8                      CDBLength;          /* 04h */
+    U8                      SenseBufferLength;  /* 05h */
+    U8                      Reserved2;          /* 06h */
+    U8                      MsgFlags;           /* 07h */
+    U32                     MsgContext;         /* 08h */
+    U8                      LUN[8];             /* 0Ch */
+    U32                     Control;            /* 14h */
+    U8                      CDB[16];            /* 18h */
+    U32                     DataLength;         /* 28h */
+    U32                     SenseBufferLowAddr; /* 2Ch */
+    SGE_IO_UNION            SGL;                /* 30h */
+} MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,
+  SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;
+
+
+/* SCSI IO RAID Passthrough reply structure */
+
+typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
+{
+    U8                      PhysDiskNum;        /* 00h */
+    U8                      Reserved1;          /* 01h */
+    U8                      MsgLength;          /* 02h */
+    U8                      Function;           /* 03h */
+    U8                      CDBLength;          /* 04h */
+    U8                      SenseBufferLength;  /* 05h */
+    U8                      Reserved2;          /* 06h */
+    U8                      MsgFlags;           /* 07h */
+    U32                     MsgContext;         /* 08h */
+    U8                      SCSIStatus;         /* 0Ch */
+    U8                      SCSIState;          /* 0Dh */
+    U16                     IOCStatus;          /* 0Eh */
+    U32                     IOCLogInfo;         /* 10h */
+    U32                     TransferCount;      /* 14h */
+    U32                     SenseCount;         /* 18h */
+    U32                     ResponseInfo;       /* 1Ch */
+} MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,
+  SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;
+
+
+/****************************************************************************/
+/* Mailbox reqeust structure */
+/****************************************************************************/
+
+typedef struct _MSG_MAILBOX_REQUEST
+{
+    U16                     Reserved1;
+    U8                      ChainOffset;
+    U8                      Function;
+    U16                     Reserved2;
+    U8                      Reserved3;
+    U8                      MsgFlags;
+    U32                     MsgContext;
+    U8                      Command[10];
+    U16                     Reserved4;
+    SGE_IO_UNION            SGL;
+} MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,
+  MailboxRequest_t, MPI_POINTER pMailboxRequest_t;
+
+
+/* Mailbox reply structure */
+typedef struct _MSG_MAILBOX_REPLY
+{
+    U16                     Reserved1;          /* 00h */
+    U8                      MsgLength;          /* 02h */
+    U8                      Function;           /* 03h */
+    U16                     Reserved2;          /* 04h */
+    U8                      Reserved3;          /* 06h */
+    U8                      MsgFlags;           /* 07h */
+    U32                     MsgContext;         /* 08h */
+    U16                     MailboxStatus;      /* 0Ch */
+    U16                     IOCStatus;          /* 0Eh */
+    U32                     IOCLogInfo;         /* 10h */
+    U32                     Reserved4;          /* 14h */
+} MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,
+  MailboxReply_t, MPI_POINTER pMailboxReply_t;
+
+#endif
+
+
+
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/manpages /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/manpages
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/manpages	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/manpages	2007-08-01 11:27:53.000000000 +0000
@@ -1 +1 @@
-debian/mpt-status.8
+man/mpt-status.8
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/mpt-status.8 /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/mpt-status.8
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/mpt-status.8	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/mpt-status.8	1970-01-01 00:00:00.000000000 +0000
@@ -1,50 +0,0 @@
-.\"                                      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 "February  10, 2006"
-.SH NAME
-mpt-status \-get RAID status out of mpt (and other) HW RAID controllers
-.SH SYNOPSIS
-.B mpt-status [ options ]
-.SH DESCRIPTION
-.B mpt-status
-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.
-.PP
-.SH OPTIONS
-.TP
-.B \-\-autoload 
-This will try to automatically load mptctl.
-.TP
-.B \-u \-\-controller <int>
-Set the IOC unit (controller).
-.TP
-.B \-h \-\-help
-Print some help information.
-.TP
-.B \-i \-\-set_id <int>
-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 \-\-quit
-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
-.SH AUTHOR
-mpt-status was written by Roberto Nibali <ratz@drugphish.ch>.
-.PP
-This manual page was written by Steffen Joeris <steffen.joeris@skolelinux.de>,
-for the Debian project (but may be used by others).
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/mpt-status.init /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/mpt-status.init
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/mpt-status.init	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/mpt-status.init	2007-08-01 11:27:53.000000000 +0000
@@ -129,16 +129,16 @@
 d_start() {
     [ -f $PIDFILE ] && PID="`cat $PIDFILE`"
     if [ "$PID" ] ; then
-        echo "Daemon already running.  Refusing to start another"
-        exit 0
+        log_progress_msg "Daemon already running. Refusing to start another"
+        return 0
     elif check_daemon ; then
         # Use the daemon package to turn this script into a daemon
         start-stop-daemon --start --quiet --pidfile $PIDFILE \
                 --oknodo --exec /usr/bin/daemon $SCRIPTNAME check_mpt
-	exit 0
+	return 0
     else
-        echo "Daemon is already running. Refusing to start another"
-        exit 0
+        log_progress_msg "Daemon is already running. Refusing to start another"
+        return 0
     fi
 }
 
@@ -149,12 +149,10 @@
         if [ -f $PIDFILE ] ; then
                 start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE
                 rm -f $PIDFILE
-                log_end_msg 0
-                exit 0
+                return 0
         else
-                log_begin_msg "Daemon is already stopped."
-                log_end_msg 0
-                exit 0
+                log_progress_msg "Daemon is already stopped."
+                return 0
         fi
 }
 
@@ -166,7 +164,7 @@
                 rm -f $PIDFILE
                 log_end_msg 0
         else
-                log_begin_msg "Daemon is already stopped."
+                log_progress_msg "Daemon is already stopped."
                 log_end_msg 0
         fi
 }
@@ -175,12 +173,12 @@
   start)
         echo -n ""
         log_begin_msg "Starting $DESC: $NAME"
-        d_start || CODE=$?
+        d_start ; CODE=$?
         log_end_msg $CODE
         ;;
   stop)
         log_begin_msg "Stopping $DESC: $NAME"
-        d_stop || CODE=$?
+        d_stop ; CODE=$?
         log_end_msg $CODE
         ;;
   check_mpt)
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/patches/10-include.patch /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/patches/10-include.patch
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/patches/10-include.patch	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/patches/10-include.patch	2007-08-01 11:27:53.000000000 +0000
@@ -1,21 +1,23 @@
---- mpt-status.h.orig	2006-03-04 18:26:01.000000000 +0100
-+++ mpt-status.h	2006-03-04 18:29:50.000000000 +0100
-@@ -21,12 +21,12 @@
- #endif // __x86_64__ 
- */
- 
+--- mpt-status.h.orig	2007-01-16 15:07:36.000000000 +0100
++++ mpt-status.h	2007-01-16 22:43:15.000000000 +0100
+@@ -15,13 +15,13 @@
+ #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 <pci/pci.h>	// config.h and header.h from pciutils package
 +#include "debian/includes/mpi_type.h"
 +#include "debian/includes/mpi.h"
 +#include "debian/includes/mpi_ioc.h"
 +#include "debian/includes/mpi_cnfg.h"
++#include "debian/includes/mpi_raid.h"
 +#include "debian/includes/mptctl.h"
- 
- #define VERSION "1.1.5"
+ //#include "mptbase.h"
+ #endif // SANITIZED_KERNEL_HEADERS
  
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/patches/20-compiler.patch /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/patches/20-compiler.patch
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/patches/20-compiler.patch	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/patches/20-compiler.patch	2007-08-01 11:27:53.000000000 +0000
@@ -0,0 +1,13 @@
+--- mpt-status-1.2.0.orig/mpt-status.h
++++ mpt-status-1.2.0/mpt-status.h
+@@ -2,9 +2,6 @@
+ #define _MPT_STATUS_H
+ 
+ #include <sys/ioctl.h>
+-#ifdef __linux__
+-#include <linux/compiler.h>
+-#endif
+ 
+ #ifdef SANITIZED_KERNEL_HEADERS
+ #include "mpt-sanitized.h"
+
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/patches/20-nonlinux.patch /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/patches/20-nonlinux.patch
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/debian/patches/20-nonlinux.patch	2007-08-01 11:27:52.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/debian/patches/20-nonlinux.patch	1970-01-01 00:00:00.000000000 +0000
@@ -1,10 +0,0 @@
---- mpt-status.c.orig	2006-04-15 12:20:51.000000000 +0200
-+++ mpt-status.c	2006-04-15 12:20:56.000000000 +0200
-@@ -33,7 +33,6 @@
- #include <getopt.h>
- 
- #include <sys/ioctl.h>
--#include <linux/compiler.h>
- #include "mpt-status.h"
- 
- #define ARG_M_A 0x0001
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/AUTHORS /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/AUTHORS
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/AUTHORS	2006-02-12 15:24:35.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/AUTHORS	2006-11-01 08:27:36.000000000 +0000
@@ -2,4 +2,4 @@
 Matthew Braithwaite <mab@red-bean.com>
 
 New author (see Changelog):
-Roberto Nibali, ratz <ratz@drugphish.ch,ratz@terreactive.ch>
+Roberto Nibali, ratz <ratz@drugphish.ch,rnibali@pyx.ch,roberto.nibali@ubs.com>
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/Changelog /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/Changelog
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/Changelog	2006-03-06 18:21:22.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/Changelog	2006-11-01 19:01:28.000000000 +0000
@@ -1,7 +1,95 @@
+2006-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]:
-	* Version: 1.1.6 [released] (Codename: Brown Paper Bag I)
 	o mpt-status.c
-		- commented out SGE pointer debug information
+		- 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)
@@ -22,7 +110,7 @@
 		  too many people complained about it and before the kernel
 		  headers are not sanitized, there is no point in trying to
 		  address this deficiency
-		- prelimiary work done for IOCpage5_t support (hotspare)
+		- 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
@@ -38,11 +126,12 @@
 	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
+		- 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
-		- reorganised long_options and usage to be in alphabetical
+		- reorganized long_options and usage to be in alphabetical
 		  order
 		- fixed read_page to actually work on LSI-SAS1064 controllers
 	o doc/*
@@ -72,7 +161,7 @@
 		- 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 legimit C code ;).
+		- 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
@@ -175,7 +264,7 @@
 2005-05-18, ratz [ratz@tac.ch]:
 	* Version: 1.1.0
 	o mpt-status.c
-		- impoved output handling
+		- 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
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/DeveloperNotes /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/DeveloperNotes
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/DeveloperNotes	2006-02-12 19:04:09.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/DeveloperNotes	2006-11-01 08:26:29.000000000 +0000
@@ -1,3 +1,9 @@
+Regarding 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
@@ -51,7 +57,8 @@
 Random Notes
 ------------
 The includes pci.h, config.h, header.h are from pciutils. Most distros might
-have a pciutils-devel package or somthing similar.
+have a pciutils-devel package or something similar.
+
 
 Directory structure
 -------------------
@@ -73,38 +80,20 @@
 ./contrib/mpt-status.spec
 
 
-Porting to 64bit
-----------------
-The following is a working output of the 64bit ioctl access:
-
-open("/dev/mptctl", O_RDWR)             = 3
-brk(0)                                  = 0x502000
-brk(0x525000)                           = 0x525000
-ioctl(3, 0xc0486d14, 0x7fbfffc100)      = 0
-ioctl(3, 0xc0486d14, 0x7fbfffc100)      = 0
-fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
-mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a9556c000
-write(1, "ioc0 vol 0 type IS, 0 phy, 0 GB,"..., 47ioc0 vol 0 type IS, 0 phy, 0 GB, state OPTIMAL
-) = 47
-munmap(0x2a9556c000, 4096)              = 0
-exit_group(0)                           = ?
-
-cpp9:/home/ratz # ltrace mpt-status
-__libc_start_main(0x400b00, 1, 0x7fbffff698, 0x400ff0, 0x400fa0 <unfinished ...>
-system("/sbin/modprobe mptctl" <unfinished ...>
---- SIGCHLD (Child exited) ---
-<... system resumed> )                           = 0
-open("/dev/mptctl", 2, 00)                       = 3
-calloc(10240, 1)                                 = 0x502010
-memset(0x7fbfffc100, '\000', 10240)              = 0x7fbfffc100
-memset(0x7fbfff9900, '\000', 10240)              = 0x7fbfff9900
-memset(0x7fbfff7100, '\000', 10240)              = 0x7fbfff7100
-ioctl(3, -1068995308, 0x7fbfffc100)              = 0
-ioctl(3, -1068995308, 0x7fbfffc100)              = 0
-printf("ioc%d vol %d type %s, %d phy, %d"..., 0, 0, "IS", 0, 0) = 31
-printf(", state")                                = 7
-printf(" OPTIMAL")                               = 8
-putchar(10, 0x401195, 0, 8, 0x2a95894b00ioc0 vol 0 type IS, 0 phy, 0 GB, state OPTIMAL
-)        = 10
-+++ exited (status 0) +++
+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.
 
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/FAQ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/FAQ
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/FAQ	2006-03-04 14:55:03.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/FAQ	2006-11-01 08:24:48.000000000 +0000
@@ -28,11 +28,11 @@
 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 ?
+> 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 abreviations ?
+> 2) Could you give the meaning of these abbreviations?
 
 Maybe:
 
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/INSTALL /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/INSTALL
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/INSTALL	2006-02-12 15:24:35.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/INSTALL	2006-10-26 06:57:27.000000000 +0000
@@ -9,9 +9,15 @@
 	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 minor tweak the Makefile shipped with this
+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
 ----------------------------
@@ -38,6 +44,12 @@
 
 	/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
 ------------------------------
@@ -59,6 +71,12 @@
 
 	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)
 --------------------------------------------------------------------------
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/README /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/README
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/README	2006-03-04 14:15:14.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/README	2006-11-02 08:58:17.000000000 +0000
@@ -1,7 +1,7 @@
 About
 -----
 The mpt-status software is a query tool to access the running configuration and
-status of LSI SCSI HBAs. This is a heavily modified version of the original
+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.
 
@@ -9,12 +9,34 @@
 
 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/
@@ -31,7 +53,7 @@
 --------+-----------+---------------------------------------------------------
 Debian	| OK        | http://packages.debian.org/unstable/admin/mpt-status
 --------+-----------+---------------------------------------------------------
-SuSE	| NOK (old) | http://www.novell.com/products/linuxpackages/professional/mpt-status.html
+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
 --------+-----------+---------------------------------------------------------
 
@@ -41,7 +63,7 @@
     PLD 
     Turbolinux
 
-I have provided spec (for RPM) files for OpenSuSE and Red Hat, however they are
+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.
 
 
@@ -89,13 +111,23 @@
 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, SLES8, SLES9
-Redhat		: 7.3, 9.0, RHEL3, RHEL4, FC1, FC2, FC3, FC4
+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
 
@@ -104,8 +136,7 @@
 
 Architectures:
 i386
-x86_64 (currently broken for some systems, EMT64 works)
-ultra sparc (only compilation)
+x86_64
 
 
 List of Hardware configuration
@@ -120,7 +151,3 @@
 dmesg -s 1000000 (best after having rebooted your machine)
 lspci -v
 dmidecode
-
-The current list of working hardware configuration is:
-
-[TBW]
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/ReleaseNotes /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/ReleaseNotes
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/ReleaseNotes	2006-03-06 18:23:32.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/ReleaseNotes	2006-11-01 13:51:52.000000000 +0000
@@ -1,11 +1,18 @@
-Release Notes mpt-status 1.1.6 (2006-03-06)
+Release Notes mpt-status 1.2.0 (2006-11-03)
 ==============================
-Codename: Brown Paper Bag I
+Codename: <Zidane>
+
+[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 heavily modified version of the original
+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.
 
@@ -13,6 +20,8 @@
 
 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
@@ -29,26 +38,45 @@
 
 General Information
 -------------------
-This release brings you following fixes and new things:
-
-o Removed debugging statements in the normal output
-
-Please skip version 1.1.5!
+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
 -------
-No problems are expected when upgrading from the previous (1.1.4) version.
+You can upgrade mpt-status without any problems. This has been widely tested
+by a broad user base.
 
 
 Outlook
 -------
-The next version will bring 64bit support and based on this, sanitized kernel
-headers. SuSE and Debian folks have already started this, however only for a
-limited range of machine types. Another thing that will be worked on is the
-much requested report of the spare disk and a /proc/mdstat like percentage
-output to completion of the synchronisation process.
-
-The next version will probably also break your scripts, because the output
-format will slightely be changed to make more sense. This is a heads-up for the
-distro maintainters.
+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.
+
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/THANKS /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/THANKS
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/THANKS	2006-03-04 14:45:47.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/THANKS	2006-11-01 08:47:46.000000000 +0000
@@ -1,7 +1,8 @@
 This file is to thank all the contributors of this software. There is no
-specific order or preference, it's a silly little tool anyway ;).
+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
@@ -14,11 +15,21 @@
 			  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
+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, please drop me an email and I will add you to this
-hall of fame list.
+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.
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/TODO /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/TODO
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/doc/TODO	2006-02-12 15:24:36.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/doc/TODO	2006-05-02 17:29:05.000000000 +0000
@@ -1,17 +1,17 @@
 This file is a wishlist compiled out of various people's ideas. It should
 eventually be prioritized into "important, normal, nice to have".
 
-
-Ratz' ideas
------------
 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 support for spare disk status output 
-o sanitize kernel headers and remove the __user and __kernel stuff
-o test 64bit
-
+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:
 
-User requests
--------------
-o [Klaus Ade Johnstad] add raid status line of sync process, like /proc/mdstat
+ #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)
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/incl/mpt-sanitized.h /tmp/CUWG8NXatu/mpt-status-1.2.0/incl/mpt-sanitized.h
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/incl/mpt-sanitized.h	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/incl/mpt-sanitized.h	2006-04-24 17:29:46.000000000 +0000
@@ -0,0 +1,198 @@
+#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];
+};
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/incl/sles.h /tmp/CUWG8NXatu/mpt-status-1.2.0/incl/sles.h
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/incl/sles.h	2006-02-12 17:42:35.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/incl/sles.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,198 +0,0 @@
-#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];
-};
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/man/README /tmp/CUWG8NXatu/mpt-status-1.2.0/man/README
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/man/README	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/man/README	2006-10-26 06:55:19.000000000 +0000
@@ -0,0 +1,12 @@
+This 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).
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/man/mpt-status.8 /tmp/CUWG8NXatu/mpt-status-1.2.0/man/mpt-status.8
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/man/mpt-status.8	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/man/mpt-status.8	2006-11-01 19:09:29.000000000 +0000
@@ -0,0 +1,99 @@
+.\"                                      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 <int>
+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 <int>
+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 [<int>]
+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 <ratz@drugphish.ch> or <rnibali@pyx.ch>.
+
+.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 <ratz@drugphish.ch>.
+.PP
+This manual page was written by Steffen Joeris <steffen.joeris@skolelinux.de>,
+for the Debian project (but may be used by others).
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/mpt-status.c /tmp/CUWG8NXatu/mpt-status-1.2.0/mpt-status.c
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/mpt-status.c	2006-03-06 18:19:44.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/mpt-status.c	2006-11-01 09:13:35.000000000 +0000
@@ -5,6 +5,7 @@
 
 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
@@ -23,17 +24,17 @@
 
 */
 
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <stdarg.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
 #include <getopt.h>
-
-#include <sys/ioctl.h>
-#include <linux/compiler.h>
+#include <netinet/in.h>
 #include "mpt-status.h"
 
 #define ARG_M_A 0x0001
@@ -45,6 +46,12 @@
 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[] = {
@@ -52,362 +59,1065 @@
 	{ "controller",		required_argument, NULL, 'u' },
 	{ "debug",		optional_argument, NULL, 'd' },
 	{ "help",		no_argument,       NULL, 'h' },
-	{ "status_only",	no_argument,       NULL, 's' },
+	{ "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:pqsu:vV";
+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 mptctl\n"
-  "  -u, --controller <int>     Set the IOC unit (controller)\n"
+  "      --autoload             This will try to automatically load the \n"
+  "                             mptctl kernel module\n"
   "  -d, --debug [<int>]        Enable debugging and set level optionally\n"
-  "                             NOTE: This is not implemented yet\n"
+  "                             NOTE: This is not fully implemented yet\n"
   "  -h, --help                 Print this help information page\n"
-  "  -i, --set_id <int>         Set id of primary device (check README)\n"
-  "  -p, --probe_id		Use this to probe SCSI id's when not on id 0\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"
-  "  -s, --status_only		Only print the status information. This can\n"
+  "  -i, --set_id <int>         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 <int>     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 int print_status_only = PRINT_STATUS_ONLY;
-static int id_of_primary_device = 0;
-static int ioc_unit = 0;
 
-static void print_usage(const char *progname) {
-        printf(usage_template, progname);
+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 void print_version(void) {
-	printf("Version: %s\n", VERSION);
+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;
 }
 
-/*
-// 32bit version
-static void *read_page(U8 pagetype, U8 pagewhich, U8 pagenumber,
-			U32 address, U8 version) {
-*/
-// original
-static void *read_page(unsigned int pagetype, unsigned int pagewhich,
-			unsigned int pagenumber, unsigned int address,
-			unsigned int version) {
-/*
-// 64bit version 
-static void *read_page(uint8_t pagetype, uint8_t pagewhich,
-			uint8_t pagenumber, uint32_t address,
-			uint8_t version) {
-*/
-	char command[REALLYBIG];
-	char reply[REALLYBIG];
-	char sense[REALLYBIG];
-	char *in;
-	unsigned int warnings;
-	struct mpt_ioctl_command *cmd;
-	Config_t *config_request;
-	ConfigReply_t *config_reply;
-	unsigned short div = sizeof(char *); /* this is fishy */
-
-	if (NULL == (in = calloc(REALLYBIG, 1))) {
-		perror("calloc");
-		exit(EXIT_FAILURE);
-	}
-
-	warnings = 0;
-	cmd = (struct mpt_ioctl_command *)command;
-	config_request = (Config_t *) cmd->MF;
-	config_reply = (ConfigReply_t *) reply;
-
-	memset((void *)command, 0, sizeof(command));
-	memset((void *)reply, 0, sizeof(reply));
-	memset((void *)sense, 0, sizeof(sense));
-	memset((void *)in, 0, sizeof(in));
-
-	cmd->hdr.iocnum = ioc_unit;
-	cmd->hdr.port = 0;
-	cmd->hdr.maxDataSize = BIG;
-	cmd->timeout = 10;
-	cmd->dataSgeOffset = (((char *)&config_request->PageBufferSGE) -
-	     ((char *)config_request)) / div;
-	/*
-	printf("SGE ptr: %p\n", (char *)&config_request->PageBufferSGE);
-	printf("conf ptr: %p\n", (char *)config_request);
-	printf("dataSgeOffset: %d\n", cmd->dataSgeOffset);
-	*/
-	cmd->senseDataPtr = (void *)sense;
-	cmd->replyFrameBufPtr = (void *)config_reply;
-	cmd->dataInBufPtr = (void *)in;
-	cmd->maxSenseBytes = BIG;
-	cmd->maxReplyBytes = BIG;
-	cmd->dataInSize = BIG;
-
-	config_request->Function = MPI_FUNCTION_CONFIG;
-	config_request->Action = MPI_CONFIG_ACTION_PAGE_HEADER;
-	config_request->Header.PageType = pagetype;
-	config_request->Header.PageNumber = pagenumber;
-	config_request->Header.PageLength = 0;
-	config_request->Header.PageVersion = 0;
-	config_request->PageAddress = address;
-
-	if (-1 == ioctl(m, MPTCOMMAND, cmd)) {
-		perror("MPI_FUNCTION_CONFIG (get page header)");
-		exit(EXIT_FAILURE);
-	}
-
-	if (version != config_reply->Header.PageVersion) {
-		if (verbose_mode > 0) {
-			fprintf(stderr,
-				"Version mismatch on pagetype %u, page number %u: expected %d, got %d\n",
-				pagetype, pagenumber, version,
-				config_reply->Header.PageVersion);
-		}
-		/* Enable the following to automatically output a warning */
-		//warnings++;
+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;
+}
 
-	config_request->Action = pagewhich;
-	config_request->Header.PageLength = config_reply->Header.PageLength;
+static int allocReplyFrame(void) {
+	mpiBlkPtr->replyFrameBufPtr = (char *) &g_reply;
+	memset (mpiBlkPtr->replyFrameBufPtr, 0, REPLY_SIZE);
+	mpiBlkPtr->maxReplyBytes = REPLY_SIZE;
+	return 0;
+}
 
-	/*
-	 * Is this check really necessary (255 is max anyway)? --ratz
-	 * config_reply->Header.PageLength is U8.
-	if (config_reply->Header.PageLength > UINT8_MAX) {
-		fprintf(stderr, "reply too big\n");
-		exit(EXIT_FAILURE);
+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;
+}
 
-	if (-1 == ioctl(m, MPTCOMMAND, cmd)) {
-		perror("MPI_FUNCTION_CONFIG (get page)");
-		exit(EXIT_FAILURE);
+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 (warnings > 0 && quiet_mode == 0 && verbose_mode != 0) {
-		fprintf(stderr, "\nHouston, we have got a problem!"
-				" If you're interested in the warnings or you"
-				" were asked to send verbose information, add"
-				" the '-v' switch to your command line\n");
+	if (status & MPT_EXIT_NOCLOSE) {
+		close(m);
 	}
-	return in;
+	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 __probe_scsi_id() {
+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;
-	int ioc = 0;
-	RaidVolumePage0_t *page;
 
 	for (scsi_id = 0; scsi_id < 16; scsi_id++) {
-		page = read_page(MPI_CONFIG_PAGETYPE_RAID_VOLUME,
-			 MPI_CONFIG_ACTION_PAGE_READ_CURRENT,
-			 ioc,
-			 scsi_id,
-			 MPI_RAIDVOLPAGE0_PAGEVERSION);
-		if (0 != page->NumPhysDisks) {
-			/* found the first 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;
 		}
 	}
-	/* nothing found */
+	freeMem();
 	return -1;
 }
 
-static void print_information() {
-	RaidVolumePage0_t *page;
-	RaidPhysDiskPage0_t *phys;
-	//IOCPage5_t *ioc_hotspare;
-	char *VolumeTypes[] = { "IS", "IME", "IM" };
-	int i;
-	int ioc = 0;
-
-	page = read_page(MPI_CONFIG_PAGETYPE_RAID_VOLUME,
-			 MPI_CONFIG_ACTION_PAGE_READ_CURRENT,
-			 ioc,
-			 id_of_primary_device,
-			 MPI_RAIDVOLPAGE0_PAGEVERSION);
-	if (0 == page->NumPhysDisks) {
-		if (probe_id > 0) {
-			id_of_primary_device = __probe_scsi_id();
-			if (-1 == id_of_primary_device) {
-				printf("Nothing found, contact the author\n");
-				exit(EXIT_FAILURE);
+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 {
-				printf("Found SCSI id=%d, use ''mpt-status "
-				       "-i %d`` to get more information.\n",
-					id_of_primary_device,
-					id_of_primary_device);
-				exit(EXIT_SUCCESS);
+				__print_physdisk_advanced(pRPD0, 0);
 			}
 		} else {
-			printf("%s\n", wrong_scsi_id);
-			exit(EXIT_FAILURE);
+			//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) {
-		printf("vol_id %d", page->VolumeID);
+		mpt_printf("vol_id:%d", page->VolumeID);
 	} else {
-		printf("ioc%d vol_id %d type %s, %d phy, %d GB",
-		       page->VolumeIOC,
-		       page->VolumeID,
-		       page->VolumeType < sizeof(VolumeTypes) ?
+		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->NumPhysDisks,
-		       page->MaxLBA / (2 * 1024 * 1024));
-		printf(", state");
+			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 (page->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_OPTIMAL)
-		printf(" OPTIMAL");
-	if (page->VolumeStatus.State & MPI_RAIDVOL0_STATUS_STATE_DEGRADED)
-		printf(" DEGRADED");
-	if (page->VolumeStatus.State & MPI_RAIDVOL0_STATUS_STATE_FAILED)
-		printf(" FAILED");
 	if (1 != print_status_only) {
-		printf(", flags");
+		mpt_printf(" flags:");
 		if (page->VolumeStatus.Flags != 0) {
 			if (page->VolumeStatus.Flags &
 			    MPI_RAIDVOL0_STATUS_FLAG_ENABLED)
-				printf(" ENABLED");
+				mpt_printf(" ENABLED");
 			if (page->VolumeStatus.Flags &
 			    MPI_RAIDVOL0_STATUS_FLAG_QUIESCED)
-				printf(" QUIESCED");
+				mpt_printf(" QUIESCED");
 			if (page->VolumeStatus.Flags &
-			    MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS)
-				printf(" RESYNC_IN_PROGRESS");
+			    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)
-				printf(" VOLUME_INACTIVE");
+				mpt_printf(" VOLUME_INACTIVE");
 		} else {
-			printf(" NONE");
+			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);
+}
 
-	/* go through all physical disk of a found array */
-	for (i = 0; i < page->NumPhysDisks; ++i) {
-		char vendor[BIG];
-		char productid[BIG];
-		char rev[BIG];
-		phys = read_page(MPI_CONFIG_PAGETYPE_RAID_PHYSDISK,
-				 MPI_CONFIG_ACTION_PAGE_READ_CURRENT,
-				 0,
-				 page->PhysDisk[i].PhysDiskNum,
-				 MPI_RAIDPHYSDISKPAGE0_PAGEVERSION);
-		memset(vendor, 0, sizeof(vendor));
-		memset(productid, 0, sizeof(productid));
-		memset(rev, 0, sizeof(rev));
-		/* the cast to char * is new for 1.1.5, maybe this breaks
-		   something subtle since I haven't sanitized the headers yet
-		*/
-		strncpy(vendor, (char *) phys->InquiryData.VendorID,
-			sizeof(phys->InquiryData.VendorID));
-		strncpy(productid, (char *) phys->InquiryData.ProductID,
-			sizeof(phys->InquiryData.ProductID));
-		strncpy(rev, (char *) phys->InquiryData.ProductRevLevel,
-			sizeof(phys->InquiryData.ProductRevLevel));
+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("phys_id %d", phys->PhysDiskNum);
+	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 {
-			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)
-			printf(" ONLINE");
-		if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_MISSING)
-			printf(" MISSING");
-		if (phys->PhysDiskStatus.State ==
-		    MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE)
-			printf(" NOT_COMPATIBLE");
-		if (phys->PhysDiskStatus.State == MPI_PHYSDISK0_STATUS_FAILED)
-			printf(" FAILED");
-		if (phys->PhysDiskStatus.State ==
-		    MPI_PHYSDISK0_STATUS_INITIALIZING)
-			printf(" INITIALIZING");
-		if (phys->PhysDiskStatus.State ==
-		    MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED)
-			printf(" OFFLINE_REQUESTED");
-		if (phys->PhysDiskStatus.State ==
-		    MPI_PHYSDISK0_STATUS_FAILED_REQUESTED)
-			printf(" FAILED_REQUESTED");
-		if (phys->PhysDiskStatus.State ==
-		    MPI_PHYSDISK0_STATUS_OTHER_OFFLINE)
-			printf(" OTHER_OFFLINE");
-		if (1 != print_status_only) {
-			printf(", flags");
-			if (phys->PhysDiskStatus.Flags) {
-				if (phys->PhysDiskStatus.Flags &
-				    MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC)
-					printf(" OUT_OF_SYNC");
-				if (phys->PhysDiskStatus.Flags &
-				    MPI_PHYSDISK0_STATUS_FLAG_QUIESCED)
-					printf(" QUIESCED");
-			} else {
-				printf(" NONE");
-			}
+			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");
 		}
-		printf("\n");
+		/* 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");
+}
 
-	/* go through all hotspares
-	ioc_hotspare = read_page(MPI_CONFIG_PAGETYPE_RAID_VOLUME,
-			 MPI_CONFIG_ACTION_PAGE_READ_CURRENT,
-			 0,
-			 id_of_primary_device,
-			 MPI_IOCPAGE5_PAGEVERSION);
-
-	//printf("Number of hotspares: %d\n", ioc_hotspare->NumHotSpares);
-	for (i = 0; i < ioc_hotspare->NumHotSpares; ++i) {
-		Ioc5HotSpare_t *hotspare;
-
-		hotspare = read_page(MPI_CONFIG_PAGETYPE_RAID_PHYSDISK,
-			 MPI_CONFIG_ACTION_PAGE_READ_CURRENT,
-			 0,
-			 ioc_hotspare->HotSpare[i].PhysDiskNum,
-			 MPI_IOCPAGE5_PAGEVERSION);
-		printf("Hotspare: phys_id %d state: %s\n",
-			hotspare->PhysDiskNum,
-			hotspare->Flags == MPI_IOC_PAGE_5_HOT_SPARE_ACTIVE ?
-			"ACTIVE" : "INACTIVE");
+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) {
-		system("/sbin/modprobe mptctl");
+		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) {
-			fprintf(stderr,
-				"  You need to be root to run this program\n");
+			mpt_fprintf(stderr, " Need root to run this program\n");
 		} else if (save_errno == ENOENT) {
-			fprintf(stderr, "  Try: mknod /dev/mptctl c 10 220\n");
+			mpt_fprintf(stderr, 
+			            "  Try: mknod /dev/mptctl c 10 220\n");
 		} else if (save_errno == ENODEV) {
-			fprintf(stderr,
-				"  Are you sure your controller is supported by mptlinux?\n");
+			mpt_fprintf(stderr,
+			            "  Are you sure your controller"
+			            " is supported by mptlinux?\n");
 		}
-		fprintf(stderr, "Also make sure mptctl is loaded into the kernel\n");
-		exit(EXIT_FAILURE);
+		mpt_fprintf(stderr, 
+		            "Make sure mptctl is loaded into the kernel\n");
+		mpt_exit(MPT_EXIT_UNKNOWN|MPT_EXIT_NOCLOSE);
 	}
 }
 
@@ -424,12 +1134,15 @@
 			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 'h':
-			print_usage(progname);
-			exit(EXIT_SUCCESS);
+		case 'n':
+			newstyle = 1;
 			break;
 		case 'p':
 			probe_id = 1;
@@ -448,7 +1161,7 @@
 			break;
 		case 'V':
 			print_version();
-			exit(EXIT_SUCCESS);
+			mpt_exit(MPT_EXIT_OKAY);
 			break;
 		case  0:
 			if (sel == ARG_M_A) {
@@ -460,12 +1173,42 @@
 			break;
 		default:
 			print_usage(progname);
-			exit(EXIT_SUCCESS);
+			mpt_exit(MPT_EXIT_UNKNOWN);
 			break;
 		}
 	} while (next_option != -1);
 
 	do_init();
-	print_information();
-	exit(EXIT_SUCCESS);
+	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;
 }
diff -Nru /tmp/jMsaaM6I2K/mpt-status-1.1.6/mpt-status.h /tmp/CUWG8NXatu/mpt-status-1.2.0/mpt-status.h
--- /tmp/jMsaaM6I2K/mpt-status-1.1.6/mpt-status.h	2006-03-04 13:17:58.000000000 +0000
+++ /tmp/CUWG8NXatu/mpt-status-1.2.0/mpt-status.h	2006-10-26 08:06:52.000000000 +0000
@@ -1,42 +1,63 @@
 #ifndef _MPT_STATUS_H
 #define _MPT_STATUS_H
 
-#ifdef REDHAT
-#  define __user
-#  define __kernel
+#include <sys/ioctl.h>
+#ifdef __linux__
+#include <linux/compiler.h>
 #endif
 
-/* This is for version 1.2.0 of mpt-status
-#ifndef __x86_64__
-#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 "mptctl.h"
+#ifdef SANITIZED_KERNEL_HEADERS
+#include "mpt-sanitized.h"
 #else
-#include <stdint.h>
-#include "pci.h"	// config.h and header.h from pciutils package
-#include "sles.h"
-#endif // __x86_64__ 
-*/
-
+#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.1.5"
+#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 */

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: