diff -Nur mpt-status-1.2.0-RC7/contrib/mpt-status-1.0.diff mpt-status-1.2.0/contrib/mpt-status-1.0.diff --- mpt-status-1.2.0-RC7/contrib/mpt-status-1.0.diff 2006-04-24 19:29:45.000000000 +0200 +++ mpt-status-1.2.0/contrib/mpt-status-1.0.diff 1970-01-01 01:00:00.000000000 +0100 @@ -1,228 +0,0 @@ ---- mpt-status.c -+++ mpt-status.c -@@ -25,17 +25,14 @@ - #include - #include - #include --#include -+#include - #include - #include - #include - #include - --#include "mptctl.h" --#include "lsi/mpi_type.h" --#include "lsi/mpi.h" --#include "lsi/mpi_ioc.h" --#include "lsi/mpi_cnfg.h" -+#include -+#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 -Nur mpt-status-1.2.0-RC7/contrib/mpt-status.spec mpt-status-1.2.0/contrib/mpt-status.spec --- mpt-status-1.2.0-RC7/contrib/mpt-status.spec 1970-01-01 01:00:00.000000000 +0100 +++ mpt-status-1.2.0/contrib/mpt-status.spec 2006-07-01 00:21:41.000000000 +0200 @@ -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 - 1.1.3-0 +- Initial package. diff -Nur mpt-status-1.2.0-RC7/contrib/sizes.c mpt-status-1.2.0/contrib/sizes.c --- mpt-status-1.2.0-RC7/contrib/sizes.c 2006-04-24 19:29:45.000000000 +0200 +++ mpt-status-1.2.0/contrib/sizes.c 2006-10-25 10:24:52.000000000 +0200 @@ -1,6 +1,8 @@ #include #include +/* This was once used to help debugging 32/64 bit issues with mpt-status. */ + int main(void) { printf("int: %d\n" "char ptr: %d\n" diff -Nur mpt-status-1.2.0-RC7/doc/Changelog mpt-status-1.2.0/doc/Changelog --- mpt-status-1.2.0-RC7/doc/Changelog 2006-05-02 19:42:29.000000000 +0200 +++ mpt-status-1.2.0/doc/Changelog 2006-10-26 10:25:52.000000000 +0200 @@ -1,10 +1,46 @@ +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 brokeness due to previously applied patch by 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 by 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-RC6 (not released), after 3 almost complete rewrites + * 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 diff -Nur mpt-status-1.2.0-RC7/doc/INSTALL mpt-status-1.2.0/doc/INSTALL --- mpt-status-1.2.0-RC7/doc/INSTALL 2006-05-02 19:59:09.000000000 +0200 +++ mpt-status-1.2.0/doc/INSTALL 2006-10-26 08:57:27.000000000 +0200 @@ -44,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 ------------------------------ @@ -65,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 -Nur mpt-status-1.2.0-RC7/doc/ReleaseNotes mpt-status-1.2.0/doc/ReleaseNotes --- mpt-status-1.2.0-RC7/doc/ReleaseNotes 2006-05-02 19:55:20.000000000 +0200 +++ mpt-status-1.2.0/doc/ReleaseNotes 2006-10-25 10:22:07.000000000 +0200 @@ -1,6 +1,6 @@ -Release Notes mpt-status 1.2.0 (2006-mm-dd) +Release Notes mpt-status 1.2.0 (2006-10-dd) ============================== -Codename: +Codename: About ----- diff -Nur mpt-status-1.2.0-RC7/doc/THANKS mpt-status-1.2.0/doc/THANKS --- mpt-status-1.2.0-RC7/doc/THANKS 2006-05-02 20:03:26.000000000 +0200 +++ mpt-status-1.2.0/doc/THANKS 2006-10-26 08:59:19.000000000 +0200 @@ -2,6 +2,7 @@ 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 @@ -20,7 +21,14 @@ 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. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -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 -Nur mpt-status-1.2.0-RC7/Makefile mpt-status-1.2.0/Makefile --- mpt-status-1.2.0-RC7/Makefile 2006-05-02 20:01:54.000000000 +0200 +++ mpt-status-1.2.0/Makefile 2006-10-26 09:11:03.000000000 +0200 @@ -1,12 +1,18 @@ PROG := mpt-status PREFIX := /usr KERNEL_PATH := /usr/src/linux -CFLAGS := -Iincl -Wall -W -O2 -I${KERNEL_PATH}/drivers/message/fusion +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) ifeq "${ARCH}" "sparc64" @@ -18,14 +24,23 @@ ${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 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 -Nur mpt-status-1.2.0-RC7/man/mpt-status.8 mpt-status-1.2.0/man/mpt-status.8 --- mpt-status-1.2.0-RC7/man/mpt-status.8 1970-01-01 01:00:00.000000000 +0100 +++ mpt-status-1.2.0/man/mpt-status.8 2006-10-26 08:38:47.000000000 +0200 @@ -0,0 +1,50 @@ +.\" 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 +Set the IOC unit (controller). +.TP +.B \-h \-\-help +Print some help information. +.TP +.B \-i \-\-set_id +Set id of primary device (check README). +.TP +.B \-p \-\-probe_id +Use this to probe SCSI id's when not on id 0. +.TP +.B \-q \-\-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 . +.PP +This manual page was written by Steffen Joeris , +for the Debian project (but may be used by others). diff -Nur mpt-status-1.2.0-RC7/man/README mpt-status-1.2.0/man/README --- mpt-status-1.2.0-RC7/man/README 1970-01-01 01:00:00.000000000 +0100 +++ mpt-status-1.2.0/man/README 2006-10-26 08:55:19.000000000 +0200 @@ -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 -Nur mpt-status-1.2.0-RC7/mpt-status.c mpt-status-1.2.0/mpt-status.c --- mpt-status-1.2.0-RC7/mpt-status.c 2006-05-11 21:39:00.000000000 +0200 +++ mpt-status-1.2.0/mpt-status.c 2006-10-26 10:24:36.000000000 +0200 @@ -134,6 +134,7 @@ 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); @@ -293,7 +294,10 @@ } static void print_version(void) { - mpt_printf("Version: %s\n", VERSION); + 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) { @@ -382,6 +386,60 @@ return status; } +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; @@ -1062,9 +1120,14 @@ 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) { @@ -1150,7 +1213,12 @@ if (probe_id > 0) { id_of_primary_device = __probe_scsi_id2(); } - GetVolumeInfo(); + if (hasVolume() > 0) { + GetVolumeInfo(); + } else { + mpt_printf("No RAID is configured\n"); + mpt_exit(MPT_EXIT_UNKNOWN); + } } else { /* this is the old style setup */ if (probe_id > 0) { diff -Nur mpt-status-1.2.0-RC7/mpt-status.h mpt-status-1.2.0/mpt-status.h --- mpt-status-1.2.0-RC7/mpt-status.h 2006-05-02 18:53:57.000000000 +0200 +++ mpt-status-1.2.0/mpt-status.h 2006-10-26 10:06:52.000000000 +0200 @@ -20,13 +20,12 @@ #include "lsi/mpi.h" #include "lsi/mpi_ioc.h" #include "lsi/mpi_cnfg.h" -//#include "lsi/mpi_init.h" #include "lsi/mpi_raid.h" -//#include "lsi/mpi_tool.h" #include "mptctl.h" +//#include "mptbase.h" #endif // SANITIZED_KERNEL_HEADERS -#define VERSION "1.2.0-RC7" +#define VERSION "1.2.0" #define BIG 1024 #define REALLYBIG 10240