From the OpenBSD mpt(4) man page:

     The LSI Logic SCSI and Fibre Channel controllers contain firmware that
     presents a multiprotocol service layer based on the LSI Logic Fusion-MPT
     architecture.  The firmware isolates the host drivers from the hardware
     and controls the device side of the message passing interface to the host
     device drivers.  The firmware manages all phases of an I/O request and
     optimizes the interrupt management for the system.  For Fibre Channel,
     the firmware also manages all FC-2 through FC-4 services, which minimizes
     the amount of Fibre Channel unique services required with the host driv-
     er.

     The MPI (Message Passing Interface) definition includes a register-level
     transport mechanism and a messaging protocol.  A system doorbell and mes-
     sage queues define the MPI transport interface.  Inbound Message Frames
     (MF), allocated in host memory, identify I/O operations to be performed
     by the IO Controller (IOC).  These operations are queued on the Request
     Queue by the host driver.  Outbound Message Frames, also in host memory,
     track I/O operations as they complete.  These frames are queued on the
     Reply Queue by the IOC.  A doorbell mechanism is provided for IOC config-
     uration, reset management, and IOC status.


You can now specify the scsi_id of the primary disk of an array. This is in
case you've got an array but your primary disk is not physically in the slot 0
in your chassis (scsi id 0) but in another one. The following excerpt from the
source code should clarify what I mean:

            This represents the id of the primary disk of an array. If you have
            following setup, the ID of the primary disk would be 1.

            +---+---+---+---+---+---+---+---+----
   SCSI ID  | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ...
            +---+---+---+---+---+---+---+---+----
                   \   \   \___  Array: Secondary Disk
                    \   \______  Array: Spare Disk
                     \_________  Array: Primary Disk

            In the following setup without a Spare Disk, the ID of the primary
            disk would be 2.

            +---+---+---+---+---+---+---+---+----
   SCSI ID  | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ...
            +---+---+---+---+---+---+---+---+----
                       \   \___  Array: Secondary Disk
                        \______  Array: Primary Disk




Random Notes
------------
The includes pci.h, config.h, header.h are from pciutils. Most distros might
have a pciutils-devel package or somthing similar.

Directory structure
-------------------
./doc/AUTHORS	          : This file lists the authors of the mpt-status code
./doc/Changelog           : Keeps track of the changes in prosa 
./doc/COPYING	          : The GNU v2 License copy
./doc/INSTALL	          : The installation documents
./doc/README	          : This document
./doc/ReleaseNotes        : The actual release notes, read them carefully
./doc/TODO	          : Stuff that needs to be done
./doc/THANKS	          : A small thank you endroit for the contributors
./doc/DeveloperNotes      : Some information on the message API of mpt
./incl/config.h           : Include file from pciutils
./incl/header.h           : Include file from pciutils
./incl/pci.h	          : Include file from pciutils
./Makefile	          : Used to build the mpt-status binary
./mpt-status.c	          : The mighty tool itself
./mpt-status.h	          : The main include file for mpt-status
./contrib/mpt-status.spec


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) +++

