aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/aic7xxx/aic79xx_core.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-02-07 07:54:46 -0700
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-27 22:55:09 -0600
commit6ea3c0b2dac0d6a857d6bc010e544f4c901fff78 (patch)
tree0650d6e8b5be747eb192e558dd90e875ca7a13fb /drivers/scsi/aic7xxx/aic79xx_core.c
parentb0dc1db15225d5801bf3105966c9ce12c5142013 (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/aic7xxx/aic79xx_core.c')
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 342f77966a5..b6266fd3168 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,
{
if (offset == 0)
period = AHD_ASYNC_XFER_PERIOD;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXTENDED;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_SDTR_LEN;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_SDTR;
- ahd->msgout_buf[ahd->msgout_index++] = period;
- ahd->msgout_buf[ahd->msgout_index++] = offset;
+ ahd->msgout_index += spi_populate_sync_msg(
+ ahd->msgout_buf + ahd->msgout_index, period, offset);
ahd->msgout_len += 5;
if (bootverbose) {
printf("(%s:%c:%d:%d): Sending SDTR period %x, offset %x\n",
@@ -3783,10 +3780,8 @@ static void
ahd_construct_wdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
u_int bus_width)
{
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXTENDED;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_WDTR_LEN;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_WDTR;
- ahd->msgout_buf[ahd->msgout_index++] = bus_width;
+ ahd->msgout_index += spi_populate_width_msg(
+ ahd->msgout_buf + ahd->msgout_index, bus_width);
ahd->msgout_len += 4;
if (bootverbose) {
printf("(%s:%c:%d:%d): Sending WDTR %x\n",
@@ -3813,14 +3808,9 @@ ahd_construct_ppr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
ppr_options |= MSG_EXT_PPR_PCOMP_EN;
if (offset == 0)
period = AHD_ASYNC_XFER_PERIOD;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXTENDED;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_PPR_LEN;
- ahd->msgout_buf[ahd->msgout_index++] = MSG_EXT_PPR;
- ahd->msgout_buf[ahd->msgout_index++] = period;
- ahd->msgout_buf[ahd->msgout_index++] = 0;
- ahd->msgout_buf[ahd->msgout_index++] = offset;
- ahd->msgout_buf[ahd->msgout_index++] = bus_width;
- ahd->msgout_buf[ahd->msgout_index++] = ppr_options;
+ ahd->msgout_index += spi_populate_ppr_msg(
+ ahd->msgout_buf + ahd->msgout_index, period, offset,
+ bus_width, ppr_options);
ahd->msgout_len += 8;
if (bootverbose) {
printf("(%s:%c:%d:%d): Sending PPR bus_width %x, period %x, "