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 | |
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>
-rw-r--r-- | drivers/scsi/53c700.c | 18 | ||||
-rw-r--r-- | drivers/scsi/aha152x.c | 7 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_core.c | 24 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_core.c | 24 | ||||
-rw-r--r-- | drivers/scsi/ncr53c8xx.c | 25 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_spi.c | 33 | ||||
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_hipd.c | 53 | ||||
-rw-r--r-- | include/scsi/scsi_transport_spi.h | 4 |
8 files changed, 73 insertions, 115 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 4ce7438608ec..6a0f9506ea00 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -238,14 +238,6 @@ static char *NCR_700_SBCL_to_phase[] = { | |||
238 | "MSG IN", | 238 | "MSG IN", |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static __u8 NCR_700_SDTR_msg[] = { | ||
242 | 0x01, /* Extended message */ | ||
243 | 0x03, /* Extended message Length */ | ||
244 | 0x01, /* SDTR Extended message */ | ||
245 | NCR_700_MIN_PERIOD, | ||
246 | NCR_700_MAX_OFFSET | ||
247 | }; | ||
248 | |||
249 | /* This translates the SDTR message offset and period to a value | 241 | /* This translates the SDTR message offset and period to a value |
250 | * which can be loaded into the SXFER_REG. | 242 | * which can be loaded into the SXFER_REG. |
251 | * | 243 | * |
@@ -266,7 +258,7 @@ NCR_700_offset_period_to_sxfer(struct NCR_700_Host_Parameters *hostdata, | |||
266 | return 0; | 258 | return 0; |
267 | 259 | ||
268 | if(period < hostdata->min_period) { | 260 | if(period < hostdata->min_period) { |
269 | printk(KERN_WARNING "53c700: Period %dns is less than this chip's minimum, setting to %d\n", period*4, NCR_700_SDTR_msg[3]*4); | 261 | printk(KERN_WARNING "53c700: Period %dns is less than this chip's minimum, setting to %d\n", period*4, NCR_700_MIN_PERIOD*4); |
270 | period = hostdata->min_period; | 262 | period = hostdata->min_period; |
271 | } | 263 | } |
272 | XFERP = (period*4 * hostdata->sync_clock)/1000 - 4; | 264 | XFERP = (period*4 * hostdata->sync_clock)/1000 - 4; |
@@ -1434,11 +1426,9 @@ NCR_700_start_command(struct scsi_cmnd *SCp) | |||
1434 | 1426 | ||
1435 | if(hostdata->fast && | 1427 | if(hostdata->fast && |
1436 | NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC)) { | 1428 | NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC)) { |
1437 | memcpy(&hostdata->msgout[count], NCR_700_SDTR_msg, | 1429 | count += spi_populate_sync_msg(&hostdata->msgout[count], |
1438 | sizeof(NCR_700_SDTR_msg)); | 1430 | spi_period(SCp->device->sdev_target), |
1439 | hostdata->msgout[count+3] = spi_period(SCp->device->sdev_target); | 1431 | spi_offset(SCp->device->sdev_target)); |
1440 | hostdata->msgout[count+4] = spi_offset(SCp->device->sdev_target); | ||
1441 | count += sizeof(NCR_700_SDTR_msg); | ||
1442 | NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); | 1432 | NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); |
1443 | } | 1433 | } |
1444 | 1434 | ||
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index cb2ee25f213f..67d78ed7119a 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -1708,12 +1708,7 @@ static void seldo_run(struct Scsi_Host *shpnt) | |||
1708 | ADDMSGO(BUS_DEVICE_RESET); | 1708 | ADDMSGO(BUS_DEVICE_RESET); |
1709 | } else if (SYNCNEG==0 && SYNCHRONOUS) { | 1709 | } else if (SYNCNEG==0 && SYNCHRONOUS) { |
1710 | CURRENT_SC->SCp.phase |= syncneg; | 1710 | CURRENT_SC->SCp.phase |= syncneg; |
1711 | ADDMSGO(EXTENDED_MESSAGE); | 1711 | MSGOLEN += spi_populate_sync_msg(&MSGO(MSGOLEN), 50, 8); |
1712 | ADDMSGO(3); | ||
1713 | ADDMSGO(EXTENDED_SDTR); | ||
1714 | ADDMSGO(50); /* 200ns */ | ||
1715 | ADDMSGO(8); /* 8 byte req/ack offset */ | ||
1716 | |||
1717 | SYNCNEG=1; /* negotiation in progress */ | 1712 | SYNCNEG=1; /* negotiation in progress */ |
1718 | } | 1713 | } |
1719 | 1714 | ||
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 342f77966a5b..b6266fd31688 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -3762,11 +3762,8 @@ ahd_construct_sdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, | |||
3762 | { | 3762 | { |
3763 | if (offset == 0) | 3763 | if (offset == 0) |
3764 | period = AHD_ASYNC_XFER_PERIOD; | 3764 | period = AHD_ASYNC_XFER_PERIOD; |
3765 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXTENDED; | 3765 | ahd->msgout_index += spi_populate_sync_msg( |
3766 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_SDTR_LEN; | 3766 | ahd->msgout_buf + ahd->msgout_index, period, offset); |
3767 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_SDTR; | ||
3768 | ahd->msgout_buf[ahd->msgout_index++] = period; | ||
3769 | ahd->msgout_buf[ahd->msgout_index++] = offset; | ||
3770 | ahd->msgout_len += 5; | 3767 | ahd->msgout_len += 5; |
3771 | if (bootverbose) { | 3768 | if (bootverbose) { |
3772 | printf("(%s:%c:%d:%d): Sending SDTR period %x, offset %x\n", | 3769 | printf("(%s:%c:%d:%d): Sending SDTR period %x, offset %x\n", |
@@ -3783,10 +3780,8 @@ static void | |||
3783 | ahd_construct_wdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, | 3780 | ahd_construct_wdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, |
3784 | u_int bus_width) | 3781 | u_int bus_width) |
3785 | { | 3782 | { |
3786 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXTENDED; | 3783 | ahd->msgout_index += spi_populate_width_msg( |
3787 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_WDTR_LEN; | 3784 | ahd->msgout_buf + ahd->msgout_index, bus_width); |
3788 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_WDTR; | ||
3789 | ahd->msgout_buf[ahd->msgout_index++] = bus_width; | ||
3790 | ahd->msgout_len += 4; | 3785 | ahd->msgout_len += 4; |
3791 | if (bootverbose) { | 3786 | if (bootverbose) { |
3792 | printf("(%s:%c:%d:%d): Sending WDTR %x\n", | 3787 | printf("(%s:%c:%d:%d): Sending WDTR %x\n", |
@@ -3813,14 +3808,9 @@ ahd_construct_ppr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, | |||
3813 | ppr_options |= MSG_EXT_PPR_PCOMP_EN; | 3808 | ppr_options |= MSG_EXT_PPR_PCOMP_EN; |
3814 | if (offset == 0) | 3809 | if (offset == 0) |
3815 | period = AHD_ASYNC_XFER_PERIOD; | 3810 | period = AHD_ASYNC_XFER_PERIOD; |
3816 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXTENDED; | 3811 | ahd->msgout_index += spi_populate_ppr_msg( |
3817 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_PPR_LEN; | 3812 | ahd->msgout_buf + ahd->msgout_index, period, offset, |
3818 | ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_PPR; | 3813 | bus_width, ppr_options); |
3819 | ahd->msgout_buf[ahd->msgout_index++] = period; | ||
3820 | ahd->msgout_buf[ahd->msgout_index++] = 0; | ||
3821 | ahd->msgout_buf[ahd->msgout_index++] = offset; | ||
3822 | ahd->msgout_buf[ahd->msgout_index++] = bus_width; | ||
3823 | ahd->msgout_buf[ahd->msgout_index++] = ppr_options; | ||
3824 | ahd->msgout_len += 8; | 3814 | ahd->msgout_len += 8; |
3825 | if (bootverbose) { | 3815 | if (bootverbose) { |
3826 | printf("(%s:%c:%d:%d): Sending PPR bus_width %x, period %x, " | 3816 | printf("(%s:%c:%d:%d): Sending PPR bus_width %x, period %x, " |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 58ac46103eb6..d37566978fba 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c | |||
@@ -2461,11 +2461,8 @@ ahc_construct_sdtr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
2461 | { | 2461 | { |
2462 | if (offset == 0) | 2462 | if (offset == 0) |
2463 | period = AHC_ASYNC_XFER_PERIOD; | 2463 | period = AHC_ASYNC_XFER_PERIOD; |
2464 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXTENDED; | 2464 | ahc->msgout_index += spi_populate_sync_msg( |
2465 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXT_SDTR_LEN; | 2465 | ahc->msgout_buf + ahc->msgout_index, period, offset); |
2466 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXT_SDTR; | ||
2467 | ahc->msgout_buf[ahc->msgout_index++] = period; | ||
2468 | ahc->msgout_buf[ahc->msgout_index++] = offset; | ||
2469 | ahc->msgout_len += 5; | 2466 | ahc->msgout_len += 5; |
2470 | if (bootverbose) { | 2467 | if (bootverbose) { |
2471 | printf("(%s:%c:%d:%d): Sending SDTR period %x, offset %x\n", | 2468 | printf("(%s:%c:%d:%d): Sending SDTR period %x, offset %x\n", |
@@ -2482,10 +2479,8 @@ static void | |||
2482 | ahc_construct_wdtr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | 2479 | ahc_construct_wdtr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, |
2483 | u_int bus_width) | 2480 | u_int bus_width) |
2484 | { | 2481 | { |
2485 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXTENDED; | 2482 | ahc->msgout_index += spi_populate_width_msg( |
2486 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXT_WDTR_LEN; | 2483 | ahc->msgout_buf + ahc->msgout_index, bus_width); |
2487 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXT_WDTR; | ||
2488 | ahc->msgout_buf[ahc->msgout_index++] = bus_width; | ||
2489 | ahc->msgout_len += 4; | 2484 | ahc->msgout_len += 4; |
2490 | if (bootverbose) { | 2485 | if (bootverbose) { |
2491 | printf("(%s:%c:%d:%d): Sending WDTR %x\n", | 2486 | printf("(%s:%c:%d:%d): Sending WDTR %x\n", |
@@ -2505,14 +2500,9 @@ ahc_construct_ppr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
2505 | { | 2500 | { |
2506 | if (offset == 0) | 2501 | if (offset == 0) |
2507 | period = AHC_ASYNC_XFER_PERIOD; | 2502 | period = AHC_ASYNC_XFER_PERIOD; |
2508 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXTENDED; | 2503 | ahc->msgout_index += spi_populate_ppr_msg( |
2509 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXT_PPR_LEN; | 2504 | ahc->msgout_buf + ahc->msgout_index, period, offset, |
2510 | ahc->msgout_buf[ahc->msgout_index++] = MSG_EXT_PPR; | 2505 | bus_width, ppr_options); |
2511 | ahc->msgout_buf[ahc->msgout_index++] = period; | ||
2512 | ahc->msgout_buf[ahc->msgout_index++] = 0; | ||
2513 | ahc->msgout_buf[ahc->msgout_index++] = offset; | ||
2514 | ahc->msgout_buf[ahc->msgout_index++] = bus_width; | ||
2515 | ahc->msgout_buf[ahc->msgout_index++] = ppr_options; | ||
2516 | ahc->msgout_len += 8; | 2506 | ahc->msgout_len += 8; |
2517 | if (bootverbose) { | 2507 | if (bootverbose) { |
2518 | printf("(%s:%c:%d:%d): Sending PPR bus_width %x, period %x, " | 2508 | printf("(%s:%c:%d:%d): Sending PPR bus_width %x, period %x, " |
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 | ||
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 97f4be62f748..c0051a432a97 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -1051,6 +1051,39 @@ void spi_display_xfer_agreement(struct scsi_target *starget) | |||
1051 | } | 1051 | } |
1052 | EXPORT_SYMBOL(spi_display_xfer_agreement); | 1052 | EXPORT_SYMBOL(spi_display_xfer_agreement); |
1053 | 1053 | ||
1054 | int spi_populate_width_msg(unsigned char *msg, int width) | ||
1055 | { | ||
1056 | msg[0] = EXTENDED_MESSAGE; | ||
1057 | msg[1] = 2; | ||
1058 | msg[2] = EXTENDED_WDTR; | ||
1059 | msg[3] = width; | ||
1060 | return 4; | ||
1061 | } | ||
1062 | |||
1063 | int spi_populate_sync_msg(unsigned char *msg, int period, int offset) | ||
1064 | { | ||
1065 | msg[0] = EXTENDED_MESSAGE; | ||
1066 | msg[1] = 3; | ||
1067 | msg[2] = EXTENDED_SDTR; | ||
1068 | msg[3] = period; | ||
1069 | msg[4] = offset; | ||
1070 | return 5; | ||
1071 | } | ||
1072 | |||
1073 | int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, | ||
1074 | int width, int options) | ||
1075 | { | ||
1076 | msg[0] = EXTENDED_MESSAGE; | ||
1077 | msg[1] = 6; | ||
1078 | msg[2] = EXTENDED_PPR; | ||
1079 | msg[3] = period; | ||
1080 | msg[4] = 0; | ||
1081 | msg[5] = offset; | ||
1082 | msg[6] = width; | ||
1083 | msg[7] = options; | ||
1084 | return 8; | ||
1085 | } | ||
1086 | |||
1054 | #ifdef CONFIG_SCSI_CONSTANTS | 1087 | #ifdef CONFIG_SCSI_CONSTANTS |
1055 | static const char * const one_byte_msgs[] = { | 1088 | static const char * const one_byte_msgs[] = { |
1056 | /* 0x00 */ "Command Complete", NULL, "Save Pointers", | 1089 | /* 0x00 */ "Command Complete", NULL, "Save Pointers", |
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index f4854c33f48d..620b4726fbd9 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <asm/param.h> /* for timeouts in units of HZ */ | 42 | #include <asm/param.h> /* for timeouts in units of HZ */ |
43 | #include <scsi/scsi_dbg.h> | ||
44 | 43 | ||
45 | #include "sym_glue.h" | 44 | #include "sym_glue.h" |
46 | #include "sym_nvram.h" | 45 | #include "sym_nvram.h" |
@@ -1430,29 +1429,18 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp | |||
1430 | 1429 | ||
1431 | switch (nego) { | 1430 | switch (nego) { |
1432 | case NS_SYNC: | 1431 | case NS_SYNC: |
1433 | msgptr[msglen++] = M_EXTENDED; | 1432 | msglen += spi_populate_sync_msg(msgptr + msglen, goal->period, |
1434 | msgptr[msglen++] = 3; | 1433 | goal->offset); |
1435 | msgptr[msglen++] = M_X_SYNC_REQ; | ||
1436 | msgptr[msglen++] = goal->period; | ||
1437 | msgptr[msglen++] = goal->offset; | ||
1438 | break; | 1434 | break; |
1439 | case NS_WIDE: | 1435 | case NS_WIDE: |
1440 | msgptr[msglen++] = M_EXTENDED; | 1436 | msglen += spi_populate_width_msg(msgptr + msglen, goal->width); |
1441 | msgptr[msglen++] = 2; | ||
1442 | msgptr[msglen++] = M_X_WIDE_REQ; | ||
1443 | msgptr[msglen++] = goal->width; | ||
1444 | break; | 1437 | break; |
1445 | case NS_PPR: | 1438 | case NS_PPR: |
1446 | msgptr[msglen++] = M_EXTENDED; | 1439 | msglen += spi_populate_ppr_msg(msgptr + msglen, goal->period, |
1447 | msgptr[msglen++] = 6; | 1440 | goal->offset, goal->width, |
1448 | msgptr[msglen++] = M_X_PPR_REQ; | 1441 | (goal->iu ? PPR_OPT_IU : 0) | |
1449 | msgptr[msglen++] = goal->period; | ||
1450 | msgptr[msglen++] = 0; | ||
1451 | msgptr[msglen++] = goal->offset; | ||
1452 | msgptr[msglen++] = goal->width; | ||
1453 | msgptr[msglen++] = (goal->iu ? PPR_OPT_IU : 0) | | ||
1454 | (goal->dt ? PPR_OPT_DT : 0) | | 1442 | (goal->dt ? PPR_OPT_DT : 0) | |
1455 | (goal->qas ? PPR_OPT_QAS : 0); | 1443 | (goal->qas ? PPR_OPT_QAS : 0)); |
1456 | break; | 1444 | break; |
1457 | } | 1445 | } |
1458 | 1446 | ||
@@ -3948,11 +3936,7 @@ sym_sync_nego_check(struct sym_hcb *np, int req, struct sym_ccb *cp) | |||
3948 | /* | 3936 | /* |
3949 | * It was a request. Prepare an answer message. | 3937 | * It was a request. Prepare an answer message. |
3950 | */ | 3938 | */ |
3951 | np->msgout[0] = M_EXTENDED; | 3939 | spi_populate_sync_msg(np->msgout, per, ofs); |
3952 | np->msgout[1] = 3; | ||
3953 | np->msgout[2] = M_X_SYNC_REQ; | ||
3954 | np->msgout[3] = per; | ||
3955 | np->msgout[4] = ofs; | ||
3956 | 3940 | ||
3957 | if (DEBUG_FLAGS & DEBUG_NEGO) { | 3941 | if (DEBUG_FLAGS & DEBUG_NEGO) { |
3958 | sym_print_nego_msg(np, target, "sync msgout", np->msgout); | 3942 | sym_print_nego_msg(np, target, "sync msgout", np->msgout); |
@@ -4078,14 +4062,7 @@ sym_ppr_nego_check(struct sym_hcb *np, int req, int target) | |||
4078 | /* | 4062 | /* |
4079 | * It was a request. Prepare an answer message. | 4063 | * It was a request. Prepare an answer message. |
4080 | */ | 4064 | */ |
4081 | np->msgout[0] = M_EXTENDED; | 4065 | spi_populate_ppr_msg(np->msgout, per, ofs, wide, opts); |
4082 | np->msgout[1] = 6; | ||
4083 | np->msgout[2] = M_X_PPR_REQ; | ||
4084 | np->msgout[3] = per; | ||
4085 | np->msgout[4] = 0; | ||
4086 | np->msgout[5] = ofs; | ||
4087 | np->msgout[6] = wide; | ||
4088 | np->msgout[7] = opts; | ||
4089 | 4066 | ||
4090 | if (DEBUG_FLAGS & DEBUG_NEGO) { | 4067 | if (DEBUG_FLAGS & DEBUG_NEGO) { |
4091 | sym_print_nego_msg(np, target, "ppr msgout", np->msgout); | 4068 | sym_print_nego_msg(np, target, "ppr msgout", np->msgout); |
@@ -4197,10 +4174,7 @@ sym_wide_nego_check(struct sym_hcb *np, int req, struct sym_ccb *cp) | |||
4197 | /* | 4174 | /* |
4198 | * It was a request. Prepare an answer message. | 4175 | * It was a request. Prepare an answer message. |
4199 | */ | 4176 | */ |
4200 | np->msgout[0] = M_EXTENDED; | 4177 | spi_populate_width_msg(np->msgout, wide); |
4201 | np->msgout[1] = 2; | ||
4202 | np->msgout[2] = M_X_WIDE_REQ; | ||
4203 | np->msgout[3] = wide; | ||
4204 | 4178 | ||
4205 | np->msgin [0] = M_NOOP; | 4179 | np->msgin [0] = M_NOOP; |
4206 | 4180 | ||
@@ -4245,11 +4219,8 @@ static void sym_wide_nego(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb | |||
4245 | * a single SCSI command (Suggested by Justin Gibbs). | 4219 | * a single SCSI command (Suggested by Justin Gibbs). |
4246 | */ | 4220 | */ |
4247 | if (tp->tgoal.offset) { | 4221 | if (tp->tgoal.offset) { |
4248 | np->msgout[0] = M_EXTENDED; | 4222 | spi_populate_sync_msg(np->msgout, tp->tgoal.period, |
4249 | np->msgout[1] = 3; | 4223 | tp->tgoal.offset); |
4250 | np->msgout[2] = M_X_SYNC_REQ; | ||
4251 | np->msgout[3] = tp->tgoal.period; | ||
4252 | np->msgout[4] = tp->tgoal.offset; | ||
4253 | 4224 | ||
4254 | if (DEBUG_FLAGS & DEBUG_NEGO) { | 4225 | if (DEBUG_FLAGS & DEBUG_NEGO) { |
4255 | sym_print_nego_msg(np, cp->target, | 4226 | sym_print_nego_msg(np, cp->target, |
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index fb5a2ffae939..5e1d61913d4e 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h | |||
@@ -148,5 +148,9 @@ void spi_schedule_dv_device(struct scsi_device *); | |||
148 | void spi_dv_device(struct scsi_device *); | 148 | void spi_dv_device(struct scsi_device *); |
149 | void spi_display_xfer_agreement(struct scsi_target *); | 149 | void spi_display_xfer_agreement(struct scsi_target *); |
150 | int spi_print_msg(const unsigned char *); | 150 | int spi_print_msg(const unsigned char *); |
151 | int spi_populate_width_msg(unsigned char *msg, int width); | ||
152 | int spi_populate_sync_msg(unsigned char *msg, int period, int offset); | ||
153 | int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, int width, | ||
154 | int options); | ||
151 | 155 | ||
152 | #endif /* SCSI_TRANSPORT_SPI_H */ | 156 | #endif /* SCSI_TRANSPORT_SPI_H */ |