diff options
Diffstat (limited to 'drivers/scsi/BusLogic.c')
-rw-r--r-- | drivers/scsi/BusLogic.c | 83 |
1 files changed, 38 insertions, 45 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index d7ca247efa35..344d87599cd2 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -3201,26 +3201,30 @@ static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_de | |||
3201 | BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. | 3201 | BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. |
3202 | */ | 3202 | */ |
3203 | 3203 | ||
3204 | static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *shost, char *ProcBuffer, char **StartPointer, off_t Offset, int BytesAvailable, int WriteFlag) | 3204 | static int BusLogic_write_info(struct Scsi_Host *shost, char *ProcBuffer, int BytesAvailable) |
3205 | { | 3205 | { |
3206 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; | 3206 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; |
3207 | struct BusLogic_TargetStatistics *TargetStatistics; | 3207 | struct BusLogic_TargetStatistics *TargetStatistics; |
3208 | int TargetID, Length; | ||
3209 | char *Buffer; | ||
3210 | 3208 | ||
3211 | TargetStatistics = HostAdapter->TargetStatistics; | 3209 | TargetStatistics = HostAdapter->TargetStatistics; |
3212 | if (WriteFlag) { | 3210 | HostAdapter->ExternalHostAdapterResets = 0; |
3213 | HostAdapter->ExternalHostAdapterResets = 0; | 3211 | HostAdapter->HostAdapterInternalErrors = 0; |
3214 | HostAdapter->HostAdapterInternalErrors = 0; | 3212 | memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); |
3215 | memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); | 3213 | return 0; |
3216 | return 0; | 3214 | } |
3217 | } | 3215 | |
3218 | Buffer = HostAdapter->MessageBuffer; | 3216 | static int BusLogic_show_info(struct seq_file *m, struct Scsi_Host *shost) |
3219 | Length = HostAdapter->MessageBufferLength; | 3217 | { |
3220 | Length += sprintf(&Buffer[Length], "\n\ | 3218 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; |
3219 | struct BusLogic_TargetStatistics *TargetStatistics; | ||
3220 | int TargetID; | ||
3221 | |||
3222 | TargetStatistics = HostAdapter->TargetStatistics; | ||
3223 | seq_write(m, HostAdapter->MessageBuffer, HostAdapter->MessageBufferLength); | ||
3224 | seq_printf(m, "\n\ | ||
3221 | Current Driver Queue Depth: %d\n\ | 3225 | Current Driver Queue Depth: %d\n\ |
3222 | Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); | 3226 | Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); |
3223 | Length += sprintf(&Buffer[Length], "\n\n\ | 3227 | seq_printf(m, "\n\n\ |
3224 | DATA TRANSFER STATISTICS\n\ | 3228 | DATA TRANSFER STATISTICS\n\ |
3225 | \n\ | 3229 | \n\ |
3226 | Target Tagged Queuing Queue Depth Active Attempted Completed\n\ | 3230 | Target Tagged Queuing Queue Depth Active Attempted Completed\n\ |
@@ -3229,66 +3233,62 @@ Target Tagged Queuing Queue Depth Active Attempted Completed\n\ | |||
3229 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3233 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3230 | if (!TargetFlags->TargetExists) | 3234 | if (!TargetFlags->TargetExists) |
3231 | continue; | 3235 | continue; |
3232 | Length += sprintf(&Buffer[Length], " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) | 3236 | seq_printf(m, " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) |
3233 | ? " Permitted" : " Disabled")) | 3237 | ? " Permitted" : " Disabled")) |
3234 | : "Not Supported")); | 3238 | : "Not Supported")); |
3235 | Length += sprintf(&Buffer[Length], | 3239 | seq_printf(m, |
3236 | " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); | 3240 | " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); |
3237 | } | 3241 | } |
3238 | Length += sprintf(&Buffer[Length], "\n\ | 3242 | seq_printf(m, "\n\ |
3239 | Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ | 3243 | Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ |
3240 | ====== ============= ============== =================== ===================\n"); | 3244 | ====== ============= ============== =================== ===================\n"); |
3241 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3245 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { |
3242 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3246 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3243 | if (!TargetFlags->TargetExists) | 3247 | if (!TargetFlags->TargetExists) |
3244 | continue; | 3248 | continue; |
3245 | Length += sprintf(&Buffer[Length], " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); | 3249 | seq_printf(m, " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); |
3246 | if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) | 3250 | if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) |
3247 | Length += sprintf(&Buffer[Length], " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); | 3251 | seq_printf(m, " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); |
3248 | else | 3252 | else |
3249 | Length += sprintf(&Buffer[Length], " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); | 3253 | seq_printf(m, " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); |
3250 | if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) | 3254 | if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) |
3251 | Length += sprintf(&Buffer[Length], " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); | 3255 | seq_printf(m, " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); |
3252 | else | 3256 | else |
3253 | Length += sprintf(&Buffer[Length], " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); | 3257 | seq_printf(m, " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); |
3254 | } | 3258 | } |
3255 | Length += sprintf(&Buffer[Length], "\n\ | 3259 | seq_printf(m, "\n\ |
3256 | Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ | 3260 | Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ |
3257 | ====== ======= ========= ========= ========= ========= =========\n"); | 3261 | ====== ======= ========= ========= ========= ========= =========\n"); |
3258 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3262 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { |
3259 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3263 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3260 | if (!TargetFlags->TargetExists) | 3264 | if (!TargetFlags->TargetExists) |
3261 | continue; | 3265 | continue; |
3262 | Length += | 3266 | seq_printf(m, |
3263 | sprintf(&Buffer[Length], | ||
3264 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, | 3267 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, |
3265 | TargetStatistics[TargetID].ReadCommandSizeBuckets[0], | 3268 | TargetStatistics[TargetID].ReadCommandSizeBuckets[0], |
3266 | TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); | 3269 | TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); |
3267 | Length += | 3270 | seq_printf(m, |
3268 | sprintf(&Buffer[Length], | ||
3269 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, | 3271 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, |
3270 | TargetStatistics[TargetID].WriteCommandSizeBuckets[0], | 3272 | TargetStatistics[TargetID].WriteCommandSizeBuckets[0], |
3271 | TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); | 3273 | TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); |
3272 | } | 3274 | } |
3273 | Length += sprintf(&Buffer[Length], "\n\ | 3275 | seq_printf(m, "\n\ |
3274 | Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ | 3276 | Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ |
3275 | ====== ======= ========= ========= ========= ========= =========\n"); | 3277 | ====== ======= ========= ========= ========= ========= =========\n"); |
3276 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3278 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { |
3277 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3279 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3278 | if (!TargetFlags->TargetExists) | 3280 | if (!TargetFlags->TargetExists) |
3279 | continue; | 3281 | continue; |
3280 | Length += | 3282 | seq_printf(m, |
3281 | sprintf(&Buffer[Length], | ||
3282 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, | 3283 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, |
3283 | TargetStatistics[TargetID].ReadCommandSizeBuckets[5], | 3284 | TargetStatistics[TargetID].ReadCommandSizeBuckets[5], |
3284 | TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); | 3285 | TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); |
3285 | Length += | 3286 | seq_printf(m, |
3286 | sprintf(&Buffer[Length], | ||
3287 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, | 3287 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, |
3288 | TargetStatistics[TargetID].WriteCommandSizeBuckets[5], | 3288 | TargetStatistics[TargetID].WriteCommandSizeBuckets[5], |
3289 | TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); | 3289 | TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); |
3290 | } | 3290 | } |
3291 | Length += sprintf(&Buffer[Length], "\n\n\ | 3291 | seq_printf(m, "\n\n\ |
3292 | ERROR RECOVERY STATISTICS\n\ | 3292 | ERROR RECOVERY STATISTICS\n\ |
3293 | \n\ | 3293 | \n\ |
3294 | Command Aborts Bus Device Resets Host Adapter Resets\n\ | 3294 | Command Aborts Bus Device Resets Host Adapter Resets\n\ |
@@ -3299,20 +3299,12 @@ Target Requested Completed Requested Completed Requested Completed\n\ | |||
3299 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3299 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3300 | if (!TargetFlags->TargetExists) | 3300 | if (!TargetFlags->TargetExists) |
3301 | continue; | 3301 | continue; |
3302 | Length += sprintf(&Buffer[Length], "\ | 3302 | seq_printf(m, "\ |
3303 | %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted); | 3303 | %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted); |
3304 | } | 3304 | } |
3305 | Length += sprintf(&Buffer[Length], "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); | 3305 | seq_printf(m, "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); |
3306 | Length += sprintf(&Buffer[Length], "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); | 3306 | seq_printf(m, "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); |
3307 | if (Length >= BusLogic_MessageBufferSize) | 3307 | return 0; |
3308 | BusLogic_Error("Message Buffer length %d exceeds size %d\n", HostAdapter, Length, BusLogic_MessageBufferSize); | ||
3309 | if ((Length -= Offset) <= 0) | ||
3310 | return 0; | ||
3311 | if (Length >= BytesAvailable) | ||
3312 | Length = BytesAvailable; | ||
3313 | memcpy(ProcBuffer, HostAdapter->MessageBuffer + Offset, Length); | ||
3314 | *StartPointer = ProcBuffer; | ||
3315 | return Length; | ||
3316 | } | 3308 | } |
3317 | 3309 | ||
3318 | 3310 | ||
@@ -3566,7 +3558,8 @@ static int __init BusLogic_ParseDriverOptions(char *OptionsString) | |||
3566 | static struct scsi_host_template Bus_Logic_template = { | 3558 | static struct scsi_host_template Bus_Logic_template = { |
3567 | .module = THIS_MODULE, | 3559 | .module = THIS_MODULE, |
3568 | .proc_name = "BusLogic", | 3560 | .proc_name = "BusLogic", |
3569 | .proc_info = BusLogic_ProcDirectoryInfo, | 3561 | .write_info = BusLogic_write_info, |
3562 | .show_info = BusLogic_show_info, | ||
3570 | .name = "BusLogic", | 3563 | .name = "BusLogic", |
3571 | .info = BusLogic_DriverInfo, | 3564 | .info = BusLogic_DriverInfo, |
3572 | .queuecommand = BusLogic_QueueCommand, | 3565 | .queuecommand = BusLogic_QueueCommand, |