From 4c42baf4a4fc6f4d5753218a09605b1dacd1d637 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Tue, 17 Apr 2012 18:13:57 +0200 Subject: [PATCH] mpt(4): Sync with FreeBSD. Bug fixes and cleanups. --- share/man/man4/mpt.4 | 6 +- sys/dev/disk/mpt/mpilib/mpi.h | 12 +- sys/dev/disk/mpt/mpilib/mpi_cnfg.h | 71 ++++++++- sys/dev/disk/mpt/mpilib/mpi_fc.h | 4 +- sys/dev/disk/mpt/mpilib/mpi_inb.h | 250 ---------------------------- sys/dev/disk/mpt/mpilib/mpi_init.h | 4 +- sys/dev/disk/mpt/mpilib/mpi_ioc.h | 25 +++- sys/dev/disk/mpt/mpilib/mpi_lan.h | 4 +- sys/dev/disk/mpt/mpilib/mpi_raid.h | 11 +- sys/dev/disk/mpt/mpilib/mpi_sas.h | 20 ++- sys/dev/disk/mpt/mpilib/mpi_targ.h | 4 +- sys/dev/disk/mpt/mpilib/mpi_tool.h | 4 +- sys/dev/disk/mpt/mpilib/mpi_type.h | 6 +- sys/dev/disk/mpt/mpt.c | 88 +++++++--- sys/dev/disk/mpt/mpt.h | 35 ++--- sys/dev/disk/mpt/mpt_cam.c | 196 +++++++++++++++++------ sys/dev/disk/mpt/mpt_debug.c | 43 ++++-- sys/dev/disk/mpt/mpt_pci.c | 313 +++++++++++++++--------------------- sys/dev/disk/mpt/mpt_raid.c | 74 +++++++-- sys/dev/disk/mpt/mpt_raid.h | 25 +--- sys/dev/disk/mpt/mpt_reg.h | 3 +- sys/dev/disk/mpt/mpt_user.c | 18 ++- 22 files changed, 590 insertions(+), 626 deletions(-) delete mode 100644 sys/dev/disk/mpt/mpilib/mpi_inb.h diff --git a/share/man/man4/mpt.4 b/share/man/man4/mpt.4 index fd2672d..3e8a052 100644 --- a/share/man/man4/mpt.4 +++ b/share/man/man4/mpt.4 @@ -33,9 +33,9 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/mpt.4,v 1.21 2010/09/14 21:40:29 ken Exp $ +.\" $FreeBSD: src/share/man/man4/mpt.4,v 1.22 2011/07/23 22:55:32 gjb Exp $ .\" -.Dd April 28, 2011 +.Dd November 28, 2011 .Dt MPT 4 .Os .Sh NAME @@ -160,7 +160,7 @@ can take on - no separate compilation is required. .Xr mptutil 8 .Rs .%T "LSI Logic Website" -.%O http://www.lsilogic.com/ +.%O http://www.lsi.com/ .Re .Sh HISTORY The diff --git a/sys/dev/disk/mpt/mpilib/mpi.h b/sys/dev/disk/mpt/mpilib/mpi.h index 5b5c592..12a1ce5 100644 --- a/sys/dev/disk/mpt/mpilib/mpi.h +++ b/sys/dev/disk/mpt/mpilib/mpi.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi.h,v 1.9 2007/06/03 22:58:26 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi.h,v 1.10 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ * Title: MPI Message independent structures and definitions * Creation Date: July 27, 2000 * - * mpi.h Version: 01.05.13 + * mpi.h Version: 01.05.17 * * Version History * --------------- @@ -106,6 +106,10 @@ * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. + * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT. + * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT. + * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT. + * 07-11-08 01.05.17 Bumped MPI_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- */ @@ -136,7 +140,7 @@ /* Note: The major versions of 0xe0 through 0xff are reserved */ /* versioning for this MPI header set */ -#define MPI_HEADER_VERSION_UNIT (0x10) +#define MPI_HEADER_VERSION_UNIT (0x14) #define MPI_HEADER_VERSION_DEV (0x00) #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI_HEADER_VERSION_UNIT_SHIFT (8) diff --git a/sys/dev/disk/mpt/mpilib/mpi_cnfg.h b/sys/dev/disk/mpt/mpilib/mpi_cnfg.h index ccd45af..95da666 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_cnfg.h +++ b/sys/dev/disk/mpt/mpilib/mpi_cnfg.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_cnfg.h,v 1.9 2007/06/03 22:58:26 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_cnfg.h,v 1.10 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ * Title: MPI Config message, structures, and Pages * Creation Date: July 27, 2000 * - * mpi_cnfg.h Version: 01.05.15 + * mpi_cnfg.h Version: 01.05.19 * * Version History * --------------- @@ -335,6 +335,28 @@ * Expander Page 0 Flags field. * Fixed define for * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. + * 08-07-07 01.05.16 Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT + * define. + * Added BIOS Page 4 structure. + * Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID + * Physcial Disk Page 1. + * 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of + * Manufacturing Page 4. + * Added Solid State Drives Supported bit to IOC Page 6 + * Capabilities Flags. + * Added new value for AccessStatus field of SAS Device + * Page 0 (_SATA_NEEDS_INITIALIZATION). + * 03-28-08 01.05.18 Defined new bits in Manufacturing Page 4 ExtFlags field + * to control coercion size and the mixing of SAS and SATA + * SSD drives. + * 07-11-08 01.05.19 Added defines MPI_MANPAGE4_EXTFLAGS_RAID0_SINGLE_DRIVE + * and MPI_MANPAGE4_EXTFLAGS_SSD_SCRUB_DISABLE for ExtFlags + * field of Manufacturing Page 4. + * Added defines for a new bit in BIOS Page 1 BiosOptions + * field to control adapter scan order. + * Added BootDeviceWaitTime field to SAS IO Unit Page 2. + * Added MPI_SAS_PHY0_PHYINFO_PHY_VACANT for use in PhyInfo + * field of SAS Expander Page 1. * -------------------------------------------------------------------------- */ @@ -713,6 +735,16 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_4 #define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA (0x01) /* defines for the ExtFlags field */ +#define MPI_MANPAGE4_EXTFLAGS_RAID0_SINGLE_DRIVE (0x0400) +#define MPI_MANPAGE4_EXTFLAGS_SSD_SCRUB_DISABLE (0x0200) +#define MPI_MANPAGE4_EXTFLAGS_MASK_COERCION_SIZE (0x0180) +#define MPI_MANPAGE4_EXTFLAGS_SHIFT_COERCION_SIZE (7) +#define MPI_MANPAGE4_EXTFLAGS_1GB_COERCION_SIZE (0) +#define MPI_MANPAGE4_EXTFLAGS_128MB_COERCION_SIZE (1) + +#define MPI_MANPAGE4_EXTFLAGS_NO_MIX_SSD_SAS_SATA (0x0040) +#define MPI_MANPAGE4_EXTFLAGS_MIX_SSD_AND_NON_SSD (0x0020) +#define MPI_MANPAGE4_EXTFLAGS_DUAL_PORT_SUPPORT (0x0010) #define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA (0x0008) #define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE (0x0004) #define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE (0x0002) @@ -1186,6 +1218,8 @@ typedef struct _CONFIG_PAGE_IOC_6 /* IOC Page 6 Capabilities Flags */ +#define MPI_IOCPAGE6_CAP_FLAGS_SSD_SUPPORT (0x00000020) +#define MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT (0x00000010) #define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING (0x00000008) #define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE (0x00000006) @@ -1222,6 +1256,10 @@ typedef struct _CONFIG_PAGE_BIOS_1 #define MPI_BIOSPAGE1_OPTIONS_SPI_ENABLE (0x00000400) #define MPI_BIOSPAGE1_OPTIONS_FC_ENABLE (0x00000200) #define MPI_BIOSPAGE1_OPTIONS_SAS_ENABLE (0x00000100) + +#define MPI_BIOSPAGE1_OPTIONS_SCAN_HIGH_TO_LOW (0x00000002) +#define MPI_BIOSPAGE1_OPTIONS_SCAN_LOW_TO_HIGH (0x00000000) + #define MPI_BIOSPAGE1_OPTIONS_DISABLE_BIOS (0x00000001) /* values for the IOCSettings field */ @@ -1455,6 +1493,15 @@ typedef struct _CONFIG_PAGE_BIOS_2 #define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05) #define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06) +typedef struct _CONFIG_PAGE_BIOS_4 +{ + CONFIG_PAGE_HEADER Header; /* 00h */ + U64 ReassignmentBaseWWID; /* 04h */ +} CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4, + BIOSPage4_t, MPI_POINTER pBIOSPage4_t; + +#define MPI_BIOSPAGE4_PAGEVERSION (0x00) + /**************************************************************************** * SCSI Port Config Pages @@ -2446,6 +2493,15 @@ typedef struct _RAID_PHYS_DISK1_PATH #define MPI_RAID_PHYSDISK1_FLAG_BROKEN (0x0002) #define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001) + +/* + * Host code (drivers, BIOS, utilities, etc.) should leave this define set to + * one and check Header.PageLength or NumPhysDiskPaths at runtime. + */ +#ifndef MPI_RAID_PHYS_DISK1_PATH_MAX +#define MPI_RAID_PHYS_DISK1_PATH_MAX (1) +#endif + typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 { CONFIG_PAGE_HEADER Header; /* 00h */ @@ -2453,7 +2509,7 @@ typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 U8 PhysDiskNum; /* 05h */ U16 Reserved2; /* 06h */ U32 Reserved1; /* 08h */ - RAID_PHYS_DISK1_PATH Path[1]; /* 0Ch */ + RAID_PHYS_DISK1_PATH Path[MPI_RAID_PHYS_DISK1_PATH_MAX];/* 0Ch */ } CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1, RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t; @@ -2578,6 +2634,7 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_0 #define MPI_SAS_IOUNIT0_RATE_SATA_OOB_COMPLETE (0x03) #define MPI_SAS_IOUNIT0_RATE_1_5 (0x08) #define MPI_SAS_IOUNIT0_RATE_3_0 (0x09) +#define MPI_SAS_IOUNIT0_RATE_6_0 (0x0A) /* see mpi_sas.h for values for SAS IO Unit Page 0 ControllerPhyDeviceInfo values */ @@ -2697,7 +2754,7 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_2 { CONFIG_EXTENDED_PAGE_HEADER Header; /* 00h */ U8 NumDevsPerEnclosure; /* 08h */ - U8 Reserved1; /* 09h */ + U8 BootDeviceWaitTime; /* 09h */ U16 Reserved2; /* 0Ah */ U16 MaxPersistentIDs; /* 0Ch */ U16 NumPersistentIDsUsed; /* 0Eh */ @@ -2707,7 +2764,7 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_2 } CONFIG_PAGE_SAS_IO_UNIT_2, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_2, SasIOUnitPage2_t, MPI_POINTER pSasIOUnitPage2_t; -#define MPI_SASIOUNITPAGE2_PAGEVERSION (0x06) +#define MPI_SASIOUNITPAGE2_PAGEVERSION (0x07) /* values for SAS IO Unit Page 2 Status field */ #define MPI_SAS_IOUNIT2_STATUS_DEVICE_LIMIT_EXCEEDED (0x08) @@ -2871,6 +2928,7 @@ typedef struct _CONFIG_PAGE_SAS_DEVICE_0 #define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED (0x01) #define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED (0x02) #define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT (0x03) +#define MPI_SAS_DEVICE0_ASTATUS_SATA_NEEDS_INITIALIZATION (0x04) /* specific values for SATA Init failures */ #define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN (0x10) #define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT (0x11) @@ -2981,6 +3039,7 @@ typedef struct _CONFIG_PAGE_SAS_PHY_0 #define MPI_SAS_PHY0_FLAGS_SGPIO_DIRECT_ATTACH_ENC (0x01) /* values for SAS PHY Page 0 PhyInfo field */ +#define MPI_SAS_PHY0_PHYINFO_PHY_VACANT (0x80000000) #define MPI_SAS_PHY0_PHYINFO_SATA_PORT_ACTIVE (0x00004000) #define MPI_SAS_PHY0_PHYINFO_SATA_PORT_SELECTOR (0x00002000) #define MPI_SAS_PHY0_PHYINFO_VIRTUAL_PHY (0x00001000) diff --git a/sys/dev/disk/mpt/mpilib/mpi_fc.h b/sys/dev/disk/mpt/mpilib/mpi_fc.h index 7090645..7583d45 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_fc.h +++ b/sys/dev/disk/mpt/mpilib/mpi_fc.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_fc.h,v 1.6 2006/01/21 00:29:51 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_fc.h,v 1.7 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/disk/mpt/mpilib/mpi_inb.h b/sys/dev/disk/mpt/mpilib/mpi_inb.h deleted file mode 100644 index 4d7e7b2..0000000 --- a/sys/dev/disk/mpt/mpilib/mpi_inb.h +++ /dev/null @@ -1,250 +0,0 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_inb.h,v 1.1 2006/01/21 00:29:51 mjacob Exp $ */ -/*- - * 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: - * 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. -/* - * Copyright (c) 2003-2004 LSI Logic Corporation. - * - * - * Name: mpi_inb.h - * Title: MPI Inband structures and definitions - * Creation Date: September 30, 2003 - * - * mpi_inb.h Version: 01.05.01 - * - * Version History - * --------------- - * - * Date Version Description - * -------- -------- ------------------------------------------------------ - * 05-11-04 01.03.01 Original release. - * 08-19-04 01.05.01 Original release for MPI v1.5. - * -------------------------------------------------------------------------- - */ - -#ifndef MPI_INB_H -#define MPI_INB_H - -/****************************************************************************** -* -* I n b a n d M e s s a g e s -* -*******************************************************************************/ - - -/****************************************************************************/ -/* Inband Buffer Post Request */ -/****************************************************************************/ - -typedef struct _MSG_INBAND_BUFFER_POST_REQUEST -{ - U8 Reserved1; /* 00h */ - U8 BufferCount; /* 01h */ - U8 ChainOffset; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U32 Reserved4; /* 0Ch */ - SGE_TRANS_SIMPLE_UNION SGL; /* 10h */ -} MSG_INBAND_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_INBAND_BUFFER_POST_REQUEST, - MpiInbandBufferPostRequest_t , MPI_POINTER pMpiInbandBufferPostRequest_t; - - -typedef struct _WWN_FC_FORMAT -{ - U64 NodeName; /* 00h */ - U64 PortName; /* 08h */ -} WWN_FC_FORMAT, MPI_POINTER PTR_WWN_FC_FORMAT, - WwnFcFormat_t, MPI_POINTER pWwnFcFormat_t; - -typedef struct _WWN_SAS_FORMAT -{ - U64 WorldWideID; /* 00h */ - U32 Reserved1; /* 08h */ - U32 Reserved2; /* 0Ch */ -} WWN_SAS_FORMAT, MPI_POINTER PTR_WWN_SAS_FORMAT, - WwnSasFormat_t, MPI_POINTER pWwnSasFormat_t; - -typedef union _WWN_INBAND_FORMAT -{ - WWN_FC_FORMAT Fc; - WWN_SAS_FORMAT Sas; -} WWN_INBAND_FORMAT, MPI_POINTER PTR_WWN_INBAND_FORMAT, - WwnInbandFormat, MPI_POINTER pWwnInbandFormat; - - -/* Inband Buffer Post reply message */ - -typedef struct _MSG_INBAND_BUFFER_POST_REPLY -{ - U16 Reserved1; /* 00h */ - U8 MsgLength; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U16 Reserved4; /* 0Ch */ - U16 IOCStatus; /* 0Eh */ - U32 IOCLogInfo; /* 10h */ - U32 TransferLength; /* 14h */ - U32 TransactionContext; /* 18h */ - WWN_INBAND_FORMAT Wwn; /* 1Ch */ - U32 IOCIdentifier[4]; /* 2Ch */ -} MSG_INBAND_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_INBAND_BUFFER_POST_REPLY, - MpiInbandBufferPostReply_t, MPI_POINTER pMpiInbandBufferPostReply_t; - - -/****************************************************************************/ -/* Inband Send Request */ -/****************************************************************************/ - -typedef struct _MSG_INBAND_SEND_REQUEST -{ - U16 Reserved1; /* 00h */ - U8 ChainOffset; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U32 Reserved4; /* 0Ch */ - WWN_INBAND_FORMAT Wwn; /* 10h */ - U32 Reserved5; /* 20h */ - SGE_IO_UNION SGL; /* 24h */ -} MSG_INBAND_SEND_REQUEST, MPI_POINTER PTR_MSG_INBAND_SEND_REQUEST, - MpiInbandSendRequest_t , MPI_POINTER pMpiInbandSendRequest_t; - - -/* Inband Send reply message */ - -typedef struct _MSG_INBAND_SEND_REPLY -{ - U16 Reserved1; /* 00h */ - U8 MsgLength; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U16 Reserved4; /* 0Ch */ - U16 IOCStatus; /* 0Eh */ - U32 IOCLogInfo; /* 10h */ - U32 ResponseLength; /* 14h */ -} MSG_INBAND_SEND_REPLY, MPI_POINTER PTR_MSG_INBAND_SEND_REPLY, - MpiInbandSendReply_t, MPI_POINTER pMpiInbandSendReply_t; - - -/****************************************************************************/ -/* Inband Response Request */ -/****************************************************************************/ - -typedef struct _MSG_INBAND_RSP_REQUEST -{ - U16 Reserved1; /* 00h */ - U8 ChainOffset; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U32 Reserved4; /* 0Ch */ - WWN_INBAND_FORMAT Wwn; /* 10h */ - U32 IOCIdentifier[4]; /* 20h */ - U32 ResponseLength; /* 30h */ - SGE_IO_UNION SGL; /* 34h */ -} MSG_INBAND_RSP_REQUEST, MPI_POINTER PTR_MSG_INBAND_RSP_REQUEST, - MpiInbandRspRequest_t , MPI_POINTER pMpiInbandRspRequest_t; - - -/* Inband Response reply message */ - -typedef struct _MSG_INBAND_RSP_REPLY -{ - U16 Reserved1; /* 00h */ - U8 MsgLength; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U16 Reserved4; /* 0Ch */ - U16 IOCStatus; /* 0Eh */ - U32 IOCLogInfo; /* 10h */ -} MSG_INBAND_RSP_REPLY, MPI_POINTER PTR_MSG_INBAND_RSP_REPLY, - MpiInbandRspReply_t, MPI_POINTER pMpiInbandRspReply_t; - - -/****************************************************************************/ -/* Inband Abort Request */ -/****************************************************************************/ - -typedef struct _MSG_INBAND_ABORT_REQUEST -{ - U8 Reserved1; /* 00h */ - U8 AbortType; /* 01h */ - U8 ChainOffset; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U32 Reserved4; /* 0Ch */ - U32 ContextToAbort; /* 10h */ -} MSG_INBAND_ABORT_REQUEST, MPI_POINTER PTR_MSG_INBAND_ABORT_REQUEST, - MpiInbandAbortRequest_t , MPI_POINTER pMpiInbandAbortRequest_t; - -#define MPI_INBAND_ABORT_TYPE_ALL_BUFFERS (0x00) -#define MPI_INBAND_ABORT_TYPE_EXACT_BUFFER (0x01) -#define MPI_INBAND_ABORT_TYPE_SEND_REQUEST (0x02) -#define MPI_INBAND_ABORT_TYPE_RESPONSE_REQUEST (0x03) - - -/* Inband Abort reply message */ - -typedef struct _MSG_INBAND_ABORT_REPLY -{ - U8 Reserved1; /* 00h */ - U8 AbortType; /* 01h */ - U8 MsgLength; /* 02h */ - U8 Function; /* 03h */ - U16 Reserved2; /* 04h */ - U8 Reserved3; /* 06h */ - U8 MsgFlags; /* 07h */ - U32 MsgContext; /* 08h */ - U16 Reserved4; /* 0Ch */ - U16 IOCStatus; /* 0Eh */ - U32 IOCLogInfo; /* 10h */ -} MSG_INBAND_ABORT_REPLY, MPI_POINTER PTR_MSG_INBAND_ABORT_REPLY, - MpiInbandAbortReply_t, MPI_POINTER pMpiInbandAbortReply_t; - - -#endif diff --git a/sys/dev/disk/mpt/mpilib/mpi_init.h b/sys/dev/disk/mpt/mpilib/mpi_init.h index 606455b..a6edcbf 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_init.h +++ b/sys/dev/disk/mpt/mpilib/mpi_init.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_init.h,v 1.8 2007/06/03 22:58:27 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_init.h,v 1.9 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/disk/mpt/mpilib/mpi_ioc.h b/sys/dev/disk/mpt/mpilib/mpi_ioc.h index 6ae0228..a120217 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_ioc.h +++ b/sys/dev/disk/mpt/mpilib/mpi_ioc.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_ioc.h,v 1.9 2007/06/03 22:58:27 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_ioc.h,v 1.11 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: August 11, 2000 * - * mpi_ioc.h Version: 01.05.14 + * mpi_ioc.h Version: 01.05.16 * * Version History * --------------- @@ -140,6 +140,16 @@ * added _MULTI_PORT_DOMAIN. * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. * Added Common Boot Block type to FWUpload Request. + * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define. + * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and + * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data. + * Added SASAddress field to SAS Initiator Device Table + * Overflow event data structure. + * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status + * Change Event data to indicate completion of internally + * generated task management. + * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define. + * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define. * -------------------------------------------------------------------------- */ @@ -639,6 +649,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_STATUS_CHANGE #define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B) #define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C) #define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D) +#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET (0x0E) +#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL (0x0F) /* SCSI Event data for Queue Full event */ @@ -735,6 +747,8 @@ typedef struct _MPI_EVENT_DATA_IR2 #define MPI_EVENT_IR2_RC_PD_REMOVED (0x05) #define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06) #define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07) +#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED (0x08) +#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED (0x09) /* defines for logical disk states */ #define MPI_LD_STATE_OPTIMAL (0x00) @@ -854,6 +868,7 @@ typedef struct _EVENT_DATA_SAS_PHY_LINK_STATUS #define MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE (0x03) #define MPI_EVENT_SAS_PLS_LR_RATE_1_5 (0x08) #define MPI_EVENT_SAS_PLS_LR_RATE_3_0 (0x09) +#define MPI_EVENT_SAS_PLS_LR_RATE_6_0 (0x0A) /* SAS Discovery Event data */ @@ -894,6 +909,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERROR #define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800) #define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) #define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000) +#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE (0x00004000) /* SAS SMP Error Event data */ @@ -929,6 +945,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE /* defines for the ReasonCode field of the SAS Initiator Device Status Change event */ #define MPI_EVENT_SAS_INIT_RC_ADDED (0x01) +#define MPI_EVENT_SAS_INIT_RC_REMOVED (0x02) +#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE (0x03) /* SAS Initiator Device Table Overflow Event data */ @@ -937,6 +955,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABLE_OVERFLOW U8 MaxInit; /* 00h */ U8 CurrentInit; /* 01h */ U16 Reserved1; /* 02h */ + U64 SASAddress; /* 04h */ } EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, MpiEventDataSasInitTableOverflow_t, diff --git a/sys/dev/disk/mpt/mpilib/mpi_lan.h b/sys/dev/disk/mpt/mpilib/mpi_lan.h index 18e104d..5ae9118 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_lan.h +++ b/sys/dev/disk/mpt/mpilib/mpi_lan.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_lan.h,v 1.6 2006/01/21 00:29:51 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_lan.h,v 1.7 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/disk/mpt/mpilib/mpi_raid.h b/sys/dev/disk/mpt/mpilib/mpi_raid.h index 7a9c8f2..83cdb06 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_raid.h +++ b/sys/dev/disk/mpt/mpilib/mpi_raid.h @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_raid.h,v 1.8 2007/06/03 22:58:27 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_raid.h,v 1.9 2012/03/24 16:23:21 marius Exp $ */ /*- * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. * All rights reserved. @@ -33,7 +33,7 @@ * Title: MPI RAID message and structures * Creation Date: February 27, 2001 * - * mpi_raid.h Version: 01.05.03 + * mpi_raid.h Version: 01.05.05 * * Version History * --------------- @@ -61,6 +61,9 @@ * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and * associated defines. + * 08-07-07 01.05.04 Added Disable Full Rebuild bit to the ActionDataWord + * for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME. + * 01-15-08 01.05.05 Added define for MPI_RAID_ACTION_SET_VOLUME_NAME. * -------------------------------------------------------------------------- */ @@ -120,6 +123,7 @@ typedef struct _MSG_RAID_ACTION #define MPI_RAID_ACTION_SET_RESYNC_RATE (0x13) #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE (0x14) #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE (0x15) +#define MPI_RAID_ACTION_SET_VOLUME_NAME (0x16) /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */ #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC (0x00000001) @@ -132,6 +136,9 @@ typedef struct _MSG_RAID_ACTION #define MPI_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000) #define MPI_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000002) +/* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */ +#define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD (0x00000001) + /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */ #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL (0x00000001) diff --git a/sys/dev/disk/mpt/mpilib/mpi_sas.h b/sys/dev/disk/mpt/mpilib/mpi_sas.h index 75c5e42..8011ccc 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_sas.h +++ b/sys/dev/disk/mpt/mpilib/mpi_sas.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_sas.h,v 1.3 2007/06/03 22:58:27 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_sas.h,v 1.4 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ * Title: MPI Serial Attached SCSI structures and definitions * Creation Date: August 19, 2004 * - * mpi_sas.h Version: 01.05.04 + * mpi_sas.h Version: 01.05.05 * * Version History * --------------- @@ -50,6 +50,10 @@ * reply. * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO * Unit Control request. + * 01-15-08 01.05.05 Added support for MPI_SAS_OP_SET_IOC_PARAMETER, + * including adding IOCParameter and IOCParameter value + * fields to SAS IO Unit Control Request. + * Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define. * -------------------------------------------------------------------------- */ @@ -87,6 +91,8 @@ * Values for the SAS DeviceInfo field used in SAS Device Status Change Event * data and SAS IO Unit Configuration pages. */ +#define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC (0xF0000000) + #define MPI_SAS_DEVICE_INFO_SEP (0x00004000) #define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000) #define MPI_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000) @@ -243,7 +249,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST U8 ChainOffset; /* 02h */ U8 Function; /* 03h */ U16 DevHandle; /* 04h */ - U8 Reserved3; /* 06h */ + U8 IOCParameter; /* 06h */ U8 MsgFlags; /* 07h */ U32 MsgContext; /* 08h */ U8 TargetID; /* 0Ch */ @@ -252,7 +258,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST U8 PrimFlags; /* 0Fh */ U32 Primitive; /* 10h */ U64 SASAddress; /* 14h */ - U32 Reserved4; /* 1Ch */ + U32 IOCParameterValue; /* 1Ch */ } MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST, SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t; @@ -268,6 +274,8 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST #define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C) #define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D) /* obsolete name */ #define MPI_SAS_OP_REMOVE_DEVICE (0x0D) +#define MPI_SAS_OP_SET_IOC_PARAMETER (0x0E) +#define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN (0x80) /* values for the PrimFlags field */ #define MPI_SAS_PRIMFLAGS_SINGLE (0x08) @@ -283,7 +291,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY U8 MsgLength; /* 02h */ U8 Function; /* 03h */ U16 DevHandle; /* 04h */ - U8 Reserved3; /* 06h */ + U8 IOCParameter; /* 06h */ U8 MsgFlags; /* 07h */ U32 MsgContext; /* 08h */ U16 Reserved4; /* 0Ch */ diff --git a/sys/dev/disk/mpt/mpilib/mpi_targ.h b/sys/dev/disk/mpt/mpilib/mpi_targ.h index 1fec5e3..2032ae5 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_targ.h +++ b/sys/dev/disk/mpt/mpilib/mpi_targ.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_targ.h,v 1.7 2007/06/03 22:58:27 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_targ.h,v 1.8 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/disk/mpt/mpilib/mpi_tool.h b/sys/dev/disk/mpt/mpilib/mpi_tool.h index 09517b7..93f043a 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_tool.h +++ b/sys/dev/disk/mpt/mpilib/mpi_tool.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_tool.h,v 1.1 2006/01/21 00:29:51 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_tool.h,v 1.2 2012/03/24 16:23:21 marius Exp $ */ /*- - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/disk/mpt/mpilib/mpi_type.h b/sys/dev/disk/mpt/mpilib/mpi_type.h index f4bcbc0..bf1a7a0 100644 --- a/sys/dev/disk/mpt/mpilib/mpi_type.h +++ b/sys/dev/disk/mpt/mpilib/mpi_type.h @@ -1,6 +1,6 @@ -/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_type.h,v 1.10 2006/02/26 22:50:14 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_type.h,v 1.12 2012/03/24 16:23:21 marius Exp $ */ /* - * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors. + * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,7 +84,7 @@ typedef uint32_t U32; #else -#if defined(unix) || defined(__arm) || defined(ALPHA) || defined(__PPC__) || defined(__ppc) +#if defined(__unix__) || defined(__arm) || defined(ALPHA) || defined(__PPC__) || defined(__ppc) typedef signed int S32; typedef unsigned int U32; diff --git a/sys/dev/disk/mpt/mpt.c b/sys/dev/disk/mpt/mpt.c index e7ac172..2a3cc0e 100644 --- a/sys/dev/disk/mpt/mpt.c +++ b/sys/dev/disk/mpt/mpt.c @@ -94,7 +94,7 @@ * 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. * - * $FreeBSD: src/sys/dev/mpt/mpt.c,v 1.57 2011/04/22 09:59:16 marius Exp $ + * $FreeBSD: src/sys/dev/mpt/mpt.c,v 1.61 2012/02/11 12:03:44 marius Exp $ */ #include @@ -147,7 +147,7 @@ static __inline struct mpt_personality * mpt_pers_find(struct mpt_softc *mpt, u_int start_at) { KASSERT(start_at <= MPT_MAX_PERSONALITIES, - ("mpt_pers_find: starting position out of range\n")); + ("mpt_pers_find: starting position out of range")); while (start_at < MPT_MAX_PERSONALITIES && (mpt->mpt_pers_mask & (0x1 << start_at)) == 0) { @@ -300,66 +300,75 @@ mpt_modevent(module_t mod, int type, void *data) return (error); } -int +static int mpt_stdload(struct mpt_personality *pers) { + /* Load is always successful. */ return (0); } -int +static int mpt_stdprobe(struct mpt_softc *mpt) { + /* Probe is always successful. */ return (0); } -int +static int mpt_stdattach(struct mpt_softc *mpt) { + /* Attach is always successful. */ return (0); } -int +static int mpt_stdenable(struct mpt_softc *mpt) { + /* Enable is always successful. */ return (0); } -void +static void mpt_stdready(struct mpt_softc *mpt) { -} +} -int +static int mpt_stdevent(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_stdevent: 0x%x\n", msg->Event & 0xFF); /* Event was not for us. */ return (0); } -void +static void mpt_stdreset(struct mpt_softc *mpt, int type) { + } -void +static void mpt_stdshutdown(struct mpt_softc *mpt) { + } -void +static void mpt_stddetach(struct mpt_softc *mpt) { + } -int +static int mpt_stdunload(struct mpt_personality *pers) { + /* Unload is always successful. */ return (0); } @@ -382,7 +391,6 @@ mpt_postattach(void *unused) } SYSINIT(mptdev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, mpt_postattach, NULL); - /******************************* Bus DMA Support ******************************/ void mpt_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -477,6 +485,7 @@ static int mpt_default_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Default Handler Called: req=%p:%u reply_descriptor=%x frame=%p\n", req, req->serno, reply_desc, reply_frame); @@ -493,8 +502,8 @@ static int mpt_config_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { - if (req != NULL) { + if (req != NULL) { if (reply_frame != NULL) { MSG_CONFIG *cfgp; MSG_CONFIG_REPLY *reply; @@ -527,6 +536,7 @@ static int mpt_handshake_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + /* Nothing to be done. */ return (TRUE); } @@ -649,6 +659,7 @@ static int mpt_core_event(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_core_event: 0x%x\n", msg->Event & 0xFF); switch(msg->Event & 0xFF) { @@ -869,6 +880,7 @@ mpt_complete_request_chain(struct mpt_softc *mpt, struct req_queue *chain, void mpt_dump_reply_frame(struct mpt_softc *mpt, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Address Reply:\n"); mpt_print_reply(reply_frame); } @@ -880,12 +892,14 @@ static __inline uint32_t mpt_rd_intr(struct mpt_softc *mpt); static __inline uint32_t mpt_rd_db(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_DOORBELL); } static __inline uint32_t mpt_rd_intr(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_INTR_STATUS); } @@ -894,6 +908,7 @@ static int mpt_wait_db_ack(struct mpt_softc *mpt) { int i; + for (i=0; i < MPT_MAX_WAIT; i++) { if (!MPT_DB_IS_BUSY(mpt_rd_intr(mpt))) { maxwait_ack = i > maxwait_ack ? i : maxwait_ack; @@ -909,6 +924,7 @@ static int mpt_wait_db_int(struct mpt_softc *mpt) { int i; + for (i = 0; i < MPT_MAX_WAIT; i++) { if (MPT_DB_INTR(mpt_rd_intr(mpt))) { maxwait_int = i > maxwait_int ? i : maxwait_int; @@ -924,6 +940,7 @@ void mpt_check_doorbell(struct mpt_softc *mpt) { uint32_t db = mpt_rd_db(mpt); + if (MPT_STATE(db) != MPT_DB_STATE_RUNNING) { mpt_prt(mpt, "Device not running\n"); mpt_print_db(db); @@ -955,6 +972,7 @@ static int mpt_download_fw(struct mpt_softc *mpt); static int mpt_soft_reset(struct mpt_softc *mpt) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "soft reset\n"); /* Have to use hard reset if we are not in Running state */ @@ -1018,6 +1036,7 @@ mpt_enable_diag_mode(struct mpt_softc *mpt) static void mpt_disable_diag_mode(struct mpt_softc *mpt) { + mpt_write(mpt, MPT_OFFSET_SEQUENCE, 0xFFFFFFFF); } @@ -1033,6 +1052,12 @@ mpt_hard_reset(struct mpt_softc *mpt) mpt_lprt(mpt, MPT_PRT_DEBUG, "hard reset\n"); + if (mpt->is_1078) { + mpt_write(mpt, MPT_OFFSET_RESET_1078, 0x07); + DELAY(1000); + return; + } + error = mpt_enable_diag_mode(mpt); if (error) { mpt_prt(mpt, "WARNING - Could not enter diagnostic mode !\n"); @@ -1093,6 +1118,7 @@ mpt_hard_reset(struct mpt_softc *mpt) static void mpt_core_ioc_reset(struct mpt_softc *mpt, int type) { + /* * Complete all pending requests with a status * appropriate for an IOC reset. @@ -1101,7 +1127,6 @@ mpt_core_ioc_reset(struct mpt_softc *mpt, int type) MPI_IOCSTATUS_INVALID_STATE); } - /* * Reset the IOC when needed. Try software command first then if needed * poke at the magic diagnostic reset. Note that a hard reset resets @@ -1177,8 +1202,7 @@ mpt_free_request(struct mpt_softc *mpt, request_t *req) uint32_t offset, reply_baddr; if (req == NULL || req != &mpt->request_pool[req->index]) { - panic("mpt_free_request bad req ptr\n"); - return; + panic("mpt_free_request: bad req ptr"); } if ((nxt = req->chain) != NULL) { req->chain = NULL; @@ -1241,7 +1265,7 @@ retry: req = TAILQ_FIRST(&mpt->request_free_list); if (req != NULL) { KASSERT(req == &mpt->request_pool[req->index], - ("mpt_get_request: corrupted request free list\n")); + ("mpt_get_request: corrupted request free list")); KASSERT(req->state == REQ_STATE_FREE, ("req %p:%u not free on free list %x index %d function %x", req, req->serno, req->state, req->index, @@ -1262,6 +1286,7 @@ retry: void mpt_send_cmd(struct mpt_softc *mpt, request_t *req) { + if (mpt->verbose > MPT_PRT_DEBUG2) { mpt_dump_request(mpt, req); } @@ -2057,7 +2082,7 @@ mpt_send_port_enable(struct mpt_softc *mpt, int port) mpt_send_cmd(mpt, req); error = mpt_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE, - FALSE, (mpt->is_sas || mpt->is_fc)? 30000 : 3000); + FALSE, (mpt->is_sas || mpt->is_fc)? 300000 : 30000); if (error != 0) { mpt_prt(mpt, "port %d enable timed out\n", port); return (-1); @@ -2103,6 +2128,7 @@ mpt_send_event_request(struct mpt_softc *mpt, int onoff) void mpt_enable_ints(struct mpt_softc *mpt) { + /* Unmask every thing except door bell int */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, MPT_INTR_DB_MASK); } @@ -2113,6 +2139,7 @@ mpt_enable_ints(struct mpt_softc *mpt) void mpt_disable_ints(struct mpt_softc *mpt) { + /* Mask all interrupts */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, MPT_INTR_REPLY_MASK | MPT_INTR_DB_MASK); @@ -2210,7 +2237,7 @@ mpt_detach(struct mpt_softc *mpt) return (0); } -int +static int mpt_core_load(struct mpt_personality *pers) { int i; @@ -2236,7 +2263,7 @@ mpt_core_load(struct mpt_personality *pers) * Initialize per-instance driver data and perform * initial controller configuration. */ -int +static int mpt_core_attach(struct mpt_softc *mpt) { int val, error; @@ -2275,9 +2302,10 @@ mpt_core_attach(struct mpt_softc *mpt) return (error); } -int +static int mpt_core_enable(struct mpt_softc *mpt) { + /* * We enter with the IOC enabled, but async events * not enabled, ports not enabled and interrupts @@ -2325,13 +2353,14 @@ mpt_core_enable(struct mpt_softc *mpt) return (0); } -void +static void mpt_core_shutdown(struct mpt_softc *mpt) { + mpt_disable_ints(mpt); } -void +static void mpt_core_detach(struct mpt_softc *mpt) { int val; @@ -2353,9 +2382,10 @@ mpt_core_detach(struct mpt_softc *mpt) sysctl_ctx_free(&mpt->mpt_sysctl_ctx); } -int +static int mpt_core_unload(struct mpt_personality *pers) { + /* Unload is always successful. */ return (0); } @@ -2428,6 +2458,11 @@ mpt_download_fw(struct mpt_softc *mpt) uint32_t ext_offset; uint32_t data; + if (mpt->pci_pio_reg == NULL) { + mpt_prt(mpt, "No PIO resource!\n"); + return (ENXIO); + } + mpt_prt(mpt, "Downloading Firmware - Image Size %d\n", mpt->fw_image_size); @@ -2577,6 +2612,7 @@ static void mpt_dma_buf_free(struct mpt_softc *mpt) { int i; + if (mpt->request_dmat == 0) { mpt_lprt(mpt, MPT_PRT_DEBUG, "already released dma memory\n"); return; diff --git a/sys/dev/disk/mpt/mpt.h b/sys/dev/disk/mpt/mpt.h index b717547..2344a49 100644 --- a/sys/dev/disk/mpt/mpt.h +++ b/sys/dev/disk/mpt/mpt.h @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/mpt/mpt.h,v 1.55 2011/04/22 09:59:16 marius Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpt.h,v 1.60 2012/03/24 00:30:17 marius Exp $ */ /*- * Generic defines for LSI '909 FC adapters. * FreeBSD Version. @@ -543,7 +543,7 @@ struct mpt_softc { int mpt_locksetup; uint32_t mpt_pers_mask; uint32_t - : 8, + : 7, unit : 8, ready : 1, fw_uploaded : 1, @@ -560,7 +560,8 @@ struct mpt_softc { disabled : 1, is_spi : 1, is_sas : 1, - is_fc : 1; + is_fc : 1, + is_1078 : 1; u_int cfg_role; u_int role; /* role: none, ini, target, both */ @@ -648,17 +649,17 @@ struct mpt_softc { int pci_msi_count; struct resource * pci_irq; /* Interrupt map for chip */ void * ih; /* Interrupt handle */ +#if 0 struct mpt_pci_cfg pci_cfg; /* saved PCI conf registers */ +#endif /* * 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; @@ -816,12 +817,14 @@ mpt_read(struct mpt_softc *mpt, int offset) static __inline void mpt_pio_write(struct mpt_softc *mpt, size_t offset, uint32_t val) { + KASSERT(mpt->pci_pio_reg != NULL, ("no PIO resource")); 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) { + KASSERT(mpt->pci_pio_reg != NULL, ("no PIO resource")); return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset)); } /*********************** Reply Frame/Request Management ***********************/ @@ -909,16 +912,6 @@ mpt_complete_request_chain(struct mpt_softc *, struct req_queue *, u_int); int mpt_reset(struct mpt_softc *, int /*reinit*/); /****************************** Debugging ************************************/ -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); - void mpt_dump_data(struct mpt_softc *, const char *, void *, int); void mpt_dump_request(struct mpt_softc *, request_t *); @@ -943,11 +936,13 @@ do { \ mpt_prt(mpt, __VA_ARGS__); \ } while (0) +#if 0 #define mpt_lprtc(mpt, level, ...) \ do { \ if (level <= (mpt)->verbose) \ mpt_prtc(mpt, __VA_ARGS__); \ } while (0) +#endif void mpt_prt(struct mpt_softc *, const char *, ...) __printflike(2, 3); void mpt_prtc(struct mpt_softc *, const char *, ...) @@ -977,7 +972,7 @@ static __inline request_t * mpt_tag_2_req(struct mpt_softc *mpt, uint32_t tag) { uint16_t rtg = (tag >> 18); - KASSERT(rtg < mpt->tgt_cmds_allocated, ("bad tag %d\n", tag)); + KASSERT(rtg < mpt->tgt_cmds_allocated, ("bad tag %d", tag)); KASSERT(mpt->tgt_cmd_ptrs, ("no cmd backpointer array")); KASSERT(mpt->tgt_cmd_ptrs[rtg], ("no cmd backpointer")); return (mpt->tgt_cmd_ptrs[rtg]); @@ -1044,7 +1039,7 @@ mpt_req_spcl(struct mpt_softc *mpt, request_t *req, const char *s, int line) return; } } - panic("%s(%d): req %p:%u function %x not in els or tgt ptrs\n", + panic("%s(%d): req %p:%u function %x not in els or tgt ptrs", s, line, req, req->serno, ((PTR_MSG_REQUEST_HEADER)req->req_vbuf)->Function); } @@ -1058,13 +1053,13 @@ mpt_req_not_spcl(struct mpt_softc *mpt, request_t *req, const char *s, int line) int i; for (i = 0; i < mpt->els_cmds_allocated; i++) { KASSERT(req != mpt->els_cmd_ptrs[i], - ("%s(%d): req %p:%u func %x in els ptrs at ioindex %d\n", + ("%s(%d): req %p:%u func %x in els ptrs at ioindex %d", s, line, req, req->serno, ((PTR_MSG_REQUEST_HEADER)req->req_vbuf)->Function, i)); } for (i = 0; i < mpt->tgt_cmds_allocated; i++) { KASSERT(req != mpt->tgt_cmd_ptrs[i], - ("%s(%d): req %p:%u func %x in tgt ptrs at ioindex %d\n", + ("%s(%d): req %p:%u func %x in tgt ptrs at ioindex %d", s, line, req, req->serno, ((PTR_MSG_REQUEST_HEADER)req->req_vbuf)->Function, i)); } @@ -1104,7 +1099,6 @@ 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*/, cfgparms_t *params, bus_addr_t /*addr*/, bus_size_t/*len*/, @@ -1158,6 +1152,5 @@ 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); -void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *msg); void mpt_dump_sgl(SGE_IO_UNION *se, int offset); #endif /* _MPT_H_ */ diff --git a/sys/dev/disk/mpt/mpt_cam.c b/sys/dev/disk/mpt/mpt_cam.c index 46a7700..8f9f2f4 100644 --- a/sys/dev/disk/mpt/mpt_cam.c +++ b/sys/dev/disk/mpt/mpt_cam.c @@ -93,7 +93,7 @@ * 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. * - * $FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.77 2011/04/22 09:59:16 marius Exp $ + * $FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.84 2012/02/11 12:03:44 marius Exp $ */ #include @@ -189,7 +189,7 @@ MODULE_DEPEND(mpt_cam, cam, 1, 1, 1); int mpt_enable_sata_wc = -1; TUNABLE_INT("hw.mpt.enable_sata_wc", &mpt_enable_sata_wc); -int +static int mpt_cam_probe(struct mpt_softc *mpt) { int role; @@ -211,7 +211,7 @@ mpt_cam_probe(struct mpt_softc *mpt) return (ENODEV); } -int +static int mpt_cam_attach(struct mpt_softc *mpt) { struct cam_devq *devq; @@ -502,7 +502,6 @@ mpt_read_config_info_fc(struct mpt_softc *mpt) static int mpt_set_initial_config_fc(struct mpt_softc *mpt) { - CONFIG_PAGE_FC_PORT_1 fc; U32 fl; int r, doit = 0; @@ -874,8 +873,8 @@ static int mpt_sata_pass_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { - if (req != NULL) { + if (req != NULL) { if (reply_frame != NULL) { req->IOCStatus = le16toh(reply_frame->IOCStatus); } @@ -1107,7 +1106,7 @@ mpt_set_initial_config_spi(struct mpt_softc *mpt) return (0); } -int +static int mpt_cam_enable(struct mpt_softc *mpt) { int error; @@ -1144,9 +1143,10 @@ out: return (error); } -void +static void mpt_cam_ready(struct mpt_softc *mpt) { + /* * If we're in target mode, hang out resources now * so we don't cause the world to hang talking to us. @@ -1164,7 +1164,7 @@ mpt_cam_ready(struct mpt_softc *mpt) mpt->ready = 1; } -void +static void mpt_cam_detach(struct mpt_softc *mpt) { mpt_handler_t handler; @@ -1267,8 +1267,9 @@ mpt_execute_req_a64(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) char *mpt_off; union ccb *ccb; struct mpt_softc *mpt; - int seg, first_lim; - uint32_t flags, nxt_off; + bus_addr_t chain_list_addr; + int first_lim, seg, this_seg_lim; + uint32_t addr, cur_off, flags, nxt_off, tf; void *sglp = NULL; MSG_REQUEST_HEADER *hdrp; SGE_SIMPLE64 *se; @@ -1344,7 +1345,7 @@ bad: MPT_TGT_STATE(mpt, cmd_req)->req = NULL; } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -1422,16 +1423,20 @@ bad: se = (SGE_SIMPLE64 *) sglp; for (seg = 0; seg < first_lim; seg++, se++, dm_segs++) { - uint32_t tf; - + tf = flags; memset(se, 0, sizeof (*se)); + MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); se->Address.Low = htole32(dm_segs->ds_addr & 0xffffffff); if (sizeof(bus_addr_t) > 4) { - se->Address.High = - htole32(((uint64_t)dm_segs->ds_addr) >> 32); + addr = ((uint64_t)dm_segs->ds_addr) >> 32; + /* SAS1078 36GB limitation WAR */ + if (mpt->is_1078 && (((uint64_t)dm_segs->ds_addr + + MPI_SGE_LENGTH(se->FlagsLength)) >> 32) == 9) { + addr |= (1 << 31); + tf |= MPI_SGE_FLAGS_LOCAL_ADDRESS; + } + se->Address.High = htole32(addr); } - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); - tf = flags; if (seg == first_lim - 1) { tf |= MPI_SGE_FLAGS_LAST_ELEMENT; } @@ -1456,15 +1461,11 @@ bad: /* * Make up the rest of the data segments out of a chain element - * (contiained in the current request frame) which points to + * (contained in the current request frame) which points to * SIMPLE64 elements in the next request frame, possibly ending * with *another* chain element (if there's more). */ while (seg < nseg) { - int this_seg_lim; - uint32_t tf, cur_off; - bus_addr_t chain_list_addr; - /* * Point to the chain descriptor. Note that the chain * descriptor is at the end of the *previous* list (whether @@ -1492,7 +1493,7 @@ bad: nxt_off += MPT_RQSL(mpt); /* - * Now initialized the chain descriptor. + * Now initialize the chain descriptor. */ memset(ce, 0, sizeof (*ce)); @@ -1542,16 +1543,24 @@ bad: * set the end of list and end of buffer flags. */ while (seg < this_seg_lim) { + tf = flags; memset(se, 0, sizeof (*se)); + MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); se->Address.Low = htole32(dm_segs->ds_addr & 0xffffffff); if (sizeof (bus_addr_t) > 4) { - se->Address.High = - htole32(((uint64_t)dm_segs->ds_addr) >> 32); + addr = ((uint64_t)dm_segs->ds_addr) >> 32; + /* SAS1078 36GB limitation WAR */ + if (mpt->is_1078 && + (((uint64_t)dm_segs->ds_addr + + MPI_SGE_LENGTH(se->FlagsLength)) >> + 32) == 9) { + addr |= (1 << 31); + tf |= MPI_SGE_FLAGS_LOCAL_ADDRESS; + } + se->Address.High = htole32(addr); } - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); - tf = flags; - if (seg == this_seg_lim - 1) { + if (seg == this_seg_lim - 1) { tf |= MPI_SGE_FLAGS_LAST_ELEMENT; } if (seg == nseg - 1) { @@ -1622,7 +1631,7 @@ out: bus_dmamap_unload(mpt->buffer_dmat, req->dmap); } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -1747,7 +1756,7 @@ bad: MPT_TGT_STATE(mpt, cmd_req)->req = NULL; } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -1830,8 +1839,6 @@ bad: memset(se, 0,sizeof (*se)); se->Address = htole32(dm_segs->ds_addr); - - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); tf = flags; if (seg == first_lim - 1) { @@ -1858,7 +1865,7 @@ bad: /* * Make up the rest of the data segments out of a chain element - * (contiained in the current request frame) which points to + * (contained in the current request frame) which points to * SIMPLE32 elements in the next request frame, possibly ending * with *another* chain element (if there's more). */ @@ -1894,7 +1901,7 @@ bad: nxt_off += MPT_RQSL(mpt); /* - * Now initialized the chain descriptor. + * Now initialize the chain descriptor. */ memset(ce, 0, sizeof (*ce)); @@ -1946,12 +1953,9 @@ bad: memset(se, 0, sizeof (*se)); se->Address = htole32(dm_segs->ds_addr); - - - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); tf = flags; - if (seg == this_seg_lim - 1) { + if (seg == this_seg_lim - 1) { tf |= MPI_SGE_FLAGS_LAST_ELEMENT; } if (seg == nseg - 1) { @@ -2022,7 +2026,7 @@ out: bus_dmamap_unload(mpt->buffer_dmat, req->dmap); } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -2536,7 +2540,8 @@ mpt_cam_event(struct mpt_softc *mpt, request_t *req, pqf->CurrentDepth = le16toh(pqf->CurrentDepth); mpt_prt(mpt, "QUEUE FULL EVENT: Bus 0x%02x Target 0x%02x Depth " "%d\n", pqf->Bus, pqf->TargetID, pqf->CurrentDepth); - if (mpt->phydisk_sim) { + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + pqf->TargetID) != 0) { sim = mpt->phydisk_sim; } else { sim = mpt->sim; @@ -2568,9 +2573,85 @@ mpt_cam_event(struct mpt_softc *mpt, request_t *req, mpt_prt(mpt, "IR resync update %d completed\n", (data0 >> 16) & 0xff); break; + case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: + { + union ccb *ccb; + struct cam_sim *sim; + struct cam_path *tmppath; + PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE psdsc; + + psdsc = (PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE)msg->Data; + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + psdsc->TargetID) != 0) + sim = mpt->phydisk_sim; + else + sim = mpt->sim; + switch(psdsc->ReasonCode) { + case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: + MPTLOCK_2_CAMLOCK(mpt); + ccb = kmalloc(sizeof(union ccb), M_TEMP, + M_WAITOK | M_ZERO); + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(sim), psdsc->TargetID, + CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + CAMLOCK_2_MPTLOCK(mpt); + mpt_prt(mpt, + "unable to create path for rescan\n"); + kfree(ccb, M_TEMP); + break; + } + xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, + 5/*priority (low)*/); + ccb->ccb_h.func_code = XPT_SCAN_BUS; + ccb->ccb_h.cbfcnp = mpt_cam_rescan_callback; + ccb->crcn.flags = CAM_FLAG_NONE; + xpt_action(ccb); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: + MPTLOCK_2_CAMLOCK(mpt); + if (xpt_create_path(&tmppath, NULL, cam_sim_path(sim), + psdsc->TargetID, CAM_LUN_WILDCARD) != + CAM_REQ_CMP) { + mpt_prt(mpt, + "unable to create path for async event"); + CAMLOCK_2_MPTLOCK(mpt); + break; + } + xpt_async(AC_LOST_DEVICE, tmppath, NULL); + xpt_free_path(tmppath); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET: + case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL: + case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET: + break; + default: + mpt_lprt(mpt, MPT_PRT_WARN, + "SAS device status change: Bus: 0x%02x TargetID: " + "0x%02x ReasonCode: 0x%02x\n", psdsc->Bus, + psdsc->TargetID, psdsc->ReasonCode); + break; + } + break; + } + case MPI_EVENT_SAS_DISCOVERY_ERROR: + { + PTR_EVENT_DATA_DISCOVERY_ERROR pde; + + pde = (PTR_EVENT_DATA_DISCOVERY_ERROR)msg->Data; + pde->DiscoveryStatus = le32toh(pde->DiscoveryStatus); + mpt_lprt(mpt, MPT_PRT_WARN, + "SAS discovery error: Port: 0x%02x Status: 0x%08x\n", + pde->Port, pde->DiscoveryStatus); + break; + } case MPI_EVENT_EVENT_CHANGE: case MPI_EVENT_INTEGRATED_RAID: - case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: + case MPI_EVENT_IR2: + case MPI_EVENT_LOG_ENTRY_ADDED: + case MPI_EVENT_SAS_DISCOVERY: + case MPI_EVENT_SAS_PHY_LINK_STATUS: case MPI_EVENT_SAS_SES: break; default: @@ -2658,7 +2739,7 @@ mpt_scsi_reply_handler(struct mpt_softc *mpt, request_t *req, mpt_prt(mpt, "mpt_scsi_reply_handler: %p:%u complete\n", req, req->serno); } - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); MPTLOCK_2_CAMLOCK(mpt); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); @@ -3038,6 +3119,7 @@ mpt_fc_els_reply_handler(struct mpt_softc *mpt, request_t *req, static void mpt_cam_ioc_reset(struct mpt_softc *mpt, int type) { + /* * The pending list is already run down by * the generic handler. Perform the same @@ -3087,12 +3169,20 @@ mpt_scsi_reply_frame_handler(struct mpt_softc *mpt, request_t *req, if ((sstate & MPI_SCSI_STATE_AUTOSENSE_VALID) != 0 && (ccb->ccb_h.flags & (CAM_SENSE_PHYS | CAM_SENSE_PTR)) == 0) { + uint32_t sense_returned; + ccb->ccb_h.status |= CAM_AUTOSNS_VALID; - ccb->csio.sense_resid = - ccb->csio.sense_len - le32toh(scsi_io_reply->SenseCount); + + sense_returned = le32toh(scsi_io_reply->SenseCount); + if (sense_returned < ccb->csio.sense_len) + ccb->csio.sense_resid = ccb->csio.sense_len - + sense_returned; + else + ccb->csio.sense_resid = 0; + + bzero(&ccb->csio.sense_data, sizeof(&ccb->csio.sense_data)); bcopy(req->sense_vbuf, &ccb->csio.sense_data, - min(ccb->csio.sense_len, - le32toh(scsi_io_reply->SenseCount))); + min(ccb->csio.sense_len, sense_returned)); } if ((sstate & MPI_SCSI_STATE_QUEUE_TAG_REJECTED) != 0) { @@ -3564,7 +3654,7 @@ mpt_action(struct cam_sim *sim, union ccb *ccb) break; } mpt_calc_geometry(ccg, /*extended*/1); - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); break; } case XPT_PATH_INQ: /* Path routing inquiry */ @@ -3966,6 +4056,7 @@ mpt_spawn_recovery_thread(struct mpt_softc *mpt) static void mpt_terminate_recovery_thread(struct mpt_softc *mpt) { + if (mpt->recovery_thread == NULL) { return; } @@ -4369,6 +4460,7 @@ mpt_add_target_commands(struct mpt_softc *mpt) static int mpt_enable_lun(struct mpt_softc *mpt, target_id_t tgt, lun_id_t lun) { + if (tgt == CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { mpt->twildcard = 1; } else if (lun >= MPT_MAX_LUNS) { @@ -4394,6 +4486,7 @@ static int mpt_disable_lun(struct mpt_softc *mpt, target_id_t tgt, lun_id_t lun) { int i; + if (tgt == CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { mpt->twildcard = 0; } else if (lun >= MPT_MAX_LUNS) { @@ -4459,7 +4552,7 @@ mpt_target_start_io(struct mpt_softc *mpt, union ccb *ccb) request_t *req; KASSERT((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE, - ("dxfer_len %u but direction is NONE\n", csio->dxfer_len)); + ("dxfer_len %u but direction is NONE", csio->dxfer_len)); if ((req = mpt_get_request(mpt, FALSE)) == NULL) { if (mpt->outofbeer == 0) { @@ -5278,6 +5371,7 @@ mpt_tgt_dump_tgt_state(struct mpt_softc *mpt, request_t *req) static void mpt_tgt_dump_req_state(struct mpt_softc *mpt, request_t *req) { + mpt_prt(mpt, "req %p:%u index %u (%x) state %x\n", req, req->serno, req->index, req->index, req->state); mpt_tgt_dump_tgt_state(mpt, req); @@ -5362,7 +5456,7 @@ mpt_scsi_tgt_reply_handler(struct mpt_softc *mpt, request_t *req, mpt_set_ccb_status(ccb, CAM_REQ_CMP); ccb->ccb_h.status &= ~CAM_SIM_QUEUED; KASSERT(ccb->ccb_h.status, - ("zero ccb sts at %d\n", __LINE__)); + ("zero ccb sts at %d", __LINE__)); tgt->state = TGT_STATE_IN_CAM; if (mpt->outofbeer) { ccb->ccb_h.status |= CAM_RELEASE_SIMQ; @@ -5424,7 +5518,7 @@ mpt_scsi_tgt_reply_handler(struct mpt_softc *mpt, request_t *req, mpt_set_ccb_status(ccb, CAM_REQ_CMP); ccb->ccb_h.status &= ~CAM_SIM_QUEUED; KASSERT(ccb->ccb_h.status, - ("ZERO ccb sts at %d\n", __LINE__)); + ("ZERO ccb sts at %d", __LINE__)); tgt->ccb = NULL; } else { mpt_lprt(mpt, MPT_PRT_DEBUG, @@ -5496,7 +5590,7 @@ mpt_scsi_tgt_reply_handler(struct mpt_softc *mpt, request_t *req, } tgt = MPT_TGT_STATE(mpt, req); KASSERT(tgt->state == TGT_STATE_LOADING, - ("bad state 0x%x on reply to buffer post\n", tgt->state)); + ("bad state 0x%x on reply to buffer post", tgt->state)); mpt_assign_serno(mpt, req); tgt->state = TGT_STATE_LOADED; break; diff --git a/sys/dev/disk/mpt/mpt_debug.c b/sys/dev/disk/mpt/mpt_debug.c index 2e712d4..34cef47 100644 --- a/sys/dev/disk/mpt/mpt_debug.c +++ b/sys/dev/disk/mpt/mpt_debug.c @@ -62,7 +62,7 @@ * Support from LSI-Logic has also gone a great deal toward making this a * workable subsystem and is gratefully acknowledged. * - * $FreeBSD: src/sys/dev/mpt/mpt_debug.c,v 1.19 2011/04/22 09:59:16 marius Exp $ + * $FreeBSD: src/sys/dev/mpt/mpt_debug.c,v 1.20 2011/07/29 18:35:10 marius Exp $ */ #include @@ -284,6 +284,7 @@ mpt_scsi_state(int code) } return buf; } + static char * mpt_scsi_status(int code) { @@ -297,10 +298,11 @@ mpt_scsi_status(int code) ksnprintf(buf, sizeof buf, "Unknown (0x%08x)", code); return buf; } -static char * + +static const char * mpt_who(int who_init) { - char *who; + const char *who; switch (who_init) { case MPT_DB_INIT_NOONE: who = "No One"; break; @@ -314,10 +316,10 @@ mpt_who(int who_init) return who; } -static char * +static const char * mpt_state(u_int32_t mb) { - char *text; + const char *text; switch (MPT_STATE(mb)) { case MPT_DB_STATE_RESET: text = "Reset"; break; @@ -346,6 +348,7 @@ mpt_scsi_tm_type(int code) void mpt_print_db(u_int32_t mb) { + kprintf("mpt mailbox: (0x%x) State %s WhoInit %s\n", mb, mpt_state(mb), mpt_who(MPT_WHO(mb))); } @@ -356,6 +359,7 @@ mpt_print_db(u_int32_t mb) static void mpt_print_reply_hdr(MSG_DEFAULT_REPLY *msg) { + kprintf("%s Reply @ %p\n", mpt_ioc_function(msg->Function), msg); kprintf("\tIOC Status %s\n", mpt_ioc_status(msg->IOCStatus)); kprintf("\tIOCLogInfo 0x%08x\n", msg->IOCLogInfo); @@ -367,6 +371,7 @@ mpt_print_reply_hdr(MSG_DEFAULT_REPLY *msg) static void mpt_print_init_reply(MSG_IOC_INIT_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); kprintf("\tWhoInit %s\n", mpt_who(msg->WhoInit)); kprintf("\tMaxDevices 0x%02x\n", msg->MaxDevices); @@ -376,6 +381,7 @@ mpt_print_init_reply(MSG_IOC_INIT_REPLY *msg) static void mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); kprintf("\tIOCNumber %d\n", msg->IOCNumber); kprintf("\tMaxChainDepth %d\n", msg->MaxChainDepth); @@ -401,6 +407,7 @@ mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY *msg) static void mpt_print_enable_reply(MSG_PORT_ENABLE_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); kprintf("\tPort: %d\n", msg->PortNumber); } @@ -408,6 +415,7 @@ mpt_print_enable_reply(MSG_PORT_ENABLE_REPLY *msg) static void mpt_print_scsi_io_reply(MSG_SCSI_IO_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); kprintf("\tBus: %d\n", msg->Bus); kprintf("\tTargetID %d\n", msg->TargetID); @@ -419,11 +427,10 @@ mpt_print_scsi_io_reply(MSG_SCSI_IO_REPLY *msg) kprintf("\tResponseInfo 0x%08x\n", msg->ResponseInfo); } - - static void mpt_print_event_notice(MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); kprintf("\tEvent: %s\n", mpt_ioc_event(msg->Event)); kprintf("\tEventContext 0x%04x\n", msg->EventContext); @@ -516,7 +523,7 @@ mpt_print_request_hdr(MSG_REQUEST_HEADER *req) kprintf("\tMsgContext 0x%08x\n", req->MsgContext); } -void +static void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg) { MSG_SCSI_IO_REQUEST local, *msg = &local; @@ -574,6 +581,7 @@ mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg) static void mpt_print_scsi_tmf_request(MSG_SCSI_TASK_MGMT *msg) { + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); kprintf("\tLun 0x%02x\n", msg->LUN[1]); kprintf("\tTaskType %s\n", mpt_scsi_tm_type(msg->TaskType)); @@ -584,6 +592,7 @@ mpt_print_scsi_tmf_request(MSG_SCSI_TASK_MGMT *msg) static void mpt_print_scsi_target_assist_request(PTR_MSG_TARGET_ASSIST_REQUEST msg) { + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); kprintf("\tStatusCode 0x%02x\n", msg->StatusCode); kprintf("\tTargetAssist 0x%02x\n", msg->TargetAssistFlags); @@ -599,6 +608,7 @@ static void mpt_print_scsi_target_status_send_request(MSG_TARGET_STATUS_SEND_REQUEST *msg) { SGE_IO_UNION x; + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); kprintf("\tStatusCode 0x%02x\n", msg->StatusCode); kprintf("\tStatusFlags 0x%02x\n", msg->StatusFlags); @@ -636,7 +646,14 @@ mpt_print_request(void *vreq) } } -int +#if 0 +typedef struct mpt_decode_entry { + char *name; + u_int value; + u_int mask; +} mpt_decode_entry_t; + +static 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) @@ -688,7 +705,7 @@ mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries, return (printed); } -static mpt_decode_entry_t req_state_parse_table[] = { +static const mpt_decode_entry_t req_state_parse_table[] = { { "REQ_FREE", 0x00, 0xff }, { "REQ_ALLOCATED", 0x01, 0x01 }, { "REQ_QUEUED", 0x02, 0x02 }, @@ -697,13 +714,15 @@ static mpt_decode_entry_t req_state_parse_table[] = { { "REQ_NEED_WAKEUP", 0x10, 0x10 } }; -void +static 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); } +#endif #define LAST_SGE ( \ MPI_SGE_FLAGS_END_OF_LIST | \ @@ -804,6 +823,7 @@ mpt_dump_data(struct mpt_softc *mpt, const char *msg, void *addr, int len) { int offset; uint8_t *cp = addr; + mpt_prt(mpt, "%s:", msg); for (offset = 0; offset < len; offset++) { if ((offset & 0xf) == 0) { @@ -819,6 +839,7 @@ mpt_dump_request(struct mpt_softc *mpt, request_t *req) { uint32_t *pReq = req->req_vbuf; int o; + mpt_prt(mpt, "Send Request %d (%jx):", req->index, (uintmax_t) req->req_pbuf); for (o = 0; o < mpt->ioc_facts.RequestFrameSize; o++) { diff --git a/sys/dev/disk/mpt/mpt_pci.c b/sys/dev/disk/mpt/mpt_pci.c index cc241de..cec8dc0 100644 --- a/sys/dev/disk/mpt/mpt_pci.c +++ b/sys/dev/disk/mpt/mpt_pci.c @@ -97,119 +97,53 @@ * 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. * - * $FreeBSD: src/sys/dev/mpt/mpt_pci.c,v 1.61 2011/04/22 09:59:16 marius Exp $ + * $FreeBSD: src/sys/dev/mpt/mpt_pci.c,v 1.70 2012/04/04 20:42:45 marius Exp $ */ #include #include #include -#ifndef PCI_VENDOR_LSI -#define PCI_VENDOR_LSI 0x1000 -#endif - -#ifndef PCI_PRODUCT_LSI_FC909 -#define PCI_PRODUCT_LSI_FC909 0x0620 -#endif - -#ifndef PCI_PRODUCT_LSI_FC909A -#define PCI_PRODUCT_LSI_FC909A 0x0621 -#endif - -#ifndef PCI_PRODUCT_LSI_FC919 -#define PCI_PRODUCT_LSI_FC919 0x0624 -#endif - -#ifndef PCI_PRODUCT_LSI_FC919_LAN -#define PCI_PRODUCT_LSI_FC919_LAN 0x0625 -#endif - -#ifndef PCI_PRODUCT_LSI_FC929 -#define PCI_PRODUCT_LSI_FC929 0x0622 -#endif - -#ifndef PCI_PRODUCT_LSI_FC929_LAN -#define PCI_PRODUCT_LSI_FC929_LAN 0x0623 -#endif - -#ifndef PCI_PRODUCT_LSI_FC929X -#define PCI_PRODUCT_LSI_FC929X 0x0626 -#endif - -#ifndef PCI_PRODUCT_LSI_FC929X_LAN -#define PCI_PRODUCT_LSI_FC929X_LAN 0x0627 -#endif - -#ifndef PCI_PRODUCT_LSI_FC919X -#define PCI_PRODUCT_LSI_FC919X 0x0628 -#endif - -#ifndef PCI_PRODUCT_LSI_FC919X_LAN -#define PCI_PRODUCT_LSI_FC919X_LAN 0x0629 -#endif - -#ifndef PCI_PRODUCT_LSI_FC7X04X -#define PCI_PRODUCT_LSI_FC7X04X 0x0640 -#endif - -#ifndef PCI_PRODUCT_LSI_FC646 -#define PCI_PRODUCT_LSI_FC646 0x0646 -#endif - -#ifndef PCI_PRODUCT_LSI_1030 -#define PCI_PRODUCT_LSI_1030 0x0030 -#endif - -#ifndef PCI_PRODUCT_LSI_1030ZC -#define PCI_PRODUCT_LSI_1030ZC 0x0031 -#endif - -#ifndef PCI_PRODUCT_LSI_SAS1064 -#define PCI_PRODUCT_LSI_SAS1064 0x0050 -#endif - -#ifndef PCI_PRODUCT_LSI_SAS1064A -#define PCI_PRODUCT_LSI_SAS1064A 0x005C -#endif +/* + * XXX it seems no other MPT driver knows about the following chips. + */ -#ifndef PCI_PRODUCT_LSI_SAS1064E -#define PCI_PRODUCT_LSI_SAS1064E 0x0056 +#ifndef MPI_MANUFACTPAGE_DEVICEID_FC909_FB +#define MPI_MANUFACTPAGE_DEVICEID_FC909_FB 0x0620 #endif -#ifndef PCI_PRODUCT_LSI_SAS1066 -#define PCI_PRODUCT_LSI_SAS1066 0x005E +#ifndef MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB +#define MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB 0x0625 #endif -#ifndef PCI_PRODUCT_LSI_SAS1066E -#define PCI_PRODUCT_LSI_SAS1066E 0x005A +#ifndef MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB +#define MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB 0x0623 #endif -#ifndef PCI_PRODUCT_LSI_SAS1068 -#define PCI_PRODUCT_LSI_SAS1068 0x0054 +#ifndef MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB +#define MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB 0x0627 #endif -#ifndef PCI_PRODUCT_LSI_SAS1068A -#define PCI_PRODUCT_LSI_SAS1068A 0x0055 +#ifndef MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB +#define MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB 0x0629 #endif -#ifndef PCI_PRODUCT_LSI_SAS1068E -#define PCI_PRODUCT_LSI_SAS1068E 0x0058 +#ifndef MPI_MANUFACTPAGE_DEVID_SAS1068A_FB +#define MPI_MANUFACTPAGE_DEVID_SAS1068A_FB 0x0055 #endif -#ifndef PCI_PRODUCT_LSI_SAS1078 -#define PCI_PRODUCT_LSI_SAS1078 0x0062 +#ifndef MPI_MANUFACTPAGE_DEVID_SAS1068E_FB +#define MPI_MANUFACTPAGE_DEVID_SAS1068E_FB 0x0059 #endif -#ifndef PCI_PRODUCT_LSI_SAS1078DE -#define PCI_PRODUCT_LSI_SAS1078DE 0x007C +#ifndef MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB +#define MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB 0x007C #endif #ifndef PCIM_CMD_SERRESPEN #define PCIM_CMD_SERRESPEN 0x0100 #endif - - static int mpt_pci_probe(device_t); static int mpt_pci_attach(device_t); static void mpt_free_bus_resources(struct mpt_softc *mpt); @@ -217,7 +151,10 @@ 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); +#if 0 static void mpt_read_config_regs(struct mpt_softc *mpt); +static void mpt_set_config_regs(struct mpt_softc *mpt); +#endif static void mpt_pci_intr(void *); static device_method_t mpt_methods[] = { @@ -240,63 +177,71 @@ MODULE_VERSION(mpt, 1); static int mpt_pci_probe(device_t dev) { - char *desc; + const char *desc; + int rval; - if (pci_get_vendor(dev) != PCI_VENDOR_LSI) { + if (pci_get_vendor(dev) != MPI_MANUFACTPAGE_VENDORID_LSILOGIC) return (ENXIO); - } + rval = BUS_PROBE_DEFAULT; switch (pci_get_device(dev)) { - case PCI_PRODUCT_LSI_FC909: + case MPI_MANUFACTPAGE_DEVICEID_FC909_FB: desc = "LSILogic FC909 FC Adapter"; break; - case PCI_PRODUCT_LSI_FC909A: + case MPI_MANUFACTPAGE_DEVICEID_FC909: desc = "LSILogic FC909A FC Adapter"; break; - case PCI_PRODUCT_LSI_FC919: + case MPI_MANUFACTPAGE_DEVICEID_FC919: desc = "LSILogic FC919 FC Adapter"; break; - case PCI_PRODUCT_LSI_FC919_LAN: + case MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB: desc = "LSILogic FC919 LAN Adapter"; break; - case PCI_PRODUCT_LSI_FC929: + case MPI_MANUFACTPAGE_DEVICEID_FC929: desc = "Dual LSILogic FC929 FC Adapter"; break; - case PCI_PRODUCT_LSI_FC929_LAN: + case MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB: desc = "Dual LSILogic FC929 LAN Adapter"; break; - case PCI_PRODUCT_LSI_FC919X: + case MPI_MANUFACTPAGE_DEVICEID_FC919X: desc = "LSILogic FC919 FC PCI-X Adapter"; break; - case PCI_PRODUCT_LSI_FC919X_LAN: + case MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB: desc = "LSILogic FC919 LAN PCI-X Adapter"; break; - case PCI_PRODUCT_LSI_FC929X: + case MPI_MANUFACTPAGE_DEVICEID_FC929X: desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter"; break; - case PCI_PRODUCT_LSI_FC929X_LAN: + case MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB: desc = "Dual LSILogic FC929X LAN PCI-X Adapter"; break; - case PCI_PRODUCT_LSI_FC646: + case MPI_MANUFACTPAGE_DEVICEID_FC949E: desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter"; break; - case PCI_PRODUCT_LSI_FC7X04X: + case MPI_MANUFACTPAGE_DEVICEID_FC949X: desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-X Adapter"; break; - case PCI_PRODUCT_LSI_1030: - case PCI_PRODUCT_LSI_1030ZC: + case MPI_MANUFACTPAGE_DEVID_53C1030: + case MPI_MANUFACTPAGE_DEVID_53C1030ZC: desc = "LSILogic 1030 Ultra4 Adapter"; break; - case PCI_PRODUCT_LSI_SAS1064: - case PCI_PRODUCT_LSI_SAS1064A: - case PCI_PRODUCT_LSI_SAS1064E: - case PCI_PRODUCT_LSI_SAS1066: - case PCI_PRODUCT_LSI_SAS1066E: - case PCI_PRODUCT_LSI_SAS1068: - case PCI_PRODUCT_LSI_SAS1068A: - case PCI_PRODUCT_LSI_SAS1068E: - case PCI_PRODUCT_LSI_SAS1078: - case PCI_PRODUCT_LSI_SAS1078DE: + case MPI_MANUFACTPAGE_DEVID_SAS1068E_FB: + /* + * Allow mfi(4) to claim this device in case it's in MegaRAID + * mode. + */ + rval = BUS_PROBE_LOW_PRIORITY; + /* FALLTHROUGH */ + case MPI_MANUFACTPAGE_DEVID_SAS1064: + case MPI_MANUFACTPAGE_DEVID_SAS1064A: + case MPI_MANUFACTPAGE_DEVID_SAS1064E: + case MPI_MANUFACTPAGE_DEVID_SAS1066: + case MPI_MANUFACTPAGE_DEVID_SAS1066E: + case MPI_MANUFACTPAGE_DEVID_SAS1068: + case MPI_MANUFACTPAGE_DEVID_SAS1068A_FB: + case MPI_MANUFACTPAGE_DEVID_SAS1068E: + case MPI_MANUFACTPAGE_DEVID_SAS1078: + case MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB: desc = "LSILogic SAS/SATA Adapter"; break; default: @@ -304,7 +249,7 @@ mpt_pci_probe(device_t dev) } device_set_desc(dev, desc); - return (0); + return (rval); } static void @@ -368,7 +313,6 @@ mpt_set_options(struct mpt_softc *mpt) mpt->msi_enable = 0; } - static void mpt_link_peer(struct mpt_softc *mpt) { @@ -402,12 +346,12 @@ mpt_link_peer(struct mpt_softc *mpt) static void mpt_unlink_peer(struct mpt_softc *mpt) { + if (mpt->mpt2) { mpt->mpt2->mpt2 = NULL; } } - static int mpt_pci_attach(device_t dev) { @@ -416,38 +360,36 @@ mpt_pci_attach(device_t dev) uint32_t data, cmd; int mpt_io_bar, mpt_mem_bar; - /* Allocate the softc structure */ mpt = (struct mpt_softc*)device_get_softc(dev); - if (mpt == NULL) { - device_printf(dev, "cannot allocate softc\n"); - return (ENOMEM); - } - memset(mpt, 0, sizeof(struct mpt_softc)); + switch (pci_get_device(dev)) { - case PCI_PRODUCT_LSI_FC909: - case PCI_PRODUCT_LSI_FC909A: - case PCI_PRODUCT_LSI_FC919: - case PCI_PRODUCT_LSI_FC919_LAN: - case PCI_PRODUCT_LSI_FC929: - case PCI_PRODUCT_LSI_FC929_LAN: - case PCI_PRODUCT_LSI_FC929X: - case PCI_PRODUCT_LSI_FC929X_LAN: - case PCI_PRODUCT_LSI_FC919X: - case PCI_PRODUCT_LSI_FC919X_LAN: - case PCI_PRODUCT_LSI_FC646: - case PCI_PRODUCT_LSI_FC7X04X: + case MPI_MANUFACTPAGE_DEVICEID_FC909_FB: + case MPI_MANUFACTPAGE_DEVICEID_FC909: + case MPI_MANUFACTPAGE_DEVICEID_FC919: + case MPI_MANUFACTPAGE_DEVICEID_FC919_LAN_FB: + case MPI_MANUFACTPAGE_DEVICEID_FC929: + case MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB: + case MPI_MANUFACTPAGE_DEVICEID_FC929X: + case MPI_MANUFACTPAGE_DEVICEID_FC929X_LAN_FB: + case MPI_MANUFACTPAGE_DEVICEID_FC919X: + case MPI_MANUFACTPAGE_DEVICEID_FC919X_LAN_FB: + case MPI_MANUFACTPAGE_DEVICEID_FC949E: + case MPI_MANUFACTPAGE_DEVICEID_FC949X: mpt->is_fc = 1; break; - case PCI_PRODUCT_LSI_SAS1064: - case PCI_PRODUCT_LSI_SAS1064A: - case PCI_PRODUCT_LSI_SAS1064E: - case PCI_PRODUCT_LSI_SAS1066: - case PCI_PRODUCT_LSI_SAS1066E: - case PCI_PRODUCT_LSI_SAS1068: - case PCI_PRODUCT_LSI_SAS1068A: - case PCI_PRODUCT_LSI_SAS1068E: - case PCI_PRODUCT_LSI_SAS1078: - case PCI_PRODUCT_LSI_SAS1078DE: + case MPI_MANUFACTPAGE_DEVID_SAS1078: + case MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB: + mpt->is_1078 = 1; + /* FALLTHROUGH */ + case MPI_MANUFACTPAGE_DEVID_SAS1064: + case MPI_MANUFACTPAGE_DEVID_SAS1064A: + case MPI_MANUFACTPAGE_DEVID_SAS1064E: + case MPI_MANUFACTPAGE_DEVID_SAS1066: + case MPI_MANUFACTPAGE_DEVID_SAS1066E: + case MPI_MANUFACTPAGE_DEVID_SAS1068: + case MPI_MANUFACTPAGE_DEVID_SAS1068A_FB: + case MPI_MANUFACTPAGE_DEVID_SAS1068E: + case MPI_MANUFACTPAGE_DEVID_SAS1068E_FB: mpt->is_sas = 1; break; default: @@ -495,12 +437,12 @@ mpt_pci_attach(device_t dev) * If so, link with our partner (around yet) */ switch (pci_get_device(dev)) { - case PCI_PRODUCT_LSI_FC929: - case PCI_PRODUCT_LSI_FC929_LAN: - case PCI_PRODUCT_LSI_FC646: - case PCI_PRODUCT_LSI_FC7X04X: - case PCI_PRODUCT_LSI_1030: - case PCI_PRODUCT_LSI_1030ZC: + case MPI_MANUFACTPAGE_DEVICEID_FC929: + case MPI_MANUFACTPAGE_DEVICEID_FC929_LAN_FB: + case MPI_MANUFACTPAGE_DEVICEID_FC949E: + case MPI_MANUFACTPAGE_DEVICEID_FC949X: + case MPI_MANUFACTPAGE_DEVID_53C1030: + case MPI_MANUFACTPAGE_DEVID_53C1030ZC: mpt_link_peer(mpt); break; default: @@ -526,27 +468,34 @@ mpt_pci_attach(device_t dev) * certain reset operations (but must be disabled for * some cards otherwise). */ - mpt->pci_pio_rid = PCIR_BAR(mpt_io_bar); + mpt_io_bar = PCIR_BAR(mpt_io_bar); mpt->pci_pio_reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &mpt->pci_pio_rid, RF_ACTIVE); + &mpt_io_bar, RF_ACTIVE); if (mpt->pci_pio_reg == NULL) { - device_printf(dev, "unable to map registers in PIO mode\n"); - goto bad; + if (bootverbose) { + device_printf(dev, + "unable to map registers in PIO mode\n"); + } + } else { + mpt->pci_pio_st = rman_get_bustag(mpt->pci_pio_reg); + mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_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_mem_bar = PCIR_BAR(mpt_mem_bar); mpt->pci_reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &mpt->pci_mem_rid, RF_ACTIVE); + &mpt_mem_bar, RF_ACTIVE); if (mpt->pci_reg == NULL) { - device_printf(dev, "Unable to memory map registers.\n"); - if (mpt->is_sas) { + if (bootverbose || mpt->is_sas || mpt->pci_pio_reg == NULL) { + device_printf(dev, + "Unable to memory map registers.\n"); + } + if (mpt->is_sas || mpt->pci_pio_reg == NULL) { device_printf(dev, "Giving Up.\n"); goto bad; } - device_printf(dev, "Falling back to PIO mode.\n"); + if (bootverbose) { + device_printf(dev, "Falling back to PIO mode.\n"); + } mpt->pci_st = mpt->pci_pio_st; mpt->pci_sh = mpt->pci_pio_sh; } else { @@ -581,7 +530,7 @@ mpt_pci_attach(device_t dev) } #endif mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, - RF_ACTIVE | RF_SHAREABLE); + RF_ACTIVE | (mpt->pci_msi_count ? 0 : RF_SHAREABLE)); if (mpt->pci_irq == NULL) { device_printf(dev, "could not allocate interrupt\n"); goto bad; @@ -600,12 +549,12 @@ mpt_pci_attach(device_t dev) } /* Allocate dma memory */ -/* XXX JGibbs -Should really be done based on IOCFacts. */ if (mpt_dma_mem_alloc(mpt)) { mpt_prt(mpt, "Could not allocate DMA memory\n"); goto bad; } +#if 0 /* * Save the PCI config register values * @@ -617,6 +566,7 @@ mpt_pci_attach(device_t dev) */ mpt_read_config_regs(mpt); +#endif /* * Disable PIO until we need it @@ -664,15 +614,16 @@ bad: static void mpt_free_bus_resources(struct mpt_softc *mpt) { + if (mpt->ih) { bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih); - mpt->ih = 0; + mpt->ih = NULL; } if (mpt->pci_irq) { bus_release_resource(mpt->dev, SYS_RES_IRQ, - mpt->pci_msi_count ? 1 : 0, mpt->pci_irq); - mpt->pci_irq = 0; + rman_get_rid(mpt->pci_irq), mpt->pci_irq); + mpt->pci_irq = NULL; } if (mpt->pci_msi_count) { @@ -681,19 +632,18 @@ mpt_free_bus_resources(struct mpt_softc *mpt) } 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; + bus_release_resource(mpt->dev, SYS_RES_IOPORT, + rman_get_rid(mpt->pci_pio_reg), mpt->pci_pio_reg); + mpt->pci_pio_reg = NULL; } if (mpt->pci_reg) { - bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_mem_rid, - mpt->pci_reg); - mpt->pci_reg = 0; + bus_release_resource(mpt->dev, SYS_RES_MEMORY, + rman_get_rid(mpt->pci_reg), mpt->pci_reg); + mpt->pci_reg = NULL; } MPT_LOCK_DESTROY(mpt); } - /* * Disconnect ourselves from the system. */ @@ -718,7 +668,6 @@ mpt_pci_detach(device_t dev) return(0); } - /* * Disable the hardware */ @@ -805,8 +754,6 @@ mpt_dma_mem_alloc(struct mpt_softc *mpt) return (0); } - - /* Deallocate memory that was allocated by mpt_dma_mem_alloc */ static void @@ -823,18 +770,17 @@ mpt_dma_mem_free(struct mpt_softc *mpt) bus_dmamem_free(mpt->reply_dmat, mpt->reply, mpt->reply_dmap); bus_dma_tag_destroy(mpt->reply_dmat); bus_dma_tag_destroy(mpt->parent_dmat); - mpt->reply_dmat = 0; + mpt->reply_dmat = NULL; kfree(mpt->request_pool, M_DEVBUF); - mpt->request_pool = 0; - + mpt->request_pool = NULL; } - - +#if 0 /* Reads modifiable (via PCI transactions) config registers */ static void 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 = pci_read_config(mpt->dev, PCIR_CACHELNSZ, 2); @@ -849,7 +795,7 @@ mpt_read_config_regs(struct mpt_softc *mpt) } /* Sets modifiable config registers */ -void +static void mpt_set_config_regs(struct mpt_softc *mpt) { uint32_t val; @@ -888,6 +834,7 @@ mpt_set_config_regs(struct mpt_softc *mpt) pci_write_config(mpt->dev, PCIR_INTLINE, mpt->pci_cfg.IntLine, 1); pci_write_config(mpt->dev, 0x44, mpt->pci_cfg.PMCSR, 4); } +#endif static void mpt_pci_intr(void *arg) diff --git a/sys/dev/disk/mpt/mpt_raid.c b/sys/dev/disk/mpt/mpt_raid.c index e44b606..4c6a56a 100644 --- a/sys/dev/disk/mpt/mpt_raid.c +++ b/sys/dev/disk/mpt/mpt_raid.c @@ -39,7 +39,7 @@ * Support from LSI-Logic has also gone a great deal toward making this a * workable subsystem and is gratefully acknowledged. * - * $FreeBSD: src/sys/dev/mpt/mpt_raid.c,v 1.28 2011/01/12 19:53:56 mdf Exp $ + * $FreeBSD: src/sys/dev/mpt/mpt_raid.c,v 1.30 2011/07/29 18:38:31 marius Exp $ */ #include @@ -77,7 +77,6 @@ struct mpt_raid_action_result #define REQ_IOCSTATUS(req) ((req)->IOCStatus & MPI_IOCSTATUS_MASK) - static mpt_probe_handler_t mpt_raid_probe; static mpt_attach_handler_t mpt_raid_attach; static mpt_enable_handler_t mpt_raid_enable; @@ -117,9 +116,25 @@ static void mpt_adjust_queue_depth(struct mpt_softc *, struct mpt_raid_volume *, struct cam_path *); static void mpt_raid_sysctl_attach(struct mpt_softc *); +static const char *mpt_vol_type(struct mpt_raid_volume *vol); +static const char *mpt_vol_state(struct mpt_raid_volume *vol); +static const char *mpt_disk_state(struct mpt_raid_disk *disk); +static void mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, + const char *fmt, ...); +static void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk, + const char *fmt, ...); + +static 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); + +static int mpt_refresh_raid_data(struct mpt_softc *mpt); +static void mpt_schedule_raid_refresh(struct mpt_softc *mpt); + static uint32_t raid_handler_id = MPT_HANDLER_ID_NONE; -const char * +static const char * mpt_vol_type(struct mpt_raid_volume *vol) { switch (vol->config_page->VolumeType) { @@ -134,7 +149,7 @@ mpt_vol_type(struct mpt_raid_volume *vol) } } -const char * +static const char * mpt_vol_state(struct mpt_raid_volume *vol) { switch (vol->config_page->VolumeStatus.State) { @@ -149,7 +164,7 @@ mpt_vol_state(struct mpt_raid_volume *vol) } } -const char * +static const char * mpt_disk_state(struct mpt_raid_disk *disk) { switch (disk->config_page.PhysDiskStatus.State) { @@ -174,7 +189,7 @@ mpt_disk_state(struct mpt_raid_disk *disk) } } -void +static void mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, const char *fmt, ...) { @@ -188,7 +203,7 @@ mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, __va_end(ap); } -void +static void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk, const char *fmt, ...) { @@ -246,16 +261,17 @@ mpt_raid_async(void *callback_arg, u_int32_t code, } } -int +static int mpt_raid_probe(struct mpt_softc *mpt) { + if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) { return (ENODEV); } return (0); } -int +static int mpt_raid_attach(struct mpt_softc *mpt) { struct ccb_setasync csa; @@ -299,13 +315,14 @@ cleanup: return (error); } -int +static int mpt_raid_enable(struct mpt_softc *mpt) { + return (0); } -void +static void mpt_raid_detach(struct mpt_softc *mpt) { struct ccb_setasync csa; @@ -330,6 +347,7 @@ mpt_raid_detach(struct mpt_softc *mpt) static void mpt_raid_ioc_reset(struct mpt_softc *mpt, int type) { + /* Nothing to do yet. */ } @@ -562,7 +580,7 @@ mpt_raid_reply_frame_handler(struct mpt_softc *mpt, request_t *req, /* * Utiltity routine to perform a RAID action command; */ -int +static 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, @@ -726,6 +744,7 @@ mpt_raid_thread(void *arg) static void mpt_raid_quiesce_timeout(void *arg) { + /* Complete the CCB with error */ /* COWWWW */ } @@ -783,7 +802,7 @@ mpt_raid_quiesce_disk(struct mpt_softc *mpt, struct mpt_raid_disk *mpt_disk, /* XXX Ignores that there may be multiple busses/IOCs involved. */ cam_status -mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, u_int *tgt) +mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, target_id_t *tgt) { struct mpt_raid_disk *mpt_disk; @@ -800,7 +819,26 @@ mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, u_int *tgt) /* XXX Ignores that there may be multiple busses/IOCs involved. */ int -mpt_is_raid_volume(struct mpt_softc *mpt, int tgt) +mpt_is_raid_member(struct mpt_softc *mpt, target_id_t tgt) +{ + struct mpt_raid_disk *mpt_disk; + int i; + + if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) + return (0); + for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { + mpt_disk = &mpt->raid_disks[i]; + if ((mpt_disk->flags & MPT_RDF_ACTIVE) != 0 && + mpt_disk->config_page.PhysDiskID == tgt) + return (1); + } + return (0); + +} + +/* XXX Ignores that there may be multiple busses/IOCs involved. */ +int +mpt_is_raid_volume(struct mpt_softc *mpt, target_id_t tgt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; CONFIG_PAGE_IOC_2_RAID_VOL *ioc_last_vol; @@ -1312,7 +1350,7 @@ mpt_refresh_raid_vol(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol, * be updated by our event handler. Interesting changes are displayed * to the console. */ -int +static int mpt_refresh_raid_data(struct mpt_softc *mpt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; @@ -1560,9 +1598,10 @@ mpt_raid_timer(void *arg) mpt_raid_wakeup(mpt); } -void +static void mpt_schedule_raid_refresh(struct mpt_softc *mpt) { + callout_reset(&mpt->raid_timer, MPT_RAID_SYNC_REPORT_INTERVAL, mpt_raid_timer, mpt); } @@ -1713,7 +1752,8 @@ mpt_raid_set_vol_mwce(struct mpt_softc *mpt, mpt_raid_mwce_t mwce) MPT_UNLOCK(mpt); return (0); } -const char *mpt_vol_mwce_strs[] = + +static const char *mpt_vol_mwce_strs[] = { "On", "Off", diff --git a/sys/dev/disk/mpt/mpt_raid.h b/sys/dev/disk/mpt/mpt_raid.h index 3cf3cb1..14485a2 100644 --- a/sys/dev/disk/mpt/mpt_raid.h +++ b/sys/dev/disk/mpt/mpt_raid.h @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/mpt/mpt_raid.h,v 1.7 2006/07/16 03:31:01 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpt_raid.h,v 1.9 2011/07/29 18:38:31 marius Exp $ */ /*- * Definitions for the integrated RAID features LSI MPT Fusion adapters. * @@ -53,31 +53,14 @@ typedef enum { 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, ...) -__printflike(3, 4); -void -mpt_disk_prt(struct mpt_softc *, struct mpt_raid_disk *, const char *, ...) -__printflike(3, 4); - -int -mpt_issue_raid_req(struct mpt_softc *, struct mpt_raid_volume *, - struct mpt_raid_disk *, request_t *, u_int, uint32_t, bus_addr_t, - bus_size_t, int, int); - -cam_status -mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); -int mpt_is_raid_volume(struct mpt_softc *, int); +cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); +int mpt_is_raid_member(struct mpt_softc *, target_id_t); +int mpt_is_raid_volume(struct mpt_softc *, target_id_t); #if 0 cam_status mpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *); #endif -int mpt_refresh_raid_data(struct mpt_softc *); -void mpt_schedule_raid_refresh(struct mpt_softc *); void mpt_raid_free_mem(struct mpt_softc *); static __inline void diff --git a/sys/dev/disk/mpt/mpt_reg.h b/sys/dev/disk/mpt/mpt_reg.h index 6476c60..3537d13 100644 --- a/sys/dev/disk/mpt/mpt_reg.h +++ b/sys/dev/disk/mpt/mpt_reg.h @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/mpt/mpt_reg.h,v 1.4 2006/05/29 20:34:28 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/mpt/mpt_reg.h,v 1.5 2012/02/11 12:03:44 marius Exp $ */ /*- * Generic defines for LSI '909 FC adapters. * FreeBSD Version. @@ -77,6 +77,7 @@ #define MPT_OFFSET_REPLY_Q 0x44 #define MPT_OFFSET_HOST_INDEX 0x50 #define MPT_OFFSET_FUBAR 0x90 +#define MPT_OFFSET_RESET_1078 0x10fc /* Bit Maps for DOORBELL register */ enum DB_STATE_BITS { diff --git a/sys/dev/disk/mpt/mpt_user.c b/sys/dev/disk/mpt/mpt_user.c index ebef580..4feef22 100644 --- a/sys/dev/disk/mpt/mpt_user.c +++ b/sys/dev/disk/mpt/mpt_user.c @@ -29,7 +29,7 @@ * * LSI MPT-Fusion Host Adapter FreeBSD userland interface * - * $FreeBSD: src/sys/dev/mpt/mpt_user.c,v 1.5 2011/03/06 12:48:15 marius Exp $ + * $FreeBSD: src/sys/dev/mpt/mpt_user.c,v 1.6 2011/07/29 18:35:10 marius Exp $ */ #include @@ -91,7 +91,7 @@ static MALLOC_DEFINE(M_MPTUSER, "mpt_user", "Buffers for mpt(4) ioctls"); static uint32_t user_handler_id = MPT_HANDLER_ID_NONE; -int +static int mpt_user_probe(struct mpt_softc *mpt) { @@ -99,7 +99,7 @@ mpt_user_probe(struct mpt_softc *mpt) return (0); } -int +static int mpt_user_attach(struct mpt_softc *mpt) { mpt_handler_t handler; @@ -128,19 +128,20 @@ mpt_user_attach(struct mpt_softc *mpt) return (0); } -int +static int mpt_user_enable(struct mpt_softc *mpt) { return (0); } -void +static void mpt_user_ready(struct mpt_softc *mpt) { + } -int +static int mpt_user_event(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { @@ -149,12 +150,13 @@ mpt_user_event(struct mpt_softc *mpt, request_t *req, return (0); } -void +static void mpt_user_reset(struct mpt_softc *mpt, int type) { + } -void +static void mpt_user_detach(struct mpt_softc *mpt) { mpt_handler_t handler; -- 1.7.7.2