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/aic7xxx | |
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/aic7xxx')
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_core.c | 24 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_core.c | 24 |
2 files changed, 14 insertions, 34 deletions
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, " |