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/scsi_transport_spi.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/scsi_transport_spi.c')
-rw-r--r-- | drivers/scsi/scsi_transport_spi.c | 33 |
1 files changed, 33 insertions, 0 deletions
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", |