aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic7xxx_core.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-02-07 09:54:46 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-27 23:55:09 -0500
commit6ea3c0b2dac0d6a857d6bc010e544f4c901fff78 (patch)
tree0650d6e8b5be747eb192e558dd90e875ca7a13fb /drivers/scsi/aic7xxx/aic7xxx_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/aic7xxx_core.c')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 58ac46103eb..d37566978fb 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
2482ahc_construct_wdtr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, 2479ahc_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, "