diff options
author | Matthew Wilcox <matthew@wil.cx> | 2006-02-07 09:54:46 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-02-27 23:55:09 -0500 |
commit | 6ea3c0b2dac0d6a857d6bc010e544f4c901fff78 (patch) | |
tree | 0650d6e8b5be747eb192e558dd90e875ca7a13fb /drivers/scsi/ncr53c8xx.c | |
parent | b0dc1db15225d5801bf3105966c9ce12c5142013 (diff) |
[SCSI] Add spi_populate_*_msg functions
Introduce new helpers:
- spi_populate_width_msg()
- spi_populate_sync_msg()
- spi_populate_ppr_msg()
and use them in drivers which already enable the SPI transport.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/ncr53c8xx.c')
-rw-r--r-- | drivers/scsi/ncr53c8xx.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index abb1859bff09..22f913127f08 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c | |||
@@ -4105,17 +4105,11 @@ static int ncr_prepare_nego(struct ncb *np, struct ccb *cp, u_char *msgptr) | |||
4105 | 4105 | ||
4106 | switch (nego) { | 4106 | switch (nego) { |
4107 | case NS_SYNC: | 4107 | case NS_SYNC: |
4108 | msgptr[msglen++] = EXTENDED_MESSAGE; | 4108 | msglen += spi_populate_sync_msg(msgptr + msglen, |
4109 | msgptr[msglen++] = 3; | 4109 | tp->maxoffs ? tp->minsync : 0, tp->maxoffs); |
4110 | msgptr[msglen++] = EXTENDED_SDTR; | ||
4111 | msgptr[msglen++] = tp->maxoffs ? tp->minsync : 0; | ||
4112 | msgptr[msglen++] = tp->maxoffs; | ||
4113 | break; | 4110 | break; |
4114 | case NS_WIDE: | 4111 | case NS_WIDE: |
4115 | msgptr[msglen++] = EXTENDED_MESSAGE; | 4112 | msglen += spi_populate_width_msg(msgptr + msglen, tp->usrwide); |
4116 | msgptr[msglen++] = 2; | ||
4117 | msgptr[msglen++] = EXTENDED_WDTR; | ||
4118 | msgptr[msglen++] = tp->usrwide; | ||
4119 | break; | 4113 | break; |
4120 | } | 4114 | } |
4121 | 4115 | ||
@@ -6989,12 +6983,7 @@ void ncr_int_sir (struct ncb *np) | |||
6989 | spi_offset(starget) = ofs; | 6983 | spi_offset(starget) = ofs; |
6990 | ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); | 6984 | ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); |
6991 | 6985 | ||
6992 | np->msgout[0] = EXTENDED_MESSAGE; | 6986 | spi_populate_sync_msg(np->msgout, per, ofs); |
6993 | np->msgout[1] = 3; | ||
6994 | np->msgout[2] = EXTENDED_SDTR; | ||
6995 | np->msgout[3] = per; | ||
6996 | np->msgout[4] = ofs; | ||
6997 | |||
6998 | cp->nego_status = NS_SYNC; | 6987 | cp->nego_status = NS_SYNC; |
6999 | 6988 | ||
7000 | if (DEBUG_FLAGS & DEBUG_NEGO) { | 6989 | if (DEBUG_FLAGS & DEBUG_NEGO) { |
@@ -7080,11 +7069,7 @@ void ncr_int_sir (struct ncb *np) | |||
7080 | 7069 | ||
7081 | spi_width(starget) = wide; | 7070 | spi_width(starget) = wide; |
7082 | ncr_setwide(np, cp, wide, 1); | 7071 | ncr_setwide(np, cp, wide, 1); |
7083 | 7072 | spi_populate_width_msg(np->msgout, wide); | |
7084 | np->msgout[0] = EXTENDED_MESSAGE; | ||
7085 | np->msgout[1] = 2; | ||
7086 | np->msgout[2] = EXTENDED_WDTR; | ||
7087 | np->msgout[3] = wide; | ||
7088 | 7073 | ||
7089 | np->msgin [0] = NOP; | 7074 | np->msgin [0] = NOP; |
7090 | 7075 | ||