linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9][RESEND] mvsas: fill in error info record and phy mode6 bits.
@ 2008-03-27  6:53 Ke Wei
  2008-03-27 13:36 ` Jeff Garzik
  2008-03-30 15:03 ` James Bottomley
  0 siblings, 2 replies; 4+ messages in thread
From: Ke Wei @ 2008-03-27  6:53 UTC (permalink / raw)
  To: linux-scsi; +Cc: james.bottomley, jeff

and remove some unused members from struct.


Signed-off-by: Ke Wei <kewei@marvell.com>
---
 drivers/scsi/mvsas.c |  123 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 87 insertions(+), 36 deletions(-)

diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c
index 5ec0665..3a447fe 100644
--- a/drivers/scsi/mvsas.c
+++ b/drivers/scsi/mvsas.c
@@ -37,11 +37,13 @@
 #include <linux/dma-mapping.h>
 #include <linux/ctype.h>
 #include <scsi/libsas.h>
+#include <scsi/scsi_tcq.h>
+#include <scsi/sas_ata.h>
 #include <asm/io.h>
 
 #define DRV_NAME	"mvsas"
-#define DRV_VERSION	"0.5.1"
-#define _MV_DUMP 0
+#define DRV_VERSION	"0.5.2"
+#define _MV_DUMP	0
 #define MVS_DISABLE_NVRAM
 #define MVS_DISABLE_MSI
 
@@ -52,7 +54,7 @@
 	readl(regs + MVS_##reg);		\
 	} while (0)
 
-#define MVS_ID_NOT_MAPPED	0xff
+#define MVS_ID_NOT_MAPPED	0x7f
 #define MVS_CHIP_SLOT_SZ	(1U << mvi->chip->slot_width)
 
 /* offset for D2H FIS in the Received FIS List Structure */
@@ -84,6 +86,7 @@ enum driver_configuration {
 	MVS_RX_FIS_COUNT	= 17,	/* Optional rx'd FISs (max 17) */
 
 	MVS_QUEUE_SIZE		= 30,	/* Support Queue depth */
+	MVS_CAN_QUEUE		= MVS_SLOTS - 1,	/* SCSI Queue depth */
 };
 
 /* unchangeable hardware details */
@@ -358,7 +361,20 @@ enum hw_register_bits {
 
 	/* VSR */
 	/* PHYMODE 6 (CDB) */
-	PHY_MODE6_DTL_SPEED	= (1U << 27),
+	PHY_MODE6_LATECLK	= (1U << 29),	/* Lock Clock */
+	PHY_MODE6_DTL_SPEED	= (1U << 27),	/* Digital Loop Speed */
+	PHY_MODE6_FC_ORDER	= (1U << 26),	/* Fibre Channel Mode Order*/
+	PHY_MODE6_MUCNT_EN	= (1U << 24),	/* u Count Enable */
+	PHY_MODE6_SEL_MUCNT_LEN	= (1U << 22),	/* Training Length Select */
+	PHY_MODE6_SELMUPI	= (1U << 20),	/* Phase Multi Select (init) */
+	PHY_MODE6_SELMUPF	= (1U << 18),	/* Phase Multi Select (final) */
+	PHY_MODE6_SELMUFF	= (1U << 16),	/* Freq Loop Multi Sel(final) */
+	PHY_MODE6_SELMUFI	= (1U << 14),	/* Freq Loop Multi Sel(init) */
+	PHY_MODE6_FREEZE_LOOP	= (1U << 12),	/* Freeze Rx CDR Loop */
+	PHY_MODE6_INT_RXFOFFS	= (1U << 3),	/* Rx CDR Freq Loop Enable */
+	PHY_MODE6_FRC_RXFOFFS	= (1U << 2),	/* Initial Rx CDR Offset */
+	PHY_MODE6_STAU_0D8	= (1U << 1),	/* Rx CDR Freq Loop Saturate */
+	PHY_MODE6_RXSAT_DIS	= (1U << 0),	/* Saturate Ctl */
 };
 
 enum mvs_info_flags {
@@ -511,7 +527,43 @@ enum status_buffer {
 };
 
 enum error_info_rec {
-	CMD_ISS_STPD	=  (1U << 31),	/* Cmd Issue Stopped */
+	CMD_ISS_STPD	= (1U << 31),	/* Cmd Issue Stopped */
+	CMD_PI_ERR	= (1U << 30),	/* Protection info error.  see flags2 */
+	RSP_OVER	= (1U << 29),	/* rsp buffer overflow */
+	RETRY_LIM	= (1U << 28),	/* FIS/frame retry limit exceeded */
+	UNK_FIS 	= (1U << 27),	/* unknown FIS */
+	DMA_TERM	= (1U << 26),	/* DMA terminate primitive rx'd */
+	SYNC_ERR	= (1U << 25),	/* SYNC rx'd during frame xmit */
+	TFILE_ERR	= (1U << 24),	/* SATA taskfile Error bit set */
+	R_ERR		= (1U << 23),	/* SATA returned R_ERR prim */
+	RD_OFS		= (1U << 20),	/* Read DATA frame invalid offset */
+	XFER_RDY_OFS	= (1U << 19),	/* XFER_RDY offset error */
+	UNEXP_XFER_RDY	= (1U << 18),	/* unexpected XFER_RDY error */
+	DATA_OVER_UNDER = (1U << 16),	/* data overflow/underflow */
+	INTERLOCK	= (1U << 15),	/* interlock error */
+	NAK		= (1U << 14),	/* NAK rx'd */
+	ACK_NAK_TO	= (1U << 13),	/* ACK/NAK timeout */
+	CXN_CLOSED	= (1U << 12),	/* cxn closed w/out ack/nak */
+	OPEN_TO 	= (1U << 11),	/* I_T nexus lost, open cxn timeout */
+	PATH_BLOCKED	= (1U << 10),	/* I_T nexus lost, pathway blocked */
+	NO_DEST 	= (1U << 9),	/* I_T nexus lost, no destination */
+	STP_RES_BSY	= (1U << 8),	/* STP resources busy */
+	BREAK		= (1U << 7),	/* break received */
+	BAD_DEST	= (1U << 6),	/* bad destination */
+	BAD_PROTO	= (1U << 5),	/* protocol not supported */
+	BAD_RATE	= (1U << 4),	/* cxn rate not supported */
+	WRONG_DEST	= (1U << 3),	/* wrong destination error */
+	CREDIT_TO	= (1U << 2),	/* credit timeout */
+	WDOG_TO 	= (1U << 1),	/* watchdog timeout */
+	BUF_PAR 	= (1U << 0),	/* buffer parity error */
+};
+
+enum error_info_rec_2 {
+	SLOT_BSY_ERR	= (1U << 31),	/* Slot Busy Error */
+	GRD_CHK_ERR	= (1U << 14),	/* Guard Check Error */
+	APP_CHK_ERR	= (1U << 13),	/* Application Check error */
+	REF_CHK_ERR	= (1U << 12),	/* Reference Check Error */
+	USR_BLK_NM	= (1U << 0),	/* User Block Number */
 };
 
 struct mvs_chip_info {
@@ -543,28 +595,12 @@ struct mvs_cmd_hdr {
 	__le32			reserved[4];
 };
 
-struct mvs_slot_info {
-	struct sas_task		*task;
-	u32			n_elem;
-	u32			tx;
-
-	/* DMA buffer for storing cmd tbl, open addr frame, status buffer,
-	 * and PRD table
-	 */
-	void			*buf;
-	dma_addr_t		buf_dma;
-#if _MV_DUMP
-	u32			cmd_size;
-#endif
-
-	void			*response;
-};
-
 struct mvs_port {
 	struct asd_sas_port	sas_port;
 	u8			port_attached;
 	u8			taskfileset;
 	u8			wide_port_phymap;
+	struct list_head	list;
 };
 
 struct mvs_phy {
@@ -582,6 +618,27 @@ struct mvs_phy {
 	u32		frame_rcvd_size;
 	u8		frame_rcvd[32];
 	u8		phy_attached;
+	enum sas_linkrate	minimum_linkrate;
+	enum sas_linkrate	maximum_linkrate;
+};
+
+struct mvs_slot_info {
+	struct list_head	list;
+	struct sas_task		*task;
+	u32			n_elem;
+	u32			tx;
+
+	/* DMA buffer for storing cmd tbl, open addr frame, status buffer,
+	 * and PRD table
+	 */
+	void			*buf;
+	dma_addr_t		buf_dma;
+#if _MV_DUMP
+	u32			cmd_size;
+#endif
+
+	void			*response;
+	struct mvs_port		*port;
 };
 
 struct mvs_info {
@@ -612,21 +669,14 @@ struct mvs_info {
 
 	const struct mvs_chip_info *chip;
 
-	unsigned long		tags[MVS_SLOTS];
+	u8			tags[MVS_SLOTS];
 	struct mvs_slot_info	slot_info[MVS_SLOTS];
 				/* further per-slot information */
 	struct mvs_phy		phy[MVS_MAX_PHYS];
 	struct mvs_port		port[MVS_MAX_PHYS];
-
-	u32			can_queue;	/* per adapter */
-	u32			tag_out;	/*Get*/
-	u32			tag_in;		/*Give*/
-};
-
-struct mvs_queue_task {
-	struct list_head list;
-
-	void   *uldd_task;
+#ifdef MVS_USE_TASKLET
+	struct tasklet_struct	tasklet;
+#endif
 };
 
 static int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
@@ -641,10 +691,11 @@ static u32 mvs_read_port_irq_mask(struct mvs_info *mvi, u32 port);
 static u32 mvs_is_phy_ready(struct mvs_info *mvi, int i);
 static void mvs_detect_porttype(struct mvs_info *mvi, int i);
 static void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st);
+static void mvs_release_task(struct mvs_info *mvi, int phy_no);
 
 static int mvs_scan_finished(struct Scsi_Host *, unsigned long);
 static void mvs_scan_start(struct Scsi_Host *);
-static int mvs_sas_slave_alloc(struct scsi_device *scsi_dev);
+static int mvs_slave_configure(struct scsi_device *sdev);
 
 static struct scsi_transport_template *mvs_stt;
 
@@ -659,7 +710,7 @@ static struct scsi_host_template mvs_sht = {
 	.name			= DRV_NAME,
 	.queuecommand		= sas_queuecommand,
 	.target_alloc		= sas_target_alloc,
-	.slave_configure	= sas_slave_configure,
+	.slave_configure	= mvs_slave_configure,
 	.slave_destroy		= sas_slave_destroy,
 	.scan_finished		= mvs_scan_finished,
 	.scan_start		= mvs_scan_start,
@@ -674,7 +725,7 @@ static struct scsi_host_template mvs_sht = {
 	.use_clustering		= ENABLE_CLUSTERING,
 	.eh_device_reset_handler	= sas_eh_device_reset_handler,
 	.eh_bus_reset_handler	= sas_eh_bus_reset_handler,
-	.slave_alloc		= mvs_sas_slave_alloc,
+	.slave_alloc		= sas_slave_alloc,
 	.target_destroy		= sas_target_destroy,
 	.ioctl			= sas_ioctl,
 };
-- 
1.5.4





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/9][RESEND] mvsas: fill in error info record and phy mode6 bits.
  2008-03-27  6:53 [PATCH 1/9][RESEND] mvsas: fill in error info record and phy mode6 bits Ke Wei
@ 2008-03-27 13:36 ` Jeff Garzik
  2008-03-30 15:03 ` James Bottomley
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2008-03-27 13:36 UTC (permalink / raw)
  To: kewei; +Cc: linux-scsi, james.bottomley

Ke Wei wrote:
> and remove some unused members from struct.
> 
> 
> Signed-off-by: Ke Wei <kewei@marvell.com>

For patches 1-8:

Acked-by:  Jeff Garzik <jgarzik@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/9][RESEND] mvsas: fill in error info record and phy mode6 bits.
  2008-03-27  6:53 [PATCH 1/9][RESEND] mvsas: fill in error info record and phy mode6 bits Ke Wei
  2008-03-27 13:36 ` Jeff Garzik
@ 2008-03-30 15:03 ` James Bottomley
  2008-03-31 10:44   ` Ke Wei
  1 sibling, 1 reply; 4+ messages in thread
From: James Bottomley @ 2008-03-30 15:03 UTC (permalink / raw)
  To: kewei; +Cc: linux-scsi, jeff

On Thu, 2008-03-27 at 14:53 +0800, Ke Wei wrote:
> and remove some unused members from struct.

Well ... I'll put this in, since it's an improvement.  However, it looks
like error handling is broken; this is what I get ejecting a CD (which
was successfully inserted and read):

00000000 : 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
00 : ................

sas: command 0xf53617c0, task 0xf741fcb0, timed out: EH_NOT_HANDLED
sas: Enter sas_scsi_recover_host
sas: trying to find task 0xf741fcb0
sas: sas_scsi_find_task: aborting task 0xf741fcb0
sas: sas_scsi_find_task: task 0xf741fcb0 is aborted
sas: sas_eh_handle_sas_errors: task 0xf741fcb0 is aborted
sas: --- Exit sas_scsi_recover_host
BUG: unable to handle kernel paging request at 6b6b6c2b
IP: [<c014066b>] __lock_acquire+0x6b/0xff0
*pde = 00000000 
Oops: 0002 [#1] SMP 
Modules linked in: isofs iTCO_wdt serio_raw iTCO_vendor_support
i3000_edac ext3 jbd mbcache sg sr_mod cdrom sd_mod uhci_hcd tg3 aic79xx
scsi_transport_spi aic94xx usbcore mvsas libsas libata firmware_class
scsi_transport_sas scsi_mod

Pid: 0, comm: swapper Not tainted (2.6.25-rc7 #78)
EIP: 0060:[<c014066b>] EFLAGS: 00010002 CPU: 0
EIP is at __lock_acquire+0x6b/0xff0
EAX: 00000002 EBX: 00000046 ECX: f741fccc EDX: 00000002
ESI: 00000001 EDI: 6b6b6b6b EBP: c0479e38 ESP: c0479db8
 DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
Process swapper (pid: 0, ti=c0478000 task=c044c3c0 task.ti=c0478000)
Stack: c044c3c0 c044c3c0 00000001 c044c3c0 c02f4c77 00000292 c0479de0
c01400fa 
       f531d1ec 00000292 c0479df0 00000292 00000002 00000000 00000000
f741fccc 
       c044c3c0 f799c1c0 c0479e2c f89ce647 00000286 000002b4 f531d030
c044c3c0 
Call Trace:
 [<c02f4c77>] ? _spin_unlock_irqrestore+0x47/0x60
 [<c01400fa>] ? trace_hardirqs_on+0x7a/0x140
 [<f89ce647>] ? scsi_run_queue+0xf7/0x1b0 [scsi_mod]
 [<c0141668>] ? lock_acquire+0x78/0xa0
 [<f8837fb0>] ? mvs_slot_complete+0x60/0x300 [mvsas]
 [<c02f47cb>] ? _spin_lock+0x2b/0x40
 [<f8837fb0>] ? mvs_slot_complete+0x60/0x300 [mvsas]
 [<f8837fb0>] ? mvs_slot_complete+0x60/0x300 [mvsas]
 [<f8838351>] ? mvs_int_full+0x91/0x450 [mvsas]
 [<f8839459>] ? mvs_interrupt+0x39/0x60 [mvsas]
 [<c02f47d2>] ? _spin_lock+0x32/0x40
 [<f8839460>] ? mvs_interrupt+0x40/0x60 [mvsas]
 [<c0150fc8>] ? handle_IRQ_event+0x28/0x60
 [<c01523a1>] ? handle_fasteoi_irq+0x71/0xe0
 [<c01066d8>] ? do_IRQ+0x48/0xa0
 [<c0104c26>] ? common_interrupt+0x2e/0x34
 [<c01400d8>] ? trace_hardirqs_on+0x58/0x140
 [<c0102d93>] ? default_idle+0x63/0xa0
 [<c0102d30>] ? default_idle+0x0/0xa0
 [<c0102bbd>] ? cpu_idle+0x5d/0xe0
 [<c02e5969>] ? rest_init+0x49/0x50
 =======================
Code: c4 02 0f 85 78 05 00 00 83 7d b8 07 0f 87 9f 05 00 00 8b 4d b8 85
c9 0f 85 6b 03 00 00 8b 4d bc 8b 79 04 85 ff 0f 84 5d 03 00 00 <f0> ff
87 c0 00 00 00 89 f8 e8 57 d4 ff ff 85 c0 0f 85 00 02 00 
EIP: [<c014066b>] __lock_acquire+0x6b/0xff0 SS:ESP 0068:c0479db8
Kernel panic - not syncing: Fatal exception in interrupt



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/9][RESEND] mvsas: fill in error info record and phy mode6 bits.
  2008-03-30 15:03 ` James Bottomley
@ 2008-03-31 10:44   ` Ke Wei
  0 siblings, 0 replies; 4+ messages in thread
From: Ke Wei @ 2008-03-31 10:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi, jeff

James Bottomley wrote:
> Well ... I'll put this in, since it's an improvement.  However, it looks
> like error handling is broken; this is what I get ejecting a CD (which
> was successfully inserted and read):
> 
Today I checked this bug report. It doesn't happen. Do you have more detail information? 
But I observed that the GPCMD_GET_EVENT_STATUS_NOTIFICATION command will be retried when timeout occurs. Maybe it will cause WARNING then system hangs sometimes. 

------------[ cut here ]------------
WARNING: at drivers/ata/libata-core.c:5769 __ata_qc_complete+0x9f/0xc0()
Modules linked in: mvsas dm_mod md_mod lp parport_pc psmouse floppy parport serio_raw pcspkr rng_core ide_pci_generic it821x button af_packet evdev ide_generic piix usbhid thermal processor fan [last unloaded: mvsas]
Pid: 1437, comm: cc1 Not tainted 2.6.25-rc6 #5
 [<c01289cf>] warn_on_slowpath+0x5f/0xa0
 [<c0149e20>] __lock_acquire+0x250/0x10b0
 [<c03eb61f>] __ata_qc_complete+0x9f/0xc0
 [<c03cb19b>] sas_ata_task_done+0xdb/0x250
 [<d78d52f0>] mvs_slot_complete+0x160/0x2f0 [mvsas]
 [<d78d52fa>] mvs_slot_complete+0x16a/0x2f0 [mvsas]
 [<d78d5578>] mvs_int_full+0x98/0x480 [mvsas]
 [<d78d599c>] mvs_interrupt+0x3c/0x60 [mvsas]
 [<c015c1d0>] handle_IRQ_event+0x20/0x60
 [<c015dcc9>] handle_fasteoi_irq+0x79/0x110
 [<c010734b>] do_IRQ+0x3b/0x80
 [<c0105792>] common_interrupt+0x2e/0x34
 [<c012007b>] pick_next_highest_task_rt+0x6b/0x110
 [<c012dce2>] __do_softirq+0x72/0x100
 [<c012ddc5>] do_softirq+0x55/0x60
 [<c0111f54>] smp_apic_timer_interrupt+0x54/0x80
 [<c0105869>] apic_timer_interrupt+0x29/0x38
 [<c0105873>] apic_timer_interrupt+0x33/0x38
 =======================
---[ end trace ea458b53b1ca42bf ]---
sr0: CDROM (ioctl) error, command: Read TOC/PMA/ATIP 43 00 00 00 00 00 00 00 0c 00
sr: Sense Key : No Sense [current] 
sr: Add. Sense: No additional sense information


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-31 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27  6:53 [PATCH 1/9][RESEND] mvsas: fill in error info record and phy mode6 bits Ke Wei
2008-03-27 13:36 ` Jeff Garzik
2008-03-30 15:03 ` James Bottomley
2008-03-31 10:44   ` Ke Wei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).