aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-07-03 10:41:12 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-07-03 10:41:12 -0400
commitc4e00fac42f268ed0a547cdd1d12bb8399864040 (patch)
tree1a54d87be2066c49b71a03764fcb4fc7f9c68c41 /drivers/message/fusion
parent29454dde27d8e340bb1987bad9aa504af7081eba (diff)
parentd6b0c53723753fc0cfda63f56735b225c43e1e9a (diff)
Merge ../scsi-misc-2.6
Conflicts: drivers/scsi/nsp32.c drivers/scsi/pcmcia/nsp_cs.c Removal of randomness flag conflicts with SA_ -> IRQF_ global replacement. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/Makefile5
-rw-r--r--drivers/message/fusion/lsi/fc_log.h89
-rw-r--r--drivers/message/fusion/lsi/mpi.h5
-rw-r--r--drivers/message/fusion/lsi/mpi_cnfg.h158
-rw-r--r--drivers/message/fusion/lsi/mpi_history.txt76
-rw-r--r--drivers/message/fusion/lsi/mpi_init.h4
-rw-r--r--drivers/message/fusion/lsi/mpi_ioc.h154
-rw-r--r--drivers/message/fusion/lsi/mpi_log_sas.h82
-rw-r--r--drivers/message/fusion/lsi/mpi_sas.h13
-rw-r--r--drivers/message/fusion/lsi/mpi_targ.h5
-rw-r--r--drivers/message/fusion/mptbase.c75
-rw-r--r--drivers/message/fusion/mptbase.h19
-rw-r--r--drivers/message/fusion/mptfc.c16
-rw-r--r--drivers/message/fusion/mptsas.c996
-rw-r--r--drivers/message/fusion/mptspi.c4
15 files changed, 1211 insertions, 490 deletions
diff --git a/drivers/message/fusion/Makefile b/drivers/message/fusion/Makefile
index 51740b346224..b114236f4395 100644
--- a/drivers/message/fusion/Makefile
+++ b/drivers/message/fusion/Makefile
@@ -33,6 +33,11 @@
33# For mptfc: 33# For mptfc:
34#CFLAGS_mptfc.o += -DMPT_DEBUG_FC 34#CFLAGS_mptfc.o += -DMPT_DEBUG_FC
35 35
36# For mptsas:
37#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS
38#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS_WIDE
39
40
36#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC 41#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC
37 42
38obj-$(CONFIG_FUSION_SPI) += mptbase.o mptscsih.o mptspi.o 43obj-$(CONFIG_FUSION_SPI) += mptbase.o mptscsih.o mptspi.o
diff --git a/drivers/message/fusion/lsi/fc_log.h b/drivers/message/fusion/lsi/fc_log.h
deleted file mode 100644
index dc98d46f9071..000000000000
--- a/drivers/message/fusion/lsi/fc_log.h
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * Copyright (c) 2000-2001 LSI Logic Corporation. All rights reserved.
3 *
4 * NAME: fc_log.h
5 * SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips
6 * DESCRIPTION: Contains the enumerated list of values that may be returned
7 * in the IOCLogInfo field of a MPI Default Reply Message.
8 *
9 * CREATION DATE: 6/02/2000
10 * ID: $Id: fc_log.h,v 4.6 2001/07/26 14:41:33 sschremm Exp $
11 */
12
13
14/*
15 * MpiIocLogInfo_t enum
16 *
17 * These 32 bit values are used in the IOCLogInfo field of the MPI reply
18 * messages.
19 * The value is 0xabcccccc where
20 * a = The type of log info as per the MPI spec. Since these codes are
21 * all for Fibre Channel this value will always be 2.
22 * b = Specifies a subclass of the firmware where
23 * 0 = FCP Initiator
24 * 1 = FCP Target
25 * 2 = LAN
26 * 3 = MPI Message Layer
27 * 4 = FC Link
28 * 5 = Context Manager
29 * 6 = Invalid Field Offset
30 * 7 = State Change Info
31 * all others are reserved for future use
32 * c = A specific value within the subclass.
33 *
34 * NOTE: Any new values should be added to the end of each subclass so that the
35 * codes remain consistent across firmware releases.
36 */
37typedef enum _MpiIocLogInfoFc
38{
39 MPI_IOCLOGINFO_FC_INIT_BASE = 0x20000000,
40 MPI_IOCLOGINFO_FC_INIT_ERROR_OUT_OF_ORDER_FRAME = 0x20000001, /* received an out of order frame - unsupported */
41 MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_START_OF_FRAME = 0x20000002, /* Bad Rx Frame, bad start of frame primative */
42 MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_END_OF_FRAME = 0x20000003, /* Bad Rx Frame, bad end of frame primative */
43 MPI_IOCLOGINFO_FC_INIT_ERROR_OVER_RUN = 0x20000004, /* Bad Rx Frame, overrun */
44 MPI_IOCLOGINFO_FC_INIT_ERROR_RX_OTHER = 0x20000005, /* Other errors caught by IOC which require retries */
45 MPI_IOCLOGINFO_FC_INIT_ERROR_SUBPROC_DEAD = 0x20000006, /* Main processor could not initialize sub-processor */
46 MPI_IOCLOGINFO_FC_INIT_ERROR_RX_OVERRUN = 0x20000007, /* Scatter Gather overrun */
47 MPI_IOCLOGINFO_FC_INIT_ERROR_RX_BAD_STATUS = 0x20000008, /* Receiver detected context mismatch via invalid header */
48 MPI_IOCLOGINFO_FC_INIT_ERROR_RX_UNEXPECTED_FRAME= 0x20000009, /* CtxMgr detected unsupported frame type */
49 MPI_IOCLOGINFO_FC_INIT_ERROR_LINK_FAILURE = 0x2000000A, /* Link failure occurred */
50 MPI_IOCLOGINFO_FC_INIT_ERROR_TX_TIMEOUT = 0x2000000B, /* Transmitter timeout error */
51
52 MPI_IOCLOGINFO_FC_TARGET_BASE = 0x21000000,
53 MPI_IOCLOGINFO_FC_TARGET_NO_PDISC = 0x21000001, /* not sent because we are waiting for a PDISC from the initiator */
54 MPI_IOCLOGINFO_FC_TARGET_NO_LOGIN = 0x21000002, /* not sent because we are not logged in to the remote node */
55 MPI_IOCLOGINFO_FC_TARGET_DOAR_KILLED_BY_LIP = 0x21000003, /* Data Out, Auto Response, not sent due to a LIP */
56 MPI_IOCLOGINFO_FC_TARGET_DIAR_KILLED_BY_LIP = 0x21000004, /* Data In, Auto Response, not sent due to a LIP */
57 MPI_IOCLOGINFO_FC_TARGET_DIAR_MISSING_DATA = 0x21000005, /* Data In, Auto Response, missing data frames */
58 MPI_IOCLOGINFO_FC_TARGET_DONR_KILLED_BY_LIP = 0x21000006, /* Data Out, No Response, not sent due to a LIP */
59 MPI_IOCLOGINFO_FC_TARGET_WRSP_KILLED_BY_LIP = 0x21000007, /* Auto-response after a write not sent due to a LIP */
60 MPI_IOCLOGINFO_FC_TARGET_DINR_KILLED_BY_LIP = 0x21000008, /* Data In, No Response, not completed due to a LIP */
61 MPI_IOCLOGINFO_FC_TARGET_DINR_MISSING_DATA = 0x21000009, /* Data In, No Response, missing data frames */
62 MPI_IOCLOGINFO_FC_TARGET_MRSP_KILLED_BY_LIP = 0x2100000a, /* Manual Response not sent due to a LIP */
63 MPI_IOCLOGINFO_FC_TARGET_NO_CLASS_3 = 0x2100000b, /* not sent because remote node does not support Class 3 */
64 MPI_IOCLOGINFO_FC_TARGET_LOGIN_NOT_VALID = 0x2100000c, /* not sent because login to remote node not validated */
65 MPI_IOCLOGINFO_FC_TARGET_FROM_OUTBOUND = 0x2100000e, /* cleared from the outbound queue after a logout */
66 MPI_IOCLOGINFO_FC_TARGET_WAITING_FOR_DATA_IN = 0x2100000f, /* cleared waiting for data after a logout */
67
68 MPI_IOCLOGINFO_FC_LAN_BASE = 0x22000000,
69 MPI_IOCLOGINFO_FC_LAN_TRANS_SGL_MISSING = 0x22000001, /* Transaction Context Sgl Missing */
70 MPI_IOCLOGINFO_FC_LAN_TRANS_WRONG_PLACE = 0x22000002, /* Transaction Context found before an EOB */
71 MPI_IOCLOGINFO_FC_LAN_TRANS_RES_BITS_SET = 0x22000003, /* Transaction Context value has reserved bits set */
72 MPI_IOCLOGINFO_FC_LAN_WRONG_SGL_FLAG = 0x22000004, /* Invalid SGL Flags */
73
74 MPI_IOCLOGINFO_FC_MSG_BASE = 0x23000000,
75
76 MPI_IOCLOGINFO_FC_LINK_BASE = 0x24000000,
77 MPI_IOCLOGINFO_FC_LINK_LOOP_INIT_TIMEOUT = 0x24000001, /* Loop initialization timed out */
78 MPI_IOCLOGINFO_FC_LINK_ALREADY_INITIALIZED = 0x24000002, /* Another system controller already initialized the loop */
79 MPI_IOCLOGINFO_FC_LINK_LINK_NOT_ESTABLISHED = 0x24000003, /* Not synchronized to signal or still negotiating (possible cable problem) */
80 MPI_IOCLOGINFO_FC_LINK_CRC_ERROR = 0x24000004, /* CRC check detected error on received frame */
81
82 MPI_IOCLOGINFO_FC_CTX_BASE = 0x25000000,
83
84 MPI_IOCLOGINFO_FC_INVALID_FIELD_BYTE_OFFSET = 0x26000000, /* The lower 24 bits give the byte offset of the field in the request message that is invalid */
85 MPI_IOCLOGINFO_FC_INVALID_FIELD_MAX_OFFSET = 0x26ffffff,
86
87 MPI_IOCLOGINFO_FC_STATE_CHANGE = 0x27000000 /* The lower 24 bits give additional information concerning state change */
88
89} MpiIocLogInfoFc_t;
diff --git a/drivers/message/fusion/lsi/mpi.h b/drivers/message/fusion/lsi/mpi.h
index 02cdc840a06b..81ad77622dac 100644
--- a/drivers/message/fusion/lsi/mpi.h
+++ b/drivers/message/fusion/lsi/mpi.h
@@ -6,7 +6,7 @@
6 * Title: MPI Message independent structures and definitions 6 * Title: MPI Message independent structures and definitions
7 * Creation Date: July 27, 2000 7 * Creation Date: July 27, 2000
8 * 8 *
9 * mpi.h Version: 01.05.10 9 * mpi.h Version: 01.05.11
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -76,6 +76,7 @@
76 * Added EEDP IOCStatus codes. 76 * Added EEDP IOCStatus codes.
77 * 08-03-05 01.05.09 Bumped MPI_HEADER_VERSION_UNIT. 77 * 08-03-05 01.05.09 Bumped MPI_HEADER_VERSION_UNIT.
78 * 08-30-05 01.05.10 Added 2 new IOCStatus codes for Target. 78 * 08-30-05 01.05.10 Added 2 new IOCStatus codes for Target.
79 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT.
79 * -------------------------------------------------------------------------- 80 * --------------------------------------------------------------------------
80 */ 81 */
81 82
@@ -106,7 +107,7 @@
106/* Note: The major versions of 0xe0 through 0xff are reserved */ 107/* Note: The major versions of 0xe0 through 0xff are reserved */
107 108
108/* versioning for this MPI header set */ 109/* versioning for this MPI header set */
109#define MPI_HEADER_VERSION_UNIT (0x0C) 110#define MPI_HEADER_VERSION_UNIT (0x0D)
110#define MPI_HEADER_VERSION_DEV (0x00) 111#define MPI_HEADER_VERSION_DEV (0x00)
111#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) 112#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00)
112#define MPI_HEADER_VERSION_UNIT_SHIFT (8) 113#define MPI_HEADER_VERSION_UNIT_SHIFT (8)
diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h b/drivers/message/fusion/lsi/mpi_cnfg.h
index b1becec27e1b..47e13e360c10 100644
--- a/drivers/message/fusion/lsi/mpi_cnfg.h
+++ b/drivers/message/fusion/lsi/mpi_cnfg.h
@@ -6,7 +6,7 @@
6 * Title: MPI Config message, structures, and Pages 6 * Title: MPI Config message, structures, and Pages
7 * Creation Date: July 27, 2000 7 * Creation Date: July 27, 2000
8 * 8 *
9 * mpi_cnfg.h Version: 01.05.11 9 * mpi_cnfg.h Version: 01.05.12
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -266,6 +266,16 @@
266 * Added postpone SATA Init bit to SAS IO Unit Page 1 266 * Added postpone SATA Init bit to SAS IO Unit Page 1
267 * ControlFlags. 267 * ControlFlags.
268 * Changed LogEntry format for Log Page 0. 268 * Changed LogEntry format for Log Page 0.
269 * 03-27-06 01.05.12 Added two new Flags defines for Manufacturing Page 4.
270 * Added Manufacturing Page 7.
271 * Added MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING.
272 * Added IOC Page 6.
273 * Added PrevBootDeviceForm field to CONFIG_PAGE_BIOS_2.
274 * Added MaxLBAHigh field to RAID Volume Page 0.
275 * Added Nvdata version fields to SAS IO Unit Page 0.
276 * Added AdditionalControlFlags, MaxTargetPortConnectTime,
277 * ReportDeviceMissingDelay, and IODeviceMissingDelay
278 * fields to SAS IO Unit Page 1.
269 * -------------------------------------------------------------------------- 279 * --------------------------------------------------------------------------
270 */ 280 */
271 281
@@ -631,9 +641,11 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_4
631} CONFIG_PAGE_MANUFACTURING_4, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_4, 641} CONFIG_PAGE_MANUFACTURING_4, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_4,
632 ManufacturingPage4_t, MPI_POINTER pManufacturingPage4_t; 642 ManufacturingPage4_t, MPI_POINTER pManufacturingPage4_t;
633 643
634#define MPI_MANUFACTURING4_PAGEVERSION (0x03) 644#define MPI_MANUFACTURING4_PAGEVERSION (0x04)
635 645
636/* defines for the Flags field */ 646/* defines for the Flags field */
647#define MPI_MANPAGE4_FORCE_BAD_BLOCK_TABLE (0x80)
648#define MPI_MANPAGE4_FORCE_OFFLINE_FAILOVER (0x40)
637#define MPI_MANPAGE4_IME_DISABLE (0x20) 649#define MPI_MANPAGE4_IME_DISABLE (0x20)
638#define MPI_MANPAGE4_IM_DISABLE (0x10) 650#define MPI_MANPAGE4_IM_DISABLE (0x10)
639#define MPI_MANPAGE4_IS_DISABLE (0x08) 651#define MPI_MANPAGE4_IS_DISABLE (0x08)
@@ -668,6 +680,66 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_6
668#define MPI_MANUFACTURING6_PAGEVERSION (0x00) 680#define MPI_MANUFACTURING6_PAGEVERSION (0x00)
669 681
670 682
683typedef struct _MPI_MANPAGE7_CONNECTOR_INFO
684{
685 U32 Pinout; /* 00h */
686 U8 Connector[16]; /* 04h */
687 U8 Location; /* 14h */
688 U8 Reserved1; /* 15h */
689 U16 Slot; /* 16h */
690 U32 Reserved2; /* 18h */
691} MPI_MANPAGE7_CONNECTOR_INFO, MPI_POINTER PTR_MPI_MANPAGE7_CONNECTOR_INFO,
692 MpiManPage7ConnectorInfo_t, MPI_POINTER pMpiManPage7ConnectorInfo_t;
693
694/* defines for the Pinout field */
695#define MPI_MANPAGE7_PINOUT_SFF_8484_L4 (0x00080000)
696#define MPI_MANPAGE7_PINOUT_SFF_8484_L3 (0x00040000)
697#define MPI_MANPAGE7_PINOUT_SFF_8484_L2 (0x00020000)
698#define MPI_MANPAGE7_PINOUT_SFF_8484_L1 (0x00010000)
699#define MPI_MANPAGE7_PINOUT_SFF_8470_L4 (0x00000800)
700#define MPI_MANPAGE7_PINOUT_SFF_8470_L3 (0x00000400)
701#define MPI_MANPAGE7_PINOUT_SFF_8470_L2 (0x00000200)
702#define MPI_MANPAGE7_PINOUT_SFF_8470_L1 (0x00000100)
703#define MPI_MANPAGE7_PINOUT_SFF_8482 (0x00000002)
704#define MPI_MANPAGE7_PINOUT_CONNECTION_UNKNOWN (0x00000001)
705
706/* defines for the Location field */
707#define MPI_MANPAGE7_LOCATION_UNKNOWN (0x01)
708#define MPI_MANPAGE7_LOCATION_INTERNAL (0x02)
709#define MPI_MANPAGE7_LOCATION_EXTERNAL (0x04)
710#define MPI_MANPAGE7_LOCATION_SWITCHABLE (0x08)
711#define MPI_MANPAGE7_LOCATION_AUTO (0x10)
712#define MPI_MANPAGE7_LOCATION_NOT_PRESENT (0x20)
713#define MPI_MANPAGE7_LOCATION_NOT_CONNECTED (0x80)
714
715/*
716 * Host code (drivers, BIOS, utilities, etc.) should leave this define set to
717 * one and check NumPhys at runtime.
718 */
719#ifndef MPI_MANPAGE7_CONNECTOR_INFO_MAX
720#define MPI_MANPAGE7_CONNECTOR_INFO_MAX (1)
721#endif
722
723typedef struct _CONFIG_PAGE_MANUFACTURING_7
724{
725 CONFIG_PAGE_HEADER Header; /* 00h */
726 U32 Reserved1; /* 04h */
727 U32 Reserved2; /* 08h */
728 U32 Flags; /* 0Ch */
729 U8 EnclosureName[16]; /* 10h */
730 U8 NumPhys; /* 20h */
731 U8 Reserved3; /* 21h */
732 U16 Reserved4; /* 22h */
733 MPI_MANPAGE7_CONNECTOR_INFO ConnectorInfo[MPI_MANPAGE7_CONNECTOR_INFO_MAX]; /* 24h */
734} CONFIG_PAGE_MANUFACTURING_7, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_7,
735 ManufacturingPage7_t, MPI_POINTER pManufacturingPage7_t;
736
737#define MPI_MANUFACTURING7_PAGEVERSION (0x00)
738
739/* defines for the Flags field */
740#define MPI_MANPAGE7_FLAG_USE_SLOT_INFO (0x00000001)
741
742
671/**************************************************************************** 743/****************************************************************************
672* IO Unit Config Pages 744* IO Unit Config Pages
673****************************************************************************/ 745****************************************************************************/
@@ -867,7 +939,7 @@ typedef struct _CONFIG_PAGE_IOC_2
867} CONFIG_PAGE_IOC_2, MPI_POINTER PTR_CONFIG_PAGE_IOC_2, 939} CONFIG_PAGE_IOC_2, MPI_POINTER PTR_CONFIG_PAGE_IOC_2,
868 IOCPage2_t, MPI_POINTER pIOCPage2_t; 940 IOCPage2_t, MPI_POINTER pIOCPage2_t;
869 941
870#define MPI_IOCPAGE2_PAGEVERSION (0x03) 942#define MPI_IOCPAGE2_PAGEVERSION (0x04)
871 943
872/* IOC Page 2 Capabilities flags */ 944/* IOC Page 2 Capabilities flags */
873 945
@@ -878,6 +950,7 @@ typedef struct _CONFIG_PAGE_IOC_2
878#define MPI_IOCPAGE2_CAP_FLAGS_RAID_6_SUPPORT (0x00000010) 950#define MPI_IOCPAGE2_CAP_FLAGS_RAID_6_SUPPORT (0x00000010)
879#define MPI_IOCPAGE2_CAP_FLAGS_RAID_10_SUPPORT (0x00000020) 951#define MPI_IOCPAGE2_CAP_FLAGS_RAID_10_SUPPORT (0x00000020)
880#define MPI_IOCPAGE2_CAP_FLAGS_RAID_50_SUPPORT (0x00000040) 952#define MPI_IOCPAGE2_CAP_FLAGS_RAID_50_SUPPORT (0x00000040)
953#define MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING (0x10000000)
881#define MPI_IOCPAGE2_CAP_FLAGS_SES_SUPPORT (0x20000000) 954#define MPI_IOCPAGE2_CAP_FLAGS_SES_SUPPORT (0x20000000)
882#define MPI_IOCPAGE2_CAP_FLAGS_SAFTE_SUPPORT (0x40000000) 955#define MPI_IOCPAGE2_CAP_FLAGS_SAFTE_SUPPORT (0x40000000)
883#define MPI_IOCPAGE2_CAP_FLAGS_CROSS_CHANNEL_SUPPORT (0x80000000) 956#define MPI_IOCPAGE2_CAP_FLAGS_CROSS_CHANNEL_SUPPORT (0x80000000)
@@ -975,6 +1048,44 @@ typedef struct _CONFIG_PAGE_IOC_5
975 1048
976#define MPI_IOCPAGE5_PAGEVERSION (0x00) 1049#define MPI_IOCPAGE5_PAGEVERSION (0x00)
977 1050
1051typedef struct _CONFIG_PAGE_IOC_6
1052{
1053 CONFIG_PAGE_HEADER Header; /* 00h */
1054 U32 CapabilitiesFlags; /* 04h */
1055 U8 MaxDrivesIS; /* 08h */
1056 U8 MaxDrivesIM; /* 09h */
1057 U8 MaxDrivesIME; /* 0Ah */
1058 U8 Reserved1; /* 0Bh */
1059 U8 MinDrivesIS; /* 0Ch */
1060 U8 MinDrivesIM; /* 0Dh */
1061 U8 MinDrivesIME; /* 0Eh */
1062 U8 Reserved2; /* 0Fh */
1063 U8 MaxGlobalHotSpares; /* 10h */
1064 U8 Reserved3; /* 11h */
1065 U16 Reserved4; /* 12h */
1066 U32 Reserved5; /* 14h */
1067 U32 SupportedStripeSizeMapIS; /* 18h */
1068 U32 SupportedStripeSizeMapIME; /* 1Ch */
1069 U32 Reserved6; /* 20h */
1070 U8 MetadataSize; /* 24h */
1071 U8 Reserved7; /* 25h */
1072 U16 Reserved8; /* 26h */
1073 U16 MaxBadBlockTableEntries; /* 28h */
1074 U16 Reserved9; /* 2Ah */
1075 U16 IRNvsramUsage; /* 2Ch */
1076 U16 Reserved10; /* 2Eh */
1077 U32 IRNvsramVersion; /* 30h */
1078 U32 Reserved11; /* 34h */
1079 U32 Reserved12; /* 38h */
1080} CONFIG_PAGE_IOC_6, MPI_POINTER PTR_CONFIG_PAGE_IOC_6,
1081 IOCPage6_t, MPI_POINTER pIOCPage6_t;
1082
1083#define MPI_IOCPAGE6_PAGEVERSION (0x00)
1084
1085/* IOC Page 6 Capabilities Flags */
1086
1087#define MPI_IOCPAGE6_CAP_FLAGS_GLOBAL_HOT_SPARE (0x00000001)
1088
978 1089
979/**************************************************************************** 1090/****************************************************************************
980* BIOS Config Pages 1091* BIOS Config Pages
@@ -1218,13 +1329,13 @@ typedef struct _CONFIG_PAGE_BIOS_2
1218 U32 Reserved5; /* 14h */ 1329 U32 Reserved5; /* 14h */
1219 U32 Reserved6; /* 18h */ 1330 U32 Reserved6; /* 18h */
1220 U8 BootDeviceForm; /* 1Ch */ 1331 U8 BootDeviceForm; /* 1Ch */
1221 U8 Reserved7; /* 1Dh */ 1332 U8 PrevBootDeviceForm; /* 1Ch */
1222 U16 Reserved8; /* 1Eh */ 1333 U16 Reserved8; /* 1Eh */
1223 MPI_BIOSPAGE2_BOOT_DEVICE BootDevice; /* 20h */ 1334 MPI_BIOSPAGE2_BOOT_DEVICE BootDevice; /* 20h */
1224} CONFIG_PAGE_BIOS_2, MPI_POINTER PTR_CONFIG_PAGE_BIOS_2, 1335} CONFIG_PAGE_BIOS_2, MPI_POINTER PTR_CONFIG_PAGE_BIOS_2,
1225 BIOSPage2_t, MPI_POINTER pBIOSPage2_t; 1336 BIOSPage2_t, MPI_POINTER pBIOSPage2_t;
1226 1337
1227#define MPI_BIOSPAGE2_PAGEVERSION (0x01) 1338#define MPI_BIOSPAGE2_PAGEVERSION (0x02)
1228 1339
1229#define MPI_BIOSPAGE2_FORM_MASK (0x0F) 1340#define MPI_BIOSPAGE2_FORM_MASK (0x0F)
1230#define MPI_BIOSPAGE2_FORM_ADAPTER_ORDER (0x00) 1341#define MPI_BIOSPAGE2_FORM_ADAPTER_ORDER (0x00)
@@ -2080,7 +2191,7 @@ typedef struct _CONFIG_PAGE_RAID_VOL_0
2080 RAID_VOL0_STATUS VolumeStatus; /* 08h */ 2191 RAID_VOL0_STATUS VolumeStatus; /* 08h */
2081 RAID_VOL0_SETTINGS VolumeSettings; /* 0Ch */ 2192 RAID_VOL0_SETTINGS VolumeSettings; /* 0Ch */
2082 U32 MaxLBA; /* 10h */ 2193 U32 MaxLBA; /* 10h */
2083 U32 Reserved1; /* 14h */ 2194 U32 MaxLBAHigh; /* 14h */
2084 U32 StripeSize; /* 18h */ 2195 U32 StripeSize; /* 18h */
2085 U32 Reserved2; /* 1Ch */ 2196 U32 Reserved2; /* 1Ch */
2086 U32 Reserved3; /* 20h */ 2197 U32 Reserved3; /* 20h */
@@ -2092,7 +2203,7 @@ typedef struct _CONFIG_PAGE_RAID_VOL_0
2092} CONFIG_PAGE_RAID_VOL_0, MPI_POINTER PTR_CONFIG_PAGE_RAID_VOL_0, 2203} CONFIG_PAGE_RAID_VOL_0, MPI_POINTER PTR_CONFIG_PAGE_RAID_VOL_0,
2093 RaidVolumePage0_t, MPI_POINTER pRaidVolumePage0_t; 2204 RaidVolumePage0_t, MPI_POINTER pRaidVolumePage0_t;
2094 2205
2095#define MPI_RAIDVOLPAGE0_PAGEVERSION (0x05) 2206#define MPI_RAIDVOLPAGE0_PAGEVERSION (0x06)
2096 2207
2097/* values for RAID Volume Page 0 InactiveStatus field */ 2208/* values for RAID Volume Page 0 InactiveStatus field */
2098#define MPI_RAIDVOLPAGE0_UNKNOWN_INACTIVE (0x00) 2209#define MPI_RAIDVOLPAGE0_UNKNOWN_INACTIVE (0x00)
@@ -2324,7 +2435,8 @@ typedef struct _MPI_SAS_IO_UNIT0_PHY_DATA
2324typedef struct _CONFIG_PAGE_SAS_IO_UNIT_0 2435typedef struct _CONFIG_PAGE_SAS_IO_UNIT_0
2325{ 2436{
2326 CONFIG_EXTENDED_PAGE_HEADER Header; /* 00h */ 2437 CONFIG_EXTENDED_PAGE_HEADER Header; /* 00h */
2327 U32 Reserved1; /* 08h */ 2438 U16 NvdataVersionDefault; /* 08h */
2439 U16 NvdataVersionPersistent; /* 0Ah */
2328 U8 NumPhys; /* 0Ch */ 2440 U8 NumPhys; /* 0Ch */
2329 U8 Reserved2; /* 0Dh */ 2441 U8 Reserved2; /* 0Dh */
2330 U16 Reserved3; /* 0Eh */ 2442 U16 Reserved3; /* 0Eh */
@@ -2332,7 +2444,7 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_0
2332} CONFIG_PAGE_SAS_IO_UNIT_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_0, 2444} CONFIG_PAGE_SAS_IO_UNIT_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_0,
2333 SasIOUnitPage0_t, MPI_POINTER pSasIOUnitPage0_t; 2445 SasIOUnitPage0_t, MPI_POINTER pSasIOUnitPage0_t;
2334 2446
2335#define MPI_SASIOUNITPAGE0_PAGEVERSION (0x03) 2447#define MPI_SASIOUNITPAGE0_PAGEVERSION (0x04)
2336 2448
2337/* values for SAS IO Unit Page 0 PortFlags */ 2449/* values for SAS IO Unit Page 0 PortFlags */
2338#define MPI_SAS_IOUNIT0_PORT_FLAGS_DISCOVERY_IN_PROGRESS (0x08) 2450#define MPI_SAS_IOUNIT0_PORT_FLAGS_DISCOVERY_IN_PROGRESS (0x08)
@@ -2373,12 +2485,13 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_0
2373 2485
2374typedef struct _MPI_SAS_IO_UNIT1_PHY_DATA 2486typedef struct _MPI_SAS_IO_UNIT1_PHY_DATA
2375{ 2487{
2376 U8 Port; /* 00h */ 2488 U8 Port; /* 00h */
2377 U8 PortFlags; /* 01h */ 2489 U8 PortFlags; /* 01h */
2378 U8 PhyFlags; /* 02h */ 2490 U8 PhyFlags; /* 02h */
2379 U8 MaxMinLinkRate; /* 03h */ 2491 U8 MaxMinLinkRate; /* 03h */
2380 U32 ControllerPhyDeviceInfo;/* 04h */ 2492 U32 ControllerPhyDeviceInfo; /* 04h */
2381 U32 Reserved1; /* 08h */ 2493 U16 MaxTargetPortConnectTime; /* 08h */
2494 U16 Reserved1; /* 0Ah */
2382} MPI_SAS_IO_UNIT1_PHY_DATA, MPI_POINTER PTR_MPI_SAS_IO_UNIT1_PHY_DATA, 2495} MPI_SAS_IO_UNIT1_PHY_DATA, MPI_POINTER PTR_MPI_SAS_IO_UNIT1_PHY_DATA,
2383 SasIOUnit1PhyData, MPI_POINTER pSasIOUnit1PhyData; 2496 SasIOUnit1PhyData, MPI_POINTER pSasIOUnit1PhyData;
2384 2497
@@ -2395,15 +2508,17 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_1
2395 CONFIG_EXTENDED_PAGE_HEADER Header; /* 00h */ 2508 CONFIG_EXTENDED_PAGE_HEADER Header; /* 00h */
2396 U16 ControlFlags; /* 08h */ 2509 U16 ControlFlags; /* 08h */
2397 U16 MaxNumSATATargets; /* 0Ah */ 2510 U16 MaxNumSATATargets; /* 0Ah */
2398 U32 Reserved1; /* 0Ch */ 2511 U16 AdditionalControlFlags; /* 0Ch */
2512 U16 Reserved1; /* 0Eh */
2399 U8 NumPhys; /* 10h */ 2513 U8 NumPhys; /* 10h */
2400 U8 SATAMaxQDepth; /* 11h */ 2514 U8 SATAMaxQDepth; /* 11h */
2401 U16 Reserved2; /* 12h */ 2515 U8 ReportDeviceMissingDelay; /* 12h */
2516 U8 IODeviceMissingDelay; /* 13h */
2402 MPI_SAS_IO_UNIT1_PHY_DATA PhyData[MPI_SAS_IOUNIT1_PHY_MAX]; /* 14h */ 2517 MPI_SAS_IO_UNIT1_PHY_DATA PhyData[MPI_SAS_IOUNIT1_PHY_MAX]; /* 14h */
2403} CONFIG_PAGE_SAS_IO_UNIT_1, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_1, 2518} CONFIG_PAGE_SAS_IO_UNIT_1, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_1,
2404 SasIOUnitPage1_t, MPI_POINTER pSasIOUnitPage1_t; 2519 SasIOUnitPage1_t, MPI_POINTER pSasIOUnitPage1_t;
2405 2520
2406#define MPI_SASIOUNITPAGE1_PAGEVERSION (0x05) 2521#define MPI_SASIOUNITPAGE1_PAGEVERSION (0x06)
2407 2522
2408/* values for SAS IO Unit Page 1 ControlFlags */ 2523/* values for SAS IO Unit Page 1 ControlFlags */
2409#define MPI_SAS_IOUNIT1_CONTROL_DEVICE_SELF_TEST (0x8000) 2524#define MPI_SAS_IOUNIT1_CONTROL_DEVICE_SELF_TEST (0x8000)
@@ -2428,6 +2543,13 @@ typedef struct _CONFIG_PAGE_SAS_IO_UNIT_1
2428#define MPI_SAS_IOUNIT1_CONTROL_FIRST_LVL_DISC_ONLY (0x0002) 2543#define MPI_SAS_IOUNIT1_CONTROL_FIRST_LVL_DISC_ONLY (0x0002)
2429#define MPI_SAS_IOUNIT1_CONTROL_CLEAR_AFFILIATION (0x0001) 2544#define MPI_SAS_IOUNIT1_CONTROL_CLEAR_AFFILIATION (0x0001)
2430 2545
2546/* values for SAS IO Unit Page 1 AdditionalControlFlags */
2547#define MPI_SAS_IOUNIT1_ACONTROL_ALLOW_TABLE_TO_TABLE (0x0001)
2548
2549/* defines for SAS IO Unit Page 1 ReportDeviceMissingDelay */
2550#define MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK (0x7F)
2551#define MPI_SAS_IOUNIT1_REPORT_MISSING_UNIT_16 (0x80)
2552
2431/* values for SAS IO Unit Page 1 PortFlags */ 2553/* values for SAS IO Unit Page 1 PortFlags */
2432#define MPI_SAS_IOUNIT1_PORT_FLAGS_0_TARGET_IOC_NUM (0x00) 2554#define MPI_SAS_IOUNIT1_PORT_FLAGS_0_TARGET_IOC_NUM (0x00)
2433#define MPI_SAS_IOUNIT1_PORT_FLAGS_1_TARGET_IOC_NUM (0x04) 2555#define MPI_SAS_IOUNIT1_PORT_FLAGS_1_TARGET_IOC_NUM (0x04)
diff --git a/drivers/message/fusion/lsi/mpi_history.txt b/drivers/message/fusion/lsi/mpi_history.txt
index 4a5f8dd1d766..582cfe7c2aa1 100644
--- a/drivers/message/fusion/lsi/mpi_history.txt
+++ b/drivers/message/fusion/lsi/mpi_history.txt
@@ -6,25 +6,25 @@
6 Copyright (c) 2000-2005 LSI Logic Corporation. 6 Copyright (c) 2000-2005 LSI Logic Corporation.
7 7
8 --------------------------------------- 8 ---------------------------------------
9 Header Set Release Version: 01.05.12 9 Header Set Release Version: 01.05.13
10 Header Set Release Date: 08-30-05 10 Header Set Release Date: 03-27-06
11 --------------------------------------- 11 ---------------------------------------
12 12
13 Filename Current version Prior version 13 Filename Current version Prior version
14 ---------- --------------- ------------- 14 ---------- --------------- -------------
15 mpi.h 01.05.10 01.05.09 15 mpi.h 01.05.11 01.05.10
16 mpi_ioc.h 01.05.10 01.05.09 16 mpi_ioc.h 01.05.11 01.05.10
17 mpi_cnfg.h 01.05.11 01.05.10 17 mpi_cnfg.h 01.05.12 01.05.11
18 mpi_init.h 01.05.06 01.05.06 18 mpi_init.h 01.05.07 01.05.06
19 mpi_targ.h 01.05.05 01.05.05 19 mpi_targ.h 01.05.06 01.05.05
20 mpi_fc.h 01.05.01 01.05.01 20 mpi_fc.h 01.05.01 01.05.01
21 mpi_lan.h 01.05.01 01.05.01 21 mpi_lan.h 01.05.01 01.05.01
22 mpi_raid.h 01.05.02 01.05.02 22 mpi_raid.h 01.05.02 01.05.02
23 mpi_tool.h 01.05.03 01.05.03 23 mpi_tool.h 01.05.03 01.05.03
24 mpi_inb.h 01.05.01 01.05.01 24 mpi_inb.h 01.05.01 01.05.01
25 mpi_sas.h 01.05.02 01.05.01 25 mpi_sas.h 01.05.03 01.05.02
26 mpi_type.h 01.05.02 01.05.01 26 mpi_type.h 01.05.02 01.05.02
27 mpi_history.txt 01.05.12 01.05.11 27 mpi_history.txt 01.05.13 01.05.12
28 28
29 29
30 * Date Version Description 30 * Date Version Description
@@ -93,6 +93,7 @@ mpi.h
93 * Added EEDP IOCStatus codes. 93 * Added EEDP IOCStatus codes.
94 * 08-03-05 01.05.09 Bumped MPI_HEADER_VERSION_UNIT. 94 * 08-03-05 01.05.09 Bumped MPI_HEADER_VERSION_UNIT.
95 * 08-30-05 01.05.10 Added 2 new IOCStatus codes for Target. 95 * 08-30-05 01.05.10 Added 2 new IOCStatus codes for Target.
96 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT.
96 * -------------------------------------------------------------------------- 97 * --------------------------------------------------------------------------
97 98
98mpi_ioc.h 99mpi_ioc.h
@@ -170,6 +171,17 @@ mpi_ioc.h
170 * Added new ReasonCode value for SAS Device Status Change 171 * Added new ReasonCode value for SAS Device Status Change
171 * event. 172 * event.
172 * Added new family code for FC949E. 173 * Added new family code for FC949E.
174 * 03-27-06 01.05.11 Added MPI_IOCFACTS_CAPABILITY_TLR.
175 * Added additional Reason Codes and more event data fields
176 * to EVENT_DATA_SAS_DEVICE_STATUS_CHANGE.
177 * Added EVENT_DATA_SAS_BROADCAST_PRIMITIVE structure and
178 * new event.
179 * Added MPI_EVENT_SAS_SMP_ERROR and event data structure.
180 * Added MPI_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE and event
181 * data structure.
182 * Added MPI_EVENT_SAS_INIT_TABLE_OVERFLOW and event
183 * data structure.
184 * Added MPI_EXT_IMAGE_TYPE_INITIALIZATION.
173 * -------------------------------------------------------------------------- 185 * --------------------------------------------------------------------------
174 186
175mpi_cnfg.h 187mpi_cnfg.h
@@ -425,6 +437,16 @@ mpi_cnfg.h
425 * Added postpone SATA Init bit to SAS IO Unit Page 1 437 * Added postpone SATA Init bit to SAS IO Unit Page 1
426 * ControlFlags. 438 * ControlFlags.
427 * Changed LogEntry format for Log Page 0. 439 * Changed LogEntry format for Log Page 0.
440 * 03-27-06 01.05.12 Added two new Flags defines for Manufacturing Page 4.
441 * Added Manufacturing Page 7.
442 * Added MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING.
443 * Added IOC Page 6.
444 * Added PrevBootDeviceForm field to CONFIG_PAGE_BIOS_2.
445 * Added MaxLBAHigh field to RAID Volume Page 0.
446 * Added Nvdata version fields to SAS IO Unit Page 0.
447 * Added AdditionalControlFlags, MaxTargetPortConnectTime,
448 * ReportDeviceMissingDelay, and IODeviceMissingDelay
449 * fields to SAS IO Unit Page 1.
428 * -------------------------------------------------------------------------- 450 * --------------------------------------------------------------------------
429 451
430mpi_init.h 452mpi_init.h
@@ -467,6 +489,7 @@ mpi_init.h
467 * Added four new defines for SEP SlotStatus. 489 * Added four new defines for SEP SlotStatus.
468 * 08-03-05 01.05.06 Fixed some MPI_SCSIIO32_MSGFLGS_ defines to make them 490 * 08-03-05 01.05.06 Fixed some MPI_SCSIIO32_MSGFLGS_ defines to make them
469 * unique in the first 32 characters. 491 * unique in the first 32 characters.
492 * 03-27-06 01.05.07 Added Task Management type of Clear ACA.
470 * -------------------------------------------------------------------------- 493 * --------------------------------------------------------------------------
471 494
472mpi_targ.h 495mpi_targ.h
@@ -511,6 +534,7 @@ mpi_targ.h
511 * 02-22-05 01.05.03 Changed a comment. 534 * 02-22-05 01.05.03 Changed a comment.
512 * 03-11-05 01.05.04 Removed TargetAssistExtended Request. 535 * 03-11-05 01.05.04 Removed TargetAssistExtended Request.
513 * 06-24-05 01.05.05 Added TargetAssistExtended structures and defines. 536 * 06-24-05 01.05.05 Added TargetAssistExtended structures and defines.
537 * 03-27-06 01.05.06 Added a comment.
514 * -------------------------------------------------------------------------- 538 * --------------------------------------------------------------------------
515 539
516mpi_fc.h 540mpi_fc.h
@@ -610,6 +634,10 @@ mpi_sas.h
610 * 08-30-05 01.05.02 Added DeviceInfo bit for SEP. 634 * 08-30-05 01.05.02 Added DeviceInfo bit for SEP.
611 * Added PrimFlags and Primitive field to SAS IO Unit 635 * Added PrimFlags and Primitive field to SAS IO Unit
612 * Control request, and added a new operation code. 636 * Control request, and added a new operation code.
637 * 03-27-06 01.05.03 Added Force Full Discovery, Transmit Port Select Signal,
638 * and Remove Device operations to SAS IO Unit Control.
639 * Added DevHandle field to SAS IO Unit Control request and
640 * reply.
613 * -------------------------------------------------------------------------- 641 * --------------------------------------------------------------------------
614 642
615mpi_type.h 643mpi_type.h
@@ -625,20 +653,20 @@ mpi_type.h
625 653
626mpi_history.txt Parts list history 654mpi_history.txt Parts list history
627 655
628Filename 01.05.12 01.05.11 01.05.10 01.05.09 656Filename 01.05.13 01.05.12 01.05.11 01.05.10 01.05.09
629---------- -------- -------- -------- -------- 657---------- -------- -------- -------- -------- --------
630mpi.h 01.05.10 01.05.09 01.05.08 01.05.07 658mpi.h 01.05.11 01.05.10 01.05.09 01.05.08 01.05.07
631mpi_ioc.h 01.05.10 01.05.09 01.05.09 01.05.08 659mpi_ioc.h 01.05.11 01.05.10 01.05.09 01.05.09 01.05.08
632mpi_cnfg.h 01.05.11 01.05.10 01.05.09 01.05.08 660mpi_cnfg.h 01.05.12 01.05.11 01.05.10 01.05.09 01.05.08
633mpi_init.h 01.05.06 01.05.06 01.05.05 01.05.04 661mpi_init.h 01.05.07 01.05.06 01.05.06 01.05.05 01.05.04
634mpi_targ.h 01.05.05 01.05.05 01.05.05 01.05.04 662mpi_targ.h 01.05.06 01.05.05 01.05.05 01.05.05 01.05.04
635mpi_fc.h 01.05.01 01.05.01 01.05.01 01.05.01 663mpi_fc.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
636mpi_lan.h 01.05.01 01.05.01 01.05.01 01.05.01 664mpi_lan.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
637mpi_raid.h 01.05.02 01.05.02 01.05.02 01.05.02 665mpi_raid.h 01.05.02 01.05.02 01.05.02 01.05.02 01.05.02
638mpi_tool.h 01.05.03 01.05.03 01.05.03 01.05.03 666mpi_tool.h 01.05.03 01.05.03 01.05.03 01.05.03 01.05.03
639mpi_inb.h 01.05.01 01.05.01 01.05.01 01.05.01 667mpi_inb.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
640mpi_sas.h 01.05.02 01.05.01 01.05.01 01.05.01 668mpi_sas.h 01.05.03 01.05.02 01.05.01 01.05.01 01.05.01
641mpi_type.h 01.05.02 01.05.01 01.05.01 01.05.01 669mpi_type.h 01.05.02 01.05.02 01.05.01 01.05.01 01.05.01
642 670
643Filename 01.05.08 01.05.07 01.05.06 01.05.05 01.05.04 01.05.03 671Filename 01.05.08 01.05.07 01.05.06 01.05.05 01.05.04 01.05.03
644---------- -------- -------- -------- -------- -------- -------- 672---------- -------- -------- -------- -------- -------- --------
diff --git a/drivers/message/fusion/lsi/mpi_init.h b/drivers/message/fusion/lsi/mpi_init.h
index 68941f459ca3..c1c678989a23 100644
--- a/drivers/message/fusion/lsi/mpi_init.h
+++ b/drivers/message/fusion/lsi/mpi_init.h
@@ -6,7 +6,7 @@
6 * Title: MPI initiator mode messages and structures 6 * Title: MPI initiator mode messages and structures
7 * Creation Date: June 8, 2000 7 * Creation Date: June 8, 2000
8 * 8 *
9 * mpi_init.h Version: 01.05.06 9 * mpi_init.h Version: 01.05.07
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -52,6 +52,7 @@
52 * Added four new defines for SEP SlotStatus. 52 * Added four new defines for SEP SlotStatus.
53 * 08-03-05 01.05.06 Fixed some MPI_SCSIIO32_MSGFLGS_ defines to make them 53 * 08-03-05 01.05.06 Fixed some MPI_SCSIIO32_MSGFLGS_ defines to make them
54 * unique in the first 32 characters. 54 * unique in the first 32 characters.
55 * 03-27-06 01.05.07 Added Task Management type of Clear ACA.
55 * -------------------------------------------------------------------------- 56 * --------------------------------------------------------------------------
56 */ 57 */
57 58
@@ -427,6 +428,7 @@ typedef struct _MSG_SCSI_TASK_MGMT
427#define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05) 428#define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05)
428#define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06) 429#define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06)
429#define MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07) 430#define MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07)
431#define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_ACA (0x08)
430 432
431/* MsgFlags bits */ 433/* MsgFlags bits */
432#define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION (0x00) 434#define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION (0x00)
diff --git a/drivers/message/fusion/lsi/mpi_ioc.h b/drivers/message/fusion/lsi/mpi_ioc.h
index 2c5f43fa7c73..18ba407fd399 100644
--- a/drivers/message/fusion/lsi/mpi_ioc.h
+++ b/drivers/message/fusion/lsi/mpi_ioc.h
@@ -6,7 +6,7 @@
6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages 6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages
7 * Creation Date: August 11, 2000 7 * Creation Date: August 11, 2000
8 * 8 *
9 * mpi_ioc.h Version: 01.05.10 9 * mpi_ioc.h Version: 01.05.11
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -87,6 +87,17 @@
87 * Added new ReasonCode value for SAS Device Status Change 87 * Added new ReasonCode value for SAS Device Status Change
88 * event. 88 * event.
89 * Added new family code for FC949E. 89 * Added new family code for FC949E.
90 * 03-27-06 01.05.11 Added MPI_IOCFACTS_CAPABILITY_TLR.
91 * Added additional Reason Codes and more event data fields
92 * to EVENT_DATA_SAS_DEVICE_STATUS_CHANGE.
93 * Added EVENT_DATA_SAS_BROADCAST_PRIMITIVE structure and
94 * new event.
95 * Added MPI_EVENT_SAS_SMP_ERROR and event data structure.
96 * Added MPI_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE and event
97 * data structure.
98 * Added MPI_EVENT_SAS_INIT_TABLE_OVERFLOW and event
99 * data structure.
100 * Added MPI_EXT_IMAGE_TYPE_INITIALIZATION.
90 * -------------------------------------------------------------------------- 101 * --------------------------------------------------------------------------
91 */ 102 */
92 103
@@ -272,6 +283,7 @@ typedef struct _MSG_IOC_FACTS_REPLY
272#define MPI_IOCFACTS_CAPABILITY_MULTICAST (0x00000100) 283#define MPI_IOCFACTS_CAPABILITY_MULTICAST (0x00000100)
273#define MPI_IOCFACTS_CAPABILITY_SCSIIO32 (0x00000200) 284#define MPI_IOCFACTS_CAPABILITY_SCSIIO32 (0x00000200)
274#define MPI_IOCFACTS_CAPABILITY_NO_SCSIIO16 (0x00000400) 285#define MPI_IOCFACTS_CAPABILITY_NO_SCSIIO16 (0x00000400)
286#define MPI_IOCFACTS_CAPABILITY_TLR (0x00000800)
275 287
276 288
277/***************************************************************************** 289/*****************************************************************************
@@ -448,30 +460,34 @@ typedef struct _MSG_EVENT_ACK_REPLY
448 460
449/* Event */ 461/* Event */
450 462
451#define MPI_EVENT_NONE (0x00000000) 463#define MPI_EVENT_NONE (0x00000000)
452#define MPI_EVENT_LOG_DATA (0x00000001) 464#define MPI_EVENT_LOG_DATA (0x00000001)
453#define MPI_EVENT_STATE_CHANGE (0x00000002) 465#define MPI_EVENT_STATE_CHANGE (0x00000002)
454#define MPI_EVENT_UNIT_ATTENTION (0x00000003) 466#define MPI_EVENT_UNIT_ATTENTION (0x00000003)
455#define MPI_EVENT_IOC_BUS_RESET (0x00000004) 467#define MPI_EVENT_IOC_BUS_RESET (0x00000004)
456#define MPI_EVENT_EXT_BUS_RESET (0x00000005) 468#define MPI_EVENT_EXT_BUS_RESET (0x00000005)
457#define MPI_EVENT_RESCAN (0x00000006) 469#define MPI_EVENT_RESCAN (0x00000006)
458#define MPI_EVENT_LINK_STATUS_CHANGE (0x00000007) 470#define MPI_EVENT_LINK_STATUS_CHANGE (0x00000007)
459#define MPI_EVENT_LOOP_STATE_CHANGE (0x00000008) 471#define MPI_EVENT_LOOP_STATE_CHANGE (0x00000008)
460#define MPI_EVENT_LOGOUT (0x00000009) 472#define MPI_EVENT_LOGOUT (0x00000009)
461#define MPI_EVENT_EVENT_CHANGE (0x0000000A) 473#define MPI_EVENT_EVENT_CHANGE (0x0000000A)
462#define MPI_EVENT_INTEGRATED_RAID (0x0000000B) 474#define MPI_EVENT_INTEGRATED_RAID (0x0000000B)
463#define MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE (0x0000000C) 475#define MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE (0x0000000C)
464#define MPI_EVENT_ON_BUS_TIMER_EXPIRED (0x0000000D) 476#define MPI_EVENT_ON_BUS_TIMER_EXPIRED (0x0000000D)
465#define MPI_EVENT_QUEUE_FULL (0x0000000E) 477#define MPI_EVENT_QUEUE_FULL (0x0000000E)
466#define MPI_EVENT_SAS_DEVICE_STATUS_CHANGE (0x0000000F) 478#define MPI_EVENT_SAS_DEVICE_STATUS_CHANGE (0x0000000F)
467#define MPI_EVENT_SAS_SES (0x00000010) 479#define MPI_EVENT_SAS_SES (0x00000010)
468#define MPI_EVENT_PERSISTENT_TABLE_FULL (0x00000011) 480#define MPI_EVENT_PERSISTENT_TABLE_FULL (0x00000011)
469#define MPI_EVENT_SAS_PHY_LINK_STATUS (0x00000012) 481#define MPI_EVENT_SAS_PHY_LINK_STATUS (0x00000012)
470#define MPI_EVENT_SAS_DISCOVERY_ERROR (0x00000013) 482#define MPI_EVENT_SAS_DISCOVERY_ERROR (0x00000013)
471#define MPI_EVENT_IR_RESYNC_UPDATE (0x00000014) 483#define MPI_EVENT_IR_RESYNC_UPDATE (0x00000014)
472#define MPI_EVENT_IR2 (0x00000015) 484#define MPI_EVENT_IR2 (0x00000015)
473#define MPI_EVENT_SAS_DISCOVERY (0x00000016) 485#define MPI_EVENT_SAS_DISCOVERY (0x00000016)
474#define MPI_EVENT_LOG_ENTRY_ADDED (0x00000021) 486#define MPI_EVENT_SAS_BROADCAST_PRIMITIVE (0x00000017)
487#define MPI_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE (0x00000018)
488#define MPI_EVENT_SAS_INIT_TABLE_OVERFLOW (0x00000019)
489#define MPI_EVENT_SAS_SMP_ERROR (0x0000001A)
490#define MPI_EVENT_LOG_ENTRY_ADDED (0x00000021)
475 491
476/* AckRequired field values */ 492/* AckRequired field values */
477 493
@@ -558,18 +574,25 @@ typedef struct _EVENT_DATA_SAS_DEVICE_STATUS_CHANGE
558 U8 PhyNum; /* 0Eh */ 574 U8 PhyNum; /* 0Eh */
559 U8 Reserved1; /* 0Fh */ 575 U8 Reserved1; /* 0Fh */
560 U64 SASAddress; /* 10h */ 576 U64 SASAddress; /* 10h */
577 U8 LUN[8]; /* 18h */
578 U16 TaskTag; /* 20h */
579 U16 Reserved2; /* 22h */
561} EVENT_DATA_SAS_DEVICE_STATUS_CHANGE, 580} EVENT_DATA_SAS_DEVICE_STATUS_CHANGE,
562 MPI_POINTER PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE, 581 MPI_POINTER PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE,
563 MpiEventDataSasDeviceStatusChange_t, 582 MpiEventDataSasDeviceStatusChange_t,
564 MPI_POINTER pMpiEventDataSasDeviceStatusChange_t; 583 MPI_POINTER pMpiEventDataSasDeviceStatusChange_t;
565 584
566/* MPI SAS Device Status Change Event data ReasonCode values */ 585/* MPI SAS Device Status Change Event data ReasonCode values */
567#define MPI_EVENT_SAS_DEV_STAT_RC_ADDED (0x03) 586#define MPI_EVENT_SAS_DEV_STAT_RC_ADDED (0x03)
568#define MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING (0x04) 587#define MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING (0x04)
569#define MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA (0x05) 588#define MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA (0x05)
570#define MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED (0x06) 589#define MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED (0x06)
571#define MPI_EVENT_SAS_DEV_STAT_RC_UNSUPPORTED (0x07) 590#define MPI_EVENT_SAS_DEV_STAT_RC_UNSUPPORTED (0x07)
572#define MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET (0x08) 591#define MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET (0x08)
592#define MPI_EVENT_SAS_DEV_STAT_RC_TASK_ABORT_INTERNAL (0x09)
593#define MPI_EVENT_SAS_DEV_STAT_RC_ABORT_TASK_SET_INTERNAL (0x0A)
594#define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B)
595#define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C)
573 596
574 597
575/* SCSI Event data for Queue Full event */ 598/* SCSI Event data for Queue Full event */
@@ -742,6 +765,27 @@ typedef struct _EVENT_DATA_SAS_SES
742} EVENT_DATA_SAS_SES, MPI_POINTER PTR_EVENT_DATA_SAS_SES, 765} EVENT_DATA_SAS_SES, MPI_POINTER PTR_EVENT_DATA_SAS_SES,
743 MpiEventDataSasSes_t, MPI_POINTER pMpiEventDataSasSes_t; 766 MpiEventDataSasSes_t, MPI_POINTER pMpiEventDataSasSes_t;
744 767
768/* SAS Broadcast Primitive Event data */
769
770typedef struct _EVENT_DATA_SAS_BROADCAST_PRIMITIVE
771{
772 U8 PhyNum; /* 00h */
773 U8 Port; /* 01h */
774 U8 PortWidth; /* 02h */
775 U8 Primitive; /* 04h */
776} EVENT_DATA_SAS_BROADCAST_PRIMITIVE,
777 MPI_POINTER PTR_EVENT_DATA_SAS_BROADCAST_PRIMITIVE,
778 MpiEventDataSasBroadcastPrimitive_t,
779 MPI_POINTER pMpiEventDataSasBroadcastPrimitive_t;
780
781#define MPI_EVENT_PRIMITIVE_CHANGE (0x01)
782#define MPI_EVENT_PRIMITIVE_EXPANDER (0x03)
783#define MPI_EVENT_PRIMITIVE_RESERVED2 (0x04)
784#define MPI_EVENT_PRIMITIVE_RESERVED3 (0x05)
785#define MPI_EVENT_PRIMITIVE_RESERVED4 (0x06)
786#define MPI_EVENT_PRIMITIVE_CHANGE0_RESERVED (0x07)
787#define MPI_EVENT_PRIMITIVE_CHANGE1_RESERVED (0x08)
788
745/* SAS Phy Link Status Event data */ 789/* SAS Phy Link Status Event data */
746 790
747typedef struct _EVENT_DATA_SAS_PHY_LINK_STATUS 791typedef struct _EVENT_DATA_SAS_PHY_LINK_STATUS
@@ -804,6 +848,53 @@ typedef struct _EVENT_DATA_DISCOVERY_ERROR
804#define MPI_EVENT_DSCVRY_ERR_DS_MULTPL_PATHS (0x00000800) 848#define MPI_EVENT_DSCVRY_ERR_DS_MULTPL_PATHS (0x00000800)
805#define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) 849#define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000)
806 850
851/* SAS SMP Error Event data */
852
853typedef struct _EVENT_DATA_SAS_SMP_ERROR
854{
855 U8 Status; /* 00h */
856 U8 Port; /* 01h */
857 U8 SMPFunctionResult; /* 02h */
858 U8 Reserved1; /* 03h */
859 U64 SASAddress; /* 04h */
860} EVENT_DATA_SAS_SMP_ERROR, MPI_POINTER PTR_EVENT_DATA_SAS_SMP_ERROR,
861 MpiEventDataSasSmpError_t, MPI_POINTER pMpiEventDataSasSmpError_t;
862
863/* defines for the Status field of the SAS SMP Error event */
864#define MPI_EVENT_SAS_SMP_FUNCTION_RESULT_VALID (0x00)
865#define MPI_EVENT_SAS_SMP_CRC_ERROR (0x01)
866#define MPI_EVENT_SAS_SMP_TIMEOUT (0x02)
867#define MPI_EVENT_SAS_SMP_NO_DESTINATION (0x03)
868#define MPI_EVENT_SAS_SMP_BAD_DESTINATION (0x04)
869
870/* SAS Initiator Device Status Change Event data */
871
872typedef struct _EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE
873{
874 U8 ReasonCode; /* 00h */
875 U8 Port; /* 01h */
876 U16 DevHandle; /* 02h */
877 U64 SASAddress; /* 04h */
878} EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE,
879 MPI_POINTER PTR_EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE,
880 MpiEventDataSasInitDevStatusChange_t,
881 MPI_POINTER pMpiEventDataSasInitDevStatusChange_t;
882
883/* defines for the ReasonCode field of the SAS Initiator Device Status Change event */
884#define MPI_EVENT_SAS_INIT_RC_ADDED (0x01)
885
886/* SAS Initiator Device Table Overflow Event data */
887
888typedef struct _EVENT_DATA_SAS_INIT_TABLE_OVERFLOW
889{
890 U8 MaxInit; /* 00h */
891 U8 CurrentInit; /* 01h */
892 U16 Reserved1; /* 02h */
893} EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
894 MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
895 MpiEventDataSasInitTableOverflow_t,
896 MPI_POINTER pMpiEventDataSasInitTableOverflow_t;
897
807 898
808/***************************************************************************** 899/*****************************************************************************
809* 900*
@@ -1013,5 +1104,6 @@ typedef struct _MPI_EXT_IMAGE_HEADER
1013#define MPI_EXT_IMAGE_TYPE_FW (0x01) 1104#define MPI_EXT_IMAGE_TYPE_FW (0x01)
1014#define MPI_EXT_IMAGE_TYPE_NVDATA (0x03) 1105#define MPI_EXT_IMAGE_TYPE_NVDATA (0x03)
1015#define MPI_EXT_IMAGE_TYPE_BOOTLOADER (0x04) 1106#define MPI_EXT_IMAGE_TYPE_BOOTLOADER (0x04)
1107#define MPI_EXT_IMAGE_TYPE_INITIALIZATION (0x05)
1016 1108
1017#endif 1109#endif
diff --git a/drivers/message/fusion/lsi/mpi_log_sas.h b/drivers/message/fusion/lsi/mpi_log_sas.h
index a9c14ad132ce..871ebc08b706 100644
--- a/drivers/message/fusion/lsi/mpi_log_sas.h
+++ b/drivers/message/fusion/lsi/mpi_log_sas.h
@@ -13,6 +13,8 @@
13#ifndef IOPI_IOCLOGINFO_H_INCLUDED 13#ifndef IOPI_IOCLOGINFO_H_INCLUDED
14#define IOPI_IOCLOGINFO_H_INCLUDED 14#define IOPI_IOCLOGINFO_H_INCLUDED
15 15
16#define SAS_LOGINFO_NEXUS_LOSS 0x31170000
17#define SAS_LOGINFO_MASK 0xFFFF0000
16 18
17/****************************************************************************/ 19/****************************************************************************/
18/* IOC LOGINFO defines, 0x00000000 - 0x0FFFFFFF */ 20/* IOC LOGINFO defines, 0x00000000 - 0x0FFFFFFF */
@@ -51,6 +53,9 @@
51#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_DNM (0x00030500) /* Device Not Mapped */ 53#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_DNM (0x00030500) /* Device Not Mapped */
52#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_PERSIST (0x00030600) /* Persistent Page not found */ 54#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_PERSIST (0x00030600) /* Persistent Page not found */
53#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_DEFAULT (0x00030700) /* Default Page not found */ 55#define IOP_LOGINFO_CODE_CONFIG_INVALID_PAGE_DEFAULT (0x00030700) /* Default Page not found */
56
57#define IOP_LOGINFO_CODE_DIAG_MSG_ERROR (0x00040000) /* Error handling diag msg - or'd with diag status */
58
54#define IOP_LOGINFO_CODE_TASK_TERMINATED (0x00050000) 59#define IOP_LOGINFO_CODE_TASK_TERMINATED (0x00050000)
55 60
56#define IOP_LOGINFO_CODE_ENCL_MGMT_READ_ACTION_ERR0R (0x00060001) /* Read Action not supported for SEP msg */ 61#define IOP_LOGINFO_CODE_ENCL_MGMT_READ_ACTION_ERR0R (0x00060001) /* Read Action not supported for SEP msg */
@@ -103,6 +108,7 @@
103#define PL_LOGINFO_CODE_IO_EXECUTED (0x00140000) 108#define PL_LOGINFO_CODE_IO_EXECUTED (0x00140000)
104#define PL_LOGINFO_CODE_PERS_RESV_OUT_NOT_AFFIL_OWNER (0x00150000) 109#define PL_LOGINFO_CODE_PERS_RESV_OUT_NOT_AFFIL_OWNER (0x00150000)
105#define PL_LOGINFO_CODE_OPEN_TXDMA_ABORT (0x00160000) 110#define PL_LOGINFO_CODE_OPEN_TXDMA_ABORT (0x00160000)
111#define PL_LOGINFO_CODE_IO_DEVICE_MISSING_DELAY_RETRY (0x00170000)
106#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE (0x00000100) 112#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE (0x00000100)
107#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_NO_DEST_TIMEOUT (0x00000101) 113#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_NO_DEST_TIMEOUT (0x00000101)
108#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ORR_TIMEOUT (0x0000011A) /* Open Reject (Retry) Timeout */ 114#define PL_LOGINFO_SUB_CODE_OPEN_FAILURE_ORR_TIMEOUT (0x0000011A) /* Open Reject (Retry) Timeout */
@@ -165,11 +171,81 @@
165/****************************************************************************/ 171/****************************************************************************/
166/* IR LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = IR */ 172/* IR LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = IR */
167/****************************************************************************/ 173/****************************************************************************/
168#define IR_LOGINFO_CODE_UNUSED1 (0x00010000) 174#define IR_LOGINFO_RAID_ACTION_ERROR (0x00010000)
169#define IR_LOGINFO_CODE_UNUSED2 (0x00020000) 175#define IR_LOGINFO_CODE_UNUSED2 (0x00020000)
176
177/* Amount of information passed down for Create Volume is too large */
178#define IR_LOGINFO_VOLUME_CREATE_INVALID_LENGTH (0x00010001)
179/* Creation of duplicate volume attempted (Bus/Target ID checked) */
180#define IR_LOGINFO_VOLUME_CREATE_DUPLICATE (0x00010002)
181/* Creation failed due to maximum number of supported volumes exceeded */
182#define IR_LOGINFO_VOLUME_CREATE_NO_SLOTS (0x00010003)
183/* Creation failed due to DMA error in trying to read from host */
184#define IR_LOGINFO_VOLUME_CREATE_DMA_ERROR (0x00010004)
185/* Creation failed due to invalid volume type passed down */
186#define IR_LOGINFO_VOLUME_CREATE_INVALID_VOLUME_TYPE (0x00010005)
187/* Creation failed due to error reading MFG Page 4 */
188#define IR_LOGINFO_VOLUME_MFG_PAGE4_ERROR (0x00010006)
189/* Creation failed when trying to create internal structures */
190#define IR_LOGINFO_VOLUME_INTERNAL_CONFIG_STRUCTURE_ERROR (0x00010007)
191
192/* Activation failed due to trying to activate an already active volume */
193#define IR_LOGINFO_VOLUME_ACTIVATING_AN_ACTIVE_VOLUME (0x00010010)
194/* Activation failed due to trying to active unsupported volume type */
195#define IR_LOGINFO_VOLUME_ACTIVATING_INVALID_VOLUME_TYPE (0x00010011)
196/* Activation failed due to trying to active too many volumes */
197#define IR_LOGINFO_VOLUME_ACTIVATING_TOO_MANY_VOLUMES (0x00010012)
198/* Activation failed due to Volume ID in use already */
199#define IR_LOGINFO_VOLUME_ACTIVATING_VOLUME_ID_IN_USE (0x00010013)
200/* Activation failed call to activateVolume returned failure */
201#define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED (0x00010014)
202/* Activation failed trying to import the volume */
203#define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED (0x00010015)
204
205/* Phys Disk failed, too many phys disks */
206#define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS (0x00010020)
207/* Amount of information passed down for Create Pnysdisk is too large */
208#define IR_LOGINFO_PHYSDISK_CREATE_INVALID_LENGTH (0x00010021)
209/* Creation failed due to DMA error in trying to read from host */
210#define IR_LOGINFO_PHYSDISK_CREATE_DMA_ERROR (0x00010022)
211/* Creation failed due to invalid Bus TargetID passed down */
212#define IR_LOGINFO_PHYSDISK_CREATE_BUS_TID_INVALID (0x00010023)
213/* Creation failed due to error in creating RAID Phys Disk Config Page */
214#define IR_LOGINFO_PHYSDISK_CREATE_CONFIG_PAGE_ERROR (0x00010024)
215
216
217/* Compatibility Error : IR Disabled */
218#define IR_LOGINFO_COMPAT_ERROR_RAID_DISABLED (0x00010030)
219/* Compatibility Error : Inquiry Comand failed */
220#define IR_LOGINFO_COMPAT_ERROR_INQUIRY_FAILED (0x00010031)
221/* Compatibility Error : Device not direct access device */
222#define IR_LOGINFO_COMPAT_ERROR_NOT_DIRECT_ACCESS (0x00010032)
223/* Compatibility Error : Removable device found */
224#define IR_LOGINFO_COMPAT_ERROR_REMOVABLE_FOUND (0x00010033)
225/* Compatibility Error : Device SCSI Version not 2 or higher */
226#define IR_LOGINFO_COMPAT_ERROR_NEED_SCSI_2_OR_HIGHER (0x00010034)
227/* Compatibility Error : SATA device, 48 BIT LBA not supported */
228#define IR_LOGINFO_COMPAT_ERROR_SATA_48BIT_LBA_NOT_SUPPORTED (0x00010035)
229/* Compatibility Error : Device does not have 512 byte block sizes */
230#define IR_LOGINFO_COMPAT_ERROR_DEVICE_NOT_512_BYTE_BLOCK (0x00010036)
231/* Compatibility Error : Volume Type check failed */
232#define IR_LOGINFO_COMPAT_ERROR_VOLUME_TYPE_CHECK_FAILED (0x00010037)
233/* Compatibility Error : Volume Type is unsupported by FW */
234#define IR_LOGINFO_COMPAT_ERROR_UNSUPPORTED_VOLUME_TYPE (0x00010038)
235/* Compatibility Error : Disk drive too small for use in volume */
236#define IR_LOGINFO_COMPAT_ERROR_DISK_TOO_SMALL (0x00010039)
237/* Compatibility Error : Phys disk for Create Volume not found */
238#define IR_LOGINFO_COMPAT_ERROR_PHYS_DISK_NOT_FOUND (0x0001003A)
239/* Compatibility Error : membership count error, too many or too few disks for volume type */
240#define IR_LOGINFO_COMPAT_ERROR_MEMBERSHIP_COUNT (0x0001003B)
241/* Compatibility Error : Disk stripe sizes must be 64KB */
242#define IR_LOGINFO_COMPAT_ERROR_NON_64K_STRIPE_SIZE (0x0001003C)
243/* Compatibility Error : IME size limited to < 2TB */
244#define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D)
245
170 246
171/****************************************************************************/ 247/****************************************************************************/
172/* Defines for convienence */ 248/* Defines for convenience */
173/****************************************************************************/ 249/****************************************************************************/
174#define IOC_LOGINFO_PREFIX_IOP ((MPI_IOCLOGINFO_TYPE_SAS << MPI_IOCLOGINFO_TYPE_SHIFT) | IOC_LOGINFO_ORIGINATOR_IOP) 250#define IOC_LOGINFO_PREFIX_IOP ((MPI_IOCLOGINFO_TYPE_SAS << MPI_IOCLOGINFO_TYPE_SHIFT) | IOC_LOGINFO_ORIGINATOR_IOP)
175#define IOC_LOGINFO_PREFIX_PL ((MPI_IOCLOGINFO_TYPE_SAS << MPI_IOCLOGINFO_TYPE_SHIFT) | IOC_LOGINFO_ORIGINATOR_PL) 251#define IOC_LOGINFO_PREFIX_PL ((MPI_IOCLOGINFO_TYPE_SAS << MPI_IOCLOGINFO_TYPE_SHIFT) | IOC_LOGINFO_ORIGINATOR_PL)
diff --git a/drivers/message/fusion/lsi/mpi_sas.h b/drivers/message/fusion/lsi/mpi_sas.h
index 70514867bddf..50b8f0a8f456 100644
--- a/drivers/message/fusion/lsi/mpi_sas.h
+++ b/drivers/message/fusion/lsi/mpi_sas.h
@@ -6,7 +6,7 @@
6 * Title: MPI Serial Attached SCSI structures and definitions 6 * Title: MPI Serial Attached SCSI structures and definitions
7 * Creation Date: August 19, 2004 7 * Creation Date: August 19, 2004
8 * 8 *
9 * mpi_sas.h Version: 01.05.02 9 * mpi_sas.h Version: 01.05.03
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -17,6 +17,10 @@
17 * 08-30-05 01.05.02 Added DeviceInfo bit for SEP. 17 * 08-30-05 01.05.02 Added DeviceInfo bit for SEP.
18 * Added PrimFlags and Primitive field to SAS IO Unit 18 * Added PrimFlags and Primitive field to SAS IO Unit
19 * Control request, and added a new operation code. 19 * Control request, and added a new operation code.
20 * 03-27-06 01.05.03 Added Force Full Discovery, Transmit Port Select Signal,
21 * and Remove Device operations to SAS IO Unit Control.
22 * Added DevHandle field to SAS IO Unit Control request and
23 * reply.
20 * -------------------------------------------------------------------------- 24 * --------------------------------------------------------------------------
21 */ 25 */
22 26
@@ -209,7 +213,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
209 U8 Reserved1; /* 01h */ 213 U8 Reserved1; /* 01h */
210 U8 ChainOffset; /* 02h */ 214 U8 ChainOffset; /* 02h */
211 U8 Function; /* 03h */ 215 U8 Function; /* 03h */
212 U16 Reserved2; /* 04h */ 216 U16 DevHandle; /* 04h */
213 U8 Reserved3; /* 06h */ 217 U8 Reserved3; /* 06h */
214 U8 MsgFlags; /* 07h */ 218 U8 MsgFlags; /* 07h */
215 U32 MsgContext; /* 08h */ 219 U32 MsgContext; /* 08h */
@@ -231,6 +235,9 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
231#define MPI_SAS_OP_PHY_CLEAR_ERROR_LOG (0x08) 235#define MPI_SAS_OP_PHY_CLEAR_ERROR_LOG (0x08)
232#define MPI_SAS_OP_MAP_CURRENT (0x09) 236#define MPI_SAS_OP_MAP_CURRENT (0x09)
233#define MPI_SAS_OP_SEND_PRIMITIVE (0x0A) 237#define MPI_SAS_OP_SEND_PRIMITIVE (0x0A)
238#define MPI_SAS_OP_FORCE_FULL_DISCOVERY (0x0B)
239#define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C)
240#define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D)
234 241
235/* values for the PrimFlags field */ 242/* values for the PrimFlags field */
236#define MPI_SAS_PRIMFLAGS_SINGLE (0x08) 243#define MPI_SAS_PRIMFLAGS_SINGLE (0x08)
@@ -245,7 +252,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY
245 U8 Reserved1; /* 01h */ 252 U8 Reserved1; /* 01h */
246 U8 MsgLength; /* 02h */ 253 U8 MsgLength; /* 02h */
247 U8 Function; /* 03h */ 254 U8 Function; /* 03h */
248 U16 Reserved2; /* 04h */ 255 U16 DevHandle; /* 04h */
249 U8 Reserved3; /* 06h */ 256 U8 Reserved3; /* 06h */
250 U8 MsgFlags; /* 07h */ 257 U8 MsgFlags; /* 07h */
251 U32 MsgContext; /* 08h */ 258 U32 MsgContext; /* 08h */
diff --git a/drivers/message/fusion/lsi/mpi_targ.h b/drivers/message/fusion/lsi/mpi_targ.h
index 3f462859ceea..20b667315773 100644
--- a/drivers/message/fusion/lsi/mpi_targ.h
+++ b/drivers/message/fusion/lsi/mpi_targ.h
@@ -6,7 +6,7 @@
6 * Title: MPI Target mode messages and structures 6 * Title: MPI Target mode messages and structures
7 * Creation Date: June 22, 2000 7 * Creation Date: June 22, 2000
8 * 8 *
9 * mpi_targ.h Version: 01.05.05 9 * mpi_targ.h Version: 01.05.06
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -54,6 +54,7 @@
54 * 02-22-05 01.05.03 Changed a comment. 54 * 02-22-05 01.05.03 Changed a comment.
55 * 03-11-05 01.05.04 Removed TargetAssistExtended Request. 55 * 03-11-05 01.05.04 Removed TargetAssistExtended Request.
56 * 06-24-05 01.05.05 Added TargetAssistExtended structures and defines. 56 * 06-24-05 01.05.05 Added TargetAssistExtended structures and defines.
57 * 03-27-06 01.05.06 Added a comment.
57 * -------------------------------------------------------------------------- 58 * --------------------------------------------------------------------------
58 */ 59 */
59 60
@@ -351,7 +352,7 @@ typedef struct _MSG_TARGET_ASSIST_REQUEST
351#define TARGET_ASSIST_FLAGS_CONFIRMED (0x08) 352#define TARGET_ASSIST_FLAGS_CONFIRMED (0x08)
352#define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80) 353#define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80)
353 354
354 355/* Standard Target Mode Reply message */
355typedef struct _MSG_TARGET_ERROR_REPLY 356typedef struct _MSG_TARGET_ERROR_REPLY
356{ 357{
357 U16 Reserved; /* 00h */ 358 U16 Reserved; /* 00h */
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 57543603d6c8..43308df64623 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -368,20 +368,21 @@ static irqreturn_t
368mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) 368mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
369{ 369{
370 MPT_ADAPTER *ioc = bus_id; 370 MPT_ADAPTER *ioc = bus_id;
371 u32 pa; 371 u32 pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
372
373 if (pa == 0xFFFFFFFF)
374 return IRQ_NONE;
372 375
373 /* 376 /*
374 * Drain the reply FIFO! 377 * Drain the reply FIFO!
375 */ 378 */
376 while (1) { 379 do {
377 pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo); 380 if (pa & MPI_ADDRESS_REPLY_A_BIT)
378 if (pa == 0xFFFFFFFF)
379 return IRQ_HANDLED;
380 else if (pa & MPI_ADDRESS_REPLY_A_BIT)
381 mpt_reply(ioc, pa); 381 mpt_reply(ioc, pa);
382 else 382 else
383 mpt_turbo_reply(ioc, pa); 383 mpt_turbo_reply(ioc, pa);
384 } 384 pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
385 } while (pa != 0xFFFFFFFF);
385 386
386 return IRQ_HANDLED; 387 return IRQ_HANDLED;
387} 388}
@@ -1219,31 +1220,25 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1219 port = psize = 0; 1220 port = psize = 0;
1220 for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) { 1221 for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) {
1221 if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) { 1222 if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) {
1223 if (psize)
1224 continue;
1222 /* Get I/O space! */ 1225 /* Get I/O space! */
1223 port = pci_resource_start(pdev, ii); 1226 port = pci_resource_start(pdev, ii);
1224 psize = pci_resource_len(pdev,ii); 1227 psize = pci_resource_len(pdev,ii);
1225 } else { 1228 } else {
1229 if (msize)
1230 continue;
1226 /* Get memmap */ 1231 /* Get memmap */
1227 mem_phys = pci_resource_start(pdev, ii); 1232 mem_phys = pci_resource_start(pdev, ii);
1228 msize = pci_resource_len(pdev,ii); 1233 msize = pci_resource_len(pdev,ii);
1229 break;
1230 } 1234 }
1231 } 1235 }
1232 ioc->mem_size = msize; 1236 ioc->mem_size = msize;
1233 1237
1234 if (ii == DEVICE_COUNT_RESOURCE) {
1235 printk(KERN_ERR MYNAM ": ERROR - MPT adapter has no memory regions defined!\n");
1236 kfree(ioc);
1237 return -EINVAL;
1238 }
1239
1240 dinitprintk((KERN_INFO MYNAM ": MPT adapter @ %lx, msize=%dd bytes\n", mem_phys, msize));
1241 dinitprintk((KERN_INFO MYNAM ": (port i/o @ %lx, psize=%dd bytes)\n", port, psize));
1242
1243 mem = NULL; 1238 mem = NULL;
1244 /* Get logical ptr for PciMem0 space */ 1239 /* Get logical ptr for PciMem0 space */
1245 /*mem = ioremap(mem_phys, msize);*/ 1240 /*mem = ioremap(mem_phys, msize);*/
1246 mem = ioremap(mem_phys, 0x100); 1241 mem = ioremap(mem_phys, msize);
1247 if (mem == NULL) { 1242 if (mem == NULL) {
1248 printk(KERN_ERR MYNAM ": ERROR - Unable to map adapter memory!\n"); 1243 printk(KERN_ERR MYNAM ": ERROR - Unable to map adapter memory!\n");
1249 kfree(ioc); 1244 kfree(ioc);
@@ -1343,11 +1338,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1343 ioc->bus_type = SAS; 1338 ioc->bus_type = SAS;
1344 ioc->errata_flag_1064 = 1; 1339 ioc->errata_flag_1064 = 1;
1345 } 1340 }
1346 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1066) {
1347 ioc->prod_name = "LSISAS1066";
1348 ioc->bus_type = SAS;
1349 ioc->errata_flag_1064 = 1;
1350 }
1351 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068) { 1341 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068) {
1352 ioc->prod_name = "LSISAS1068"; 1342 ioc->prod_name = "LSISAS1068";
1353 ioc->bus_type = SAS; 1343 ioc->bus_type = SAS;
@@ -1357,14 +1347,14 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1357 ioc->prod_name = "LSISAS1064E"; 1347 ioc->prod_name = "LSISAS1064E";
1358 ioc->bus_type = SAS; 1348 ioc->bus_type = SAS;
1359 } 1349 }
1360 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1066E) {
1361 ioc->prod_name = "LSISAS1066E";
1362 ioc->bus_type = SAS;
1363 }
1364 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068E) { 1350 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068E) {
1365 ioc->prod_name = "LSISAS1068E"; 1351 ioc->prod_name = "LSISAS1068E";
1366 ioc->bus_type = SAS; 1352 ioc->bus_type = SAS;
1367 } 1353 }
1354 else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) {
1355 ioc->prod_name = "LSISAS1078";
1356 ioc->bus_type = SAS;
1357 }
1368 1358
1369 if (ioc->errata_flag_1064) 1359 if (ioc->errata_flag_1064)
1370 pci_disable_io_access(pdev); 1360 pci_disable_io_access(pdev);
@@ -3184,6 +3174,37 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3184 u32 diag1val = 0; 3174 u32 diag1val = 0;
3185#endif 3175#endif
3186 3176
3177 if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) {
3178 drsprintk((MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset "
3179 "address=%p\n", ioc->name, __FUNCTION__,
3180 &ioc->chip->Doorbell, &ioc->chip->Reset_1078));
3181 CHIPREG_WRITE32(&ioc->chip->Reset_1078, 0x07);
3182 if (sleepFlag == CAN_SLEEP)
3183 msleep(1);
3184 else
3185 mdelay(1);
3186
3187 for (count = 0; count < 60; count ++) {
3188 doorbell = CHIPREG_READ32(&ioc->chip->Doorbell);
3189 doorbell &= MPI_IOC_STATE_MASK;
3190
3191 drsprintk((MYIOC_s_INFO_FMT
3192 "looking for READY STATE: doorbell=%x"
3193 " count=%d\n",
3194 ioc->name, doorbell, count));
3195 if (doorbell == MPI_IOC_STATE_READY) {
3196 return 0;
3197 }
3198
3199 /* wait 1 sec */
3200 if (sleepFlag == CAN_SLEEP)
3201 msleep(1000);
3202 else
3203 mdelay(1000);
3204 }
3205 return -1;
3206 }
3207
3187 /* Clear any existing interrupts */ 3208 /* Clear any existing interrupts */
3188 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 3209 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
3189 3210
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 32ae4d664545..a5ce10b67d02 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -75,8 +75,8 @@
75#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR 75#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
76#endif 76#endif
77 77
78#define MPT_LINUX_VERSION_COMMON "3.03.10" 78#define MPT_LINUX_VERSION_COMMON "3.04.00"
79#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.10" 79#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.00"
80#define WHAT_MAGIC_STRING "@" "(" "#" ")" 80#define WHAT_MAGIC_STRING "@" "(" "#" ")"
81 81
82#define show_mptmod_ver(s,ver) \ 82#define show_mptmod_ver(s,ver) \
@@ -307,7 +307,8 @@ typedef struct _SYSIF_REGS
307 u32 HostIndex; /* 50 Host Index register */ 307 u32 HostIndex; /* 50 Host Index register */
308 u32 Reserved4[15]; /* 54-8F */ 308 u32 Reserved4[15]; /* 54-8F */
309 u32 Fubar; /* 90 For Fubar usage */ 309 u32 Fubar; /* 90 For Fubar usage */
310 u32 Reserved5[27]; /* 94-FF */ 310 u32 Reserved5[1050];/* 94-10F8 */
311 u32 Reset_1078; /* 10FC Reset 1078 */
311} SYSIF_REGS; 312} SYSIF_REGS;
312 313
313/* 314/*
@@ -341,6 +342,7 @@ typedef struct _VirtTarget {
341 u8 negoFlags; /* bit field, see above */ 342 u8 negoFlags; /* bit field, see above */
342 u8 raidVolume; /* set, if RAID Volume */ 343 u8 raidVolume; /* set, if RAID Volume */
343 u8 type; /* byte 0 of Inquiry data */ 344 u8 type; /* byte 0 of Inquiry data */
345 u8 deleted; /* target in process of being removed */
344 u32 num_luns; 346 u32 num_luns;
345 u32 luns[8]; /* Max LUNs is 256 */ 347 u32 luns[8]; /* Max LUNs is 256 */
346} VirtTarget; 348} VirtTarget;
@@ -629,10 +631,11 @@ typedef struct _MPT_ADAPTER
629 struct mutex sas_discovery_mutex; 631 struct mutex sas_discovery_mutex;
630 u8 sas_discovery_runtime; 632 u8 sas_discovery_runtime;
631 u8 sas_discovery_ignore_events; 633 u8 sas_discovery_ignore_events;
634 u16 handle;
632 int sas_index; /* index refrencing */ 635 int sas_index; /* index refrencing */
633 MPT_SAS_MGMT sas_mgmt; 636 MPT_SAS_MGMT sas_mgmt;
634 int num_ports; 637 int num_ports;
635 struct work_struct mptscsih_persistTask; 638 struct work_struct sas_persist_task;
636 639
637 struct work_struct fc_setup_reset_work; 640 struct work_struct fc_setup_reset_work;
638 struct list_head fc_rports; 641 struct list_head fc_rports;
@@ -641,6 +644,7 @@ typedef struct _MPT_ADAPTER
641 struct work_struct fc_rescan_work; 644 struct work_struct fc_rescan_work;
642 char fc_rescan_work_q_name[KOBJ_NAME_LEN]; 645 char fc_rescan_work_q_name[KOBJ_NAME_LEN];
643 struct workqueue_struct *fc_rescan_work_q; 646 struct workqueue_struct *fc_rescan_work_q;
647 u8 port_serial_number;
644} MPT_ADAPTER; 648} MPT_ADAPTER;
645 649
646/* 650/*
@@ -892,6 +896,13 @@ typedef struct _mpt_sge {
892#define DBG_DUMP_REQUEST_FRAME_HDR(mfp) 896#define DBG_DUMP_REQUEST_FRAME_HDR(mfp)
893#endif 897#endif
894 898
899// debug sas wide ports
900#ifdef MPT_DEBUG_SAS_WIDE
901#define dsaswideprintk(x) printk x
902#else
903#define dsaswideprintk(x)
904#endif
905
895 906
896/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 907/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
897 908
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 3ff8378ea660..a8f2fa985455 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -132,21 +132,21 @@ static struct scsi_host_template mptfc_driver_template = {
132 */ 132 */
133 133
134static struct pci_device_id mptfc_pci_table[] = { 134static struct pci_device_id mptfc_pci_table[] = {
135 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC909, 135 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC909,
136 PCI_ANY_ID, PCI_ANY_ID }, 136 PCI_ANY_ID, PCI_ANY_ID },
137 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC919, 137 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC919,
138 PCI_ANY_ID, PCI_ANY_ID }, 138 PCI_ANY_ID, PCI_ANY_ID },
139 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC929, 139 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC929,
140 PCI_ANY_ID, PCI_ANY_ID }, 140 PCI_ANY_ID, PCI_ANY_ID },
141 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC919X, 141 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC919X,
142 PCI_ANY_ID, PCI_ANY_ID }, 142 PCI_ANY_ID, PCI_ANY_ID },
143 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC929X, 143 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC929X,
144 PCI_ANY_ID, PCI_ANY_ID }, 144 PCI_ANY_ID, PCI_ANY_ID },
145 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC939X, 145 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC939X,
146 PCI_ANY_ID, PCI_ANY_ID }, 146 PCI_ANY_ID, PCI_ANY_ID },
147 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC949X, 147 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC949X,
148 PCI_ANY_ID, PCI_ANY_ID }, 148 PCI_ANY_ID, PCI_ANY_ID },
149 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC949ES, 149 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC949E,
150 PCI_ANY_ID, PCI_ANY_ID }, 150 PCI_ANY_ID, PCI_ANY_ID },
151 {0} /* Terminating entry */ 151 {0} /* Terminating entry */
152}; 152};
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 85689ab46cbc..f7bd8b11ed3b 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -50,11 +50,14 @@
50#include <linux/errno.h> 50#include <linux/errno.h>
51#include <linux/sched.h> 51#include <linux/sched.h>
52#include <linux/workqueue.h> 52#include <linux/workqueue.h>
53#include <linux/delay.h> /* for mdelay */
53 54
55#include <scsi/scsi.h>
54#include <scsi/scsi_cmnd.h> 56#include <scsi/scsi_cmnd.h>
55#include <scsi/scsi_device.h> 57#include <scsi/scsi_device.h>
56#include <scsi/scsi_host.h> 58#include <scsi/scsi_host.h>
57#include <scsi/scsi_transport_sas.h> 59#include <scsi/scsi_transport_sas.h>
60#include <scsi/scsi_dbg.h>
58 61
59#include "mptbase.h" 62#include "mptbase.h"
60#include "mptscsih.h" 63#include "mptscsih.h"
@@ -137,23 +140,37 @@ struct mptsas_devinfo {
137 u32 device_info; /* bitfield detailed info about this device */ 140 u32 device_info; /* bitfield detailed info about this device */
138}; 141};
139 142
143/*
144 * Specific details on ports, wide/narrow
145 */
146struct mptsas_portinfo_details{
147 u8 port_id; /* port number provided to transport */
148 u16 num_phys; /* number of phys belong to this port */
149 u64 phy_bitmask; /* TODO, extend support for 255 phys */
150 struct sas_rphy *rphy; /* transport layer rphy object */
151 struct sas_port *port; /* transport layer port object */
152 struct scsi_target *starget;
153 struct mptsas_portinfo *port_info;
154};
155
140struct mptsas_phyinfo { 156struct mptsas_phyinfo {
141 u8 phy_id; /* phy index */ 157 u8 phy_id; /* phy index */
142 u8 port_id; /* port number this phy is part of */ 158 u8 port_id; /* firmware port identifier */
143 u8 negotiated_link_rate; /* nego'd link rate for this phy */ 159 u8 negotiated_link_rate; /* nego'd link rate for this phy */
144 u8 hw_link_rate; /* hardware max/min phys link rate */ 160 u8 hw_link_rate; /* hardware max/min phys link rate */
145 u8 programmed_link_rate; /* programmed max/min phy link rate */ 161 u8 programmed_link_rate; /* programmed max/min phy link rate */
162 u8 sas_port_add_phy; /* flag to request sas_port_add_phy*/
146 struct mptsas_devinfo identify; /* point to phy device info */ 163 struct mptsas_devinfo identify; /* point to phy device info */
147 struct mptsas_devinfo attached; /* point to attached device info */ 164 struct mptsas_devinfo attached; /* point to attached device info */
148 struct sas_phy *phy; 165 struct sas_phy *phy; /* transport layer phy object */
149 struct sas_rphy *rphy; 166 struct mptsas_portinfo *portinfo;
150 struct scsi_target *starget; 167 struct mptsas_portinfo_details * port_details;
151}; 168};
152 169
153struct mptsas_portinfo { 170struct mptsas_portinfo {
154 struct list_head list; 171 struct list_head list;
155 u16 handle; /* unique id to address this */ 172 u16 handle; /* unique id to address this */
156 u8 num_phys; /* number of phys */ 173 u16 num_phys; /* number of phys */
157 struct mptsas_phyinfo *phy_info; 174 struct mptsas_phyinfo *phy_info;
158}; 175};
159 176
@@ -169,7 +186,7 @@ struct mptsas_enclosure {
169 u8 sep_channel; /* SEP channel logical channel id */ 186 u8 sep_channel; /* SEP channel logical channel id */
170}; 187};
171 188
172#ifdef SASDEBUG 189#ifdef MPT_DEBUG_SAS
173static void mptsas_print_phy_data(MPI_SAS_IO_UNIT0_PHY_DATA *phy_data) 190static void mptsas_print_phy_data(MPI_SAS_IO_UNIT0_PHY_DATA *phy_data)
174{ 191{
175 printk("---- IO UNIT PAGE 0 ------------\n"); 192 printk("---- IO UNIT PAGE 0 ------------\n");
@@ -305,7 +322,7 @@ mptsas_find_portinfo_by_handle(MPT_ADAPTER *ioc, u16 handle)
305static inline int 322static inline int
306mptsas_is_end_device(struct mptsas_devinfo * attached) 323mptsas_is_end_device(struct mptsas_devinfo * attached)
307{ 324{
308 if ((attached->handle) && 325 if ((attached->sas_address) &&
309 (attached->device_info & 326 (attached->device_info &
310 MPI_SAS_DEVICE_INFO_END_DEVICE) && 327 MPI_SAS_DEVICE_INFO_END_DEVICE) &&
311 ((attached->device_info & 328 ((attached->device_info &
@@ -319,6 +336,253 @@ mptsas_is_end_device(struct mptsas_devinfo * attached)
319 return 0; 336 return 0;
320} 337}
321 338
339/* no mutex */
340static void
341mptsas_port_delete(struct mptsas_portinfo_details * port_details)
342{
343 struct mptsas_portinfo *port_info;
344 struct mptsas_phyinfo *phy_info;
345 u8 i;
346
347 if (!port_details)
348 return;
349
350 port_info = port_details->port_info;
351 phy_info = port_info->phy_info;
352
353 dsaswideprintk((KERN_DEBUG "%s: [%p]: port=%02d num_phys=%02d "
354 "bitmask=0x%016llX\n",
355 __FUNCTION__, port_details, port_details->port_id,
356 port_details->num_phys, port_details->phy_bitmask));
357
358 for (i = 0; i < port_info->num_phys; i++, phy_info++) {
359 if(phy_info->port_details != port_details)
360 continue;
361 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo));
362 phy_info->port_details = NULL;
363 }
364 kfree(port_details);
365}
366
367static inline struct sas_rphy *
368mptsas_get_rphy(struct mptsas_phyinfo *phy_info)
369{
370 if (phy_info->port_details)
371 return phy_info->port_details->rphy;
372 else
373 return NULL;
374}
375
376static inline void
377mptsas_set_rphy(struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy)
378{
379 if (phy_info->port_details) {
380 phy_info->port_details->rphy = rphy;
381 dsaswideprintk((KERN_DEBUG "sas_rphy_add: rphy=%p\n", rphy));
382 }
383
384#ifdef MPT_DEBUG_SAS_WIDE
385 if (rphy) {
386 dev_printk(KERN_DEBUG, &rphy->dev, "add:");
387 printk("rphy=%p release=%p\n",
388 rphy, rphy->dev.release);
389 }
390#endif
391}
392
393static inline struct sas_port *
394mptsas_get_port(struct mptsas_phyinfo *phy_info)
395{
396 if (phy_info->port_details)
397 return phy_info->port_details->port;
398 else
399 return NULL;
400}
401
402static inline void
403mptsas_set_port(struct mptsas_phyinfo *phy_info, struct sas_port *port)
404{
405 if (phy_info->port_details)
406 phy_info->port_details->port = port;
407
408#ifdef MPT_DEBUG_SAS_WIDE
409 if (port) {
410 dev_printk(KERN_DEBUG, &port->dev, "add: ");
411 printk("port=%p release=%p\n",
412 port, port->dev.release);
413 }
414#endif
415}
416
417static inline struct scsi_target *
418mptsas_get_starget(struct mptsas_phyinfo *phy_info)
419{
420 if (phy_info->port_details)
421 return phy_info->port_details->starget;
422 else
423 return NULL;
424}
425
426static inline void
427mptsas_set_starget(struct mptsas_phyinfo *phy_info, struct scsi_target *
428starget)
429{
430 if (phy_info->port_details)
431 phy_info->port_details->starget = starget;
432}
433
434
435/*
436 * mptsas_setup_wide_ports
437 *
438 * Updates for new and existing narrow/wide port configuration
439 * in the sas_topology
440 */
441static void
442mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
443{
444 struct mptsas_portinfo_details * port_details;
445 struct mptsas_phyinfo *phy_info, *phy_info_cmp;
446 u64 sas_address;
447 int i, j;
448
449 mutex_lock(&ioc->sas_topology_mutex);
450
451 phy_info = port_info->phy_info;
452 for (i = 0 ; i < port_info->num_phys ; i++, phy_info++) {
453 if (phy_info->attached.handle)
454 continue;
455 port_details = phy_info->port_details;
456 if (!port_details)
457 continue;
458 if (port_details->num_phys < 2)
459 continue;
460 /*
461 * Removing a phy from a port, letting the last
462 * phy be removed by firmware events.
463 */
464 dsaswideprintk((KERN_DEBUG
465 "%s: [%p]: port=%d deleting phy = %d\n",
466 __FUNCTION__, port_details,
467 port_details->port_id, i));
468 port_details->num_phys--;
469 port_details->phy_bitmask &= ~ (1 << phy_info->phy_id);
470 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo));
471 sas_port_delete_phy(port_details->port, phy_info->phy);
472 phy_info->port_details = NULL;
473 }
474
475 /*
476 * Populate and refresh the tree
477 */
478 phy_info = port_info->phy_info;
479 for (i = 0 ; i < port_info->num_phys ; i++, phy_info++) {
480 sas_address = phy_info->attached.sas_address;
481 dsaswideprintk((KERN_DEBUG "phy_id=%d sas_address=0x%018llX\n",
482 i, sas_address));
483 if (!sas_address)
484 continue;
485 port_details = phy_info->port_details;
486 /*
487 * Forming a port
488 */
489 if (!port_details) {
490 port_details = kzalloc(sizeof(*port_details),
491 GFP_KERNEL);
492 if (!port_details)
493 goto out;
494 port_details->num_phys = 1;
495 port_details->port_info = port_info;
496 port_details->port_id = ioc->port_serial_number++;
497 if (phy_info->phy_id < 64 )
498 port_details->phy_bitmask |=
499 (1 << phy_info->phy_id);
500 phy_info->sas_port_add_phy=1;
501 dsaswideprintk((KERN_DEBUG "\t\tForming port\n\t\t"
502 "phy_id=%d sas_address=0x%018llX\n",
503 i, sas_address));
504 phy_info->port_details = port_details;
505 }
506
507 if (i == port_info->num_phys - 1)
508 continue;
509 phy_info_cmp = &port_info->phy_info[i + 1];
510 for (j = i + 1 ; j < port_info->num_phys ; j++,
511 phy_info_cmp++) {
512 if (!phy_info_cmp->attached.sas_address)
513 continue;
514 if (sas_address != phy_info_cmp->attached.sas_address)
515 continue;
516 if (phy_info_cmp->port_details == port_details )
517 continue;
518 dsaswideprintk((KERN_DEBUG
519 "\t\tphy_id=%d sas_address=0x%018llX\n",
520 j, phy_info_cmp->attached.sas_address));
521 if (phy_info_cmp->port_details) {
522 port_details->rphy =
523 mptsas_get_rphy(phy_info_cmp);
524 port_details->port =
525 mptsas_get_port(phy_info_cmp);
526 port_details->starget =
527 mptsas_get_starget(phy_info_cmp);
528 port_details->port_id =
529 phy_info_cmp->port_details->port_id;
530 port_details->num_phys =
531 phy_info_cmp->port_details->num_phys;
532// port_info->port_serial_number--;
533 ioc->port_serial_number--;
534 if (!phy_info_cmp->port_details->num_phys)
535 kfree(phy_info_cmp->port_details);
536 } else
537 phy_info_cmp->sas_port_add_phy=1;
538 /*
539 * Adding a phy to a port
540 */
541 phy_info_cmp->port_details = port_details;
542 if (phy_info_cmp->phy_id < 64 )
543 port_details->phy_bitmask |=
544 (1 << phy_info_cmp->phy_id);
545 port_details->num_phys++;
546 }
547 }
548
549 out:
550
551#ifdef MPT_DEBUG_SAS_WIDE
552 for (i = 0; i < port_info->num_phys; i++) {
553 port_details = port_info->phy_info[i].port_details;
554 if (!port_details)
555 continue;
556 dsaswideprintk((KERN_DEBUG
557 "%s: [%p]: phy_id=%02d port_id=%02d num_phys=%02d "
558 "bitmask=0x%016llX\n",
559 __FUNCTION__,
560 port_details, i, port_details->port_id,
561 port_details->num_phys, port_details->phy_bitmask));
562 dsaswideprintk((KERN_DEBUG"\t\tport = %p rphy=%p\n",
563 port_details->port, port_details->rphy));
564 }
565 dsaswideprintk((KERN_DEBUG"\n"));
566#endif
567 mutex_unlock(&ioc->sas_topology_mutex);
568}
569
570static void
571mptsas_target_reset(MPT_ADAPTER *ioc, VirtTarget * vtarget)
572{
573 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata;
574
575 if (mptscsih_TMHandler(hd,
576 MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
577 vtarget->bus_id, vtarget->target_id, 0, 0, 5) < 0) {
578 hd->tmPending = 0;
579 hd->tmState = TM_STATE_NONE;
580 printk(MYIOC_s_WARN_FMT
581 "Error processing TaskMgmt id=%d TARGET_RESET\n",
582 ioc->name, vtarget->target_id);
583 }
584}
585
322static int 586static int
323mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure, 587mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
324 u32 form, u32 form_specific) 588 u32 form, u32 form_specific)
@@ -400,11 +664,105 @@ mptsas_slave_configure(struct scsi_device *sdev)
400 return mptscsih_slave_configure(sdev); 664 return mptscsih_slave_configure(sdev);
401} 665}
402 666
403/* 667static int
404 * This is pretty ugly. We will be able to seriously clean it up 668mptsas_target_alloc(struct scsi_target *starget)
405 * once the DV code in mptscsih goes away and we can properly 669{
406 * implement ->target_alloc. 670 struct Scsi_Host *host = dev_to_shost(&starget->dev);
407 */ 671 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
672 VirtTarget *vtarget;
673 u32 target_id;
674 u32 channel;
675 struct sas_rphy *rphy;
676 struct mptsas_portinfo *p;
677 int i;
678
679 vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL);
680 if (!vtarget)
681 return -ENOMEM;
682
683 vtarget->starget = starget;
684 vtarget->ioc_id = hd->ioc->id;
685 vtarget->tflags = MPT_TARGET_FLAGS_Q_YES|MPT_TARGET_FLAGS_VALID_INQUIRY;
686
687 target_id = starget->id;
688 channel = 0;
689
690 hd->Targets[target_id] = vtarget;
691
692 /*
693 * RAID volumes placed beyond the last expected port.
694 */
695 if (starget->channel == hd->ioc->num_ports)
696 goto out;
697
698 rphy = dev_to_rphy(starget->dev.parent);
699 mutex_lock(&hd->ioc->sas_topology_mutex);
700 list_for_each_entry(p, &hd->ioc->sas_topology, list) {
701 for (i = 0; i < p->num_phys; i++) {
702 if (p->phy_info[i].attached.sas_address !=
703 rphy->identify.sas_address)
704 continue;
705 target_id = p->phy_info[i].attached.id;
706 channel = p->phy_info[i].attached.channel;
707 mptsas_set_starget(&p->phy_info[i], starget);
708
709 /*
710 * Exposing hidden raid components
711 */
712 if (mptscsih_is_phys_disk(hd->ioc, target_id)) {
713 target_id = mptscsih_raid_id_to_num(hd,
714 target_id);
715 vtarget->tflags |=
716 MPT_TARGET_FLAGS_RAID_COMPONENT;
717 }
718 mutex_unlock(&hd->ioc->sas_topology_mutex);
719 goto out;
720 }
721 }
722 mutex_unlock(&hd->ioc->sas_topology_mutex);
723
724 kfree(vtarget);
725 return -ENXIO;
726
727 out:
728 vtarget->target_id = target_id;
729 vtarget->bus_id = channel;
730 starget->hostdata = vtarget;
731 return 0;
732}
733
734static void
735mptsas_target_destroy(struct scsi_target *starget)
736{
737 struct Scsi_Host *host = dev_to_shost(&starget->dev);
738 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
739 struct sas_rphy *rphy;
740 struct mptsas_portinfo *p;
741 int i;
742
743 if (!starget->hostdata)
744 return;
745
746 if (starget->channel == hd->ioc->num_ports)
747 goto out;
748
749 rphy = dev_to_rphy(starget->dev.parent);
750 list_for_each_entry(p, &hd->ioc->sas_topology, list) {
751 for (i = 0; i < p->num_phys; i++) {
752 if (p->phy_info[i].attached.sas_address !=
753 rphy->identify.sas_address)
754 continue;
755 mptsas_set_starget(&p->phy_info[i], NULL);
756 goto out;
757 }
758 }
759
760 out:
761 kfree(starget->hostdata);
762 starget->hostdata = NULL;
763}
764
765
408static int 766static int
409mptsas_slave_alloc(struct scsi_device *sdev) 767mptsas_slave_alloc(struct scsi_device *sdev)
410{ 768{
@@ -412,61 +770,41 @@ mptsas_slave_alloc(struct scsi_device *sdev)
412 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; 770 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
413 struct sas_rphy *rphy; 771 struct sas_rphy *rphy;
414 struct mptsas_portinfo *p; 772 struct mptsas_portinfo *p;
415 VirtTarget *vtarget;
416 VirtDevice *vdev; 773 VirtDevice *vdev;
417 struct scsi_target *starget; 774 struct scsi_target *starget;
418 u32 target_id; 775 int i;
419 int i;
420 776
421 vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL); 777 vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
422 if (!vdev) { 778 if (!vdev) {
423 printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", 779 printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n",
424 hd->ioc->name, sizeof(VirtDevice)); 780 hd->ioc->name, sizeof(VirtDevice));
425 return -ENOMEM; 781 return -ENOMEM;
426 } 782 }
427 sdev->hostdata = vdev;
428 starget = scsi_target(sdev); 783 starget = scsi_target(sdev);
429 vtarget = starget->hostdata; 784 vdev->vtarget = starget->hostdata;
430 vtarget->ioc_id = hd->ioc->id;
431 vdev->vtarget = vtarget;
432 if (vtarget->num_luns == 0) {
433 vtarget->tflags = MPT_TARGET_FLAGS_Q_YES|MPT_TARGET_FLAGS_VALID_INQUIRY;
434 hd->Targets[sdev->id] = vtarget;
435 }
436 785
437 /* 786 /*
438 RAID volumes placed beyond the last expected port. 787 * RAID volumes placed beyond the last expected port.
439 */ 788 */
440 if (sdev->channel == hd->ioc->num_ports) { 789 if (sdev->channel == hd->ioc->num_ports)
441 target_id = sdev->id;
442 vtarget->bus_id = 0;
443 vdev->lun = 0;
444 goto out; 790 goto out;
445 }
446 791
447 rphy = dev_to_rphy(sdev->sdev_target->dev.parent); 792 rphy = dev_to_rphy(sdev->sdev_target->dev.parent);
448 mutex_lock(&hd->ioc->sas_topology_mutex); 793 mutex_lock(&hd->ioc->sas_topology_mutex);
449 list_for_each_entry(p, &hd->ioc->sas_topology, list) { 794 list_for_each_entry(p, &hd->ioc->sas_topology, list) {
450 for (i = 0; i < p->num_phys; i++) { 795 for (i = 0; i < p->num_phys; i++) {
451 if (p->phy_info[i].attached.sas_address == 796 if (p->phy_info[i].attached.sas_address !=
452 rphy->identify.sas_address) { 797 rphy->identify.sas_address)
453 target_id = p->phy_info[i].attached.id; 798 continue;
454 vtarget->bus_id = p->phy_info[i].attached.channel; 799 vdev->lun = sdev->lun;
455 vdev->lun = sdev->lun; 800 /*
456 p->phy_info[i].starget = sdev->sdev_target; 801 * Exposing hidden raid components
457 /* 802 */
458 * Exposing hidden disk (RAID) 803 if (mptscsih_is_phys_disk(hd->ioc,
459 */ 804 p->phy_info[i].attached.id))
460 if (mptscsih_is_phys_disk(hd->ioc, target_id)) { 805 sdev->no_uld_attach = 1;
461 target_id = mptscsih_raid_id_to_num(hd, 806 mutex_unlock(&hd->ioc->sas_topology_mutex);
462 target_id); 807 goto out;
463 vdev->vtarget->tflags |=
464 MPT_TARGET_FLAGS_RAID_COMPONENT;
465 sdev->no_uld_attach = 1;
466 }
467 mutex_unlock(&hd->ioc->sas_topology_mutex);
468 goto out;
469 }
470 } 808 }
471 } 809 }
472 mutex_unlock(&hd->ioc->sas_topology_mutex); 810 mutex_unlock(&hd->ioc->sas_topology_mutex);
@@ -475,57 +813,39 @@ mptsas_slave_alloc(struct scsi_device *sdev)
475 return -ENXIO; 813 return -ENXIO;
476 814
477 out: 815 out:
478 vtarget->target_id = target_id; 816 vdev->vtarget->num_luns++;
479 vtarget->num_luns++; 817 sdev->hostdata = vdev;
480 return 0; 818 return 0;
481} 819}
482 820
483static void 821static int
484mptsas_slave_destroy(struct scsi_device *sdev) 822mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
485{ 823{
486 struct Scsi_Host *host = sdev->host; 824 VirtDevice *vdev = SCpnt->device->hostdata;
487 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
488 VirtDevice *vdev;
489 825
490 /* 826// scsi_print_command(SCpnt);
491 * Issue target reset to flush firmware outstanding commands. 827 if (vdev->vtarget->deleted) {
492 */ 828 SCpnt->result = DID_NO_CONNECT << 16;
493 vdev = sdev->hostdata; 829 done(SCpnt);
494 if (vdev->configured_lun){ 830 return 0;
495 if (mptscsih_TMHandler(hd,
496 MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
497 vdev->vtarget->bus_id,
498 vdev->vtarget->target_id,
499 0, 0, 5 /* 5 second timeout */)
500 < 0){
501
502 /* The TM request failed!
503 * Fatal error case.
504 */
505 printk(MYIOC_s_WARN_FMT
506 "Error processing TaskMgmt id=%d TARGET_RESET\n",
507 hd->ioc->name,
508 vdev->vtarget->target_id);
509
510 hd->tmPending = 0;
511 hd->tmState = TM_STATE_NONE;
512 }
513 } 831 }
514 mptscsih_slave_destroy(sdev); 832
833 return mptscsih_qcmd(SCpnt,done);
515} 834}
516 835
836
517static struct scsi_host_template mptsas_driver_template = { 837static struct scsi_host_template mptsas_driver_template = {
518 .module = THIS_MODULE, 838 .module = THIS_MODULE,
519 .proc_name = "mptsas", 839 .proc_name = "mptsas",
520 .proc_info = mptscsih_proc_info, 840 .proc_info = mptscsih_proc_info,
521 .name = "MPT SPI Host", 841 .name = "MPT SPI Host",
522 .info = mptscsih_info, 842 .info = mptscsih_info,
523 .queuecommand = mptscsih_qcmd, 843 .queuecommand = mptsas_qcmd,
524 .target_alloc = mptscsih_target_alloc, 844 .target_alloc = mptsas_target_alloc,
525 .slave_alloc = mptsas_slave_alloc, 845 .slave_alloc = mptsas_slave_alloc,
526 .slave_configure = mptsas_slave_configure, 846 .slave_configure = mptsas_slave_configure,
527 .target_destroy = mptscsih_target_destroy, 847 .target_destroy = mptsas_target_destroy,
528 .slave_destroy = mptsas_slave_destroy, 848 .slave_destroy = mptscsih_slave_destroy,
529 .change_queue_depth = mptscsih_change_queue_depth, 849 .change_queue_depth = mptscsih_change_queue_depth,
530 .eh_abort_handler = mptscsih_abort, 850 .eh_abort_handler = mptscsih_abort,
531 .eh_device_reset_handler = mptscsih_dev_reset, 851 .eh_device_reset_handler = mptscsih_dev_reset,
@@ -795,7 +1115,7 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
795 1115
796 port_info->num_phys = buffer->NumPhys; 1116 port_info->num_phys = buffer->NumPhys;
797 port_info->phy_info = kcalloc(port_info->num_phys, 1117 port_info->phy_info = kcalloc(port_info->num_phys,
798 sizeof(struct mptsas_phyinfo),GFP_KERNEL); 1118 sizeof(*port_info->phy_info),GFP_KERNEL);
799 if (!port_info->phy_info) { 1119 if (!port_info->phy_info) {
800 error = -ENOMEM; 1120 error = -ENOMEM;
801 goto out_free_consistent; 1121 goto out_free_consistent;
@@ -811,6 +1131,7 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
811 buffer->PhyData[i].Port; 1131 buffer->PhyData[i].Port;
812 port_info->phy_info[i].negotiated_link_rate = 1132 port_info->phy_info[i].negotiated_link_rate =
813 buffer->PhyData[i].NegotiatedLinkRate; 1133 buffer->PhyData[i].NegotiatedLinkRate;
1134 port_info->phy_info[i].portinfo = port_info;
814 } 1135 }
815 1136
816 out_free_consistent: 1137 out_free_consistent:
@@ -968,7 +1289,7 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
968 CONFIGPARMS cfg; 1289 CONFIGPARMS cfg;
969 SasExpanderPage0_t *buffer; 1290 SasExpanderPage0_t *buffer;
970 dma_addr_t dma_handle; 1291 dma_addr_t dma_handle;
971 int error; 1292 int i, error;
972 1293
973 hdr.PageVersion = MPI_SASEXPANDER0_PAGEVERSION; 1294 hdr.PageVersion = MPI_SASEXPANDER0_PAGEVERSION;
974 hdr.ExtPageLength = 0; 1295 hdr.ExtPageLength = 0;
@@ -1013,12 +1334,15 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
1013 port_info->num_phys = buffer->NumPhys; 1334 port_info->num_phys = buffer->NumPhys;
1014 port_info->handle = le16_to_cpu(buffer->DevHandle); 1335 port_info->handle = le16_to_cpu(buffer->DevHandle);
1015 port_info->phy_info = kcalloc(port_info->num_phys, 1336 port_info->phy_info = kcalloc(port_info->num_phys,
1016 sizeof(struct mptsas_phyinfo),GFP_KERNEL); 1337 sizeof(*port_info->phy_info),GFP_KERNEL);
1017 if (!port_info->phy_info) { 1338 if (!port_info->phy_info) {
1018 error = -ENOMEM; 1339 error = -ENOMEM;
1019 goto out_free_consistent; 1340 goto out_free_consistent;
1020 } 1341 }
1021 1342
1343 for (i = 0; i < port_info->num_phys; i++)
1344 port_info->phy_info[i].portinfo = port_info;
1345
1022 out_free_consistent: 1346 out_free_consistent:
1023 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 1347 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
1024 buffer, dma_handle); 1348 buffer, dma_handle);
@@ -1161,19 +1485,23 @@ static int mptsas_probe_one_phy(struct device *dev,
1161{ 1485{
1162 MPT_ADAPTER *ioc; 1486 MPT_ADAPTER *ioc;
1163 struct sas_phy *phy; 1487 struct sas_phy *phy;
1164 int error; 1488 struct sas_port *port;
1489 int error = 0;
1165 1490
1166 if (!dev) 1491 if (!dev) {
1167 return -ENODEV; 1492 error = -ENODEV;
1493 goto out;
1494 }
1168 1495
1169 if (!phy_info->phy) { 1496 if (!phy_info->phy) {
1170 phy = sas_phy_alloc(dev, index); 1497 phy = sas_phy_alloc(dev, index);
1171 if (!phy) 1498 if (!phy) {
1172 return -ENOMEM; 1499 error = -ENOMEM;
1500 goto out;
1501 }
1173 } else 1502 } else
1174 phy = phy_info->phy; 1503 phy = phy_info->phy;
1175 1504
1176 phy->port_identifier = phy_info->port_id;
1177 mptsas_parse_device_info(&phy->identify, &phy_info->identify); 1505 mptsas_parse_device_info(&phy->identify, &phy_info->identify);
1178 1506
1179 /* 1507 /*
@@ -1265,19 +1593,52 @@ static int mptsas_probe_one_phy(struct device *dev,
1265 error = sas_phy_add(phy); 1593 error = sas_phy_add(phy);
1266 if (error) { 1594 if (error) {
1267 sas_phy_free(phy); 1595 sas_phy_free(phy);
1268 return error; 1596 goto out;
1269 } 1597 }
1270 phy_info->phy = phy; 1598 phy_info->phy = phy;
1271 } 1599 }
1272 1600
1273 if ((phy_info->attached.handle) && 1601 if (!phy_info->attached.handle ||
1274 (!phy_info->rphy)) { 1602 !phy_info->port_details)
1603 goto out;
1604
1605 port = mptsas_get_port(phy_info);
1606 ioc = phy_to_ioc(phy_info->phy);
1607
1608 if (phy_info->sas_port_add_phy) {
1609
1610 if (!port) {
1611 port = sas_port_alloc(dev,
1612 phy_info->port_details->port_id);
1613 dsaswideprintk((KERN_DEBUG
1614 "sas_port_alloc: port=%p dev=%p port_id=%d\n",
1615 port, dev, phy_info->port_details->port_id));
1616 if (!port) {
1617 error = -ENOMEM;
1618 goto out;
1619 }
1620 error = sas_port_add(port);
1621 if (error) {
1622 dfailprintk((MYIOC_s_ERR_FMT
1623 "%s: exit at line=%d\n", ioc->name,
1624 __FUNCTION__, __LINE__));
1625 goto out;
1626 }
1627 mptsas_set_port(phy_info, port);
1628 }
1629 dsaswideprintk((KERN_DEBUG "sas_port_add_phy: phy_id=%d\n",
1630 phy_info->phy_id));
1631 sas_port_add_phy(port, phy_info->phy);
1632 phy_info->sas_port_add_phy = 0;
1633 }
1634
1635 if (!mptsas_get_rphy(phy_info) && port && !port->rphy) {
1275 1636
1276 struct sas_rphy *rphy; 1637 struct sas_rphy *rphy;
1638 struct device *parent;
1277 struct sas_identify identify; 1639 struct sas_identify identify;
1278 1640
1279 ioc = phy_to_ioc(phy_info->phy); 1641 parent = dev->parent->parent;
1280
1281 /* 1642 /*
1282 * Let the hotplug_work thread handle processing 1643 * Let the hotplug_work thread handle processing
1283 * the adding/removing of devices that occur 1644 * the adding/removing of devices that occur
@@ -1285,36 +1646,63 @@ static int mptsas_probe_one_phy(struct device *dev,
1285 */ 1646 */
1286 if (ioc->sas_discovery_runtime && 1647 if (ioc->sas_discovery_runtime &&
1287 mptsas_is_end_device(&phy_info->attached)) 1648 mptsas_is_end_device(&phy_info->attached))
1288 return 0; 1649 goto out;
1289 1650
1290 mptsas_parse_device_info(&identify, &phy_info->attached); 1651 mptsas_parse_device_info(&identify, &phy_info->attached);
1652 if (scsi_is_host_device(parent)) {
1653 struct mptsas_portinfo *port_info;
1654 int i;
1655
1656 mutex_lock(&ioc->sas_topology_mutex);
1657 port_info = mptsas_find_portinfo_by_handle(ioc,
1658 ioc->handle);
1659 mutex_unlock(&ioc->sas_topology_mutex);
1660
1661 for (i = 0; i < port_info->num_phys; i++)
1662 if (port_info->phy_info[i].identify.sas_address ==
1663 identify.sas_address)
1664 goto out;
1665
1666 } else if (scsi_is_sas_rphy(parent)) {
1667 struct sas_rphy *parent_rphy = dev_to_rphy(parent);
1668 if (identify.sas_address ==
1669 parent_rphy->identify.sas_address)
1670 goto out;
1671 }
1672
1291 switch (identify.device_type) { 1673 switch (identify.device_type) {
1292 case SAS_END_DEVICE: 1674 case SAS_END_DEVICE:
1293 rphy = sas_end_device_alloc(phy); 1675 rphy = sas_end_device_alloc(port);
1294 break; 1676 break;
1295 case SAS_EDGE_EXPANDER_DEVICE: 1677 case SAS_EDGE_EXPANDER_DEVICE:
1296 case SAS_FANOUT_EXPANDER_DEVICE: 1678 case SAS_FANOUT_EXPANDER_DEVICE:
1297 rphy = sas_expander_alloc(phy, identify.device_type); 1679 rphy = sas_expander_alloc(port, identify.device_type);
1298 break; 1680 break;
1299 default: 1681 default:
1300 rphy = NULL; 1682 rphy = NULL;
1301 break; 1683 break;
1302 } 1684 }
1303 if (!rphy) 1685 if (!rphy) {
1304 return 0; /* non-fatal: an rphy can be added later */ 1686 dfailprintk((MYIOC_s_ERR_FMT
1687 "%s: exit at line=%d\n", ioc->name,
1688 __FUNCTION__, __LINE__));
1689 goto out;
1690 }
1305 1691
1306 rphy->identify = identify; 1692 rphy->identify = identify;
1307
1308 error = sas_rphy_add(rphy); 1693 error = sas_rphy_add(rphy);
1309 if (error) { 1694 if (error) {
1695 dfailprintk((MYIOC_s_ERR_FMT
1696 "%s: exit at line=%d\n", ioc->name,
1697 __FUNCTION__, __LINE__));
1310 sas_rphy_free(rphy); 1698 sas_rphy_free(rphy);
1311 return error; 1699 goto out;
1312 } 1700 }
1313 1701 mptsas_set_rphy(phy_info, rphy);
1314 phy_info->rphy = rphy;
1315 } 1702 }
1316 1703
1317 return 0; 1704 out:
1705 return error;
1318} 1706}
1319 1707
1320static int 1708static int
@@ -1333,6 +1721,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1333 goto out_free_port_info; 1721 goto out_free_port_info;
1334 1722
1335 mutex_lock(&ioc->sas_topology_mutex); 1723 mutex_lock(&ioc->sas_topology_mutex);
1724 ioc->handle = hba->handle;
1336 port_info = mptsas_find_portinfo_by_handle(ioc, hba->handle); 1725 port_info = mptsas_find_portinfo_by_handle(ioc, hba->handle);
1337 if (!port_info) { 1726 if (!port_info) {
1338 port_info = hba; 1727 port_info = hba;
@@ -1342,8 +1731,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1342 for (i = 0; i < hba->num_phys; i++) 1731 for (i = 0; i < hba->num_phys; i++)
1343 port_info->phy_info[i].negotiated_link_rate = 1732 port_info->phy_info[i].negotiated_link_rate =
1344 hba->phy_info[i].negotiated_link_rate; 1733 hba->phy_info[i].negotiated_link_rate;
1345 if (hba->phy_info) 1734 kfree(hba->phy_info);
1346 kfree(hba->phy_info);
1347 kfree(hba); 1735 kfree(hba);
1348 hba = NULL; 1736 hba = NULL;
1349 } 1737 }
@@ -1362,18 +1750,19 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1362 port_info->phy_info[i].phy_id; 1750 port_info->phy_info[i].phy_id;
1363 handle = port_info->phy_info[i].identify.handle; 1751 handle = port_info->phy_info[i].identify.handle;
1364 1752
1365 if (port_info->phy_info[i].attached.handle) { 1753 if (port_info->phy_info[i].attached.handle)
1366 mptsas_sas_device_pg0(ioc, 1754 mptsas_sas_device_pg0(ioc,
1367 &port_info->phy_info[i].attached, 1755 &port_info->phy_info[i].attached,
1368 (MPI_SAS_DEVICE_PGAD_FORM_HANDLE << 1756 (MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<
1369 MPI_SAS_DEVICE_PGAD_FORM_SHIFT), 1757 MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
1370 port_info->phy_info[i].attached.handle); 1758 port_info->phy_info[i].attached.handle);
1371 } 1759 }
1760
1761 mptsas_setup_wide_ports(ioc, port_info);
1372 1762
1763 for (i = 0; i < port_info->num_phys; i++, ioc->sas_index++)
1373 mptsas_probe_one_phy(&ioc->sh->shost_gendev, 1764 mptsas_probe_one_phy(&ioc->sh->shost_gendev,
1374 &port_info->phy_info[i], ioc->sas_index, 1); 1765 &port_info->phy_info[i], ioc->sas_index, 1);
1375 ioc->sas_index++;
1376 }
1377 1766
1378 return 0; 1767 return 0;
1379 1768
@@ -1387,6 +1776,8 @@ static int
1387mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle) 1776mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
1388{ 1777{
1389 struct mptsas_portinfo *port_info, *p, *ex; 1778 struct mptsas_portinfo *port_info, *p, *ex;
1779 struct device *parent;
1780 struct sas_rphy *rphy;
1390 int error = -ENOMEM, i, j; 1781 int error = -ENOMEM, i, j;
1391 1782
1392 ex = kzalloc(sizeof(*port_info), GFP_KERNEL); 1783 ex = kzalloc(sizeof(*port_info), GFP_KERNEL);
@@ -1408,16 +1799,13 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
1408 list_add_tail(&port_info->list, &ioc->sas_topology); 1799 list_add_tail(&port_info->list, &ioc->sas_topology);
1409 } else { 1800 } else {
1410 port_info->handle = ex->handle; 1801 port_info->handle = ex->handle;
1411 if (ex->phy_info) 1802 kfree(ex->phy_info);
1412 kfree(ex->phy_info);
1413 kfree(ex); 1803 kfree(ex);
1414 ex = NULL; 1804 ex = NULL;
1415 } 1805 }
1416 mutex_unlock(&ioc->sas_topology_mutex); 1806 mutex_unlock(&ioc->sas_topology_mutex);
1417 1807
1418 for (i = 0; i < port_info->num_phys; i++) { 1808 for (i = 0; i < port_info->num_phys; i++) {
1419 struct device *parent;
1420
1421 mptsas_sas_expander_pg1(ioc, &port_info->phy_info[i], 1809 mptsas_sas_expander_pg1(ioc, &port_info->phy_info[i],
1422 (MPI_SAS_EXPAND_PGAD_FORM_HANDLE_PHY_NUM << 1810 (MPI_SAS_EXPAND_PGAD_FORM_HANDLE_PHY_NUM <<
1423 MPI_SAS_EXPAND_PGAD_FORM_SHIFT), (i << 16) + *handle); 1811 MPI_SAS_EXPAND_PGAD_FORM_SHIFT), (i << 16) + *handle);
@@ -1441,34 +1829,34 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
1441 port_info->phy_info[i].attached.phy_id = 1829 port_info->phy_info[i].attached.phy_id =
1442 port_info->phy_info[i].phy_id; 1830 port_info->phy_info[i].phy_id;
1443 } 1831 }
1832 }
1444 1833
1445 /* 1834 parent = &ioc->sh->shost_gendev;
1446 * If we find a parent port handle this expander is 1835 for (i = 0; i < port_info->num_phys; i++) {
1447 * attached to another expander, else it hangs of the
1448 * HBA phys.
1449 */
1450 parent = &ioc->sh->shost_gendev;
1451 mutex_lock(&ioc->sas_topology_mutex); 1836 mutex_lock(&ioc->sas_topology_mutex);
1452 list_for_each_entry(p, &ioc->sas_topology, list) { 1837 list_for_each_entry(p, &ioc->sas_topology, list) {
1453 for (j = 0; j < p->num_phys; j++) { 1838 for (j = 0; j < p->num_phys; j++) {
1454 if (port_info->phy_info[i].identify.handle == 1839 if (port_info->phy_info[i].identify.handle !=
1455 p->phy_info[j].attached.handle) 1840 p->phy_info[j].attached.handle)
1456 parent = &p->phy_info[j].rphy->dev; 1841 continue;
1842 rphy = mptsas_get_rphy(&p->phy_info[j]);
1843 parent = &rphy->dev;
1457 } 1844 }
1458 } 1845 }
1459 mutex_unlock(&ioc->sas_topology_mutex); 1846 mutex_unlock(&ioc->sas_topology_mutex);
1847 }
1848
1849 mptsas_setup_wide_ports(ioc, port_info);
1460 1850
1851 for (i = 0; i < port_info->num_phys; i++, ioc->sas_index++)
1461 mptsas_probe_one_phy(parent, &port_info->phy_info[i], 1852 mptsas_probe_one_phy(parent, &port_info->phy_info[i],
1462 ioc->sas_index, 0); 1853 ioc->sas_index, 0);
1463 ioc->sas_index++;
1464 }
1465 1854
1466 return 0; 1855 return 0;
1467 1856
1468 out_free_port_info: 1857 out_free_port_info:
1469 if (ex) { 1858 if (ex) {
1470 if (ex->phy_info) 1859 kfree(ex->phy_info);
1471 kfree(ex->phy_info);
1472 kfree(ex); 1860 kfree(ex);
1473 } 1861 }
1474 out: 1862 out:
@@ -1487,7 +1875,12 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
1487{ 1875{
1488 struct mptsas_portinfo buffer; 1876 struct mptsas_portinfo buffer;
1489 struct mptsas_portinfo *port_info, *n, *parent; 1877 struct mptsas_portinfo *port_info, *n, *parent;
1878 struct mptsas_phyinfo *phy_info;
1879 struct scsi_target * starget;
1880 VirtTarget * vtarget;
1881 struct sas_port * port;
1490 int i; 1882 int i;
1883 u64 expander_sas_address;
1491 1884
1492 mutex_lock(&ioc->sas_topology_mutex); 1885 mutex_lock(&ioc->sas_topology_mutex);
1493 list_for_each_entry_safe(port_info, n, &ioc->sas_topology, list) { 1886 list_for_each_entry_safe(port_info, n, &ioc->sas_topology, list) {
@@ -1502,6 +1895,25 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
1502 MPI_SAS_EXPAND_PGAD_FORM_SHIFT), port_info->handle)) { 1895 MPI_SAS_EXPAND_PGAD_FORM_SHIFT), port_info->handle)) {
1503 1896
1504 /* 1897 /*
1898 * Issue target reset to all child end devices
1899 * then mark them deleted to prevent further
1900 * IO going to them.
1901 */
1902 phy_info = port_info->phy_info;
1903 for (i = 0; i < port_info->num_phys; i++, phy_info++) {
1904 starget = mptsas_get_starget(phy_info);
1905 if (!starget)
1906 continue;
1907 vtarget = starget->hostdata;
1908 if(vtarget->deleted)
1909 continue;
1910 vtarget->deleted = 1;
1911 mptsas_target_reset(ioc, vtarget);
1912 sas_port_delete(mptsas_get_port(phy_info));
1913 mptsas_port_delete(phy_info->port_details);
1914 }
1915
1916 /*
1505 * Obtain the port_info instance to the parent port 1917 * Obtain the port_info instance to the parent port
1506 */ 1918 */
1507 parent = mptsas_find_portinfo_by_handle(ioc, 1919 parent = mptsas_find_portinfo_by_handle(ioc,
@@ -1510,34 +1922,43 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
1510 if (!parent) 1922 if (!parent)
1511 goto next_port; 1923 goto next_port;
1512 1924
1925 expander_sas_address =
1926 port_info->phy_info[0].identify.sas_address;
1927
1513 /* 1928 /*
1514 * Delete rphys in the parent that point 1929 * Delete rphys in the parent that point
1515 * to this expander. The transport layer will 1930 * to this expander. The transport layer will
1516 * cleanup all the children. 1931 * cleanup all the children.
1517 */ 1932 */
1518 for (i = 0; i < parent->num_phys; i++) { 1933 phy_info = parent->phy_info;
1519 if ((!parent->phy_info[i].rphy) || 1934 for (i = 0; i < parent->num_phys; i++, phy_info++) {
1520 (parent->phy_info[i].attached.sas_address != 1935 port = mptsas_get_port(phy_info);
1521 port_info->phy_info[i].identify.sas_address)) 1936 if (!port)
1937 continue;
1938 if (phy_info->attached.sas_address !=
1939 expander_sas_address)
1522 continue; 1940 continue;
1523 sas_rphy_delete(parent->phy_info[i].rphy); 1941#ifdef MPT_DEBUG_SAS_WIDE
1524 memset(&parent->phy_info[i].attached, 0, 1942 dev_printk(KERN_DEBUG, &port->dev, "delete\n");
1525 sizeof(struct mptsas_devinfo)); 1943#endif
1526 parent->phy_info[i].rphy = NULL; 1944 sas_port_delete(port);
1527 parent->phy_info[i].starget = NULL; 1945 mptsas_port_delete(phy_info->port_details);
1528 } 1946 }
1529 next_port: 1947 next_port:
1948
1949 phy_info = port_info->phy_info;
1950 for (i = 0; i < port_info->num_phys; i++, phy_info++)
1951 mptsas_port_delete(phy_info->port_details);
1952
1530 list_del(&port_info->list); 1953 list_del(&port_info->list);
1531 if (port_info->phy_info) 1954 kfree(port_info->phy_info);
1532 kfree(port_info->phy_info);
1533 kfree(port_info); 1955 kfree(port_info);
1534 } 1956 }
1535 /* 1957 /*
1536 * Free this memory allocated from inside 1958 * Free this memory allocated from inside
1537 * mptsas_sas_expander_pg0 1959 * mptsas_sas_expander_pg0
1538 */ 1960 */
1539 if (buffer.phy_info) 1961 kfree(buffer.phy_info);
1540 kfree(buffer.phy_info);
1541 } 1962 }
1542 mutex_unlock(&ioc->sas_topology_mutex); 1963 mutex_unlock(&ioc->sas_topology_mutex);
1543} 1964}
@@ -1573,60 +1994,59 @@ mptsas_scan_sas_topology(MPT_ADAPTER *ioc)
1573/* 1994/*
1574 * Work queue thread to handle Runtime discovery 1995 * Work queue thread to handle Runtime discovery
1575 * Mere purpose is the hot add/delete of expanders 1996 * Mere purpose is the hot add/delete of expanders
1997 *(Mutex UNLOCKED)
1576 */ 1998 */
1577static void 1999static void
1578mptscsih_discovery_work(void * arg) 2000__mptsas_discovery_work(MPT_ADAPTER *ioc)
1579{ 2001{
1580 struct mptsas_discovery_event *ev = arg;
1581 MPT_ADAPTER *ioc = ev->ioc;
1582 u32 handle = 0xFFFF; 2002 u32 handle = 0xFFFF;
1583 2003
1584 mutex_lock(&ioc->sas_discovery_mutex);
1585 ioc->sas_discovery_runtime=1; 2004 ioc->sas_discovery_runtime=1;
1586 mptsas_delete_expander_phys(ioc); 2005 mptsas_delete_expander_phys(ioc);
1587 mptsas_probe_hba_phys(ioc); 2006 mptsas_probe_hba_phys(ioc);
1588 while (!mptsas_probe_expander_phys(ioc, &handle)) 2007 while (!mptsas_probe_expander_phys(ioc, &handle))
1589 ; 2008 ;
1590 kfree(ev);
1591 ioc->sas_discovery_runtime=0; 2009 ioc->sas_discovery_runtime=0;
2010}
2011
2012/*
2013 * Work queue thread to handle Runtime discovery
2014 * Mere purpose is the hot add/delete of expanders
2015 *(Mutex LOCKED)
2016 */
2017static void
2018mptsas_discovery_work(void * arg)
2019{
2020 struct mptsas_discovery_event *ev = arg;
2021 MPT_ADAPTER *ioc = ev->ioc;
2022
2023 mutex_lock(&ioc->sas_discovery_mutex);
2024 __mptsas_discovery_work(ioc);
1592 mutex_unlock(&ioc->sas_discovery_mutex); 2025 mutex_unlock(&ioc->sas_discovery_mutex);
2026 kfree(ev);
1593} 2027}
1594 2028
1595static struct mptsas_phyinfo * 2029static struct mptsas_phyinfo *
1596mptsas_find_phyinfo_by_parent(MPT_ADAPTER *ioc, u16 parent_handle, u8 phy_id) 2030mptsas_find_phyinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
1597{ 2031{
1598 struct mptsas_portinfo *port_info; 2032 struct mptsas_portinfo *port_info;
1599 struct mptsas_devinfo device_info;
1600 struct mptsas_phyinfo *phy_info = NULL; 2033 struct mptsas_phyinfo *phy_info = NULL;
1601 int i, error; 2034 int i;
1602
1603 /*
1604 * Retrieve the parent sas_address
1605 */
1606 error = mptsas_sas_device_pg0(ioc, &device_info,
1607 (MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<
1608 MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
1609 parent_handle);
1610 if (error)
1611 return NULL;
1612 2035
1613 /*
1614 * The phy_info structures are never deallocated during lifetime of
1615 * a host, so the code below is safe without additional refcounting.
1616 */
1617 mutex_lock(&ioc->sas_topology_mutex); 2036 mutex_lock(&ioc->sas_topology_mutex);
1618 list_for_each_entry(port_info, &ioc->sas_topology, list) { 2037 list_for_each_entry(port_info, &ioc->sas_topology, list) {
1619 for (i = 0; i < port_info->num_phys; i++) { 2038 for (i = 0; i < port_info->num_phys; i++) {
1620 if (port_info->phy_info[i].identify.sas_address == 2039 if (port_info->phy_info[i].attached.sas_address
1621 device_info.sas_address && 2040 != sas_address)
1622 port_info->phy_info[i].phy_id == phy_id) { 2041 continue;
1623 phy_info = &port_info->phy_info[i]; 2042 if (!mptsas_is_end_device(
1624 break; 2043 &port_info->phy_info[i].attached))
1625 } 2044 continue;
2045 phy_info = &port_info->phy_info[i];
2046 break;
1626 } 2047 }
1627 } 2048 }
1628 mutex_unlock(&ioc->sas_topology_mutex); 2049 mutex_unlock(&ioc->sas_topology_mutex);
1629
1630 return phy_info; 2050 return phy_info;
1631} 2051}
1632 2052
@@ -1637,21 +2057,19 @@ mptsas_find_phyinfo_by_target(MPT_ADAPTER *ioc, u32 id)
1637 struct mptsas_phyinfo *phy_info = NULL; 2057 struct mptsas_phyinfo *phy_info = NULL;
1638 int i; 2058 int i;
1639 2059
1640 /*
1641 * The phy_info structures are never deallocated during lifetime of
1642 * a host, so the code below is safe without additional refcounting.
1643 */
1644 mutex_lock(&ioc->sas_topology_mutex); 2060 mutex_lock(&ioc->sas_topology_mutex);
1645 list_for_each_entry(port_info, &ioc->sas_topology, list) { 2061 list_for_each_entry(port_info, &ioc->sas_topology, list) {
1646 for (i = 0; i < port_info->num_phys; i++) 2062 for (i = 0; i < port_info->num_phys; i++) {
1647 if (mptsas_is_end_device(&port_info->phy_info[i].attached)) 2063 if (port_info->phy_info[i].attached.id != id)
1648 if (port_info->phy_info[i].attached.id == id) { 2064 continue;
1649 phy_info = &port_info->phy_info[i]; 2065 if (!mptsas_is_end_device(
1650 break; 2066 &port_info->phy_info[i].attached))
1651 } 2067 continue;
2068 phy_info = &port_info->phy_info[i];
2069 break;
2070 }
1652 } 2071 }
1653 mutex_unlock(&ioc->sas_topology_mutex); 2072 mutex_unlock(&ioc->sas_topology_mutex);
1654
1655 return phy_info; 2073 return phy_info;
1656} 2074}
1657 2075
@@ -1659,7 +2077,7 @@ mptsas_find_phyinfo_by_target(MPT_ADAPTER *ioc, u32 id)
1659 * Work queue thread to clear the persitency table 2077 * Work queue thread to clear the persitency table
1660 */ 2078 */
1661static void 2079static void
1662mptscsih_sas_persist_clear_table(void * arg) 2080mptsas_persist_clear_table(void * arg)
1663{ 2081{
1664 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; 2082 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
1665 2083
@@ -1680,7 +2098,6 @@ mptsas_reprobe_target(struct scsi_target *starget, int uld_attach)
1680 mptsas_reprobe_lun); 2098 mptsas_reprobe_lun);
1681} 2099}
1682 2100
1683
1684/* 2101/*
1685 * Work queue thread to handle SAS hotplug events 2102 * Work queue thread to handle SAS hotplug events
1686 */ 2103 */
@@ -1691,14 +2108,17 @@ mptsas_hotplug_work(void *arg)
1691 MPT_ADAPTER *ioc = ev->ioc; 2108 MPT_ADAPTER *ioc = ev->ioc;
1692 struct mptsas_phyinfo *phy_info; 2109 struct mptsas_phyinfo *phy_info;
1693 struct sas_rphy *rphy; 2110 struct sas_rphy *rphy;
2111 struct sas_port *port;
1694 struct scsi_device *sdev; 2112 struct scsi_device *sdev;
2113 struct scsi_target * starget;
1695 struct sas_identify identify; 2114 struct sas_identify identify;
1696 char *ds = NULL; 2115 char *ds = NULL;
1697 struct mptsas_devinfo sas_device; 2116 struct mptsas_devinfo sas_device;
1698 VirtTarget *vtarget; 2117 VirtTarget *vtarget;
2118 VirtDevice *vdevice;
1699 2119
1700 mutex_lock(&ioc->sas_discovery_mutex);
1701 2120
2121 mutex_lock(&ioc->sas_discovery_mutex);
1702 switch (ev->event_type) { 2122 switch (ev->event_type) {
1703 case MPTSAS_DEL_DEVICE: 2123 case MPTSAS_DEL_DEVICE:
1704 2124
@@ -1707,24 +2127,50 @@ mptsas_hotplug_work(void *arg)
1707 /* 2127 /*
1708 * Sanity checks, for non-existing phys and remote rphys. 2128 * Sanity checks, for non-existing phys and remote rphys.
1709 */ 2129 */
1710 if (!phy_info) 2130 if (!phy_info || !phy_info->port_details) {
2131 dfailprintk((MYIOC_s_ERR_FMT
2132 "%s: exit at line=%d\n", ioc->name,
2133 __FUNCTION__, __LINE__));
1711 break; 2134 break;
1712 if (!phy_info->rphy) 2135 }
2136 rphy = mptsas_get_rphy(phy_info);
2137 if (!rphy) {
2138 dfailprintk((MYIOC_s_ERR_FMT
2139 "%s: exit at line=%d\n", ioc->name,
2140 __FUNCTION__, __LINE__));
1713 break; 2141 break;
1714 if (phy_info->starget) { 2142 }
1715 vtarget = phy_info->starget->hostdata; 2143 port = mptsas_get_port(phy_info);
2144 if (!port) {
2145 dfailprintk((MYIOC_s_ERR_FMT
2146 "%s: exit at line=%d\n", ioc->name,
2147 __FUNCTION__, __LINE__));
2148 break;
2149 }
1716 2150
1717 if (!vtarget) 2151 starget = mptsas_get_starget(phy_info);
2152 if (starget) {
2153 vtarget = starget->hostdata;
2154
2155 if (!vtarget) {
2156 dfailprintk((MYIOC_s_ERR_FMT
2157 "%s: exit at line=%d\n", ioc->name,
2158 __FUNCTION__, __LINE__));
1718 break; 2159 break;
2160 }
2161
1719 /* 2162 /*
1720 * Handling RAID components 2163 * Handling RAID components
1721 */ 2164 */
1722 if (ev->phys_disk_num_valid) { 2165 if (ev->phys_disk_num_valid) {
1723 vtarget->target_id = ev->phys_disk_num; 2166 vtarget->target_id = ev->phys_disk_num;
1724 vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT; 2167 vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT;
1725 mptsas_reprobe_target(vtarget->starget, 1); 2168 mptsas_reprobe_target(starget, 1);
1726 break; 2169 break;
1727 } 2170 }
2171
2172 vtarget->deleted = 1;
2173 mptsas_target_reset(ioc, vtarget);
1728 } 2174 }
1729 2175
1730 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET) 2176 if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET)
@@ -1738,10 +2184,11 @@ mptsas_hotplug_work(void *arg)
1738 "removing %s device, channel %d, id %d, phy %d\n", 2184 "removing %s device, channel %d, id %d, phy %d\n",
1739 ioc->name, ds, ev->channel, ev->id, phy_info->phy_id); 2185 ioc->name, ds, ev->channel, ev->id, phy_info->phy_id);
1740 2186
1741 sas_rphy_delete(phy_info->rphy); 2187#ifdef MPT_DEBUG_SAS_WIDE
1742 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo)); 2188 dev_printk(KERN_DEBUG, &port->dev, "delete\n");
1743 phy_info->rphy = NULL; 2189#endif
1744 phy_info->starget = NULL; 2190 sas_port_delete(port);
2191 mptsas_port_delete(phy_info->port_details);
1745 break; 2192 break;
1746 case MPTSAS_ADD_DEVICE: 2193 case MPTSAS_ADD_DEVICE:
1747 2194
@@ -1753,59 +2200,60 @@ mptsas_hotplug_work(void *arg)
1753 */ 2200 */
1754 if (mptsas_sas_device_pg0(ioc, &sas_device, 2201 if (mptsas_sas_device_pg0(ioc, &sas_device,
1755 (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID << 2202 (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID <<
1756 MPI_SAS_DEVICE_PGAD_FORM_SHIFT), ev->id)) 2203 MPI_SAS_DEVICE_PGAD_FORM_SHIFT), ev->id)) {
2204 dfailprintk((MYIOC_s_ERR_FMT
2205 "%s: exit at line=%d\n", ioc->name,
2206 __FUNCTION__, __LINE__));
1757 break; 2207 break;
2208 }
1758 2209
1759 phy_info = mptsas_find_phyinfo_by_parent(ioc, 2210 ssleep(2);
1760 sas_device.handle_parent, sas_device.phy_id); 2211 __mptsas_discovery_work(ioc);
1761 2212
1762 if (!phy_info) { 2213 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
1763 u32 handle = 0xFFFF; 2214 sas_device.sas_address);
1764 2215
1765 /* 2216 if (!phy_info || !phy_info->port_details) {
1766 * Its possible when an expander has been hot added 2217 dfailprintk((MYIOC_s_ERR_FMT
1767 * containing attached devices, the sas firmware 2218 "%s: exit at line=%d\n", ioc->name,
1768 * may send a RC_ADDED event prior to the 2219 __FUNCTION__, __LINE__));
1769 * DISCOVERY STOP event. If that occurs, our 2220 break;
1770 * view of the topology in the driver in respect to this
1771 * expander might of not been setup, and we hit this
1772 * condition.
1773 * Therefore, this code kicks off discovery to
1774 * refresh the data.
1775 * Then again, we check whether the parent phy has
1776 * been created.
1777 */
1778 ioc->sas_discovery_runtime=1;
1779 mptsas_delete_expander_phys(ioc);
1780 mptsas_probe_hba_phys(ioc);
1781 while (!mptsas_probe_expander_phys(ioc, &handle))
1782 ;
1783 ioc->sas_discovery_runtime=0;
1784
1785 phy_info = mptsas_find_phyinfo_by_parent(ioc,
1786 sas_device.handle_parent, sas_device.phy_id);
1787 if (!phy_info)
1788 break;
1789 } 2221 }
1790 2222
1791 if (phy_info->starget) { 2223 starget = mptsas_get_starget(phy_info);
1792 vtarget = phy_info->starget->hostdata; 2224 if (starget) {
2225 vtarget = starget->hostdata;
1793 2226
1794 if (!vtarget) 2227 if (!vtarget) {
2228 dfailprintk((MYIOC_s_ERR_FMT
2229 "%s: exit at line=%d\n", ioc->name,
2230 __FUNCTION__, __LINE__));
1795 break; 2231 break;
2232 }
1796 /* 2233 /*
1797 * Handling RAID components 2234 * Handling RAID components
1798 */ 2235 */
1799 if (vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) { 2236 if (vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
1800 vtarget->tflags &= ~MPT_TARGET_FLAGS_RAID_COMPONENT; 2237 vtarget->tflags &= ~MPT_TARGET_FLAGS_RAID_COMPONENT;
1801 vtarget->target_id = ev->id; 2238 vtarget->target_id = ev->id;
1802 mptsas_reprobe_target(phy_info->starget, 0); 2239 mptsas_reprobe_target(starget, 0);
1803 } 2240 }
1804 break; 2241 break;
1805 } 2242 }
1806 2243
1807 if (phy_info->rphy) 2244 if (mptsas_get_rphy(phy_info)) {
2245 dfailprintk((MYIOC_s_ERR_FMT
2246 "%s: exit at line=%d\n", ioc->name,
2247 __FUNCTION__, __LINE__));
1808 break; 2248 break;
2249 }
2250 port = mptsas_get_port(phy_info);
2251 if (!port) {
2252 dfailprintk((MYIOC_s_ERR_FMT
2253 "%s: exit at line=%d\n", ioc->name,
2254 __FUNCTION__, __LINE__));
2255 break;
2256 }
1809 2257
1810 memcpy(&phy_info->attached, &sas_device, 2258 memcpy(&phy_info->attached, &sas_device,
1811 sizeof(struct mptsas_devinfo)); 2259 sizeof(struct mptsas_devinfo));
@@ -1822,28 +2270,23 @@ mptsas_hotplug_work(void *arg)
1822 ioc->name, ds, ev->channel, ev->id, ev->phy_id); 2270 ioc->name, ds, ev->channel, ev->id, ev->phy_id);
1823 2271
1824 mptsas_parse_device_info(&identify, &phy_info->attached); 2272 mptsas_parse_device_info(&identify, &phy_info->attached);
1825 switch (identify.device_type) { 2273 rphy = sas_end_device_alloc(port);
1826 case SAS_END_DEVICE: 2274 if (!rphy) {
1827 rphy = sas_end_device_alloc(phy_info->phy); 2275 dfailprintk((MYIOC_s_ERR_FMT
1828 break; 2276 "%s: exit at line=%d\n", ioc->name,
1829 case SAS_EDGE_EXPANDER_DEVICE: 2277 __FUNCTION__, __LINE__));
1830 case SAS_FANOUT_EXPANDER_DEVICE:
1831 rphy = sas_expander_alloc(phy_info->phy, identify.device_type);
1832 break;
1833 default:
1834 rphy = NULL;
1835 break;
1836 }
1837 if (!rphy)
1838 break; /* non-fatal: an rphy can be added later */ 2278 break; /* non-fatal: an rphy can be added later */
2279 }
1839 2280
1840 rphy->identify = identify; 2281 rphy->identify = identify;
1841 if (sas_rphy_add(rphy)) { 2282 if (sas_rphy_add(rphy)) {
2283 dfailprintk((MYIOC_s_ERR_FMT
2284 "%s: exit at line=%d\n", ioc->name,
2285 __FUNCTION__, __LINE__));
1842 sas_rphy_free(rphy); 2286 sas_rphy_free(rphy);
1843 break; 2287 break;
1844 } 2288 }
1845 2289 mptsas_set_rphy(phy_info, rphy);
1846 phy_info->rphy = rphy;
1847 break; 2290 break;
1848 case MPTSAS_ADD_RAID: 2291 case MPTSAS_ADD_RAID:
1849 sdev = scsi_device_lookup( 2292 sdev = scsi_device_lookup(
@@ -1875,6 +2318,9 @@ mptsas_hotplug_work(void *arg)
1875 printk(MYIOC_s_INFO_FMT 2318 printk(MYIOC_s_INFO_FMT
1876 "removing raid volume, channel %d, id %d\n", 2319 "removing raid volume, channel %d, id %d\n",
1877 ioc->name, ioc->num_ports, ev->id); 2320 ioc->name, ioc->num_ports, ev->id);
2321 vdevice = sdev->hostdata;
2322 vdevice->vtarget->deleted = 1;
2323 mptsas_target_reset(ioc, vdevice->vtarget);
1878 scsi_remove_device(sdev); 2324 scsi_remove_device(sdev);
1879 scsi_device_put(sdev); 2325 scsi_device_put(sdev);
1880 mpt_findImVolumes(ioc); 2326 mpt_findImVolumes(ioc);
@@ -1884,12 +2330,13 @@ mptsas_hotplug_work(void *arg)
1884 break; 2330 break;
1885 } 2331 }
1886 2332
1887 kfree(ev);
1888 mutex_unlock(&ioc->sas_discovery_mutex); 2333 mutex_unlock(&ioc->sas_discovery_mutex);
2334 kfree(ev);
2335
1889} 2336}
1890 2337
1891static void 2338static void
1892mptscsih_send_sas_event(MPT_ADAPTER *ioc, 2339mptsas_send_sas_event(MPT_ADAPTER *ioc,
1893 EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *sas_event_data) 2340 EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *sas_event_data)
1894{ 2341{
1895 struct mptsas_hotplug_event *ev; 2342 struct mptsas_hotplug_event *ev;
@@ -1905,7 +2352,7 @@ mptscsih_send_sas_event(MPT_ADAPTER *ioc,
1905 switch (sas_event_data->ReasonCode) { 2352 switch (sas_event_data->ReasonCode) {
1906 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: 2353 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED:
1907 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: 2354 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING:
1908 ev = kmalloc(sizeof(*ev), GFP_ATOMIC); 2355 ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
1909 if (!ev) { 2356 if (!ev) {
1910 printk(KERN_WARNING "mptsas: lost hotplug event\n"); 2357 printk(KERN_WARNING "mptsas: lost hotplug event\n");
1911 break; 2358 break;
@@ -1935,10 +2382,9 @@ mptscsih_send_sas_event(MPT_ADAPTER *ioc,
1935 /* 2382 /*
1936 * Persistent table is full. 2383 * Persistent table is full.
1937 */ 2384 */
1938 INIT_WORK(&ioc->mptscsih_persistTask, 2385 INIT_WORK(&ioc->sas_persist_task,
1939 mptscsih_sas_persist_clear_table, 2386 mptsas_persist_clear_table, (void *)ioc);
1940 (void *)ioc); 2387 schedule_work(&ioc->sas_persist_task);
1941 schedule_work(&ioc->mptscsih_persistTask);
1942 break; 2388 break;
1943 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: 2389 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
1944 /* TODO */ 2390 /* TODO */
@@ -1950,7 +2396,7 @@ mptscsih_send_sas_event(MPT_ADAPTER *ioc,
1950} 2396}
1951 2397
1952static void 2398static void
1953mptscsih_send_raid_event(MPT_ADAPTER *ioc, 2399mptsas_send_raid_event(MPT_ADAPTER *ioc,
1954 EVENT_DATA_RAID *raid_event_data) 2400 EVENT_DATA_RAID *raid_event_data)
1955{ 2401{
1956 struct mptsas_hotplug_event *ev; 2402 struct mptsas_hotplug_event *ev;
@@ -1960,13 +2406,12 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc,
1960 if (ioc->bus_type != SAS) 2406 if (ioc->bus_type != SAS)
1961 return; 2407 return;
1962 2408
1963 ev = kmalloc(sizeof(*ev), GFP_ATOMIC); 2409 ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
1964 if (!ev) { 2410 if (!ev) {
1965 printk(KERN_WARNING "mptsas: lost hotplug event\n"); 2411 printk(KERN_WARNING "mptsas: lost hotplug event\n");
1966 return; 2412 return;
1967 } 2413 }
1968 2414
1969 memset(ev,0,sizeof(struct mptsas_hotplug_event));
1970 INIT_WORK(&ev->work, mptsas_hotplug_work, ev); 2415 INIT_WORK(&ev->work, mptsas_hotplug_work, ev);
1971 ev->ioc = ioc; 2416 ev->ioc = ioc;
1972 ev->id = raid_event_data->VolumeID; 2417 ev->id = raid_event_data->VolumeID;
@@ -2028,7 +2473,7 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc,
2028} 2473}
2029 2474
2030static void 2475static void
2031mptscsih_send_discovery(MPT_ADAPTER *ioc, 2476mptsas_send_discovery_event(MPT_ADAPTER *ioc,
2032 EVENT_DATA_SAS_DISCOVERY *discovery_data) 2477 EVENT_DATA_SAS_DISCOVERY *discovery_data)
2033{ 2478{
2034 struct mptsas_discovery_event *ev; 2479 struct mptsas_discovery_event *ev;
@@ -2043,11 +2488,10 @@ mptscsih_send_discovery(MPT_ADAPTER *ioc,
2043 if (discovery_data->DiscoveryStatus) 2488 if (discovery_data->DiscoveryStatus)
2044 return; 2489 return;
2045 2490
2046 ev = kmalloc(sizeof(*ev), GFP_ATOMIC); 2491 ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
2047 if (!ev) 2492 if (!ev)
2048 return; 2493 return;
2049 memset(ev,0,sizeof(struct mptsas_discovery_event)); 2494 INIT_WORK(&ev->work, mptsas_discovery_work, ev);
2050 INIT_WORK(&ev->work, mptscsih_discovery_work, ev);
2051 ev->ioc = ioc; 2495 ev->ioc = ioc;
2052 schedule_work(&ev->work); 2496 schedule_work(&ev->work);
2053}; 2497};
@@ -2075,21 +2519,21 @@ mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
2075 2519
2076 switch (event) { 2520 switch (event) {
2077 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: 2521 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
2078 mptscsih_send_sas_event(ioc, 2522 mptsas_send_sas_event(ioc,
2079 (EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *)reply->Data); 2523 (EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *)reply->Data);
2080 break; 2524 break;
2081 case MPI_EVENT_INTEGRATED_RAID: 2525 case MPI_EVENT_INTEGRATED_RAID:
2082 mptscsih_send_raid_event(ioc, 2526 mptsas_send_raid_event(ioc,
2083 (EVENT_DATA_RAID *)reply->Data); 2527 (EVENT_DATA_RAID *)reply->Data);
2084 break; 2528 break;
2085 case MPI_EVENT_PERSISTENT_TABLE_FULL: 2529 case MPI_EVENT_PERSISTENT_TABLE_FULL:
2086 INIT_WORK(&ioc->mptscsih_persistTask, 2530 INIT_WORK(&ioc->sas_persist_task,
2087 mptscsih_sas_persist_clear_table, 2531 mptsas_persist_clear_table,
2088 (void *)ioc); 2532 (void *)ioc);
2089 schedule_work(&ioc->mptscsih_persistTask); 2533 schedule_work(&ioc->sas_persist_task);
2090 break; 2534 break;
2091 case MPI_EVENT_SAS_DISCOVERY: 2535 case MPI_EVENT_SAS_DISCOVERY:
2092 mptscsih_send_discovery(ioc, 2536 mptsas_send_discovery_event(ioc,
2093 (EVENT_DATA_SAS_DISCOVERY *)reply->Data); 2537 (EVENT_DATA_SAS_DISCOVERY *)reply->Data);
2094 break; 2538 break;
2095 default: 2539 default:
@@ -2308,7 +2752,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2308 2752
2309 return 0; 2753 return 0;
2310 2754
2311out_mptsas_probe: 2755 out_mptsas_probe:
2312 2756
2313 mptscsih_remove(pdev); 2757 mptscsih_remove(pdev);
2314 return error; 2758 return error;
@@ -2318,6 +2762,7 @@ static void __devexit mptsas_remove(struct pci_dev *pdev)
2318{ 2762{
2319 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 2763 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
2320 struct mptsas_portinfo *p, *n; 2764 struct mptsas_portinfo *p, *n;
2765 int i;
2321 2766
2322 ioc->sas_discovery_ignore_events=1; 2767 ioc->sas_discovery_ignore_events=1;
2323 sas_remove_host(ioc->sh); 2768 sas_remove_host(ioc->sh);
@@ -2325,8 +2770,9 @@ static void __devexit mptsas_remove(struct pci_dev *pdev)
2325 mutex_lock(&ioc->sas_topology_mutex); 2770 mutex_lock(&ioc->sas_topology_mutex);
2326 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) { 2771 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) {
2327 list_del(&p->list); 2772 list_del(&p->list);
2328 if (p->phy_info) 2773 for (i = 0 ; i < p->num_phys ; i++)
2329 kfree(p->phy_info); 2774 mptsas_port_delete(p->phy_info[i].port_details);
2775 kfree(p->phy_info);
2330 kfree(p); 2776 kfree(p);
2331 } 2777 }
2332 mutex_unlock(&ioc->sas_topology_mutex); 2778 mutex_unlock(&ioc->sas_topology_mutex);
@@ -2335,17 +2781,15 @@ static void __devexit mptsas_remove(struct pci_dev *pdev)
2335} 2781}
2336 2782
2337static struct pci_device_id mptsas_pci_table[] = { 2783static struct pci_device_id mptsas_pci_table[] = {
2338 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1064, 2784 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1064,
2339 PCI_ANY_ID, PCI_ANY_ID },
2340 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1066,
2341 PCI_ANY_ID, PCI_ANY_ID }, 2785 PCI_ANY_ID, PCI_ANY_ID },
2342 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1068, 2786 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1068,
2343 PCI_ANY_ID, PCI_ANY_ID }, 2787 PCI_ANY_ID, PCI_ANY_ID },
2344 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1064E, 2788 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1064E,
2345 PCI_ANY_ID, PCI_ANY_ID }, 2789 PCI_ANY_ID, PCI_ANY_ID },
2346 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1066E, 2790 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1068E,
2347 PCI_ANY_ID, PCI_ANY_ID }, 2791 PCI_ANY_ID, PCI_ANY_ID },
2348 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1068E, 2792 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1078,
2349 PCI_ANY_ID, PCI_ANY_ID }, 2793 PCI_ANY_ID, PCI_ANY_ID },
2350 {0} /* Terminating entry */ 2794 {0} /* Terminating entry */
2351}; 2795};
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 3201de053943..0a1ff762205f 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -775,9 +775,9 @@ static struct spi_function_template mptspi_transport_functions = {
775 */ 775 */
776 776
777static struct pci_device_id mptspi_pci_table[] = { 777static struct pci_device_id mptspi_pci_table[] = {
778 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030, 778 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_53C1030,
779 PCI_ANY_ID, PCI_ANY_ID }, 779 PCI_ANY_ID, PCI_ANY_ID },
780 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_1030_53C1035, 780 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_53C1035,
781 PCI_ANY_ID, PCI_ANY_ID }, 781 PCI_ANY_ID, PCI_ANY_ID },
782 {0} /* Terminating entry */ 782 {0} /* Terminating entry */
783}; 783};