Massive overhaul of MPT Fusion driver:

o Add timeout error recovery (from a thread context to avoid
  the deferral of other critical interrupts).
o Properly recover commands across controller reset events.
o Update the driver to handle events and status codes that
  have been added to the MPI spec since the driver was
  originally written.
o Make the driver more modular to improve maintainability and
  support dynamic "personality" registration (e.g. SCSI Initiator,
  RAID, SAS, FC, etc).
o Shorten and simplify the common I/O path to improve driver
  performance.
o Add RAID volume and RAID member state/settings reporting.
o Add periodic volume resynchronization status reporting.
o Add support for sysctl tunable resync rate, member write cache
  enable, and volume transaction queue depth.

Sponsored by
----------------
Avid Technologies Inc:
	SCSI error recovery, driver re-organization, update of MPI library
	headers, portions of dynamic personality registration, and misc bug
	fixes.

Wheel Open Technologies:
	RAID event notification, RAID member pass-thru support, firmware
	upload/download support, enhanced RAID resync speed, portions
	of dynamic personality registration, and misc bug fixes.

Detailed Changes
================
mpt.c mpt_cam.c mpt_raid.c mpt_pci.c:
o Add support for personality modules.  Each module exports
  load, and unload module scope methods as well as probe, attach,
  event, reset, shutdown, and detach  per-device instance
  methods

mpt.c mpt.h mpt_pci.c:
o The driver now associates a callback function (via an
  index) with every transaction submitted to the controller.
  This allows the main interrupt handler to absolve itself
  of any knowledge of individual transaction/response types
  by simply calling the callback function "registered" for
  the transaction.  We use a callback index instead of a
  callback function pointer in each requests so we can
  properly handle responses (e.g. event notifications)
  that are not associated with a transaction.  Personality
  modules dynamically register their callbacks with the
  driver core to receive the callback index to use for their
  handlers.

o Move the interrupt handler into mpt.c.  The ISR algorithm
  is bus transport and OS independent and thus had no reason
  to be in mpt_pci.c.

o Simplify configuration message reply handling by copying
  reply frame data for the requester and storing completion
  status in the original request structure.

o Add the mpt_complete_request_chain() helper method and use
  it to implement reset handlers that must abort transactions.

o Keep track of all pending requests on the new
  requests_pending_list in the softc.

o Add default handlers to mpt.c to handle generic event
  notifications and controller reset activities.  The event
  handler code is largely the same as in the original driver.
  The reset handler is new and terminates any pending transactions
  with a status code indicating the controller needs to be
  re-initialized.

o Add some endian support to the driver.  A complete audit is
  still required for this driver to have any hope of operating
  in a big-endian environment.

o Use inttypes.h and __inline.  Come closer to being style(9)
  compliant.

o Remove extraneous use of typedefs.

o Convert request state from a strict enumeration to a series
  of flags.  This allows us to, for example, tag transactions
  that have timed-out while retaining the state that the
  transaction is still in-flight on the controller.

o Add mpt_wait_req() which allows a caller to poll or sleep
  for the completion of a request.  Use this to simplify
  and factor code out from many initialization routines.
  We also use this to sleep for task management request
  completions in our CAM timeout handler.

mpt.c:
o Correct a bug in the event handler where request structures were
  freed even if the request reply was marked as a continuation
  reply. Continuation replies indicate that the controller still owns
  the request and freeing these replies prematurely corrupted
  controller state.

o Implement firmware upload and download. On controllers that do
  not have dedicated NVRAM (as in the Sun v20/v40z), the firmware
  image is downloaded to the controller by the system BIOS. This
  image occupies precious controller RAM space until the host driver
  fetches the image, reducing the number of concurrent I/Os the
  controller can processes. The uploaded image is used to
  re-program the controller during hard reset events since the
  controller cannot fetch the firmware on its own. Implementing this
  feature allows much higher queue depths when RAID volumes
  are configured.

o Changed configuration page accessors to allow threads to sleep
  rather than busy wait for completion.

o Removed hard coded data transfer sizes from configuration page
  routines so that RAID configuration page processing is possible.

mpt_reg.h:
o Move controller register definitions into a separate file.

mpt.h:
o Re-arrange includes to allow inlined functions to be
  defined in mpt.h.

o Add reply, event, and reset handler definitions.

o Add softc fields for handling timeout and controller
  reset recovery.

mpt_cam.c:
o Move mpt_freebsd.c to mpt_cam.c.  Move all core functionality,
  such as event handling, into mpt.c leaving only CAM SCSI
  support here.

o Revamp completion handler to provide correct CAM status for
  all currently defined SCSI MPI message result codes.

o Register event and reset handlers with the MPT core.  Modify
  the event handler to notify CAM of bus reset events.  The
  controller reset handler will abort any transactions that
  have timed out.  All other pending CAM transactions are
  correctly aborted by the core driver's reset handler.

o Allocate a single request up front to perform task management
  operations.  This guarantees that we can always perform a
  TMF operation even when the controller is saturated with other
  operations.  The single request also serves as a perfect
  mechanism of guaranteeing that only a single TMF is in flight
  at a time - something that is required according to the MPT
  Fusion documentation.

o Add a helper function for issuing task management requests
  to the controller.  This is used to abort individual requests
  or perform a bus reset.

o Modify the CAM XPT_BUS_RESET ccb handler to wait for and
  properly handle the status of the bus reset task management
  frame used to reset the bus.  The previous code assumed that
  the reset request would always succeed.

o Add timeout recovery support.  When a timeout occurs, the
  timed-out request is added to a queue to be processed by
  our recovery thread and the thread is woken up.  The recovery
  thread processes timed-out command serially, attempting first
  to abort them and then falling back to a bus reset if an
  abort fails.

o Add calls to mpt_reset() to reset the controller if any
  handshake command, bus reset attempt or abort attempt
  fails due to a timeout.

o Export a secondary "bus" to CAM that exposes all volume drive
  members as pass-thru devices, allowing CAM to perform proper
  speed negotiation to hidden devices.

o Add a CAM async event handler tracking the AC_FOUND_DEVICE event.
  Use this to trigger calls to set the per-volume queue depth once
  the volume is fully registered with CAM. This is required to avoid
  hitting firmware limits on volume queue depth.  Exceeding the
  limit causes the firmware to hang.

mpt_cam.h:
o Add several helper functions for interfacing to CAM and
  performing timeout recovery.

mpt_pci.c:
o Disable interrupts on the controller before registering and
  enabling interrupt delivery to the OS.  Otherwise we risk
  receiving interrupts before the driver is ready to receive
  them.

o Make use of compatibility macros that allow the driver to
  be compiled under 4.x and 5.x.

mpt_raid.c:
o Add a per-controller instance RAID thread to perform settings
   changes and query status (minimizes CPU busy wait loops).

o Use a shutdown handler to disable "Member Write Cache Enable"
  (MWCE) setting for RAID arrays set to enable MWCE During Rebuild.

o Change reply handler function signature to allow handlers to defer
  the deletion of reply frames. Use this to allow the event reply
  handler to queue up events that need to be acked if no resources
  are available to immediately ack an event. Queued events are
  processed in mpt_free_request() where resources are freed. This
  avoids a panic on resource shortage.

o Parse and print out RAID controller capabilities during driver probe.

o Define, allocate, and maintain RAID data structures for volumes,
  hidden member physical disks and spare disks.

o Add dynamic sysctls for per-instance setting of the log level, array
  resync rate, array member cache enable, and volume queue depth.

mpt_debug.c:
o Add mpt_lprt and mpt_lprtc for printing diagnostics conditioned on
  a particular log level to aid in tracking down driver issues.

o Add mpt_decode_value() which parses the bits in an integer
  value based on a parsing table (mask, value, name string, tuples).

mpilib/*:
o Update mpi library header files to latest distribution from LSI.

Submitted by: gibbs
Approved by: re
This commit is contained in:
scottl 2005-07-10 15:05:39 +00:00
parent 256b79e5c0
commit 9126bcda9d
21 changed files with 7137 additions and 2973 deletions

View File

@ -1,27 +1,34 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* NAME: fc_log.h
* SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips

View File

@ -1,34 +1,40 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI.H
* Title: MPI Message independent structures and definitions
* Creation Date: July 27, 2000
*
* MPI.H Version: 01.02.09
* MPI.H Version: 01.02.11
*
* Version History
* ---------------
@ -73,6 +79,8 @@
* 11-15-02 01.02.08 Added define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX and
* obsoleted define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX.
* 04-01-03 01.02.09 New IOCStatus code: MPI_IOCSTATUS_FC_EXCHANGE_CANCELED
* 06-26-03 01.02.10 Bumped MPI_HEADER_VERSION_UNIT value.
* 01-16-04 01.02.11 Added define for MPI_IOCLOGINFO_TYPE_SHIFT.
* --------------------------------------------------------------------------
*/
@ -101,7 +109,7 @@
/* Note: The major versions of 0xe0 through 0xff are reserved */
/* versioning for this MPI header set */
#define MPI_HEADER_VERSION_UNIT (0x09)
#define MPI_HEADER_VERSION_UNIT (0x0D)
#define MPI_HEADER_VERSION_DEV (0x00)
#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00)
#define MPI_HEADER_VERSION_UNIT_SHIFT (8)
@ -318,7 +326,7 @@ typedef struct _SGE_SIMPLE_UNION
{
U32 Address32;
U64 Address64;
} _u;
}u;
} SGESimpleUnion_t, MPI_POINTER pSGESimpleUnion_t,
SGE_SIMPLE_UNION, MPI_POINTER PTR_SGE_SIMPLE_UNION;
@ -353,7 +361,7 @@ typedef struct _SGE_CHAIN_UNION
{
U32 Address32;
U64 Address64;
} _u;
}u;
} SGE_CHAIN_UNION, MPI_POINTER PTR_SGE_CHAIN_UNION,
SGEChainUnion_t, MPI_POINTER pSGEChainUnion_t;
@ -417,7 +425,7 @@ typedef struct _SGE_TRANSACTION_UNION
U32 TransactionContext64[2];
U32 TransactionContext96[3];
U32 TransactionContext128[4];
} _u;
}u;
U32 TransactionDetails[1];
} SGE_TRANSACTION_UNION, MPI_POINTER PTR_SGE_TRANSACTION_UNION,
SGETransactionUnion_t, MPI_POINTER pSGETransactionUnion_t;
@ -433,7 +441,7 @@ typedef struct _SGE_IO_UNION
{
SGE_SIMPLE_UNION Simple;
SGE_CHAIN_UNION Chain;
} _u;
} u;
} SGE_IO_UNION, MPI_POINTER PTR_SGE_IO_UNION,
SGEIOUnion_t, MPI_POINTER pSGEIOUnion_t;
@ -447,7 +455,7 @@ typedef struct _SGE_TRANS_SIMPLE_UNION
{
SGE_SIMPLE_UNION Simple;
SGE_TRANSACTION_UNION Transaction;
} _u;
} u;
} SGE_TRANS_SIMPLE_UNION, MPI_POINTER PTR_SGE_TRANS_SIMPLE_UNION,
SGETransSimpleUnion_t, MPI_POINTER pSGETransSimpleUnion_t;
@ -462,7 +470,7 @@ typedef struct _SGE_MPI_UNION
SGE_SIMPLE_UNION Simple;
SGE_CHAIN_UNION Chain;
SGE_TRANSACTION_UNION Transaction;
} _u;
} u;
} SGE_MPI_UNION, MPI_POINTER PTR_SGE_MPI_UNION,
MPI_SGE_UNION_t, MPI_POINTER pMPI_SGE_UNION_t,
SGEAllUnion_t, MPI_POINTER pSGEAllUnion_t;
@ -696,6 +704,7 @@ typedef struct _MSG_DEFAULT_REPLY
/****************************************************************************/
#define MPI_IOCLOGINFO_TYPE_MASK (0xF0000000)
#define MPI_IOCLOGINFO_TYPE_SHIFT (28)
#define MPI_IOCLOGINFO_TYPE_NONE (0x0)
#define MPI_IOCLOGINFO_TYPE_SCSI (0x1)
#define MPI_IOCLOGINFO_TYPE_FC (0x2)

View File

@ -1,34 +1,40 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_CNFG.H
* Title: MPI Config message, structures, and Pages
* Creation Date: July 27, 2000
*
* MPI_CNFG.H Version: 01.02.11
* MPI_CNFG.H Version: 01.02.13
*
* Version History
* ---------------
@ -158,6 +164,21 @@
* Added define MPI_FCPORTPAGE5_FLAGS_DISABLE to disable
* an alias.
* Added more device id defines.
* 06-26-03 01.02.12 Added MPI_IOUNITPAGE1_IR_USE_STATIC_VOLUME_ID define.
* Added TargetConfig and IDConfig fields to
* CONFIG_PAGE_SCSI_PORT_1.
* Added more PortFlags defines for CONFIG_PAGE_SCSI_PORT_2
* to control DV.
* Added more Flags defines for CONFIG_PAGE_FC_PORT_1.
* In CONFIG_PAGE_FC_DEVICE_0, replaced Reserved1 field
* with ADISCHardALPA.
* Added MPI_FC_DEVICE_PAGE0_PROT_FCP_RETRY define.
* 01-16-04 01.02.13 Added InitiatorDeviceTimeout and InitiatorIoPendTimeout
* fields and related defines to CONFIG_PAGE_FC_PORT_1.
* Added define for
* MPI_FCPORTPAGE1_FLAGS_SOFT_ALPA_FALLBACK.
* Added new fields to the substructures of
* CONFIG_PAGE_FC_PORT_10.
* --------------------------------------------------------------------------
*/
@ -459,6 +480,7 @@ typedef struct _CONFIG_PAGE_IO_UNIT_1
#define MPI_IOUNITPAGE1_SINGLE_FUNCTION (0x00000001)
#define MPI_IOUNITPAGE1_MULTI_PATHING (0x00000002)
#define MPI_IOUNITPAGE1_SINGLE_PATHING (0x00000000)
#define MPI_IOUNITPAGE1_IR_USE_STATIC_VOLUME_ID (0x00000004)
#define MPI_IOUNITPAGE1_DISABLE_IR (0x00000040)
#define MPI_IOUNITPAGE1_FORCE_32 (0x00000080)
@ -742,14 +764,22 @@ typedef struct _CONFIG_PAGE_SCSI_PORT_1
CONFIG_PAGE_HEADER Header; /* 00h */
U32 Configuration; /* 04h */
U32 OnBusTimerValue; /* 08h */
U8 TargetConfig; /* 0Ch */
U8 Reserved1; /* 0Dh */
U16 IDConfig; /* 0Eh */
} CONFIG_PAGE_SCSI_PORT_1, MPI_POINTER PTR_CONFIG_PAGE_SCSI_PORT_1,
SCSIPortPage1_t, MPI_POINTER pSCSIPortPage1_t;
#define MPI_SCSIPORTPAGE1_PAGEVERSION (0x02)
#define MPI_SCSIPORTPAGE1_PAGEVERSION (0x03)
/* Configuration values */
#define MPI_SCSIPORTPAGE1_CFG_PORT_SCSI_ID_MASK (0x000000FF)
#define MPI_SCSIPORTPAGE1_CFG_PORT_RESPONSE_ID_MASK (0xFFFF0000)
/* TargetConfig values */
#define MPI_SCSIPORTPAGE1_TARGCONFIG_TARG_ONLY (0x01)
#define MPI_SCSIPORTPAGE1_TARGCONFIG_INIT_TARG (0x02)
typedef struct _MPI_DEVICE_INFO
{
@ -768,13 +798,20 @@ typedef struct _CONFIG_PAGE_SCSI_PORT_2
} CONFIG_PAGE_SCSI_PORT_2, MPI_POINTER PTR_CONFIG_PAGE_SCSI_PORT_2,
SCSIPortPage2_t, MPI_POINTER pSCSIPortPage2_t;
#define MPI_SCSIPORTPAGE2_PAGEVERSION (0x01)
#define MPI_SCSIPORTPAGE2_PAGEVERSION (0x02)
/* PortFlags values */
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_SCAN_HIGH_TO_LOW (0x00000001)
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_AVOID_SCSI_RESET (0x00000004)
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_ALTERNATE_CHS (0x00000008)
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_TERMINATION_DISABLE (0x00000010)
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_DV_MASK (0x00000060)
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_FULL_DV (0x00000000)
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_BASIC_DV_ONLY (0x00000020)
#define MPI_SCSIPORTPAGE2_PORT_FLAGS_OFF_DV (0x00000060)
/* PortSettings values */
#define MPI_SCSIPORTPAGE2_PORT_HOST_ID_MASK (0x0000000F)
#define MPI_SCSIPORTPAGE2_PORT_MASK_INIT_HBA (0x00000030)
#define MPI_SCSIPORTPAGE2_PORT_DISABLE_INIT_HBA (0x00000000)
@ -1016,18 +1053,23 @@ typedef struct _CONFIG_PAGE_FC_PORT_1
U8 AltConnector; /* 1Bh */
U8 NumRequestedAliases; /* 1Ch */
U8 RR_TOV; /* 1Dh */
U16 Reserved2; /* 1Eh */
U8 InitiatorDeviceTimeout; /* 1Eh */
U8 InitiatorIoPendTimeout; /* 1Fh */
} CONFIG_PAGE_FC_PORT_1, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_1,
FCPortPage1_t, MPI_POINTER pFCPortPage1_t;
#define MPI_FCPORTPAGE1_PAGEVERSION (0x05)
#define MPI_FCPORTPAGE1_PAGEVERSION (0x06)
#define MPI_FCPORTPAGE1_FLAGS_EXT_FCP_STATUS_EN (0x08000000)
#define MPI_FCPORTPAGE1_FLAGS_IMMEDIATE_ERROR_REPLY (0x04000000)
#define MPI_FCPORTPAGE1_FLAGS_FORCE_USE_NOSEEPROM_WWNS (0x02000000)
#define MPI_FCPORTPAGE1_FLAGS_VERBOSE_RESCAN_EVENTS (0x01000000)
#define MPI_FCPORTPAGE1_FLAGS_TARGET_MODE_OXID (0x00800000)
#define MPI_FCPORTPAGE1_FLAGS_PORT_OFFLINE (0x00400000)
#define MPI_FCPORTPAGE1_FLAGS_SOFT_ALPA_FALLBACK (0x00200000)
#define MPI_FCPORTPAGE1_FLAGS_MASK_RR_TOV_UNITS (0x00000070)
#define MPI_FCPORTPAGE1_FLAGS_SUPPRESS_PROT_REG (0x00000008)
#define MPI_FCPORTPAGE1_FLAGS_PLOGI_ON_LOGO (0x00000004)
#define MPI_FCPORTPAGE1_FLAGS_MAINTAIN_LOGINS (0x00000002)
#define MPI_FCPORTPAGE1_FLAGS_SORT_BY_DID (0x00000001)
#define MPI_FCPORTPAGE1_FLAGS_SORT_BY_WWN (0x00000000)
@ -1060,6 +1102,9 @@ typedef struct _CONFIG_PAGE_FC_PORT_1
#define MPI_FCPORTPAGE1_ALT_CONN_UNKNOWN (0x00)
#define MPI_FCPORTPAGE1_INITIATOR_DEV_TIMEOUT_MASK (0x7F)
#define MPI_FCPORTPAGE1_INITIATOR_DEV_UNIT_16 (0x80)
typedef struct _CONFIG_PAGE_FC_PORT_2
{
@ -1254,8 +1299,8 @@ typedef struct _CONFIG_PAGE_FC_PORT_10_BASE_SFP_DATA
U8 VendorOUI[3]; /* 35h */
U8 VendorPN[16]; /* 38h */
U8 VendorRev[4]; /* 48h */
U16 Reserved4; /* 4Ch */
U8 Reserved5; /* 4Eh */
U16 Wavelength; /* 4Ch */
U8 Reserved4; /* 4Eh */
U8 CC_BASE; /* 4Fh */
} CONFIG_PAGE_FC_PORT_10_BASE_SFP_DATA,
MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_10_BASE_SFP_DATA,
@ -1313,7 +1358,9 @@ typedef struct _CONFIG_PAGE_FC_PORT_10_EXTENDED_SFP_DATA
U8 BitRateMin; /* 53h */
U8 VendorSN[16]; /* 54h */
U8 DateCode[8]; /* 64h */
U8 Reserved5[3]; /* 6Ch */
U8 DiagMonitoringType; /* 6Ch */
U8 EnhancedOptions; /* 6Dh */
U8 SFF8472Compliance; /* 6Eh */
U8 CC_EXT; /* 6Fh */
} CONFIG_PAGE_FC_PORT_10_EXTENDED_SFP_DATA,
MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_10_EXTENDED_SFP_DATA,
@ -1340,7 +1387,7 @@ typedef struct _CONFIG_PAGE_FC_PORT_10
} CONFIG_PAGE_FC_PORT_10, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_10,
FCPortPage10_t, MPI_POINTER pFCPortPage10_t;
#define MPI_FCPORTPAGE10_PAGEVERSION (0x00)
#define MPI_FCPORTPAGE10_PAGEVERSION (0x01)
/* standard MODDEF pin definitions (from GBIC spec.) */
#define MPI_FCPORTPAGE10_FLAGS_MODDEF_MASK (0x00000007)
@ -1374,7 +1421,7 @@ typedef struct _CONFIG_PAGE_FC_DEVICE_0
U8 Flags; /* 19h */
U16 BBCredit; /* 1Ah */
U16 MaxRxFrameSize; /* 1Ch */
U8 Reserved1; /* 1Eh */
U8 ADISCHardALPA; /* 1Eh */
U8 PortNumber; /* 1Fh */
U8 FcPhLowestVersion; /* 20h */
U8 FcPhHighestVersion; /* 21h */
@ -1383,7 +1430,7 @@ typedef struct _CONFIG_PAGE_FC_DEVICE_0
} CONFIG_PAGE_FC_DEVICE_0, MPI_POINTER PTR_CONFIG_PAGE_FC_DEVICE_0,
FCDevicePage0_t, MPI_POINTER pFCDevicePage0_t;
#define MPI_FC_DEVICE_PAGE0_PAGEVERSION (0x02)
#define MPI_FC_DEVICE_PAGE0_PAGEVERSION (0x03)
#define MPI_FC_DEVICE_PAGE0_FLAGS_TARGETID_BUS_VALID (0x01)
#define MPI_FC_DEVICE_PAGE0_FLAGS_PLOGI_INVALID (0x02)
@ -1392,6 +1439,7 @@ typedef struct _CONFIG_PAGE_FC_DEVICE_0
#define MPI_FC_DEVICE_PAGE0_PROT_IP (0x01)
#define MPI_FC_DEVICE_PAGE0_PROT_FCP_TARGET (0x02)
#define MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR (0x04)
#define MPI_FC_DEVICE_PAGE0_PROT_FCP_RETRY (0x08)
#define MPI_FC_DEVICE_PAGE0_PGAD_PORT_MASK (MPI_FC_DEVICE_PGAD_PORT_MASK)
#define MPI_FC_DEVICE_PAGE0_PGAD_FORM_MASK (MPI_FC_DEVICE_PGAD_FORM_MASK)
@ -1402,6 +1450,7 @@ typedef struct _CONFIG_PAGE_FC_DEVICE_0
#define MPI_FC_DEVICE_PAGE0_PGAD_BUS_SHIFT (MPI_FC_DEVICE_PGAD_BT_BUS_SHIFT)
#define MPI_FC_DEVICE_PAGE0_PGAD_TID_MASK (MPI_FC_DEVICE_PGAD_BT_TID_MASK)
#define MPI_FC_DEVICE_PAGE0_HARD_ALPA_UNKNOWN (0xFF)
/****************************************************************************
* RAID Volume Config Pages
@ -1487,8 +1536,9 @@ typedef struct _CONFIG_PAGE_RAID_VOL_0
U32 Reserved2; /* 1Ch */
U32 Reserved3; /* 20h */
U8 NumPhysDisks; /* 24h */
U8 Reserved4; /* 25h */
U16 Reserved5; /* 26h */
U8 DataScrubRate; /* 25h */
U8 ResyncRate; /* 26h */
U8 InactiveStatus; /* 27h */
RAID_VOL0_PHYS_DISK PhysDisk[MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX];/* 28h */
} CONFIG_PAGE_RAID_VOL_0, MPI_POINTER PTR_CONFIG_PAGE_RAID_VOL_0,
RaidVolumePage0_t, MPI_POINTER pRaidVolumePage0_t;

View File

@ -1,34 +1,40 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_FC.H
* Title: MPI Fibre Channel messages and structures
* Creation Date: June 12, 2000
*
* MPI Version: 01.02.02
* MPI_FC.H Version: 01.02.04
*
* Version History
* ---------------
@ -57,6 +63,8 @@
* 08-08-01 01.02.01 Original release for v1.2 work.
* 09-28-01 01.02.02 Change name of reserved field in
* MSG_LINK_SERVICE_RSP_REPLY.
* 05-31-02 01.02.03 Adding AliasIndex to FC Direct Access requests.
* 01-16-04 01.02.04 Added define for MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK.
* --------------------------------------------------------------------------
*/
@ -215,7 +223,7 @@ typedef struct _MSG_LINK_SERVICE_RSP_REPLY
typedef struct _MSG_EXLINK_SERVICE_SEND_REQUEST
{
U8 SendFlags; /* 00h */
U8 Reserved; /* 01h */
U8 AliasIndex; /* 01h */
U8 ChainOffset; /* 02h */
U8 Function; /* 03h */
U32 MsgFlags_Did; /* 04h */
@ -234,7 +242,8 @@ typedef struct _MSG_EXLINK_SERVICE_SEND_REQUEST
/* Extended Link Service Send Reply */
typedef struct _MSG_EXLINK_SERVICE_SEND_REPLY
{
U16 Reserved; /* 00h */
U8 Reserved; /* 00h */
U8 AliasIndex; /* 01h */
U8 MsgLength; /* 02h */
U8 Function; /* 03h */
U16 Reserved1; /* 04h */
@ -297,7 +306,7 @@ typedef struct _MSG_FC_ABORT_REPLY
typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REQUEST
{
U8 SendFlags; /* 00h */
U8 Reserved; /* 01h */
U8 AliasIndex; /* 01h */
U8 ChainOffset; /* 02h */
U8 Function; /* 03h */
U32 MsgFlags_Did; /* 04h */
@ -319,7 +328,8 @@ typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REQUEST
/* FC Common Transport Send Reply */
typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REPLY
{
U16 Reserved; /* 00h */
U8 Reserved; /* 00h */
U8 AliasIndex; /* 01h */
U8 MsgLength; /* 02h */
U8 Function; /* 03h */
U16 Reserved1; /* 04h */
@ -353,6 +363,7 @@ typedef struct _MSG_FC_PRIMITIVE_SEND_REQUEST
FcPrimitiveSendRequest_t, MPI_POINTER pFcPrimitiveSendRequest_t;
#define MPI_FC_PRIM_SEND_FLAGS_PORT_MASK (0x01)
#define MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK (0x02)
#define MPI_FC_PRIM_SEND_FLAGS_RESET_LINK (0x04)
#define MPI_FC_PRIM_SEND_FLAGS_STOP_SEND (0x08)
#define MPI_FC_PRIM_SEND_FLAGS_SEND_ONCE (0x10)

View File

@ -1,34 +1,40 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_INIT.H
* Title: MPI initiator mode messages and structures
* Creation Date: June 8, 2000
*
* MPI_INIT.H Version: 01.02.06
* MPI_INIT.H Version: 01.02.07
*
* Version History
* ---------------
@ -54,6 +60,7 @@
* 05-31-02 01.02.05 Added MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR define
* for SCSI IO requests.
* 11-15-02 01.02.06 Added special extended SCSI Status defines for FCP.
* 06-26-03 01.02.07 Added MPI_SCSI_STATUS_FCPEXT_UNASSIGNED define.
* --------------------------------------------------------------------------
*/
@ -178,6 +185,7 @@ typedef struct _MSG_SCSI_IO_REPLY
#define MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT (0x80)
#define MPI_SCSI_STATUS_FCPEXT_NO_LINK (0x81)
#define MPI_SCSI_STATUS_FCPEXT_UNASSIGNED (0x82)
/* SCSI IO Reply SCSIState values */

View File

@ -1,34 +1,40 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_IOC.H
* Title: MPI IOC, Port, Event, FW Download, and FW Upload messages
* Creation Date: August 11, 2000
*
* MPI_IOC.H Version: 01.02.07
* MPI_IOC.H Version: 01.02.08
*
* Version History
* ---------------
@ -78,6 +84,7 @@
* MPI_IOCFACTS_EXCEPT_RAID_CONFIG_INVALID.
* Added AliasIndex to EVENT_DATA_LOGOUT structure.
* 04-01-03 01.02.07 Added defines for MPI_FW_HEADER_SIGNATURE_.
* 06-26-03 01.02.08 Added new values to the product family defines.
* --------------------------------------------------------------------------
*/
@ -700,6 +707,8 @@ typedef struct _MPI_FW_HEADER
#define MPI_FW_HEADER_PID_FAMILY_1020C0_SCSI (0x0008)
#define MPI_FW_HEADER_PID_FAMILY_1035A0_SCSI (0x0009)
#define MPI_FW_HEADER_PID_FAMILY_1035B0_SCSI (0x000A)
#define MPI_FW_HEADER_PID_FAMILY_1030TA0_SCSI (0x000B)
#define MPI_FW_HEADER_PID_FAMILY_1020TA0_SCSI (0x000C)
#define MPI_FW_HEADER_PID_FAMILY_909_FC (0x0000)
#define MPI_FW_HEADER_PID_FAMILY_919_FC (0x0001)
#define MPI_FW_HEADER_PID_FAMILY_919X_FC (0x0002)

View File

@ -1,34 +1,40 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_LAN.H
* Title: MPI LAN messages and structures
* Creation Date: June 30, 2000
*
* MPI Version: 01.02.01
* MPI_LAN.H Version: 01.02.01
*
* Version History
* ---------------

View File

@ -1,27 +1,33 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_RAID.H
@ -106,6 +112,8 @@ typedef struct _MSG_RAID_ACTION
#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)

View File

@ -1,34 +1,40 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_TARG.H
* Title: MPI Target mode messages and structures
* Creation Date: June 22, 2000
*
* MPI Version: 01.02.04
* MPI_TARG.H Version: 01.02.09
*
* Version History
* ---------------
@ -56,6 +62,15 @@
* of MPI.
* 10-04-01 01.02.03 Added PriorityReason to MSG_TARGET_ERROR_REPLY.
* 11-01-01 01.02.04 Added define for TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY.
* 03-14-02 01.02.05 Modified MPI_TARGET_FCP_RSP_BUFFER to get the proper
* byte ordering.
* 05-31-02 01.02.06 Modified TARGET_MODE_REPLY_ALIAS_MASK to only include
* one bit.
* Added AliasIndex field to MPI_TARGET_FCP_CMD_BUFFER.
* 09-16-02 01.02.07 Added flags for confirmed completion.
* Added PRIORITY_REASON_TARGET_BUSY.
* 11-15-02 01.02.08 Added AliasID field to MPI_TARGET_SCSI_SPI_CMD_BUFFER.
* 04-01-03 01.02.09 Added OptionalOxid field to MPI_TARGET_FCP_CMD_BUFFER.
* --------------------------------------------------------------------------
*/
@ -77,7 +92,7 @@ typedef struct _CMD_BUFFER_DESCRIPTOR
{
U32 PhysicalAddress32;
U64 PhysicalAddress64;
} _u;
} u;
} CMD_BUFFER_DESCRIPTOR, MPI_POINTER PTR_CMD_BUFFER_DESCRIPTOR,
CmdBufferDescriptor_t, MPI_POINTER pCmdBufferDescriptor_t;
@ -155,6 +170,7 @@ typedef struct _MSG_PRIORITY_CMD_RECEIVED_REPLY
#define PRIORITY_REASON_PROTOCOL_ERR (0x06)
#define PRIORITY_REASON_DATA_OUT_PARITY_ERR (0x07)
#define PRIORITY_REASON_DATA_OUT_CRC_ERR (0x08)
#define PRIORITY_REASON_TARGET_BUSY (0x09)
#define PRIORITY_REASON_UNKNOWN (0xFF)
@ -183,6 +199,9 @@ typedef struct _MPI_TARGET_FCP_CMD_BUFFER
U8 FcpCntl[4]; /* 08h */
U8 FcpCdb[16]; /* 0Ch */
U32 FcpDl; /* 1Ch */
U8 AliasIndex; /* 20h */
U8 Reserved1; /* 21h */
U16 OptionalOxid; /* 22h */
} MPI_TARGET_FCP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_CMD_BUFFER,
MpiTargetFcpCmdBuffer, MPI_POINTER pMpiTargetFcpCmdBuffer;
@ -201,6 +220,10 @@ typedef struct _MPI_TARGET_SCSI_SPI_CMD_BUFFER
U8 TaskManagementFlags; /* 12h */
U8 AdditionalCDBLength; /* 13h */
U8 CDB[16]; /* 14h */
/* Alias ID */
U8 AliasID; /* 24h */
U8 Reserved1; /* 25h */
U16 Reserved2; /* 26h */
} MPI_TARGET_SCSI_SPI_CMD_BUFFER,
MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_CMD_BUFFER,
MpiTargetScsiSpiCmdBuffer, MPI_POINTER pMpiTargetScsiSpiCmdBuffer;
@ -231,6 +254,7 @@ typedef struct _MSG_TARGET_ASSIST_REQUEST
#define TARGET_ASSIST_FLAGS_DATA_DIRECTION (0x01)
#define TARGET_ASSIST_FLAGS_AUTO_STATUS (0x02)
#define TARGET_ASSIST_FLAGS_HIGH_PRIORITY (0x04)
#define TARGET_ASSIST_FLAGS_CONFIRMED (0x08)
#define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80)
@ -275,14 +299,19 @@ typedef struct _MSG_TARGET_STATUS_SEND_REQUEST
#define TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS (0x01)
#define TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY (0x04)
#define TARGET_STATUS_SEND_FLAGS_CONFIRMED (0x08)
#define TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER (0x80)
/*
* NOTE: FCP_RSP data is big-endian. When used on a little-endian system, this
* structure properly orders the bytes.
*/
typedef struct _MPI_TARGET_FCP_RSP_BUFFER
{
U8 Reserved0[8]; /* 00h */
U8 FcpStatus; /* 08h */
U8 FcpFlags; /* 09h */
U8 Reserved1[2]; /* 0Ah */
U8 Reserved1[2]; /* 08h */
U8 FcpFlags; /* 0Ah */
U8 FcpStatus; /* 0Bh */
U32 FcpResid; /* 0Ch */
U32 FcpSenseLength; /* 10h */
U32 FcpResponseLength; /* 14h */
@ -291,6 +320,10 @@ typedef struct _MPI_TARGET_FCP_RSP_BUFFER
} MPI_TARGET_FCP_RSP_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_RSP_BUFFER,
MpiTargetFcpRspBuffer, MPI_POINTER pMpiTargetFcpRspBuffer;
/*
* NOTE: The SPI status IU is big-endian. When used on a little-endian system,
* this structure properly orders the bytes.
*/
typedef struct _MPI_TARGET_SCSI_SPI_STATUS_IU
{
U8 Reserved0; /* 00h */
@ -354,7 +387,7 @@ typedef struct _MSG_TARGET_MODE_ABORT_REPLY
#define TARGET_MODE_REPLY_IO_INDEX_SHIFT (0)
#define TARGET_MODE_REPLY_INITIATOR_INDEX_MASK (0x03FFC000)
#define TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT (14)
#define TARGET_MODE_REPLY_ALIAS_MASK (0x0C000000)
#define TARGET_MODE_REPLY_ALIAS_MASK (0x04000000)
#define TARGET_MODE_REPLY_ALIAS_SHIFT (26)
#define TARGET_MODE_REPLY_PORT_MASK (0x10000000)
#define TARGET_MODE_REPLY_PORT_SHIFT (28)

View File

@ -1,27 +1,33 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 2000, 2001 by LSI Logic Corporation
*
/*
* Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Name: MPI_TYPE.H
@ -46,9 +52,6 @@
#ifndef MPI_TYPE_H
#define MPI_TYPE_H
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*******************************************************************************
* Define MPI_POINTER if it hasn't already been defined. By default MPI_POINTER
@ -66,24 +69,12 @@
*
*****************************************************************************/
typedef signed char S8;
typedef unsigned char U8;
typedef signed short S16;
typedef unsigned short U16;
#if defined(unix) || defined(__arm) || defined(ALPHA) \
|| defined(__CC_INT_IS_32BIT)
typedef signed int S32;
typedef unsigned int U32;
#else
typedef signed long S32;
typedef unsigned long U32;
#endif
typedef int8_t S8;
typedef uint8_t U8;
typedef int16_t S16;
typedef uint16_t U16;
typedef int32_t S32;
typedef uint32_t U32;
typedef struct _S64
{

File diff suppressed because it is too large Load Diff

View File

@ -25,155 +25,828 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Additional Copyright (c) 2002 by Matthew Jacob under same license.
*/
/*
* Additional Copyright (c) 2002 by Matthew Jacob under same license.
* Copyright (c) 2004, Avid Technology, Inc. and its contributors.
* Copyright (c) 2004, 2005 Justin T. Gibbs
* Copyright (c) 2005, WHEEL Sp. z o.o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MPT_H_
#define _MPT_H_
#include <dev/mpt/mpt_freebsd.h>
/********************************* OS Includes ********************************/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/endian.h>
#include <sys/eventhandler.h>
#if __FreeBSD_version < 500000
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#else
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#endif
#include <sys/proc.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/resource.h>
#include <sys/rman.h>
#include "opt_ddb.h"
/**************************** Register Definitions ****************************/
#include <dev/mpt/mpt_reg.h>
/******************************* MPI Definitions ******************************/
#include <dev/mpt/mpilib/mpi_type.h>
#include <dev/mpt/mpilib/mpi.h>
#include <dev/mpt/mpilib/mpi_cnfg.h>
#include <dev/mpt/mpilib/mpi_ioc.h>
#include <dev/mpt/mpilib/mpi_raid.h>
/* XXX For mpt_debug.c */
#include <dev/mpt/mpilib/mpi_init.h>
/****************************** Misc Definitions ******************************/
#define MPT_OK (0)
#define MPT_FAIL (0x10000)
/* Register Offset to chip registers */
#define MPT_OFFSET_DOORBELL 0x00
#define MPT_OFFSET_SEQUENCE 0x04
#define MPT_OFFSET_DIAGNOSTIC 0x08
#define MPT_OFFSET_TEST 0x0C
#define MPT_OFFSET_INTR_STATUS 0x30
#define MPT_OFFSET_INTR_MASK 0x34
#define MPT_OFFSET_REQUEST_Q 0x40
#define MPT_OFFSET_REPLY_Q 0x44
#define MPT_OFFSET_HOST_INDEX 0x50
#define MPT_OFFSET_FUBAR 0x90
#define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array))
#define MPT_DIAG_SEQUENCE_1 0x04
#define MPT_DIAG_SEQUENCE_2 0x0b
#define MPT_DIAG_SEQUENCE_3 0x02
#define MPT_DIAG_SEQUENCE_4 0x07
#define MPT_DIAG_SEQUENCE_5 0x0d
/**************************** Forward Declarations ****************************/
struct mpt_softc;
struct mpt_personality;
typedef struct req_entry request_t;
/* Bit Maps for DOORBELL register */
enum DB_STATE_BITS {
MPT_DB_STATE_RESET = 0x00000000,
MPT_DB_STATE_READY = 0x10000000,
MPT_DB_STATE_RUNNING = 0x20000000,
MPT_DB_STATE_FAULT = 0x40000000,
MPT_DB_STATE_MASK = 0xf0000000
/************************* Personality Module Support *************************/
typedef int mpt_load_handler_t(struct mpt_personality *);
typedef int mpt_probe_handler_t(struct mpt_softc *);
typedef int mpt_attach_handler_t(struct mpt_softc *);
typedef int mpt_event_handler_t(struct mpt_softc *, request_t *,
MSG_EVENT_NOTIFY_REPLY *);
typedef void mpt_reset_handler_t(struct mpt_softc *, int /*type*/);
/* XXX Add return value and use for veto? */
typedef void mpt_shutdown_handler_t(struct mpt_softc *);
typedef void mpt_detach_handler_t(struct mpt_softc *);
typedef int mpt_unload_handler_t(struct mpt_personality *);
struct mpt_personality
{
const char *name;
uint32_t id; /* Assigned identifier. */
u_int use_count; /* Instances using personality*/
mpt_load_handler_t *load; /* configure personailty */
#define MPT_PERS_FIRST_HANDLER(pers) (&(pers)->load)
mpt_probe_handler_t *probe; /* configure personailty */
mpt_attach_handler_t *attach; /* initialize device instance */
mpt_event_handler_t *event; /* Handle MPI event. */
mpt_reset_handler_t *reset; /* Re-init after reset. */
mpt_shutdown_handler_t *shutdown; /* Shutdown instance. */
mpt_detach_handler_t *detach; /* release device instance */
mpt_unload_handler_t *unload; /* Shutdown personality */
#define MPT_PERS_LAST_HANDLER(pers) (&(pers)->unload)
};
#define MPT_STATE(v) ((enum DB_STATE_BITS)((v) & MPT_DB_STATE_MASK))
int mpt_modevent(module_t, int, void *);
#define MPT_DB_LENGTH_SHIFT (16)
#define MPT_DB_DATA_MASK (0xffff)
/* Maximum supported number of personalities. */
#define MPT_MAX_PERSONALITIES (15)
#define MPT_DB_DB_USED 0x08000000
#define MPT_DB_IS_IN_USE(v) (((v) & MPT_DB_DB_USED) != 0)
#define MPT_PERSONALITY_DEPEND(name, dep, vmin, vpref, vmax) \
MODULE_DEPEND(name, dep, vmin, vpref, vmax)
#define DECLARE_MPT_PERSONALITY(name, order) \
static moduledata_t name##_mod = { \
#name, mpt_modevent, &name##_personality \
}; \
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, order); \
MODULE_VERSION(name, 1); \
MPT_PERSONALITY_DEPEND(name, mpt_core, 1, 1, 1)
/******************************* Bus DMA Support ******************************/
/* XXX Need to update bus_dmamap_sync to take a range argument. */
#define bus_dmamap_sync_range(dma_tag, dmamap, offset, len, op) \
bus_dmamap_sync(dma_tag, dmamap, op)
#if __FreeBSD_version >= 501102
#define mpt_dma_tag_create(mpt, parent_tag, alignment, boundary, \
lowaddr, highaddr, filter, filterarg, \
maxsize, nsegments, maxsegsz, flags, \
dma_tagp) \
bus_dma_tag_create(parent_tag, alignment, boundary, \
lowaddr, highaddr, filter, filterarg, \
maxsize, nsegments, maxsegsz, flags, \
busdma_lock_mutex, &Giant, \
dma_tagp)
#else
#define mpt_dma_tag_create(mpt, parent_tag, alignment, boundary, \
lowaddr, highaddr, filter, filterarg, \
maxsize, nsegments, maxsegsz, flags, \
dma_tagp) \
bus_dma_tag_create(parent_tag, alignment, boundary, \
lowaddr, highaddr, filter, filterarg, \
maxsize, nsegments, maxsegsz, flags, \
dma_tagp)
#endif
struct mpt_map_info {
struct mpt_softc *mpt;
int error;
uint32_t phys;
};
void mpt_map_rquest(void *, bus_dma_segment_t *, int, int);
/**************************** Kernel Thread Support ***************************/
#if __FreeBSD_version > 500005
#define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
#else
#define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, fmtstr, arg)
#endif
/****************************** Timer Facilities ******************************/
#if __FreeBSD_version > 500000
#define mpt_callout_init(c) callout_init(c, /*mpsafe*/0);
#else
#define mpt_callout_init(c) callout_init(c);
#endif
/********************************** Endianess *********************************/
static __inline uint64_t
u64toh(U64 s)
{
uint64_t result;
result = le32toh(s.Low);
result |= ((uint64_t)le32toh(s.High)) << 32;
return (result);
}
/**************************** MPI Transaction State ***************************/
typedef enum {
REQ_STATE_FREE = 0x00,
REQ_STATE_ALLOCATED = 0x01,
REQ_STATE_QUEUED = 0x02,
REQ_STATE_DONE = 0x04,
REQ_STATE_TIMEDOUT = 0x08,
REQ_STATE_NEED_WAKEUP = 0x10,
REQ_STATE_MASK = 0xFF
} mpt_req_state_t;
struct req_entry {
TAILQ_ENTRY(req_entry) links; /* Pointer to next in list */
mpt_req_state_t state; /* Request State Information */
uint16_t index; /* Index of this entry */
uint16_t IOCStatus; /* Completion status */
union ccb *ccb; /* CAM request */
void *req_vbuf; /* Virtual Address of Entry */
void *sense_vbuf; /* Virtual Address of sense data */
bus_addr_t req_pbuf; /* Physical Address of Entry */
bus_addr_t sense_pbuf; /* Physical Address of sense data */
bus_dmamap_t dmap; /* DMA map for data buffer */
};
/**************************** Handler Registration ****************************/
/*
* Global table of registered reply handlers. The
* handler is indicated by byte 3 of the request
* index submitted to the IOC. This allows the
* driver core to perform generic processing without
* any knowledge of per-personality behavior.
*
* MPT_NUM_REPLY_HANDLERS must be a power of 2
* to allow the easy generation of a mask.
*
* The handler offsets used by the core are hard coded
* allowing faster code generation when assigning a handler
* to a request. All "personalities" must use the
* the handler registration mechanism.
*
* The IOC handlers that are rarely executed are placed
* at the tail of the table to make it more likely that
* all commonly executed handlers fit in a single cache
* line.
*/
#define MPT_NUM_REPLY_HANDLERS (16)
#define MPT_REPLY_HANDLER_EVENTS MPT_CBI_TO_HID(0)
#define MPT_REPLY_HANDLER_CONFIG MPT_CBI_TO_HID(MPT_NUM_REPLY_HANDLERS-1)
#define MPT_REPLY_HANDLER_HANDSHAKE MPT_CBI_TO_HID(MPT_NUM_REPLY_HANDLERS-2)
typedef int mpt_reply_handler_t(struct mpt_softc *mpt, request_t *request,
MSG_DEFAULT_REPLY *reply_frame);
typedef union {
mpt_reply_handler_t *reply_handler;
} mpt_handler_t;
typedef enum {
MPT_HANDLER_REPLY,
MPT_HANDLER_EVENT,
MPT_HANDLER_RESET,
MPT_HANDLER_SHUTDOWN
} mpt_handler_type;
struct mpt_handler_record
{
LIST_ENTRY(mpt_handler_record) links;
mpt_handler_t handler;
};
LIST_HEAD(mpt_handler_list, mpt_handler_record);
/*
* "Whom" initializor values
* The handler_id is currently unused but would contain the
* handler ID used in the MsgContext field to allow direction
* of replies to the handler. Registrations that don't require
* a handler id can pass in NULL for the handler_id.
*
* Deregistrations for handlers without a handler id should
* pass in MPT_HANDLER_ID_NONE.
*/
#define MPT_DB_INIT_NOONE 0x00
#define MPT_DB_INIT_BIOS 0x01
#define MPT_DB_INIT_ROMBIOS 0x02
#define MPT_DB_INIT_PCIPEER 0x03
#define MPT_DB_INIT_HOST 0x04
#define MPT_DB_INIT_MANUFACTURE 0x05
#define MPT_HANDLER_ID_NONE (0xFFFFFFFF)
int mpt_register_handler(struct mpt_softc *, mpt_handler_type,
mpt_handler_t, uint32_t *);
int mpt_deregister_handler(struct mpt_softc *, mpt_handler_type,
mpt_handler_t, uint32_t);
#define MPT_WHO(v) \
((v & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT)
/******************* Per-Controller Instance Data Structures ******************/
TAILQ_HEAD(req_queue, req_entry);
/* Function Maps for DOORBELL register */
enum DB_FUNCTION_BITS {
MPT_FUNC_IOC_RESET = 0x40000000,
MPT_FUNC_UNIT_RESET = 0x41000000,
MPT_FUNC_HANDSHAKE = 0x42000000,
MPT_FUNC_REPLY_REMOVE = 0x43000000,
MPT_FUNC_MASK = 0xff000000
/* Structure for saving proper values for modifyable PCI config registers */
struct mpt_pci_cfg {
uint16_t Command;
uint16_t LatencyTimer_LineSize;
uint32_t IO_BAR;
uint32_t Mem0_BAR[2];
uint32_t Mem1_BAR[2];
uint32_t ROM_BAR;
uint8_t IntLine;
uint32_t PMCSR;
};
/* Function Maps for INTERRUPT request register */
enum _MPT_INTR_REQ_BITS {
MPT_INTR_DB_BUSY = 0x80000000,
MPT_INTR_REPLY_READY = 0x00000008,
MPT_INTR_DB_READY = 0x00000001
typedef enum {
MPT_RVF_NONE = 0x0,
MPT_RVF_ACTIVE = 0x1,
MPT_RVF_ANNOUNCED = 0x2,
MPT_RVF_UP2DATE = 0x4,
MPT_RVF_REFERENCED = 0x8,
MPT_RVF_WCE_CHANGED = 0x10
} mpt_raid_volume_flags;
struct mpt_raid_volume {
CONFIG_PAGE_RAID_VOL_0 *config_page;
MPI_RAID_VOL_INDICATOR sync_progress;
mpt_raid_volume_flags flags;
u_int quieced_disks;
};
#define MPT_DB_IS_BUSY(v) (((v) & MPT_INTR_DB_BUSY) != 0)
#define MPT_DB_INTR(v) (((v) & MPT_INTR_DB_READY) != 0)
#define MPT_REPLY_INTR(v) (((v) & MPT_INTR_REPLY_READY) != 0)
typedef enum {
MPT_RDF_NONE = 0x00,
MPT_RDF_ACTIVE = 0x01,
MPT_RDF_ANNOUNCED = 0x02,
MPT_RDF_UP2DATE = 0x04,
MPT_RDF_REFERENCED = 0x08,
MPT_RDF_QUIESCING = 0x10,
MPT_RDF_QUIESCED = 0x20
} mpt_raid_disk_flags;
/* Function Maps for INTERRUPT make register */
enum _MPT_INTR_MASK_BITS {
MPT_INTR_REPLY_MASK = 0x00000008,
MPT_INTR_DB_MASK = 0x00000001
struct mpt_raid_disk {
CONFIG_PAGE_RAID_PHYS_DISK_0 config_page;
struct mpt_raid_volume *volume;
u_int member_number;
u_int pass_thru_active;
mpt_raid_disk_flags flags;
};
/* Function Maps for DIAGNOSTIC make register */
enum _MPT_DIAG_BITS {
MPT_DIAG_ENABLED = 0x00000080,
MPT_DIAG_FLASHBAD = 0x00000040,
MPT_DIAG_RESET_HIST = 0x00000020,
MPT_DIAG_TTLI = 0x00000008,
MPT_DIAG_RESET_IOC = 0x00000004,
MPT_DIAG_ARM_DISABLE = 0x00000002,
MPT_DIAG_DME = 0x00000001
struct mpt_evtf_record {
MSG_EVENT_NOTIFY_REPLY reply;
uint32_t context;
LIST_ENTRY(mpt_evtf_record) links;
};
/* Magic addresses in diagnostic memory space */
#define MPT_DIAG_IOP_BASE (0x00000000)
#define MPT_DIAG_IOP_SIZE (0x00002000)
#define MPT_DIAG_GPIO (0x00030010)
#define MPT_DIAG_IOPQ_REG_BASE0 (0x00050004)
#define MPT_DIAG_IOPQ_REG_BASE1 (0x00051004)
#define MPT_DIAG_MEM_CFG_BASE (0x00040000)
#define MPT_DIAG_CTX0_BASE (0x000E0000)
#define MPT_DIAG_CTX0_SIZE (0x00002000)
#define MPT_DIAG_CTX1_BASE (0x001E0000)
#define MPT_DIAG_CTX1_SIZE (0x00002000)
#define MPT_DIAG_FLASH_BASE (0x00800000)
#define MPT_DIAG_RAM_BASE (0x01000000)
#define MPT_DIAG_RAM_SIZE (0x00400000)
LIST_HEAD(mpt_evtf_list, mpt_evtf_record);
/* GPIO bit assignments */
#define MPT_DIAG_GPIO_SCL (0x00010000)
#define MPT_DIAG_GPIO_SDA_OUT (0x00008000)
#define MPT_DIAG_GPIO_SDA_IN (0x00004000)
struct mpt_softc {
device_t dev;
#if __FreeBSD_version < 500000
int mpt_splsaved;
uint32_t mpt_islocked;
#else
struct mtx mpt_lock;
#endif
uint32_t mpt_pers_mask;
uint32_t : 15,
raid_mwce_set : 1,
getreqwaiter : 1,
shutdwn_raid : 1,
shutdwn_recovery: 1,
unit : 8,
outofbeer : 1,
mpt_locksetup : 1,
disabled : 1,
is_fc : 1,
bus : 1; /* FC929/1030 have two busses */
#define MPT_REPLY_EMPTY (0xffffffff) /* Reply Queue Empty Symbol */
#define MPT_CONTEXT_REPLY (0x80000000)
#define MPT_CONTEXT_MASK (~0xE0000000)
u_int verbose;
#ifdef _KERNEL
int mpt_soft_reset(mpt_softc_t *mpt);
void mpt_hard_reset(mpt_softc_t *mpt);
int mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply);
/*
* IOC Facts
*/
uint16_t mpt_global_credits;
uint16_t request_frame_size;
uint8_t mpt_max_devices;
uint8_t mpt_max_buses;
void mpt_send_cmd(mpt_softc_t *mpt, request_t *req);
void mpt_free_reply(mpt_softc_t *mpt, u_int32_t ptr);
void mpt_enable_ints(mpt_softc_t *mpt);
void mpt_disable_ints(mpt_softc_t *mpt);
u_int32_t mpt_pop_reply_queue(mpt_softc_t *mpt);
int mpt_init(mpt_softc_t *mpt, u_int32_t who);
int mpt_reset(mpt_softc_t *mpt);
int mpt_send_handshake_cmd(mpt_softc_t *mpt, size_t len, void *cmd);
request_t * mpt_get_request(mpt_softc_t *mpt);
void mpt_free_request(mpt_softc_t *mpt, request_t *req);
int mpt_intr(void *dummy);
void mpt_check_doorbell(mpt_softc_t * mpt);
/*
* Port Facts
* XXX - Add multi-port support!.
*/
uint16_t mpt_ini_id;
uint16_t mpt_port_type;
uint16_t mpt_proto_flags;
int mpt_read_cfg_page(mpt_softc_t *, int, CONFIG_PAGE_HEADER *);
int mpt_write_cfg_page(mpt_softc_t *, int, CONFIG_PAGE_HEADER *);
/*
* Device Configuration Information
*/
union {
struct mpt_spi_cfg {
CONFIG_PAGE_SCSI_PORT_0 _port_page0;
CONFIG_PAGE_SCSI_PORT_1 _port_page1;
CONFIG_PAGE_SCSI_PORT_2 _port_page2;
CONFIG_PAGE_SCSI_DEVICE_0 _dev_page0[16];
CONFIG_PAGE_SCSI_DEVICE_1 _dev_page1[16];
uint16_t _tag_enable;
uint16_t _disc_enable;
uint16_t _update_params0;
uint16_t _update_params1;
} spi;
#define mpt_port_page0 cfg.spi._port_page0
#define mpt_port_page1 cfg.spi._port_page1
#define mpt_port_page2 cfg.spi._port_page2
#define mpt_dev_page0 cfg.spi._dev_page0
#define mpt_dev_page1 cfg.spi._dev_page1
#define mpt_tag_enable cfg.spi._tag_enable
#define mpt_disc_enable cfg.spi._disc_enable
#define mpt_update_params0 cfg.spi._update_params0
#define mpt_update_params1 cfg.spi._update_params1
struct mpi_fc_cfg {
uint8_t nada;
} fc;
} cfg;
/* Controller Info */
CONFIG_PAGE_IOC_2 * ioc_page2;
CONFIG_PAGE_IOC_3 * ioc_page3;
/* Raid Data */
struct mpt_raid_volume* raid_volumes;
struct mpt_raid_disk* raid_disks;
u_int raid_max_volumes;
u_int raid_max_disks;
u_int raid_page0_len;
u_int raid_wakeup;
u_int raid_rescan;
u_int raid_resync_rate;
u_int raid_mwce_setting;
u_int raid_queue_depth;
struct proc *raid_thread;
struct callout raid_timer;
/*
* PCI Hardware info
*/
struct resource * pci_irq; /* Interrupt map for chip */
void * ih; /* Interupt handle */
struct mpt_pci_cfg pci_cfg; /* saved PCI conf registers */
/*
* DMA Mapping Stuff
*/
struct resource * pci_reg; /* Register map for chip */
int pci_mem_rid; /* Resource ID */
bus_space_tag_t pci_st; /* Bus tag for registers */
bus_space_handle_t pci_sh; /* Bus handle for registers */
/* PIO versions of above. */
int pci_pio_rid;
struct resource * pci_pio_reg;
bus_space_tag_t pci_pio_st;
bus_space_handle_t pci_pio_sh;
bus_dma_tag_t parent_dmat; /* DMA tag for parent PCI bus */
bus_dma_tag_t reply_dmat; /* DMA tag for reply memory */
bus_dmamap_t reply_dmap; /* DMA map for reply memory */
uint8_t *reply; /* KVA of reply memory */
bus_addr_t reply_phys; /* BusAddr of reply memory */
bus_dma_tag_t buffer_dmat; /* DMA tag for buffers */
bus_dma_tag_t request_dmat; /* DMA tag for request memroy */
bus_dmamap_t request_dmap; /* DMA map for request memroy */
uint8_t *request; /* KVA of Request memory */
bus_addr_t request_phys; /* BusADdr of request memory */
u_int reset_cnt;
/*
* CAM && Software Management
*/
request_t *request_pool;
struct req_queue request_free_list;
struct req_queue request_pending_list;
struct req_queue request_timeout_list;
/*
* Deferred frame acks due to resource shortage.
*/
struct mpt_evtf_list ack_frames;
struct cam_sim *sim;
struct cam_path *path;
struct cam_sim *phydisk_sim;
struct cam_path *phydisk_path;
struct proc *recovery_thread;
request_t *tmf_req;
uint32_t sequence; /* Sequence Number */
uint32_t timeouts; /* timeout count */
uint32_t success; /* successes afer timeout */
/* Opposing port in a 929 or 1030, or NULL */
struct mpt_softc * mpt2;
/* FW Image management */
uint32_t fw_image_size;
uint8_t *fw_image;
bus_dma_tag_t fw_dmat; /* DMA tag for firmware image */
bus_dmamap_t fw_dmap; /* DMA map for firmware image */
bus_addr_t fw_phys; /* BusAddr of request memory */
/* Shutdown Event Handler. */
eventhandler_tag eh;
TAILQ_ENTRY(mpt_softc) links;
};
/***************************** Locking Primatives *****************************/
#if __FreeBSD_version < 500000
#define MPT_IFLAGS INTR_TYPE_CAM
#define MPT_LOCK(mpt) mpt_lockspl(mpt)
#define MPT_UNLOCK(mpt) mpt_unlockspl(mpt)
#define MPTLOCK_2_CAMLOCK MPT_UNLOCK
#define CAMLOCK_2_MPTLOCK MPT_LOCK
#define MPT_LOCK_SETUP(mpt)
#define MPT_LOCK_DESTROY(mpt)
static __inline void mpt_lockspl(struct mpt_softc *mpt);
static __inline void mpt_unlockspl(struct mpt_softc *mpt);
static __inline void
mpt_lockspl(struct mpt_softc *mpt)
{
int s;
s = splcam();
if (mpt->mpt_islocked++ == 0) {
mpt->mpt_splsaved = s;
} else {
splx(s);
panic("Recursed lock with mask: 0x%x\n", s);
}
}
static __inline void
mpt_unlockspl(struct mpt_softc *mpt)
{
if (mpt->mpt_islocked) {
if (--mpt->mpt_islocked == 0) {
splx(mpt->mpt_splsaved);
}
} else
panic("Negative lock count\n");
}
static __inline int
mpt_sleep(struct mpt_softc *mpt, void *ident, int priority,
const char *wmesg, int timo)
{
int saved_cnt;
int saved_spl;
int error;
KASSERT(mpt->mpt_islocked <= 1, ("Invalid lock count on tsleep"));
saved_cnt = mpt->mpt_islocked;
saved_spl = mpt->mpt_splsaved;
mpt->mpt_islocked = 0;
error = tsleep(ident, priority, wmesg, timo);
KASSERT(mpt->mpt_islocked = 0, ("Invalid lock count on wakeup"));
mpt->mpt_islocked = saved_cnt;
mpt->mpt_splsaved = saved_spl;
return (error);
}
#else
#if LOCKING_WORKED_AS_IT_SHOULD
#error "Shouldn't Be Here!"
#define MPT_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
#define MPT_LOCK_SETUP(mpt) \
mtx_init(&mpt->mpt_lock, "mpt", NULL, MTX_DEF); \
mpt->mpt_locksetup = 1
#define MPT_LOCK_DESTROY(mpt) \
if (mpt->mpt_locksetup) { \
mtx_destroy(&mpt->mpt_lock); \
mpt->mpt_locksetup = 0; \
}
#define MPT_LOCK(mpt) mtx_lock(&(mpt)->mpt_lock)
#define MPT_UNLOCK(mpt) mtx_unlock(&(mpt)->mpt_lock)
#define MPTLOCK_2_CAMLOCK(mpt) \
mtx_unlock(&(mpt)->mpt_lock); mtx_lock(&Giant)
#define CAMLOCK_2_MPTLOCK(mpt) \
mtx_unlock(&Giant); mtx_lock(&(mpt)->mpt_lock)
#define mpt_sleep(mpt, ident, priority, wmesg, timo) \
msleep(ident, &(mpt)->mpt_lock, priority, wmesg, timo)
#else
#define MPT_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY
#define MPT_LOCK_SETUP(mpt) do { } while (0)
#define MPT_LOCK_DESTROY(mpt) do { } while (0)
#define MPT_LOCK(mpt) do { } while (0)
#define MPT_UNLOCK(mpt) do { } while (0)
#define MPTLOCK_2_CAMLOCK(mpt) do { } while (0)
#define CAMLOCK_2_MPTLOCK(mpt) do { } while (0)
#define mpt_sleep(mpt, ident, priority, wmesg, timo) \
tsleep(ident, priority, wmesg, timo)
#endif
#endif
/******************************* Register Access ******************************/
static __inline void mpt_write(struct mpt_softc *, size_t, uint32_t);
static __inline uint32_t mpt_read(struct mpt_softc *, int);
static __inline void mpt_pio_write(struct mpt_softc *, size_t, uint32_t);
static __inline uint32_t mpt_pio_read(struct mpt_softc *, int);
static __inline void
mpt_write(struct mpt_softc *mpt, size_t offset, uint32_t val)
{
bus_space_write_4(mpt->pci_st, mpt->pci_sh, offset, val);
}
static __inline uint32_t
mpt_read(struct mpt_softc *mpt, int offset)
{
return (bus_space_read_4(mpt->pci_st, mpt->pci_sh, offset));
}
/*
* Some operations (e.g. diagnostic register writes while the ARM proccessor
* is disabled), must be performed using "PCI pio" operations. On non-PCI
* busses, these operations likely map to normal register accesses.
*/
static __inline void
mpt_pio_write(struct mpt_softc *mpt, size_t offset, uint32_t val)
{
bus_space_write_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset, val);
}
static __inline uint32_t
mpt_pio_read(struct mpt_softc *mpt, int offset)
{
return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset));
}
/*********************** Reply Frame/Request Management ***********************/
/* Max MPT Reply we are willing to accept (must be power of 2) */
#define MPT_REPLY_SIZE 128
#define MPT_MAX_REQUESTS(mpt) ((mpt)->is_fc ? 1024 : 256)
#define MPT_REQUEST_AREA 512
#define MPT_SENSE_SIZE 32 /* included in MPT_REQUEST_SIZE */
#define MPT_REQ_MEM_SIZE(mpt) (MPT_MAX_REQUESTS(mpt) * MPT_REQUEST_AREA)
#define MPT_CONTEXT_CB_SHIFT (16)
#define MPT_CBI(handle) (handle >> MPT_CONTEXT_CB_SHIFT)
#define MPT_CBI_TO_HID(cbi) ((cbi) << MPT_CONTEXT_CB_SHIFT)
#define MPT_CONTEXT_TO_CBI(x) \
(((x) >> MPT_CONTEXT_CB_SHIFT) & (MPT_NUM_REPLY_HANDLERS - 1))
#define MPT_CONTEXT_REQI_MASK 0xFFFF
#define MPT_CONTEXT_TO_REQI(x) \
((x) & MPT_CONTEXT_REQI_MASK)
/*
* Convert a 32bit physical address returned from IOC to an
* offset into our reply frame memory or the kvm address needed
* to access the data. The returned address is only the low
* 32 bits, so mask our base physical address accordingly.
*/
#define MPT_REPLY_BADDR(x) \
(x << 1)
#define MPT_REPLY_OTOV(m, i) \
((void *)(&m->reply[i]))
#define MPT_DUMP_REPLY_FRAME(mpt, reply_frame) \
do { \
if (mpt->verbose >= MPT_PRT_DEBUG) \
mpt_dump_reply_frame(mpt, reply_frame); \
} while(0)
static __inline uint32_t mpt_pop_reply_queue(struct mpt_softc *mpt);
static __inline void mpt_free_reply(struct mpt_softc *mpt, uint32_t ptr);
/*
* Give the reply buffer back to the IOC after we have
* finished processing it.
*/
static __inline void
mpt_free_reply(struct mpt_softc *mpt, uint32_t ptr)
{
mpt_write(mpt, MPT_OFFSET_REPLY_Q, ptr);
}
/* Get a reply from the IOC */
static __inline uint32_t
mpt_pop_reply_queue(struct mpt_softc *mpt)
{
return mpt_read(mpt, MPT_OFFSET_REPLY_Q);
}
void mpt_complete_request_chain(struct mpt_softc *mpt,
struct req_queue *chain, u_int iocstatus);
/************************** Scatter Gather Managment **************************/
/*
* We cannot tell prior to getting IOC facts how big the IOC's request
* area is. Because of this we cannot tell at compile time how many
* simple SG elements we can fit within an IOC request prior to having
* to put in a chain element.
*
* Experimentally we know that the Ultra4 parts have a 96 byte request
* element size and the Fibre Channel units have a 144 byte request
* element size. Therefore, if we have 512-32 (== 480) bytes of request
* area to play with, we have room for between 3 and 5 request sized
* regions- the first of which is the command plus a simple SG list,
* the rest of which are chained continuation SG lists. Given that the
* normal request we use is 48 bytes w/o the first SG element, we can
* assume we have 480-48 == 432 bytes to have simple SG elements and/or
* chain elements. If we assume 32 bit addressing, this works out to
* 54 SG or chain elements. If we assume 5 chain elements, then we have
* a maximum of 49 seperate actual SG segments.
*/
#define MPT_SGL_MAX 49
#define MPT_RQSL(mpt) (mpt->request_frame_size << 2)
#define MPT_NSGL(mpt) (MPT_RQSL(mpt) / sizeof (SGE_SIMPLE32))
#define MPT_NSGL_FIRST(mpt) \
(((mpt->request_frame_size << 2) - \
sizeof (MSG_SCSI_IO_REQUEST) - \
sizeof (SGE_IO_UNION)) / sizeof (SGE_SIMPLE32))
/***************************** IOC Initialization *****************************/
int mpt_reset(struct mpt_softc *, int /*reinit*/);
/****************************** Debugging/Logging *****************************/
typedef struct mpt_decode_entry {
char *name;
u_int value;
u_int mask;
} mpt_decode_entry_t;
int mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries,
const char *name, u_int value, u_int *cur_column,
u_int wrap_point);
enum {
MPT_PRT_ALWAYS,
MPT_PRT_FATAL,
MPT_PRT_ERROR,
MPT_PRT_WARN,
MPT_PRT_INFO,
MPT_PRT_DEBUG,
MPT_PRT_TRACE
};
#define mpt_lprt(mpt, level, ...) \
do { \
if (level <= (mpt)->verbose) \
mpt_prt(mpt, __VA_ARGS__); \
} while (0)
#define mpt_lprtc(mpt, level, ...) \
do { \
if (level <= (mpt)->debug_level) \
mpt_prtc(mpt, __VA_ARGS__); \
} while (0)
void mpt_prt(struct mpt_softc *, const char *, ...);
void mpt_prtc(struct mpt_softc *, const char *, ...);
/**************************** Unclassified Routines ***************************/
void mpt_send_cmd(struct mpt_softc *mpt, request_t *req);
int mpt_recv_handshake_reply(struct mpt_softc *mpt,
size_t reply_len, void *reply);
int mpt_wait_req(struct mpt_softc *mpt, request_t *req,
mpt_req_state_t state, mpt_req_state_t mask,
int sleep_ok, int time_ms);
void mpt_enable_ints(struct mpt_softc *mpt);
void mpt_disable_ints(struct mpt_softc *mpt);
int mpt_attach(struct mpt_softc *mpt);
int mpt_shutdown(struct mpt_softc *mpt);
int mpt_detach(struct mpt_softc *mpt);
int mpt_send_handshake_cmd(struct mpt_softc *mpt,
size_t len, void *cmd);
request_t * mpt_get_request(struct mpt_softc *mpt, int sleep_ok);
void mpt_free_request(struct mpt_softc *mpt, request_t *req);
void mpt_intr(void *arg);
void mpt_check_doorbell(struct mpt_softc *mpt);
void mpt_dump_reply_frame(struct mpt_softc *mpt,
MSG_DEFAULT_REPLY *reply_frame);
void mpt_set_config_regs(struct mpt_softc *);
int mpt_issue_cfg_req(struct mpt_softc */*mpt*/, request_t */*req*/,
u_int /*Action*/, u_int /*PageVersion*/,
u_int /*PageLength*/, u_int /*PageNumber*/,
u_int /*PageType*/, uint32_t /*PageAddress*/,
bus_addr_t /*addr*/, bus_size_t/*len*/,
int /*sleep_ok*/, int /*timeout_ms*/);
int mpt_read_cfg_header(struct mpt_softc *, int /*PageType*/,
int /*PageNumber*/,
uint32_t /*PageAddress*/,
CONFIG_PAGE_HEADER *,
int /*sleep_ok*/, int /*timeout_ms*/);
int mpt_read_cfg_page(struct mpt_softc *t, int /*Action*/,
uint32_t /*PageAddress*/,
CONFIG_PAGE_HEADER *, size_t /*len*/,
int /*sleep_ok*/, int /*timeout_ms*/);
int mpt_write_cfg_page(struct mpt_softc *, int /*Action*/,
uint32_t /*PageAddress*/,
CONFIG_PAGE_HEADER *, size_t /*len*/,
int /*sleep_ok*/, int /*timeout_ms*/);
static __inline int
mpt_read_cur_cfg_page(struct mpt_softc *mpt, uint32_t PageAddress,
CONFIG_PAGE_HEADER *hdr, size_t len,
int sleep_ok, int timeout_ms)
{
return (mpt_read_cfg_page(mpt, MPI_CONFIG_ACTION_PAGE_READ_CURRENT,
PageAddress, hdr, len, sleep_ok, timeout_ms));
}
static __inline int
mpt_write_cur_cfg_page(struct mpt_softc *mpt, uint32_t PageAddress,
CONFIG_PAGE_HEADER *hdr, size_t len, int sleep_ok,
int timeout_ms)
{
return (mpt_write_cfg_page(mpt, MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT,
PageAddress, hdr, len, sleep_ok,
timeout_ms));
}
/* mpt_debug.c functions */
void mpt_print_reply(void *vmsg);
void mpt_print_db(u_int32_t mb);
void mpt_print_db(uint32_t mb);
void mpt_print_config_reply(void *vmsg);
char *mpt_ioc_diag(u_int32_t diag);
char *mpt_req_state(enum mpt_req_state state);
void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *msg);
char *mpt_ioc_diag(uint32_t diag);
void mpt_req_state(mpt_req_state_t state);
void mpt_print_config_request(void *vmsg);
void mpt_print_request(void *vmsg);
#endif
void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *msg);
#endif /* _MPT_H_ */

1931
sys/dev/mpt/mpt_cam.c Normal file

File diff suppressed because it is too large Load Diff

110
sys/dev/mpt/mpt_cam.h Normal file
View File

@ -0,0 +1,110 @@
/* $FreeBSD$ */
/*-
* LSI MPT Host Adapter FreeBSD Wrapper Definitions (CAM version)
*
* Copyright (c) 2000, 2001 by Greg Ansley, Adam Prewett
*
* Partially derived from Matty Jacobs ISP driver.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
*
* Additional Copyright (c) 2002 by Matthew Jacob under same license.
*/
/*-
* Copyright (c) 2004, Avid Technology, Inc. and its contributors.
* Copyright (c) 2005, WHEEL Sp. z o.o.
* Copyright (c) 2004, 2005 Justin T. Gibbs
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MPT_CAM_H_
#define _MPT_CAM_H_
#include <cam/cam.h>
#include <cam/cam_debug.h>
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_debug.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
#define ccb_mpt_ptr sim_priv.entries[0].ptr
#define ccb_req_ptr sim_priv.entries[1].ptr
/************************** CCB Manipulation Routines *************************/
static __inline void mpt_freeze_ccb(union ccb *ccb);
static __inline void mpt_set_ccb_status(union ccb *ccb, cam_status status);
static __inline void
mpt_freeze_ccb(union ccb *ccb)
{
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
ccb->ccb_h.status |= CAM_DEV_QFRZN;
xpt_freeze_devq(ccb->ccb_h.path, /*count*/1);
}
}
static __inline void
mpt_set_ccb_status(union ccb *ccb, cam_status status)
{
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
ccb->ccb_h.status |= status;
}
/****************************** Timeout Recovery ******************************/
/*
* The longest timeout specified for a Task Managent command.
*/
#define MPT_TMF_MAX_TIMEOUT (20000)
static __inline void
mpt_wakeup_recovery_thread(struct mpt_softc *mpt)
{
wakeup(mpt);
}
#endif /*_MPT_CAM_H_ */

View File

@ -24,15 +24,21 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
*
* Additional Copyright (c) 2002 by Matthew Jacob under same license.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <dev/mpt/mpt_freebsd.h>
#include <dev/mpt/mpt.h>
#include <dev/mpt/mpilib/mpi_ioc.h>
#include <dev/mpt/mpilib/mpi_init.h>
#include <dev/mpt/mpilib/mpi_fc.h>
#include <cam/scsi/scsi_all.h>
#include <machine/stdarg.h> /* for use by mpt_prt below */
struct Error_Map {
@ -100,6 +106,7 @@ static const struct Error_Map IOC_Func[] = {
{ MPI_FUNCTION_PORT_FACTS, "Port Facts" },
{ MPI_FUNCTION_PORT_ENABLE, "Port Enable" },
{ MPI_FUNCTION_EVENT_NOTIFICATION, "Event Notification" },
{ MPI_FUNCTION_EVENT_ACK, "Event Ack" },
{ MPI_FUNCTION_FW_DOWNLOAD, "FW Download" },
{ MPI_FUNCTION_TARGET_CMD_BUFFER_POST, "SCSI Target Command Buffer" },
{ MPI_FUNCTION_TARGET_ASSIST, "Target Assist" },
@ -109,9 +116,25 @@ static const struct Error_Map IOC_Func[] = {
{ MPI_FUNCTION_TARGET_FC_RSP_LINK_SRVC, "FC: Link Service Response" },
{ MPI_FUNCTION_TARGET_FC_EX_SEND_LINK_SRVC, "FC: Send Extended Link Service" },
{ MPI_FUNCTION_TARGET_FC_ABORT, "FC: Abort" },
{ MPI_FUNCTION_FC_LINK_SRVC_BUF_POST, "FC: Link Service Buffers" },
{ MPI_FUNCTION_FC_LINK_SRVC_RSP, "FC: Link Server Response" },
{ MPI_FUNCTION_FC_EX_LINK_SRVC_SEND, "FC: Send Extended Link Service" },
{ MPI_FUNCTION_FC_ABORT, "FC: Abort" },
{ MPI_FUNCTION_FW_UPLOAD, "FW Upload" },
{ MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND, "FC: Send Common Transport" },
{ MPI_FUNCTION_FC_PRIMITIVE_SEND, "FC: Send Primitive" },
{ MPI_FUNCTION_RAID_ACTION, "RAID Action" },
{ MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH, "RAID SCSI Pass-Through" },
{ MPI_FUNCTION_TOOLBOX, "Toolbox Command" },
{ MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR, "SCSI Enclosure Proc. Command" },
{ MPI_FUNCTION_MAILBOX, "Mailbox Command" },
{ MPI_FUNCTION_LAN_SEND, "LAN Send" },
{ MPI_FUNCTION_LAN_RECEIVE, "LAN Recieve" },
{ MPI_FUNCTION_LAN_RESET, "LAN Reset" },
{ MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, "IOC Message Unit Reset" },
{ MPI_FUNCTION_IO_UNIT_RESET, "IO Unit Reset" },
{ MPI_FUNCTION_HANDSHAKE, "Handshake" },
{ MPI_FUNCTION_REPLY_FRAME_REMOVAL, "Reply Frame Removal" },
{ -1, 0},
};
@ -154,15 +177,23 @@ static const struct Error_Map IOC_SCSIStatus[] = {
};
static const struct Error_Map IOC_Diag[] = {
{ MPT_DIAG_ENABLED, "DWE" },
{ MPT_DIAG_FLASHBAD, "FLASH_Bad" },
{ MPT_DIAG_TTLI, "TTLI" },
{ MPT_DIAG_RESET_IOC, "Reset" },
{ MPT_DIAG_ARM_DISABLE, "DisARM" },
{ MPT_DIAG_DME, "DME" },
{ MPI_DIAG_DRWE, "DWE" },
{ MPI_DIAG_FLASH_BAD_SIG, "FLASH_Bad" },
{ MPI_DIAGNOSTIC_OFFSET, "Offset" },
{ MPI_DIAG_RESET_ADAPTER, "Reset" },
{ MPI_DIAG_DISABLE_ARM, "DisARM" },
{ MPI_DIAG_MEM_ENABLE, "DME" },
{ -1, 0 },
};
static const struct Error_Map IOC_SCSITMType[] = {
{ MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, "Abort Task" },
{ MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, "Abort Task Set" },
{ MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, "Target Reset" },
{ MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, "Reset Bus" },
{ MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET, "Logical Unit Reset" },
{ -1, 0 },
};
static void mpt_dump_sgl(SGE_IO_UNION *sgl);
@ -286,6 +317,20 @@ mpt_state(u_int32_t mb)
return text;
}
static char *
mpt_scsi_tm_type(int code)
{
const struct Error_Map *status = IOC_SCSITMType;
static char buf[64];
while (status->Error_Code >= 0) {
if (status->Error_Code == code)
return status->Error_String;
status++;
}
snprintf(buf, sizeof buf, "Unknown (0x%08x)", code);
return buf;
}
void
mpt_print_db(u_int32_t mb)
{
@ -508,6 +553,15 @@ mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg)
mpt_dump_sgl(&orig_msg->SGL);
}
static void
mpt_print_scsi_tmf_request(MSG_SCSI_TASK_MGMT *msg)
{
mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg);
printf("\tLun 0x%02x\n", msg->LUN[1]);
printf("\tTaskType %s\n", mpt_scsi_tm_type(msg->TaskType));
printf("\tTaskMsgContext 0x%08x\n", msg->TaskMsgContext);
}
void
mpt_print_request(void *vreq)
{
@ -517,25 +571,81 @@ mpt_print_request(void *vreq)
case MPI_FUNCTION_SCSI_IO_REQUEST:
mpt_print_scsi_io_request((MSG_SCSI_IO_REQUEST *)req);
break;
case MPI_FUNCTION_SCSI_TASK_MGMT:
mpt_print_scsi_tmf_request((MSG_SCSI_TASK_MGMT *)req);
default:
mpt_print_request_hdr(req);
break;
}
}
char *
mpt_req_state(enum mpt_req_state state)
int
mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries,
const char *name, u_int value, u_int *cur_column,
u_int wrap_point)
{
char *text;
int printed;
u_int printed_mask;
u_int dummy_column;
switch (state) {
case REQ_FREE: text = "Free"; break;
case REQ_IN_PROGRESS: text = "In Progress"; break;
case REQ_ON_CHIP: text = "On Chip"; break;
case REQ_TIMEOUT: text = "Timeout"; break;
default: text = "Unknown"; break;
if (cur_column == NULL) {
dummy_column = 0;
cur_column = &dummy_column;
}
return text;
if (*cur_column >= wrap_point) {
printf("\n");
*cur_column = 0;
}
printed = printf("%s[0x%x]", name, value);
if (table == NULL) {
printed += printf(" ");
*cur_column += printed;
return (printed);
}
printed_mask = 0;
while (printed_mask != 0xFF) {
int entry;
for (entry = 0; entry < num_entries; entry++) {
if (((value & table[entry].mask)
!= table[entry].value)
|| ((printed_mask & table[entry].mask)
== table[entry].mask))
continue;
printed += printf("%s%s",
printed_mask == 0 ? ":(" : "|",
table[entry].name);
printed_mask |= table[entry].mask;
break;
}
if (entry >= num_entries)
break;
}
if (printed_mask != 0)
printed += printf(") ");
else
printed += printf(" ");
*cur_column += printed;
return (printed);
}
static mpt_decode_entry_t req_state_parse_table[] = {
{ "REQ_FREE", 0x00, 0xff },
{ "REQ_ALLOCATED", 0x01, 0x01 },
{ "REQ_QUEUED", 0x02, 0x02 },
{ "REQ_DONE", 0x04, 0x04 },
{ "REQ_TIMEDOUT", 0x08, 0x08 },
{ "REQ_NEED_WAKEUP", 0x10, 0x10 }
};
void
mpt_req_state(mpt_req_state_t state)
{
mpt_decode_value(req_state_parse_table,
NUM_ELEMENTS(req_state_parse_table),
"REQ_STATE", state, NULL, 80);
}
static void
@ -597,12 +707,22 @@ mpt_dump_sgl(SGE_IO_UNION *su)
}
void
mpt_prt(mpt_softc_t *mpt, const char *fmt, ...)
mpt_prt(struct mpt_softc *mpt, const char *fmt, ...)
{
va_list ap;
printf("%s: ", device_get_nameunit(mpt->dev));
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
printf("\n");
}
void
mpt_prtc(struct mpt_softc *mpt, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,357 +0,0 @@
/* $FreeBSD$ */
/*-
* LSI MPT Host Adapter FreeBSD Wrapper Definitions (CAM version)
*
* Copyright (c) 2000, 2001 by Greg Ansley, Adam Prewett
*
* Partially derived from Matty Jacobs ISP driver.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
*/
/*
* Additional Copyright (c) 2002 by Matthew Jacob under same license.
*/
#ifndef _MPT_FREEBSD_H_
#define _MPT_FREEBSD_H_
/* #define RELENG_4 1 */
#include <sys/param.h>
#include <sys/systm.h>
#ifdef RELENG_4
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#else
#include <sys/endian.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#endif
#include <sys/proc.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <machine/cpu.h>
#include <cam/cam.h>
#include <cam/cam_debug.h>
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_debug.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
#include "opt_ddb.h"
#include "dev/mpt/mpilib/mpi_type.h"
#include "dev/mpt/mpilib/mpi.h"
#include "dev/mpt/mpilib/mpi_cnfg.h"
#include "dev/mpt/mpilib/mpi_fc.h"
#include "dev/mpt/mpilib/mpi_init.h"
#include "dev/mpt/mpilib/mpi_ioc.h"
#include "dev/mpt/mpilib/mpi_lan.h"
#include "dev/mpt/mpilib/mpi_targ.h"
#define INLINE __inline
#ifdef RELENG_4
#define MPT_IFLAGS INTR_TYPE_CAM
#define MPT_LOCK(mpt) mpt_lockspl(mpt)
#define MPT_UNLOCK(mpt) mpt_unlockspl(mpt)
#define MPTLOCK_2_CAMLOCK MPT_UNLOCK
#define CAMLOCK_2_MPTLOCK MPT_LOCK
#define MPT_LOCK_SETUP(mpt)
#define MPT_LOCK_DESTROY(mpt)
#else
#if LOCKING_WORKED_AS_IT_SHOULD
#define MPT_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
#define MPT_LOCK_SETUP(mpt) \
mtx_init(&mpt->mpt_lock, "mpt", NULL, MTX_DEF); \
mpt->mpt_locksetup = 1
#define MPT_LOCK_DESTROY(mpt) \
if (mpt->mpt_locksetup) { \
mtx_destroy(&mpt->mpt_lock); \
mpt->mpt_locksetup = 0; \
}
#define MPT_LOCK(mpt) mtx_lock(&(mpt)->mpt_lock)
#define MPT_UNLOCK(mpt) mtx_unlock(&(mpt)->mpt_lock)
#define MPTLOCK_2_CAMLOCK(mpt) \
mtx_unlock(&(mpt)->mpt_lock); mtx_lock(&Giant)
#define CAMLOCK_2_MPTLOCK(mpt) \
mtx_unlock(&Giant); mtx_lock(&(mpt)->mpt_lock)
#else
#define MPT_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY
#define MPT_LOCK_SETUP(mpt) do { } while (0)
#define MPT_LOCK_DESTROY(mpt) do { } while (0)
#define MPT_LOCK(mpt) do { } while (0)
#define MPT_UNLOCK(mpt) do { } while (0)
#define MPTLOCK_2_CAMLOCK(mpt) do { } while (0)
#define CAMLOCK_2_MPTLOCK(mpt) do { } while (0)
#endif
#endif
/* Max MPT Reply we are willing to accept (must be power of 2) */
#define MPT_REPLY_SIZE 128
#define MPT_MAX_REQUESTS(mpt) ((mpt)->is_fc? 1024 : 256)
#define MPT_REQUEST_AREA 512
#define MPT_SENSE_SIZE 32 /* included in MPT_REQUEST_SIZE */
#define MPT_REQ_MEM_SIZE(mpt) (MPT_MAX_REQUESTS(mpt) * MPT_REQUEST_AREA)
/*
* We cannot tell prior to getting IOC facts how big the IOC's request
* area is. Because of this we cannot tell at compile time how many
* simple SG elements we can fit within an IOC request prior to having
* to put in a chain element.
*
* Experimentally we know that the Ultra4 parts have a 96 byte request
* element size and the Fibre Channel units have a 144 byte request
* element size. Therefore, if we have 512-32 (== 480) bytes of request
* area to play with, we have room for between 3 and 5 request sized
* regions- the first of which is the command plus a simple SG list,
* the rest of which are chained continuation SG lists. Given that the
* normal request we use is 48 bytes w/o the first SG element, we can
* assume we have 480-48 == 432 bytes to have simple SG elements and/or
* chain elements. If we assume 32 bit addressing, this works out to
* 54 SG or chain elements. If we assume 5 chain elements, then we have
* a maximum of 49 seperate actual SG segments.
*/
#define MPT_SGL_MAX 49
#define MPT_RQSL(mpt) (mpt->request_frame_size << 2)
#define MPT_NSGL(mpt) (MPT_RQSL(mpt) / sizeof (SGE_SIMPLE32))
#define MPT_NSGL_FIRST(mpt) \
(((mpt->request_frame_size << 2) - \
sizeof (MSG_SCSI_IO_REQUEST) - \
sizeof (SGE_IO_UNION)) / sizeof (SGE_SIMPLE32))
/*
* Convert a physical address returned from IOC to kvm address
* needed to access the data.
*/
#define MPT_REPLY_PTOV(m, x) \
((void *)(&m->reply[((x << 1) - m->reply_phys)]))
#define ccb_mpt_ptr sim_priv.entries[0].ptr
#define ccb_req_ptr sim_priv.entries[1].ptr
enum mpt_req_state {
REQ_FREE, REQ_IN_PROGRESS, REQ_TIMEOUT, REQ_ON_CHIP, REQ_DONE
};
typedef struct req_entry {
u_int16_t index; /* Index of this entry */
union ccb * ccb; /* CAM request */
void * req_vbuf; /* Virtual Address of Entry */
void * sense_vbuf; /* Virtual Address of sense data */
bus_addr_t req_pbuf; /* Physical Address of Entry */
bus_addr_t sense_pbuf; /* Physical Address of sense data */
bus_dmamap_t dmap; /* DMA map for data buffer */
SLIST_ENTRY(req_entry) link; /* Pointer to next in list */
enum mpt_req_state debug; /* Debugging */
u_int32_t sequence; /* Sequence Number */
} request_t;
/* Structure for saving proper values for modifyable PCI configuration registers */
struct mpt_pci_cfg {
u_int16_t Command;
u_int16_t LatencyTimer_LineSize;
u_int32_t IO_BAR;
u_int32_t Mem0_BAR[2];
u_int32_t Mem1_BAR[2];
u_int32_t ROM_BAR;
u_int8_t IntLine;
u_int32_t PMCSR;
};
typedef struct mpt_softc {
device_t dev;
#ifdef RELENG_4
int mpt_splsaved;
u_int32_t mpt_islocked;
#else
struct mtx mpt_lock;
#endif
u_int32_t : 16,
unit : 8,
verbose : 3,
outofbeer : 1,
mpt_locksetup : 1,
disabled : 1,
is_fc : 1,
bus : 1; /* FC929/1030 have two busses */
/*
* IOC Facts
*/
u_int16_t mpt_global_credits;
u_int16_t request_frame_size;
u_int8_t mpt_max_devices;
u_int8_t mpt_max_buses;
/*
* Port Facts
*/
u_int16_t mpt_ini_id;
/*
* Device Configuration Information
*/
union {
struct mpt_spi_cfg {
CONFIG_PAGE_SCSI_PORT_0 _port_page0;
CONFIG_PAGE_SCSI_PORT_1 _port_page1;
CONFIG_PAGE_SCSI_PORT_2 _port_page2;
CONFIG_PAGE_SCSI_DEVICE_0 _dev_page0[16];
CONFIG_PAGE_SCSI_DEVICE_1 _dev_page1[16];
uint16_t _tag_enable;
uint16_t _disc_enable;
uint16_t _update_params0;
uint16_t _update_params1;
} spi;
#define mpt_port_page0 cfg.spi._port_page0
#define mpt_port_page1 cfg.spi._port_page1
#define mpt_port_page2 cfg.spi._port_page2
#define mpt_dev_page0 cfg.spi._dev_page0
#define mpt_dev_page1 cfg.spi._dev_page1
#define mpt_tag_enable cfg.spi._tag_enable
#define mpt_disc_enable cfg.spi._disc_enable
#define mpt_update_params0 cfg.spi._update_params0
#define mpt_update_params1 cfg.spi._update_params1
struct mpi_fc_cfg {
u_int8_t nada;
} fc;
} cfg;
/*
* PCI Hardware info
*/
struct resource * pci_irq; /* Interrupt map for chip */
void * ih; /* Interupt handle */
struct mpt_pci_cfg pci_cfg; /* saved PCI conf registers */
/*
* DMA Mapping Stuff
*/
struct resource * pci_reg; /* Register map for chip */
int pci_reg_id; /* Resource ID */
bus_space_tag_t pci_st; /* Bus tag for registers */
bus_space_handle_t pci_sh; /* Bus handle for registers */
vm_offset_t pci_pa; /* Physical Address */
bus_dma_tag_t parent_dmat; /* DMA tag for parent PCI bus */
bus_dma_tag_t reply_dmat; /* DMA tag for reply memory */
bus_dmamap_t reply_dmap; /* DMA map for reply memory */
char * reply; /* KVA of reply memory */
bus_addr_t reply_phys; /* BusAddr of reply memory */
bus_dma_tag_t buffer_dmat; /* DMA tag for buffers */
bus_dma_tag_t request_dmat; /* DMA tag for request memroy */
bus_dmamap_t request_dmap; /* DMA map for request memroy */
char * request; /* KVA of Request memory */
bus_addr_t request_phys; /* BusADdr of request memory */
/*
* CAM && Software Management
*/
request_t * request_pool;
SLIST_HEAD(req_queue, req_entry) request_free_list;
struct cam_sim * sim;
struct cam_path * path;
u_int32_t sequence; /* Sequence Number */
u_int32_t timeouts; /* timeout count */
u_int32_t success; /* successes afer timeout */
/* Opposing port in a 929 or 1030, or NULL */
struct mpt_softc * mpt2;
} mpt_softc_t;
#include <dev/mpt/mpt.h>
static INLINE void mpt_write(mpt_softc_t *, size_t, u_int32_t);
static INLINE u_int32_t mpt_read(mpt_softc_t *, int);
static INLINE void
mpt_write(mpt_softc_t *mpt, size_t offset, u_int32_t val)
{
bus_space_write_4(mpt->pci_st, mpt->pci_sh, offset, val);
}
static INLINE u_int32_t
mpt_read(mpt_softc_t *mpt, int offset)
{
return (bus_space_read_4(mpt->pci_st, mpt->pci_sh, offset));
}
void mpt_cam_attach(mpt_softc_t *);
void mpt_cam_detach(mpt_softc_t *);
void mpt_done(mpt_softc_t *, u_int32_t);
void mpt_prt(mpt_softc_t *, const char *, ...);
void mpt_set_config_regs(mpt_softc_t *);
#ifdef RELENG_4
static INLINE void mpt_lockspl(mpt_softc_t *);
static INLINE void mpt_unlockspl(mpt_softc_t *);
static INLINE void
mpt_lockspl(mpt_softc_t *mpt)
{
int s = splcam();
if (mpt->mpt_islocked++ == 0) {
mpt->mpt_splsaved = s;
} else {
splx(s);
}
}
static INLINE void
mpt_unlockspl(mpt_softc_t *mpt)
{
if (mpt->mpt_islocked) {
if (--mpt->mpt_islocked == 0) {
splx(mpt->mpt_splsaved);
}
}
}
#endif
#endif /* _MPT_FREEBSD_H */

View File

@ -29,25 +29,53 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 2004, Avid Technology, Inc. and its contributors.
* Copyright (c) 2005, WHEEL Sp. z o.o.
* Copyright (c) 2004, 2005 Justin T. Gibbs
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <dev/mpt/mpt.h>
#include <dev/mpt/mpt_cam.h>
#include <dev/mpt/mpt_raid.h>
#if __FreeBSD_version < 500000
#include <pci/pcireg.h>
#include <pci/pcivar.h>
#else
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
#include <sys/malloc.h>
#include <dev/mpt/mpt_freebsd.h>
#endif
#ifndef PCI_VENDOR_LSI
#define PCI_VENDOR_LSI 0x1000
@ -69,10 +97,6 @@ __FBSDID("$FreeBSD$");
#define PCI_PRODUCT_LSI_FC929 0x0622
#endif
#ifndef PCI_PRODUCT_LSI_FC929X
#define PCI_PRODUCT_LSI_FC929X 0x0626
#endif
#ifndef PCI_PRODUCT_LSI_1030
#define PCI_PRODUCT_LSI_1030 0x0030
#endif
@ -83,64 +107,37 @@ __FBSDID("$FreeBSD$");
#define MEM_MAP_REG 0x14
#define MEM_MAP_SRAM 0x1C
#define MPT_IO_BAR 0
#define MPT_MEM_BAR 1
static int mpt_probe(device_t);
static int mpt_attach(device_t);
static void mpt_free_bus_resources(mpt_softc_t *mpt);
static int mpt_detach(device_t);
static int mpt_shutdown(device_t);
static int mpt_dma_mem_alloc(mpt_softc_t *mpt);
static void mpt_dma_mem_free(mpt_softc_t *mpt);
static void mpt_read_config_regs(mpt_softc_t *mpt);
static int mpt_pci_probe(device_t);
static int mpt_pci_attach(device_t);
static void mpt_free_bus_resources(struct mpt_softc *mpt);
static int mpt_pci_detach(device_t);
static int mpt_pci_shutdown(device_t);
static int mpt_dma_mem_alloc(struct mpt_softc *mpt);
static void mpt_dma_mem_free(struct mpt_softc *mpt);
static void mpt_read_config_regs(struct mpt_softc *mpt);
static void mpt_pci_intr(void *);
static device_method_t mpt_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, mpt_probe),
DEVMETHOD(device_attach, mpt_attach),
DEVMETHOD(device_detach, mpt_detach),
DEVMETHOD(device_shutdown, mpt_shutdown),
DEVMETHOD(device_probe, mpt_pci_probe),
DEVMETHOD(device_attach, mpt_pci_attach),
DEVMETHOD(device_detach, mpt_pci_detach),
DEVMETHOD(device_shutdown, mpt_pci_shutdown),
{ 0, 0 }
};
static driver_t mpt_driver = {
"mpt", mpt_methods, sizeof (mpt_softc_t)
"mpt", mpt_methods, sizeof(struct mpt_softc)
};
static devclass_t mpt_devclass;
DRIVER_MODULE(mpt, pci, mpt_driver, mpt_devclass, 0, 0);
MODULE_VERSION(mpt, 1);
int
mpt_intr(void *dummy)
{
int nrepl = 0;
u_int32_t reply;
mpt_softc_t *mpt = (mpt_softc_t *)dummy;
if ((mpt_read(mpt, MPT_OFFSET_INTR_STATUS) & MPT_INTR_REPLY_READY) == 0)
return (0);
reply = mpt_pop_reply_queue(mpt);
while (reply != MPT_REPLY_EMPTY) {
nrepl++;
if (mpt->verbose > 1) {
if ((reply & MPT_CONTEXT_REPLY) != 0) {
/* Address reply; IOC has something to say */
mpt_print_reply(MPT_REPLY_PTOV(mpt, reply));
} else {
/* Context reply ; all went well */
mpt_prt(mpt, "context %u reply OK", reply);
}
}
mpt_done(mpt, reply);
reply = mpt_pop_reply_queue(mpt);
}
return (nrepl != 0);
}
static int
mpt_probe(device_t dev)
mpt_pci_probe(device_t dev)
{
char *desc;
@ -160,9 +157,6 @@ mpt_probe(device_t dev)
case PCI_PRODUCT_LSI_FC929:
desc = "LSILogic FC929 FC Adapter";
break;
case PCI_PRODUCT_LSI_FC929X:
desc = "LSILogic FC929X FC Adapter";
break;
case PCI_PRODUCT_LSI_1030:
desc = "LSILogic 1030 Ultra4 Adapter";
break;
@ -171,12 +165,12 @@ mpt_probe(device_t dev)
}
device_set_desc(dev, desc);
return (BUS_PROBE_DEFAULT);
return (0);
}
#ifdef RELENG_4
static void
mpt_set_options(mpt_softc_t *mpt)
mpt_set_options(struct mpt_softc *mpt)
{
int bitmap;
@ -190,14 +184,14 @@ mpt_set_options(mpt_softc_t *mpt)
bitmap = 0;
if (getenv_int("mpt_debug", &bitmap)) {
if (bitmap & (1 << mpt->unit)) {
mpt->verbose = 2;
mpt->verbose = MPT_PRT_DEBUG;
}
}
}
#else
static void
mpt_set_options(mpt_softc_t *mpt)
mpt_set_options(struct mpt_softc *mpt)
{
int tval;
@ -216,18 +210,17 @@ mpt_set_options(mpt_softc_t *mpt)
static void
mpt_link_peer(mpt_softc_t *mpt)
mpt_link_peer(struct mpt_softc *mpt)
{
mpt_softc_t *mpt2;
struct mpt_softc *mpt2;
if (mpt->unit == 0) {
if (mpt->unit == 0)
return;
}
/*
* XXX: depends on probe order
*/
mpt2 = (mpt_softc_t *) devclass_get_softc(mpt_devclass, mpt->unit-1);
mpt2 = (struct mpt_softc *)devclass_get_softc(mpt_devclass,mpt->unit-1);
if (mpt2 == NULL) {
return;
@ -240,27 +233,27 @@ mpt_link_peer(mpt_softc_t *mpt)
}
mpt->mpt2 = mpt2;
mpt2->mpt2 = mpt;
if (mpt->verbose) {
mpt_prt(mpt, "linking with peer (mpt%d)",
if (mpt->verbose >= MPT_PRT_DEBUG) {
mpt_prt(mpt, "linking with peer (mpt%d)\n",
device_get_unit(mpt2->dev));
}
}
static int
mpt_attach(device_t dev)
mpt_pci_attach(device_t dev)
{
int iqd;
u_int32_t data, cmd;
mpt_softc_t *mpt;
struct mpt_softc *mpt;
int iqd;
uint32_t data, cmd;
/* Allocate the softc structure */
mpt = (mpt_softc_t*) device_get_softc(dev);
mpt = (struct mpt_softc*)device_get_softc(dev);
if (mpt == NULL) {
device_printf(dev, "cannot allocate softc\n");
return (ENOMEM);
}
bzero(mpt, sizeof (mpt_softc_t));
bzero(mpt, sizeof(struct mpt_softc));
switch ((pci_get_device(dev) & ~1)) {
case PCI_PRODUCT_LSI_FC909:
case PCI_PRODUCT_LSI_FC909A:
@ -273,7 +266,11 @@ mpt_attach(device_t dev)
}
mpt->dev = dev;
mpt->unit = device_get_unit(dev);
mpt->raid_resync_rate = MPT_RAID_RESYNC_RATE_DEFAULT;
mpt->raid_mwce_setting = MPT_RAID_MWCE_DEFAULT;
mpt->raid_queue_depth = MPT_RAID_QUEUE_DEPTH_DEFAULT;
mpt_set_options(mpt);
mpt->verbose = MPT_PRT_INFO;
mpt->verbose += (bootverbose != 0)? 1 : 0;
/* Make sure memory access decoders are enabled */
@ -298,7 +295,6 @@ mpt_attach(device_t dev)
data &= ~1;
pci_write_config(dev, PCIR_BIOS, data, 4);
/*
* Is this part a dual?
* If so, link with our partner (around yet)
@ -308,42 +304,62 @@ mpt_attach(device_t dev)
mpt_link_peer(mpt);
}
/* Set up the memory regions */
/* Allocate kernel virtual memory for the 9x9's Mem0 region */
mpt->pci_reg_id = MEM_MAP_REG;
mpt->pci_reg = bus_alloc_resource(dev, SYS_RES_MEMORY,
&mpt->pci_reg_id, 0, ~0, 0, RF_ACTIVE);
if (mpt->pci_reg == NULL) {
device_printf(dev, "unable to map any ports\n");
/*
* Set up register access. PIO mode is required for
* certain reset operations.
*/
mpt->pci_pio_rid = PCIR_BAR(MPT_IO_BAR);
mpt->pci_pio_reg = bus_alloc_resource(dev, SYS_RES_IOPORT,
&mpt->pci_pio_rid, 0, ~0, 0, RF_ACTIVE);
if (mpt->pci_pio_reg == NULL) {
device_printf(dev, "unable to map registers in PIO mode\n");
goto bad;
}
mpt->pci_st = rman_get_bustag(mpt->pci_reg);
mpt->pci_sh = rman_get_bushandle(mpt->pci_reg);
/* Get the Physical Address */
mpt->pci_pa = rman_get_start(mpt->pci_reg);
mpt->pci_pio_st = rman_get_bustag(mpt->pci_pio_reg);
mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg);
/* Allocate kernel virtual memory for the 9x9's Mem0 region */
mpt->pci_mem_rid = PCIR_BAR(MPT_MEM_BAR);
mpt->pci_reg = bus_alloc_resource(dev, SYS_RES_MEMORY,
&mpt->pci_mem_rid, 0, ~0, 0, RF_ACTIVE);
if (mpt->pci_reg == NULL) {
device_printf(dev, "Unable to memory map registers.\n");
device_printf(dev, "Falling back to PIO mode.\n");
mpt->pci_st = mpt->pci_pio_st;
mpt->pci_sh = mpt->pci_pio_sh;
} else {
mpt->pci_st = rman_get_bustag(mpt->pci_reg);
mpt->pci_sh = rman_get_bushandle(mpt->pci_reg);
}
/* Get a handle to the interrupt */
iqd = 0;
#if __FreeBSD_version < 500000
mpt->pci_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &iqd, 0, ~0, 1,
RF_ACTIVE | RF_SHAREABLE);
#else
mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
RF_ACTIVE | RF_SHAREABLE);
#endif
if (mpt->pci_irq == NULL) {
device_printf(dev, "could not allocate interrupt\n");
goto bad;
}
/* Register the interrupt handler */
if (bus_setup_intr(dev, mpt->pci_irq, MPT_IFLAGS, mpt_pci_intr,
mpt, &mpt->ih)) {
device_printf(dev, "could not setup interrupt\n");
goto bad;
}
MPT_LOCK_SETUP(mpt);
/* Disable interrupts at the part */
mpt_disable_ints(mpt);
/* Register the interrupt handler */
if (bus_setup_intr(dev, mpt->pci_irq, MPT_IFLAGS, mpt_pci_intr,
mpt, &mpt->ih)) {
device_printf(dev, "could not setup interrupt\n");
goto bad;
}
/* Allocate dma memory */
/* XXX JGibbs -Should really be done based on IOCFacts. */
if (mpt_dma_mem_alloc(mpt)) {
device_printf(dev, "Could not allocate DMA memory\n");
goto bad;
@ -364,18 +380,10 @@ mpt_attach(device_t dev)
/* Initialize the hardware */
if (mpt->disabled == 0) {
MPT_LOCK(mpt);
if (mpt_init(mpt, MPT_DB_INIT_HOST) != 0) {
if (mpt_attach(mpt) != 0) {
MPT_UNLOCK(mpt);
goto bad;
}
/*
* Attach to CAM
*/
MPTLOCK_2_CAMLOCK(mpt);
mpt_cam_attach(mpt);
CAMLOCK_2_MPTLOCK(mpt);
MPT_UNLOCK(mpt);
}
return (0);
@ -394,7 +402,7 @@ bad:
* Free bus resources
*/
static void
mpt_free_bus_resources(mpt_softc_t *mpt)
mpt_free_bus_resources(struct mpt_softc *mpt)
{
if (mpt->ih) {
bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih);
@ -406,8 +414,13 @@ mpt_free_bus_resources(mpt_softc_t *mpt)
mpt->pci_irq = 0;
}
if (mpt->pci_pio_reg) {
bus_release_resource(mpt->dev, SYS_RES_IOPORT, mpt->pci_pio_rid,
mpt->pci_pio_reg);
mpt->pci_pio_reg = 0;
}
if (mpt->pci_reg) {
bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_reg_id,
bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_mem_rid,
mpt->pci_reg);
mpt->pci_reg = 0;
}
@ -419,19 +432,41 @@ mpt_free_bus_resources(mpt_softc_t *mpt)
* Disconnect ourselves from the system.
*/
static int
mpt_detach(device_t dev)
mpt_pci_detach(device_t dev)
{
mpt_softc_t *mpt;
mpt = (mpt_softc_t*) device_get_softc(dev);
struct mpt_softc *mpt;
mpt_prt(mpt, "mpt_detach");
mpt = (struct mpt_softc*)device_get_softc(dev);
mpt_prt(mpt, "mpt_detach\n");
if (mpt) {
mpt_disable_ints(mpt);
mpt_cam_detach(mpt);
mpt_reset(mpt);
mpt_detach(mpt);
mpt_reset(mpt, /*reinit*/FALSE);
mpt_dma_mem_free(mpt);
mpt_free_bus_resources(mpt);
if (mpt->raid_volumes != NULL
&& mpt->ioc_page2 != NULL) {
int i;
for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) {
struct mpt_raid_volume *mpt_vol;
mpt_vol = &mpt->raid_volumes[i];
if (mpt_vol->config_page)
free(mpt_vol->config_page, M_DEVBUF);
}
}
if (mpt->ioc_page2 != NULL)
free(mpt->ioc_page2, M_DEVBUF);
if (mpt->ioc_page3 != NULL)
free(mpt->ioc_page3, M_DEVBUF);
if (mpt->raid_volumes != NULL)
free(mpt->raid_volumes, M_DEVBUF);
if (mpt->raid_disks != NULL)
free(mpt->raid_disks, M_DEVBUF);
if (mpt->eh != NULL)
EVENTHANDLER_DEREGISTER(shutdown_final, mpt->eh);
}
return(0);
}
@ -439,43 +474,27 @@ mpt_detach(device_t dev)
/*
* Disable the hardware
* XXX - Called too early by New Bus!!! ???
*/
static int
mpt_shutdown(device_t dev)
mpt_pci_shutdown(device_t dev)
{
mpt_softc_t *mpt;
mpt = (mpt_softc_t*) device_get_softc(dev);
struct mpt_softc *mpt;
if (mpt) {
mpt_reset(mpt);
}
mpt = (struct mpt_softc *)device_get_softc(dev);
if (mpt)
return (mpt_shutdown(mpt));
return(0);
}
struct imush {
mpt_softc_t *mpt;
int error;
u_int32_t phys;
};
static void
mpt_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error)
{
struct imush *imushp = (struct imush *) arg;
imushp->error = error;
imushp->phys = segs->ds_addr;
}
static int
mpt_dma_mem_alloc(mpt_softc_t *mpt)
mpt_dma_mem_alloc(struct mpt_softc *mpt)
{
int i, error;
u_char *vptr;
u_int32_t pptr, end;
uint8_t *vptr;
uint32_t pptr, end;
size_t len;
struct imush im;
struct mpt_map_info mi;
device_t dev = mpt->dev;
/* Check if we alreay have allocated the reply memory */
@ -483,17 +502,16 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
return 0;
}
len = sizeof (request_t *) * MPT_REQ_MEM_SIZE(mpt);
len = sizeof (request_t) * MPT_MAX_REQUESTS(mpt);
#ifdef RELENG_4
mpt->request_pool = (request_t *) malloc(len, M_DEVBUF, M_WAITOK);
mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK);
if (mpt->request_pool == NULL) {
device_printf(dev, "cannot allocate request pool\n");
return (1);
}
bzero(mpt->request_pool, len);
#else
mpt->request_pool = (request_t *)
malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK|M_ZERO);
if (mpt->request_pool == NULL) {
device_printf(dev, "cannot allocate request pool\n");
return (1);
@ -501,24 +519,27 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
#endif
/*
* Create a dma tag for this device
* Create a parent dma tag for this device
*
* Align at page boundaries, limit to 32-bit addressing
* Align at byte boundaries, limit to 32-bit addressing
* (The chip supports 64-bit addressing, but this driver doesn't)
*/
if (bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT,
BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED, 0,
busdma_lock_mutex, &Giant, &mpt->parent_dmat) != 0) {
if (mpt_dma_tag_create(mpt, /*parent*/NULL, /*alignment*/1,
/*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
/*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/BUS_SPACE_MAXSIZE_32BIT,
/*nsegments*/BUS_SPACE_MAXSIZE_32BIT,
/*maxsegsz*/BUS_SPACE_UNRESTRICTED, /*flags*/0,
&mpt->parent_dmat) != 0) {
device_printf(dev, "cannot create parent dma tag\n");
return (1);
}
/* Create a child tag for reply buffers */
if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE,
if (mpt_dma_tag_create(mpt, mpt->parent_dmat, PAGE_SIZE,
0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, PAGE_SIZE, 1, BUS_SPACE_MAXSIZE_32BIT, 0,
busdma_lock_mutex, &Giant, &mpt->reply_dmat) != 0) {
&mpt->reply_dmat) != 0) {
device_printf(dev, "cannot create a dma tag for replies\n");
return (1);
}
@ -531,35 +552,35 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
return (1);
}
im.mpt = mpt;
im.error = 0;
mi.mpt = mpt;
mi.error = 0;
/* Load and lock it into "bus space" */
bus_dmamap_load(mpt->reply_dmat, mpt->reply_dmap, mpt->reply,
PAGE_SIZE, mpt_map_rquest, &im, 0);
PAGE_SIZE, mpt_map_rquest, &mi, 0);
if (im.error) {
if (mi.error) {
device_printf(dev,
"error %d loading dma map for DMA reply queue\n", im.error);
"error %d loading dma map for DMA reply queue\n", mi.error);
return (1);
}
mpt->reply_phys = im.phys;
mpt->reply_phys = mi.phys;
/* Create a child tag for data buffers */
if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE,
if (mpt_dma_tag_create(mpt, mpt->parent_dmat, 1,
0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, MAXBSIZE, MPT_SGL_MAX, BUS_SPACE_MAXSIZE_32BIT, 0,
busdma_lock_mutex, &Giant, &mpt->buffer_dmat) != 0) {
&mpt->buffer_dmat) != 0) {
device_printf(dev,
"cannot create a dma tag for data buffers\n");
return (1);
}
/* Create a child tag for request buffers */
if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE,
if (mpt_dma_tag_create(mpt, mpt->parent_dmat, PAGE_SIZE,
0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, MPT_REQ_MEM_SIZE(mpt), 1, BUS_SPACE_MAXSIZE_32BIT, 0,
busdma_lock_mutex, &Giant, &mpt->request_dmat) != 0) {
&mpt->request_dmat) != 0) {
device_printf(dev, "cannot create a dma tag for requests\n");
return (1);
}
@ -573,20 +594,20 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
return (1);
}
im.mpt = mpt;
im.error = 0;
mi.mpt = mpt;
mi.error = 0;
/* Load and lock it into "bus space" */
bus_dmamap_load(mpt->request_dmat, mpt->request_dmap, mpt->request,
MPT_REQ_MEM_SIZE(mpt), mpt_map_rquest, &im, 0);
MPT_REQ_MEM_SIZE(mpt), mpt_map_rquest, &mi, 0);
if (im.error) {
if (mi.error) {
device_printf(dev,
"error %d loading dma map for DMA request queue\n",
im.error);
mi.error);
return (1);
}
mpt->request_phys = im.phys;
mpt->request_phys = mi.phys;
i = 0;
pptr = mpt->request_phys;
@ -621,13 +642,13 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
/* Deallocate memory that was allocated by mpt_dma_mem_alloc
*/
static void
mpt_dma_mem_free(mpt_softc_t *mpt)
mpt_dma_mem_free(struct mpt_softc *mpt)
{
int i;
/* Make sure we aren't double destroying */
if (mpt->reply_dmat == 0) {
if (mpt->verbose)
if (mpt->verbose >= MPT_PRT_DEBUG)
device_printf(mpt->dev,"Already released dma memory\n");
return;
}
@ -653,7 +674,7 @@ mpt_dma_mem_free(mpt_softc_t *mpt)
/* Reads modifiable (via PCI transactions) config registers */
static void
mpt_read_config_regs(mpt_softc_t *mpt)
mpt_read_config_regs(struct mpt_softc *mpt)
{
mpt->pci_cfg.Command = pci_read_config(mpt->dev, PCIR_COMMAND, 2);
mpt->pci_cfg.LatencyTimer_LineSize =
@ -670,9 +691,9 @@ mpt_read_config_regs(mpt_softc_t *mpt)
/* Sets modifiable config registers */
void
mpt_set_config_regs(mpt_softc_t *mpt)
mpt_set_config_regs(struct mpt_softc *mpt)
{
u_int32_t val;
uint32_t val;
#define MPT_CHECK(reg, offset, size) \
val = pci_read_config(mpt->dev, offset, size); \
@ -682,7 +703,7 @@ mpt_set_config_regs(mpt_softc_t *mpt)
mpt->pci_cfg.reg, val); \
}
if (mpt->verbose) {
if (mpt->verbose >= MPT_PRT_DEBUG) {
MPT_CHECK(Command, PCIR_COMMAND, 2);
MPT_CHECK(LatencyTimer_LineSize, PCIR_CACHELNSZ, 2);
MPT_CHECK(IO_BAR, PCIR_BAR(0), 4);
@ -712,8 +733,10 @@ mpt_set_config_regs(mpt_softc_t *mpt)
static void
mpt_pci_intr(void *arg)
{
mpt_softc_t *mpt = arg;
struct mpt_softc *mpt;
mpt = (struct mpt_softc *)arg;
MPT_LOCK(mpt);
(void) mpt_intr(mpt);
mpt_intr(mpt);
MPT_UNLOCK(mpt);
}

1674
sys/dev/mpt/mpt_raid.c Normal file

File diff suppressed because it is too large Load Diff

95
sys/dev/mpt/mpt_raid.h Normal file
View File

@ -0,0 +1,95 @@
/* $FreeBSD$ */
/*-
* Definitions for the integrated RAID features LSI MPT Fusion adapters.
*
* Copyright (c) 2005, WHEEL Sp. z o.o.
* Copyright (c) 2004, 2005 Justin T. Gibbs
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon including
* a substantially similar Disclaimer requirement for further binary
* redistribution.
* 3. Neither the name of the LSI Logic Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MPT_RAID_H_
#define _MPT_RAID_H_
#include <cam/cam.h>
union ccb;
typedef enum {
MPT_RAID_MWCE_ON,
MPT_RAID_MWCE_OFF,
MPT_RAID_MWCE_REBUILD_ONLY,
MPT_RAID_MWCE_NC
} mpt_raid_mwce_t;
const char *
mpt_vol_type(struct mpt_raid_volume *);
const char *
mpt_vol_state(struct mpt_raid_volume *);
const char *
mpt_disk_state(struct mpt_raid_disk *);
void mpt_vol_prt(struct mpt_softc *, struct mpt_raid_volume *,
const char *fmt, ...);
void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk,
const char *fmt, ...);
int mpt_issue_raid_req(struct mpt_softc *mpt, struct mpt_raid_volume *vol,
struct mpt_raid_disk *disk, request_t *req,
u_int Action, uint32_t ActionDataWord,
bus_addr_t addr, bus_size_t len, int write,
int wait);
cam_status
mpt_map_physdisk(struct mpt_softc *mpt, union ccb *, u_int *tgt);
cam_status
mpt_raid_quiesce_disk(struct mpt_softc *mpt,
struct mpt_raid_disk *mpt_disk,
request_t *req);
void mpt_refresh_raid_data(struct mpt_softc *);
void mpt_schedule_raid_refresh(struct mpt_softc *mpt);
static __inline void
mpt_raid_wakeup(struct mpt_softc *mpt)
{
mpt->raid_wakeup++;
wakeup(&mpt->raid_volumes);
}
#define MPT_RAID_SYNC_REPORT_INTERVAL (15 * 60 * hz)
#define MPT_RAID_RESYNC_RATE_MAX (255)
#define MPT_RAID_RESYNC_RATE_MIN (1)
#define MPT_RAID_RESYNC_RATE_NC (0)
#define MPT_RAID_RESYNC_RATE_DEFAULT MPT_RAID_RESYNC_RATE_NC
#define MPT_RAID_QUEUE_DEPTH_DEFAULT (128)
#define MPT_RAID_MWCE_DEFAULT MPT_RAID_MWCE_NC
#define RAID_VOL_FOREACH(mpt, mpt_vol) \
for (mpt_vol = (mpt)->raid_volumes; \
mpt_vol != (mpt)->raid_volumes + (mpt)->raid_max_volumes; \
mpt_vol++)
#endif /*_MPT_RAID_H_ */

125
sys/dev/mpt/mpt_reg.h Normal file
View File

@ -0,0 +1,125 @@
/* $FreeBSD$ */
/*-
* Generic defines for LSI '909 FC adapters.
* FreeBSD Version.
*
* Copyright (c) 2000, 2001 by Greg Ansley
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Additional Copyright (c) 2002 by Matthew Jacob under same license.
*/
#ifndef _MPT_REG_H_
#define _MPT_REG_H_
#define MPT_OFFSET_DOORBELL 0x00
#define MPT_OFFSET_SEQUENCE 0x04
#define MPT_OFFSET_DIAGNOSTIC 0x08
#define MPT_OFFSET_TEST 0x0C
#define MPT_OFFSET_DIAG_DATA 0x10
#define MPT_OFFSET_DIAG_ADDR 0x14
#define MPT_OFFSET_INTR_STATUS 0x30
#define MPT_OFFSET_INTR_MASK 0x34
#define MPT_OFFSET_REQUEST_Q 0x40
#define MPT_OFFSET_REPLY_Q 0x44
#define MPT_OFFSET_HOST_INDEX 0x50
#define MPT_OFFSET_FUBAR 0x90
/* Bit Maps for DOORBELL register */
enum DB_STATE_BITS {
MPT_DB_STATE_RESET = 0x00000000,
MPT_DB_STATE_READY = 0x10000000,
MPT_DB_STATE_RUNNING = 0x20000000,
MPT_DB_STATE_FAULT = 0x40000000,
MPT_DB_STATE_MASK = 0xf0000000
};
#define MPT_STATE(v) ((enum DB_STATE_BITS)((v) & MPT_DB_STATE_MASK))
#define MPT_DB_LENGTH_SHIFT (16)
#define MPT_DB_DATA_MASK (0xffff)
#define MPT_DB_DB_USED 0x08000000
#define MPT_DB_IS_IN_USE(v) (((v) & MPT_DB_DB_USED) != 0)
/*
* "Whom" initializor values
*/
#define MPT_DB_INIT_NOONE 0x00
#define MPT_DB_INIT_BIOS 0x01
#define MPT_DB_INIT_ROMBIOS 0x02
#define MPT_DB_INIT_PCIPEER 0x03
#define MPT_DB_INIT_HOST 0x04
#define MPT_DB_INIT_MANUFACTURE 0x05
#define MPT_WHO(v) \
((v & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT)
/* Function Maps for DOORBELL register */
enum DB_FUNCTION_BITS {
MPT_FUNC_IOC_RESET = 0x40000000,
MPT_FUNC_UNIT_RESET = 0x41000000,
MPT_FUNC_HANDSHAKE = 0x42000000,
MPT_FUNC_REPLY_REMOVE = 0x43000000,
MPT_FUNC_MASK = 0xff000000
};
/* Function Maps for INTERRUPT request register */
enum _MPT_INTR_REQ_BITS {
MPT_INTR_DB_BUSY = 0x80000000,
MPT_INTR_REPLY_READY = 0x00000008,
MPT_INTR_DB_READY = 0x00000001
};
#define MPT_DB_IS_BUSY(v) (((v) & MPT_INTR_DB_BUSY) != 0)
#define MPT_DB_INTR(v) (((v) & MPT_INTR_DB_READY) != 0)
#define MPT_REPLY_INTR(v) (((v) & MPT_INTR_REPLY_READY) != 0)
/* Function Maps for INTERRUPT make register */
enum _MPT_INTR_MASK_BITS {
MPT_INTR_REPLY_MASK = 0x00000008,
MPT_INTR_DB_MASK = 0x00000001
};
/* Magic addresses in diagnostic memory space */
#define MPT_DIAG_IOP_BASE (0x00000000)
#define MPT_DIAG_IOP_SIZE (0x00002000)
#define MPT_DIAG_GPIO (0x00030010)
#define MPT_DIAG_IOPQ_REG_BASE0 (0x00050004)
#define MPT_DIAG_IOPQ_REG_BASE1 (0x00051004)
#define MPT_DIAG_CTX0_BASE (0x000E0000)
#define MPT_DIAG_CTX0_SIZE (0x00002000)
#define MPT_DIAG_CTX1_BASE (0x001E0000)
#define MPT_DIAG_CTX1_SIZE (0x00002000)
#define MPT_DIAG_FLASH_BASE (0x00800000)
#define MPT_DIAG_RAM_BASE (0x01000000)
#define MPT_DIAG_RAM_SIZE (0x00400000)
#define MPT_DIAG_MEM_CFG_BASE (0x3F000000)
#define MPT_DIAG_MEM_CFG_BADFL (0x04000000)
/* GPIO bit assignments */
#define MPT_DIAG_GPIO_SCL (0x00010000)
#define MPT_DIAG_GPIO_SDA_OUT (0x00008000)
#define MPT_DIAG_GPIO_SDA_IN (0x00004000)
#define MPT_REPLY_EMPTY (0xFFFFFFFF) /* Reply Queue Empty Symbol */
#endif /* _MPT_REG_H_ */