diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
commit | 20b4fb485227404329e41ad15588afad3df23050 (patch) | |
tree | f3e099f0ab3da8a93b447203e294d2bb22f6dc05 /drivers/scsi | |
parent | b9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff) | |
parent | ac3e3c5b1164397656df81b9e9ab4991184d3236 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro,
Misc cleanups all over the place, mainly wrt /proc interfaces (switch
create_proc_entry to proc_create(), get rid of the deprecated
create_proc_read_entry() in favor of using proc_create_data() and
seq_file etc).
7kloc removed.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
don't bother with deferred freeing of fdtables
proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
proc: Make the PROC_I() and PDE() macros internal to procfs
proc: Supply a function to remove a proc entry by PDE
take cgroup_open() and cpuset_open() to fs/proc/base.c
ppc: Clean up scanlog
ppc: Clean up rtas_flash driver somewhat
hostap: proc: Use remove_proc_subtree()
drm: proc: Use remove_proc_subtree()
drm: proc: Use minor->index to label things, not PDE->name
drm: Constify drm_proc_list[]
zoran: Don't print proc_dir_entry data in debug
reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
proc: Supply an accessor for getting the data from a PDE's parent
airo: Use remove_proc_subtree()
rtl8192u: Don't need to save device proc dir PDE
rtl8187se: Use a dir under /proc/net/r8180/
proc: Add proc_mkdir_data()
proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
proc: Move PDE_NET() to fs/proc/proc_net.c
...
Diffstat (limited to 'drivers/scsi')
69 files changed, 1576 insertions, 3531 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, |
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h index 649fcb31f26d..6c6c13c3be1b 100644 --- a/drivers/scsi/BusLogic.h +++ b/drivers/scsi/BusLogic.h | |||
@@ -1321,7 +1321,6 @@ static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T Co | |||
1321 | static const char *BusLogic_DriverInfo(struct Scsi_Host *); | 1321 | static const char *BusLogic_DriverInfo(struct Scsi_Host *); |
1322 | static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); | 1322 | static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); |
1323 | static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); | 1323 | static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); |
1324 | static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int); | ||
1325 | static int BusLogic_SlaveConfigure(struct scsi_device *); | 1324 | static int BusLogic_SlaveConfigure(struct scsi_device *); |
1326 | static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); | 1325 | static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); |
1327 | static irqreturn_t BusLogic_InterruptHandler(int, void *); | 1326 | static irqreturn_t BusLogic_InterruptHandler(int, void *); |
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 450353e04dde..1e9d6ad9302b 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -695,33 +695,35 @@ static void NCR5380_print_status(struct Scsi_Host *instance) | |||
695 | * Return the number of bytes read from or written | 695 | * Return the number of bytes read from or written |
696 | */ | 696 | */ |
697 | 697 | ||
698 | static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, | ||
699 | char *buffer, int length) | ||
700 | { | ||
701 | #ifdef DTC_PUBLIC_RELEASE | ||
702 | dtc_wmaxi = dtc_maxi = 0; | ||
703 | #endif | ||
704 | #ifdef PAS16_PUBLIC_RELEASE | ||
705 | pas_wmaxi = pas_maxi = 0; | ||
706 | #endif | ||
707 | return (-ENOSYS); /* Currently this is a no-op */ | ||
708 | } | ||
709 | |||
698 | #undef SPRINTF | 710 | #undef SPRINTF |
699 | #define SPRINTF(args...) do { if(pos < buffer + length-80) pos += sprintf(pos, ## args); } while(0) | 711 | #define SPRINTF(args...) seq_printf(m, ## args) |
700 | static | 712 | static |
701 | char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length); | 713 | void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m); |
702 | static | 714 | static |
703 | char *lprint_command(unsigned char *cmd, char *pos, char *buffer, int len); | 715 | void lprint_command(unsigned char *cmd, struct seq_file *m); |
704 | static | 716 | static |
705 | char *lprint_opcode(int opcode, char *pos, char *buffer, int length); | 717 | void lprint_opcode(int opcode, struct seq_file *m); |
706 | 718 | ||
707 | static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, | 719 | static int __maybe_unused NCR5380_show_info(struct seq_file *m, |
708 | char *buffer, char **start, off_t offset, int length, int inout) | 720 | struct Scsi_Host *instance) |
709 | { | 721 | { |
710 | char *pos = buffer; | ||
711 | struct NCR5380_hostdata *hostdata; | 722 | struct NCR5380_hostdata *hostdata; |
712 | Scsi_Cmnd *ptr; | 723 | Scsi_Cmnd *ptr; |
713 | 724 | ||
714 | hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 725 | hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
715 | 726 | ||
716 | if (inout) { /* Has data been written to the file ? */ | ||
717 | #ifdef DTC_PUBLIC_RELEASE | ||
718 | dtc_wmaxi = dtc_maxi = 0; | ||
719 | #endif | ||
720 | #ifdef PAS16_PUBLIC_RELEASE | ||
721 | pas_wmaxi = pas_maxi = 0; | ||
722 | #endif | ||
723 | return (-ENOSYS); /* Currently this is a no-op */ | ||
724 | } | ||
725 | SPRINTF("NCR5380 core release=%d. ", NCR5380_PUBLIC_RELEASE); | 727 | SPRINTF("NCR5380 core release=%d. ", NCR5380_PUBLIC_RELEASE); |
726 | if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) | 728 | if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) |
727 | SPRINTF("ncr53c400 release=%d. ", NCR53C400_PUBLIC_RELEASE); | 729 | SPRINTF("ncr53c400 release=%d. ", NCR53C400_PUBLIC_RELEASE); |
@@ -755,46 +757,37 @@ static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, | |||
755 | if (!hostdata->connected) | 757 | if (!hostdata->connected) |
756 | SPRINTF("scsi%d: no currently connected command\n", instance->host_no); | 758 | SPRINTF("scsi%d: no currently connected command\n", instance->host_no); |
757 | else | 759 | else |
758 | pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, pos, buffer, length); | 760 | lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m); |
759 | SPRINTF("scsi%d: issue_queue\n", instance->host_no); | 761 | SPRINTF("scsi%d: issue_queue\n", instance->host_no); |
760 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 762 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
761 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | 763 | lprint_Scsi_Cmnd(ptr, m); |
762 | 764 | ||
763 | SPRINTF("scsi%d: disconnected_queue\n", instance->host_no); | 765 | SPRINTF("scsi%d: disconnected_queue\n", instance->host_no); |
764 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 766 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
765 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | 767 | lprint_Scsi_Cmnd(ptr, m); |
766 | spin_unlock_irq(instance->host_lock); | 768 | spin_unlock_irq(instance->host_lock); |
767 | 769 | return 0; | |
768 | *start = buffer; | ||
769 | if (pos - buffer < offset) | ||
770 | return 0; | ||
771 | else if (pos - buffer - offset < length) | ||
772 | return pos - buffer - offset; | ||
773 | return length; | ||
774 | } | 770 | } |
775 | 771 | ||
776 | static char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length) | 772 | static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m) |
777 | { | 773 | { |
778 | SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); | 774 | SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); |
779 | SPRINTF(" command = "); | 775 | SPRINTF(" command = "); |
780 | pos = lprint_command(cmd->cmnd, pos, buffer, length); | 776 | lprint_command(cmd->cmnd, m); |
781 | return (pos); | ||
782 | } | 777 | } |
783 | 778 | ||
784 | static char *lprint_command(unsigned char *command, char *pos, char *buffer, int length) | 779 | static void lprint_command(unsigned char *command, struct seq_file *m) |
785 | { | 780 | { |
786 | int i, s; | 781 | int i, s; |
787 | pos = lprint_opcode(command[0], pos, buffer, length); | 782 | lprint_opcode(command[0], m); |
788 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) | 783 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
789 | SPRINTF("%02x ", command[i]); | 784 | SPRINTF("%02x ", command[i]); |
790 | SPRINTF("\n"); | 785 | SPRINTF("\n"); |
791 | return (pos); | ||
792 | } | 786 | } |
793 | 787 | ||
794 | static char *lprint_opcode(int opcode, char *pos, char *buffer, int length) | 788 | static void lprint_opcode(int opcode, struct seq_file *m) |
795 | { | 789 | { |
796 | SPRINTF("%2d (0x%02x)", opcode, opcode); | 790 | SPRINTF("%2d (0x%02x)", opcode, opcode); |
797 | return (pos); | ||
798 | } | 791 | } |
799 | 792 | ||
800 | 793 | ||
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index fd40a32b1f6f..14964d0a0e9d 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h | |||
@@ -314,8 +314,10 @@ static void NCR5380_print(struct Scsi_Host *instance); | |||
314 | static int NCR5380_abort(Scsi_Cmnd * cmd); | 314 | static int NCR5380_abort(Scsi_Cmnd * cmd); |
315 | static int NCR5380_bus_reset(Scsi_Cmnd * cmd); | 315 | static int NCR5380_bus_reset(Scsi_Cmnd * cmd); |
316 | static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); | 316 | static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
317 | static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, | 317 | static int __maybe_unused NCR5380_show_info(struct seq_file *, |
318 | char *buffer, char **start, off_t offset, int length, int inout); | 318 | struct Scsi_Host *); |
319 | static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, | ||
320 | char *buffer, int length); | ||
319 | 321 | ||
320 | static void NCR5380_reselect(struct Scsi_Host *instance); | 322 | static void NCR5380_reselect(struct Scsi_Host *instance); |
321 | static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag); | 323 | static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag); |
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index 3e09aa21c1ca..30fa38a0ad39 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c | |||
@@ -166,7 +166,8 @@ static int a2091_bus_reset(struct scsi_cmnd *cmd) | |||
166 | static struct scsi_host_template a2091_scsi_template = { | 166 | static struct scsi_host_template a2091_scsi_template = { |
167 | .module = THIS_MODULE, | 167 | .module = THIS_MODULE, |
168 | .name = "Commodore A2091/A590 SCSI", | 168 | .name = "Commodore A2091/A590 SCSI", |
169 | .proc_info = wd33c93_proc_info, | 169 | .show_info = wd33c93_show_info, |
170 | .write_info = wd33c93_write_info, | ||
170 | .proc_name = "A2901", | 171 | .proc_name = "A2901", |
171 | .queuecommand = wd33c93_queuecommand, | 172 | .queuecommand = wd33c93_queuecommand, |
172 | .eh_abort_handler = wd33c93_abort, | 173 | .eh_abort_handler = wd33c93_abort, |
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index e29fe0e708f8..c487916a9d45 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c | |||
@@ -181,7 +181,8 @@ static int a3000_bus_reset(struct scsi_cmnd *cmd) | |||
181 | static struct scsi_host_template amiga_a3000_scsi_template = { | 181 | static struct scsi_host_template amiga_a3000_scsi_template = { |
182 | .module = THIS_MODULE, | 182 | .module = THIS_MODULE, |
183 | .name = "Amiga 3000 built-in SCSI", | 183 | .name = "Amiga 3000 built-in SCSI", |
184 | .proc_info = wd33c93_proc_info, | 184 | .show_info = wd33c93_show_info, |
185 | .write_info = wd33c93_write_info, | ||
185 | .proc_name = "A3000", | 186 | .proc_name = "A3000", |
186 | .queuecommand = wd33c93_queuecommand, | 187 | .queuecommand = wd33c93_queuecommand, |
187 | .eh_abort_handler = wd33c93_abort, | 188 | .eh_abort_handler = wd33c93_abort, |
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index dcfaee66a8b9..c67e401954c5 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -2178,22 +2178,6 @@ do { \ | |||
2178 | 2178 | ||
2179 | #define ASC_INFO_SIZE 128 /* advansys_info() line size */ | 2179 | #define ASC_INFO_SIZE 128 /* advansys_info() line size */ |
2180 | 2180 | ||
2181 | #ifdef CONFIG_PROC_FS | ||
2182 | /* /proc/scsi/advansys/[0...] related definitions */ | ||
2183 | #define ASC_PRTBUF_SIZE 2048 | ||
2184 | #define ASC_PRTLINE_SIZE 160 | ||
2185 | |||
2186 | #define ASC_PRT_NEXT() \ | ||
2187 | if (cp) { \ | ||
2188 | totlen += len; \ | ||
2189 | leftlen -= len; \ | ||
2190 | if (leftlen == 0) { \ | ||
2191 | return totlen; \ | ||
2192 | } \ | ||
2193 | cp += len; \ | ||
2194 | } | ||
2195 | #endif /* CONFIG_PROC_FS */ | ||
2196 | |||
2197 | /* Asc Library return codes */ | 2181 | /* Asc Library return codes */ |
2198 | #define ASC_TRUE 1 | 2182 | #define ASC_TRUE 1 |
2199 | #define ASC_FALSE 0 | 2183 | #define ASC_FALSE 0 |
@@ -2384,7 +2368,6 @@ struct asc_board { | |||
2384 | } eep_config; | 2368 | } eep_config; |
2385 | ulong last_reset; /* Saved last reset time */ | 2369 | ulong last_reset; /* Saved last reset time */ |
2386 | /* /proc/scsi/advansys/[0...] */ | 2370 | /* /proc/scsi/advansys/[0...] */ |
2387 | char *prtbuf; /* /proc print buffer */ | ||
2388 | #ifdef ADVANSYS_STATS | 2371 | #ifdef ADVANSYS_STATS |
2389 | struct asc_stats asc_stats; /* Board statistics */ | 2372 | struct asc_stats asc_stats; /* Board statistics */ |
2390 | #endif /* ADVANSYS_STATS */ | 2373 | #endif /* ADVANSYS_STATS */ |
@@ -2875,64 +2858,21 @@ static const char *advansys_info(struct Scsi_Host *shost) | |||
2875 | } | 2858 | } |
2876 | 2859 | ||
2877 | #ifdef CONFIG_PROC_FS | 2860 | #ifdef CONFIG_PROC_FS |
2878 | /* | ||
2879 | * asc_prt_line() | ||
2880 | * | ||
2881 | * If 'cp' is NULL print to the console, otherwise print to a buffer. | ||
2882 | * | ||
2883 | * Return 0 if printing to the console, otherwise return the number of | ||
2884 | * bytes written to the buffer. | ||
2885 | * | ||
2886 | * Note: If any single line is greater than ASC_PRTLINE_SIZE bytes the stack | ||
2887 | * will be corrupted. 's[]' is defined to be ASC_PRTLINE_SIZE bytes. | ||
2888 | */ | ||
2889 | static int asc_prt_line(char *buf, int buflen, char *fmt, ...) | ||
2890 | { | ||
2891 | va_list args; | ||
2892 | int ret; | ||
2893 | char s[ASC_PRTLINE_SIZE]; | ||
2894 | |||
2895 | va_start(args, fmt); | ||
2896 | ret = vsprintf(s, fmt, args); | ||
2897 | BUG_ON(ret >= ASC_PRTLINE_SIZE); | ||
2898 | if (buf == NULL) { | ||
2899 | (void)printk(s); | ||
2900 | ret = 0; | ||
2901 | } else { | ||
2902 | ret = min(buflen, ret); | ||
2903 | memcpy(buf, s, ret); | ||
2904 | } | ||
2905 | va_end(args); | ||
2906 | return ret; | ||
2907 | } | ||
2908 | 2861 | ||
2909 | /* | 2862 | /* |
2910 | * asc_prt_board_devices() | 2863 | * asc_prt_board_devices() |
2911 | * | 2864 | * |
2912 | * Print driver information for devices attached to the board. | 2865 | * Print driver information for devices attached to the board. |
2913 | * | ||
2914 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
2915 | * cf. asc_prt_line(). | ||
2916 | * | ||
2917 | * Return the number of characters copied into 'cp'. No more than | ||
2918 | * 'cplen' characters will be copied to 'cp'. | ||
2919 | */ | 2866 | */ |
2920 | static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen) | 2867 | static void asc_prt_board_devices(struct seq_file *m, struct Scsi_Host *shost) |
2921 | { | 2868 | { |
2922 | struct asc_board *boardp = shost_priv(shost); | 2869 | struct asc_board *boardp = shost_priv(shost); |
2923 | int leftlen; | ||
2924 | int totlen; | ||
2925 | int len; | ||
2926 | int chip_scsi_id; | 2870 | int chip_scsi_id; |
2927 | int i; | 2871 | int i; |
2928 | 2872 | ||
2929 | leftlen = cplen; | 2873 | seq_printf(m, |
2930 | totlen = len = 0; | 2874 | "\nDevice Information for AdvanSys SCSI Host %d:\n", |
2931 | 2875 | shost->host_no); | |
2932 | len = asc_prt_line(cp, leftlen, | ||
2933 | "\nDevice Information for AdvanSys SCSI Host %d:\n", | ||
2934 | shost->host_no); | ||
2935 | ASC_PRT_NEXT(); | ||
2936 | 2876 | ||
2937 | if (ASC_NARROW_BOARD(boardp)) { | 2877 | if (ASC_NARROW_BOARD(boardp)) { |
2938 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; | 2878 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; |
@@ -2940,60 +2880,42 @@ static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen) | |||
2940 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; | 2880 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; |
2941 | } | 2881 | } |
2942 | 2882 | ||
2943 | len = asc_prt_line(cp, leftlen, "Target IDs Detected:"); | 2883 | seq_printf(m, "Target IDs Detected:"); |
2944 | ASC_PRT_NEXT(); | ||
2945 | for (i = 0; i <= ADV_MAX_TID; i++) { | 2884 | for (i = 0; i <= ADV_MAX_TID; i++) { |
2946 | if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) { | 2885 | if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) |
2947 | len = asc_prt_line(cp, leftlen, " %X,", i); | 2886 | seq_printf(m, " %X,", i); |
2948 | ASC_PRT_NEXT(); | ||
2949 | } | ||
2950 | } | 2887 | } |
2951 | len = asc_prt_line(cp, leftlen, " (%X=Host Adapter)\n", chip_scsi_id); | 2888 | seq_printf(m, " (%X=Host Adapter)\n", chip_scsi_id); |
2952 | ASC_PRT_NEXT(); | ||
2953 | |||
2954 | return totlen; | ||
2955 | } | 2889 | } |
2956 | 2890 | ||
2957 | /* | 2891 | /* |
2958 | * Display Wide Board BIOS Information. | 2892 | * Display Wide Board BIOS Information. |
2959 | */ | 2893 | */ |
2960 | static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen) | 2894 | static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost) |
2961 | { | 2895 | { |
2962 | struct asc_board *boardp = shost_priv(shost); | 2896 | struct asc_board *boardp = shost_priv(shost); |
2963 | int leftlen; | ||
2964 | int totlen; | ||
2965 | int len; | ||
2966 | ushort major, minor, letter; | 2897 | ushort major, minor, letter; |
2967 | 2898 | ||
2968 | leftlen = cplen; | 2899 | seq_printf(m, "\nROM BIOS Version: "); |
2969 | totlen = len = 0; | ||
2970 | |||
2971 | len = asc_prt_line(cp, leftlen, "\nROM BIOS Version: "); | ||
2972 | ASC_PRT_NEXT(); | ||
2973 | 2900 | ||
2974 | /* | 2901 | /* |
2975 | * If the BIOS saved a valid signature, then fill in | 2902 | * If the BIOS saved a valid signature, then fill in |
2976 | * the BIOS code segment base address. | 2903 | * the BIOS code segment base address. |
2977 | */ | 2904 | */ |
2978 | if (boardp->bios_signature != 0x55AA) { | 2905 | if (boardp->bios_signature != 0x55AA) { |
2979 | len = asc_prt_line(cp, leftlen, "Disabled or Pre-3.1\n"); | 2906 | seq_printf(m, "Disabled or Pre-3.1\n"); |
2980 | ASC_PRT_NEXT(); | 2907 | seq_printf(m, |
2981 | len = asc_prt_line(cp, leftlen, | 2908 | "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"); |
2982 | "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"); | 2909 | seq_printf(m, |
2983 | ASC_PRT_NEXT(); | 2910 | "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n"); |
2984 | len = asc_prt_line(cp, leftlen, | ||
2985 | "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n"); | ||
2986 | ASC_PRT_NEXT(); | ||
2987 | } else { | 2911 | } else { |
2988 | major = (boardp->bios_version >> 12) & 0xF; | 2912 | major = (boardp->bios_version >> 12) & 0xF; |
2989 | minor = (boardp->bios_version >> 8) & 0xF; | 2913 | minor = (boardp->bios_version >> 8) & 0xF; |
2990 | letter = (boardp->bios_version & 0xFF); | 2914 | letter = (boardp->bios_version & 0xFF); |
2991 | 2915 | ||
2992 | len = asc_prt_line(cp, leftlen, "%d.%d%c\n", | 2916 | seq_printf(m, "%d.%d%c\n", |
2993 | major, minor, | 2917 | major, minor, |
2994 | letter >= 26 ? '?' : letter + 'A'); | 2918 | letter >= 26 ? '?' : letter + 'A'); |
2995 | ASC_PRT_NEXT(); | ||
2996 | |||
2997 | /* | 2919 | /* |
2998 | * Current available ROM BIOS release is 3.1I for UW | 2920 | * Current available ROM BIOS release is 3.1I for UW |
2999 | * and 3.2I for U2W. This code doesn't differentiate | 2921 | * and 3.2I for U2W. This code doesn't differentiate |
@@ -3001,16 +2923,12 @@ static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen) | |||
3001 | */ | 2923 | */ |
3002 | if (major < 3 || (major <= 3 && minor < 1) || | 2924 | if (major < 3 || (major <= 3 && minor < 1) || |
3003 | (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) { | 2925 | (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) { |
3004 | len = asc_prt_line(cp, leftlen, | 2926 | seq_printf(m, |
3005 | "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"); | 2927 | "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"); |
3006 | ASC_PRT_NEXT(); | 2928 | seq_printf(m, |
3007 | len = asc_prt_line(cp, leftlen, | 2929 | "ftp://ftp.connectcom.net/pub\n"); |
3008 | "ftp://ftp.connectcom.net/pub\n"); | ||
3009 | ASC_PRT_NEXT(); | ||
3010 | } | 2930 | } |
3011 | } | 2931 | } |
3012 | |||
3013 | return totlen; | ||
3014 | } | 2932 | } |
3015 | 2933 | ||
3016 | /* | 2934 | /* |
@@ -3115,20 +3033,11 @@ static int asc_get_eeprom_string(ushort *serialnum, uchar *cp) | |||
3115 | * asc_prt_asc_board_eeprom() | 3033 | * asc_prt_asc_board_eeprom() |
3116 | * | 3034 | * |
3117 | * Print board EEPROM configuration. | 3035 | * Print board EEPROM configuration. |
3118 | * | ||
3119 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3120 | * cf. asc_prt_line(). | ||
3121 | * | ||
3122 | * Return the number of characters copied into 'cp'. No more than | ||
3123 | * 'cplen' characters will be copied to 'cp'. | ||
3124 | */ | 3036 | */ |
3125 | static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) | 3037 | static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost) |
3126 | { | 3038 | { |
3127 | struct asc_board *boardp = shost_priv(shost); | 3039 | struct asc_board *boardp = shost_priv(shost); |
3128 | ASC_DVC_VAR *asc_dvc_varp; | 3040 | ASC_DVC_VAR *asc_dvc_varp; |
3129 | int leftlen; | ||
3130 | int totlen; | ||
3131 | int len; | ||
3132 | ASCEEP_CONFIG *ep; | 3041 | ASCEEP_CONFIG *ep; |
3133 | int i; | 3042 | int i; |
3134 | #ifdef CONFIG_ISA | 3043 | #ifdef CONFIG_ISA |
@@ -3139,129 +3048,75 @@ static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3139 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; | 3048 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; |
3140 | ep = &boardp->eep_config.asc_eep; | 3049 | ep = &boardp->eep_config.asc_eep; |
3141 | 3050 | ||
3142 | leftlen = cplen; | 3051 | seq_printf(m, |
3143 | totlen = len = 0; | 3052 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", |
3144 | 3053 | shost->host_no); | |
3145 | len = asc_prt_line(cp, leftlen, | ||
3146 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", | ||
3147 | shost->host_no); | ||
3148 | ASC_PRT_NEXT(); | ||
3149 | 3054 | ||
3150 | if (asc_get_eeprom_string((ushort *)&ep->adapter_info[0], serialstr) | 3055 | if (asc_get_eeprom_string((ushort *)&ep->adapter_info[0], serialstr) |
3151 | == ASC_TRUE) { | 3056 | == ASC_TRUE) |
3152 | len = | 3057 | seq_printf(m, " Serial Number: %s\n", serialstr); |
3153 | asc_prt_line(cp, leftlen, " Serial Number: %s\n", | 3058 | else if (ep->adapter_info[5] == 0xBB) |
3154 | serialstr); | 3059 | seq_printf(m, |
3155 | ASC_PRT_NEXT(); | 3060 | " Default Settings Used for EEPROM-less Adapter.\n"); |
3156 | } else { | 3061 | else |
3157 | if (ep->adapter_info[5] == 0xBB) { | 3062 | seq_printf(m, |
3158 | len = asc_prt_line(cp, leftlen, | 3063 | " Serial Number Signature Not Present.\n"); |
3159 | " Default Settings Used for EEPROM-less Adapter.\n"); | 3064 | |
3160 | ASC_PRT_NEXT(); | 3065 | seq_printf(m, |
3161 | } else { | 3066 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3162 | len = asc_prt_line(cp, leftlen, | 3067 | ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng, |
3163 | " Serial Number Signature Not Present.\n"); | 3068 | ep->max_tag_qng); |
3164 | ASC_PRT_NEXT(); | 3069 | |
3165 | } | 3070 | seq_printf(m, |
3166 | } | 3071 | " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam); |
3167 | 3072 | ||
3168 | len = asc_prt_line(cp, leftlen, | 3073 | seq_printf(m, " Target ID: "); |
3169 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3074 | for (i = 0; i <= ASC_MAX_TID; i++) |
3170 | ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng, | 3075 | seq_printf(m, " %d", i); |
3171 | ep->max_tag_qng); | 3076 | seq_printf(m, "\n"); |
3172 | ASC_PRT_NEXT(); | 3077 | |
3173 | 3078 | seq_printf(m, " Disconnects: "); | |
3174 | len = asc_prt_line(cp, leftlen, | 3079 | for (i = 0; i <= ASC_MAX_TID; i++) |
3175 | " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam); | 3080 | seq_printf(m, " %c", |
3176 | ASC_PRT_NEXT(); | 3081 | (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3177 | 3082 | seq_printf(m, "\n"); | |
3178 | len = asc_prt_line(cp, leftlen, " Target ID: "); | 3083 | |
3179 | ASC_PRT_NEXT(); | 3084 | seq_printf(m, " Command Queuing: "); |
3180 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3085 | for (i = 0; i <= ASC_MAX_TID; i++) |
3181 | len = asc_prt_line(cp, leftlen, " %d", i); | 3086 | seq_printf(m, " %c", |
3182 | ASC_PRT_NEXT(); | 3087 | (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3183 | } | 3088 | seq_printf(m, "\n"); |
3184 | len = asc_prt_line(cp, leftlen, "\n"); | 3089 | |
3185 | ASC_PRT_NEXT(); | 3090 | seq_printf(m, " Start Motor: "); |
3186 | 3091 | for (i = 0; i <= ASC_MAX_TID; i++) | |
3187 | len = asc_prt_line(cp, leftlen, " Disconnects: "); | 3092 | seq_printf(m, " %c", |
3188 | ASC_PRT_NEXT(); | 3093 | (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3189 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3094 | seq_printf(m, "\n"); |
3190 | len = asc_prt_line(cp, leftlen, " %c", | 3095 | |
3191 | (ep-> | 3096 | seq_printf(m, " Synchronous Transfer:"); |
3192 | disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3097 | for (i = 0; i <= ASC_MAX_TID; i++) |
3193 | 'N'); | 3098 | seq_printf(m, " %c", |
3194 | ASC_PRT_NEXT(); | 3099 | (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3195 | } | 3100 | seq_printf(m, "\n"); |
3196 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3197 | ASC_PRT_NEXT(); | ||
3198 | |||
3199 | len = asc_prt_line(cp, leftlen, " Command Queuing: "); | ||
3200 | ASC_PRT_NEXT(); | ||
3201 | for (i = 0; i <= ASC_MAX_TID; i++) { | ||
3202 | len = asc_prt_line(cp, leftlen, " %c", | ||
3203 | (ep-> | ||
3204 | use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3205 | 'N'); | ||
3206 | ASC_PRT_NEXT(); | ||
3207 | } | ||
3208 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3209 | ASC_PRT_NEXT(); | ||
3210 | |||
3211 | len = asc_prt_line(cp, leftlen, " Start Motor: "); | ||
3212 | ASC_PRT_NEXT(); | ||
3213 | for (i = 0; i <= ASC_MAX_TID; i++) { | ||
3214 | len = asc_prt_line(cp, leftlen, " %c", | ||
3215 | (ep-> | ||
3216 | start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3217 | 'N'); | ||
3218 | ASC_PRT_NEXT(); | ||
3219 | } | ||
3220 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3221 | ASC_PRT_NEXT(); | ||
3222 | |||
3223 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); | ||
3224 | ASC_PRT_NEXT(); | ||
3225 | for (i = 0; i <= ASC_MAX_TID; i++) { | ||
3226 | len = asc_prt_line(cp, leftlen, " %c", | ||
3227 | (ep-> | ||
3228 | init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3229 | 'N'); | ||
3230 | ASC_PRT_NEXT(); | ||
3231 | } | ||
3232 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3233 | ASC_PRT_NEXT(); | ||
3234 | 3101 | ||
3235 | #ifdef CONFIG_ISA | 3102 | #ifdef CONFIG_ISA |
3236 | if (asc_dvc_varp->bus_type & ASC_IS_ISA) { | 3103 | if (asc_dvc_varp->bus_type & ASC_IS_ISA) { |
3237 | len = asc_prt_line(cp, leftlen, | 3104 | seq_printf(m, |
3238 | " Host ISA DMA speed: %d MB/S\n", | 3105 | " Host ISA DMA speed: %d MB/S\n", |
3239 | isa_dma_speed[ASC_EEP_GET_DMA_SPD(ep)]); | 3106 | isa_dma_speed[ASC_EEP_GET_DMA_SPD(ep)]); |
3240 | ASC_PRT_NEXT(); | ||
3241 | } | 3107 | } |
3242 | #endif /* CONFIG_ISA */ | 3108 | #endif /* CONFIG_ISA */ |
3243 | |||
3244 | return totlen; | ||
3245 | } | 3109 | } |
3246 | 3110 | ||
3247 | /* | 3111 | /* |
3248 | * asc_prt_adv_board_eeprom() | 3112 | * asc_prt_adv_board_eeprom() |
3249 | * | 3113 | * |
3250 | * Print board EEPROM configuration. | 3114 | * Print board EEPROM configuration. |
3251 | * | ||
3252 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3253 | * cf. asc_prt_line(). | ||
3254 | * | ||
3255 | * Return the number of characters copied into 'cp'. No more than | ||
3256 | * 'cplen' characters will be copied to 'cp'. | ||
3257 | */ | 3115 | */ |
3258 | static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) | 3116 | static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost) |
3259 | { | 3117 | { |
3260 | struct asc_board *boardp = shost_priv(shost); | 3118 | struct asc_board *boardp = shost_priv(shost); |
3261 | ADV_DVC_VAR *adv_dvc_varp; | 3119 | ADV_DVC_VAR *adv_dvc_varp; |
3262 | int leftlen; | ||
3263 | int totlen; | ||
3264 | int len; | ||
3265 | int i; | 3120 | int i; |
3266 | char *termstr; | 3121 | char *termstr; |
3267 | uchar serialstr[13]; | 3122 | uchar serialstr[13]; |
@@ -3281,13 +3136,9 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3281 | ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; | 3136 | ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; |
3282 | } | 3137 | } |
3283 | 3138 | ||
3284 | leftlen = cplen; | 3139 | seq_printf(m, |
3285 | totlen = len = 0; | 3140 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", |
3286 | 3141 | shost->host_no); | |
3287 | len = asc_prt_line(cp, leftlen, | ||
3288 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", | ||
3289 | shost->host_no); | ||
3290 | ASC_PRT_NEXT(); | ||
3291 | 3142 | ||
3292 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3143 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3293 | wordp = &ep_3550->serial_number_word1; | 3144 | wordp = &ep_3550->serial_number_word1; |
@@ -3297,38 +3148,28 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3297 | wordp = &ep_38C1600->serial_number_word1; | 3148 | wordp = &ep_38C1600->serial_number_word1; |
3298 | } | 3149 | } |
3299 | 3150 | ||
3300 | if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE) { | 3151 | if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE) |
3301 | len = | 3152 | seq_printf(m, " Serial Number: %s\n", serialstr); |
3302 | asc_prt_line(cp, leftlen, " Serial Number: %s\n", | 3153 | else |
3303 | serialstr); | 3154 | seq_printf(m, " Serial Number Signature Not Present.\n"); |
3304 | ASC_PRT_NEXT(); | ||
3305 | } else { | ||
3306 | len = asc_prt_line(cp, leftlen, | ||
3307 | " Serial Number Signature Not Present.\n"); | ||
3308 | ASC_PRT_NEXT(); | ||
3309 | } | ||
3310 | 3155 | ||
3311 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3156 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) |
3312 | len = asc_prt_line(cp, leftlen, | 3157 | seq_printf(m, |
3313 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3158 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3314 | ep_3550->adapter_scsi_id, | 3159 | ep_3550->adapter_scsi_id, |
3315 | ep_3550->max_host_qng, ep_3550->max_dvc_qng); | 3160 | ep_3550->max_host_qng, ep_3550->max_dvc_qng); |
3316 | ASC_PRT_NEXT(); | 3161 | else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) |
3317 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { | 3162 | seq_printf(m, |
3318 | len = asc_prt_line(cp, leftlen, | 3163 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3319 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3164 | ep_38C0800->adapter_scsi_id, |
3320 | ep_38C0800->adapter_scsi_id, | 3165 | ep_38C0800->max_host_qng, |
3321 | ep_38C0800->max_host_qng, | 3166 | ep_38C0800->max_dvc_qng); |
3322 | ep_38C0800->max_dvc_qng); | 3167 | else |
3323 | ASC_PRT_NEXT(); | 3168 | seq_printf(m, |
3324 | } else { | 3169 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3325 | len = asc_prt_line(cp, leftlen, | 3170 | ep_38C1600->adapter_scsi_id, |
3326 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3171 | ep_38C1600->max_host_qng, |
3327 | ep_38C1600->adapter_scsi_id, | 3172 | ep_38C1600->max_dvc_qng); |
3328 | ep_38C1600->max_host_qng, | ||
3329 | ep_38C1600->max_dvc_qng); | ||
3330 | ASC_PRT_NEXT(); | ||
3331 | } | ||
3332 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3173 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3333 | word = ep_3550->termination; | 3174 | word = ep_3550->termination; |
3334 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { | 3175 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
@@ -3352,34 +3193,26 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3352 | break; | 3193 | break; |
3353 | } | 3194 | } |
3354 | 3195 | ||
3355 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3196 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) |
3356 | len = asc_prt_line(cp, leftlen, | 3197 | seq_printf(m, |
3357 | " termination: %u (%s), bios_ctrl: 0x%x\n", | 3198 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
3358 | ep_3550->termination, termstr, | 3199 | ep_3550->termination, termstr, |
3359 | ep_3550->bios_ctrl); | 3200 | ep_3550->bios_ctrl); |
3360 | ASC_PRT_NEXT(); | 3201 | else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) |
3361 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { | 3202 | seq_printf(m, |
3362 | len = asc_prt_line(cp, leftlen, | 3203 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
3363 | " termination: %u (%s), bios_ctrl: 0x%x\n", | 3204 | ep_38C0800->termination_lvd, termstr, |
3364 | ep_38C0800->termination_lvd, termstr, | 3205 | ep_38C0800->bios_ctrl); |
3365 | ep_38C0800->bios_ctrl); | 3206 | else |
3366 | ASC_PRT_NEXT(); | 3207 | seq_printf(m, |
3367 | } else { | 3208 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
3368 | len = asc_prt_line(cp, leftlen, | 3209 | ep_38C1600->termination_lvd, termstr, |
3369 | " termination: %u (%s), bios_ctrl: 0x%x\n", | 3210 | ep_38C1600->bios_ctrl); |
3370 | ep_38C1600->termination_lvd, termstr, | ||
3371 | ep_38C1600->bios_ctrl); | ||
3372 | ASC_PRT_NEXT(); | ||
3373 | } | ||
3374 | 3211 | ||
3375 | len = asc_prt_line(cp, leftlen, " Target ID: "); | 3212 | seq_printf(m, " Target ID: "); |
3376 | ASC_PRT_NEXT(); | 3213 | for (i = 0; i <= ADV_MAX_TID; i++) |
3377 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3214 | seq_printf(m, " %X", i); |
3378 | len = asc_prt_line(cp, leftlen, " %X", i); | 3215 | seq_printf(m, "\n"); |
3379 | ASC_PRT_NEXT(); | ||
3380 | } | ||
3381 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3382 | ASC_PRT_NEXT(); | ||
3383 | 3216 | ||
3384 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3217 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3385 | word = ep_3550->disc_enable; | 3218 | word = ep_3550->disc_enable; |
@@ -3388,15 +3221,11 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3388 | } else { | 3221 | } else { |
3389 | word = ep_38C1600->disc_enable; | 3222 | word = ep_38C1600->disc_enable; |
3390 | } | 3223 | } |
3391 | len = asc_prt_line(cp, leftlen, " Disconnects: "); | 3224 | seq_printf(m, " Disconnects: "); |
3392 | ASC_PRT_NEXT(); | 3225 | for (i = 0; i <= ADV_MAX_TID; i++) |
3393 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3226 | seq_printf(m, " %c", |
3394 | len = asc_prt_line(cp, leftlen, " %c", | 3227 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3395 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3228 | seq_printf(m, "\n"); |
3396 | ASC_PRT_NEXT(); | ||
3397 | } | ||
3398 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3399 | ASC_PRT_NEXT(); | ||
3400 | 3229 | ||
3401 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3230 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3402 | word = ep_3550->tagqng_able; | 3231 | word = ep_3550->tagqng_able; |
@@ -3405,15 +3234,11 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3405 | } else { | 3234 | } else { |
3406 | word = ep_38C1600->tagqng_able; | 3235 | word = ep_38C1600->tagqng_able; |
3407 | } | 3236 | } |
3408 | len = asc_prt_line(cp, leftlen, " Command Queuing: "); | 3237 | seq_printf(m, " Command Queuing: "); |
3409 | ASC_PRT_NEXT(); | 3238 | for (i = 0; i <= ADV_MAX_TID; i++) |
3410 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3239 | seq_printf(m, " %c", |
3411 | len = asc_prt_line(cp, leftlen, " %c", | 3240 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3412 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3241 | seq_printf(m, "\n"); |
3413 | ASC_PRT_NEXT(); | ||
3414 | } | ||
3415 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3416 | ASC_PRT_NEXT(); | ||
3417 | 3242 | ||
3418 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3243 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3419 | word = ep_3550->start_motor; | 3244 | word = ep_3550->start_motor; |
@@ -3422,42 +3247,28 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3422 | } else { | 3247 | } else { |
3423 | word = ep_38C1600->start_motor; | 3248 | word = ep_38C1600->start_motor; |
3424 | } | 3249 | } |
3425 | len = asc_prt_line(cp, leftlen, " Start Motor: "); | 3250 | seq_printf(m, " Start Motor: "); |
3426 | ASC_PRT_NEXT(); | 3251 | for (i = 0; i <= ADV_MAX_TID; i++) |
3427 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3252 | seq_printf(m, " %c", |
3428 | len = asc_prt_line(cp, leftlen, " %c", | 3253 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3429 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3254 | seq_printf(m, "\n"); |
3430 | ASC_PRT_NEXT(); | ||
3431 | } | ||
3432 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3433 | ASC_PRT_NEXT(); | ||
3434 | 3255 | ||
3435 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3256 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3436 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); | 3257 | seq_printf(m, " Synchronous Transfer:"); |
3437 | ASC_PRT_NEXT(); | 3258 | for (i = 0; i <= ADV_MAX_TID; i++) |
3438 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3259 | seq_printf(m, " %c", |
3439 | len = asc_prt_line(cp, leftlen, " %c", | 3260 | (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ? |
3440 | (ep_3550-> | 3261 | 'Y' : 'N'); |
3441 | sdtr_able & ADV_TID_TO_TIDMASK(i)) ? | 3262 | seq_printf(m, "\n"); |
3442 | 'Y' : 'N'); | ||
3443 | ASC_PRT_NEXT(); | ||
3444 | } | ||
3445 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3446 | ASC_PRT_NEXT(); | ||
3447 | } | 3263 | } |
3448 | 3264 | ||
3449 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3265 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3450 | len = asc_prt_line(cp, leftlen, " Ultra Transfer: "); | 3266 | seq_printf(m, " Ultra Transfer: "); |
3451 | ASC_PRT_NEXT(); | 3267 | for (i = 0; i <= ADV_MAX_TID; i++) |
3452 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3268 | seq_printf(m, " %c", |
3453 | len = asc_prt_line(cp, leftlen, " %c", | 3269 | (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i)) |
3454 | (ep_3550-> | 3270 | ? 'Y' : 'N'); |
3455 | ultra_able & ADV_TID_TO_TIDMASK(i)) | 3271 | seq_printf(m, "\n"); |
3456 | ? 'Y' : 'N'); | ||
3457 | ASC_PRT_NEXT(); | ||
3458 | } | ||
3459 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3460 | ASC_PRT_NEXT(); | ||
3461 | } | 3272 | } |
3462 | 3273 | ||
3463 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3274 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
@@ -3467,21 +3278,16 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3467 | } else { | 3278 | } else { |
3468 | word = ep_38C1600->wdtr_able; | 3279 | word = ep_38C1600->wdtr_able; |
3469 | } | 3280 | } |
3470 | len = asc_prt_line(cp, leftlen, " Wide Transfer: "); | 3281 | seq_printf(m, " Wide Transfer: "); |
3471 | ASC_PRT_NEXT(); | 3282 | for (i = 0; i <= ADV_MAX_TID; i++) |
3472 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3283 | seq_printf(m, " %c", |
3473 | len = asc_prt_line(cp, leftlen, " %c", | 3284 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3474 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3285 | seq_printf(m, "\n"); |
3475 | ASC_PRT_NEXT(); | ||
3476 | } | ||
3477 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3478 | ASC_PRT_NEXT(); | ||
3479 | 3286 | ||
3480 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 || | 3287 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 || |
3481 | adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) { | 3288 | adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) { |
3482 | len = asc_prt_line(cp, leftlen, | 3289 | seq_printf(m, |
3483 | " Synchronous Transfer Speed (Mhz):\n "); | 3290 | " Synchronous Transfer Speed (Mhz):\n "); |
3484 | ASC_PRT_NEXT(); | ||
3485 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3291 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3486 | char *speed_str; | 3292 | char *speed_str; |
3487 | 3293 | ||
@@ -3517,99 +3323,64 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3517 | speed_str = "Unk"; | 3323 | speed_str = "Unk"; |
3518 | break; | 3324 | break; |
3519 | } | 3325 | } |
3520 | len = asc_prt_line(cp, leftlen, "%X:%s ", i, speed_str); | 3326 | seq_printf(m, "%X:%s ", i, speed_str); |
3521 | ASC_PRT_NEXT(); | 3327 | if (i == 7) |
3522 | if (i == 7) { | 3328 | seq_printf(m, "\n "); |
3523 | len = asc_prt_line(cp, leftlen, "\n "); | ||
3524 | ASC_PRT_NEXT(); | ||
3525 | } | ||
3526 | sdtr_speed >>= 4; | 3329 | sdtr_speed >>= 4; |
3527 | } | 3330 | } |
3528 | len = asc_prt_line(cp, leftlen, "\n"); | 3331 | seq_printf(m, "\n"); |
3529 | ASC_PRT_NEXT(); | ||
3530 | } | 3332 | } |
3531 | |||
3532 | return totlen; | ||
3533 | } | 3333 | } |
3534 | 3334 | ||
3535 | /* | 3335 | /* |
3536 | * asc_prt_driver_conf() | 3336 | * asc_prt_driver_conf() |
3537 | * | ||
3538 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3539 | * cf. asc_prt_line(). | ||
3540 | * | ||
3541 | * Return the number of characters copied into 'cp'. No more than | ||
3542 | * 'cplen' characters will be copied to 'cp'. | ||
3543 | */ | 3337 | */ |
3544 | static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen) | 3338 | static void asc_prt_driver_conf(struct seq_file *m, struct Scsi_Host *shost) |
3545 | { | 3339 | { |
3546 | struct asc_board *boardp = shost_priv(shost); | 3340 | struct asc_board *boardp = shost_priv(shost); |
3547 | int leftlen; | ||
3548 | int totlen; | ||
3549 | int len; | ||
3550 | int chip_scsi_id; | 3341 | int chip_scsi_id; |
3551 | 3342 | ||
3552 | leftlen = cplen; | 3343 | seq_printf(m, |
3553 | totlen = len = 0; | 3344 | "\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n", |
3345 | shost->host_no); | ||
3554 | 3346 | ||
3555 | len = asc_prt_line(cp, leftlen, | 3347 | seq_printf(m, |
3556 | "\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n", | 3348 | " host_busy %u, last_reset %lu, max_id %u, max_lun %u, max_channel %u\n", |
3557 | shost->host_no); | 3349 | shost->host_busy, shost->last_reset, shost->max_id, |
3558 | ASC_PRT_NEXT(); | 3350 | shost->max_lun, shost->max_channel); |
3559 | 3351 | ||
3560 | len = asc_prt_line(cp, leftlen, | 3352 | seq_printf(m, |
3561 | " host_busy %u, last_reset %u, max_id %u, max_lun %u, max_channel %u\n", | 3353 | " unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n", |
3562 | shost->host_busy, shost->last_reset, shost->max_id, | 3354 | shost->unique_id, shost->can_queue, shost->this_id, |
3563 | shost->max_lun, shost->max_channel); | 3355 | shost->sg_tablesize, shost->cmd_per_lun); |
3564 | ASC_PRT_NEXT(); | ||
3565 | 3356 | ||
3566 | len = asc_prt_line(cp, leftlen, | 3357 | seq_printf(m, |
3567 | " unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n", | 3358 | " unchecked_isa_dma %d, use_clustering %d\n", |
3568 | shost->unique_id, shost->can_queue, shost->this_id, | 3359 | shost->unchecked_isa_dma, shost->use_clustering); |
3569 | shost->sg_tablesize, shost->cmd_per_lun); | ||
3570 | ASC_PRT_NEXT(); | ||
3571 | 3360 | ||
3572 | len = asc_prt_line(cp, leftlen, | 3361 | seq_printf(m, |
3573 | " unchecked_isa_dma %d, use_clustering %d\n", | 3362 | " flags 0x%x, last_reset 0x%lx, jiffies 0x%lx, asc_n_io_port 0x%x\n", |
3574 | shost->unchecked_isa_dma, shost->use_clustering); | 3363 | boardp->flags, boardp->last_reset, jiffies, |
3575 | ASC_PRT_NEXT(); | 3364 | boardp->asc_n_io_port); |
3576 | 3365 | ||
3577 | len = asc_prt_line(cp, leftlen, | 3366 | seq_printf(m, " io_port 0x%lx\n", shost->io_port); |
3578 | " flags 0x%x, last_reset 0x%x, jiffies 0x%x, asc_n_io_port 0x%x\n", | ||
3579 | boardp->flags, boardp->last_reset, jiffies, | ||
3580 | boardp->asc_n_io_port); | ||
3581 | ASC_PRT_NEXT(); | ||
3582 | |||
3583 | len = asc_prt_line(cp, leftlen, " io_port 0x%x\n", shost->io_port); | ||
3584 | ASC_PRT_NEXT(); | ||
3585 | 3367 | ||
3586 | if (ASC_NARROW_BOARD(boardp)) { | 3368 | if (ASC_NARROW_BOARD(boardp)) { |
3587 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; | 3369 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; |
3588 | } else { | 3370 | } else { |
3589 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; | 3371 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; |
3590 | } | 3372 | } |
3591 | |||
3592 | return totlen; | ||
3593 | } | 3373 | } |
3594 | 3374 | ||
3595 | /* | 3375 | /* |
3596 | * asc_prt_asc_board_info() | 3376 | * asc_prt_asc_board_info() |
3597 | * | 3377 | * |
3598 | * Print dynamic board configuration information. | 3378 | * Print dynamic board configuration information. |
3599 | * | ||
3600 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3601 | * cf. asc_prt_line(). | ||
3602 | * | ||
3603 | * Return the number of characters copied into 'cp'. No more than | ||
3604 | * 'cplen' characters will be copied to 'cp'. | ||
3605 | */ | 3379 | */ |
3606 | static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) | 3380 | static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost) |
3607 | { | 3381 | { |
3608 | struct asc_board *boardp = shost_priv(shost); | 3382 | struct asc_board *boardp = shost_priv(shost); |
3609 | int chip_scsi_id; | 3383 | int chip_scsi_id; |
3610 | int leftlen; | ||
3611 | int totlen; | ||
3612 | int len; | ||
3613 | ASC_DVC_VAR *v; | 3384 | ASC_DVC_VAR *v; |
3614 | ASC_DVC_CFG *c; | 3385 | ASC_DVC_CFG *c; |
3615 | int i; | 3386 | int i; |
@@ -3619,105 +3390,79 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3619 | c = &boardp->dvc_cfg.asc_dvc_cfg; | 3390 | c = &boardp->dvc_cfg.asc_dvc_cfg; |
3620 | chip_scsi_id = c->chip_scsi_id; | 3391 | chip_scsi_id = c->chip_scsi_id; |
3621 | 3392 | ||
3622 | leftlen = cplen; | 3393 | seq_printf(m, |
3623 | totlen = len = 0; | 3394 | "\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", |
3395 | shost->host_no); | ||
3624 | 3396 | ||
3625 | len = asc_prt_line(cp, leftlen, | 3397 | seq_printf(m, " chip_version %u, mcode_date 0x%x, " |
3626 | "\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", | 3398 | "mcode_version 0x%x, err_code %u\n", |
3627 | shost->host_no); | 3399 | c->chip_version, c->mcode_date, c->mcode_version, |
3628 | ASC_PRT_NEXT(); | 3400 | v->err_code); |
3629 | |||
3630 | len = asc_prt_line(cp, leftlen, " chip_version %u, mcode_date 0x%x, " | ||
3631 | "mcode_version 0x%x, err_code %u\n", | ||
3632 | c->chip_version, c->mcode_date, c->mcode_version, | ||
3633 | v->err_code); | ||
3634 | ASC_PRT_NEXT(); | ||
3635 | 3401 | ||
3636 | /* Current number of commands waiting for the host. */ | 3402 | /* Current number of commands waiting for the host. */ |
3637 | len = asc_prt_line(cp, leftlen, | 3403 | seq_printf(m, |
3638 | " Total Command Pending: %d\n", v->cur_total_qng); | 3404 | " Total Command Pending: %d\n", v->cur_total_qng); |
3639 | ASC_PRT_NEXT(); | ||
3640 | 3405 | ||
3641 | len = asc_prt_line(cp, leftlen, " Command Queuing:"); | 3406 | seq_printf(m, " Command Queuing:"); |
3642 | ASC_PRT_NEXT(); | ||
3643 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3407 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3644 | if ((chip_scsi_id == i) || | 3408 | if ((chip_scsi_id == i) || |
3645 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3409 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3646 | continue; | 3410 | continue; |
3647 | } | 3411 | } |
3648 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3412 | seq_printf(m, " %X:%c", |
3649 | i, | 3413 | i, |
3650 | (v-> | 3414 | (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3651 | use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? | ||
3652 | 'Y' : 'N'); | ||
3653 | ASC_PRT_NEXT(); | ||
3654 | } | 3415 | } |
3655 | len = asc_prt_line(cp, leftlen, "\n"); | 3416 | seq_printf(m, "\n"); |
3656 | ASC_PRT_NEXT(); | ||
3657 | 3417 | ||
3658 | /* Current number of commands waiting for a device. */ | 3418 | /* Current number of commands waiting for a device. */ |
3659 | len = asc_prt_line(cp, leftlen, " Command Queue Pending:"); | 3419 | seq_printf(m, " Command Queue Pending:"); |
3660 | ASC_PRT_NEXT(); | ||
3661 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3420 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3662 | if ((chip_scsi_id == i) || | 3421 | if ((chip_scsi_id == i) || |
3663 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3422 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3664 | continue; | 3423 | continue; |
3665 | } | 3424 | } |
3666 | len = asc_prt_line(cp, leftlen, " %X:%u", i, v->cur_dvc_qng[i]); | 3425 | seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]); |
3667 | ASC_PRT_NEXT(); | ||
3668 | } | 3426 | } |
3669 | len = asc_prt_line(cp, leftlen, "\n"); | 3427 | seq_printf(m, "\n"); |
3670 | ASC_PRT_NEXT(); | ||
3671 | 3428 | ||
3672 | /* Current limit on number of commands that can be sent to a device. */ | 3429 | /* Current limit on number of commands that can be sent to a device. */ |
3673 | len = asc_prt_line(cp, leftlen, " Command Queue Limit:"); | 3430 | seq_printf(m, " Command Queue Limit:"); |
3674 | ASC_PRT_NEXT(); | ||
3675 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3431 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3676 | if ((chip_scsi_id == i) || | 3432 | if ((chip_scsi_id == i) || |
3677 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3433 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3678 | continue; | 3434 | continue; |
3679 | } | 3435 | } |
3680 | len = asc_prt_line(cp, leftlen, " %X:%u", i, v->max_dvc_qng[i]); | 3436 | seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]); |
3681 | ASC_PRT_NEXT(); | ||
3682 | } | 3437 | } |
3683 | len = asc_prt_line(cp, leftlen, "\n"); | 3438 | seq_printf(m, "\n"); |
3684 | ASC_PRT_NEXT(); | ||
3685 | 3439 | ||
3686 | /* Indicate whether the device has returned queue full status. */ | 3440 | /* Indicate whether the device has returned queue full status. */ |
3687 | len = asc_prt_line(cp, leftlen, " Command Queue Full:"); | 3441 | seq_printf(m, " Command Queue Full:"); |
3688 | ASC_PRT_NEXT(); | ||
3689 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3442 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3690 | if ((chip_scsi_id == i) || | 3443 | if ((chip_scsi_id == i) || |
3691 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3444 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3692 | continue; | 3445 | continue; |
3693 | } | 3446 | } |
3694 | if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) { | 3447 | if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) |
3695 | len = asc_prt_line(cp, leftlen, " %X:Y-%d", | 3448 | seq_printf(m, " %X:Y-%d", |
3696 | i, boardp->queue_full_cnt[i]); | 3449 | i, boardp->queue_full_cnt[i]); |
3697 | } else { | 3450 | else |
3698 | len = asc_prt_line(cp, leftlen, " %X:N", i); | 3451 | seq_printf(m, " %X:N", i); |
3699 | } | ||
3700 | ASC_PRT_NEXT(); | ||
3701 | } | 3452 | } |
3702 | len = asc_prt_line(cp, leftlen, "\n"); | 3453 | seq_printf(m, "\n"); |
3703 | ASC_PRT_NEXT(); | ||
3704 | 3454 | ||
3705 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); | 3455 | seq_printf(m, " Synchronous Transfer:"); |
3706 | ASC_PRT_NEXT(); | ||
3707 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3456 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3708 | if ((chip_scsi_id == i) || | 3457 | if ((chip_scsi_id == i) || |
3709 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3458 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3710 | continue; | 3459 | continue; |
3711 | } | 3460 | } |
3712 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3461 | seq_printf(m, " %X:%c", |
3713 | i, | 3462 | i, |
3714 | (v-> | 3463 | (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3715 | sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3716 | 'N'); | ||
3717 | ASC_PRT_NEXT(); | ||
3718 | } | 3464 | } |
3719 | len = asc_prt_line(cp, leftlen, "\n"); | 3465 | seq_printf(m, "\n"); |
3720 | ASC_PRT_NEXT(); | ||
3721 | 3466 | ||
3722 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3467 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3723 | uchar syn_period_ix; | 3468 | uchar syn_period_ix; |
@@ -3728,69 +3473,48 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3728 | continue; | 3473 | continue; |
3729 | } | 3474 | } |
3730 | 3475 | ||
3731 | len = asc_prt_line(cp, leftlen, " %X:", i); | 3476 | seq_printf(m, " %X:", i); |
3732 | ASC_PRT_NEXT(); | ||
3733 | 3477 | ||
3734 | if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) { | 3478 | if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) { |
3735 | len = asc_prt_line(cp, leftlen, " Asynchronous"); | 3479 | seq_printf(m, " Asynchronous"); |
3736 | ASC_PRT_NEXT(); | ||
3737 | } else { | 3480 | } else { |
3738 | syn_period_ix = | 3481 | syn_period_ix = |
3739 | (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index - | 3482 | (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index - |
3740 | 1); | 3483 | 1); |
3741 | 3484 | ||
3742 | len = asc_prt_line(cp, leftlen, | 3485 | seq_printf(m, |
3743 | " Transfer Period Factor: %d (%d.%d Mhz),", | 3486 | " Transfer Period Factor: %d (%d.%d Mhz),", |
3744 | v->sdtr_period_tbl[syn_period_ix], | 3487 | v->sdtr_period_tbl[syn_period_ix], |
3745 | 250 / | 3488 | 250 / v->sdtr_period_tbl[syn_period_ix], |
3746 | v->sdtr_period_tbl[syn_period_ix], | 3489 | ASC_TENTHS(250, |
3747 | ASC_TENTHS(250, | 3490 | v->sdtr_period_tbl[syn_period_ix])); |
3748 | v-> | ||
3749 | sdtr_period_tbl | ||
3750 | [syn_period_ix])); | ||
3751 | ASC_PRT_NEXT(); | ||
3752 | 3491 | ||
3753 | len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d", | 3492 | seq_printf(m, " REQ/ACK Offset: %d", |
3754 | boardp-> | 3493 | boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET); |
3755 | sdtr_data[i] & ASC_SYN_MAX_OFFSET); | ||
3756 | ASC_PRT_NEXT(); | ||
3757 | } | 3494 | } |
3758 | 3495 | ||
3759 | if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { | 3496 | if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
3760 | len = asc_prt_line(cp, leftlen, "*\n"); | 3497 | seq_printf(m, "*\n"); |
3761 | renegotiate = 1; | 3498 | renegotiate = 1; |
3762 | } else { | 3499 | } else { |
3763 | len = asc_prt_line(cp, leftlen, "\n"); | 3500 | seq_printf(m, "\n"); |
3764 | } | 3501 | } |
3765 | ASC_PRT_NEXT(); | ||
3766 | } | 3502 | } |
3767 | 3503 | ||
3768 | if (renegotiate) { | 3504 | if (renegotiate) { |
3769 | len = asc_prt_line(cp, leftlen, | 3505 | seq_printf(m, |
3770 | " * = Re-negotiation pending before next command.\n"); | 3506 | " * = Re-negotiation pending before next command.\n"); |
3771 | ASC_PRT_NEXT(); | ||
3772 | } | 3507 | } |
3773 | |||
3774 | return totlen; | ||
3775 | } | 3508 | } |
3776 | 3509 | ||
3777 | /* | 3510 | /* |
3778 | * asc_prt_adv_board_info() | 3511 | * asc_prt_adv_board_info() |
3779 | * | 3512 | * |
3780 | * Print dynamic board configuration information. | 3513 | * Print dynamic board configuration information. |
3781 | * | ||
3782 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3783 | * cf. asc_prt_line(). | ||
3784 | * | ||
3785 | * Return the number of characters copied into 'cp'. No more than | ||
3786 | * 'cplen' characters will be copied to 'cp'. | ||
3787 | */ | 3514 | */ |
3788 | static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | 3515 | static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost) |
3789 | { | 3516 | { |
3790 | struct asc_board *boardp = shost_priv(shost); | 3517 | struct asc_board *boardp = shost_priv(shost); |
3791 | int leftlen; | ||
3792 | int totlen; | ||
3793 | int len; | ||
3794 | int i; | 3518 | int i; |
3795 | ADV_DVC_VAR *v; | 3519 | ADV_DVC_VAR *v; |
3796 | ADV_DVC_CFG *c; | 3520 | ADV_DVC_CFG *c; |
@@ -3809,47 +3533,35 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3809 | iop_base = v->iop_base; | 3533 | iop_base = v->iop_base; |
3810 | chip_scsi_id = v->chip_scsi_id; | 3534 | chip_scsi_id = v->chip_scsi_id; |
3811 | 3535 | ||
3812 | leftlen = cplen; | 3536 | seq_printf(m, |
3813 | totlen = len = 0; | 3537 | "\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", |
3814 | 3538 | shost->host_no); | |
3815 | len = asc_prt_line(cp, leftlen, | ||
3816 | "\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", | ||
3817 | shost->host_no); | ||
3818 | ASC_PRT_NEXT(); | ||
3819 | 3539 | ||
3820 | len = asc_prt_line(cp, leftlen, | 3540 | seq_printf(m, |
3821 | " iop_base 0x%lx, cable_detect: %X, err_code %u\n", | 3541 | " iop_base 0x%lx, cable_detect: %X, err_code %u\n", |
3822 | v->iop_base, | 3542 | (unsigned long)v->iop_base, |
3823 | AdvReadWordRegister(iop_base, | 3543 | AdvReadWordRegister(iop_base,IOPW_SCSI_CFG1) & CABLE_DETECT, |
3824 | IOPW_SCSI_CFG1) & CABLE_DETECT, | 3544 | v->err_code); |
3825 | v->err_code); | ||
3826 | ASC_PRT_NEXT(); | ||
3827 | 3545 | ||
3828 | len = asc_prt_line(cp, leftlen, " chip_version %u, mcode_date 0x%x, " | 3546 | seq_printf(m, " chip_version %u, mcode_date 0x%x, " |
3829 | "mcode_version 0x%x\n", c->chip_version, | 3547 | "mcode_version 0x%x\n", c->chip_version, |
3830 | c->mcode_date, c->mcode_version); | 3548 | c->mcode_date, c->mcode_version); |
3831 | ASC_PRT_NEXT(); | ||
3832 | 3549 | ||
3833 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); | 3550 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
3834 | len = asc_prt_line(cp, leftlen, " Queuing Enabled:"); | 3551 | seq_printf(m, " Queuing Enabled:"); |
3835 | ASC_PRT_NEXT(); | ||
3836 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3552 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3837 | if ((chip_scsi_id == i) || | 3553 | if ((chip_scsi_id == i) || |
3838 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3554 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3839 | continue; | 3555 | continue; |
3840 | } | 3556 | } |
3841 | 3557 | ||
3842 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3558 | seq_printf(m, " %X:%c", |
3843 | i, | 3559 | i, |
3844 | (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3560 | (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3845 | 'N'); | ||
3846 | ASC_PRT_NEXT(); | ||
3847 | } | 3561 | } |
3848 | len = asc_prt_line(cp, leftlen, "\n"); | 3562 | seq_printf(m, "\n"); |
3849 | ASC_PRT_NEXT(); | ||
3850 | 3563 | ||
3851 | len = asc_prt_line(cp, leftlen, " Queue Limit:"); | 3564 | seq_printf(m, " Queue Limit:"); |
3852 | ASC_PRT_NEXT(); | ||
3853 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3565 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3854 | if ((chip_scsi_id == i) || | 3566 | if ((chip_scsi_id == i) || |
3855 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3567 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
@@ -3859,14 +3571,11 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3859 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + i, | 3571 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + i, |
3860 | lrambyte); | 3572 | lrambyte); |
3861 | 3573 | ||
3862 | len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte); | 3574 | seq_printf(m, " %X:%d", i, lrambyte); |
3863 | ASC_PRT_NEXT(); | ||
3864 | } | 3575 | } |
3865 | len = asc_prt_line(cp, leftlen, "\n"); | 3576 | seq_printf(m, "\n"); |
3866 | ASC_PRT_NEXT(); | ||
3867 | 3577 | ||
3868 | len = asc_prt_line(cp, leftlen, " Command Pending:"); | 3578 | seq_printf(m, " Command Pending:"); |
3869 | ASC_PRT_NEXT(); | ||
3870 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3579 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3871 | if ((chip_scsi_id == i) || | 3580 | if ((chip_scsi_id == i) || |
3872 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3581 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
@@ -3876,33 +3585,26 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3876 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_QUEUED_CMD + i, | 3585 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_QUEUED_CMD + i, |
3877 | lrambyte); | 3586 | lrambyte); |
3878 | 3587 | ||
3879 | len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte); | 3588 | seq_printf(m, " %X:%d", i, lrambyte); |
3880 | ASC_PRT_NEXT(); | ||
3881 | } | 3589 | } |
3882 | len = asc_prt_line(cp, leftlen, "\n"); | 3590 | seq_printf(m, "\n"); |
3883 | ASC_PRT_NEXT(); | ||
3884 | 3591 | ||
3885 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); | 3592 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
3886 | len = asc_prt_line(cp, leftlen, " Wide Enabled:"); | 3593 | seq_printf(m, " Wide Enabled:"); |
3887 | ASC_PRT_NEXT(); | ||
3888 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3594 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3889 | if ((chip_scsi_id == i) || | 3595 | if ((chip_scsi_id == i) || |
3890 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3596 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3891 | continue; | 3597 | continue; |
3892 | } | 3598 | } |
3893 | 3599 | ||
3894 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3600 | seq_printf(m, " %X:%c", |
3895 | i, | 3601 | i, |
3896 | (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3602 | (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3897 | 'N'); | ||
3898 | ASC_PRT_NEXT(); | ||
3899 | } | 3603 | } |
3900 | len = asc_prt_line(cp, leftlen, "\n"); | 3604 | seq_printf(m, "\n"); |
3901 | ASC_PRT_NEXT(); | ||
3902 | 3605 | ||
3903 | AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done); | 3606 | AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done); |
3904 | len = asc_prt_line(cp, leftlen, " Transfer Bit Width:"); | 3607 | seq_printf(m, " Transfer Bit Width:"); |
3905 | ASC_PRT_NEXT(); | ||
3906 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3608 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3907 | if ((chip_scsi_id == i) || | 3609 | if ((chip_scsi_id == i) || |
3908 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3610 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
@@ -3913,37 +3615,30 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3913 | ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i), | 3615 | ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i), |
3914 | lramword); | 3616 | lramword); |
3915 | 3617 | ||
3916 | len = asc_prt_line(cp, leftlen, " %X:%d", | 3618 | seq_printf(m, " %X:%d", |
3917 | i, (lramword & 0x8000) ? 16 : 8); | 3619 | i, (lramword & 0x8000) ? 16 : 8); |
3918 | ASC_PRT_NEXT(); | ||
3919 | 3620 | ||
3920 | if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) && | 3621 | if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) && |
3921 | (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { | 3622 | (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
3922 | len = asc_prt_line(cp, leftlen, "*"); | 3623 | seq_printf(m, "*"); |
3923 | ASC_PRT_NEXT(); | ||
3924 | renegotiate = 1; | 3624 | renegotiate = 1; |
3925 | } | 3625 | } |
3926 | } | 3626 | } |
3927 | len = asc_prt_line(cp, leftlen, "\n"); | 3627 | seq_printf(m, "\n"); |
3928 | ASC_PRT_NEXT(); | ||
3929 | 3628 | ||
3930 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); | 3629 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
3931 | len = asc_prt_line(cp, leftlen, " Synchronous Enabled:"); | 3630 | seq_printf(m, " Synchronous Enabled:"); |
3932 | ASC_PRT_NEXT(); | ||
3933 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3631 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3934 | if ((chip_scsi_id == i) || | 3632 | if ((chip_scsi_id == i) || |
3935 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3633 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3936 | continue; | 3634 | continue; |
3937 | } | 3635 | } |
3938 | 3636 | ||
3939 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3637 | seq_printf(m, " %X:%c", |
3940 | i, | 3638 | i, |
3941 | (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3639 | (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3942 | 'N'); | ||
3943 | ASC_PRT_NEXT(); | ||
3944 | } | 3640 | } |
3945 | len = asc_prt_line(cp, leftlen, "\n"); | 3641 | seq_printf(m, "\n"); |
3946 | ASC_PRT_NEXT(); | ||
3947 | 3642 | ||
3948 | AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done); | 3643 | AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done); |
3949 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3644 | for (i = 0; i <= ADV_MAX_TID; i++) { |
@@ -3959,358 +3654,170 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3959 | continue; | 3654 | continue; |
3960 | } | 3655 | } |
3961 | 3656 | ||
3962 | len = asc_prt_line(cp, leftlen, " %X:", i); | 3657 | seq_printf(m, " %X:", i); |
3963 | ASC_PRT_NEXT(); | ||
3964 | 3658 | ||
3965 | if ((lramword & 0x1F) == 0) { /* Check for REQ/ACK Offset 0. */ | 3659 | if ((lramword & 0x1F) == 0) { /* Check for REQ/ACK Offset 0. */ |
3966 | len = asc_prt_line(cp, leftlen, " Asynchronous"); | 3660 | seq_printf(m, " Asynchronous"); |
3967 | ASC_PRT_NEXT(); | ||
3968 | } else { | 3661 | } else { |
3969 | len = | 3662 | seq_printf(m, " Transfer Period Factor: "); |
3970 | asc_prt_line(cp, leftlen, | ||
3971 | " Transfer Period Factor: "); | ||
3972 | ASC_PRT_NEXT(); | ||
3973 | 3663 | ||
3974 | if ((lramword & 0x1F00) == 0x1100) { /* 80 Mhz */ | 3664 | if ((lramword & 0x1F00) == 0x1100) { /* 80 Mhz */ |
3975 | len = | 3665 | seq_printf(m, "9 (80.0 Mhz),"); |
3976 | asc_prt_line(cp, leftlen, "9 (80.0 Mhz),"); | ||
3977 | ASC_PRT_NEXT(); | ||
3978 | } else if ((lramword & 0x1F00) == 0x1000) { /* 40 Mhz */ | 3666 | } else if ((lramword & 0x1F00) == 0x1000) { /* 40 Mhz */ |
3979 | len = | 3667 | seq_printf(m, "10 (40.0 Mhz),"); |
3980 | asc_prt_line(cp, leftlen, "10 (40.0 Mhz),"); | ||
3981 | ASC_PRT_NEXT(); | ||
3982 | } else { /* 20 Mhz or below. */ | 3668 | } else { /* 20 Mhz or below. */ |
3983 | 3669 | ||
3984 | period = (((lramword >> 8) * 25) + 50) / 4; | 3670 | period = (((lramword >> 8) * 25) + 50) / 4; |
3985 | 3671 | ||
3986 | if (period == 0) { /* Should never happen. */ | 3672 | if (period == 0) { /* Should never happen. */ |
3987 | len = | 3673 | seq_printf(m, "%d (? Mhz), ", period); |
3988 | asc_prt_line(cp, leftlen, | ||
3989 | "%d (? Mhz), "); | ||
3990 | ASC_PRT_NEXT(); | ||
3991 | } else { | 3674 | } else { |
3992 | len = asc_prt_line(cp, leftlen, | 3675 | seq_printf(m, |
3993 | "%d (%d.%d Mhz),", | 3676 | "%d (%d.%d Mhz),", |
3994 | period, 250 / period, | 3677 | period, 250 / period, |
3995 | ASC_TENTHS(250, | 3678 | ASC_TENTHS(250, period)); |
3996 | period)); | ||
3997 | ASC_PRT_NEXT(); | ||
3998 | } | 3679 | } |
3999 | } | 3680 | } |
4000 | 3681 | ||
4001 | len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d", | 3682 | seq_printf(m, " REQ/ACK Offset: %d", |
4002 | lramword & 0x1F); | 3683 | lramword & 0x1F); |
4003 | ASC_PRT_NEXT(); | ||
4004 | } | 3684 | } |
4005 | 3685 | ||
4006 | if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { | 3686 | if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
4007 | len = asc_prt_line(cp, leftlen, "*\n"); | 3687 | seq_printf(m, "*\n"); |
4008 | renegotiate = 1; | 3688 | renegotiate = 1; |
4009 | } else { | 3689 | } else { |
4010 | len = asc_prt_line(cp, leftlen, "\n"); | 3690 | seq_printf(m, "\n"); |
4011 | } | 3691 | } |
4012 | ASC_PRT_NEXT(); | ||
4013 | } | 3692 | } |
4014 | 3693 | ||
4015 | if (renegotiate) { | 3694 | if (renegotiate) { |
4016 | len = asc_prt_line(cp, leftlen, | 3695 | seq_printf(m, |
4017 | " * = Re-negotiation pending before next command.\n"); | 3696 | " * = Re-negotiation pending before next command.\n"); |
4018 | ASC_PRT_NEXT(); | ||
4019 | } | 3697 | } |
4020 | |||
4021 | return totlen; | ||
4022 | } | ||
4023 | |||
4024 | /* | ||
4025 | * asc_proc_copy() | ||
4026 | * | ||
4027 | * Copy proc information to a read buffer taking into account the current | ||
4028 | * read offset in the file and the remaining space in the read buffer. | ||
4029 | */ | ||
4030 | static int | ||
4031 | asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen, | ||
4032 | char *cp, int cplen) | ||
4033 | { | ||
4034 | int cnt = 0; | ||
4035 | |||
4036 | ASC_DBG(2, "offset %d, advoffset %d, cplen %d\n", | ||
4037 | (unsigned)offset, (unsigned)advoffset, cplen); | ||
4038 | if (offset <= advoffset) { | ||
4039 | /* Read offset below current offset, copy everything. */ | ||
4040 | cnt = min(cplen, leftlen); | ||
4041 | ASC_DBG(2, "curbuf 0x%lx, cp 0x%lx, cnt %d\n", | ||
4042 | (ulong)curbuf, (ulong)cp, cnt); | ||
4043 | memcpy(curbuf, cp, cnt); | ||
4044 | } else if (offset < advoffset + cplen) { | ||
4045 | /* Read offset within current range, partial copy. */ | ||
4046 | cnt = (advoffset + cplen) - offset; | ||
4047 | cp = (cp + cplen) - cnt; | ||
4048 | cnt = min(cnt, leftlen); | ||
4049 | ASC_DBG(2, "curbuf 0x%lx, cp 0x%lx, cnt %d\n", | ||
4050 | (ulong)curbuf, (ulong)cp, cnt); | ||
4051 | memcpy(curbuf, cp, cnt); | ||
4052 | } | ||
4053 | return cnt; | ||
4054 | } | 3698 | } |
4055 | 3699 | ||
4056 | #ifdef ADVANSYS_STATS | 3700 | #ifdef ADVANSYS_STATS |
4057 | /* | 3701 | /* |
4058 | * asc_prt_board_stats() | 3702 | * asc_prt_board_stats() |
4059 | * | ||
4060 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
4061 | * cf. asc_prt_line(). | ||
4062 | * | ||
4063 | * Return the number of characters copied into 'cp'. No more than | ||
4064 | * 'cplen' characters will be copied to 'cp'. | ||
4065 | */ | 3703 | */ |
4066 | static int asc_prt_board_stats(struct Scsi_Host *shost, char *cp, int cplen) | 3704 | static void asc_prt_board_stats(struct seq_file *m, struct Scsi_Host *shost) |
4067 | { | 3705 | { |
4068 | struct asc_board *boardp = shost_priv(shost); | 3706 | struct asc_board *boardp = shost_priv(shost); |
4069 | struct asc_stats *s = &boardp->asc_stats; | 3707 | struct asc_stats *s = &boardp->asc_stats; |
4070 | 3708 | ||
4071 | int leftlen = cplen; | 3709 | seq_printf(m, |
4072 | int len, totlen = 0; | 3710 | "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n", |
3711 | shost->host_no); | ||
4073 | 3712 | ||
4074 | len = asc_prt_line(cp, leftlen, | 3713 | seq_printf(m, |
4075 | "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n", | 3714 | " queuecommand %u, reset %u, biosparam %u, interrupt %u\n", |
4076 | shost->host_no); | 3715 | s->queuecommand, s->reset, s->biosparam, |
4077 | ASC_PRT_NEXT(); | 3716 | s->interrupt); |
4078 | 3717 | ||
4079 | len = asc_prt_line(cp, leftlen, | 3718 | seq_printf(m, |
4080 | " queuecommand %lu, reset %lu, biosparam %lu, interrupt %lu\n", | 3719 | " callback %u, done %u, build_error %u, build_noreq %u, build_nosg %u\n", |
4081 | s->queuecommand, s->reset, s->biosparam, | 3720 | s->callback, s->done, s->build_error, |
4082 | s->interrupt); | 3721 | s->adv_build_noreq, s->adv_build_nosg); |
4083 | ASC_PRT_NEXT(); | ||
4084 | 3722 | ||
4085 | len = asc_prt_line(cp, leftlen, | 3723 | seq_printf(m, |
4086 | " callback %lu, done %lu, build_error %lu, build_noreq %lu, build_nosg %lu\n", | 3724 | " exe_noerror %u, exe_busy %u, exe_error %u, exe_unknown %u\n", |
4087 | s->callback, s->done, s->build_error, | 3725 | s->exe_noerror, s->exe_busy, s->exe_error, |
4088 | s->adv_build_noreq, s->adv_build_nosg); | 3726 | s->exe_unknown); |
4089 | ASC_PRT_NEXT(); | ||
4090 | |||
4091 | len = asc_prt_line(cp, leftlen, | ||
4092 | " exe_noerror %lu, exe_busy %lu, exe_error %lu, exe_unknown %lu\n", | ||
4093 | s->exe_noerror, s->exe_busy, s->exe_error, | ||
4094 | s->exe_unknown); | ||
4095 | ASC_PRT_NEXT(); | ||
4096 | 3727 | ||
4097 | /* | 3728 | /* |
4098 | * Display data transfer statistics. | 3729 | * Display data transfer statistics. |
4099 | */ | 3730 | */ |
4100 | if (s->xfer_cnt > 0) { | 3731 | if (s->xfer_cnt > 0) { |
4101 | len = asc_prt_line(cp, leftlen, " xfer_cnt %lu, xfer_elem %lu, ", | 3732 | seq_printf(m, " xfer_cnt %u, xfer_elem %u, ", |
4102 | s->xfer_cnt, s->xfer_elem); | 3733 | s->xfer_cnt, s->xfer_elem); |
4103 | ASC_PRT_NEXT(); | ||
4104 | 3734 | ||
4105 | len = asc_prt_line(cp, leftlen, "xfer_bytes %lu.%01lu kb\n", | 3735 | seq_printf(m, "xfer_bytes %u.%01u kb\n", |
4106 | s->xfer_sect / 2, ASC_TENTHS(s->xfer_sect, 2)); | 3736 | s->xfer_sect / 2, ASC_TENTHS(s->xfer_sect, 2)); |
4107 | ASC_PRT_NEXT(); | ||
4108 | 3737 | ||
4109 | /* Scatter gather transfer statistics */ | 3738 | /* Scatter gather transfer statistics */ |
4110 | len = asc_prt_line(cp, leftlen, " avg_num_elem %lu.%01lu, ", | 3739 | seq_printf(m, " avg_num_elem %u.%01u, ", |
4111 | s->xfer_elem / s->xfer_cnt, | 3740 | s->xfer_elem / s->xfer_cnt, |
4112 | ASC_TENTHS(s->xfer_elem, s->xfer_cnt)); | 3741 | ASC_TENTHS(s->xfer_elem, s->xfer_cnt)); |
4113 | ASC_PRT_NEXT(); | ||
4114 | 3742 | ||
4115 | len = asc_prt_line(cp, leftlen, "avg_elem_size %lu.%01lu kb, ", | 3743 | seq_printf(m, "avg_elem_size %u.%01u kb, ", |
4116 | (s->xfer_sect / 2) / s->xfer_elem, | 3744 | (s->xfer_sect / 2) / s->xfer_elem, |
4117 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_elem)); | 3745 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_elem)); |
4118 | ASC_PRT_NEXT(); | ||
4119 | 3746 | ||
4120 | len = asc_prt_line(cp, leftlen, "avg_xfer_size %lu.%01lu kb\n", | 3747 | seq_printf(m, "avg_xfer_size %u.%01u kb\n", |
4121 | (s->xfer_sect / 2) / s->xfer_cnt, | 3748 | (s->xfer_sect / 2) / s->xfer_cnt, |
4122 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_cnt)); | 3749 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_cnt)); |
4123 | ASC_PRT_NEXT(); | ||
4124 | } | 3750 | } |
4125 | |||
4126 | return totlen; | ||
4127 | } | 3751 | } |
4128 | #endif /* ADVANSYS_STATS */ | 3752 | #endif /* ADVANSYS_STATS */ |
4129 | 3753 | ||
4130 | /* | 3754 | /* |
4131 | * advansys_proc_info() - /proc/scsi/advansys/{0,1,2,3,...} | 3755 | * advansys_show_info() - /proc/scsi/advansys/{0,1,2,3,...} |
4132 | * | 3756 | * |
4133 | * *buffer: I/O buffer | 3757 | * m: seq_file to print into |
4134 | * **start: if inout == FALSE pointer into buffer where user read should start | 3758 | * shost: Scsi_Host |
4135 | * offset: current offset into a /proc/scsi/advansys/[0...] file | ||
4136 | * length: length of buffer | ||
4137 | * hostno: Scsi_Host host_no | ||
4138 | * inout: TRUE - user is writing; FALSE - user is reading | ||
4139 | * | 3759 | * |
4140 | * Return the number of bytes read from or written to a | 3760 | * Return the number of bytes read from or written to a |
4141 | * /proc/scsi/advansys/[0...] file. | 3761 | * /proc/scsi/advansys/[0...] file. |
4142 | * | ||
4143 | * Note: This function uses the per board buffer 'prtbuf' which is | ||
4144 | * allocated when the board is initialized in advansys_detect(). The | ||
4145 | * buffer is ASC_PRTBUF_SIZE bytes. The function asc_proc_copy() is | ||
4146 | * used to write to the buffer. The way asc_proc_copy() is written | ||
4147 | * if 'prtbuf' is too small it will not be overwritten. Instead the | ||
4148 | * user just won't get all the available statistics. | ||
4149 | */ | 3762 | */ |
4150 | static int | 3763 | static int |
4151 | advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 3764 | advansys_show_info(struct seq_file *m, struct Scsi_Host *shost) |
4152 | off_t offset, int length, int inout) | ||
4153 | { | 3765 | { |
4154 | struct asc_board *boardp = shost_priv(shost); | 3766 | struct asc_board *boardp = shost_priv(shost); |
4155 | char *cp; | ||
4156 | int cplen; | ||
4157 | int cnt; | ||
4158 | int totcnt; | ||
4159 | int leftlen; | ||
4160 | char *curbuf; | ||
4161 | off_t advoffset; | ||
4162 | 3767 | ||
4163 | ASC_DBG(1, "begin\n"); | 3768 | ASC_DBG(1, "begin\n"); |
4164 | 3769 | ||
4165 | /* | 3770 | /* |
4166 | * User write not supported. | ||
4167 | */ | ||
4168 | if (inout == TRUE) | ||
4169 | return -ENOSYS; | ||
4170 | |||
4171 | /* | ||
4172 | * User read of /proc/scsi/advansys/[0...] file. | 3771 | * User read of /proc/scsi/advansys/[0...] file. |
4173 | */ | 3772 | */ |
4174 | 3773 | ||
4175 | /* Copy read data starting at the beginning of the buffer. */ | ||
4176 | *start = buffer; | ||
4177 | curbuf = buffer; | ||
4178 | advoffset = 0; | ||
4179 | totcnt = 0; | ||
4180 | leftlen = length; | ||
4181 | |||
4182 | /* | 3774 | /* |
4183 | * Get board configuration information. | 3775 | * Get board configuration information. |
4184 | * | 3776 | * |
4185 | * advansys_info() returns the board string from its own static buffer. | 3777 | * advansys_info() returns the board string from its own static buffer. |
4186 | */ | 3778 | */ |
4187 | cp = (char *)advansys_info(shost); | ||
4188 | strcat(cp, "\n"); | ||
4189 | cplen = strlen(cp); | ||
4190 | /* Copy board information. */ | 3779 | /* Copy board information. */ |
4191 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | 3780 | seq_printf(m, "%s\n", (char *)advansys_info(shost)); |
4192 | totcnt += cnt; | ||
4193 | leftlen -= cnt; | ||
4194 | if (leftlen == 0) { | ||
4195 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4196 | return totcnt; | ||
4197 | } | ||
4198 | advoffset += cplen; | ||
4199 | curbuf += cnt; | ||
4200 | |||
4201 | /* | 3781 | /* |
4202 | * Display Wide Board BIOS Information. | 3782 | * Display Wide Board BIOS Information. |
4203 | */ | 3783 | */ |
4204 | if (!ASC_NARROW_BOARD(boardp)) { | 3784 | if (!ASC_NARROW_BOARD(boardp)) |
4205 | cp = boardp->prtbuf; | 3785 | asc_prt_adv_bios(m, shost); |
4206 | cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE); | ||
4207 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4208 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, | ||
4209 | cplen); | ||
4210 | totcnt += cnt; | ||
4211 | leftlen -= cnt; | ||
4212 | if (leftlen == 0) { | ||
4213 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4214 | return totcnt; | ||
4215 | } | ||
4216 | advoffset += cplen; | ||
4217 | curbuf += cnt; | ||
4218 | } | ||
4219 | 3786 | ||
4220 | /* | 3787 | /* |
4221 | * Display driver information for each device attached to the board. | 3788 | * Display driver information for each device attached to the board. |
4222 | */ | 3789 | */ |
4223 | cp = boardp->prtbuf; | 3790 | asc_prt_board_devices(m, shost); |
4224 | cplen = asc_prt_board_devices(shost, cp, ASC_PRTBUF_SIZE); | ||
4225 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4226 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4227 | totcnt += cnt; | ||
4228 | leftlen -= cnt; | ||
4229 | if (leftlen == 0) { | ||
4230 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4231 | return totcnt; | ||
4232 | } | ||
4233 | advoffset += cplen; | ||
4234 | curbuf += cnt; | ||
4235 | 3791 | ||
4236 | /* | 3792 | /* |
4237 | * Display EEPROM configuration for the board. | 3793 | * Display EEPROM configuration for the board. |
4238 | */ | 3794 | */ |
4239 | cp = boardp->prtbuf; | 3795 | if (ASC_NARROW_BOARD(boardp)) |
4240 | if (ASC_NARROW_BOARD(boardp)) { | 3796 | asc_prt_asc_board_eeprom(m, shost); |
4241 | cplen = asc_prt_asc_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); | 3797 | else |
4242 | } else { | 3798 | asc_prt_adv_board_eeprom(m, shost); |
4243 | cplen = asc_prt_adv_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); | ||
4244 | } | ||
4245 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4246 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4247 | totcnt += cnt; | ||
4248 | leftlen -= cnt; | ||
4249 | if (leftlen == 0) { | ||
4250 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4251 | return totcnt; | ||
4252 | } | ||
4253 | advoffset += cplen; | ||
4254 | curbuf += cnt; | ||
4255 | 3799 | ||
4256 | /* | 3800 | /* |
4257 | * Display driver configuration and information for the board. | 3801 | * Display driver configuration and information for the board. |
4258 | */ | 3802 | */ |
4259 | cp = boardp->prtbuf; | 3803 | asc_prt_driver_conf(m, shost); |
4260 | cplen = asc_prt_driver_conf(shost, cp, ASC_PRTBUF_SIZE); | ||
4261 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4262 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4263 | totcnt += cnt; | ||
4264 | leftlen -= cnt; | ||
4265 | if (leftlen == 0) { | ||
4266 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4267 | return totcnt; | ||
4268 | } | ||
4269 | advoffset += cplen; | ||
4270 | curbuf += cnt; | ||
4271 | 3804 | ||
4272 | #ifdef ADVANSYS_STATS | 3805 | #ifdef ADVANSYS_STATS |
4273 | /* | 3806 | /* |
4274 | * Display driver statistics for the board. | 3807 | * Display driver statistics for the board. |
4275 | */ | 3808 | */ |
4276 | cp = boardp->prtbuf; | 3809 | asc_prt_board_stats(m, shost); |
4277 | cplen = asc_prt_board_stats(shost, cp, ASC_PRTBUF_SIZE); | ||
4278 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4279 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4280 | totcnt += cnt; | ||
4281 | leftlen -= cnt; | ||
4282 | if (leftlen == 0) { | ||
4283 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4284 | return totcnt; | ||
4285 | } | ||
4286 | advoffset += cplen; | ||
4287 | curbuf += cnt; | ||
4288 | #endif /* ADVANSYS_STATS */ | 3810 | #endif /* ADVANSYS_STATS */ |
4289 | 3811 | ||
4290 | /* | 3812 | /* |
4291 | * Display Asc Library dynamic configuration information | 3813 | * Display Asc Library dynamic configuration information |
4292 | * for the board. | 3814 | * for the board. |
4293 | */ | 3815 | */ |
4294 | cp = boardp->prtbuf; | 3816 | if (ASC_NARROW_BOARD(boardp)) |
4295 | if (ASC_NARROW_BOARD(boardp)) { | 3817 | asc_prt_asc_board_info(m, shost); |
4296 | cplen = asc_prt_asc_board_info(shost, cp, ASC_PRTBUF_SIZE); | 3818 | else |
4297 | } else { | 3819 | asc_prt_adv_board_info(m, shost); |
4298 | cplen = asc_prt_adv_board_info(shost, cp, ASC_PRTBUF_SIZE); | 3820 | return 0; |
4299 | } | ||
4300 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4301 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4302 | totcnt += cnt; | ||
4303 | leftlen -= cnt; | ||
4304 | if (leftlen == 0) { | ||
4305 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4306 | return totcnt; | ||
4307 | } | ||
4308 | advoffset += cplen; | ||
4309 | curbuf += cnt; | ||
4310 | |||
4311 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4312 | |||
4313 | return totcnt; | ||
4314 | } | 3821 | } |
4315 | #endif /* CONFIG_PROC_FS */ | 3822 | #endif /* CONFIG_PROC_FS */ |
4316 | 3823 | ||
@@ -11743,7 +11250,7 @@ static int AdvInitGetConfig(struct pci_dev *pdev, struct Scsi_Host *shost) | |||
11743 | static struct scsi_host_template advansys_template = { | 11250 | static struct scsi_host_template advansys_template = { |
11744 | .proc_name = DRV_NAME, | 11251 | .proc_name = DRV_NAME, |
11745 | #ifdef CONFIG_PROC_FS | 11252 | #ifdef CONFIG_PROC_FS |
11746 | .proc_info = advansys_proc_info, | 11253 | .show_info = advansys_show_info, |
11747 | #endif | 11254 | #endif |
11748 | .name = DRV_NAME, | 11255 | .name = DRV_NAME, |
11749 | .info = advansys_info, | 11256 | .info = advansys_info, |
@@ -11939,20 +11446,6 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
11939 | #endif /* CONFIG_PCI */ | 11446 | #endif /* CONFIG_PCI */ |
11940 | } | 11447 | } |
11941 | 11448 | ||
11942 | #ifdef CONFIG_PROC_FS | ||
11943 | /* | ||
11944 | * Allocate buffer for printing information from | ||
11945 | * /proc/scsi/advansys/[0...]. | ||
11946 | */ | ||
11947 | boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL); | ||
11948 | if (!boardp->prtbuf) { | ||
11949 | shost_printk(KERN_ERR, shost, "kmalloc(%d) returned NULL\n", | ||
11950 | ASC_PRTBUF_SIZE); | ||
11951 | ret = -ENOMEM; | ||
11952 | goto err_unmap; | ||
11953 | } | ||
11954 | #endif /* CONFIG_PROC_FS */ | ||
11955 | |||
11956 | if (ASC_NARROW_BOARD(boardp)) { | 11449 | if (ASC_NARROW_BOARD(boardp)) { |
11957 | /* | 11450 | /* |
11958 | * Set the board bus type and PCI IRQ before | 11451 | * Set the board bus type and PCI IRQ before |
@@ -12010,7 +11503,7 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12010 | } | 11503 | } |
12011 | 11504 | ||
12012 | if (ret) | 11505 | if (ret) |
12013 | goto err_free_proc; | 11506 | goto err_unmap; |
12014 | 11507 | ||
12015 | /* | 11508 | /* |
12016 | * Save the EEPROM configuration so that it can be displayed | 11509 | * Save the EEPROM configuration so that it can be displayed |
@@ -12055,7 +11548,7 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12055 | ASC_DBG(2, "AscInitSetConfig()\n"); | 11548 | ASC_DBG(2, "AscInitSetConfig()\n"); |
12056 | ret = AscInitSetConfig(pdev, shost) ? -ENODEV : 0; | 11549 | ret = AscInitSetConfig(pdev, shost) ? -ENODEV : 0; |
12057 | if (ret) | 11550 | if (ret) |
12058 | goto err_free_proc; | 11551 | goto err_unmap; |
12059 | } else { | 11552 | } else { |
12060 | ADVEEP_3550_CONFIG *ep_3550; | 11553 | ADVEEP_3550_CONFIG *ep_3550; |
12061 | ADVEEP_38C0800_CONFIG *ep_38C0800; | 11554 | ADVEEP_38C0800_CONFIG *ep_38C0800; |
@@ -12290,7 +11783,7 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12290 | shost_printk(KERN_ERR, shost, "request_dma() " | 11783 | shost_printk(KERN_ERR, shost, "request_dma() " |
12291 | "%d failed %d\n", | 11784 | "%d failed %d\n", |
12292 | shost->dma_channel, ret); | 11785 | shost->dma_channel, ret); |
12293 | goto err_free_proc; | 11786 | goto err_unmap; |
12294 | } | 11787 | } |
12295 | AscEnableIsaDma(shost->dma_channel); | 11788 | AscEnableIsaDma(shost->dma_channel); |
12296 | } | 11789 | } |
@@ -12371,8 +11864,6 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12371 | if (shost->dma_channel != NO_ISA_DMA) | 11864 | if (shost->dma_channel != NO_ISA_DMA) |
12372 | free_dma(shost->dma_channel); | 11865 | free_dma(shost->dma_channel); |
12373 | #endif | 11866 | #endif |
12374 | err_free_proc: | ||
12375 | kfree(boardp->prtbuf); | ||
12376 | err_unmap: | 11867 | err_unmap: |
12377 | if (boardp->ioremap_addr) | 11868 | if (boardp->ioremap_addr) |
12378 | iounmap(boardp->ioremap_addr); | 11869 | iounmap(boardp->ioremap_addr); |
@@ -12406,7 +11897,6 @@ static int advansys_release(struct Scsi_Host *shost) | |||
12406 | iounmap(board->ioremap_addr); | 11897 | iounmap(board->ioremap_addr); |
12407 | advansys_wide_free_mem(board); | 11898 | advansys_wide_free_mem(board); |
12408 | } | 11899 | } |
12409 | kfree(board->prtbuf); | ||
12410 | scsi_host_put(shost); | 11900 | scsi_host_put(shost); |
12411 | ASC_DBG(1, "end\n"); | 11901 | ASC_DBG(1, "end\n"); |
12412 | return 0; | 11902 | return 0; |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index a284be17699f..3f7b6fee0a74 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -2977,11 +2977,10 @@ static void show_queues(struct Scsi_Host *shpnt) | |||
2977 | } | 2977 | } |
2978 | 2978 | ||
2979 | #undef SPRINTF | 2979 | #undef SPRINTF |
2980 | #define SPRINTF(args...) pos += sprintf(pos, ## args) | 2980 | #define SPRINTF(args...) seq_printf(m, ##args) |
2981 | 2981 | ||
2982 | static int get_command(char *pos, Scsi_Cmnd * ptr) | 2982 | static void get_command(struct seq_file *m, Scsi_Cmnd * ptr) |
2983 | { | 2983 | { |
2984 | char *start = pos; | ||
2985 | int i; | 2984 | int i; |
2986 | 2985 | ||
2987 | SPRINTF("%p: target=%d; lun=%d; cmnd=( ", | 2986 | SPRINTF("%p: target=%d; lun=%d; cmnd=( ", |
@@ -3011,13 +3010,10 @@ static int get_command(char *pos, Scsi_Cmnd * ptr) | |||
3011 | if (ptr->SCp.phase & syncneg) | 3010 | if (ptr->SCp.phase & syncneg) |
3012 | SPRINTF("syncneg|"); | 3011 | SPRINTF("syncneg|"); |
3013 | SPRINTF("; next=0x%p\n", SCNEXT(ptr)); | 3012 | SPRINTF("; next=0x%p\n", SCNEXT(ptr)); |
3014 | |||
3015 | return (pos - start); | ||
3016 | } | 3013 | } |
3017 | 3014 | ||
3018 | static int get_ports(struct Scsi_Host *shpnt, char *pos) | 3015 | static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt) |
3019 | { | 3016 | { |
3020 | char *start = pos; | ||
3021 | int s; | 3017 | int s; |
3022 | 3018 | ||
3023 | SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name); | 3019 | SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name); |
@@ -3273,11 +3269,9 @@ static int get_ports(struct Scsi_Host *shpnt, char *pos) | |||
3273 | if (s & ENREQINIT) | 3269 | if (s & ENREQINIT) |
3274 | SPRINTF("ENREQINIT "); | 3270 | SPRINTF("ENREQINIT "); |
3275 | SPRINTF(")\n"); | 3271 | SPRINTF(")\n"); |
3276 | |||
3277 | return (pos - start); | ||
3278 | } | 3272 | } |
3279 | 3273 | ||
3280 | static int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) | 3274 | static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length) |
3281 | { | 3275 | { |
3282 | if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) | 3276 | if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) |
3283 | return -EINVAL; | 3277 | return -EINVAL; |
@@ -3320,26 +3314,11 @@ static int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) | |||
3320 | return length; | 3314 | return length; |
3321 | } | 3315 | } |
3322 | 3316 | ||
3323 | #undef SPRINTF | 3317 | static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt) |
3324 | #define SPRINTF(args...) \ | ||
3325 | do { if(pos < buffer + length) pos += sprintf(pos, ## args); } while(0) | ||
3326 | |||
3327 | static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start, | ||
3328 | off_t offset, int length, int inout) | ||
3329 | { | 3318 | { |
3330 | int i; | 3319 | int i; |
3331 | char *pos = buffer; | ||
3332 | Scsi_Cmnd *ptr; | 3320 | Scsi_Cmnd *ptr; |
3333 | unsigned long flags; | 3321 | unsigned long flags; |
3334 | int thislength; | ||
3335 | |||
3336 | DPRINTK(debug_procinfo, | ||
3337 | KERN_DEBUG "aha152x_proc_info: buffer=%p offset=%ld length=%d hostno=%d inout=%d\n", | ||
3338 | buffer, offset, length, shpnt->host_no, inout); | ||
3339 | |||
3340 | |||
3341 | if (inout) | ||
3342 | return aha152x_set_info(buffer, length, shpnt); | ||
3343 | 3322 | ||
3344 | SPRINTF(AHA152X_REVID "\n"); | 3323 | SPRINTF(AHA152X_REVID "\n"); |
3345 | 3324 | ||
@@ -3392,25 +3371,25 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3392 | if (ISSUE_SC) { | 3371 | if (ISSUE_SC) { |
3393 | SPRINTF("not yet issued commands:\n"); | 3372 | SPRINTF("not yet issued commands:\n"); |
3394 | for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr)) | 3373 | for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr)) |
3395 | pos += get_command(pos, ptr); | 3374 | get_command(m, ptr); |
3396 | } else | 3375 | } else |
3397 | SPRINTF("no not yet issued commands\n"); | 3376 | SPRINTF("no not yet issued commands\n"); |
3398 | DO_UNLOCK(flags); | 3377 | DO_UNLOCK(flags); |
3399 | 3378 | ||
3400 | if (CURRENT_SC) { | 3379 | if (CURRENT_SC) { |
3401 | SPRINTF("current command:\n"); | 3380 | SPRINTF("current command:\n"); |
3402 | pos += get_command(pos, CURRENT_SC); | 3381 | get_command(m, CURRENT_SC); |
3403 | } else | 3382 | } else |
3404 | SPRINTF("no current command\n"); | 3383 | SPRINTF("no current command\n"); |
3405 | 3384 | ||
3406 | if (DISCONNECTED_SC) { | 3385 | if (DISCONNECTED_SC) { |
3407 | SPRINTF("disconnected commands:\n"); | 3386 | SPRINTF("disconnected commands:\n"); |
3408 | for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr)) | 3387 | for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr)) |
3409 | pos += get_command(pos, ptr); | 3388 | get_command(m, ptr); |
3410 | } else | 3389 | } else |
3411 | SPRINTF("no disconnected commands\n"); | 3390 | SPRINTF("no disconnected commands\n"); |
3412 | 3391 | ||
3413 | pos += get_ports(shpnt, pos); | 3392 | get_ports(m, shpnt); |
3414 | 3393 | ||
3415 | #if defined(AHA152X_STAT) | 3394 | #if defined(AHA152X_STAT) |
3416 | SPRINTF("statistics:\n" | 3395 | SPRINTF("statistics:\n" |
@@ -3440,24 +3419,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3440 | HOSTDATA(shpnt)->time[i]); | 3419 | HOSTDATA(shpnt)->time[i]); |
3441 | } | 3420 | } |
3442 | #endif | 3421 | #endif |
3443 | 3422 | return 0; | |
3444 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: pos=%p\n", pos); | ||
3445 | |||
3446 | thislength = pos - (buffer + offset); | ||
3447 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: length=%d thislength=%d\n", length, thislength); | ||
3448 | |||
3449 | if(thislength<0) { | ||
3450 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: output too short\n"); | ||
3451 | *start = NULL; | ||
3452 | return 0; | ||
3453 | } | ||
3454 | |||
3455 | thislength = thislength<length ? thislength : length; | ||
3456 | |||
3457 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: return %d\n", thislength); | ||
3458 | |||
3459 | *start = buffer + offset; | ||
3460 | return thislength < length ? thislength : length; | ||
3461 | } | 3423 | } |
3462 | 3424 | ||
3463 | static int aha152x_adjust_queue(struct scsi_device *device) | 3425 | static int aha152x_adjust_queue(struct scsi_device *device) |
@@ -3470,7 +3432,8 @@ static struct scsi_host_template aha152x_driver_template = { | |||
3470 | .module = THIS_MODULE, | 3432 | .module = THIS_MODULE, |
3471 | .name = AHA152X_REVID, | 3433 | .name = AHA152X_REVID, |
3472 | .proc_name = "aha152x", | 3434 | .proc_name = "aha152x", |
3473 | .proc_info = aha152x_proc_info, | 3435 | .show_info = aha152x_show_info, |
3436 | .write_info = aha152x_set_info, | ||
3474 | .queuecommand = aha152x_queue, | 3437 | .queuecommand = aha152x_queue, |
3475 | .eh_abort_handler = aha152x_abort, | 3438 | .eh_abort_handler = aha152x_abort, |
3476 | .eh_device_reset_handler = aha152x_device_reset, | 3439 | .eh_device_reset_handler = aha152x_device_reset, |
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index df775e6ba579..5f3101797c93 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c | |||
@@ -106,33 +106,14 @@ static inline dma_addr_t ecb_cpu_to_dma (struct Scsi_Host *host, void *cpu) | |||
106 | return hdata->ecb_dma_addr + offset; | 106 | return hdata->ecb_dma_addr + offset; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int aha1740_proc_info(struct Scsi_Host *shpnt, char *buffer, | 109 | static int aha1740_show_info(struct seq_file *m, struct Scsi_Host *shpnt) |
110 | char **start, off_t offset, | ||
111 | int length, int inout) | ||
112 | { | 110 | { |
113 | int len; | 111 | struct aha1740_hostdata *host = HOSTDATA(shpnt); |
114 | struct aha1740_hostdata *host; | 112 | seq_printf(m, "aha174x at IO:%lx, IRQ %d, SLOT %d.\n" |
115 | |||
116 | if (inout) | ||
117 | return-ENOSYS; | ||
118 | |||
119 | host = HOSTDATA(shpnt); | ||
120 | |||
121 | len = sprintf(buffer, "aha174x at IO:%lx, IRQ %d, SLOT %d.\n" | ||
122 | "Extended translation %sabled.\n", | 113 | "Extended translation %sabled.\n", |
123 | shpnt->io_port, shpnt->irq, host->edev->slot, | 114 | shpnt->io_port, shpnt->irq, host->edev->slot, |
124 | host->translation ? "en" : "dis"); | 115 | host->translation ? "en" : "dis"); |
125 | 116 | return 0; | |
126 | if (offset > len) { | ||
127 | *start = buffer; | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | *start = buffer + offset; | ||
132 | len -= offset; | ||
133 | if (len > length) | ||
134 | len = length; | ||
135 | return len; | ||
136 | } | 117 | } |
137 | 118 | ||
138 | static int aha1740_makecode(unchar *sense, unchar *status) | 119 | static int aha1740_makecode(unchar *sense, unchar *status) |
@@ -556,7 +537,7 @@ static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy) | |||
556 | static struct scsi_host_template aha1740_template = { | 537 | static struct scsi_host_template aha1740_template = { |
557 | .module = THIS_MODULE, | 538 | .module = THIS_MODULE, |
558 | .proc_name = "aha1740", | 539 | .proc_name = "aha1740", |
559 | .proc_info = aha1740_proc_info, | 540 | .show_info = aha1740_show_info, |
560 | .name = "Adaptec 174x (EISA)", | 541 | .name = "Adaptec 174x (EISA)", |
561 | .queuecommand = aha1740_queuecommand, | 542 | .queuecommand = aha1740_queuecommand, |
562 | .bios_param = aha1740_biosparam, | 543 | .bios_param = aha1740_biosparam, |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 9328121804bb..69d5c43a65e5 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -906,7 +906,8 @@ struct scsi_host_template aic79xx_driver_template = { | |||
906 | .module = THIS_MODULE, | 906 | .module = THIS_MODULE, |
907 | .name = "aic79xx", | 907 | .name = "aic79xx", |
908 | .proc_name = "aic79xx", | 908 | .proc_name = "aic79xx", |
909 | .proc_info = ahd_linux_proc_info, | 909 | .show_info = ahd_linux_show_info, |
910 | .write_info = ahd_proc_write_seeprom, | ||
910 | .info = ahd_linux_info, | 911 | .info = ahd_linux_info, |
911 | .queuecommand = ahd_linux_queue, | 912 | .queuecommand = ahd_linux_queue, |
912 | .eh_abort_handler = ahd_linux_abort, | 913 | .eh_abort_handler = ahd_linux_abort, |
@@ -1702,19 +1703,13 @@ ahd_send_async(struct ahd_softc *ahd, char channel, | |||
1702 | switch (code) { | 1703 | switch (code) { |
1703 | case AC_TRANSFER_NEG: | 1704 | case AC_TRANSFER_NEG: |
1704 | { | 1705 | { |
1705 | char buf[80]; | ||
1706 | struct scsi_target *starget; | 1706 | struct scsi_target *starget; |
1707 | struct info_str info; | ||
1708 | struct ahd_initiator_tinfo *tinfo; | 1707 | struct ahd_initiator_tinfo *tinfo; |
1709 | struct ahd_tmode_tstate *tstate; | 1708 | struct ahd_tmode_tstate *tstate; |
1710 | unsigned int target_ppr_options; | 1709 | unsigned int target_ppr_options; |
1711 | 1710 | ||
1712 | BUG_ON(target == CAM_TARGET_WILDCARD); | 1711 | BUG_ON(target == CAM_TARGET_WILDCARD); |
1713 | 1712 | ||
1714 | info.buffer = buf; | ||
1715 | info.length = sizeof(buf); | ||
1716 | info.offset = 0; | ||
1717 | info.pos = 0; | ||
1718 | tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, | 1713 | tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, |
1719 | target, &tstate); | 1714 | target, &tstate); |
1720 | 1715 | ||
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 28e43498cdff..c58fa33c6592 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h | |||
@@ -379,14 +379,6 @@ void ahd_insb(struct ahd_softc * ahd, long port, | |||
379 | int ahd_linux_register_host(struct ahd_softc *, | 379 | int ahd_linux_register_host(struct ahd_softc *, |
380 | struct scsi_host_template *); | 380 | struct scsi_host_template *); |
381 | 381 | ||
382 | /*************************** Pretty Printing **********************************/ | ||
383 | struct info_str { | ||
384 | char *buffer; | ||
385 | int length; | ||
386 | off_t offset; | ||
387 | int pos; | ||
388 | }; | ||
389 | |||
390 | /******************************** Locking *************************************/ | 382 | /******************************** Locking *************************************/ |
391 | static inline void | 383 | static inline void |
392 | ahd_lockinit(struct ahd_softc *ahd) | 384 | ahd_lockinit(struct ahd_softc *ahd) |
@@ -513,8 +505,8 @@ ahd_flush_device_writes(struct ahd_softc *ahd) | |||
513 | } | 505 | } |
514 | 506 | ||
515 | /**************************** Proc FS Support *********************************/ | 507 | /**************************** Proc FS Support *********************************/ |
516 | int ahd_linux_proc_info(struct Scsi_Host *, char *, char **, | 508 | int ahd_proc_write_seeprom(struct Scsi_Host *, char *, int); |
517 | off_t, int, int); | 509 | int ahd_linux_show_info(struct seq_file *,struct Scsi_Host *); |
518 | 510 | ||
519 | /*********************** Transaction Access Wrappers **************************/ | 511 | /*********************** Transaction Access Wrappers **************************/ |
520 | static inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t); | 512 | static inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t); |
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c index 59c85d5a153a..e9778b4f7e32 100644 --- a/drivers/scsi/aic7xxx/aic79xx_proc.c +++ b/drivers/scsi/aic7xxx/aic79xx_proc.c | |||
@@ -42,16 +42,12 @@ | |||
42 | #include "aic79xx_osm.h" | 42 | #include "aic79xx_osm.h" |
43 | #include "aic79xx_inline.h" | 43 | #include "aic79xx_inline.h" |
44 | 44 | ||
45 | static void copy_mem_info(struct info_str *info, char *data, int len); | ||
46 | static int copy_info(struct info_str *info, char *fmt, ...); | ||
47 | static void ahd_dump_target_state(struct ahd_softc *ahd, | 45 | static void ahd_dump_target_state(struct ahd_softc *ahd, |
48 | struct info_str *info, | 46 | struct seq_file *m, |
49 | u_int our_id, char channel, | 47 | u_int our_id, char channel, |
50 | u_int target_id); | 48 | u_int target_id); |
51 | static void ahd_dump_device_state(struct info_str *info, | 49 | static void ahd_dump_device_state(struct seq_file *m, |
52 | struct scsi_device *sdev); | 50 | struct scsi_device *sdev); |
53 | static int ahd_proc_write_seeprom(struct ahd_softc *ahd, | ||
54 | char *buffer, int length); | ||
55 | 51 | ||
56 | /* | 52 | /* |
57 | * Table of syncrates that don't follow the "divisible by 4" | 53 | * Table of syncrates that don't follow the "divisible by 4" |
@@ -93,58 +89,15 @@ ahd_calc_syncsrate(u_int period_factor) | |||
93 | return (10000000 / (period_factor * 4 * 10)); | 89 | return (10000000 / (period_factor * 4 * 10)); |
94 | } | 90 | } |
95 | 91 | ||
96 | |||
97 | static void | ||
98 | copy_mem_info(struct info_str *info, char *data, int len) | ||
99 | { | ||
100 | if (info->pos + len > info->offset + info->length) | ||
101 | len = info->offset + info->length - info->pos; | ||
102 | |||
103 | if (info->pos + len < info->offset) { | ||
104 | info->pos += len; | ||
105 | return; | ||
106 | } | ||
107 | |||
108 | if (info->pos < info->offset) { | ||
109 | off_t partial; | ||
110 | |||
111 | partial = info->offset - info->pos; | ||
112 | data += partial; | ||
113 | info->pos += partial; | ||
114 | len -= partial; | ||
115 | } | ||
116 | |||
117 | if (len > 0) { | ||
118 | memcpy(info->buffer, data, len); | ||
119 | info->pos += len; | ||
120 | info->buffer += len; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | static int | ||
125 | copy_info(struct info_str *info, char *fmt, ...) | ||
126 | { | ||
127 | va_list args; | ||
128 | char buf[256]; | ||
129 | int len; | ||
130 | |||
131 | va_start(args, fmt); | ||
132 | len = vsprintf(buf, fmt, args); | ||
133 | va_end(args); | ||
134 | |||
135 | copy_mem_info(info, buf, len); | ||
136 | return (len); | ||
137 | } | ||
138 | |||
139 | static void | 92 | static void |
140 | ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) | 93 | ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo) |
141 | { | 94 | { |
142 | u_int speed; | 95 | u_int speed; |
143 | u_int freq; | 96 | u_int freq; |
144 | u_int mb; | 97 | u_int mb; |
145 | 98 | ||
146 | if (tinfo->period == AHD_PERIOD_UNKNOWN) { | 99 | if (tinfo->period == AHD_PERIOD_UNKNOWN) { |
147 | copy_info(info, "Renegotiation Pending\n"); | 100 | seq_printf(m, "Renegotiation Pending\n"); |
148 | return; | 101 | return; |
149 | } | 102 | } |
150 | speed = 3300; | 103 | speed = 3300; |
@@ -156,34 +109,34 @@ ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) | |||
156 | speed *= (0x01 << tinfo->width); | 109 | speed *= (0x01 << tinfo->width); |
157 | mb = speed / 1000; | 110 | mb = speed / 1000; |
158 | if (mb > 0) | 111 | if (mb > 0) |
159 | copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); | 112 | seq_printf(m, "%d.%03dMB/s transfers", mb, speed % 1000); |
160 | else | 113 | else |
161 | copy_info(info, "%dKB/s transfers", speed); | 114 | seq_printf(m, "%dKB/s transfers", speed); |
162 | 115 | ||
163 | if (freq != 0) { | 116 | if (freq != 0) { |
164 | int printed_options; | 117 | int printed_options; |
165 | 118 | ||
166 | printed_options = 0; | 119 | printed_options = 0; |
167 | copy_info(info, " (%d.%03dMHz", freq / 1000, freq % 1000); | 120 | seq_printf(m, " (%d.%03dMHz", freq / 1000, freq % 1000); |
168 | if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) { | 121 | if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) { |
169 | copy_info(info, " RDSTRM"); | 122 | seq_printf(m, " RDSTRM"); |
170 | printed_options++; | 123 | printed_options++; |
171 | } | 124 | } |
172 | if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) { | 125 | if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) { |
173 | copy_info(info, "%s", printed_options ? "|DT" : " DT"); | 126 | seq_printf(m, "%s", printed_options ? "|DT" : " DT"); |
174 | printed_options++; | 127 | printed_options++; |
175 | } | 128 | } |
176 | if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { | 129 | if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { |
177 | copy_info(info, "%s", printed_options ? "|IU" : " IU"); | 130 | seq_printf(m, "%s", printed_options ? "|IU" : " IU"); |
178 | printed_options++; | 131 | printed_options++; |
179 | } | 132 | } |
180 | if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) { | 133 | if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) { |
181 | copy_info(info, "%s", | 134 | seq_printf(m, "%s", |
182 | printed_options ? "|RTI" : " RTI"); | 135 | printed_options ? "|RTI" : " RTI"); |
183 | printed_options++; | 136 | printed_options++; |
184 | } | 137 | } |
185 | if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) { | 138 | if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) { |
186 | copy_info(info, "%s", | 139 | seq_printf(m, "%s", |
187 | printed_options ? "|QAS" : " QAS"); | 140 | printed_options ? "|QAS" : " QAS"); |
188 | printed_options++; | 141 | printed_options++; |
189 | } | 142 | } |
@@ -191,19 +144,19 @@ ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) | |||
191 | 144 | ||
192 | if (tinfo->width > 0) { | 145 | if (tinfo->width > 0) { |
193 | if (freq != 0) { | 146 | if (freq != 0) { |
194 | copy_info(info, ", "); | 147 | seq_printf(m, ", "); |
195 | } else { | 148 | } else { |
196 | copy_info(info, " ("); | 149 | seq_printf(m, " ("); |
197 | } | 150 | } |
198 | copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); | 151 | seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width)); |
199 | } else if (freq != 0) { | 152 | } else if (freq != 0) { |
200 | copy_info(info, ")"); | 153 | seq_printf(m, ")"); |
201 | } | 154 | } |
202 | copy_info(info, "\n"); | 155 | seq_printf(m, "\n"); |
203 | } | 156 | } |
204 | 157 | ||
205 | static void | 158 | static void |
206 | ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, | 159 | ahd_dump_target_state(struct ahd_softc *ahd, struct seq_file *m, |
207 | u_int our_id, char channel, u_int target_id) | 160 | u_int our_id, char channel, u_int target_id) |
208 | { | 161 | { |
209 | struct scsi_target *starget; | 162 | struct scsi_target *starget; |
@@ -213,17 +166,17 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, | |||
213 | 166 | ||
214 | tinfo = ahd_fetch_transinfo(ahd, channel, our_id, | 167 | tinfo = ahd_fetch_transinfo(ahd, channel, our_id, |
215 | target_id, &tstate); | 168 | target_id, &tstate); |
216 | copy_info(info, "Target %d Negotiation Settings\n", target_id); | 169 | seq_printf(m, "Target %d Negotiation Settings\n", target_id); |
217 | copy_info(info, "\tUser: "); | 170 | seq_printf(m, "\tUser: "); |
218 | ahd_format_transinfo(info, &tinfo->user); | 171 | ahd_format_transinfo(m, &tinfo->user); |
219 | starget = ahd->platform_data->starget[target_id]; | 172 | starget = ahd->platform_data->starget[target_id]; |
220 | if (starget == NULL) | 173 | if (starget == NULL) |
221 | return; | 174 | return; |
222 | 175 | ||
223 | copy_info(info, "\tGoal: "); | 176 | seq_printf(m, "\tGoal: "); |
224 | ahd_format_transinfo(info, &tinfo->goal); | 177 | ahd_format_transinfo(m, &tinfo->goal); |
225 | copy_info(info, "\tCurr: "); | 178 | seq_printf(m, "\tCurr: "); |
226 | ahd_format_transinfo(info, &tinfo->curr); | 179 | ahd_format_transinfo(m, &tinfo->curr); |
227 | 180 | ||
228 | for (lun = 0; lun < AHD_NUM_LUNS; lun++) { | 181 | for (lun = 0; lun < AHD_NUM_LUNS; lun++) { |
229 | struct scsi_device *dev; | 182 | struct scsi_device *dev; |
@@ -233,29 +186,30 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, | |||
233 | if (dev == NULL) | 186 | if (dev == NULL) |
234 | continue; | 187 | continue; |
235 | 188 | ||
236 | ahd_dump_device_state(info, dev); | 189 | ahd_dump_device_state(m, dev); |
237 | } | 190 | } |
238 | } | 191 | } |
239 | 192 | ||
240 | static void | 193 | static void |
241 | ahd_dump_device_state(struct info_str *info, struct scsi_device *sdev) | 194 | ahd_dump_device_state(struct seq_file *m, struct scsi_device *sdev) |
242 | { | 195 | { |
243 | struct ahd_linux_device *dev = scsi_transport_device_data(sdev); | 196 | struct ahd_linux_device *dev = scsi_transport_device_data(sdev); |
244 | 197 | ||
245 | copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", | 198 | seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", |
246 | sdev->sdev_target->channel + 'A', | 199 | sdev->sdev_target->channel + 'A', |
247 | sdev->sdev_target->id, sdev->lun); | 200 | sdev->sdev_target->id, sdev->lun); |
248 | 201 | ||
249 | copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); | 202 | seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); |
250 | copy_info(info, "\t\tCommands Active %d\n", dev->active); | 203 | seq_printf(m, "\t\tCommands Active %d\n", dev->active); |
251 | copy_info(info, "\t\tCommand Openings %d\n", dev->openings); | 204 | seq_printf(m, "\t\tCommand Openings %d\n", dev->openings); |
252 | copy_info(info, "\t\tMax Tagged Openings %d\n", dev->maxtags); | 205 | seq_printf(m, "\t\tMax Tagged Openings %d\n", dev->maxtags); |
253 | copy_info(info, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); | 206 | seq_printf(m, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); |
254 | } | 207 | } |
255 | 208 | ||
256 | static int | 209 | int |
257 | ahd_proc_write_seeprom(struct ahd_softc *ahd, char *buffer, int length) | 210 | ahd_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length) |
258 | { | 211 | { |
212 | struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; | ||
259 | ahd_mode_state saved_modes; | 213 | ahd_mode_state saved_modes; |
260 | int have_seeprom; | 214 | int have_seeprom; |
261 | u_long s; | 215 | u_long s; |
@@ -319,64 +273,45 @@ done: | |||
319 | * Return information to handle /proc support for the driver. | 273 | * Return information to handle /proc support for the driver. |
320 | */ | 274 | */ |
321 | int | 275 | int |
322 | ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 276 | ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost) |
323 | off_t offset, int length, int inout) | ||
324 | { | 277 | { |
325 | struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; | 278 | struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; |
326 | struct info_str info; | ||
327 | char ahd_info[256]; | 279 | char ahd_info[256]; |
328 | u_int max_targ; | 280 | u_int max_targ; |
329 | u_int i; | 281 | u_int i; |
330 | int retval; | ||
331 | 282 | ||
332 | /* Has data been written to the file? */ | 283 | seq_printf(m, "Adaptec AIC79xx driver version: %s\n", |
333 | if (inout == TRUE) { | ||
334 | retval = ahd_proc_write_seeprom(ahd, buffer, length); | ||
335 | goto done; | ||
336 | } | ||
337 | |||
338 | if (start) | ||
339 | *start = buffer; | ||
340 | |||
341 | info.buffer = buffer; | ||
342 | info.length = length; | ||
343 | info.offset = offset; | ||
344 | info.pos = 0; | ||
345 | |||
346 | copy_info(&info, "Adaptec AIC79xx driver version: %s\n", | ||
347 | AIC79XX_DRIVER_VERSION); | 284 | AIC79XX_DRIVER_VERSION); |
348 | copy_info(&info, "%s\n", ahd->description); | 285 | seq_printf(m, "%s\n", ahd->description); |
349 | ahd_controller_info(ahd, ahd_info); | 286 | ahd_controller_info(ahd, ahd_info); |
350 | copy_info(&info, "%s\n", ahd_info); | 287 | seq_printf(m, "%s\n", ahd_info); |
351 | copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", | 288 | seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n", |
352 | ahd->scb_data.numscbs, AHD_NSEG); | 289 | ahd->scb_data.numscbs, AHD_NSEG); |
353 | 290 | ||
354 | max_targ = 16; | 291 | max_targ = 16; |
355 | 292 | ||
356 | if (ahd->seep_config == NULL) | 293 | if (ahd->seep_config == NULL) |
357 | copy_info(&info, "No Serial EEPROM\n"); | 294 | seq_printf(m, "No Serial EEPROM\n"); |
358 | else { | 295 | else { |
359 | copy_info(&info, "Serial EEPROM:\n"); | 296 | seq_printf(m, "Serial EEPROM:\n"); |
360 | for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) { | 297 | for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) { |
361 | if (((i % 8) == 0) && (i != 0)) { | 298 | if (((i % 8) == 0) && (i != 0)) { |
362 | copy_info(&info, "\n"); | 299 | seq_printf(m, "\n"); |
363 | } | 300 | } |
364 | copy_info(&info, "0x%.4x ", | 301 | seq_printf(m, "0x%.4x ", |
365 | ((uint16_t*)ahd->seep_config)[i]); | 302 | ((uint16_t*)ahd->seep_config)[i]); |
366 | } | 303 | } |
367 | copy_info(&info, "\n"); | 304 | seq_printf(m, "\n"); |
368 | } | 305 | } |
369 | copy_info(&info, "\n"); | 306 | seq_printf(m, "\n"); |
370 | 307 | ||
371 | if ((ahd->features & AHD_WIDE) == 0) | 308 | if ((ahd->features & AHD_WIDE) == 0) |
372 | max_targ = 8; | 309 | max_targ = 8; |
373 | 310 | ||
374 | for (i = 0; i < max_targ; i++) { | 311 | for (i = 0; i < max_targ; i++) { |
375 | 312 | ||
376 | ahd_dump_target_state(ahd, &info, ahd->our_id, 'A', | 313 | ahd_dump_target_state(ahd, m, ahd->our_id, 'A', |
377 | /*target_id*/i); | 314 | /*target_id*/i); |
378 | } | 315 | } |
379 | retval = info.pos > info.offset ? info.pos - info.offset : 0; | 316 | return 0; |
380 | done: | ||
381 | return (retval); | ||
382 | } | 317 | } |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 5a477cdc780d..c0c62583b542 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -803,7 +803,8 @@ struct scsi_host_template aic7xxx_driver_template = { | |||
803 | .module = THIS_MODULE, | 803 | .module = THIS_MODULE, |
804 | .name = "aic7xxx", | 804 | .name = "aic7xxx", |
805 | .proc_name = "aic7xxx", | 805 | .proc_name = "aic7xxx", |
806 | .proc_info = ahc_linux_proc_info, | 806 | .show_info = ahc_linux_show_info, |
807 | .write_info = ahc_proc_write_seeprom, | ||
807 | .info = ahc_linux_info, | 808 | .info = ahc_linux_info, |
808 | .queuecommand = ahc_linux_queue, | 809 | .queuecommand = ahc_linux_queue, |
809 | .eh_abort_handler = ahc_linux_abort, | 810 | .eh_abort_handler = ahc_linux_abort, |
@@ -1631,10 +1632,8 @@ ahc_send_async(struct ahc_softc *ahc, char channel, | |||
1631 | switch (code) { | 1632 | switch (code) { |
1632 | case AC_TRANSFER_NEG: | 1633 | case AC_TRANSFER_NEG: |
1633 | { | 1634 | { |
1634 | char buf[80]; | ||
1635 | struct scsi_target *starget; | 1635 | struct scsi_target *starget; |
1636 | struct ahc_linux_target *targ; | 1636 | struct ahc_linux_target *targ; |
1637 | struct info_str info; | ||
1638 | struct ahc_initiator_tinfo *tinfo; | 1637 | struct ahc_initiator_tinfo *tinfo; |
1639 | struct ahc_tmode_tstate *tstate; | 1638 | struct ahc_tmode_tstate *tstate; |
1640 | int target_offset; | 1639 | int target_offset; |
@@ -1642,10 +1641,6 @@ ahc_send_async(struct ahc_softc *ahc, char channel, | |||
1642 | 1641 | ||
1643 | BUG_ON(target == CAM_TARGET_WILDCARD); | 1642 | BUG_ON(target == CAM_TARGET_WILDCARD); |
1644 | 1643 | ||
1645 | info.buffer = buf; | ||
1646 | info.length = sizeof(buf); | ||
1647 | info.offset = 0; | ||
1648 | info.pos = 0; | ||
1649 | tinfo = ahc_fetch_transinfo(ahc, channel, | 1644 | tinfo = ahc_fetch_transinfo(ahc, channel, |
1650 | channel == 'A' ? ahc->our_id | 1645 | channel == 'A' ? ahc->our_id |
1651 | : ahc->our_id_b, | 1646 | : ahc->our_id_b, |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index bca0fb83f553..bc4cca92ff04 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h | |||
@@ -383,14 +383,6 @@ void ahc_insb(struct ahc_softc * ahc, long port, | |||
383 | int ahc_linux_register_host(struct ahc_softc *, | 383 | int ahc_linux_register_host(struct ahc_softc *, |
384 | struct scsi_host_template *); | 384 | struct scsi_host_template *); |
385 | 385 | ||
386 | /*************************** Pretty Printing **********************************/ | ||
387 | struct info_str { | ||
388 | char *buffer; | ||
389 | int length; | ||
390 | off_t offset; | ||
391 | int pos; | ||
392 | }; | ||
393 | |||
394 | /******************************** Locking *************************************/ | 386 | /******************************** Locking *************************************/ |
395 | /* Lock protecting internal data structures */ | 387 | /* Lock protecting internal data structures */ |
396 | 388 | ||
@@ -523,8 +515,8 @@ ahc_flush_device_writes(struct ahc_softc *ahc) | |||
523 | } | 515 | } |
524 | 516 | ||
525 | /**************************** Proc FS Support *********************************/ | 517 | /**************************** Proc FS Support *********************************/ |
526 | int ahc_linux_proc_info(struct Scsi_Host *, char *, char **, | 518 | int ahc_proc_write_seeprom(struct Scsi_Host *, char *, int); |
527 | off_t, int, int); | 519 | int ahc_linux_show_info(struct seq_file *, struct Scsi_Host *); |
528 | 520 | ||
529 | /*************************** Domain Validation ********************************/ | 521 | /*************************** Domain Validation ********************************/ |
530 | /*********************** Transaction Access Wrappers *************************/ | 522 | /*********************** Transaction Access Wrappers *************************/ |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index f2525f8ed1c7..383a3d11652d 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c | |||
@@ -43,16 +43,12 @@ | |||
43 | #include "aic7xxx_inline.h" | 43 | #include "aic7xxx_inline.h" |
44 | #include "aic7xxx_93cx6.h" | 44 | #include "aic7xxx_93cx6.h" |
45 | 45 | ||
46 | static void copy_mem_info(struct info_str *info, char *data, int len); | ||
47 | static int copy_info(struct info_str *info, char *fmt, ...); | ||
48 | static void ahc_dump_target_state(struct ahc_softc *ahc, | 46 | static void ahc_dump_target_state(struct ahc_softc *ahc, |
49 | struct info_str *info, | 47 | struct seq_file *m, |
50 | u_int our_id, char channel, | 48 | u_int our_id, char channel, |
51 | u_int target_id, u_int target_offset); | 49 | u_int target_id, u_int target_offset); |
52 | static void ahc_dump_device_state(struct info_str *info, | 50 | static void ahc_dump_device_state(struct seq_file *m, |
53 | struct scsi_device *dev); | 51 | struct scsi_device *dev); |
54 | static int ahc_proc_write_seeprom(struct ahc_softc *ahc, | ||
55 | char *buffer, int length); | ||
56 | 52 | ||
57 | /* | 53 | /* |
58 | * Table of syncrates that don't follow the "divisible by 4" | 54 | * Table of syncrates that don't follow the "divisible by 4" |
@@ -94,51 +90,8 @@ ahc_calc_syncsrate(u_int period_factor) | |||
94 | return (10000000 / (period_factor * 4 * 10)); | 90 | return (10000000 / (period_factor * 4 * 10)); |
95 | } | 91 | } |
96 | 92 | ||
97 | |||
98 | static void | ||
99 | copy_mem_info(struct info_str *info, char *data, int len) | ||
100 | { | ||
101 | if (info->pos + len > info->offset + info->length) | ||
102 | len = info->offset + info->length - info->pos; | ||
103 | |||
104 | if (info->pos + len < info->offset) { | ||
105 | info->pos += len; | ||
106 | return; | ||
107 | } | ||
108 | |||
109 | if (info->pos < info->offset) { | ||
110 | off_t partial; | ||
111 | |||
112 | partial = info->offset - info->pos; | ||
113 | data += partial; | ||
114 | info->pos += partial; | ||
115 | len -= partial; | ||
116 | } | ||
117 | |||
118 | if (len > 0) { | ||
119 | memcpy(info->buffer, data, len); | ||
120 | info->pos += len; | ||
121 | info->buffer += len; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | static int | ||
126 | copy_info(struct info_str *info, char *fmt, ...) | ||
127 | { | ||
128 | va_list args; | ||
129 | char buf[256]; | ||
130 | int len; | ||
131 | |||
132 | va_start(args, fmt); | ||
133 | len = vsprintf(buf, fmt, args); | ||
134 | va_end(args); | ||
135 | |||
136 | copy_mem_info(info, buf, len); | ||
137 | return (len); | ||
138 | } | ||
139 | |||
140 | static void | 93 | static void |
141 | ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) | 94 | ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo) |
142 | { | 95 | { |
143 | u_int speed; | 96 | u_int speed; |
144 | u_int freq; | 97 | u_int freq; |
@@ -153,12 +106,12 @@ ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) | |||
153 | speed *= (0x01 << tinfo->width); | 106 | speed *= (0x01 << tinfo->width); |
154 | mb = speed / 1000; | 107 | mb = speed / 1000; |
155 | if (mb > 0) | 108 | if (mb > 0) |
156 | copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); | 109 | seq_printf(m, "%d.%03dMB/s transfers", mb, speed % 1000); |
157 | else | 110 | else |
158 | copy_info(info, "%dKB/s transfers", speed); | 111 | seq_printf(m, "%dKB/s transfers", speed); |
159 | 112 | ||
160 | if (freq != 0) { | 113 | if (freq != 0) { |
161 | copy_info(info, " (%d.%03dMHz%s, offset %d", | 114 | seq_printf(m, " (%d.%03dMHz%s, offset %d", |
162 | freq / 1000, freq % 1000, | 115 | freq / 1000, freq % 1000, |
163 | (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 | 116 | (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 |
164 | ? " DT" : "", tinfo->offset); | 117 | ? " DT" : "", tinfo->offset); |
@@ -166,19 +119,19 @@ ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) | |||
166 | 119 | ||
167 | if (tinfo->width > 0) { | 120 | if (tinfo->width > 0) { |
168 | if (freq != 0) { | 121 | if (freq != 0) { |
169 | copy_info(info, ", "); | 122 | seq_printf(m, ", "); |
170 | } else { | 123 | } else { |
171 | copy_info(info, " ("); | 124 | seq_printf(m, " ("); |
172 | } | 125 | } |
173 | copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); | 126 | seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width)); |
174 | } else if (freq != 0) { | 127 | } else if (freq != 0) { |
175 | copy_info(info, ")"); | 128 | seq_printf(m, ")"); |
176 | } | 129 | } |
177 | copy_info(info, "\n"); | 130 | seq_printf(m, "\n"); |
178 | } | 131 | } |
179 | 132 | ||
180 | static void | 133 | static void |
181 | ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | 134 | ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m, |
182 | u_int our_id, char channel, u_int target_id, | 135 | u_int our_id, char channel, u_int target_id, |
183 | u_int target_offset) | 136 | u_int target_offset) |
184 | { | 137 | { |
@@ -190,18 +143,18 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | |||
190 | tinfo = ahc_fetch_transinfo(ahc, channel, our_id, | 143 | tinfo = ahc_fetch_transinfo(ahc, channel, our_id, |
191 | target_id, &tstate); | 144 | target_id, &tstate); |
192 | if ((ahc->features & AHC_TWIN) != 0) | 145 | if ((ahc->features & AHC_TWIN) != 0) |
193 | copy_info(info, "Channel %c ", channel); | 146 | seq_printf(m, "Channel %c ", channel); |
194 | copy_info(info, "Target %d Negotiation Settings\n", target_id); | 147 | seq_printf(m, "Target %d Negotiation Settings\n", target_id); |
195 | copy_info(info, "\tUser: "); | 148 | seq_printf(m, "\tUser: "); |
196 | ahc_format_transinfo(info, &tinfo->user); | 149 | ahc_format_transinfo(m, &tinfo->user); |
197 | starget = ahc->platform_data->starget[target_offset]; | 150 | starget = ahc->platform_data->starget[target_offset]; |
198 | if (!starget) | 151 | if (!starget) |
199 | return; | 152 | return; |
200 | 153 | ||
201 | copy_info(info, "\tGoal: "); | 154 | seq_printf(m, "\tGoal: "); |
202 | ahc_format_transinfo(info, &tinfo->goal); | 155 | ahc_format_transinfo(m, &tinfo->goal); |
203 | copy_info(info, "\tCurr: "); | 156 | seq_printf(m, "\tCurr: "); |
204 | ahc_format_transinfo(info, &tinfo->curr); | 157 | ahc_format_transinfo(m, &tinfo->curr); |
205 | 158 | ||
206 | for (lun = 0; lun < AHC_NUM_LUNS; lun++) { | 159 | for (lun = 0; lun < AHC_NUM_LUNS; lun++) { |
207 | struct scsi_device *sdev; | 160 | struct scsi_device *sdev; |
@@ -211,29 +164,30 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | |||
211 | if (sdev == NULL) | 164 | if (sdev == NULL) |
212 | continue; | 165 | continue; |
213 | 166 | ||
214 | ahc_dump_device_state(info, sdev); | 167 | ahc_dump_device_state(m, sdev); |
215 | } | 168 | } |
216 | } | 169 | } |
217 | 170 | ||
218 | static void | 171 | static void |
219 | ahc_dump_device_state(struct info_str *info, struct scsi_device *sdev) | 172 | ahc_dump_device_state(struct seq_file *m, struct scsi_device *sdev) |
220 | { | 173 | { |
221 | struct ahc_linux_device *dev = scsi_transport_device_data(sdev); | 174 | struct ahc_linux_device *dev = scsi_transport_device_data(sdev); |
222 | 175 | ||
223 | copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", | 176 | seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", |
224 | sdev->sdev_target->channel + 'A', | 177 | sdev->sdev_target->channel + 'A', |
225 | sdev->sdev_target->id, sdev->lun); | 178 | sdev->sdev_target->id, sdev->lun); |
226 | 179 | ||
227 | copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); | 180 | seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); |
228 | copy_info(info, "\t\tCommands Active %d\n", dev->active); | 181 | seq_printf(m, "\t\tCommands Active %d\n", dev->active); |
229 | copy_info(info, "\t\tCommand Openings %d\n", dev->openings); | 182 | seq_printf(m, "\t\tCommand Openings %d\n", dev->openings); |
230 | copy_info(info, "\t\tMax Tagged Openings %d\n", dev->maxtags); | 183 | seq_printf(m, "\t\tMax Tagged Openings %d\n", dev->maxtags); |
231 | copy_info(info, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); | 184 | seq_printf(m, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); |
232 | } | 185 | } |
233 | 186 | ||
234 | static int | 187 | int |
235 | ahc_proc_write_seeprom(struct ahc_softc *ahc, char *buffer, int length) | 188 | ahc_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length) |
236 | { | 189 | { |
190 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; | ||
237 | struct seeprom_descriptor sd; | 191 | struct seeprom_descriptor sd; |
238 | int have_seeprom; | 192 | int have_seeprom; |
239 | u_long s; | 193 | u_long s; |
@@ -332,53 +286,36 @@ done: | |||
332 | * Return information to handle /proc support for the driver. | 286 | * Return information to handle /proc support for the driver. |
333 | */ | 287 | */ |
334 | int | 288 | int |
335 | ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 289 | ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost) |
336 | off_t offset, int length, int inout) | ||
337 | { | 290 | { |
338 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; | 291 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; |
339 | struct info_str info; | ||
340 | char ahc_info[256]; | 292 | char ahc_info[256]; |
341 | u_int max_targ; | 293 | u_int max_targ; |
342 | u_int i; | 294 | u_int i; |
343 | int retval; | ||
344 | 295 | ||
345 | /* Has data been written to the file? */ | 296 | seq_printf(m, "Adaptec AIC7xxx driver version: %s\n", |
346 | if (inout == TRUE) { | ||
347 | retval = ahc_proc_write_seeprom(ahc, buffer, length); | ||
348 | goto done; | ||
349 | } | ||
350 | |||
351 | if (start) | ||
352 | *start = buffer; | ||
353 | |||
354 | info.buffer = buffer; | ||
355 | info.length = length; | ||
356 | info.offset = offset; | ||
357 | info.pos = 0; | ||
358 | |||
359 | copy_info(&info, "Adaptec AIC7xxx driver version: %s\n", | ||
360 | AIC7XXX_DRIVER_VERSION); | 297 | AIC7XXX_DRIVER_VERSION); |
361 | copy_info(&info, "%s\n", ahc->description); | 298 | seq_printf(m, "%s\n", ahc->description); |
362 | ahc_controller_info(ahc, ahc_info); | 299 | ahc_controller_info(ahc, ahc_info); |
363 | copy_info(&info, "%s\n", ahc_info); | 300 | seq_printf(m, "%s\n", ahc_info); |
364 | copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", | 301 | seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n", |
365 | ahc->scb_data->numscbs, AHC_NSEG); | 302 | ahc->scb_data->numscbs, AHC_NSEG); |
366 | 303 | ||
367 | 304 | ||
368 | if (ahc->seep_config == NULL) | 305 | if (ahc->seep_config == NULL) |
369 | copy_info(&info, "No Serial EEPROM\n"); | 306 | seq_printf(m, "No Serial EEPROM\n"); |
370 | else { | 307 | else { |
371 | copy_info(&info, "Serial EEPROM:\n"); | 308 | seq_printf(m, "Serial EEPROM:\n"); |
372 | for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { | 309 | for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { |
373 | if (((i % 8) == 0) && (i != 0)) { | 310 | if (((i % 8) == 0) && (i != 0)) { |
374 | copy_info(&info, "\n"); | 311 | seq_printf(m, "\n"); |
375 | } | 312 | } |
376 | copy_info(&info, "0x%.4x ", | 313 | seq_printf(m, "0x%.4x ", |
377 | ((uint16_t*)ahc->seep_config)[i]); | 314 | ((uint16_t*)ahc->seep_config)[i]); |
378 | } | 315 | } |
379 | copy_info(&info, "\n"); | 316 | seq_printf(m, "\n"); |
380 | } | 317 | } |
381 | copy_info(&info, "\n"); | 318 | seq_printf(m, "\n"); |
382 | 319 | ||
383 | max_targ = 16; | 320 | max_targ = 16; |
384 | if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) | 321 | if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) |
@@ -398,10 +335,8 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
398 | target_id = i % 8; | 335 | target_id = i % 8; |
399 | } | 336 | } |
400 | 337 | ||
401 | ahc_dump_target_state(ahc, &info, our_id, | 338 | ahc_dump_target_state(ahc, m, our_id, |
402 | channel, target_id, i); | 339 | channel, target_id, i); |
403 | } | 340 | } |
404 | retval = info.pos > info.offset ? info.pos - info.offset : 0; | 341 | return 0; |
405 | done: | ||
406 | return (retval); | ||
407 | } | 342 | } |
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 5b212f0df898..33ec9c643400 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -11108,7 +11108,7 @@ MODULE_VERSION(AIC7XXX_H_VERSION); | |||
11108 | 11108 | ||
11109 | 11109 | ||
11110 | static struct scsi_host_template driver_template = { | 11110 | static struct scsi_host_template driver_template = { |
11111 | .proc_info = aic7xxx_proc_info, | 11111 | .show_info = aic7xxx_show_info, |
11112 | .detect = aic7xxx_detect, | 11112 | .detect = aic7xxx_detect, |
11113 | .release = aic7xxx_release, | 11113 | .release = aic7xxx_release, |
11114 | .info = aic7xxx_info, | 11114 | .info = aic7xxx_info, |
diff --git a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c index b07e4f04fd00..976f45ccf2cf 100644 --- a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c | |||
@@ -30,62 +30,23 @@ | |||
30 | *-M*************************************************************************/ | 30 | *-M*************************************************************************/ |
31 | 31 | ||
32 | 32 | ||
33 | #define BLS (&aic7xxx_buffer[size]) | ||
34 | #define HDRB \ | 33 | #define HDRB \ |
35 | " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+" | 34 | " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+" |
36 | 35 | ||
37 | #ifdef PROC_DEBUG | ||
38 | extern int vsprintf(char *, const char *, va_list); | ||
39 | |||
40 | static void | ||
41 | proc_debug(const char *fmt, ...) | ||
42 | { | ||
43 | va_list ap; | ||
44 | char buf[256]; | ||
45 | |||
46 | va_start(ap, fmt); | ||
47 | vsprintf(buf, fmt, ap); | ||
48 | printk(buf); | ||
49 | va_end(ap); | ||
50 | } | ||
51 | #else /* PROC_DEBUG */ | ||
52 | # define proc_debug(fmt, args...) | ||
53 | #endif /* PROC_DEBUG */ | ||
54 | |||
55 | static int aic7xxx_buffer_size = 0; | ||
56 | static char *aic7xxx_buffer = NULL; | ||
57 | |||
58 | 36 | ||
59 | /*+F************************************************************************* | 37 | /*+F************************************************************************* |
60 | * Function: | 38 | * Function: |
61 | * aic7xxx_set_info | 39 | * aic7xxx_show_info |
62 | * | ||
63 | * Description: | ||
64 | * Set parameters for the driver from the /proc filesystem. | ||
65 | *-F*************************************************************************/ | ||
66 | static int | ||
67 | aic7xxx_set_info(char *buffer, int length, struct Scsi_Host *HBAptr) | ||
68 | { | ||
69 | proc_debug("aic7xxx_set_info(): %s\n", buffer); | ||
70 | return (-ENOSYS); /* Currently this is a no-op */ | ||
71 | } | ||
72 | |||
73 | |||
74 | /*+F************************************************************************* | ||
75 | * Function: | ||
76 | * aic7xxx_proc_info | ||
77 | * | 40 | * |
78 | * Description: | 41 | * Description: |
79 | * Return information to handle /proc support for the driver. | 42 | * Return information to handle /proc support for the driver. |
80 | *-F*************************************************************************/ | 43 | *-F*************************************************************************/ |
81 | int | 44 | int |
82 | aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t offset, int length, | 45 | aic7xxx_show_info(struct seq_file *m, struct Scsi_Host *HBAptr) |
83 | int inout) | ||
84 | { | 46 | { |
85 | struct aic7xxx_host *p; | 47 | struct aic7xxx_host *p; |
86 | struct aic_dev_data *aic_dev; | 48 | struct aic_dev_data *aic_dev; |
87 | struct scsi_device *sdptr; | 49 | struct scsi_device *sdptr; |
88 | int size = 0; | ||
89 | unsigned char i; | 50 | unsigned char i; |
90 | unsigned char tindex; | 51 | unsigned char tindex; |
91 | 52 | ||
@@ -94,66 +55,21 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t | |||
94 | 55 | ||
95 | if (!p) | 56 | if (!p) |
96 | { | 57 | { |
97 | size += sprintf(buffer, "Can't find adapter for host number %d\n", HBAptr->host_no); | 58 | seq_printf(m, "Can't find adapter for host number %d\n", HBAptr->host_no); |
98 | if (size > length) | 59 | return 0; |
99 | { | ||
100 | return (size); | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | return (length); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | if (inout == TRUE) /* Has data been written to the file? */ | ||
109 | { | ||
110 | return (aic7xxx_set_info(buffer, length, HBAptr)); | ||
111 | } | 60 | } |
112 | 61 | ||
113 | p = (struct aic7xxx_host *) HBAptr->hostdata; | 62 | p = (struct aic7xxx_host *) HBAptr->hostdata; |
114 | 63 | ||
115 | /* | 64 | seq_printf(m, "Adaptec AIC7xxx driver version: "); |
116 | * It takes roughly 1K of space to hold all relevant card info, not | 65 | seq_printf(m, "%s/", AIC7XXX_C_VERSION); |
117 | * counting any proc stats, so we start out with a 1.5k buffer size and | 66 | seq_printf(m, "%s", AIC7XXX_H_VERSION); |
118 | * if proc_stats is defined, then we sweep the stats structure to see | 67 | seq_printf(m, "\n"); |
119 | * how many drives we will be printing out for and add 384 bytes per | 68 | seq_printf(m, "Adapter Configuration:\n"); |
120 | * device with active stats. | 69 | seq_printf(m, " SCSI Adapter: %s\n", |
121 | * | ||
122 | * Hmmmm...that 1.5k seems to keep growing as items get added so they | ||
123 | * can be easily viewed for debugging purposes. So, we bumped that | ||
124 | * 1.5k to 4k so we can quit having to bump it all the time. | ||
125 | */ | ||
126 | |||
127 | size = 4096; | ||
128 | list_for_each_entry(aic_dev, &p->aic_devs, list) | ||
129 | size += 512; | ||
130 | if (aic7xxx_buffer_size != size) | ||
131 | { | ||
132 | if (aic7xxx_buffer != NULL) | ||
133 | { | ||
134 | kfree(aic7xxx_buffer); | ||
135 | aic7xxx_buffer_size = 0; | ||
136 | } | ||
137 | aic7xxx_buffer = kmalloc(size, GFP_KERNEL); | ||
138 | } | ||
139 | if (aic7xxx_buffer == NULL) | ||
140 | { | ||
141 | size = sprintf(buffer, "AIC7xxx - kmalloc error at line %d\n", | ||
142 | __LINE__); | ||
143 | return size; | ||
144 | } | ||
145 | aic7xxx_buffer_size = size; | ||
146 | |||
147 | size = 0; | ||
148 | size += sprintf(BLS, "Adaptec AIC7xxx driver version: "); | ||
149 | size += sprintf(BLS, "%s/", AIC7XXX_C_VERSION); | ||
150 | size += sprintf(BLS, "%s", AIC7XXX_H_VERSION); | ||
151 | size += sprintf(BLS, "\n"); | ||
152 | size += sprintf(BLS, "Adapter Configuration:\n"); | ||
153 | size += sprintf(BLS, " SCSI Adapter: %s\n", | ||
154 | board_names[p->board_name_index]); | 70 | board_names[p->board_name_index]); |
155 | if (p->flags & AHC_TWIN) | 71 | if (p->flags & AHC_TWIN) |
156 | size += sprintf(BLS, " Twin Channel Controller "); | 72 | seq_printf(m, " Twin Channel Controller "); |
157 | else | 73 | else |
158 | { | 74 | { |
159 | char *channel = ""; | 75 | char *channel = ""; |
@@ -184,86 +100,86 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t | |||
184 | ultra = "Ultra-2 LVD/SE "; | 100 | ultra = "Ultra-2 LVD/SE "; |
185 | else if (p->features & AHC_ULTRA) | 101 | else if (p->features & AHC_ULTRA) |
186 | ultra = "Ultra "; | 102 | ultra = "Ultra "; |
187 | size += sprintf(BLS, " %s%sController%s ", | 103 | seq_printf(m, " %s%sController%s ", |
188 | ultra, wide, channel); | 104 | ultra, wide, channel); |
189 | } | 105 | } |
190 | switch(p->chip & ~AHC_CHIPID_MASK) | 106 | switch(p->chip & ~AHC_CHIPID_MASK) |
191 | { | 107 | { |
192 | case AHC_VL: | 108 | case AHC_VL: |
193 | size += sprintf(BLS, "at VLB slot %d\n", p->pci_device_fn); | 109 | seq_printf(m, "at VLB slot %d\n", p->pci_device_fn); |
194 | break; | 110 | break; |
195 | case AHC_EISA: | 111 | case AHC_EISA: |
196 | size += sprintf(BLS, "at EISA slot %d\n", p->pci_device_fn); | 112 | seq_printf(m, "at EISA slot %d\n", p->pci_device_fn); |
197 | break; | 113 | break; |
198 | default: | 114 | default: |
199 | size += sprintf(BLS, "at PCI %d/%d/%d\n", p->pci_bus, | 115 | seq_printf(m, "at PCI %d/%d/%d\n", p->pci_bus, |
200 | PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn)); | 116 | PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn)); |
201 | break; | 117 | break; |
202 | } | 118 | } |
203 | if( !(p->maddr) ) | 119 | if( !(p->maddr) ) |
204 | { | 120 | { |
205 | size += sprintf(BLS, " Programmed I/O Base: %lx\n", p->base); | 121 | seq_printf(m, " Programmed I/O Base: %lx\n", p->base); |
206 | } | 122 | } |
207 | else | 123 | else |
208 | { | 124 | { |
209 | size += sprintf(BLS, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase); | 125 | seq_printf(m, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase); |
210 | } | 126 | } |
211 | if( (p->chip & (AHC_VL | AHC_EISA)) ) | 127 | if( (p->chip & (AHC_VL | AHC_EISA)) ) |
212 | { | 128 | { |
213 | size += sprintf(BLS, " BIOS Memory Address: 0x%08x\n", p->bios_address); | 129 | seq_printf(m, " BIOS Memory Address: 0x%08x\n", p->bios_address); |
214 | } | 130 | } |
215 | size += sprintf(BLS, " Adapter SEEPROM Config: %s\n", | 131 | seq_printf(m, " Adapter SEEPROM Config: %s\n", |
216 | (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." : | 132 | (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." : |
217 | ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." : | 133 | ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." : |
218 | "SEEPROM not found, using leftover BIOS values.") ); | 134 | "SEEPROM not found, using leftover BIOS values.") ); |
219 | size += sprintf(BLS, " Adaptec SCSI BIOS: %s\n", | 135 | seq_printf(m, " Adaptec SCSI BIOS: %s\n", |
220 | (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled"); | 136 | (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled"); |
221 | size += sprintf(BLS, " IRQ: %d\n", HBAptr->irq); | 137 | seq_printf(m, " IRQ: %d\n", HBAptr->irq); |
222 | size += sprintf(BLS, " SCBs: Active %d, Max Active %d,\n", | 138 | seq_printf(m, " SCBs: Active %d, Max Active %d,\n", |
223 | p->activescbs, p->max_activescbs); | 139 | p->activescbs, p->max_activescbs); |
224 | size += sprintf(BLS, " Allocated %d, HW %d, " | 140 | seq_printf(m, " Allocated %d, HW %d, " |
225 | "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs, | 141 | "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs, |
226 | p->scb_data->maxscbs); | 142 | p->scb_data->maxscbs); |
227 | if (p->flags & AHC_EXTERNAL_SRAM) | 143 | if (p->flags & AHC_EXTERNAL_SRAM) |
228 | size += sprintf(BLS, " Using External SCB SRAM\n"); | 144 | seq_printf(m, " Using External SCB SRAM\n"); |
229 | size += sprintf(BLS, " Interrupts: %ld", p->isr_count); | 145 | seq_printf(m, " Interrupts: %ld", p->isr_count); |
230 | if (p->chip & AHC_EISA) | 146 | if (p->chip & AHC_EISA) |
231 | { | 147 | { |
232 | size += sprintf(BLS, " %s\n", | 148 | seq_printf(m, " %s\n", |
233 | (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)"); | 149 | (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)"); |
234 | } | 150 | } |
235 | else | 151 | else |
236 | { | 152 | { |
237 | size += sprintf(BLS, "\n"); | 153 | seq_printf(m, "\n"); |
238 | } | 154 | } |
239 | size += sprintf(BLS, " BIOS Control Word: 0x%04x\n", | 155 | seq_printf(m, " BIOS Control Word: 0x%04x\n", |
240 | p->bios_control); | 156 | p->bios_control); |
241 | size += sprintf(BLS, " Adapter Control Word: 0x%04x\n", | 157 | seq_printf(m, " Adapter Control Word: 0x%04x\n", |
242 | p->adapter_control); | 158 | p->adapter_control); |
243 | size += sprintf(BLS, " Extended Translation: %sabled\n", | 159 | seq_printf(m, " Extended Translation: %sabled\n", |
244 | (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis"); | 160 | (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis"); |
245 | size += sprintf(BLS, "Disconnect Enable Flags: 0x%04x\n", p->discenable); | 161 | seq_printf(m, "Disconnect Enable Flags: 0x%04x\n", p->discenable); |
246 | if (p->features & (AHC_ULTRA | AHC_ULTRA2)) | 162 | if (p->features & (AHC_ULTRA | AHC_ULTRA2)) |
247 | { | 163 | { |
248 | size += sprintf(BLS, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); | 164 | seq_printf(m, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); |
249 | } | 165 | } |
250 | size += sprintf(BLS, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth); | 166 | seq_printf(m, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth); |
251 | size += sprintf(BLS, " Tagged Queue By Device array for aic7xxx host " | 167 | seq_printf(m, " Tagged Queue By Device array for aic7xxx host " |
252 | "instance %d:\n", p->instance); | 168 | "instance %d:\n", p->instance); |
253 | size += sprintf(BLS, " {"); | 169 | seq_printf(m, " {"); |
254 | for(i=0; i < (MAX_TARGETS - 1); i++) | 170 | for(i=0; i < (MAX_TARGETS - 1); i++) |
255 | size += sprintf(BLS, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); | 171 | seq_printf(m, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); |
256 | size += sprintf(BLS, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); | 172 | seq_printf(m, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); |
257 | 173 | ||
258 | size += sprintf(BLS, "\n"); | 174 | seq_printf(m, "\n"); |
259 | size += sprintf(BLS, "Statistics:\n\n"); | 175 | seq_printf(m, "Statistics:\n\n"); |
260 | list_for_each_entry(aic_dev, &p->aic_devs, list) | 176 | list_for_each_entry(aic_dev, &p->aic_devs, list) |
261 | { | 177 | { |
262 | sdptr = aic_dev->SDptr; | 178 | sdptr = aic_dev->SDptr; |
263 | tindex = sdptr->channel << 3 | sdptr->id; | 179 | tindex = sdptr->channel << 3 | sdptr->id; |
264 | size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n", | 180 | seq_printf(m, "(scsi%d:%d:%d:%d)\n", |
265 | p->host_no, sdptr->channel, sdptr->id, sdptr->lun); | 181 | p->host_no, sdptr->channel, sdptr->id, sdptr->lun); |
266 | size += sprintf(BLS, " Device using %s/%s", | 182 | seq_printf(m, " Device using %s/%s", |
267 | (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ? | 183 | (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ? |
268 | "Wide" : "Narrow", | 184 | "Wide" : "Narrow", |
269 | (aic_dev->cur.offset != 0) ? | 185 | (aic_dev->cur.offset != 0) ? |
@@ -279,78 +195,59 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t | |||
279 | sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options); | 195 | sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options); |
280 | if (sync_rate != NULL) | 196 | if (sync_rate != NULL) |
281 | { | 197 | { |
282 | size += sprintf(BLS, "%s MByte/sec, offset %d\n", | 198 | seq_printf(m, "%s MByte/sec, offset %d\n", |
283 | sync_rate->rate[rate], | 199 | sync_rate->rate[rate], |
284 | aic_dev->cur.offset ); | 200 | aic_dev->cur.offset ); |
285 | } | 201 | } |
286 | else | 202 | else |
287 | { | 203 | { |
288 | size += sprintf(BLS, "3.3 MByte/sec, offset %d\n", | 204 | seq_printf(m, "3.3 MByte/sec, offset %d\n", |
289 | aic_dev->cur.offset ); | 205 | aic_dev->cur.offset ); |
290 | } | 206 | } |
291 | } | 207 | } |
292 | size += sprintf(BLS, " Transinfo settings: "); | 208 | seq_printf(m, " Transinfo settings: "); |
293 | size += sprintf(BLS, "current(%d/%d/%d/%d), ", | 209 | seq_printf(m, "current(%d/%d/%d/%d), ", |
294 | aic_dev->cur.period, | 210 | aic_dev->cur.period, |
295 | aic_dev->cur.offset, | 211 | aic_dev->cur.offset, |
296 | aic_dev->cur.width, | 212 | aic_dev->cur.width, |
297 | aic_dev->cur.options); | 213 | aic_dev->cur.options); |
298 | size += sprintf(BLS, "goal(%d/%d/%d/%d), ", | 214 | seq_printf(m, "goal(%d/%d/%d/%d), ", |
299 | aic_dev->goal.period, | 215 | aic_dev->goal.period, |
300 | aic_dev->goal.offset, | 216 | aic_dev->goal.offset, |
301 | aic_dev->goal.width, | 217 | aic_dev->goal.width, |
302 | aic_dev->goal.options); | 218 | aic_dev->goal.options); |
303 | size += sprintf(BLS, "user(%d/%d/%d/%d)\n", | 219 | seq_printf(m, "user(%d/%d/%d/%d)\n", |
304 | p->user[tindex].period, | 220 | p->user[tindex].period, |
305 | p->user[tindex].offset, | 221 | p->user[tindex].offset, |
306 | p->user[tindex].width, | 222 | p->user[tindex].width, |
307 | p->user[tindex].options); | 223 | p->user[tindex].options); |
308 | if(sdptr->simple_tags) | 224 | if(sdptr->simple_tags) |
309 | { | 225 | { |
310 | size += sprintf(BLS, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth); | 226 | seq_printf(m, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth); |
311 | } | 227 | } |
312 | if(aic_dev->barrier_total) | 228 | if(aic_dev->barrier_total) |
313 | size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n", | 229 | seq_printf(m, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n", |
314 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total, | 230 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total, |
315 | aic_dev->barrier_total, aic_dev->ordered_total); | 231 | aic_dev->barrier_total, aic_dev->ordered_total); |
316 | else | 232 | else |
317 | size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld reads/writes)\n", | 233 | seq_printf(m, " Total transfers %ld:\n (%ld/%ld reads/writes)\n", |
318 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total); | 234 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total); |
319 | size += sprintf(BLS, "%s\n", HDRB); | 235 | seq_printf(m, "%s\n", HDRB); |
320 | size += sprintf(BLS, " Reads:"); | 236 | seq_printf(m, " Reads:"); |
321 | for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++) | 237 | for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++) |
322 | { | 238 | { |
323 | size += sprintf(BLS, " %10ld", aic_dev->r_bins[i]); | 239 | seq_printf(m, " %10ld", aic_dev->r_bins[i]); |
324 | } | 240 | } |
325 | size += sprintf(BLS, "\n"); | 241 | seq_printf(m, "\n"); |
326 | size += sprintf(BLS, " Writes:"); | 242 | seq_printf(m, " Writes:"); |
327 | for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++) | 243 | for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++) |
328 | { | 244 | { |
329 | size += sprintf(BLS, " %10ld", aic_dev->w_bins[i]); | 245 | seq_printf(m, " %10ld", aic_dev->w_bins[i]); |
330 | } | 246 | } |
331 | size += sprintf(BLS, "\n"); | 247 | seq_printf(m, "\n"); |
332 | size += sprintf(BLS, "\n\n"); | 248 | seq_printf(m, "\n\n"); |
333 | } | ||
334 | if (size >= aic7xxx_buffer_size) | ||
335 | { | ||
336 | printk(KERN_WARNING "aic7xxx: Overflow in aic7xxx_proc.c\n"); | ||
337 | } | ||
338 | |||
339 | if (offset > size - 1) | ||
340 | { | ||
341 | kfree(aic7xxx_buffer); | ||
342 | aic7xxx_buffer = NULL; | ||
343 | aic7xxx_buffer_size = length = 0; | ||
344 | *start = NULL; | ||
345 | } | 249 | } |
346 | else | 250 | return 0; |
347 | { | ||
348 | *start = buffer; | ||
349 | length = min_t(int, length, size - offset); | ||
350 | memcpy(buffer, &aic7xxx_buffer[offset], length); | ||
351 | } | ||
352 | |||
353 | return (length); | ||
354 | } | 251 | } |
355 | 252 | ||
356 | /* | 253 | /* |
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index 3e1172adb37b..09ba1869d366 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c | |||
@@ -2836,20 +2836,15 @@ char *acornscsi_info(struct Scsi_Host *host) | |||
2836 | return string; | 2836 | return string; |
2837 | } | 2837 | } |
2838 | 2838 | ||
2839 | int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, off_t offset, | 2839 | static int acornscsi_show_info(struct seq_file *m, struct Scsi_Host *instance) |
2840 | int length, int inout) | ||
2841 | { | 2840 | { |
2842 | int pos, begin = 0, devidx; | 2841 | int devidx; |
2843 | struct scsi_device *scd; | 2842 | struct scsi_device *scd; |
2844 | AS_Host *host; | 2843 | AS_Host *host; |
2845 | char *p = buffer; | ||
2846 | |||
2847 | if (inout == 1) | ||
2848 | return -EINVAL; | ||
2849 | 2844 | ||
2850 | host = (AS_Host *)instance->hostdata; | 2845 | host = (AS_Host *)instance->hostdata; |
2851 | 2846 | ||
2852 | p += sprintf(p, "AcornSCSI driver v%d.%d.%d" | 2847 | seq_printf(m, "AcornSCSI driver v%d.%d.%d" |
2853 | #ifdef CONFIG_SCSI_ACORNSCSI_SYNC | 2848 | #ifdef CONFIG_SCSI_ACORNSCSI_SYNC |
2854 | " SYNC" | 2849 | " SYNC" |
2855 | #endif | 2850 | #endif |
@@ -2864,14 +2859,14 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2864 | #endif | 2859 | #endif |
2865 | "\n\n", VER_MAJOR, VER_MINOR, VER_PATCH); | 2860 | "\n\n", VER_MAJOR, VER_MINOR, VER_PATCH); |
2866 | 2861 | ||
2867 | p += sprintf(p, "SBIC: WD33C93A Address: %p IRQ : %d\n", | 2862 | seq_printf(m, "SBIC: WD33C93A Address: %p IRQ : %d\n", |
2868 | host->base + SBIC_REGIDX, host->scsi.irq); | 2863 | host->base + SBIC_REGIDX, host->scsi.irq); |
2869 | #ifdef USE_DMAC | 2864 | #ifdef USE_DMAC |
2870 | p += sprintf(p, "DMAC: uPC71071 Address: %p IRQ : %d\n\n", | 2865 | seq_printf(m, "DMAC: uPC71071 Address: %p IRQ : %d\n\n", |
2871 | host->base + DMAC_OFFSET, host->scsi.irq); | 2866 | host->base + DMAC_OFFSET, host->scsi.irq); |
2872 | #endif | 2867 | #endif |
2873 | 2868 | ||
2874 | p += sprintf(p, "Statistics:\n" | 2869 | seq_printf(m, "Statistics:\n" |
2875 | "Queued commands: %-10u Issued commands: %-10u\n" | 2870 | "Queued commands: %-10u Issued commands: %-10u\n" |
2876 | "Done commands : %-10u Reads : %-10u\n" | 2871 | "Done commands : %-10u Reads : %-10u\n" |
2877 | "Writes : %-10u Others : %-10u\n" | 2872 | "Writes : %-10u Others : %-10u\n" |
@@ -2886,7 +2881,7 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2886 | for (devidx = 0; devidx < 9; devidx ++) { | 2881 | for (devidx = 0; devidx < 9; devidx ++) { |
2887 | unsigned int statptr, prev; | 2882 | unsigned int statptr, prev; |
2888 | 2883 | ||
2889 | p += sprintf(p, "\n%c:", devidx == 8 ? 'H' : ('0' + devidx)); | 2884 | seq_printf(m, "\n%c:", devidx == 8 ? 'H' : ('0' + devidx)); |
2890 | statptr = host->status_ptr[devidx] - 10; | 2885 | statptr = host->status_ptr[devidx] - 10; |
2891 | 2886 | ||
2892 | if ((signed int)statptr < 0) | 2887 | if ((signed int)statptr < 0) |
@@ -2896,7 +2891,7 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2896 | 2891 | ||
2897 | for (; statptr != host->status_ptr[devidx]; statptr = (statptr + 1) & (STATUS_BUFFER_SIZE - 1)) { | 2892 | for (; statptr != host->status_ptr[devidx]; statptr = (statptr + 1) & (STATUS_BUFFER_SIZE - 1)) { |
2898 | if (host->status[devidx][statptr].when) { | 2893 | if (host->status[devidx][statptr].when) { |
2899 | p += sprintf(p, "%c%02X:%02X+%2ld", | 2894 | seq_printf(m, "%c%02X:%02X+%2ld", |
2900 | host->status[devidx][statptr].irq ? '-' : ' ', | 2895 | host->status[devidx][statptr].irq ? '-' : ' ', |
2901 | host->status[devidx][statptr].ph, | 2896 | host->status[devidx][statptr].ph, |
2902 | host->status[devidx][statptr].ssr, | 2897 | host->status[devidx][statptr].ssr, |
@@ -2907,51 +2902,32 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2907 | } | 2902 | } |
2908 | } | 2903 | } |
2909 | 2904 | ||
2910 | p += sprintf(p, "\nAttached devices:\n"); | 2905 | seq_printf(m, "\nAttached devices:\n"); |
2911 | 2906 | ||
2912 | shost_for_each_device(scd, instance) { | 2907 | shost_for_each_device(scd, instance) { |
2913 | p += sprintf(p, "Device/Lun TaggedQ Sync\n"); | 2908 | seq_printf(m, "Device/Lun TaggedQ Sync\n"); |
2914 | p += sprintf(p, " %d/%d ", scd->id, scd->lun); | 2909 | seq_printf(m, " %d/%d ", scd->id, scd->lun); |
2915 | if (scd->tagged_supported) | 2910 | if (scd->tagged_supported) |
2916 | p += sprintf(p, "%3sabled(%3d) ", | 2911 | seq_printf(m, "%3sabled(%3d) ", |
2917 | scd->simple_tags ? "en" : "dis", | 2912 | scd->simple_tags ? "en" : "dis", |
2918 | scd->current_tag); | 2913 | scd->current_tag); |
2919 | else | 2914 | else |
2920 | p += sprintf(p, "unsupported "); | 2915 | seq_printf(m, "unsupported "); |
2921 | 2916 | ||
2922 | if (host->device[scd->id].sync_xfer & 15) | 2917 | if (host->device[scd->id].sync_xfer & 15) |
2923 | p += sprintf(p, "offset %d, %d ns\n", | 2918 | seq_printf(m, "offset %d, %d ns\n", |
2924 | host->device[scd->id].sync_xfer & 15, | 2919 | host->device[scd->id].sync_xfer & 15, |
2925 | acornscsi_getperiod(host->device[scd->id].sync_xfer)); | 2920 | acornscsi_getperiod(host->device[scd->id].sync_xfer)); |
2926 | else | 2921 | else |
2927 | p += sprintf(p, "async\n"); | 2922 | seq_printf(m, "async\n"); |
2928 | 2923 | ||
2929 | pos = p - buffer; | ||
2930 | if (pos + begin < offset) { | ||
2931 | begin += pos; | ||
2932 | p = buffer; | ||
2933 | } | ||
2934 | pos = p - buffer; | ||
2935 | if (pos + begin > offset + length) { | ||
2936 | scsi_device_put(scd); | ||
2937 | break; | ||
2938 | } | ||
2939 | } | 2924 | } |
2940 | 2925 | return 0; | |
2941 | pos = p - buffer; | ||
2942 | |||
2943 | *start = buffer + (offset - begin); | ||
2944 | pos -= offset - begin; | ||
2945 | |||
2946 | if (pos > length) | ||
2947 | pos = length; | ||
2948 | |||
2949 | return pos; | ||
2950 | } | 2926 | } |
2951 | 2927 | ||
2952 | static struct scsi_host_template acornscsi_template = { | 2928 | static struct scsi_host_template acornscsi_template = { |
2953 | .module = THIS_MODULE, | 2929 | .module = THIS_MODULE, |
2954 | .proc_info = acornscsi_proc_info, | 2930 | .show_info = acornscsi_show_info, |
2955 | .name = "AcornSCSI", | 2931 | .name = "AcornSCSI", |
2956 | .info = acornscsi_info, | 2932 | .info = acornscsi_info, |
2957 | .queuecommand = acornscsi_queuecmd, | 2933 | .queuecommand = acornscsi_queuecmd, |
diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c index 9274510294ac..32d23212de48 100644 --- a/drivers/scsi/arm/arxescsi.c +++ b/drivers/scsi/arm/arxescsi.c | |||
@@ -220,47 +220,21 @@ static const char *arxescsi_info(struct Scsi_Host *host) | |||
220 | return string; | 220 | return string; |
221 | } | 221 | } |
222 | 222 | ||
223 | /* | ||
224 | * Function: int arxescsi_proc_info(char *buffer, char **start, off_t offset, | ||
225 | * int length, int host_no, int inout) | ||
226 | * Purpose : Return information about the driver to a user process accessing | ||
227 | * the /proc filesystem. | ||
228 | * Params : buffer - a buffer to write information to | ||
229 | * start - a pointer into this buffer set by this routine to the start | ||
230 | * of the required information. | ||
231 | * offset - offset into information that we have read up to. | ||
232 | * length - length of buffer | ||
233 | * host_no - host number to return information for | ||
234 | * inout - 0 for reading, 1 for writing. | ||
235 | * Returns : length of data written to buffer. | ||
236 | */ | ||
237 | static int | 223 | static int |
238 | arxescsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, | 224 | arxescsi_show_info(struct seq_file *m, struct Scsi_Host *host) |
239 | int inout) | ||
240 | { | 225 | { |
241 | struct arxescsi_info *info; | 226 | struct arxescsi_info *info; |
242 | char *p = buffer; | ||
243 | int pos; | ||
244 | |||
245 | info = (struct arxescsi_info *)host->hostdata; | 227 | info = (struct arxescsi_info *)host->hostdata; |
246 | if (inout == 1) | ||
247 | return -EINVAL; | ||
248 | |||
249 | p += sprintf(p, "ARXE 16-bit SCSI driver v%s\n", VERSION); | ||
250 | p += fas216_print_host(&info->info, p); | ||
251 | p += fas216_print_stats(&info->info, p); | ||
252 | p += fas216_print_devices(&info->info, p); | ||
253 | |||
254 | *start = buffer + offset; | ||
255 | pos = p - buffer - offset; | ||
256 | if (pos > length) | ||
257 | pos = length; | ||
258 | 228 | ||
259 | return pos; | 229 | seq_printf(m, "ARXE 16-bit SCSI driver v%s\n", VERSION); |
230 | fas216_print_host(&info->info, m); | ||
231 | fas216_print_stats(&info->info, m); | ||
232 | fas216_print_devices(&info->info, m); | ||
233 | return 0; | ||
260 | } | 234 | } |
261 | 235 | ||
262 | static struct scsi_host_template arxescsi_template = { | 236 | static struct scsi_host_template arxescsi_template = { |
263 | .proc_info = arxescsi_proc_info, | 237 | .show_info = arxescsi_show_info, |
264 | .name = "ARXE SCSI card", | 238 | .name = "ARXE SCSI card", |
265 | .info = arxescsi_info, | 239 | .info = arxescsi_info, |
266 | .queuecommand = fas216_noqueue_command, | 240 | .queuecommand = fas216_noqueue_command, |
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c index c93938b246d5..b679778376c5 100644 --- a/drivers/scsi/arm/cumana_1.c +++ b/drivers/scsi/arm/cumana_1.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value) | 30 | #define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value) |
31 | #define NCR5380_intr cumanascsi_intr | 31 | #define NCR5380_intr cumanascsi_intr |
32 | #define NCR5380_queue_command cumanascsi_queue_command | 32 | #define NCR5380_queue_command cumanascsi_queue_command |
33 | #define NCR5380_proc_info cumanascsi_proc_info | ||
34 | 33 | ||
35 | #define NCR5380_implementation_fields \ | 34 | #define NCR5380_implementation_fields \ |
36 | unsigned ctrl; \ | 35 | unsigned ctrl; \ |
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c index e3bae93c3c22..58915f29055b 100644 --- a/drivers/scsi/arm/cumana_2.c +++ b/drivers/scsi/arm/cumana_2.c | |||
@@ -337,50 +337,25 @@ cumanascsi_2_set_proc_info(struct Scsi_Host *host, char *buffer, int length) | |||
337 | return ret; | 337 | return ret; |
338 | } | 338 | } |
339 | 339 | ||
340 | /* Prototype: int cumanascsi_2_proc_info(char *buffer, char **start, off_t offset, | 340 | static int cumanascsi_2_show_info(struct seq_file *m, struct Scsi_Host *host) |
341 | * int length, int host_no, int inout) | ||
342 | * Purpose : Return information about the driver to a user process accessing | ||
343 | * the /proc filesystem. | ||
344 | * Params : buffer - a buffer to write information to | ||
345 | * start - a pointer into this buffer set by this routine to the start | ||
346 | * of the required information. | ||
347 | * offset - offset into information that we have read up to. | ||
348 | * length - length of buffer | ||
349 | * host_no - host number to return information for | ||
350 | * inout - 0 for reading, 1 for writing. | ||
351 | * Returns : length of data written to buffer. | ||
352 | */ | ||
353 | int cumanascsi_2_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t offset, | ||
354 | int length, int inout) | ||
355 | { | 341 | { |
356 | struct cumanascsi2_info *info; | 342 | struct cumanascsi2_info *info; |
357 | char *p = buffer; | ||
358 | int pos; | ||
359 | |||
360 | if (inout == 1) | ||
361 | return cumanascsi_2_set_proc_info(host, buffer, length); | ||
362 | |||
363 | info = (struct cumanascsi2_info *)host->hostdata; | 343 | info = (struct cumanascsi2_info *)host->hostdata; |
364 | 344 | ||
365 | p += sprintf(p, "Cumana SCSI II driver v%s\n", VERSION); | 345 | seq_printf(m, "Cumana SCSI II driver v%s\n", VERSION); |
366 | p += fas216_print_host(&info->info, p); | 346 | fas216_print_host(&info->info, m); |
367 | p += sprintf(p, "Term : o%s\n", | 347 | seq_printf(m, "Term : o%s\n", |
368 | info->terms ? "n" : "ff"); | 348 | info->terms ? "n" : "ff"); |
369 | 349 | ||
370 | p += fas216_print_stats(&info->info, p); | 350 | fas216_print_stats(&info->info, m); |
371 | p += fas216_print_devices(&info->info, p); | 351 | fas216_print_devices(&info->info, m); |
372 | 352 | return 0; | |
373 | *start = buffer + offset; | ||
374 | pos = p - buffer - offset; | ||
375 | if (pos > length) | ||
376 | pos = length; | ||
377 | |||
378 | return pos; | ||
379 | } | 353 | } |
380 | 354 | ||
381 | static struct scsi_host_template cumanascsi2_template = { | 355 | static struct scsi_host_template cumanascsi2_template = { |
382 | .module = THIS_MODULE, | 356 | .module = THIS_MODULE, |
383 | .proc_info = cumanascsi_2_proc_info, | 357 | .show_info = cumanascsi_2_show_info, |
358 | .write_info = cumanascsi_2_set_proc_info, | ||
384 | .name = "Cumana SCSI II", | 359 | .name = "Cumana SCSI II", |
385 | .info = cumanascsi_2_info, | 360 | .info = cumanascsi_2_info, |
386 | .queuecommand = fas216_queue_command, | 361 | .queuecommand = fas216_queue_command, |
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index 8e36908415ec..5bf3c0d134b4 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c | |||
@@ -422,45 +422,20 @@ eesoxscsi_set_proc_info(struct Scsi_Host *host, char *buffer, int length) | |||
422 | return ret; | 422 | return ret; |
423 | } | 423 | } |
424 | 424 | ||
425 | /* Prototype: int eesoxscsi_proc_info(char *buffer, char **start, off_t offset, | 425 | static int eesoxscsi_show_info(struct seq_file *m, struct Scsi_Host *host) |
426 | * int length, int host_no, int inout) | ||
427 | * Purpose : Return information about the driver to a user process accessing | ||
428 | * the /proc filesystem. | ||
429 | * Params : buffer - a buffer to write information to | ||
430 | * start - a pointer into this buffer set by this routine to the start | ||
431 | * of the required information. | ||
432 | * offset - offset into information that we have read up to. | ||
433 | * length - length of buffer | ||
434 | * host_no - host number to return information for | ||
435 | * inout - 0 for reading, 1 for writing. | ||
436 | * Returns : length of data written to buffer. | ||
437 | */ | ||
438 | int eesoxscsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | ||
439 | int length, int inout) | ||
440 | { | 426 | { |
441 | struct eesoxscsi_info *info; | 427 | struct eesoxscsi_info *info; |
442 | char *p = buffer; | ||
443 | int pos; | ||
444 | |||
445 | if (inout == 1) | ||
446 | return eesoxscsi_set_proc_info(host, buffer, length); | ||
447 | 428 | ||
448 | info = (struct eesoxscsi_info *)host->hostdata; | 429 | info = (struct eesoxscsi_info *)host->hostdata; |
449 | 430 | ||
450 | p += sprintf(p, "EESOX SCSI driver v%s\n", VERSION); | 431 | seq_printf(m, "EESOX SCSI driver v%s\n", VERSION); |
451 | p += fas216_print_host(&info->info, p); | 432 | fas216_print_host(&info->info, m); |
452 | p += sprintf(p, "Term : o%s\n", | 433 | seq_printf(m, "Term : o%s\n", |
453 | info->control & EESOX_TERM_ENABLE ? "n" : "ff"); | 434 | info->control & EESOX_TERM_ENABLE ? "n" : "ff"); |
454 | 435 | ||
455 | p += fas216_print_stats(&info->info, p); | 436 | fas216_print_stats(&info->info, m); |
456 | p += fas216_print_devices(&info->info, p); | 437 | fas216_print_devices(&info->info, m); |
457 | 438 | return 0; | |
458 | *start = buffer + offset; | ||
459 | pos = p - buffer - offset; | ||
460 | if (pos > length) | ||
461 | pos = length; | ||
462 | |||
463 | return pos; | ||
464 | } | 439 | } |
465 | 440 | ||
466 | static ssize_t eesoxscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) | 441 | static ssize_t eesoxscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -498,7 +473,8 @@ static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR, | |||
498 | 473 | ||
499 | static struct scsi_host_template eesox_template = { | 474 | static struct scsi_host_template eesox_template = { |
500 | .module = THIS_MODULE, | 475 | .module = THIS_MODULE, |
501 | .proc_info = eesoxscsi_proc_info, | 476 | .show_info = eesoxscsi_show_info, |
477 | .write_info = eesoxscsi_set_proc_info, | ||
502 | .name = "EESOX SCSI", | 478 | .name = "EESOX SCSI", |
503 | .info = eesoxscsi_info, | 479 | .info = eesoxscsi_info, |
504 | .queuecommand = fas216_queue_command, | 480 | .queuecommand = fas216_queue_command, |
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 737554c37d9e..b46a6f6c0eb3 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c | |||
@@ -2958,9 +2958,9 @@ void fas216_release(struct Scsi_Host *host) | |||
2958 | queue_free(&info->queues.issue); | 2958 | queue_free(&info->queues.issue); |
2959 | } | 2959 | } |
2960 | 2960 | ||
2961 | int fas216_print_host(FAS216_Info *info, char *buffer) | 2961 | void fas216_print_host(FAS216_Info *info, struct seq_file *m) |
2962 | { | 2962 | { |
2963 | return sprintf(buffer, | 2963 | seq_printf(m, |
2964 | "\n" | 2964 | "\n" |
2965 | "Chip : %s\n" | 2965 | "Chip : %s\n" |
2966 | " Address: 0x%p\n" | 2966 | " Address: 0x%p\n" |
@@ -2970,11 +2970,9 @@ int fas216_print_host(FAS216_Info *info, char *buffer) | |||
2970 | info->scsi.irq, info->scsi.dma); | 2970 | info->scsi.irq, info->scsi.dma); |
2971 | } | 2971 | } |
2972 | 2972 | ||
2973 | int fas216_print_stats(FAS216_Info *info, char *buffer) | 2973 | void fas216_print_stats(FAS216_Info *info, struct seq_file *m) |
2974 | { | 2974 | { |
2975 | char *p = buffer; | 2975 | seq_printf(m, "\n" |
2976 | |||
2977 | p += sprintf(p, "\n" | ||
2978 | "Command Statistics:\n" | 2976 | "Command Statistics:\n" |
2979 | " Queued : %u\n" | 2977 | " Queued : %u\n" |
2980 | " Issued : %u\n" | 2978 | " Issued : %u\n" |
@@ -2991,38 +2989,33 @@ int fas216_print_stats(FAS216_Info *info, char *buffer) | |||
2991 | info->stats.writes, info->stats.miscs, | 2989 | info->stats.writes, info->stats.miscs, |
2992 | info->stats.disconnects, info->stats.aborts, | 2990 | info->stats.disconnects, info->stats.aborts, |
2993 | info->stats.bus_resets, info->stats.host_resets); | 2991 | info->stats.bus_resets, info->stats.host_resets); |
2994 | |||
2995 | return p - buffer; | ||
2996 | } | 2992 | } |
2997 | 2993 | ||
2998 | int fas216_print_devices(FAS216_Info *info, char *buffer) | 2994 | void fas216_print_devices(FAS216_Info *info, struct seq_file *m) |
2999 | { | 2995 | { |
3000 | struct fas216_device *dev; | 2996 | struct fas216_device *dev; |
3001 | struct scsi_device *scd; | 2997 | struct scsi_device *scd; |
3002 | char *p = buffer; | ||
3003 | 2998 | ||
3004 | p += sprintf(p, "Device/Lun TaggedQ Parity Sync\n"); | 2999 | seq_printf(m, "Device/Lun TaggedQ Parity Sync\n"); |
3005 | 3000 | ||
3006 | shost_for_each_device(scd, info->host) { | 3001 | shost_for_each_device(scd, info->host) { |
3007 | dev = &info->device[scd->id]; | 3002 | dev = &info->device[scd->id]; |
3008 | p += sprintf(p, " %d/%d ", scd->id, scd->lun); | 3003 | seq_printf(m, " %d/%d ", scd->id, scd->lun); |
3009 | if (scd->tagged_supported) | 3004 | if (scd->tagged_supported) |
3010 | p += sprintf(p, "%3sabled(%3d) ", | 3005 | seq_printf(m, "%3sabled(%3d) ", |
3011 | scd->simple_tags ? "en" : "dis", | 3006 | scd->simple_tags ? "en" : "dis", |
3012 | scd->current_tag); | 3007 | scd->current_tag); |
3013 | else | 3008 | else |
3014 | p += sprintf(p, "unsupported "); | 3009 | seq_printf(m, "unsupported "); |
3015 | 3010 | ||
3016 | p += sprintf(p, "%3sabled ", dev->parity_enabled ? "en" : "dis"); | 3011 | seq_printf(m, "%3sabled ", dev->parity_enabled ? "en" : "dis"); |
3017 | 3012 | ||
3018 | if (dev->sof) | 3013 | if (dev->sof) |
3019 | p += sprintf(p, "offset %d, %d ns\n", | 3014 | seq_printf(m, "offset %d, %d ns\n", |
3020 | dev->sof, dev->period * 4); | 3015 | dev->sof, dev->period * 4); |
3021 | else | 3016 | else |
3022 | p += sprintf(p, "async\n"); | 3017 | seq_printf(m, "async\n"); |
3023 | } | 3018 | } |
3024 | |||
3025 | return p - buffer; | ||
3026 | } | 3019 | } |
3027 | 3020 | ||
3028 | EXPORT_SYMBOL(fas216_init); | 3021 | EXPORT_SYMBOL(fas216_init); |
diff --git a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h index df2e1b3ddfe2..c57c16ef8193 100644 --- a/drivers/scsi/arm/fas216.h +++ b/drivers/scsi/arm/fas216.h | |||
@@ -358,9 +358,9 @@ extern void fas216_remove (struct Scsi_Host *instance); | |||
358 | */ | 358 | */ |
359 | extern void fas216_release (struct Scsi_Host *instance); | 359 | extern void fas216_release (struct Scsi_Host *instance); |
360 | 360 | ||
361 | extern int fas216_print_host(FAS216_Info *info, char *buffer); | 361 | extern void fas216_print_host(FAS216_Info *info, struct seq_file *m); |
362 | extern int fas216_print_stats(FAS216_Info *info, char *buffer); | 362 | extern void fas216_print_stats(FAS216_Info *info, struct seq_file *m); |
363 | extern int fas216_print_devices(FAS216_Info *info, char *buffer); | 363 | extern void fas216_print_devices(FAS216_Info *info, struct seq_file *m); |
364 | 364 | ||
365 | /* Function: int fas216_eh_abort(struct scsi_cmnd *SCpnt) | 365 | /* Function: int fas216_eh_abort(struct scsi_cmnd *SCpnt) |
366 | * Purpose : abort this command | 366 | * Purpose : abort this command |
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c index 48facdc18002..4266eef8aca1 100644 --- a/drivers/scsi/arm/oak.c +++ b/drivers/scsi/arm/oak.c | |||
@@ -31,7 +31,8 @@ | |||
31 | #define NCR5380_write(reg, value) writeb(value, _base + ((reg) << 2)) | 31 | #define NCR5380_write(reg, value) writeb(value, _base + ((reg) << 2)) |
32 | #define NCR5380_intr oakscsi_intr | 32 | #define NCR5380_intr oakscsi_intr |
33 | #define NCR5380_queue_command oakscsi_queue_command | 33 | #define NCR5380_queue_command oakscsi_queue_command |
34 | #define NCR5380_proc_info oakscsi_proc_info | 34 | #define NCR5380_show_info oakscsi_show_info |
35 | #define NCR5380_write_info oakscsi_write_info | ||
35 | 36 | ||
36 | #define NCR5380_implementation_fields \ | 37 | #define NCR5380_implementation_fields \ |
37 | void __iomem *base | 38 | void __iomem *base |
@@ -115,7 +116,8 @@ printk("reading %p len %d\n", addr, len); | |||
115 | 116 | ||
116 | static struct scsi_host_template oakscsi_template = { | 117 | static struct scsi_host_template oakscsi_template = { |
117 | .module = THIS_MODULE, | 118 | .module = THIS_MODULE, |
118 | .proc_info = oakscsi_proc_info, | 119 | .show_info = oakscsi_show_info, |
120 | .write_info = oakscsi_write_info, | ||
119 | .name = "Oak 16-bit SCSI", | 121 | .name = "Oak 16-bit SCSI", |
120 | .info = oakscsi_info, | 122 | .info = oakscsi_info, |
121 | .queuecommand = oakscsi_queue_command, | 123 | .queuecommand = oakscsi_queue_command, |
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index 246600b93555..abc9593615e9 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c | |||
@@ -237,32 +237,20 @@ powertecscsi_set_proc_info(struct Scsi_Host *host, char *buffer, int length) | |||
237 | * inout - 0 for reading, 1 for writing. | 237 | * inout - 0 for reading, 1 for writing. |
238 | * Returns : length of data written to buffer. | 238 | * Returns : length of data written to buffer. |
239 | */ | 239 | */ |
240 | int powertecscsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 240 | static int powertecscsi_show_info(struct seq_file *m, struct Scsi_Host *host) |
241 | int length, int inout) | ||
242 | { | 241 | { |
243 | struct powertec_info *info; | 242 | struct powertec_info *info; |
244 | char *p = buffer; | ||
245 | int pos; | ||
246 | |||
247 | if (inout == 1) | ||
248 | return powertecscsi_set_proc_info(host, buffer, length); | ||
249 | 243 | ||
250 | info = (struct powertec_info *)host->hostdata; | 244 | info = (struct powertec_info *)host->hostdata; |
251 | 245 | ||
252 | p += sprintf(p, "PowerTec SCSI driver v%s\n", VERSION); | 246 | seq_printf(m, "PowerTec SCSI driver v%s\n", VERSION); |
253 | p += fas216_print_host(&info->info, p); | 247 | fas216_print_host(&info->info, m); |
254 | p += sprintf(p, "Term : o%s\n", | 248 | seq_printf(m, "Term : o%s\n", |
255 | info->term_ctl ? "n" : "ff"); | 249 | info->term_ctl ? "n" : "ff"); |
256 | 250 | ||
257 | p += fas216_print_stats(&info->info, p); | 251 | fas216_print_stats(&info->info, m); |
258 | p += fas216_print_devices(&info->info, p); | 252 | fas216_print_devices(&info->info, m); |
259 | 253 | return 0; | |
260 | *start = buffer + offset; | ||
261 | pos = p - buffer - offset; | ||
262 | if (pos > length) | ||
263 | pos = length; | ||
264 | |||
265 | return pos; | ||
266 | } | 254 | } |
267 | 255 | ||
268 | static ssize_t powertecscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) | 256 | static ssize_t powertecscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -291,7 +279,8 @@ static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR, | |||
291 | 279 | ||
292 | static struct scsi_host_template powertecscsi_template = { | 280 | static struct scsi_host_template powertecscsi_template = { |
293 | .module = THIS_MODULE, | 281 | .module = THIS_MODULE, |
294 | .proc_info = powertecscsi_proc_info, | 282 | .show_info = powertecscsi_show_info, |
283 | .write_info = powertecscsi_set_proc_info, | ||
295 | .name = "PowerTec SCSI", | 284 | .name = "PowerTec SCSI", |
296 | .info = powertecscsi_info, | 285 | .info = powertecscsi_info, |
297 | .queuecommand = fas216_queue_command, | 286 | .queuecommand = fas216_queue_command, |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 2db79b469d9e..0f3cdbc80ba6 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -719,119 +719,94 @@ static void __init NCR5380_print_options(struct Scsi_Host *instance) | |||
719 | * Inputs : instance, pointer to this instance. | 719 | * Inputs : instance, pointer to this instance. |
720 | */ | 720 | */ |
721 | 721 | ||
722 | static void NCR5380_print_status(struct Scsi_Host *instance) | 722 | static void lprint_Scsi_Cmnd(Scsi_Cmnd *cmd) |
723 | { | 723 | { |
724 | char *pr_bfr; | 724 | int i, s; |
725 | char *start; | 725 | unsigned char *command; |
726 | int len; | 726 | printk("scsi%d: destination target %d, lun %d\n", |
727 | 727 | H_NO(cmd), cmd->device->id, cmd->device->lun); | |
728 | NCR_PRINT(NDEBUG_ANY); | 728 | printk(KERN_CONT " command = "); |
729 | NCR_PRINT_PHASE(NDEBUG_ANY); | 729 | command = cmd->cmnd; |
730 | 730 | printk(KERN_CONT "%2d (0x%02x)", command[0], command[0]); | |
731 | pr_bfr = (char *)__get_free_page(GFP_ATOMIC); | 731 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
732 | if (!pr_bfr) { | 732 | printk(KERN_CONT " %02x", command[i]); |
733 | printk("NCR5380_print_status: no memory for print buffer\n"); | 733 | printk("\n"); |
734 | return; | ||
735 | } | ||
736 | len = NCR5380_proc_info(instance, pr_bfr, &start, 0, PAGE_SIZE, 0); | ||
737 | pr_bfr[len] = 0; | ||
738 | printk("\n%s\n", pr_bfr); | ||
739 | free_page((unsigned long)pr_bfr); | ||
740 | } | 734 | } |
741 | 735 | ||
742 | 736 | static void NCR5380_print_status(struct Scsi_Host *instance) | |
743 | /******************************************/ | ||
744 | /* | ||
745 | * /proc/scsi/[dtc pas16 t128 generic]/[0-ASC_NUM_BOARD_SUPPORTED] | ||
746 | * | ||
747 | * *buffer: I/O buffer | ||
748 | * **start: if inout == FALSE pointer into buffer where user read should start | ||
749 | * offset: current offset | ||
750 | * length: length of buffer | ||
751 | * hostno: Scsi_Host host_no | ||
752 | * inout: TRUE - user is writing; FALSE - user is reading | ||
753 | * | ||
754 | * Return the number of bytes read from or written | ||
755 | */ | ||
756 | |||
757 | #undef SPRINTF | ||
758 | #define SPRINTF(fmt,args...) \ | ||
759 | do { \ | ||
760 | if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ | ||
761 | pos += sprintf(pos, fmt , ## args); \ | ||
762 | } while(0) | ||
763 | static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length); | ||
764 | |||
765 | static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer, | ||
766 | char **start, off_t offset, int length, int inout) | ||
767 | { | 737 | { |
768 | char *pos = buffer; | ||
769 | struct NCR5380_hostdata *hostdata; | 738 | struct NCR5380_hostdata *hostdata; |
770 | Scsi_Cmnd *ptr; | 739 | Scsi_Cmnd *ptr; |
771 | unsigned long flags; | 740 | unsigned long flags; |
772 | off_t begin = 0; | 741 | |
773 | #define check_offset() \ | 742 | NCR_PRINT(NDEBUG_ANY); |
774 | do { \ | 743 | NCR_PRINT_PHASE(NDEBUG_ANY); |
775 | if (pos - buffer < offset - begin) { \ | ||
776 | begin += pos - buffer; \ | ||
777 | pos = buffer; \ | ||
778 | } \ | ||
779 | } while (0) | ||
780 | 744 | ||
781 | hostdata = (struct NCR5380_hostdata *)instance->hostdata; | 745 | hostdata = (struct NCR5380_hostdata *)instance->hostdata; |
782 | 746 | ||
783 | if (inout) /* Has data been written to the file ? */ | 747 | printk("\nNCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); |
784 | return -ENOSYS; /* Currently this is a no-op */ | ||
785 | SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); | ||
786 | check_offset(); | ||
787 | local_irq_save(flags); | 748 | local_irq_save(flags); |
788 | SPRINTF("NCR5380: coroutine is%s running.\n", | 749 | printk("NCR5380: coroutine is%s running.\n", |
789 | main_running ? "" : "n't"); | 750 | main_running ? "" : "n't"); |
790 | check_offset(); | ||
791 | if (!hostdata->connected) | 751 | if (!hostdata->connected) |
792 | SPRINTF("scsi%d: no currently connected command\n", HOSTNO); | 752 | printk("scsi%d: no currently connected command\n", HOSTNO); |
793 | else | 753 | else |
794 | pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, | 754 | lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected); |
795 | pos, buffer, length); | 755 | printk("scsi%d: issue_queue\n", HOSTNO); |
796 | SPRINTF("scsi%d: issue_queue\n", HOSTNO); | 756 | for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) |
797 | check_offset(); | 757 | lprint_Scsi_Cmnd(ptr); |
798 | for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) { | ||
799 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | ||
800 | check_offset(); | ||
801 | } | ||
802 | 758 | ||
803 | SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); | 759 | printk("scsi%d: disconnected_queue\n", HOSTNO); |
804 | check_offset(); | ||
805 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; | 760 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; |
806 | ptr = NEXT(ptr)) { | 761 | ptr = NEXT(ptr)) |
807 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | 762 | lprint_Scsi_Cmnd(ptr); |
808 | check_offset(); | ||
809 | } | ||
810 | 763 | ||
811 | local_irq_restore(flags); | 764 | local_irq_restore(flags); |
812 | *start = buffer + (offset - begin); | 765 | printk("\n"); |
813 | if (pos - buffer < offset - begin) | ||
814 | return 0; | ||
815 | else if (pos - buffer - (offset - begin) < length) | ||
816 | return pos - buffer - (offset - begin); | ||
817 | return length; | ||
818 | } | 766 | } |
819 | 767 | ||
820 | static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length) | 768 | static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m) |
821 | { | 769 | { |
822 | int i, s; | 770 | int i, s; |
823 | unsigned char *command; | 771 | unsigned char *command; |
824 | SPRINTF("scsi%d: destination target %d, lun %d\n", | 772 | seq_printf(m, "scsi%d: destination target %d, lun %d\n", |
825 | H_NO(cmd), cmd->device->id, cmd->device->lun); | 773 | H_NO(cmd), cmd->device->id, cmd->device->lun); |
826 | SPRINTF(" command = "); | 774 | seq_printf(m, " command = "); |
827 | command = cmd->cmnd; | 775 | command = cmd->cmnd; |
828 | SPRINTF("%2d (0x%02x)", command[0], command[0]); | 776 | seq_printf(m, "%2d (0x%02x)", command[0], command[0]); |
829 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) | 777 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
830 | SPRINTF(" %02x", command[i]); | 778 | seq_printf(m, " %02x", command[i]); |
831 | SPRINTF("\n"); | 779 | seq_printf(m, "\n"); |
832 | return pos; | ||
833 | } | 780 | } |
834 | 781 | ||
782 | static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance) | ||
783 | { | ||
784 | struct NCR5380_hostdata *hostdata; | ||
785 | Scsi_Cmnd *ptr; | ||
786 | unsigned long flags; | ||
787 | |||
788 | hostdata = (struct NCR5380_hostdata *)instance->hostdata; | ||
789 | |||
790 | seq_printf(m, "NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); | ||
791 | local_irq_save(flags); | ||
792 | seq_printf(m, "NCR5380: coroutine is%s running.\n", | ||
793 | main_running ? "" : "n't"); | ||
794 | if (!hostdata->connected) | ||
795 | seq_printf(m, "scsi%d: no currently connected command\n", HOSTNO); | ||
796 | else | ||
797 | show_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m); | ||
798 | seq_printf(m, "scsi%d: issue_queue\n", HOSTNO); | ||
799 | for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) | ||
800 | show_Scsi_Cmnd(ptr, m); | ||
801 | |||
802 | seq_printf(m, "scsi%d: disconnected_queue\n", HOSTNO); | ||
803 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; | ||
804 | ptr = NEXT(ptr)) | ||
805 | show_Scsi_Cmnd(ptr, m); | ||
806 | |||
807 | local_irq_restore(flags); | ||
808 | return 0; | ||
809 | } | ||
835 | 810 | ||
836 | /* | 811 | /* |
837 | * Function : void NCR5380_init (struct Scsi_Host *instance) | 812 | * Function : void NCR5380_init (struct Scsi_Host *instance) |
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index df740cbbaef4..a3e6c8a3ff0f 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c | |||
@@ -1100,7 +1100,7 @@ static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value) | |||
1100 | #include "atari_NCR5380.c" | 1100 | #include "atari_NCR5380.c" |
1101 | 1101 | ||
1102 | static struct scsi_host_template driver_template = { | 1102 | static struct scsi_host_template driver_template = { |
1103 | .proc_info = atari_scsi_proc_info, | 1103 | .show_info = atari_scsi_show_info, |
1104 | .name = "Atari native SCSI", | 1104 | .name = "Atari native SCSI", |
1105 | .detect = atari_scsi_detect, | 1105 | .detect = atari_scsi_detect, |
1106 | .release = atari_scsi_release, | 1106 | .release = atari_scsi_release, |
diff --git a/drivers/scsi/atari_scsi.h b/drivers/scsi/atari_scsi.h index bd52df78b209..11c624bb122d 100644 --- a/drivers/scsi/atari_scsi.h +++ b/drivers/scsi/atari_scsi.h | |||
@@ -47,7 +47,7 @@ | |||
47 | #define NCR5380_intr atari_scsi_intr | 47 | #define NCR5380_intr atari_scsi_intr |
48 | #define NCR5380_queue_command atari_scsi_queue_command | 48 | #define NCR5380_queue_command atari_scsi_queue_command |
49 | #define NCR5380_abort atari_scsi_abort | 49 | #define NCR5380_abort atari_scsi_abort |
50 | #define NCR5380_proc_info atari_scsi_proc_info | 50 | #define NCR5380_show_info atari_scsi_show_info |
51 | #define NCR5380_dma_read_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 0) | 51 | #define NCR5380_dma_read_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 0) |
52 | #define NCR5380_dma_write_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 1) | 52 | #define NCR5380_dma_write_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 1) |
53 | #define NCR5380_dma_residual(inst) atari_scsi_dma_residual( inst ) | 53 | #define NCR5380_dma_residual(inst) atari_scsi_dma_residual( inst ) |
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index cfc73041f102..15a629d8ed08 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -3099,38 +3099,14 @@ static const char *atp870u_info(struct Scsi_Host *notused) | |||
3099 | return buffer; | 3099 | return buffer; |
3100 | } | 3100 | } |
3101 | 3101 | ||
3102 | #define BLS buffer + len + size | 3102 | static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr) |
3103 | static int atp870u_proc_info(struct Scsi_Host *HBAptr, char *buffer, | ||
3104 | char **start, off_t offset, int length, int inout) | ||
3105 | { | 3103 | { |
3106 | static u8 buff[512]; | 3104 | seq_printf(m, "ACARD AEC-671X Driver Version: 2.6+ac\n"); |
3107 | int size = 0; | 3105 | seq_printf(m, "\n"); |
3108 | int len = 0; | 3106 | seq_printf(m, "Adapter Configuration:\n"); |
3109 | off_t begin = 0; | 3107 | seq_printf(m, " Base IO: %#.4lx\n", HBAptr->io_port); |
3110 | off_t pos = 0; | 3108 | seq_printf(m, " IRQ: %d\n", HBAptr->irq); |
3111 | 3109 | return 0; | |
3112 | if (inout) | ||
3113 | return -EINVAL; | ||
3114 | if (offset == 0) | ||
3115 | memset(buff, 0, sizeof(buff)); | ||
3116 | size += sprintf(BLS, "ACARD AEC-671X Driver Version: 2.6+ac\n"); | ||
3117 | len += size; | ||
3118 | pos = begin + len; | ||
3119 | size = 0; | ||
3120 | |||
3121 | size += sprintf(BLS, "\n"); | ||
3122 | size += sprintf(BLS, "Adapter Configuration:\n"); | ||
3123 | size += sprintf(BLS, " Base IO: %#.4lx\n", HBAptr->io_port); | ||
3124 | size += sprintf(BLS, " IRQ: %d\n", HBAptr->irq); | ||
3125 | len += size; | ||
3126 | pos = begin + len; | ||
3127 | |||
3128 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
3129 | len -= (offset - begin); /* Start slop */ | ||
3130 | if (len > length) { | ||
3131 | len = length; /* Ending slop */ | ||
3132 | } | ||
3133 | return (len); | ||
3134 | } | 3110 | } |
3135 | 3111 | ||
3136 | 3112 | ||
@@ -3177,7 +3153,7 @@ static struct scsi_host_template atp870u_template = { | |||
3177 | .module = THIS_MODULE, | 3153 | .module = THIS_MODULE, |
3178 | .name = "atp870u" /* name */, | 3154 | .name = "atp870u" /* name */, |
3179 | .proc_name = "atp870u", | 3155 | .proc_name = "atp870u", |
3180 | .proc_info = atp870u_proc_info, | 3156 | .show_info = atp870u_show_info, |
3181 | .info = atp870u_info /* info */, | 3157 | .info = atp870u_info /* info */, |
3182 | .queuecommand = atp870u_queuecommand /* queuecommand */, | 3158 | .queuecommand = atp870u_queuecommand /* queuecommand */, |
3183 | .eh_abort_handler = atp870u_abort /* abort */, | 3159 | .eh_abort_handler = atp870u_abort /* abort */, |
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index fed486bfd3f4..694e13c45dfd 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c | |||
@@ -4616,26 +4616,21 @@ static void adapter_uninit(struct AdapterCtlBlk *acb) | |||
4616 | 4616 | ||
4617 | 4617 | ||
4618 | #undef SPRINTF | 4618 | #undef SPRINTF |
4619 | #define SPRINTF(args...) pos += sprintf(pos, args) | 4619 | #define SPRINTF(args...) seq_printf(m,##args) |
4620 | 4620 | ||
4621 | #undef YESNO | 4621 | #undef YESNO |
4622 | #define YESNO(YN) \ | 4622 | #define YESNO(YN) \ |
4623 | if (YN) SPRINTF(" Yes ");\ | 4623 | if (YN) SPRINTF(" Yes ");\ |
4624 | else SPRINTF(" No ") | 4624 | else SPRINTF(" No ") |
4625 | 4625 | ||
4626 | static int dc395x_proc_info(struct Scsi_Host *host, char *buffer, | 4626 | static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host) |
4627 | char **start, off_t offset, int length, int inout) | ||
4628 | { | 4627 | { |
4629 | struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)host->hostdata; | 4628 | struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)host->hostdata; |
4630 | int spd, spd1; | 4629 | int spd, spd1; |
4631 | char *pos = buffer; | ||
4632 | struct DeviceCtlBlk *dcb; | 4630 | struct DeviceCtlBlk *dcb; |
4633 | unsigned long flags; | 4631 | unsigned long flags; |
4634 | int dev; | 4632 | int dev; |
4635 | 4633 | ||
4636 | if (inout) /* Has data been written to the file ? */ | ||
4637 | return -EPERM; | ||
4638 | |||
4639 | SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n"); | 4634 | SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n"); |
4640 | SPRINTF(" Driver Version " DC395X_VERSION "\n"); | 4635 | SPRINTF(" Driver Version " DC395X_VERSION "\n"); |
4641 | 4636 | ||
@@ -4735,22 +4730,15 @@ static int dc395x_proc_info(struct Scsi_Host *host, char *buffer, | |||
4735 | SPRINTF("END\n"); | 4730 | SPRINTF("END\n"); |
4736 | } | 4731 | } |
4737 | 4732 | ||
4738 | *start = buffer + offset; | ||
4739 | DC395x_UNLOCK_IO(acb->scsi_host, flags); | 4733 | DC395x_UNLOCK_IO(acb->scsi_host, flags); |
4740 | 4734 | return 0; | |
4741 | if (pos - buffer < offset) | ||
4742 | return 0; | ||
4743 | else if (pos - buffer - offset < length) | ||
4744 | return pos - buffer - offset; | ||
4745 | else | ||
4746 | return length; | ||
4747 | } | 4735 | } |
4748 | 4736 | ||
4749 | 4737 | ||
4750 | static struct scsi_host_template dc395x_driver_template = { | 4738 | static struct scsi_host_template dc395x_driver_template = { |
4751 | .module = THIS_MODULE, | 4739 | .module = THIS_MODULE, |
4752 | .proc_name = DC395X_NAME, | 4740 | .proc_name = DC395X_NAME, |
4753 | .proc_info = dc395x_proc_info, | 4741 | .show_info = dc395x_show_info, |
4754 | .name = DC395X_BANNER " " DC395X_VERSION, | 4742 | .name = DC395X_BANNER " " DC395X_VERSION, |
4755 | .queuecommand = dc395x_queue_command, | 4743 | .queuecommand = dc395x_queue_command, |
4756 | .bios_param = dc395x_bios_param, | 4744 | .bios_param = dc395x_bios_param, |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index b6e2700ec1c6..19e1b422260a 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -553,36 +553,14 @@ static const char *adpt_info(struct Scsi_Host *host) | |||
553 | return (char *) (pHba->detail); | 553 | return (char *) (pHba->detail); |
554 | } | 554 | } |
555 | 555 | ||
556 | static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 556 | static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host) |
557 | int length, int inout) | ||
558 | { | 557 | { |
559 | struct adpt_device* d; | 558 | struct adpt_device* d; |
560 | int id; | 559 | int id; |
561 | int chan; | 560 | int chan; |
562 | int len = 0; | ||
563 | int begin = 0; | ||
564 | int pos = 0; | ||
565 | adpt_hba* pHba; | 561 | adpt_hba* pHba; |
566 | int unit; | 562 | int unit; |
567 | 563 | ||
568 | *start = buffer; | ||
569 | if (inout == TRUE) { | ||
570 | /* | ||
571 | * The user has done a write and wants us to take the | ||
572 | * data in the buffer and do something with it. | ||
573 | * proc_scsiwrite calls us with inout = 1 | ||
574 | * | ||
575 | * Read data from buffer (writing to us) - NOT SUPPORTED | ||
576 | */ | ||
577 | return -EINVAL; | ||
578 | } | ||
579 | |||
580 | /* | ||
581 | * inout = 0 means the user has done a read and wants information | ||
582 | * returned, so we write information about the cards into the buffer | ||
583 | * proc_scsiread() calls us with inout = 0 | ||
584 | */ | ||
585 | |||
586 | // Find HBA (host bus adapter) we are looking for | 564 | // Find HBA (host bus adapter) we are looking for |
587 | mutex_lock(&adpt_configuration_lock); | 565 | mutex_lock(&adpt_configuration_lock); |
588 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 566 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
@@ -596,86 +574,30 @@ static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, of | |||
596 | } | 574 | } |
597 | host = pHba->host; | 575 | host = pHba->host; |
598 | 576 | ||
599 | len = sprintf(buffer , "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); | 577 | seq_printf(m, "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); |
600 | len += sprintf(buffer+len, "%s\n", pHba->detail); | 578 | seq_printf(m, "%s\n", pHba->detail); |
601 | len += sprintf(buffer+len, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", | 579 | seq_printf(m, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", |
602 | pHba->host->host_no, pHba->name, host->irq); | 580 | pHba->host->host_no, pHba->name, host->irq); |
603 | len += sprintf(buffer+len, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", | 581 | seq_printf(m, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", |
604 | host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); | 582 | host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); |
605 | 583 | ||
606 | pos = begin + len; | 584 | seq_printf(m, "Devices:\n"); |
607 | |||
608 | /* CHECKPOINT */ | ||
609 | if(pos > offset + length) { | ||
610 | goto stop_output; | ||
611 | } | ||
612 | if(pos <= offset) { | ||
613 | /* | ||
614 | * If we haven't even written to where we last left | ||
615 | * off (the last time we were called), reset the | ||
616 | * beginning pointer. | ||
617 | */ | ||
618 | len = 0; | ||
619 | begin = pos; | ||
620 | } | ||
621 | len += sprintf(buffer+len, "Devices:\n"); | ||
622 | for(chan = 0; chan < MAX_CHANNEL; chan++) { | 585 | for(chan = 0; chan < MAX_CHANNEL; chan++) { |
623 | for(id = 0; id < MAX_ID; id++) { | 586 | for(id = 0; id < MAX_ID; id++) { |
624 | d = pHba->channel[chan].device[id]; | 587 | d = pHba->channel[chan].device[id]; |
625 | while(d){ | 588 | while(d) { |
626 | len += sprintf(buffer+len,"\t%-24.24s", d->pScsi_dev->vendor); | 589 | seq_printf(m,"\t%-24.24s", d->pScsi_dev->vendor); |
627 | len += sprintf(buffer+len," Rev: %-8.8s\n", d->pScsi_dev->rev); | 590 | seq_printf(m," Rev: %-8.8s\n", d->pScsi_dev->rev); |
628 | pos = begin + len; | ||
629 | |||
630 | |||
631 | /* CHECKPOINT */ | ||
632 | if(pos > offset + length) { | ||
633 | goto stop_output; | ||
634 | } | ||
635 | if(pos <= offset) { | ||
636 | len = 0; | ||
637 | begin = pos; | ||
638 | } | ||
639 | 591 | ||
640 | unit = d->pI2o_dev->lct_data.tid; | 592 | unit = d->pI2o_dev->lct_data.tid; |
641 | len += sprintf(buffer+len, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", | 593 | seq_printf(m, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", |
642 | unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, | 594 | unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, |
643 | scsi_device_online(d->pScsi_dev)? "online":"offline"); | 595 | scsi_device_online(d->pScsi_dev)? "online":"offline"); |
644 | pos = begin + len; | ||
645 | |||
646 | /* CHECKPOINT */ | ||
647 | if(pos > offset + length) { | ||
648 | goto stop_output; | ||
649 | } | ||
650 | if(pos <= offset) { | ||
651 | len = 0; | ||
652 | begin = pos; | ||
653 | } | ||
654 | |||
655 | d = d->next_lun; | 596 | d = d->next_lun; |
656 | } | 597 | } |
657 | } | 598 | } |
658 | } | 599 | } |
659 | 600 | return 0; | |
660 | /* | ||
661 | * begin is where we last checked our position with regards to offset | ||
662 | * begin is always less than offset. len is relative to begin. It | ||
663 | * is the number of bytes written past begin | ||
664 | * | ||
665 | */ | ||
666 | stop_output: | ||
667 | /* stop the output and calculate the correct length */ | ||
668 | *(buffer + len) = '\0'; | ||
669 | |||
670 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
671 | len -= (offset - begin); | ||
672 | if(len > length) { | ||
673 | len = length; | ||
674 | } else if(len < 0){ | ||
675 | len = 0; | ||
676 | **start = '\0'; | ||
677 | } | ||
678 | return len; | ||
679 | } | 601 | } |
680 | 602 | ||
681 | /* | 603 | /* |
@@ -3639,7 +3561,7 @@ static struct scsi_host_template driver_template = { | |||
3639 | .module = THIS_MODULE, | 3561 | .module = THIS_MODULE, |
3640 | .name = "dpt_i2o", | 3562 | .name = "dpt_i2o", |
3641 | .proc_name = "dpt_i2o", | 3563 | .proc_name = "dpt_i2o", |
3642 | .proc_info = adpt_proc_info, | 3564 | .show_info = adpt_show_info, |
3643 | .info = adpt_info, | 3565 | .info = adpt_info, |
3644 | .queuecommand = adpt_queue, | 3566 | .queuecommand = adpt_queue, |
3645 | .eh_abort_handler = adpt_abort, | 3567 | .eh_abort_handler = adpt_abort, |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 4b11bb04f5c4..d01f01604140 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -216,7 +216,8 @@ static int __init dtc_detect(struct scsi_host_template * tpnt) | |||
216 | int sig, count; | 216 | int sig, count; |
217 | 217 | ||
218 | tpnt->proc_name = "dtc3x80"; | 218 | tpnt->proc_name = "dtc3x80"; |
219 | tpnt->proc_info = &dtc_proc_info; | 219 | tpnt->show_info = dtc_show_info; |
220 | tpnt->write_info = dtc_write_info; | ||
220 | 221 | ||
221 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { | 222 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { |
222 | addr = 0; | 223 | addr = 0; |
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h index cdc621204b66..92d7cfc3f4fc 100644 --- a/drivers/scsi/dtc.h +++ b/drivers/scsi/dtc.h | |||
@@ -88,7 +88,8 @@ static int dtc_bus_reset(Scsi_Cmnd *); | |||
88 | #define NCR5380_queue_command dtc_queue_command | 88 | #define NCR5380_queue_command dtc_queue_command |
89 | #define NCR5380_abort dtc_abort | 89 | #define NCR5380_abort dtc_abort |
90 | #define NCR5380_bus_reset dtc_bus_reset | 90 | #define NCR5380_bus_reset dtc_bus_reset |
91 | #define NCR5380_proc_info dtc_proc_info | 91 | #define NCR5380_show_info dtc_show_info |
92 | #define NCR5380_write_info dtc_write_info | ||
92 | 93 | ||
93 | /* 15 12 11 10 | 94 | /* 15 12 11 10 |
94 | 1001 1100 0000 0000 */ | 95 | 1001 1100 0000 0000 */ |
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index d5f8362335d3..356def44ce58 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c | |||
@@ -92,58 +92,22 @@ static unsigned long queue_counter; | |||
92 | 92 | ||
93 | static struct scsi_host_template driver_template; | 93 | static struct scsi_host_template driver_template; |
94 | 94 | ||
95 | /* | 95 | static int eata_pio_show_info(struct seq_file *m, struct Scsi_Host *shost) |
96 | * eata_proc_info | ||
97 | * inout : decides on the direction of the dataflow and the meaning of the | ||
98 | * variables | ||
99 | * buffer: If inout==FALSE data is being written to it else read from it | ||
100 | * *start: If inout==FALSE start of the valid data in the buffer | ||
101 | * offset: If inout==FALSE offset from the beginning of the imaginary file | ||
102 | * from which we start writing into the buffer | ||
103 | * length: If inout==FALSE max number of bytes to be written into the buffer | ||
104 | * else number of bytes in the buffer | ||
105 | */ | ||
106 | static int eata_pio_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, | ||
107 | int length, int rw) | ||
108 | { | 96 | { |
109 | int len = 0; | 97 | seq_printf(m, "EATA (Extended Attachment) PIO driver version: " |
110 | off_t begin = 0, pos = 0; | ||
111 | |||
112 | if (rw) | ||
113 | return -ENOSYS; | ||
114 | |||
115 | len += sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: " | ||
116 | "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB); | 98 | "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB); |
117 | len += sprintf(buffer + len, "queued commands: %10ld\n" | 99 | seq_printf(m, "queued commands: %10ld\n" |
118 | "processed interrupts:%10ld\n", queue_counter, int_counter); | 100 | "processed interrupts:%10ld\n", queue_counter, int_counter); |
119 | len += sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n", | 101 | seq_printf(m, "\nscsi%-2d: HBA %.10s\n", |
120 | shost->host_no, SD(shost)->name); | 102 | shost->host_no, SD(shost)->name); |
121 | len += sprintf(buffer + len, "Firmware revision: v%s\n", | 103 | seq_printf(m, "Firmware revision: v%s\n", |
122 | SD(shost)->revision); | 104 | SD(shost)->revision); |
123 | len += sprintf(buffer + len, "IO: PIO\n"); | 105 | seq_printf(m, "IO: PIO\n"); |
124 | len += sprintf(buffer + len, "Base IO : %#.4x\n", (u32) shost->base); | 106 | seq_printf(m, "Base IO : %#.4x\n", (u32) shost->base); |
125 | len += sprintf(buffer + len, "Host Bus: %s\n", | 107 | seq_printf(m, "Host Bus: %s\n", |
126 | (SD(shost)->bustype == 'P')?"PCI ": | 108 | (SD(shost)->bustype == 'P')?"PCI ": |
127 | (SD(shost)->bustype == 'E')?"EISA":"ISA "); | 109 | (SD(shost)->bustype == 'E')?"EISA":"ISA "); |
128 | 110 | return 0; | |
129 | pos = begin + len; | ||
130 | |||
131 | if (pos < offset) { | ||
132 | len = 0; | ||
133 | begin = pos; | ||
134 | } | ||
135 | if (pos > offset + length) | ||
136 | goto stop_output; | ||
137 | |||
138 | stop_output: | ||
139 | DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len)); | ||
140 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
141 | len -= (offset - begin); /* Start slop */ | ||
142 | if (len > length) | ||
143 | len = length; /* Ending slop */ | ||
144 | DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len)); | ||
145 | |||
146 | return len; | ||
147 | } | 111 | } |
148 | 112 | ||
149 | static int eata_pio_release(struct Scsi_Host *sh) | 113 | static int eata_pio_release(struct Scsi_Host *sh) |
@@ -985,7 +949,7 @@ static int eata_pio_detect(struct scsi_host_template *tpnt) | |||
985 | static struct scsi_host_template driver_template = { | 949 | static struct scsi_host_template driver_template = { |
986 | .proc_name = "eata_pio", | 950 | .proc_name = "eata_pio", |
987 | .name = "EATA (Extended Attachment) PIO driver", | 951 | .name = "EATA (Extended Attachment) PIO driver", |
988 | .proc_info = eata_pio_proc_info, | 952 | .show_info = eata_pio_show_info, |
989 | .detect = eata_pio_detect, | 953 | .detect = eata_pio_detect, |
990 | .release = eata_pio_release, | 954 | .release = eata_pio_release, |
991 | .queuecommand = eata_pio_queue, | 955 | .queuecommand = eata_pio_queue, |
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 5041f925c191..5cec6c60ca22 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -745,42 +745,36 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
745 | 745 | ||
746 | #include "NCR5380.c" | 746 | #include "NCR5380.c" |
747 | 747 | ||
748 | #define PRINTP(x) len += sprintf(buffer+len, x) | 748 | #define PRINTP(x) seq_printf(m, x) |
749 | #define ANDP , | 749 | #define ANDP , |
750 | 750 | ||
751 | static int sprint_opcode(char *buffer, int len, int opcode) | 751 | static void sprint_opcode(struct seq_file *m, int opcode) |
752 | { | 752 | { |
753 | int start = len; | ||
754 | PRINTP("0x%02x " ANDP opcode); | 753 | PRINTP("0x%02x " ANDP opcode); |
755 | return len - start; | ||
756 | } | 754 | } |
757 | 755 | ||
758 | static int sprint_command(char *buffer, int len, unsigned char *command) | 756 | static void sprint_command(struct seq_file *m, unsigned char *command) |
759 | { | 757 | { |
760 | int i, s, start = len; | 758 | int i, s; |
761 | len += sprint_opcode(buffer, len, command[0]); | 759 | sprint_opcode(m, command[0]); |
762 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) | 760 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
763 | PRINTP("%02x " ANDP command[i]); | 761 | PRINTP("%02x " ANDP command[i]); |
764 | PRINTP("\n"); | 762 | PRINTP("\n"); |
765 | return len - start; | ||
766 | } | 763 | } |
767 | 764 | ||
768 | /** | 765 | /** |
769 | * sprintf_Scsi_Cmnd - print a scsi command | 766 | * sprintf_Scsi_Cmnd - print a scsi command |
770 | * @buffer: buffr to print into | 767 | * @m: seq_fil to print into |
771 | * @len: buffer length | ||
772 | * @cmd: SCSI command block | 768 | * @cmd: SCSI command block |
773 | * | 769 | * |
774 | * Print out the target and command data in hex | 770 | * Print out the target and command data in hex |
775 | */ | 771 | */ |
776 | 772 | ||
777 | static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd) | 773 | static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd) |
778 | { | 774 | { |
779 | int start = len; | ||
780 | PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun); | 775 | PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun); |
781 | PRINTP(" command = "); | 776 | PRINTP(" command = "); |
782 | len += sprint_command(buffer, len, cmd->cmnd); | 777 | sprint_command(m, cmd->cmnd); |
783 | return len - start; | ||
784 | } | 778 | } |
785 | 779 | ||
786 | /** | 780 | /** |
@@ -800,9 +794,8 @@ static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd) | |||
800 | * Locks: global cli/lock for queue walk | 794 | * Locks: global cli/lock for queue walk |
801 | */ | 795 | */ |
802 | 796 | ||
803 | static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, char **start, off_t offset, int length, int inout) | 797 | static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_ptr) |
804 | { | 798 | { |
805 | int len = 0; | ||
806 | NCR5380_local_declare(); | 799 | NCR5380_local_declare(); |
807 | unsigned long flags; | 800 | unsigned long flags; |
808 | unsigned char status; | 801 | unsigned char status; |
@@ -853,16 +846,16 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c | |||
853 | PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); | 846 | PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); |
854 | for (i = 0; i < 8; i++) | 847 | for (i = 0; i < 8; i++) |
855 | if (dev->vendor[i] >= 0x20) | 848 | if (dev->vendor[i] >= 0x20) |
856 | *(buffer + (len++)) = dev->vendor[i]; | 849 | seq_putc(m, dev->vendor[i]); |
857 | *(buffer + (len++)) = ' '; | 850 | seq_putc(m, ' '); |
858 | for (i = 0; i < 16; i++) | 851 | for (i = 0; i < 16; i++) |
859 | if (dev->model[i] >= 0x20) | 852 | if (dev->model[i] >= 0x20) |
860 | *(buffer + (len++)) = dev->model[i]; | 853 | seq_putc(m, dev->model[i]); |
861 | *(buffer + (len++)) = ' '; | 854 | seq_putc(m, ' '); |
862 | for (i = 0; i < 4; i++) | 855 | for (i = 0; i < 4; i++) |
863 | if (dev->rev[i] >= 0x20) | 856 | if (dev->rev[i] >= 0x20) |
864 | *(buffer + (len++)) = dev->rev[i]; | 857 | seq_putc(m, dev->rev[i]); |
865 | *(buffer + (len++)) = ' '; | 858 | seq_putc(m, ' '); |
866 | 859 | ||
867 | PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr); | 860 | PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr); |
868 | if (tr) | 861 | if (tr) |
@@ -886,32 +879,28 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c | |||
886 | if (!hostdata->connected) { | 879 | if (!hostdata->connected) { |
887 | PRINTP("No currently connected command\n"); | 880 | PRINTP("No currently connected command\n"); |
888 | } else { | 881 | } else { |
889 | len += sprint_Scsi_Cmnd(buffer, len, (Scsi_Cmnd *) hostdata->connected); | 882 | sprint_Scsi_Cmnd(m, (Scsi_Cmnd *) hostdata->connected); |
890 | } | 883 | } |
891 | 884 | ||
892 | PRINTP("issue_queue\n"); | 885 | PRINTP("issue_queue\n"); |
893 | 886 | ||
894 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 887 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
895 | len += sprint_Scsi_Cmnd(buffer, len, ptr); | 888 | sprint_Scsi_Cmnd(m, ptr); |
896 | 889 | ||
897 | PRINTP("disconnected_queue\n"); | 890 | PRINTP("disconnected_queue\n"); |
898 | 891 | ||
899 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 892 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
900 | len += sprint_Scsi_Cmnd(buffer, len, ptr); | 893 | sprint_Scsi_Cmnd(m, ptr); |
901 | 894 | ||
902 | *start = buffer + offset; | ||
903 | len -= offset; | ||
904 | if (len > length) | ||
905 | len = length; | ||
906 | spin_unlock_irqrestore(scsi_ptr->host_lock, flags); | 895 | spin_unlock_irqrestore(scsi_ptr->host_lock, flags); |
907 | return len; | 896 | return 0; |
908 | } | 897 | } |
909 | 898 | ||
910 | #undef PRINTP | 899 | #undef PRINTP |
911 | #undef ANDP | 900 | #undef ANDP |
912 | 901 | ||
913 | static struct scsi_host_template driver_template = { | 902 | static struct scsi_host_template driver_template = { |
914 | .proc_info = generic_NCR5380_proc_info, | 903 | .show_info = generic_NCR5380_show_info, |
915 | .name = "Generic NCR5380/NCR53C400 Scsi Driver", | 904 | .name = "Generic NCR5380/NCR53C400 Scsi Driver", |
916 | .detect = generic_NCR5380_detect, | 905 | .detect = generic_NCR5380_detect, |
917 | .release = generic_NCR5380_release_resources, | 906 | .release = generic_NCR5380_release_resources, |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 59bceac51a4c..6d55b4e7e792 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -4676,7 +4676,8 @@ static struct scsi_host_template gdth_template = { | |||
4676 | .eh_bus_reset_handler = gdth_eh_bus_reset, | 4676 | .eh_bus_reset_handler = gdth_eh_bus_reset, |
4677 | .slave_configure = gdth_slave_configure, | 4677 | .slave_configure = gdth_slave_configure, |
4678 | .bios_param = gdth_bios_param, | 4678 | .bios_param = gdth_bios_param, |
4679 | .proc_info = gdth_proc_info, | 4679 | .show_info = gdth_show_info, |
4680 | .write_info = gdth_set_info, | ||
4680 | .eh_timed_out = gdth_timed_out, | 4681 | .eh_timed_out = gdth_timed_out, |
4681 | .proc_name = "gdth", | 4682 | .proc_name = "gdth", |
4682 | .can_queue = GDTH_MAXCMDS, | 4683 | .can_queue = GDTH_MAXCMDS, |
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h index fbf6f0f4b0dd..3fd8b83ffbf9 100644 --- a/drivers/scsi/gdth.h +++ b/drivers/scsi/gdth.h | |||
@@ -1007,6 +1007,7 @@ typedef struct { | |||
1007 | 1007 | ||
1008 | /* function prototyping */ | 1008 | /* function prototyping */ |
1009 | 1009 | ||
1010 | int gdth_proc_info(struct Scsi_Host *, char *,char **,off_t,int,int); | 1010 | int gdth_show_info(struct seq_file *, struct Scsi_Host *); |
1011 | int gdth_set_info(struct Scsi_Host *, char *, int); | ||
1011 | 1012 | ||
1012 | #endif | 1013 | #endif |
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c index 652754319a4b..9fb632684863 100644 --- a/drivers/scsi/gdth_proc.c +++ b/drivers/scsi/gdth_proc.c | |||
@@ -5,23 +5,9 @@ | |||
5 | #include <linux/completion.h> | 5 | #include <linux/completion.h> |
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | 7 | ||
8 | int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, | 8 | int gdth_set_info(struct Scsi_Host *host, char *buffer, int length) |
9 | int inout) | ||
10 | { | 9 | { |
11 | gdth_ha_str *ha = shost_priv(host); | 10 | gdth_ha_str *ha = shost_priv(host); |
12 | |||
13 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", | ||
14 | length,(int)offset,inout)); | ||
15 | |||
16 | if (inout) | ||
17 | return(gdth_set_info(buffer,length,host,ha)); | ||
18 | else | ||
19 | return(gdth_get_info(buffer,start,offset,length,host,ha)); | ||
20 | } | ||
21 | |||
22 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | ||
23 | gdth_ha_str *ha) | ||
24 | { | ||
25 | int ret_val = -EINVAL; | 11 | int ret_val = -EINVAL; |
26 | 12 | ||
27 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); | 13 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); |
@@ -149,12 +135,10 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
149 | return(-EINVAL); | 135 | return(-EINVAL); |
150 | } | 136 | } |
151 | 137 | ||
152 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | 138 | int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) |
153 | struct Scsi_Host *host, gdth_ha_str *ha) | ||
154 | { | 139 | { |
155 | int size = 0,len = 0; | 140 | gdth_ha_str *ha = shost_priv(host); |
156 | int hlen; | 141 | int hlen; |
157 | off_t begin = 0,pos = 0; | ||
158 | int id, i, j, k, sec, flag; | 142 | int id, i, j, k, sec, flag; |
159 | int no_mdrv = 0, drv_no, is_mirr; | 143 | int no_mdrv = 0, drv_no, is_mirr; |
160 | u32 cnt; | 144 | u32 cnt; |
@@ -189,8 +173,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
189 | /* request is i.e. "cat /proc/scsi/gdth/0" */ | 173 | /* request is i.e. "cat /proc/scsi/gdth/0" */ |
190 | /* format: %-15s\t%-10s\t%-15s\t%s */ | 174 | /* format: %-15s\t%-10s\t%-15s\t%s */ |
191 | /* driver parameters */ | 175 | /* driver parameters */ |
192 | size = sprintf(buffer+len,"Driver Parameters:\n"); | 176 | seq_printf(m, "Driver Parameters:\n"); |
193 | len += size; pos = begin + len; | ||
194 | if (reserve_list[0] == 0xff) | 177 | if (reserve_list[0] == 0xff) |
195 | strcpy(hrec, "--"); | 178 | strcpy(hrec, "--"); |
196 | else { | 179 | else { |
@@ -201,69 +184,50 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
201 | hlen += snprintf(hrec + hlen , 161 - hlen, ",%d", reserve_list[i]); | 184 | hlen += snprintf(hrec + hlen , 161 - hlen, ",%d", reserve_list[i]); |
202 | } | 185 | } |
203 | } | 186 | } |
204 | size = sprintf(buffer+len, | 187 | seq_printf(m, |
205 | " reserve_mode: \t%d \treserve_list: \t%s\n", | 188 | " reserve_mode: \t%d \treserve_list: \t%s\n", |
206 | reserve_mode, hrec); | 189 | reserve_mode, hrec); |
207 | len += size; pos = begin + len; | 190 | seq_printf(m, |
208 | size = sprintf(buffer+len, | ||
209 | " max_ids: \t%-3d \thdr_channel: \t%d\n", | 191 | " max_ids: \t%-3d \thdr_channel: \t%d\n", |
210 | max_ids, hdr_channel); | 192 | max_ids, hdr_channel); |
211 | len += size; pos = begin + len; | ||
212 | 193 | ||
213 | /* controller information */ | 194 | /* controller information */ |
214 | size = sprintf(buffer+len,"\nDisk Array Controller Information:\n"); | 195 | seq_printf(m,"\nDisk Array Controller Information:\n"); |
215 | len += size; pos = begin + len; | 196 | seq_printf(m, |
216 | strcpy(hrec, ha->binfo.type_string); | ||
217 | size = sprintf(buffer+len, | ||
218 | " Number: \t%d \tName: \t%s\n", | 197 | " Number: \t%d \tName: \t%s\n", |
219 | ha->hanum, hrec); | 198 | ha->hanum, ha->binfo.type_string); |
220 | len += size; pos = begin + len; | ||
221 | 199 | ||
200 | seq_printf(m, | ||
201 | " Driver Ver.: \t%-10s\tFirmware Ver.: \t", | ||
202 | GDTH_VERSION_STR); | ||
222 | if (ha->more_proc) | 203 | if (ha->more_proc) |
223 | sprintf(hrec, "%d.%02d.%02d-%c%03X", | 204 | seq_printf(m, "%d.%02d.%02d-%c%03X\n", |
224 | (u8)(ha->binfo.upd_fw_ver>>24), | 205 | (u8)(ha->binfo.upd_fw_ver>>24), |
225 | (u8)(ha->binfo.upd_fw_ver>>16), | 206 | (u8)(ha->binfo.upd_fw_ver>>16), |
226 | (u8)(ha->binfo.upd_fw_ver), | 207 | (u8)(ha->binfo.upd_fw_ver), |
227 | ha->bfeat.raid ? 'R':'N', | 208 | ha->bfeat.raid ? 'R':'N', |
228 | ha->binfo.upd_revision); | 209 | ha->binfo.upd_revision); |
229 | else | 210 | else |
230 | sprintf(hrec, "%d.%02d", (u8)(ha->cpar.version>>8), | 211 | seq_printf(m, "%d.%02d\n", (u8)(ha->cpar.version>>8), |
231 | (u8)(ha->cpar.version)); | 212 | (u8)(ha->cpar.version)); |
232 | |||
233 | size = sprintf(buffer+len, | ||
234 | " Driver Ver.: \t%-10s\tFirmware Ver.: \t%s\n", | ||
235 | GDTH_VERSION_STR, hrec); | ||
236 | len += size; pos = begin + len; | ||
237 | 213 | ||
238 | if (ha->more_proc) { | 214 | if (ha->more_proc) |
239 | /* more information: 1. about controller */ | 215 | /* more information: 1. about controller */ |
240 | size = sprintf(buffer+len, | 216 | seq_printf(m, |
241 | " Serial No.: \t0x%8X\tCache RAM size:\t%d KB\n", | 217 | " Serial No.: \t0x%8X\tCache RAM size:\t%d KB\n", |
242 | ha->binfo.ser_no, ha->binfo.memsize / 1024); | 218 | ha->binfo.ser_no, ha->binfo.memsize / 1024); |
243 | len += size; pos = begin + len; | ||
244 | } | ||
245 | 219 | ||
246 | #ifdef GDTH_DMA_STATISTICS | 220 | #ifdef GDTH_DMA_STATISTICS |
247 | /* controller statistics */ | 221 | /* controller statistics */ |
248 | size = sprintf(buffer+len,"\nController Statistics:\n"); | 222 | seq_printf(m,"\nController Statistics:\n"); |
249 | len += size; pos = begin + len; | 223 | seq_printf(m, |
250 | size = sprintf(buffer+len, | ||
251 | " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n", | 224 | " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n", |
252 | ha->dma32_cnt, ha->dma64_cnt); | 225 | ha->dma32_cnt, ha->dma64_cnt); |
253 | len += size; pos = begin + len; | ||
254 | #endif | 226 | #endif |
255 | 227 | ||
256 | if (pos < offset) { | ||
257 | len = 0; | ||
258 | begin = pos; | ||
259 | } | ||
260 | if (pos > offset + length) | ||
261 | goto stop_output; | ||
262 | |||
263 | if (ha->more_proc) { | 228 | if (ha->more_proc) { |
264 | /* more information: 2. about physical devices */ | 229 | /* more information: 2. about physical devices */ |
265 | size = sprintf(buffer+len,"\nPhysical Devices:"); | 230 | seq_printf(m, "\nPhysical Devices:"); |
266 | len += size; pos = begin + len; | ||
267 | flag = FALSE; | 231 | flag = FALSE; |
268 | 232 | ||
269 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 233 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -309,21 +273,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
309 | strncpy(hrec+8,pdi->product,16); | 273 | strncpy(hrec+8,pdi->product,16); |
310 | strncpy(hrec+24,pdi->revision,4); | 274 | strncpy(hrec+24,pdi->revision,4); |
311 | hrec[28] = 0; | 275 | hrec[28] = 0; |
312 | size = sprintf(buffer+len, | 276 | seq_printf(m, |
313 | "\n Chn/ID/LUN: \t%c/%02d/%d \tName: \t%s\n", | 277 | "\n Chn/ID/LUN: \t%c/%02d/%d \tName: \t%s\n", |
314 | 'A'+i,pdi->target_id,pdi->lun,hrec); | 278 | 'A'+i,pdi->target_id,pdi->lun,hrec); |
315 | len += size; pos = begin + len; | ||
316 | flag = TRUE; | 279 | flag = TRUE; |
317 | pdi->no_ldrive &= 0xffff; | 280 | pdi->no_ldrive &= 0xffff; |
318 | if (pdi->no_ldrive == 0xffff) | 281 | if (pdi->no_ldrive == 0xffff) |
319 | strcpy(hrec,"--"); | 282 | strcpy(hrec,"--"); |
320 | else | 283 | else |
321 | sprintf(hrec,"%d",pdi->no_ldrive); | 284 | sprintf(hrec,"%d",pdi->no_ldrive); |
322 | size = sprintf(buffer+len, | 285 | seq_printf(m, |
323 | " Capacity [MB]:\t%-6d \tTo Log. Drive: \t%s\n", | 286 | " Capacity [MB]:\t%-6d \tTo Log. Drive: \t%s\n", |
324 | pdi->blkcnt/(1024*1024/pdi->blksize), | 287 | pdi->blkcnt/(1024*1024/pdi->blksize), |
325 | hrec); | 288 | hrec); |
326 | len += size; pos = begin + len; | ||
327 | } else { | 289 | } else { |
328 | pdi->devtype = 0xff; | 290 | pdi->devtype = 0xff; |
329 | } | 291 | } |
@@ -333,11 +295,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
333 | for (k = 0; k < pds->count; ++k) { | 295 | for (k = 0; k < pds->count; ++k) { |
334 | if (pds->list[k].tid == pdi->target_id && | 296 | if (pds->list[k].tid == pdi->target_id && |
335 | pds->list[k].lun == pdi->lun) { | 297 | pds->list[k].lun == pdi->lun) { |
336 | size = sprintf(buffer+len, | 298 | seq_printf(m, |
337 | " Retries: \t%-6d \tReassigns: \t%d\n", | 299 | " Retries: \t%-6d \tReassigns: \t%d\n", |
338 | pds->list[k].retries, | 300 | pds->list[k].retries, |
339 | pds->list[k].reassigns); | 301 | pds->list[k].reassigns); |
340 | len += size; pos = begin + len; | ||
341 | break; | 302 | break; |
342 | } | 303 | } |
343 | } | 304 | } |
@@ -355,32 +316,20 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
355 | pdef->sddc_type = 0x08; | 316 | pdef->sddc_type = 0x08; |
356 | 317 | ||
357 | if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) { | 318 | if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) { |
358 | size = sprintf(buffer+len, | 319 | seq_printf(m, |
359 | " Grown Defects:\t%d\n", | 320 | " Grown Defects:\t%d\n", |
360 | pdef->sddc_cnt); | 321 | pdef->sddc_cnt); |
361 | len += size; pos = begin + len; | ||
362 | } | 322 | } |
363 | } | 323 | } |
364 | if (pos < offset) { | ||
365 | len = 0; | ||
366 | begin = pos; | ||
367 | } | ||
368 | if (pos > offset + length) { | ||
369 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
370 | goto stop_output; | ||
371 | } | ||
372 | } | 324 | } |
373 | } | 325 | } |
374 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 326 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
375 | 327 | ||
376 | if (!flag) { | 328 | if (!flag) |
377 | size = sprintf(buffer+len, "\n --\n"); | 329 | seq_printf(m, "\n --\n"); |
378 | len += size; pos = begin + len; | ||
379 | } | ||
380 | 330 | ||
381 | /* 3. about logical drives */ | 331 | /* 3. about logical drives */ |
382 | size = sprintf(buffer+len,"\nLogical Drives:"); | 332 | seq_printf(m,"\nLogical Drives:"); |
383 | len += size; pos = begin + len; | ||
384 | flag = FALSE; | 333 | flag = FALSE; |
385 | 334 | ||
386 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 335 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -418,10 +367,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
418 | } | 367 | } |
419 | 368 | ||
420 | if (drv_no == i) { | 369 | if (drv_no == i) { |
421 | size = sprintf(buffer+len, | 370 | seq_printf(m, |
422 | "\n Number: \t%-2d \tStatus: \t%s\n", | 371 | "\n Number: \t%-2d \tStatus: \t%s\n", |
423 | drv_no, hrec); | 372 | drv_no, hrec); |
424 | len += size; pos = begin + len; | ||
425 | flag = TRUE; | 373 | flag = TRUE; |
426 | no_mdrv = pcdi->cd_ldcnt; | 374 | no_mdrv = pcdi->cd_ldcnt; |
427 | if (no_mdrv > 1 || pcdi->ld_slave != -1) { | 375 | if (no_mdrv > 1 || pcdi->ld_slave != -1) { |
@@ -436,61 +384,37 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
436 | } else { | 384 | } else { |
437 | strcpy(hrec, "???"); | 385 | strcpy(hrec, "???"); |
438 | } | 386 | } |
439 | size = sprintf(buffer+len, | 387 | seq_printf(m, |
440 | " Capacity [MB]:\t%-6d \tType: \t%s\n", | 388 | " Capacity [MB]:\t%-6d \tType: \t%s\n", |
441 | pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize), | 389 | pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize), |
442 | hrec); | 390 | hrec); |
443 | len += size; pos = begin + len; | ||
444 | } else { | 391 | } else { |
445 | size = sprintf(buffer+len, | 392 | seq_printf(m, |
446 | " Slave Number: \t%-2d \tStatus: \t%s\n", | 393 | " Slave Number: \t%-2d \tStatus: \t%s\n", |
447 | drv_no & 0x7fff, hrec); | 394 | drv_no & 0x7fff, hrec); |
448 | len += size; pos = begin + len; | ||
449 | } | 395 | } |
450 | drv_no = pcdi->ld_slave; | 396 | drv_no = pcdi->ld_slave; |
451 | if (pos < offset) { | ||
452 | len = 0; | ||
453 | begin = pos; | ||
454 | } | ||
455 | if (pos > offset + length) { | ||
456 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
457 | goto stop_output; | ||
458 | } | ||
459 | } while (drv_no != -1); | 397 | } while (drv_no != -1); |
460 | 398 | ||
461 | if (is_mirr) { | 399 | if (is_mirr) |
462 | size = sprintf(buffer+len, | 400 | seq_printf(m, |
463 | " Missing Drv.: \t%-2d \tInvalid Drv.: \t%d\n", | 401 | " Missing Drv.: \t%-2d \tInvalid Drv.: \t%d\n", |
464 | no_mdrv - j - k, k); | 402 | no_mdrv - j - k, k); |
465 | len += size; pos = begin + len; | 403 | |
466 | } | ||
467 | |||
468 | if (!ha->hdr[i].is_arraydrv) | 404 | if (!ha->hdr[i].is_arraydrv) |
469 | strcpy(hrec, "--"); | 405 | strcpy(hrec, "--"); |
470 | else | 406 | else |
471 | sprintf(hrec, "%d", ha->hdr[i].master_no); | 407 | sprintf(hrec, "%d", ha->hdr[i].master_no); |
472 | size = sprintf(buffer+len, | 408 | seq_printf(m, |
473 | " To Array Drv.:\t%s\n", hrec); | 409 | " To Array Drv.:\t%s\n", hrec); |
474 | len += size; pos = begin + len; | ||
475 | if (pos < offset) { | ||
476 | len = 0; | ||
477 | begin = pos; | ||
478 | } | ||
479 | if (pos > offset + length) { | ||
480 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
481 | goto stop_output; | ||
482 | } | ||
483 | } | 410 | } |
484 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 411 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
485 | 412 | ||
486 | if (!flag) { | 413 | if (!flag) |
487 | size = sprintf(buffer+len, "\n --\n"); | 414 | seq_printf(m, "\n --\n"); |
488 | len += size; pos = begin + len; | ||
489 | } | ||
490 | 415 | ||
491 | /* 4. about array drives */ | 416 | /* 4. about array drives */ |
492 | size = sprintf(buffer+len,"\nArray Drives:"); | 417 | seq_printf(m,"\nArray Drives:"); |
493 | len += size; pos = begin + len; | ||
494 | flag = FALSE; | 418 | flag = FALSE; |
495 | 419 | ||
496 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 420 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -525,10 +449,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
525 | strcat(hrec, "/expand"); | 449 | strcat(hrec, "/expand"); |
526 | else if (pai->ai_ext_state & 0x1) | 450 | else if (pai->ai_ext_state & 0x1) |
527 | strcat(hrec, "/patch"); | 451 | strcat(hrec, "/patch"); |
528 | size = sprintf(buffer+len, | 452 | seq_printf(m, |
529 | "\n Number: \t%-2d \tStatus: \t%s\n", | 453 | "\n Number: \t%-2d \tStatus: \t%s\n", |
530 | i,hrec); | 454 | i,hrec); |
531 | len += size; pos = begin + len; | ||
532 | flag = TRUE; | 455 | flag = TRUE; |
533 | 456 | ||
534 | if (pai->ai_type == 0) | 457 | if (pai->ai_type == 0) |
@@ -539,31 +462,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
539 | strcpy(hrec, "RAID-5"); | 462 | strcpy(hrec, "RAID-5"); |
540 | else | 463 | else |
541 | strcpy(hrec, "RAID-10"); | 464 | strcpy(hrec, "RAID-10"); |
542 | size = sprintf(buffer+len, | 465 | seq_printf(m, |
543 | " Capacity [MB]:\t%-6d \tType: \t%s\n", | 466 | " Capacity [MB]:\t%-6d \tType: \t%s\n", |
544 | pai->ai_size/(1024*1024/pai->ai_secsize), | 467 | pai->ai_size/(1024*1024/pai->ai_secsize), |
545 | hrec); | 468 | hrec); |
546 | len += size; pos = begin + len; | ||
547 | if (pos < offset) { | ||
548 | len = 0; | ||
549 | begin = pos; | ||
550 | } | ||
551 | if (pos > offset + length) { | ||
552 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
553 | goto stop_output; | ||
554 | } | ||
555 | } | 469 | } |
556 | } | 470 | } |
557 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 471 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
558 | 472 | ||
559 | if (!flag) { | 473 | if (!flag) |
560 | size = sprintf(buffer+len, "\n --\n"); | 474 | seq_printf(m, "\n --\n"); |
561 | len += size; pos = begin + len; | ||
562 | } | ||
563 | 475 | ||
564 | /* 5. about host drives */ | 476 | /* 5. about host drives */ |
565 | size = sprintf(buffer+len,"\nHost Drives:"); | 477 | seq_printf(m,"\nHost Drives:"); |
566 | len += size; pos = begin + len; | ||
567 | flag = FALSE; | 478 | flag = FALSE; |
568 | 479 | ||
569 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); | 480 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); |
@@ -605,33 +516,22 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
605 | if (!(ha->hdr[i].present)) | 516 | if (!(ha->hdr[i].present)) |
606 | continue; | 517 | continue; |
607 | 518 | ||
608 | size = sprintf(buffer+len, | 519 | seq_printf(m, |
609 | "\n Number: \t%-2d \tArr/Log. Drive:\t%d\n", | 520 | "\n Number: \t%-2d \tArr/Log. Drive:\t%d\n", |
610 | i, ha->hdr[i].ldr_no); | 521 | i, ha->hdr[i].ldr_no); |
611 | len += size; pos = begin + len; | ||
612 | flag = TRUE; | 522 | flag = TRUE; |
613 | 523 | ||
614 | size = sprintf(buffer+len, | 524 | seq_printf(m, |
615 | " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n", | 525 | " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n", |
616 | (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); | 526 | (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); |
617 | len += size; pos = begin + len; | ||
618 | if (pos < offset) { | ||
619 | len = 0; | ||
620 | begin = pos; | ||
621 | } | ||
622 | if (pos > offset + length) | ||
623 | goto stop_output; | ||
624 | } | 527 | } |
625 | 528 | ||
626 | if (!flag) { | 529 | if (!flag) |
627 | size = sprintf(buffer+len, "\n --\n"); | 530 | seq_printf(m, "\n --\n"); |
628 | len += size; pos = begin + len; | ||
629 | } | ||
630 | } | 531 | } |
631 | 532 | ||
632 | /* controller events */ | 533 | /* controller events */ |
633 | size = sprintf(buffer+len,"\nController Events:\n"); | 534 | seq_printf(m,"\nController Events:\n"); |
634 | len += size; pos = begin + len; | ||
635 | 535 | ||
636 | for (id = -1;;) { | 536 | for (id = -1;;) { |
637 | id = gdth_read_event(ha, id, estr); | 537 | id = gdth_read_event(ha, id, estr); |
@@ -643,29 +543,14 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
643 | do_gettimeofday(&tv); | 543 | do_gettimeofday(&tv); |
644 | sec = (int)(tv.tv_sec - estr->first_stamp); | 544 | sec = (int)(tv.tv_sec - estr->first_stamp); |
645 | if (sec < 0) sec = 0; | 545 | if (sec < 0) sec = 0; |
646 | size = sprintf(buffer+len," date- %02d:%02d:%02d\t%s\n", | 546 | seq_printf(m," date- %02d:%02d:%02d\t%s\n", |
647 | sec/3600, sec%3600/60, sec%60, hrec); | 547 | sec/3600, sec%3600/60, sec%60, hrec); |
648 | len += size; pos = begin + len; | ||
649 | if (pos < offset) { | ||
650 | len = 0; | ||
651 | begin = pos; | ||
652 | } | ||
653 | if (pos > offset + length) | ||
654 | goto stop_output; | ||
655 | } | 548 | } |
656 | if (id == -1) | 549 | if (id == -1) |
657 | break; | 550 | break; |
658 | } | 551 | } |
659 | |||
660 | stop_output: | 552 | stop_output: |
661 | *start = buffer +(offset-begin); | 553 | rc = 0; |
662 | len -= (offset-begin); | ||
663 | if (len > length) | ||
664 | len = length; | ||
665 | TRACE2(("get_info() len %d pos %d begin %d offset %d length %d size %d\n", | ||
666 | len,(int)pos,(int)begin,(int)offset,length,size)); | ||
667 | rc = len; | ||
668 | |||
669 | free_fail: | 554 | free_fail: |
670 | kfree(gdtcmd); | 555 | kfree(gdtcmd); |
671 | kfree(estr); | 556 | kfree(estr); |
diff --git a/drivers/scsi/gdth_proc.h b/drivers/scsi/gdth_proc.h index dab15f59f2cc..aaa618198972 100644 --- a/drivers/scsi/gdth_proc.h +++ b/drivers/scsi/gdth_proc.h | |||
@@ -8,11 +8,6 @@ | |||
8 | int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd, | 8 | int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd, |
9 | int timeout, u32 *info); | 9 | int timeout, u32 *info); |
10 | 10 | ||
11 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | ||
12 | gdth_ha_str *ha); | ||
13 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | ||
14 | struct Scsi_Host *host, gdth_ha_str *ha); | ||
15 | |||
16 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | 11 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, |
17 | int length, gdth_ha_str *ha); | 12 | int length, gdth_ha_str *ha); |
18 | 13 | ||
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index dbe4cc6b9f8b..2203ac281103 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c | |||
@@ -191,7 +191,8 @@ static int gvp11_bus_reset(struct scsi_cmnd *cmd) | |||
191 | static struct scsi_host_template gvp11_scsi_template = { | 191 | static struct scsi_host_template gvp11_scsi_template = { |
192 | .module = THIS_MODULE, | 192 | .module = THIS_MODULE, |
193 | .name = "GVP Series II SCSI", | 193 | .name = "GVP Series II SCSI", |
194 | .proc_info = wd33c93_proc_info, | 194 | .show_info = wd33c93_show_info, |
195 | .write_info = wd33c93_write_info, | ||
195 | .proc_name = "GVP11", | 196 | .proc_name = "GVP11", |
196 | .queuecommand = wd33c93_queuecommand, | 197 | .queuecommand = wd33c93_queuecommand, |
197 | .eh_abort_handler = wd33c93_abort, | 198 | .eh_abort_handler = wd33c93_abort, |
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 26cd9d1d7571..89a8266560d0 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c | |||
@@ -121,45 +121,26 @@ static inline void imm_pb_release(imm_struct *dev) | |||
121 | * testing... | 121 | * testing... |
122 | * Also gives a method to use a script to obtain optimum timings (TODO) | 122 | * Also gives a method to use a script to obtain optimum timings (TODO) |
123 | */ | 123 | */ |
124 | static inline int imm_proc_write(imm_struct *dev, char *buffer, int length) | 124 | static int imm_write_info(struct Scsi_Host *host, char *buffer, int length) |
125 | { | 125 | { |
126 | unsigned long x; | 126 | imm_struct *dev = imm_dev(host); |
127 | 127 | ||
128 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { | 128 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { |
129 | x = simple_strtoul(buffer + 5, NULL, 0); | 129 | dev->mode = simple_strtoul(buffer + 5, NULL, 0); |
130 | dev->mode = x; | ||
131 | return length; | 130 | return length; |
132 | } | 131 | } |
133 | printk("imm /proc: invalid variable\n"); | 132 | printk("imm /proc: invalid variable\n"); |
134 | return (-EINVAL); | 133 | return -EINVAL; |
135 | } | 134 | } |
136 | 135 | ||
137 | static int imm_proc_info(struct Scsi_Host *host, char *buffer, char **start, | 136 | static int imm_show_info(struct seq_file *m, struct Scsi_Host *host) |
138 | off_t offset, int length, int inout) | ||
139 | { | 137 | { |
140 | imm_struct *dev = imm_dev(host); | 138 | imm_struct *dev = imm_dev(host); |
141 | int len = 0; | ||
142 | |||
143 | if (inout) | ||
144 | return imm_proc_write(dev, buffer, length); | ||
145 | |||
146 | len += sprintf(buffer + len, "Version : %s\n", IMM_VERSION); | ||
147 | len += | ||
148 | sprintf(buffer + len, "Parport : %s\n", | ||
149 | dev->dev->port->name); | ||
150 | len += | ||
151 | sprintf(buffer + len, "Mode : %s\n", | ||
152 | IMM_MODE_STRING[dev->mode]); | ||
153 | 139 | ||
154 | /* Request for beyond end of buffer */ | 140 | seq_printf(m, "Version : %s\n", IMM_VERSION); |
155 | if (offset > len) | 141 | seq_printf(m, "Parport : %s\n", dev->dev->port->name); |
156 | return 0; | 142 | seq_printf(m, "Mode : %s\n", IMM_MODE_STRING[dev->mode]); |
157 | 143 | return 0; | |
158 | *start = buffer + offset; | ||
159 | len -= offset; | ||
160 | if (len > length) | ||
161 | len = length; | ||
162 | return len; | ||
163 | } | 144 | } |
164 | 145 | ||
165 | #if IMM_DEBUG > 0 | 146 | #if IMM_DEBUG > 0 |
@@ -1118,7 +1099,8 @@ static int imm_adjust_queue(struct scsi_device *device) | |||
1118 | static struct scsi_host_template imm_template = { | 1099 | static struct scsi_host_template imm_template = { |
1119 | .module = THIS_MODULE, | 1100 | .module = THIS_MODULE, |
1120 | .proc_name = "imm", | 1101 | .proc_name = "imm", |
1121 | .proc_info = imm_proc_info, | 1102 | .show_info = imm_show_info, |
1103 | .write_info = imm_write_info, | ||
1122 | .name = "Iomega VPI2 (imm) interface", | 1104 | .name = "Iomega VPI2 (imm) interface", |
1123 | .queuecommand = imm_queuecommand, | 1105 | .queuecommand = imm_queuecommand, |
1124 | .eh_abort_handler = imm_abort, | 1106 | .eh_abort_handler = imm_abort, |
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index deb5b6d8398e..bf028218ac36 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c | |||
@@ -2166,152 +2166,117 @@ static int in2000_biosparam(struct scsi_device *sdev, struct block_device *bdev, | |||
2166 | } | 2166 | } |
2167 | 2167 | ||
2168 | 2168 | ||
2169 | static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) | 2169 | static int in2000_write_info(struct Scsi_Host *instance, char *buf, int len) |
2170 | { | 2170 | { |
2171 | 2171 | ||
2172 | #ifdef PROC_INTERFACE | 2172 | #ifdef PROC_INTERFACE |
2173 | 2173 | ||
2174 | char *bp; | 2174 | char *bp; |
2175 | char tbuf[128]; | ||
2176 | unsigned long flags; | ||
2177 | struct IN2000_hostdata *hd; | 2175 | struct IN2000_hostdata *hd; |
2178 | Scsi_Cmnd *cmd; | ||
2179 | int x, i; | 2176 | int x, i; |
2180 | static int stop = 0; | ||
2181 | 2177 | ||
2182 | hd = (struct IN2000_hostdata *) instance->hostdata; | 2178 | hd = (struct IN2000_hostdata *) instance->hostdata; |
2183 | 2179 | ||
2184 | /* If 'in' is TRUE we need to _read_ the proc file. We accept the following | 2180 | buf[len] = '\0'; |
2185 | * keywords (same format as command-line, but only ONE per read): | 2181 | bp = buf; |
2186 | * debug | 2182 | if (!strncmp(bp, "debug:", 6)) { |
2187 | * disconnect | 2183 | bp += 6; |
2188 | * period | 2184 | hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK; |
2189 | * resync | 2185 | } else if (!strncmp(bp, "disconnect:", 11)) { |
2190 | * proc | 2186 | bp += 11; |
2191 | */ | 2187 | x = simple_strtoul(bp, NULL, 0); |
2192 | 2188 | if (x < DIS_NEVER || x > DIS_ALWAYS) | |
2193 | if (in) { | 2189 | x = DIS_ADAPTIVE; |
2194 | buf[len] = '\0'; | 2190 | hd->disconnect = x; |
2195 | bp = buf; | 2191 | } else if (!strncmp(bp, "period:", 7)) { |
2196 | if (!strncmp(bp, "debug:", 6)) { | 2192 | bp += 7; |
2197 | bp += 6; | 2193 | x = simple_strtoul(bp, NULL, 0); |
2198 | hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK; | 2194 | hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns; |
2199 | } else if (!strncmp(bp, "disconnect:", 11)) { | 2195 | } else if (!strncmp(bp, "resync:", 7)) { |
2200 | bp += 11; | 2196 | bp += 7; |
2201 | x = simple_strtoul(bp, NULL, 0); | 2197 | x = simple_strtoul(bp, NULL, 0); |
2202 | if (x < DIS_NEVER || x > DIS_ALWAYS) | 2198 | for (i = 0; i < 7; i++) |
2203 | x = DIS_ADAPTIVE; | 2199 | if (x & (1 << i)) |
2204 | hd->disconnect = x; | 2200 | hd->sync_stat[i] = SS_UNSET; |
2205 | } else if (!strncmp(bp, "period:", 7)) { | 2201 | } else if (!strncmp(bp, "proc:", 5)) { |
2206 | bp += 7; | 2202 | bp += 5; |
2207 | x = simple_strtoul(bp, NULL, 0); | 2203 | hd->proc = simple_strtoul(bp, NULL, 0); |
2208 | hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns; | 2204 | } else if (!strncmp(bp, "level2:", 7)) { |
2209 | } else if (!strncmp(bp, "resync:", 7)) { | 2205 | bp += 7; |
2210 | bp += 7; | 2206 | hd->level2 = simple_strtoul(bp, NULL, 0); |
2211 | x = simple_strtoul(bp, NULL, 0); | ||
2212 | for (i = 0; i < 7; i++) | ||
2213 | if (x & (1 << i)) | ||
2214 | hd->sync_stat[i] = SS_UNSET; | ||
2215 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2216 | bp += 5; | ||
2217 | hd->proc = simple_strtoul(bp, NULL, 0); | ||
2218 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2219 | bp += 7; | ||
2220 | hd->level2 = simple_strtoul(bp, NULL, 0); | ||
2221 | } | ||
2222 | return len; | ||
2223 | } | 2207 | } |
2208 | #endif | ||
2209 | return len; | ||
2210 | } | ||
2211 | |||
2212 | static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance) | ||
2213 | { | ||
2214 | |||
2215 | #ifdef PROC_INTERFACE | ||
2216 | unsigned long flags; | ||
2217 | struct IN2000_hostdata *hd; | ||
2218 | Scsi_Cmnd *cmd; | ||
2219 | int x; | ||
2220 | |||
2221 | hd = (struct IN2000_hostdata *) instance->hostdata; | ||
2224 | 2222 | ||
2225 | spin_lock_irqsave(instance->host_lock, flags); | 2223 | spin_lock_irqsave(instance->host_lock, flags); |
2226 | bp = buf; | 2224 | if (hd->proc & PR_VERSION) |
2227 | *bp = '\0'; | 2225 | seq_printf(m, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE); |
2228 | if (hd->proc & PR_VERSION) { | 2226 | |
2229 | sprintf(tbuf, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE); | ||
2230 | strcat(bp, tbuf); | ||
2231 | } | ||
2232 | if (hd->proc & PR_INFO) { | 2227 | if (hd->proc & PR_INFO) { |
2233 | sprintf(tbuf, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No"); | 2228 | seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No"); |
2234 | strcat(bp, tbuf); | 2229 | seq_printf(m, "\nsync_xfer[] = "); |
2235 | strcat(bp, "\nsync_xfer[] = "); | 2230 | for (x = 0; x < 7; x++) |
2236 | for (x = 0; x < 7; x++) { | 2231 | seq_printf(m, "\t%02x", hd->sync_xfer[x]); |
2237 | sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); | 2232 | seq_printf(m, "\nsync_stat[] = "); |
2238 | strcat(bp, tbuf); | 2233 | for (x = 0; x < 7; x++) |
2239 | } | 2234 | seq_printf(m, "\t%02x", hd->sync_stat[x]); |
2240 | strcat(bp, "\nsync_stat[] = "); | ||
2241 | for (x = 0; x < 7; x++) { | ||
2242 | sprintf(tbuf, "\t%02x", hd->sync_stat[x]); | ||
2243 | strcat(bp, tbuf); | ||
2244 | } | ||
2245 | } | 2235 | } |
2246 | #ifdef PROC_STATISTICS | 2236 | #ifdef PROC_STATISTICS |
2247 | if (hd->proc & PR_STATISTICS) { | 2237 | if (hd->proc & PR_STATISTICS) { |
2248 | strcat(bp, "\ncommands issued: "); | 2238 | seq_printf(m, "\ncommands issued: "); |
2249 | for (x = 0; x < 7; x++) { | 2239 | for (x = 0; x < 7; x++) |
2250 | sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); | 2240 | seq_printf(m, "\t%ld", hd->cmd_cnt[x]); |
2251 | strcat(bp, tbuf); | 2241 | seq_printf(m, "\ndisconnects allowed:"); |
2252 | } | 2242 | for (x = 0; x < 7; x++) |
2253 | strcat(bp, "\ndisconnects allowed:"); | 2243 | seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]); |
2254 | for (x = 0; x < 7; x++) { | 2244 | seq_printf(m, "\ndisconnects done: "); |
2255 | sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); | 2245 | for (x = 0; x < 7; x++) |
2256 | strcat(bp, tbuf); | 2246 | seq_printf(m, "\t%ld", hd->disc_done_cnt[x]); |
2257 | } | 2247 | seq_printf(m, "\ninterrupts: \t%ld", hd->int_cnt); |
2258 | strcat(bp, "\ndisconnects done: "); | ||
2259 | for (x = 0; x < 7; x++) { | ||
2260 | sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]); | ||
2261 | strcat(bp, tbuf); | ||
2262 | } | ||
2263 | sprintf(tbuf, "\ninterrupts: \t%ld", hd->int_cnt); | ||
2264 | strcat(bp, tbuf); | ||
2265 | } | 2248 | } |
2266 | #endif | 2249 | #endif |
2267 | if (hd->proc & PR_CONNECTED) { | 2250 | if (hd->proc & PR_CONNECTED) { |
2268 | strcat(bp, "\nconnected: "); | 2251 | seq_printf(m, "\nconnected: "); |
2269 | if (hd->connected) { | 2252 | if (hd->connected) { |
2270 | cmd = (Scsi_Cmnd *) hd->connected; | 2253 | cmd = (Scsi_Cmnd *) hd->connected; |
2271 | sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2254 | seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2272 | strcat(bp, tbuf); | ||
2273 | } | 2255 | } |
2274 | } | 2256 | } |
2275 | if (hd->proc & PR_INPUTQ) { | 2257 | if (hd->proc & PR_INPUTQ) { |
2276 | strcat(bp, "\ninput_Q: "); | 2258 | seq_printf(m, "\ninput_Q: "); |
2277 | cmd = (Scsi_Cmnd *) hd->input_Q; | 2259 | cmd = (Scsi_Cmnd *) hd->input_Q; |
2278 | while (cmd) { | 2260 | while (cmd) { |
2279 | sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2261 | seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2280 | strcat(bp, tbuf); | ||
2281 | cmd = (Scsi_Cmnd *) cmd->host_scribble; | 2262 | cmd = (Scsi_Cmnd *) cmd->host_scribble; |
2282 | } | 2263 | } |
2283 | } | 2264 | } |
2284 | if (hd->proc & PR_DISCQ) { | 2265 | if (hd->proc & PR_DISCQ) { |
2285 | strcat(bp, "\ndisconnected_Q:"); | 2266 | seq_printf(m, "\ndisconnected_Q:"); |
2286 | cmd = (Scsi_Cmnd *) hd->disconnected_Q; | 2267 | cmd = (Scsi_Cmnd *) hd->disconnected_Q; |
2287 | while (cmd) { | 2268 | while (cmd) { |
2288 | sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2269 | seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2289 | strcat(bp, tbuf); | ||
2290 | cmd = (Scsi_Cmnd *) cmd->host_scribble; | 2270 | cmd = (Scsi_Cmnd *) cmd->host_scribble; |
2291 | } | 2271 | } |
2292 | } | 2272 | } |
2293 | if (hd->proc & PR_TEST) { | 2273 | if (hd->proc & PR_TEST) { |
2294 | ; /* insert your own custom function here */ | 2274 | ; /* insert your own custom function here */ |
2295 | } | 2275 | } |
2296 | strcat(bp, "\n"); | 2276 | seq_printf(m, "\n"); |
2297 | spin_unlock_irqrestore(instance->host_lock, flags); | 2277 | spin_unlock_irqrestore(instance->host_lock, flags); |
2298 | *start = buf; | ||
2299 | if (stop) { | ||
2300 | stop = 0; | ||
2301 | return 0; /* return 0 to signal end-of-file */ | ||
2302 | } | ||
2303 | if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */ | ||
2304 | stop = 1; | ||
2305 | if (hd->proc & PR_STOP) /* stop every other time */ | ||
2306 | stop = 1; | ||
2307 | return strlen(bp); | ||
2308 | |||
2309 | #else /* PROC_INTERFACE */ | ||
2310 | |||
2311 | return 0; | ||
2312 | |||
2313 | #endif /* PROC_INTERFACE */ | 2278 | #endif /* PROC_INTERFACE */ |
2314 | 2279 | return 0; | |
2315 | } | 2280 | } |
2316 | 2281 | ||
2317 | MODULE_LICENSE("GPL"); | 2282 | MODULE_LICENSE("GPL"); |
@@ -2319,7 +2284,8 @@ MODULE_LICENSE("GPL"); | |||
2319 | 2284 | ||
2320 | static struct scsi_host_template driver_template = { | 2285 | static struct scsi_host_template driver_template = { |
2321 | .proc_name = "in2000", | 2286 | .proc_name = "in2000", |
2322 | .proc_info = in2000_proc_info, | 2287 | .write_info = in2000_write_info, |
2288 | .show_info = in2000_show_info, | ||
2323 | .name = "Always IN2000", | 2289 | .name = "Always IN2000", |
2324 | .detect = in2000_detect, | 2290 | .detect = in2000_detect, |
2325 | .release = in2000_release, | 2291 | .release = in2000_release, |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 9aa86a315a08..8d5ea8a1e5a6 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -326,10 +326,9 @@ static void ips_scmd_buf_write(struct scsi_cmnd * scmd, void *data, | |||
326 | static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data, | 326 | static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data, |
327 | unsigned int count); | 327 | unsigned int count); |
328 | 328 | ||
329 | static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); | 329 | static int ips_write_info(struct Scsi_Host *, char *, int); |
330 | static int ips_host_info(ips_ha_t *, char *, off_t, int); | 330 | static int ips_show_info(struct seq_file *, struct Scsi_Host *); |
331 | static void copy_mem_info(IPS_INFOSTR *, char *, int); | 331 | static int ips_host_info(ips_ha_t *, struct seq_file *); |
332 | static int copy_info(IPS_INFOSTR *, char *, ...); | ||
333 | static int ips_abort_init(ips_ha_t * ha, int index); | 332 | static int ips_abort_init(ips_ha_t * ha, int index); |
334 | static int ips_init_phase2(int index); | 333 | static int ips_init_phase2(int index); |
335 | 334 | ||
@@ -367,7 +366,8 @@ static struct scsi_host_template ips_driver_template = { | |||
367 | .eh_abort_handler = ips_eh_abort, | 366 | .eh_abort_handler = ips_eh_abort, |
368 | .eh_host_reset_handler = ips_eh_reset, | 367 | .eh_host_reset_handler = ips_eh_reset, |
369 | .proc_name = "ips", | 368 | .proc_name = "ips", |
370 | .proc_info = ips_proc_info, | 369 | .show_info = ips_show_info, |
370 | .write_info = ips_write_info, | ||
371 | .slave_configure = ips_slave_configure, | 371 | .slave_configure = ips_slave_configure, |
372 | .bios_param = ips_biosparam, | 372 | .bios_param = ips_biosparam, |
373 | .this_id = -1, | 373 | .this_id = -1, |
@@ -1433,25 +1433,12 @@ ips_info(struct Scsi_Host *SH) | |||
1433 | return (bp); | 1433 | return (bp); |
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | /****************************************************************************/ | ||
1437 | /* */ | ||
1438 | /* Routine Name: ips_proc_info */ | ||
1439 | /* */ | ||
1440 | /* Routine Description: */ | ||
1441 | /* */ | ||
1442 | /* The passthru interface for the driver */ | ||
1443 | /* */ | ||
1444 | /****************************************************************************/ | ||
1445 | static int | 1436 | static int |
1446 | ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 1437 | ips_write_info(struct Scsi_Host *host, char *buffer, int length) |
1447 | int length, int func) | ||
1448 | { | 1438 | { |
1449 | int i; | 1439 | int i; |
1450 | int ret; | ||
1451 | ips_ha_t *ha = NULL; | 1440 | ips_ha_t *ha = NULL; |
1452 | 1441 | ||
1453 | METHOD_TRACE("ips_proc_info", 1); | ||
1454 | |||
1455 | /* Find our host structure */ | 1442 | /* Find our host structure */ |
1456 | for (i = 0; i < ips_next_controller; i++) { | 1443 | for (i = 0; i < ips_next_controller; i++) { |
1457 | if (ips_sh[i]) { | 1444 | if (ips_sh[i]) { |
@@ -1465,18 +1452,29 @@ ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | |||
1465 | if (!ha) | 1452 | if (!ha) |
1466 | return (-EINVAL); | 1453 | return (-EINVAL); |
1467 | 1454 | ||
1468 | if (func) { | 1455 | return 0; |
1469 | /* write */ | 1456 | } |
1470 | return (0); | ||
1471 | } else { | ||
1472 | /* read */ | ||
1473 | if (start) | ||
1474 | *start = buffer; | ||
1475 | 1457 | ||
1476 | ret = ips_host_info(ha, buffer, offset, length); | 1458 | static int |
1459 | ips_show_info(struct seq_file *m, struct Scsi_Host *host) | ||
1460 | { | ||
1461 | int i; | ||
1462 | ips_ha_t *ha = NULL; | ||
1477 | 1463 | ||
1478 | return (ret); | 1464 | /* Find our host structure */ |
1465 | for (i = 0; i < ips_next_controller; i++) { | ||
1466 | if (ips_sh[i]) { | ||
1467 | if (ips_sh[i] == host) { | ||
1468 | ha = (ips_ha_t *) ips_sh[i]->hostdata; | ||
1469 | break; | ||
1470 | } | ||
1471 | } | ||
1479 | } | 1472 | } |
1473 | |||
1474 | if (!ha) | ||
1475 | return (-EINVAL); | ||
1476 | |||
1477 | return ips_host_info(ha, m); | ||
1480 | } | 1478 | } |
1481 | 1479 | ||
1482 | /*--------------------------------------------------------------------------*/ | 1480 | /*--------------------------------------------------------------------------*/ |
@@ -2035,183 +2033,113 @@ ips_cleanup_passthru(ips_ha_t * ha, ips_scb_t * scb) | |||
2035 | /* */ | 2033 | /* */ |
2036 | /****************************************************************************/ | 2034 | /****************************************************************************/ |
2037 | static int | 2035 | static int |
2038 | ips_host_info(ips_ha_t * ha, char *ptr, off_t offset, int len) | 2036 | ips_host_info(ips_ha_t *ha, struct seq_file *m) |
2039 | { | 2037 | { |
2040 | IPS_INFOSTR info; | ||
2041 | |||
2042 | METHOD_TRACE("ips_host_info", 1); | 2038 | METHOD_TRACE("ips_host_info", 1); |
2043 | 2039 | ||
2044 | info.buffer = ptr; | 2040 | seq_printf(m, "\nIBM ServeRAID General Information:\n\n"); |
2045 | info.length = len; | ||
2046 | info.offset = offset; | ||
2047 | info.pos = 0; | ||
2048 | info.localpos = 0; | ||
2049 | |||
2050 | copy_info(&info, "\nIBM ServeRAID General Information:\n\n"); | ||
2051 | 2041 | ||
2052 | if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && | 2042 | if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && |
2053 | (le16_to_cpu(ha->nvram->adapter_type) != 0)) | 2043 | (le16_to_cpu(ha->nvram->adapter_type) != 0)) |
2054 | copy_info(&info, "\tController Type : %s\n", | 2044 | seq_printf(m, "\tController Type : %s\n", |
2055 | ips_adapter_name[ha->ad_type - 1]); | 2045 | ips_adapter_name[ha->ad_type - 1]); |
2056 | else | 2046 | else |
2057 | copy_info(&info, | 2047 | seq_printf(m, |
2058 | "\tController Type : Unknown\n"); | 2048 | "\tController Type : Unknown\n"); |
2059 | 2049 | ||
2060 | if (ha->io_addr) | 2050 | if (ha->io_addr) |
2061 | copy_info(&info, | 2051 | seq_printf(m, |
2062 | "\tIO region : 0x%lx (%d bytes)\n", | 2052 | "\tIO region : 0x%x (%d bytes)\n", |
2063 | ha->io_addr, ha->io_len); | 2053 | ha->io_addr, ha->io_len); |
2064 | 2054 | ||
2065 | if (ha->mem_addr) { | 2055 | if (ha->mem_addr) { |
2066 | copy_info(&info, | 2056 | seq_printf(m, |
2067 | "\tMemory region : 0x%lx (%d bytes)\n", | 2057 | "\tMemory region : 0x%x (%d bytes)\n", |
2068 | ha->mem_addr, ha->mem_len); | 2058 | ha->mem_addr, ha->mem_len); |
2069 | copy_info(&info, | 2059 | seq_printf(m, |
2070 | "\tShared memory address : 0x%lx\n", | 2060 | "\tShared memory address : 0x%lx\n", |
2071 | ha->mem_ptr); | 2061 | (unsigned long)ha->mem_ptr); |
2072 | } | 2062 | } |
2073 | 2063 | ||
2074 | copy_info(&info, "\tIRQ number : %d\n", ha->pcidev->irq); | 2064 | seq_printf(m, "\tIRQ number : %d\n", ha->pcidev->irq); |
2075 | 2065 | ||
2076 | /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */ | 2066 | /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */ |
2077 | /* That keeps everything happy for "text" operations on the proc file. */ | 2067 | /* That keeps everything happy for "text" operations on the proc file. */ |
2078 | 2068 | ||
2079 | if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { | 2069 | if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { |
2080 | if (ha->nvram->bios_low[3] == 0) { | 2070 | if (ha->nvram->bios_low[3] == 0) { |
2081 | copy_info(&info, | 2071 | seq_printf(m, |
2082 | "\tBIOS Version : %c%c%c%c%c%c%c\n", | 2072 | "\tBIOS Version : %c%c%c%c%c%c%c\n", |
2083 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], | 2073 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], |
2084 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], | 2074 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], |
2085 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], | 2075 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], |
2086 | ha->nvram->bios_low[2]); | 2076 | ha->nvram->bios_low[2]); |
2087 | 2077 | ||
2088 | } else { | 2078 | } else { |
2089 | copy_info(&info, | 2079 | seq_printf(m, |
2090 | "\tBIOS Version : %c%c%c%c%c%c%c%c\n", | 2080 | "\tBIOS Version : %c%c%c%c%c%c%c%c\n", |
2091 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], | 2081 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], |
2092 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], | 2082 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], |
2093 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], | 2083 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], |
2094 | ha->nvram->bios_low[2], ha->nvram->bios_low[3]); | 2084 | ha->nvram->bios_low[2], ha->nvram->bios_low[3]); |
2095 | } | 2085 | } |
2096 | 2086 | ||
2097 | } | 2087 | } |
2098 | 2088 | ||
2099 | if (ha->enq->CodeBlkVersion[7] == 0) { | 2089 | if (ha->enq->CodeBlkVersion[7] == 0) { |
2100 | copy_info(&info, | 2090 | seq_printf(m, |
2101 | "\tFirmware Version : %c%c%c%c%c%c%c\n", | 2091 | "\tFirmware Version : %c%c%c%c%c%c%c\n", |
2102 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], | 2092 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], |
2103 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], | 2093 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], |
2104 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], | 2094 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], |
2105 | ha->enq->CodeBlkVersion[6]); | 2095 | ha->enq->CodeBlkVersion[6]); |
2106 | } else { | 2096 | } else { |
2107 | copy_info(&info, | 2097 | seq_printf(m, |
2108 | "\tFirmware Version : %c%c%c%c%c%c%c%c\n", | 2098 | "\tFirmware Version : %c%c%c%c%c%c%c%c\n", |
2109 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], | 2099 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], |
2110 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], | 2100 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], |
2111 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], | 2101 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], |
2112 | ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); | 2102 | ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); |
2113 | } | 2103 | } |
2114 | 2104 | ||
2115 | if (ha->enq->BootBlkVersion[7] == 0) { | 2105 | if (ha->enq->BootBlkVersion[7] == 0) { |
2116 | copy_info(&info, | 2106 | seq_printf(m, |
2117 | "\tBoot Block Version : %c%c%c%c%c%c%c\n", | 2107 | "\tBoot Block Version : %c%c%c%c%c%c%c\n", |
2118 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], | 2108 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], |
2119 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], | 2109 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], |
2120 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], | 2110 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], |
2121 | ha->enq->BootBlkVersion[6]); | 2111 | ha->enq->BootBlkVersion[6]); |
2122 | } else { | 2112 | } else { |
2123 | copy_info(&info, | 2113 | seq_printf(m, |
2124 | "\tBoot Block Version : %c%c%c%c%c%c%c%c\n", | 2114 | "\tBoot Block Version : %c%c%c%c%c%c%c%c\n", |
2125 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], | 2115 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], |
2126 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], | 2116 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], |
2127 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], | 2117 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], |
2128 | ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); | 2118 | ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); |
2129 | } | 2119 | } |
2130 | 2120 | ||
2131 | copy_info(&info, "\tDriver Version : %s%s\n", | 2121 | seq_printf(m, "\tDriver Version : %s%s\n", |
2132 | IPS_VERSION_HIGH, IPS_VERSION_LOW); | 2122 | IPS_VERSION_HIGH, IPS_VERSION_LOW); |
2133 | 2123 | ||
2134 | copy_info(&info, "\tDriver Build : %d\n", | 2124 | seq_printf(m, "\tDriver Build : %d\n", |
2135 | IPS_BUILD_IDENT); | 2125 | IPS_BUILD_IDENT); |
2136 | 2126 | ||
2137 | copy_info(&info, "\tMax Physical Devices : %d\n", | 2127 | seq_printf(m, "\tMax Physical Devices : %d\n", |
2138 | ha->enq->ucMaxPhysicalDevices); | 2128 | ha->enq->ucMaxPhysicalDevices); |
2139 | copy_info(&info, "\tMax Active Commands : %d\n", | 2129 | seq_printf(m, "\tMax Active Commands : %d\n", |
2140 | ha->max_cmds); | 2130 | ha->max_cmds); |
2141 | copy_info(&info, "\tCurrent Queued Commands : %d\n", | 2131 | seq_printf(m, "\tCurrent Queued Commands : %d\n", |
2142 | ha->scb_waitlist.count); | 2132 | ha->scb_waitlist.count); |
2143 | copy_info(&info, "\tCurrent Active Commands : %d\n", | 2133 | seq_printf(m, "\tCurrent Active Commands : %d\n", |
2144 | ha->scb_activelist.count - ha->num_ioctl); | 2134 | ha->scb_activelist.count - ha->num_ioctl); |
2145 | copy_info(&info, "\tCurrent Queued PT Commands : %d\n", | 2135 | seq_printf(m, "\tCurrent Queued PT Commands : %d\n", |
2146 | ha->copp_waitlist.count); | 2136 | ha->copp_waitlist.count); |
2147 | copy_info(&info, "\tCurrent Active PT Commands : %d\n", | 2137 | seq_printf(m, "\tCurrent Active PT Commands : %d\n", |
2148 | ha->num_ioctl); | 2138 | ha->num_ioctl); |
2149 | 2139 | ||
2150 | copy_info(&info, "\n"); | 2140 | seq_printf(m, "\n"); |
2151 | |||
2152 | return (info.localpos); | ||
2153 | } | ||
2154 | |||
2155 | /****************************************************************************/ | ||
2156 | /* */ | ||
2157 | /* Routine Name: copy_mem_info */ | ||
2158 | /* */ | ||
2159 | /* Routine Description: */ | ||
2160 | /* */ | ||
2161 | /* Copy data into an IPS_INFOSTR structure */ | ||
2162 | /* */ | ||
2163 | /****************************************************************************/ | ||
2164 | static void | ||
2165 | copy_mem_info(IPS_INFOSTR * info, char *data, int len) | ||
2166 | { | ||
2167 | METHOD_TRACE("copy_mem_info", 1); | ||
2168 | |||
2169 | if (info->pos + len < info->offset) { | ||
2170 | info->pos += len; | ||
2171 | return; | ||
2172 | } | ||
2173 | |||
2174 | if (info->pos < info->offset) { | ||
2175 | data += (info->offset - info->pos); | ||
2176 | len -= (info->offset - info->pos); | ||
2177 | info->pos += (info->offset - info->pos); | ||
2178 | } | ||
2179 | |||
2180 | if (info->localpos + len > info->length) | ||
2181 | len = info->length - info->localpos; | ||
2182 | 2141 | ||
2183 | if (len > 0) { | 2142 | return 0; |
2184 | memcpy(info->buffer + info->localpos, data, len); | ||
2185 | info->pos += len; | ||
2186 | info->localpos += len; | ||
2187 | } | ||
2188 | } | ||
2189 | |||
2190 | /****************************************************************************/ | ||
2191 | /* */ | ||
2192 | /* Routine Name: copy_info */ | ||
2193 | /* */ | ||
2194 | /* Routine Description: */ | ||
2195 | /* */ | ||
2196 | /* printf style wrapper for an info structure */ | ||
2197 | /* */ | ||
2198 | /****************************************************************************/ | ||
2199 | static int | ||
2200 | copy_info(IPS_INFOSTR * info, char *fmt, ...) | ||
2201 | { | ||
2202 | va_list args; | ||
2203 | char buf[128]; | ||
2204 | int len; | ||
2205 | |||
2206 | METHOD_TRACE("copy_info", 1); | ||
2207 | |||
2208 | va_start(args, fmt); | ||
2209 | len = vsprintf(buf, fmt, args); | ||
2210 | va_end(args); | ||
2211 | |||
2212 | copy_mem_info(info, buf, len); | ||
2213 | |||
2214 | return (len); | ||
2215 | } | 2143 | } |
2216 | 2144 | ||
2217 | /****************************************************************************/ | 2145 | /****************************************************************************/ |
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h index f2df0593332b..45b9566b928e 100644 --- a/drivers/scsi/ips.h +++ b/drivers/scsi/ips.h | |||
@@ -416,7 +416,6 @@ | |||
416 | /* | 416 | /* |
417 | * Scsi_Host Template | 417 | * Scsi_Host Template |
418 | */ | 418 | */ |
419 | static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); | ||
420 | static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, | 419 | static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, |
421 | sector_t capacity, int geom[]); | 420 | sector_t capacity, int geom[]); |
422 | static int ips_slave_configure(struct scsi_device *SDptr); | 421 | static int ips_slave_configure(struct scsi_device *SDptr); |
@@ -959,14 +958,6 @@ typedef union { | |||
959 | IPS_ENH_SG_LIST *enh_list; | 958 | IPS_ENH_SG_LIST *enh_list; |
960 | } IPS_SG_LIST; | 959 | } IPS_SG_LIST; |
961 | 960 | ||
962 | typedef struct _IPS_INFOSTR { | ||
963 | char *buffer; | ||
964 | int length; | ||
965 | int offset; | ||
966 | int pos; | ||
967 | int localpos; | ||
968 | } IPS_INFOSTR; | ||
969 | |||
970 | typedef struct { | 961 | typedef struct { |
971 | char *option_name; | 962 | char *option_name; |
972 | int *option_flag; | 963 | int *option_flag; |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 5da297290262..90b8b0515e23 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -10394,36 +10394,6 @@ lpfc_io_resume(struct pci_dev *pdev) | |||
10394 | return; | 10394 | return; |
10395 | } | 10395 | } |
10396 | 10396 | ||
10397 | /** | ||
10398 | * lpfc_mgmt_open - method called when 'lpfcmgmt' is opened from userspace | ||
10399 | * @inode: pointer to the inode representing the lpfcmgmt device | ||
10400 | * @filep: pointer to the file representing the open lpfcmgmt device | ||
10401 | * | ||
10402 | * This routine puts a reference count on the lpfc module whenever the | ||
10403 | * character device is opened | ||
10404 | **/ | ||
10405 | static int | ||
10406 | lpfc_mgmt_open(struct inode *inode, struct file *filep) | ||
10407 | { | ||
10408 | try_module_get(THIS_MODULE); | ||
10409 | return 0; | ||
10410 | } | ||
10411 | |||
10412 | /** | ||
10413 | * lpfc_mgmt_release - method called when 'lpfcmgmt' is closed in userspace | ||
10414 | * @inode: pointer to the inode representing the lpfcmgmt device | ||
10415 | * @filep: pointer to the file representing the open lpfcmgmt device | ||
10416 | * | ||
10417 | * This routine removes a reference count from the lpfc module when the | ||
10418 | * character device is closed | ||
10419 | **/ | ||
10420 | static int | ||
10421 | lpfc_mgmt_release(struct inode *inode, struct file *filep) | ||
10422 | { | ||
10423 | module_put(THIS_MODULE); | ||
10424 | return 0; | ||
10425 | } | ||
10426 | |||
10427 | static struct pci_device_id lpfc_id_table[] = { | 10397 | static struct pci_device_id lpfc_id_table[] = { |
10428 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER, | 10398 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER, |
10429 | PCI_ANY_ID, PCI_ANY_ID, }, | 10399 | PCI_ANY_ID, PCI_ANY_ID, }, |
@@ -10541,8 +10511,7 @@ static struct pci_driver lpfc_driver = { | |||
10541 | }; | 10511 | }; |
10542 | 10512 | ||
10543 | static const struct file_operations lpfc_mgmt_fop = { | 10513 | static const struct file_operations lpfc_mgmt_fop = { |
10544 | .open = lpfc_mgmt_open, | 10514 | .owner = THIS_MODULE, |
10545 | .release = lpfc_mgmt_release, | ||
10546 | }; | 10515 | }; |
10547 | 10516 | ||
10548 | static struct miscdevice lpfc_mgmt_dev = { | 10517 | static struct miscdevice lpfc_mgmt_dev = { |
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index 24828b54773a..858075723c87 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c | |||
@@ -561,7 +561,8 @@ static int macscsi_pwrite (struct Scsi_Host *instance, | |||
561 | 561 | ||
562 | static struct scsi_host_template driver_template = { | 562 | static struct scsi_host_template driver_template = { |
563 | .proc_name = "Mac5380", | 563 | .proc_name = "Mac5380", |
564 | .proc_info = macscsi_proc_info, | 564 | .show_info = macscsi_show_info, |
565 | .write_info = macscsi_write_info, | ||
565 | .name = "Macintosh NCR5380 SCSI", | 566 | .name = "Macintosh NCR5380 SCSI", |
566 | .detect = macscsi_detect, | 567 | .detect = macscsi_detect, |
567 | .release = macscsi_release, | 568 | .release = macscsi_release, |
diff --git a/drivers/scsi/mac_scsi.h b/drivers/scsi/mac_scsi.h index d26e331c6c12..7dc62fce1c4c 100644 --- a/drivers/scsi/mac_scsi.h +++ b/drivers/scsi/mac_scsi.h | |||
@@ -72,7 +72,8 @@ | |||
72 | #define NCR5380_queue_command macscsi_queue_command | 72 | #define NCR5380_queue_command macscsi_queue_command |
73 | #define NCR5380_abort macscsi_abort | 73 | #define NCR5380_abort macscsi_abort |
74 | #define NCR5380_bus_reset macscsi_bus_reset | 74 | #define NCR5380_bus_reset macscsi_bus_reset |
75 | #define NCR5380_proc_info macscsi_proc_info | 75 | #define NCR5380_show_info macscsi_show_info |
76 | #define NCR5380_write_info macscsi_write_info | ||
76 | 77 | ||
77 | #define BOARD_NORMAL 0 | 78 | #define BOARD_NORMAL 0 |
78 | #define BOARD_NCR53C400 1 | 79 | #define BOARD_NCR53C400 1 |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 9504ec0ec682..7373255aa1e8 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/completion.h> | 39 | #include <linux/completion.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/proc_fs.h> | 41 | #include <linux/proc_fs.h> |
42 | #include <linux/seq_file.h> | ||
42 | #include <linux/reboot.h> | 43 | #include <linux/reboot.h> |
43 | #include <linux/module.h> | 44 | #include <linux/module.h> |
44 | #include <linux/list.h> | 45 | #include <linux/list.h> |
@@ -2069,385 +2070,201 @@ mega_free_inquiry(void *inquiry, dma_addr_t dma_handle, struct pci_dev *pdev) | |||
2069 | #ifdef CONFIG_PROC_FS | 2070 | #ifdef CONFIG_PROC_FS |
2070 | /* Following code handles /proc fs */ | 2071 | /* Following code handles /proc fs */ |
2071 | 2072 | ||
2072 | #define CREATE_READ_PROC(string, func) create_proc_read_entry(string, \ | ||
2073 | S_IRUSR | S_IFREG, \ | ||
2074 | controller_proc_dir_entry, \ | ||
2075 | func, adapter) | ||
2076 | |||
2077 | /** | ||
2078 | * mega_create_proc_entry() | ||
2079 | * @index - index in soft state array | ||
2080 | * @parent - parent node for this /proc entry | ||
2081 | * | ||
2082 | * Creates /proc entries for our controllers. | ||
2083 | */ | ||
2084 | static void | ||
2085 | mega_create_proc_entry(int index, struct proc_dir_entry *parent) | ||
2086 | { | ||
2087 | struct proc_dir_entry *controller_proc_dir_entry = NULL; | ||
2088 | u8 string[64] = { 0 }; | ||
2089 | adapter_t *adapter = hba_soft_state[index]; | ||
2090 | |||
2091 | sprintf(string, "hba%d", adapter->host->host_no); | ||
2092 | |||
2093 | controller_proc_dir_entry = | ||
2094 | adapter->controller_proc_dir_entry = proc_mkdir(string, parent); | ||
2095 | |||
2096 | if(!controller_proc_dir_entry) { | ||
2097 | printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n"); | ||
2098 | return; | ||
2099 | } | ||
2100 | adapter->proc_read = CREATE_READ_PROC("config", proc_read_config); | ||
2101 | adapter->proc_stat = CREATE_READ_PROC("stat", proc_read_stat); | ||
2102 | adapter->proc_mbox = CREATE_READ_PROC("mailbox", proc_read_mbox); | ||
2103 | #if MEGA_HAVE_ENH_PROC | ||
2104 | adapter->proc_rr = CREATE_READ_PROC("rebuild-rate", proc_rebuild_rate); | ||
2105 | adapter->proc_battery = CREATE_READ_PROC("battery-status", | ||
2106 | proc_battery); | ||
2107 | |||
2108 | /* | ||
2109 | * Display each physical drive on its channel | ||
2110 | */ | ||
2111 | adapter->proc_pdrvstat[0] = CREATE_READ_PROC("diskdrives-ch0", | ||
2112 | proc_pdrv_ch0); | ||
2113 | adapter->proc_pdrvstat[1] = CREATE_READ_PROC("diskdrives-ch1", | ||
2114 | proc_pdrv_ch1); | ||
2115 | adapter->proc_pdrvstat[2] = CREATE_READ_PROC("diskdrives-ch2", | ||
2116 | proc_pdrv_ch2); | ||
2117 | adapter->proc_pdrvstat[3] = CREATE_READ_PROC("diskdrives-ch3", | ||
2118 | proc_pdrv_ch3); | ||
2119 | |||
2120 | /* | ||
2121 | * Display a set of up to 10 logical drive through each of following | ||
2122 | * /proc entries | ||
2123 | */ | ||
2124 | adapter->proc_rdrvstat[0] = CREATE_READ_PROC("raiddrives-0-9", | ||
2125 | proc_rdrv_10); | ||
2126 | adapter->proc_rdrvstat[1] = CREATE_READ_PROC("raiddrives-10-19", | ||
2127 | proc_rdrv_20); | ||
2128 | adapter->proc_rdrvstat[2] = CREATE_READ_PROC("raiddrives-20-29", | ||
2129 | proc_rdrv_30); | ||
2130 | adapter->proc_rdrvstat[3] = CREATE_READ_PROC("raiddrives-30-39", | ||
2131 | proc_rdrv_40); | ||
2132 | #endif | ||
2133 | } | ||
2134 | |||
2135 | |||
2136 | /** | 2073 | /** |
2137 | * proc_read_config() | 2074 | * proc_show_config() |
2138 | * @page - buffer to write the data in | 2075 | * @m - Synthetic file construction data |
2139 | * @start - where the actual data has been written in page | 2076 | * @v - File iterator |
2140 | * @offset - same meaning as the read system call | ||
2141 | * @count - same meaning as the read system call | ||
2142 | * @eof - set if no more data needs to be returned | ||
2143 | * @data - pointer to our soft state | ||
2144 | * | 2077 | * |
2145 | * Display configuration information about the controller. | 2078 | * Display configuration information about the controller. |
2146 | */ | 2079 | */ |
2147 | static int | 2080 | static int |
2148 | proc_read_config(char *page, char **start, off_t offset, int count, int *eof, | 2081 | proc_show_config(struct seq_file *m, void *v) |
2149 | void *data) | ||
2150 | { | 2082 | { |
2151 | 2083 | ||
2152 | adapter_t *adapter = (adapter_t *)data; | 2084 | adapter_t *adapter = m->private; |
2153 | int len = 0; | ||
2154 | |||
2155 | len += sprintf(page+len, "%s", MEGARAID_VERSION); | ||
2156 | 2085 | ||
2086 | seq_puts(m, MEGARAID_VERSION); | ||
2157 | if(adapter->product_info.product_name[0]) | 2087 | if(adapter->product_info.product_name[0]) |
2158 | len += sprintf(page+len, "%s\n", | 2088 | seq_printf(m, "%s\n", adapter->product_info.product_name); |
2159 | adapter->product_info.product_name); | ||
2160 | |||
2161 | len += sprintf(page+len, "Controller Type: "); | ||
2162 | 2089 | ||
2163 | if( adapter->flag & BOARD_MEMMAP ) { | 2090 | seq_puts(m, "Controller Type: "); |
2164 | len += sprintf(page+len, | ||
2165 | "438/466/467/471/493/518/520/531/532\n"); | ||
2166 | } | ||
2167 | else { | ||
2168 | len += sprintf(page+len, | ||
2169 | "418/428/434\n"); | ||
2170 | } | ||
2171 | 2091 | ||
2172 | if(adapter->flag & BOARD_40LD) { | 2092 | if( adapter->flag & BOARD_MEMMAP ) |
2173 | len += sprintf(page+len, | 2093 | seq_puts(m, "438/466/467/471/493/518/520/531/532\n"); |
2174 | "Controller Supports 40 Logical Drives\n"); | 2094 | else |
2175 | } | 2095 | seq_puts(m, "418/428/434\n"); |
2176 | 2096 | ||
2177 | if(adapter->flag & BOARD_64BIT) { | 2097 | if(adapter->flag & BOARD_40LD) |
2178 | len += sprintf(page+len, | 2098 | seq_puts(m, "Controller Supports 40 Logical Drives\n"); |
2179 | "Controller capable of 64-bit memory addressing\n"); | ||
2180 | } | ||
2181 | if( adapter->has_64bit_addr ) { | ||
2182 | len += sprintf(page+len, | ||
2183 | "Controller using 64-bit memory addressing\n"); | ||
2184 | } | ||
2185 | else { | ||
2186 | len += sprintf(page+len, | ||
2187 | "Controller is not using 64-bit memory addressing\n"); | ||
2188 | } | ||
2189 | 2099 | ||
2190 | len += sprintf(page+len, "Base = %08lx, Irq = %d, ", adapter->base, | 2100 | if(adapter->flag & BOARD_64BIT) |
2191 | adapter->host->irq); | 2101 | seq_puts(m, "Controller capable of 64-bit memory addressing\n"); |
2192 | 2102 | if( adapter->has_64bit_addr ) | |
2193 | len += sprintf(page+len, "Logical Drives = %d, Channels = %d\n", | 2103 | seq_puts(m, "Controller using 64-bit memory addressing\n"); |
2194 | adapter->numldrv, adapter->product_info.nchannels); | 2104 | else |
2195 | 2105 | seq_puts(m, "Controller is not using 64-bit memory addressing\n"); | |
2196 | len += sprintf(page+len, "Version =%s:%s, DRAM = %dMb\n", | 2106 | |
2197 | adapter->fw_version, adapter->bios_version, | 2107 | seq_printf(m, "Base = %08lx, Irq = %d, ", |
2198 | adapter->product_info.dram_size); | 2108 | adapter->base, adapter->host->irq); |
2199 | 2109 | ||
2200 | len += sprintf(page+len, | 2110 | seq_printf(m, "Logical Drives = %d, Channels = %d\n", |
2201 | "Controller Queue Depth = %d, Driver Queue Depth = %d\n", | 2111 | adapter->numldrv, adapter->product_info.nchannels); |
2202 | adapter->product_info.max_commands, adapter->max_cmds); | 2112 | |
2203 | 2113 | seq_printf(m, "Version =%s:%s, DRAM = %dMb\n", | |
2204 | len += sprintf(page+len, "support_ext_cdb = %d\n", | 2114 | adapter->fw_version, adapter->bios_version, |
2205 | adapter->support_ext_cdb); | 2115 | adapter->product_info.dram_size); |
2206 | len += sprintf(page+len, "support_random_del = %d\n", | 2116 | |
2207 | adapter->support_random_del); | 2117 | seq_printf(m, "Controller Queue Depth = %d, Driver Queue Depth = %d\n", |
2208 | len += sprintf(page+len, "boot_ldrv_enabled = %d\n", | 2118 | adapter->product_info.max_commands, adapter->max_cmds); |
2209 | adapter->boot_ldrv_enabled); | 2119 | |
2210 | len += sprintf(page+len, "boot_ldrv = %d\n", | 2120 | seq_printf(m, "support_ext_cdb = %d\n", adapter->support_ext_cdb); |
2211 | adapter->boot_ldrv); | 2121 | seq_printf(m, "support_random_del = %d\n", adapter->support_random_del); |
2212 | len += sprintf(page+len, "boot_pdrv_enabled = %d\n", | 2122 | seq_printf(m, "boot_ldrv_enabled = %d\n", adapter->boot_ldrv_enabled); |
2213 | adapter->boot_pdrv_enabled); | 2123 | seq_printf(m, "boot_ldrv = %d\n", adapter->boot_ldrv); |
2214 | len += sprintf(page+len, "boot_pdrv_ch = %d\n", | 2124 | seq_printf(m, "boot_pdrv_enabled = %d\n", adapter->boot_pdrv_enabled); |
2215 | adapter->boot_pdrv_ch); | 2125 | seq_printf(m, "boot_pdrv_ch = %d\n", adapter->boot_pdrv_ch); |
2216 | len += sprintf(page+len, "boot_pdrv_tgt = %d\n", | 2126 | seq_printf(m, "boot_pdrv_tgt = %d\n", adapter->boot_pdrv_tgt); |
2217 | adapter->boot_pdrv_tgt); | 2127 | seq_printf(m, "quiescent = %d\n", |
2218 | len += sprintf(page+len, "quiescent = %d\n", | 2128 | atomic_read(&adapter->quiescent)); |
2219 | atomic_read(&adapter->quiescent)); | 2129 | seq_printf(m, "has_cluster = %d\n", adapter->has_cluster); |
2220 | len += sprintf(page+len, "has_cluster = %d\n", | 2130 | |
2221 | adapter->has_cluster); | 2131 | seq_puts(m, "\nModule Parameters:\n"); |
2222 | 2132 | seq_printf(m, "max_cmd_per_lun = %d\n", max_cmd_per_lun); | |
2223 | len += sprintf(page+len, "\nModule Parameters:\n"); | 2133 | seq_printf(m, "max_sectors_per_io = %d\n", max_sectors_per_io); |
2224 | len += sprintf(page+len, "max_cmd_per_lun = %d\n", | 2134 | return 0; |
2225 | max_cmd_per_lun); | ||
2226 | len += sprintf(page+len, "max_sectors_per_io = %d\n", | ||
2227 | max_sectors_per_io); | ||
2228 | |||
2229 | *eof = 1; | ||
2230 | |||
2231 | return len; | ||
2232 | } | 2135 | } |
2233 | 2136 | ||
2234 | |||
2235 | |||
2236 | /** | 2137 | /** |
2237 | * proc_read_stat() | 2138 | * proc_show_stat() |
2238 | * @page - buffer to write the data in | 2139 | * @m - Synthetic file construction data |
2239 | * @start - where the actual data has been written in page | 2140 | * @v - File iterator |
2240 | * @offset - same meaning as the read system call | ||
2241 | * @count - same meaning as the read system call | ||
2242 | * @eof - set if no more data needs to be returned | ||
2243 | * @data - pointer to our soft state | ||
2244 | * | 2141 | * |
2245 | * Diaplay statistical information about the I/O activity. | 2142 | * Display statistical information about the I/O activity. |
2246 | */ | 2143 | */ |
2247 | static int | 2144 | static int |
2248 | proc_read_stat(char *page, char **start, off_t offset, int count, int *eof, | 2145 | proc_show_stat(struct seq_file *m, void *v) |
2249 | void *data) | ||
2250 | { | 2146 | { |
2251 | adapter_t *adapter; | 2147 | adapter_t *adapter = m->private; |
2252 | int len; | 2148 | #if MEGA_HAVE_STATS |
2253 | int i; | 2149 | int i; |
2150 | #endif | ||
2254 | 2151 | ||
2255 | i = 0; /* avoid compilation warnings */ | 2152 | seq_puts(m, "Statistical Information for this controller\n"); |
2256 | len = 0; | 2153 | seq_printf(m, "pend_cmds = %d\n", atomic_read(&adapter->pend_cmds)); |
2257 | adapter = (adapter_t *)data; | ||
2258 | |||
2259 | len = sprintf(page, "Statistical Information for this controller\n"); | ||
2260 | len += sprintf(page+len, "pend_cmds = %d\n", | ||
2261 | atomic_read(&adapter->pend_cmds)); | ||
2262 | #if MEGA_HAVE_STATS | 2154 | #if MEGA_HAVE_STATS |
2263 | for(i = 0; i < adapter->numldrv; i++) { | 2155 | for(i = 0; i < adapter->numldrv; i++) { |
2264 | len += sprintf(page+len, "Logical Drive %d:\n", i); | 2156 | seq_printf(m, "Logical Drive %d:\n", i); |
2265 | 2157 | seq_printf(m, "\tReads Issued = %lu, Writes Issued = %lu\n", | |
2266 | len += sprintf(page+len, | 2158 | adapter->nreads[i], adapter->nwrites[i]); |
2267 | "\tReads Issued = %lu, Writes Issued = %lu\n", | 2159 | seq_printf(m, "\tSectors Read = %lu, Sectors Written = %lu\n", |
2268 | adapter->nreads[i], adapter->nwrites[i]); | 2160 | adapter->nreadblocks[i], adapter->nwriteblocks[i]); |
2269 | 2161 | seq_printf(m, "\tRead errors = %lu, Write errors = %lu\n\n", | |
2270 | len += sprintf(page+len, | 2162 | adapter->rd_errors[i], adapter->wr_errors[i]); |
2271 | "\tSectors Read = %lu, Sectors Written = %lu\n", | ||
2272 | adapter->nreadblocks[i], adapter->nwriteblocks[i]); | ||
2273 | |||
2274 | len += sprintf(page+len, | ||
2275 | "\tRead errors = %lu, Write errors = %lu\n\n", | ||
2276 | adapter->rd_errors[i], adapter->wr_errors[i]); | ||
2277 | } | 2163 | } |
2278 | #else | 2164 | #else |
2279 | len += sprintf(page+len, | 2165 | seq_puts(m, "IO and error counters not compiled in driver.\n"); |
2280 | "IO and error counters not compiled in driver.\n"); | ||
2281 | #endif | 2166 | #endif |
2282 | 2167 | return 0; | |
2283 | *eof = 1; | ||
2284 | |||
2285 | return len; | ||
2286 | } | 2168 | } |
2287 | 2169 | ||
2288 | 2170 | ||
2289 | /** | 2171 | /** |
2290 | * proc_read_mbox() | 2172 | * proc_show_mbox() |
2291 | * @page - buffer to write the data in | 2173 | * @m - Synthetic file construction data |
2292 | * @start - where the actual data has been written in page | 2174 | * @v - File iterator |
2293 | * @offset - same meaning as the read system call | ||
2294 | * @count - same meaning as the read system call | ||
2295 | * @eof - set if no more data needs to be returned | ||
2296 | * @data - pointer to our soft state | ||
2297 | * | 2175 | * |
2298 | * Display mailbox information for the last command issued. This information | 2176 | * Display mailbox information for the last command issued. This information |
2299 | * is good for debugging. | 2177 | * is good for debugging. |
2300 | */ | 2178 | */ |
2301 | static int | 2179 | static int |
2302 | proc_read_mbox(char *page, char **start, off_t offset, int count, int *eof, | 2180 | proc_show_mbox(struct seq_file *m, void *v) |
2303 | void *data) | ||
2304 | { | 2181 | { |
2305 | 2182 | adapter_t *adapter = m->private; | |
2306 | adapter_t *adapter = (adapter_t *)data; | ||
2307 | volatile mbox_t *mbox = adapter->mbox; | 2183 | volatile mbox_t *mbox = adapter->mbox; |
2308 | int len = 0; | 2184 | |
2309 | 2185 | seq_puts(m, "Contents of Mail Box Structure\n"); | |
2310 | len = sprintf(page, "Contents of Mail Box Structure\n"); | 2186 | seq_printf(m, " Fw Command = 0x%02x\n", mbox->m_out.cmd); |
2311 | len += sprintf(page+len, " Fw Command = 0x%02x\n", | 2187 | seq_printf(m, " Cmd Sequence = 0x%02x\n", mbox->m_out.cmdid); |
2312 | mbox->m_out.cmd); | 2188 | seq_printf(m, " No of Sectors= %04d\n", mbox->m_out.numsectors); |
2313 | len += sprintf(page+len, " Cmd Sequence = 0x%02x\n", | 2189 | seq_printf(m, " LBA = 0x%02x\n", mbox->m_out.lba); |
2314 | mbox->m_out.cmdid); | 2190 | seq_printf(m, " DTA = 0x%08x\n", mbox->m_out.xferaddr); |
2315 | len += sprintf(page+len, " No of Sectors= %04d\n", | 2191 | seq_printf(m, " Logical Drive= 0x%02x\n", mbox->m_out.logdrv); |
2316 | mbox->m_out.numsectors); | 2192 | seq_printf(m, " No of SG Elmt= 0x%02x\n", mbox->m_out.numsgelements); |
2317 | len += sprintf(page+len, " LBA = 0x%02x\n", | 2193 | seq_printf(m, " Busy = %01x\n", mbox->m_in.busy); |
2318 | mbox->m_out.lba); | 2194 | seq_printf(m, " Status = 0x%02x\n", mbox->m_in.status); |
2319 | len += sprintf(page+len, " DTA = 0x%08x\n", | 2195 | return 0; |
2320 | mbox->m_out.xferaddr); | ||
2321 | len += sprintf(page+len, " Logical Drive= 0x%02x\n", | ||
2322 | mbox->m_out.logdrv); | ||
2323 | len += sprintf(page+len, " No of SG Elmt= 0x%02x\n", | ||
2324 | mbox->m_out.numsgelements); | ||
2325 | len += sprintf(page+len, " Busy = %01x\n", | ||
2326 | mbox->m_in.busy); | ||
2327 | len += sprintf(page+len, " Status = 0x%02x\n", | ||
2328 | mbox->m_in.status); | ||
2329 | |||
2330 | *eof = 1; | ||
2331 | |||
2332 | return len; | ||
2333 | } | 2196 | } |
2334 | 2197 | ||
2335 | 2198 | ||
2336 | /** | 2199 | /** |
2337 | * proc_rebuild_rate() | 2200 | * proc_show_rebuild_rate() |
2338 | * @page - buffer to write the data in | 2201 | * @m - Synthetic file construction data |
2339 | * @start - where the actual data has been written in page | 2202 | * @v - File iterator |
2340 | * @offset - same meaning as the read system call | ||
2341 | * @count - same meaning as the read system call | ||
2342 | * @eof - set if no more data needs to be returned | ||
2343 | * @data - pointer to our soft state | ||
2344 | * | 2203 | * |
2345 | * Display current rebuild rate | 2204 | * Display current rebuild rate |
2346 | */ | 2205 | */ |
2347 | static int | 2206 | static int |
2348 | proc_rebuild_rate(char *page, char **start, off_t offset, int count, int *eof, | 2207 | proc_show_rebuild_rate(struct seq_file *m, void *v) |
2349 | void *data) | ||
2350 | { | 2208 | { |
2351 | adapter_t *adapter = (adapter_t *)data; | 2209 | adapter_t *adapter = m->private; |
2352 | dma_addr_t dma_handle; | 2210 | dma_addr_t dma_handle; |
2353 | caddr_t inquiry; | 2211 | caddr_t inquiry; |
2354 | struct pci_dev *pdev; | 2212 | struct pci_dev *pdev; |
2355 | int len = 0; | ||
2356 | 2213 | ||
2357 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2214 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2358 | *eof = 1; | 2215 | return 0; |
2359 | return len; | ||
2360 | } | ||
2361 | 2216 | ||
2362 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2217 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2363 | free_local_pdev(pdev); | 2218 | goto free_pdev; |
2364 | *eof = 1; | ||
2365 | return len; | ||
2366 | } | ||
2367 | 2219 | ||
2368 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2220 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2369 | 2221 | seq_puts(m, "Adapter inquiry failed.\n"); | |
2370 | len = sprintf(page, "Adapter inquiry failed.\n"); | ||
2371 | |||
2372 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2222 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2373 | 2223 | goto free_inquiry; | |
2374 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2375 | |||
2376 | free_local_pdev(pdev); | ||
2377 | |||
2378 | *eof = 1; | ||
2379 | |||
2380 | return len; | ||
2381 | } | 2224 | } |
2382 | 2225 | ||
2383 | if( adapter->flag & BOARD_40LD ) { | 2226 | if( adapter->flag & BOARD_40LD ) |
2384 | len = sprintf(page, "Rebuild Rate: [%d%%]\n", | 2227 | seq_printf(m, "Rebuild Rate: [%d%%]\n", |
2385 | ((mega_inquiry3 *)inquiry)->rebuild_rate); | 2228 | ((mega_inquiry3 *)inquiry)->rebuild_rate); |
2386 | } | 2229 | else |
2387 | else { | 2230 | seq_printf(m, "Rebuild Rate: [%d%%]\n", |
2388 | len = sprintf(page, "Rebuild Rate: [%d%%]\n", | ||
2389 | ((mraid_ext_inquiry *) | 2231 | ((mraid_ext_inquiry *) |
2390 | inquiry)->raid_inq.adapter_info.rebuild_rate); | 2232 | inquiry)->raid_inq.adapter_info.rebuild_rate); |
2391 | } | ||
2392 | |||
2393 | 2233 | ||
2234 | free_inquiry: | ||
2394 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2235 | mega_free_inquiry(inquiry, dma_handle, pdev); |
2395 | 2236 | free_pdev: | |
2396 | free_local_pdev(pdev); | 2237 | free_local_pdev(pdev); |
2397 | 2238 | return 0; | |
2398 | *eof = 1; | ||
2399 | |||
2400 | return len; | ||
2401 | } | 2239 | } |
2402 | 2240 | ||
2403 | 2241 | ||
2404 | /** | 2242 | /** |
2405 | * proc_battery() | 2243 | * proc_show_battery() |
2406 | * @page - buffer to write the data in | 2244 | * @m - Synthetic file construction data |
2407 | * @start - where the actual data has been written in page | 2245 | * @v - File iterator |
2408 | * @offset - same meaning as the read system call | ||
2409 | * @count - same meaning as the read system call | ||
2410 | * @eof - set if no more data needs to be returned | ||
2411 | * @data - pointer to our soft state | ||
2412 | * | 2246 | * |
2413 | * Display information about the battery module on the controller. | 2247 | * Display information about the battery module on the controller. |
2414 | */ | 2248 | */ |
2415 | static int | 2249 | static int |
2416 | proc_battery(char *page, char **start, off_t offset, int count, int *eof, | 2250 | proc_show_battery(struct seq_file *m, void *v) |
2417 | void *data) | ||
2418 | { | 2251 | { |
2419 | adapter_t *adapter = (adapter_t *)data; | 2252 | adapter_t *adapter = m->private; |
2420 | dma_addr_t dma_handle; | 2253 | dma_addr_t dma_handle; |
2421 | caddr_t inquiry; | 2254 | caddr_t inquiry; |
2422 | struct pci_dev *pdev; | 2255 | struct pci_dev *pdev; |
2423 | u8 battery_status = 0; | 2256 | u8 battery_status; |
2424 | char str[256]; | ||
2425 | int len = 0; | ||
2426 | 2257 | ||
2427 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2258 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2428 | *eof = 1; | 2259 | return 0; |
2429 | return len; | ||
2430 | } | ||
2431 | 2260 | ||
2432 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2261 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2433 | free_local_pdev(pdev); | 2262 | goto free_pdev; |
2434 | *eof = 1; | ||
2435 | return len; | ||
2436 | } | ||
2437 | 2263 | ||
2438 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2264 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2439 | 2265 | seq_printf(m, "Adapter inquiry failed.\n"); | |
2440 | len = sprintf(page, "Adapter inquiry failed.\n"); | ||
2441 | |||
2442 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2266 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2443 | 2267 | goto free_inquiry; | |
2444 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2445 | |||
2446 | free_local_pdev(pdev); | ||
2447 | |||
2448 | *eof = 1; | ||
2449 | |||
2450 | return len; | ||
2451 | } | 2268 | } |
2452 | 2269 | ||
2453 | if( adapter->flag & BOARD_40LD ) { | 2270 | if( adapter->flag & BOARD_40LD ) { |
@@ -2461,146 +2278,80 @@ proc_battery(char *page, char **start, off_t offset, int count, int *eof, | |||
2461 | /* | 2278 | /* |
2462 | * Decode the battery status | 2279 | * Decode the battery status |
2463 | */ | 2280 | */ |
2464 | sprintf(str, "Battery Status:[%d]", battery_status); | 2281 | seq_printf(m, "Battery Status:[%d]", battery_status); |
2465 | 2282 | ||
2466 | if(battery_status == MEGA_BATT_CHARGE_DONE) | 2283 | if(battery_status == MEGA_BATT_CHARGE_DONE) |
2467 | strcat(str, " Charge Done"); | 2284 | seq_puts(m, " Charge Done"); |
2468 | 2285 | ||
2469 | if(battery_status & MEGA_BATT_MODULE_MISSING) | 2286 | if(battery_status & MEGA_BATT_MODULE_MISSING) |
2470 | strcat(str, " Module Missing"); | 2287 | seq_puts(m, " Module Missing"); |
2471 | 2288 | ||
2472 | if(battery_status & MEGA_BATT_LOW_VOLTAGE) | 2289 | if(battery_status & MEGA_BATT_LOW_VOLTAGE) |
2473 | strcat(str, " Low Voltage"); | 2290 | seq_puts(m, " Low Voltage"); |
2474 | 2291 | ||
2475 | if(battery_status & MEGA_BATT_TEMP_HIGH) | 2292 | if(battery_status & MEGA_BATT_TEMP_HIGH) |
2476 | strcat(str, " Temperature High"); | 2293 | seq_puts(m, " Temperature High"); |
2477 | 2294 | ||
2478 | if(battery_status & MEGA_BATT_PACK_MISSING) | 2295 | if(battery_status & MEGA_BATT_PACK_MISSING) |
2479 | strcat(str, " Pack Missing"); | 2296 | seq_puts(m, " Pack Missing"); |
2480 | 2297 | ||
2481 | if(battery_status & MEGA_BATT_CHARGE_INPROG) | 2298 | if(battery_status & MEGA_BATT_CHARGE_INPROG) |
2482 | strcat(str, " Charge In-progress"); | 2299 | seq_puts(m, " Charge In-progress"); |
2483 | 2300 | ||
2484 | if(battery_status & MEGA_BATT_CHARGE_FAIL) | 2301 | if(battery_status & MEGA_BATT_CHARGE_FAIL) |
2485 | strcat(str, " Charge Fail"); | 2302 | seq_puts(m, " Charge Fail"); |
2486 | 2303 | ||
2487 | if(battery_status & MEGA_BATT_CYCLES_EXCEEDED) | 2304 | if(battery_status & MEGA_BATT_CYCLES_EXCEEDED) |
2488 | strcat(str, " Cycles Exceeded"); | 2305 | seq_puts(m, " Cycles Exceeded"); |
2489 | |||
2490 | len = sprintf(page, "%s\n", str); | ||
2491 | 2306 | ||
2307 | seq_putc(m, '\n'); | ||
2492 | 2308 | ||
2309 | free_inquiry: | ||
2493 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2310 | mega_free_inquiry(inquiry, dma_handle, pdev); |
2494 | 2311 | free_pdev: | |
2495 | free_local_pdev(pdev); | 2312 | free_local_pdev(pdev); |
2496 | 2313 | return 0; | |
2497 | *eof = 1; | ||
2498 | |||
2499 | return len; | ||
2500 | } | ||
2501 | |||
2502 | |||
2503 | /** | ||
2504 | * proc_pdrv_ch0() | ||
2505 | * @page - buffer to write the data in | ||
2506 | * @start - where the actual data has been written in page | ||
2507 | * @offset - same meaning as the read system call | ||
2508 | * @count - same meaning as the read system call | ||
2509 | * @eof - set if no more data needs to be returned | ||
2510 | * @data - pointer to our soft state | ||
2511 | * | ||
2512 | * Display information about the physical drives on physical channel 0. | ||
2513 | */ | ||
2514 | static int | ||
2515 | proc_pdrv_ch0(char *page, char **start, off_t offset, int count, int *eof, | ||
2516 | void *data) | ||
2517 | { | ||
2518 | adapter_t *adapter = (adapter_t *)data; | ||
2519 | |||
2520 | *eof = 1; | ||
2521 | |||
2522 | return (proc_pdrv(adapter, page, 0)); | ||
2523 | } | ||
2524 | |||
2525 | |||
2526 | /** | ||
2527 | * proc_pdrv_ch1() | ||
2528 | * @page - buffer to write the data in | ||
2529 | * @start - where the actual data has been written in page | ||
2530 | * @offset - same meaning as the read system call | ||
2531 | * @count - same meaning as the read system call | ||
2532 | * @eof - set if no more data needs to be returned | ||
2533 | * @data - pointer to our soft state | ||
2534 | * | ||
2535 | * Display information about the physical drives on physical channel 1. | ||
2536 | */ | ||
2537 | static int | ||
2538 | proc_pdrv_ch1(char *page, char **start, off_t offset, int count, int *eof, | ||
2539 | void *data) | ||
2540 | { | ||
2541 | adapter_t *adapter = (adapter_t *)data; | ||
2542 | |||
2543 | *eof = 1; | ||
2544 | |||
2545 | return (proc_pdrv(adapter, page, 1)); | ||
2546 | } | 2314 | } |
2547 | 2315 | ||
2548 | 2316 | ||
2549 | /** | 2317 | /* |
2550 | * proc_pdrv_ch2() | 2318 | * Display scsi inquiry |
2551 | * @page - buffer to write the data in | ||
2552 | * @start - where the actual data has been written in page | ||
2553 | * @offset - same meaning as the read system call | ||
2554 | * @count - same meaning as the read system call | ||
2555 | * @eof - set if no more data needs to be returned | ||
2556 | * @data - pointer to our soft state | ||
2557 | * | ||
2558 | * Display information about the physical drives on physical channel 2. | ||
2559 | */ | 2319 | */ |
2560 | static int | 2320 | static void |
2561 | proc_pdrv_ch2(char *page, char **start, off_t offset, int count, int *eof, | 2321 | mega_print_inquiry(struct seq_file *m, char *scsi_inq) |
2562 | void *data) | ||
2563 | { | 2322 | { |
2564 | adapter_t *adapter = (adapter_t *)data; | 2323 | int i; |
2565 | |||
2566 | *eof = 1; | ||
2567 | |||
2568 | return (proc_pdrv(adapter, page, 2)); | ||
2569 | } | ||
2570 | 2324 | ||
2325 | seq_puts(m, " Vendor: "); | ||
2326 | seq_write(m, scsi_inq + 8, 8); | ||
2327 | seq_puts(m, " Model: "); | ||
2328 | seq_write(m, scsi_inq + 16, 16); | ||
2329 | seq_puts(m, " Rev: "); | ||
2330 | seq_write(m, scsi_inq + 32, 4); | ||
2331 | seq_putc(m, '\n'); | ||
2571 | 2332 | ||
2572 | /** | 2333 | i = scsi_inq[0] & 0x1f; |
2573 | * proc_pdrv_ch3() | 2334 | seq_printf(m, " Type: %s ", scsi_device_type(i)); |
2574 | * @page - buffer to write the data in | ||
2575 | * @start - where the actual data has been written in page | ||
2576 | * @offset - same meaning as the read system call | ||
2577 | * @count - same meaning as the read system call | ||
2578 | * @eof - set if no more data needs to be returned | ||
2579 | * @data - pointer to our soft state | ||
2580 | * | ||
2581 | * Display information about the physical drives on physical channel 3. | ||
2582 | */ | ||
2583 | static int | ||
2584 | proc_pdrv_ch3(char *page, char **start, off_t offset, int count, int *eof, | ||
2585 | void *data) | ||
2586 | { | ||
2587 | adapter_t *adapter = (adapter_t *)data; | ||
2588 | 2335 | ||
2589 | *eof = 1; | 2336 | seq_printf(m, " ANSI SCSI revision: %02x", |
2337 | scsi_inq[2] & 0x07); | ||
2590 | 2338 | ||
2591 | return (proc_pdrv(adapter, page, 3)); | 2339 | if( (scsi_inq[2] & 0x07) == 1 && (scsi_inq[3] & 0x0f) == 1 ) |
2340 | seq_puts(m, " CCS\n"); | ||
2341 | else | ||
2342 | seq_putc(m, '\n'); | ||
2592 | } | 2343 | } |
2593 | 2344 | ||
2594 | |||
2595 | /** | 2345 | /** |
2596 | * proc_pdrv() | 2346 | * proc_show_pdrv() |
2347 | * @m - Synthetic file construction data | ||
2597 | * @page - buffer to write the data in | 2348 | * @page - buffer to write the data in |
2598 | * @adapter - pointer to our soft state | 2349 | * @adapter - pointer to our soft state |
2599 | * | 2350 | * |
2600 | * Display information about the physical drives. | 2351 | * Display information about the physical drives. |
2601 | */ | 2352 | */ |
2602 | static int | 2353 | static int |
2603 | proc_pdrv(adapter_t *adapter, char *page, int channel) | 2354 | proc_show_pdrv(struct seq_file *m, adapter_t *adapter, int channel) |
2604 | { | 2355 | { |
2605 | dma_addr_t dma_handle; | 2356 | dma_addr_t dma_handle; |
2606 | char *scsi_inq; | 2357 | char *scsi_inq; |
@@ -2611,32 +2362,24 @@ proc_pdrv(adapter_t *adapter, char *page, int channel) | |||
2611 | u8 state; | 2362 | u8 state; |
2612 | int tgt; | 2363 | int tgt; |
2613 | int max_channels; | 2364 | int max_channels; |
2614 | int len = 0; | ||
2615 | char str[80]; | ||
2616 | int i; | 2365 | int i; |
2617 | 2366 | ||
2618 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2367 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2619 | return len; | 2368 | return 0; |
2620 | } | ||
2621 | 2369 | ||
2622 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2370 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2623 | goto free_pdev; | 2371 | goto free_pdev; |
2624 | } | ||
2625 | 2372 | ||
2626 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2373 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2627 | len = sprintf(page, "Adapter inquiry failed.\n"); | 2374 | seq_puts(m, "Adapter inquiry failed.\n"); |
2628 | |||
2629 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2375 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2630 | |||
2631 | goto free_inquiry; | 2376 | goto free_inquiry; |
2632 | } | 2377 | } |
2633 | 2378 | ||
2634 | 2379 | ||
2635 | scsi_inq = pci_alloc_consistent(pdev, 256, &scsi_inq_dma_handle); | 2380 | scsi_inq = pci_alloc_consistent(pdev, 256, &scsi_inq_dma_handle); |
2636 | |||
2637 | if( scsi_inq == NULL ) { | 2381 | if( scsi_inq == NULL ) { |
2638 | len = sprintf(page, "memory not available for scsi inq.\n"); | 2382 | seq_puts(m, "memory not available for scsi inq.\n"); |
2639 | |||
2640 | goto free_inquiry; | 2383 | goto free_inquiry; |
2641 | } | 2384 | } |
2642 | 2385 | ||
@@ -2659,39 +2402,31 @@ proc_pdrv(adapter_t *adapter, char *page, int channel) | |||
2659 | i = channel*16 + tgt; | 2402 | i = channel*16 + tgt; |
2660 | 2403 | ||
2661 | state = *(pdrv_state + i); | 2404 | state = *(pdrv_state + i); |
2662 | |||
2663 | switch( state & 0x0F ) { | 2405 | switch( state & 0x0F ) { |
2664 | |||
2665 | case PDRV_ONLINE: | 2406 | case PDRV_ONLINE: |
2666 | sprintf(str, | 2407 | seq_printf(m, "Channel:%2d Id:%2d State: Online", |
2667 | "Channel:%2d Id:%2d State: Online", | 2408 | channel, tgt); |
2668 | channel, tgt); | ||
2669 | break; | 2409 | break; |
2670 | 2410 | ||
2671 | case PDRV_FAILED: | 2411 | case PDRV_FAILED: |
2672 | sprintf(str, | 2412 | seq_printf(m, "Channel:%2d Id:%2d State: Failed", |
2673 | "Channel:%2d Id:%2d State: Failed", | 2413 | channel, tgt); |
2674 | channel, tgt); | ||
2675 | break; | 2414 | break; |
2676 | 2415 | ||
2677 | case PDRV_RBLD: | 2416 | case PDRV_RBLD: |
2678 | sprintf(str, | 2417 | seq_printf(m, "Channel:%2d Id:%2d State: Rebuild", |
2679 | "Channel:%2d Id:%2d State: Rebuild", | 2418 | channel, tgt); |
2680 | channel, tgt); | ||
2681 | break; | 2419 | break; |
2682 | 2420 | ||
2683 | case PDRV_HOTSPARE: | 2421 | case PDRV_HOTSPARE: |
2684 | sprintf(str, | 2422 | seq_printf(m, "Channel:%2d Id:%2d State: Hot spare", |
2685 | "Channel:%2d Id:%2d State: Hot spare", | 2423 | channel, tgt); |
2686 | channel, tgt); | ||
2687 | break; | 2424 | break; |
2688 | 2425 | ||
2689 | default: | 2426 | default: |
2690 | sprintf(str, | 2427 | seq_printf(m, "Channel:%2d Id:%2d State: Un-configured", |
2691 | "Channel:%2d Id:%2d State: Un-configured", | 2428 | channel, tgt); |
2692 | channel, tgt); | ||
2693 | break; | 2429 | break; |
2694 | |||
2695 | } | 2430 | } |
2696 | 2431 | ||
2697 | /* | 2432 | /* |
@@ -2710,11 +2445,8 @@ proc_pdrv(adapter_t *adapter, char *page, int channel) | |||
2710 | * Check for overflow. We print less than 240 | 2445 | * Check for overflow. We print less than 240 |
2711 | * characters for inquiry | 2446 | * characters for inquiry |
2712 | */ | 2447 | */ |
2713 | if( (len + 240) >= PAGE_SIZE ) break; | 2448 | seq_puts(m, ".\n"); |
2714 | 2449 | mega_print_inquiry(m, scsi_inq); | |
2715 | len += sprintf(page+len, "%s.\n", str); | ||
2716 | |||
2717 | len += mega_print_inquiry(page+len, scsi_inq); | ||
2718 | } | 2450 | } |
2719 | 2451 | ||
2720 | free_pci: | 2452 | free_pci: |
@@ -2723,150 +2455,68 @@ free_inquiry: | |||
2723 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2455 | mega_free_inquiry(inquiry, dma_handle, pdev); |
2724 | free_pdev: | 2456 | free_pdev: |
2725 | free_local_pdev(pdev); | 2457 | free_local_pdev(pdev); |
2726 | 2458 | return 0; | |
2727 | return len; | ||
2728 | } | ||
2729 | |||
2730 | |||
2731 | /* | ||
2732 | * Display scsi inquiry | ||
2733 | */ | ||
2734 | static int | ||
2735 | mega_print_inquiry(char *page, char *scsi_inq) | ||
2736 | { | ||
2737 | int len = 0; | ||
2738 | int i; | ||
2739 | |||
2740 | len = sprintf(page, " Vendor: "); | ||
2741 | for( i = 8; i < 16; i++ ) { | ||
2742 | len += sprintf(page+len, "%c", scsi_inq[i]); | ||
2743 | } | ||
2744 | |||
2745 | len += sprintf(page+len, " Model: "); | ||
2746 | |||
2747 | for( i = 16; i < 32; i++ ) { | ||
2748 | len += sprintf(page+len, "%c", scsi_inq[i]); | ||
2749 | } | ||
2750 | |||
2751 | len += sprintf(page+len, " Rev: "); | ||
2752 | |||
2753 | for( i = 32; i < 36; i++ ) { | ||
2754 | len += sprintf(page+len, "%c", scsi_inq[i]); | ||
2755 | } | ||
2756 | |||
2757 | len += sprintf(page+len, "\n"); | ||
2758 | |||
2759 | i = scsi_inq[0] & 0x1f; | ||
2760 | |||
2761 | len += sprintf(page+len, " Type: %s ", scsi_device_type(i)); | ||
2762 | |||
2763 | len += sprintf(page+len, | ||
2764 | " ANSI SCSI revision: %02x", scsi_inq[2] & 0x07); | ||
2765 | |||
2766 | if( (scsi_inq[2] & 0x07) == 1 && (scsi_inq[3] & 0x0f) == 1 ) | ||
2767 | len += sprintf(page+len, " CCS\n"); | ||
2768 | else | ||
2769 | len += sprintf(page+len, "\n"); | ||
2770 | |||
2771 | return len; | ||
2772 | } | 2459 | } |
2773 | 2460 | ||
2774 | |||
2775 | /** | 2461 | /** |
2776 | * proc_rdrv_10() | 2462 | * proc_show_pdrv_ch0() |
2777 | * @page - buffer to write the data in | 2463 | * @m - Synthetic file construction data |
2778 | * @start - where the actual data has been written in page | 2464 | * @v - File iterator |
2779 | * @offset - same meaning as the read system call | ||
2780 | * @count - same meaning as the read system call | ||
2781 | * @eof - set if no more data needs to be returned | ||
2782 | * @data - pointer to our soft state | ||
2783 | * | 2465 | * |
2784 | * Display real time information about the logical drives 0 through 9. | 2466 | * Display information about the physical drives on physical channel 0. |
2785 | */ | 2467 | */ |
2786 | static int | 2468 | static int |
2787 | proc_rdrv_10(char *page, char **start, off_t offset, int count, int *eof, | 2469 | proc_show_pdrv_ch0(struct seq_file *m, void *v) |
2788 | void *data) | ||
2789 | { | 2470 | { |
2790 | adapter_t *adapter = (adapter_t *)data; | 2471 | return proc_show_pdrv(m, m->private, 0); |
2791 | |||
2792 | *eof = 1; | ||
2793 | |||
2794 | return (proc_rdrv(adapter, page, 0, 9)); | ||
2795 | } | 2472 | } |
2796 | 2473 | ||
2797 | 2474 | ||
2798 | /** | 2475 | /** |
2799 | * proc_rdrv_20() | 2476 | * proc_show_pdrv_ch1() |
2800 | * @page - buffer to write the data in | 2477 | * @m - Synthetic file construction data |
2801 | * @start - where the actual data has been written in page | 2478 | * @v - File iterator |
2802 | * @offset - same meaning as the read system call | ||
2803 | * @count - same meaning as the read system call | ||
2804 | * @eof - set if no more data needs to be returned | ||
2805 | * @data - pointer to our soft state | ||
2806 | * | 2479 | * |
2807 | * Display real time information about the logical drives 0 through 9. | 2480 | * Display information about the physical drives on physical channel 1. |
2808 | */ | 2481 | */ |
2809 | static int | 2482 | static int |
2810 | proc_rdrv_20(char *page, char **start, off_t offset, int count, int *eof, | 2483 | proc_show_pdrv_ch1(struct seq_file *m, void *v) |
2811 | void *data) | ||
2812 | { | 2484 | { |
2813 | adapter_t *adapter = (adapter_t *)data; | 2485 | return proc_show_pdrv(m, m->private, 1); |
2814 | |||
2815 | *eof = 1; | ||
2816 | |||
2817 | return (proc_rdrv(adapter, page, 10, 19)); | ||
2818 | } | 2486 | } |
2819 | 2487 | ||
2820 | 2488 | ||
2821 | /** | 2489 | /** |
2822 | * proc_rdrv_30() | 2490 | * proc_show_pdrv_ch2() |
2823 | * @page - buffer to write the data in | 2491 | * @m - Synthetic file construction data |
2824 | * @start - where the actual data has been written in page | 2492 | * @v - File iterator |
2825 | * @offset - same meaning as the read system call | ||
2826 | * @count - same meaning as the read system call | ||
2827 | * @eof - set if no more data needs to be returned | ||
2828 | * @data - pointer to our soft state | ||
2829 | * | 2493 | * |
2830 | * Display real time information about the logical drives 0 through 9. | 2494 | * Display information about the physical drives on physical channel 2. |
2831 | */ | 2495 | */ |
2832 | static int | 2496 | static int |
2833 | proc_rdrv_30(char *page, char **start, off_t offset, int count, int *eof, | 2497 | proc_show_pdrv_ch2(struct seq_file *m, void *v) |
2834 | void *data) | ||
2835 | { | 2498 | { |
2836 | adapter_t *adapter = (adapter_t *)data; | 2499 | return proc_show_pdrv(m, m->private, 2); |
2837 | |||
2838 | *eof = 1; | ||
2839 | |||
2840 | return (proc_rdrv(adapter, page, 20, 29)); | ||
2841 | } | 2500 | } |
2842 | 2501 | ||
2843 | 2502 | ||
2844 | /** | 2503 | /** |
2845 | * proc_rdrv_40() | 2504 | * proc_show_pdrv_ch3() |
2846 | * @page - buffer to write the data in | 2505 | * @m - Synthetic file construction data |
2847 | * @start - where the actual data has been written in page | 2506 | * @v - File iterator |
2848 | * @offset - same meaning as the read system call | ||
2849 | * @count - same meaning as the read system call | ||
2850 | * @eof - set if no more data needs to be returned | ||
2851 | * @data - pointer to our soft state | ||
2852 | * | 2507 | * |
2853 | * Display real time information about the logical drives 0 through 9. | 2508 | * Display information about the physical drives on physical channel 3. |
2854 | */ | 2509 | */ |
2855 | static int | 2510 | static int |
2856 | proc_rdrv_40(char *page, char **start, off_t offset, int count, int *eof, | 2511 | proc_show_pdrv_ch3(struct seq_file *m, void *v) |
2857 | void *data) | ||
2858 | { | 2512 | { |
2859 | adapter_t *adapter = (adapter_t *)data; | 2513 | return proc_show_pdrv(m, m->private, 3); |
2860 | |||
2861 | *eof = 1; | ||
2862 | |||
2863 | return (proc_rdrv(adapter, page, 30, 39)); | ||
2864 | } | 2514 | } |
2865 | 2515 | ||
2866 | 2516 | ||
2867 | /** | 2517 | /** |
2868 | * proc_rdrv() | 2518 | * proc_show_rdrv() |
2869 | * @page - buffer to write the data in | 2519 | * @m - Synthetic file construction data |
2870 | * @adapter - pointer to our soft state | 2520 | * @adapter - pointer to our soft state |
2871 | * @start - starting logical drive to display | 2521 | * @start - starting logical drive to display |
2872 | * @end - ending logical drive to display | 2522 | * @end - ending logical drive to display |
@@ -2875,7 +2525,7 @@ proc_rdrv_40(char *page, char **start, off_t offset, int count, int *eof, | |||
2875 | * /proc/scsi/scsi interface | 2525 | * /proc/scsi/scsi interface |
2876 | */ | 2526 | */ |
2877 | static int | 2527 | static int |
2878 | proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | 2528 | proc_show_rdrv(struct seq_file *m, adapter_t *adapter, int start, int end ) |
2879 | { | 2529 | { |
2880 | dma_addr_t dma_handle; | 2530 | dma_addr_t dma_handle; |
2881 | logdrv_param *lparam; | 2531 | logdrv_param *lparam; |
@@ -2887,29 +2537,18 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2887 | u8 *rdrv_state; | 2537 | u8 *rdrv_state; |
2888 | int num_ldrv; | 2538 | int num_ldrv; |
2889 | u32 array_sz; | 2539 | u32 array_sz; |
2890 | int len = 0; | ||
2891 | int i; | 2540 | int i; |
2892 | 2541 | ||
2893 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2542 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2894 | return len; | 2543 | return 0; |
2895 | } | ||
2896 | 2544 | ||
2897 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2545 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2898 | free_local_pdev(pdev); | 2546 | goto free_pdev; |
2899 | return len; | ||
2900 | } | ||
2901 | 2547 | ||
2902 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2548 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2903 | 2549 | seq_puts(m, "Adapter inquiry failed.\n"); | |
2904 | len = sprintf(page, "Adapter inquiry failed.\n"); | ||
2905 | |||
2906 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2550 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2907 | 2551 | goto free_inquiry; | |
2908 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2909 | |||
2910 | free_local_pdev(pdev); | ||
2911 | |||
2912 | return len; | ||
2913 | } | 2552 | } |
2914 | 2553 | ||
2915 | memset(&mc, 0, sizeof(megacmd_t)); | 2554 | memset(&mc, 0, sizeof(megacmd_t)); |
@@ -2935,13 +2574,8 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2935 | &disk_array_dma_handle); | 2574 | &disk_array_dma_handle); |
2936 | 2575 | ||
2937 | if( disk_array == NULL ) { | 2576 | if( disk_array == NULL ) { |
2938 | len = sprintf(page, "memory not available.\n"); | 2577 | seq_puts(m, "memory not available.\n"); |
2939 | 2578 | goto free_inquiry; | |
2940 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2941 | |||
2942 | free_local_pdev(pdev); | ||
2943 | |||
2944 | return len; | ||
2945 | } | 2579 | } |
2946 | 2580 | ||
2947 | mc.xferaddr = (u32)disk_array_dma_handle; | 2581 | mc.xferaddr = (u32)disk_array_dma_handle; |
@@ -2951,17 +2585,8 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2951 | mc.opcode = OP_DCMD_READ_CONFIG; | 2585 | mc.opcode = OP_DCMD_READ_CONFIG; |
2952 | 2586 | ||
2953 | if( mega_internal_command(adapter, &mc, NULL) ) { | 2587 | if( mega_internal_command(adapter, &mc, NULL) ) { |
2954 | 2588 | seq_puts(m, "40LD read config failed.\n"); | |
2955 | len = sprintf(page, "40LD read config failed.\n"); | 2589 | goto free_pci; |
2956 | |||
2957 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2958 | |||
2959 | pci_free_consistent(pdev, array_sz, disk_array, | ||
2960 | disk_array_dma_handle); | ||
2961 | |||
2962 | free_local_pdev(pdev); | ||
2963 | |||
2964 | return len; | ||
2965 | } | 2590 | } |
2966 | 2591 | ||
2967 | } | 2592 | } |
@@ -2969,24 +2594,10 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2969 | mc.cmd = NEW_READ_CONFIG_8LD; | 2594 | mc.cmd = NEW_READ_CONFIG_8LD; |
2970 | 2595 | ||
2971 | if( mega_internal_command(adapter, &mc, NULL) ) { | 2596 | if( mega_internal_command(adapter, &mc, NULL) ) { |
2972 | |||
2973 | mc.cmd = READ_CONFIG_8LD; | 2597 | mc.cmd = READ_CONFIG_8LD; |
2974 | 2598 | if( mega_internal_command(adapter, &mc, NULL) ) { | |
2975 | if( mega_internal_command(adapter, &mc, | 2599 | seq_puts(m, "8LD read config failed.\n"); |
2976 | NULL) ){ | 2600 | goto free_pci; |
2977 | |||
2978 | len = sprintf(page, | ||
2979 | "8LD read config failed.\n"); | ||
2980 | |||
2981 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2982 | |||
2983 | pci_free_consistent(pdev, array_sz, | ||
2984 | disk_array, | ||
2985 | disk_array_dma_handle); | ||
2986 | |||
2987 | free_local_pdev(pdev); | ||
2988 | |||
2989 | return len; | ||
2990 | } | 2601 | } |
2991 | } | 2602 | } |
2992 | } | 2603 | } |
@@ -3006,29 +2617,23 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
3006 | * Check for overflow. We print less than 240 characters for | 2617 | * Check for overflow. We print less than 240 characters for |
3007 | * information about each logical drive. | 2618 | * information about each logical drive. |
3008 | */ | 2619 | */ |
3009 | if( (len + 240) >= PAGE_SIZE ) break; | 2620 | seq_printf(m, "Logical drive:%2d:, ", i); |
3010 | |||
3011 | len += sprintf(page+len, "Logical drive:%2d:, ", i); | ||
3012 | 2621 | ||
3013 | switch( rdrv_state[i] & 0x0F ) { | 2622 | switch( rdrv_state[i] & 0x0F ) { |
3014 | case RDRV_OFFLINE: | 2623 | case RDRV_OFFLINE: |
3015 | len += sprintf(page+len, "state: offline"); | 2624 | seq_puts(m, "state: offline"); |
3016 | break; | 2625 | break; |
3017 | |||
3018 | case RDRV_DEGRADED: | 2626 | case RDRV_DEGRADED: |
3019 | len += sprintf(page+len, "state: degraded"); | 2627 | seq_puts(m, "state: degraded"); |
3020 | break; | 2628 | break; |
3021 | |||
3022 | case RDRV_OPTIMAL: | 2629 | case RDRV_OPTIMAL: |
3023 | len += sprintf(page+len, "state: optimal"); | 2630 | seq_puts(m, "state: optimal"); |
3024 | break; | 2631 | break; |
3025 | |||
3026 | case RDRV_DELETED: | 2632 | case RDRV_DELETED: |
3027 | len += sprintf(page+len, "state: deleted"); | 2633 | seq_puts(m, "state: deleted"); |
3028 | break; | 2634 | break; |
3029 | |||
3030 | default: | 2635 | default: |
3031 | len += sprintf(page+len, "state: unknown"); | 2636 | seq_puts(m, "state: unknown"); |
3032 | break; | 2637 | break; |
3033 | } | 2638 | } |
3034 | 2639 | ||
@@ -3036,84 +2641,203 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
3036 | * Check if check consistency or initialization is going on | 2641 | * Check if check consistency or initialization is going on |
3037 | * for this logical drive. | 2642 | * for this logical drive. |
3038 | */ | 2643 | */ |
3039 | if( (rdrv_state[i] & 0xF0) == 0x20 ) { | 2644 | if( (rdrv_state[i] & 0xF0) == 0x20 ) |
3040 | len += sprintf(page+len, | 2645 | seq_puts(m, ", check-consistency in progress"); |
3041 | ", check-consistency in progress"); | 2646 | else if( (rdrv_state[i] & 0xF0) == 0x10 ) |
3042 | } | 2647 | seq_puts(m, ", initialization in progress"); |
3043 | else if( (rdrv_state[i] & 0xF0) == 0x10 ) { | ||
3044 | len += sprintf(page+len, | ||
3045 | ", initialization in progress"); | ||
3046 | } | ||
3047 | 2648 | ||
3048 | len += sprintf(page+len, "\n"); | 2649 | seq_putc(m, '\n'); |
3049 | |||
3050 | len += sprintf(page+len, "Span depth:%3d, ", | ||
3051 | lparam->span_depth); | ||
3052 | |||
3053 | len += sprintf(page+len, "RAID level:%3d, ", | ||
3054 | lparam->level); | ||
3055 | |||
3056 | len += sprintf(page+len, "Stripe size:%3d, ", | ||
3057 | lparam->stripe_sz ? lparam->stripe_sz/2: 128); | ||
3058 | |||
3059 | len += sprintf(page+len, "Row size:%3d\n", | ||
3060 | lparam->row_size); | ||
3061 | 2650 | ||
2651 | seq_printf(m, "Span depth:%3d, ", lparam->span_depth); | ||
2652 | seq_printf(m, "RAID level:%3d, ", lparam->level); | ||
2653 | seq_printf(m, "Stripe size:%3d, ", | ||
2654 | lparam->stripe_sz ? lparam->stripe_sz/2: 128); | ||
2655 | seq_printf(m, "Row size:%3d\n", lparam->row_size); | ||
3062 | 2656 | ||
3063 | len += sprintf(page+len, "Read Policy: "); | 2657 | seq_puts(m, "Read Policy: "); |
3064 | |||
3065 | switch(lparam->read_ahead) { | 2658 | switch(lparam->read_ahead) { |
3066 | |||
3067 | case NO_READ_AHEAD: | 2659 | case NO_READ_AHEAD: |
3068 | len += sprintf(page+len, "No read ahead, "); | 2660 | seq_puts(m, "No read ahead, "); |
3069 | break; | 2661 | break; |
3070 | |||
3071 | case READ_AHEAD: | 2662 | case READ_AHEAD: |
3072 | len += sprintf(page+len, "Read ahead, "); | 2663 | seq_puts(m, "Read ahead, "); |
3073 | break; | 2664 | break; |
3074 | |||
3075 | case ADAP_READ_AHEAD: | 2665 | case ADAP_READ_AHEAD: |
3076 | len += sprintf(page+len, "Adaptive, "); | 2666 | seq_puts(m, "Adaptive, "); |
3077 | break; | 2667 | break; |
3078 | 2668 | ||
3079 | } | 2669 | } |
3080 | 2670 | ||
3081 | len += sprintf(page+len, "Write Policy: "); | 2671 | seq_puts(m, "Write Policy: "); |
3082 | |||
3083 | switch(lparam->write_mode) { | 2672 | switch(lparam->write_mode) { |
3084 | |||
3085 | case WRMODE_WRITE_THRU: | 2673 | case WRMODE_WRITE_THRU: |
3086 | len += sprintf(page+len, "Write thru, "); | 2674 | seq_puts(m, "Write thru, "); |
3087 | break; | 2675 | break; |
3088 | |||
3089 | case WRMODE_WRITE_BACK: | 2676 | case WRMODE_WRITE_BACK: |
3090 | len += sprintf(page+len, "Write back, "); | 2677 | seq_puts(m, "Write back, "); |
3091 | break; | 2678 | break; |
3092 | } | 2679 | } |
3093 | 2680 | ||
3094 | len += sprintf(page+len, "Cache Policy: "); | 2681 | seq_puts(m, "Cache Policy: "); |
3095 | |||
3096 | switch(lparam->direct_io) { | 2682 | switch(lparam->direct_io) { |
3097 | |||
3098 | case CACHED_IO: | 2683 | case CACHED_IO: |
3099 | len += sprintf(page+len, "Cached IO\n\n"); | 2684 | seq_puts(m, "Cached IO\n\n"); |
3100 | break; | 2685 | break; |
3101 | |||
3102 | case DIRECT_IO: | 2686 | case DIRECT_IO: |
3103 | len += sprintf(page+len, "Direct IO\n\n"); | 2687 | seq_puts(m, "Direct IO\n\n"); |
3104 | break; | 2688 | break; |
3105 | } | 2689 | } |
3106 | } | 2690 | } |
3107 | 2691 | ||
3108 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2692 | free_pci: |
3109 | |||
3110 | pci_free_consistent(pdev, array_sz, disk_array, | 2693 | pci_free_consistent(pdev, array_sz, disk_array, |
3111 | disk_array_dma_handle); | 2694 | disk_array_dma_handle); |
3112 | 2695 | free_inquiry: | |
2696 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2697 | free_pdev: | ||
3113 | free_local_pdev(pdev); | 2698 | free_local_pdev(pdev); |
2699 | return 0; | ||
2700 | } | ||
2701 | |||
2702 | /** | ||
2703 | * proc_show_rdrv_10() | ||
2704 | * @m - Synthetic file construction data | ||
2705 | * @v - File iterator | ||
2706 | * | ||
2707 | * Display real time information about the logical drives 0 through 9. | ||
2708 | */ | ||
2709 | static int | ||
2710 | proc_show_rdrv_10(struct seq_file *m, void *v) | ||
2711 | { | ||
2712 | return proc_show_rdrv(m, m->private, 0, 9); | ||
2713 | } | ||
2714 | |||
2715 | |||
2716 | /** | ||
2717 | * proc_show_rdrv_20() | ||
2718 | * @m - Synthetic file construction data | ||
2719 | * @v - File iterator | ||
2720 | * | ||
2721 | * Display real time information about the logical drives 0 through 9. | ||
2722 | */ | ||
2723 | static int | ||
2724 | proc_show_rdrv_20(struct seq_file *m, void *v) | ||
2725 | { | ||
2726 | return proc_show_rdrv(m, m->private, 10, 19); | ||
2727 | } | ||
2728 | |||
2729 | |||
2730 | /** | ||
2731 | * proc_show_rdrv_30() | ||
2732 | * @m - Synthetic file construction data | ||
2733 | * @v - File iterator | ||
2734 | * | ||
2735 | * Display real time information about the logical drives 0 through 9. | ||
2736 | */ | ||
2737 | static int | ||
2738 | proc_show_rdrv_30(struct seq_file *m, void *v) | ||
2739 | { | ||
2740 | return proc_show_rdrv(m, m->private, 20, 29); | ||
2741 | } | ||
2742 | |||
2743 | |||
2744 | /** | ||
2745 | * proc_show_rdrv_40() | ||
2746 | * @m - Synthetic file construction data | ||
2747 | * @v - File iterator | ||
2748 | * | ||
2749 | * Display real time information about the logical drives 0 through 9. | ||
2750 | */ | ||
2751 | static int | ||
2752 | proc_show_rdrv_40(struct seq_file *m, void *v) | ||
2753 | { | ||
2754 | return proc_show_rdrv(m, m->private, 30, 39); | ||
2755 | } | ||
2756 | |||
2757 | |||
2758 | /* | ||
2759 | * seq_file wrappers for procfile show routines. | ||
2760 | */ | ||
2761 | static int mega_proc_open(struct inode *inode, struct file *file) | ||
2762 | { | ||
2763 | adapter_t *adapter = proc_get_parent_data(inode); | ||
2764 | int (*show)(struct seq_file *, void *) = PDE_DATA(inode); | ||
2765 | |||
2766 | return single_open(file, show, adapter); | ||
2767 | } | ||
2768 | |||
2769 | static const struct file_operations mega_proc_fops = { | ||
2770 | .open = mega_proc_open, | ||
2771 | .read = seq_read, | ||
2772 | .llseek = seq_lseek, | ||
2773 | .release = seq_release, | ||
2774 | }; | ||
2775 | |||
2776 | /* | ||
2777 | * Table of proc files we need to create. | ||
2778 | */ | ||
2779 | struct mega_proc_file { | ||
2780 | const char *name; | ||
2781 | unsigned short ptr_offset; | ||
2782 | int (*show) (struct seq_file *m, void *v); | ||
2783 | }; | ||
2784 | |||
2785 | static const struct mega_proc_file mega_proc_files[] = { | ||
2786 | { "config", offsetof(adapter_t, proc_read), proc_show_config }, | ||
2787 | { "stat", offsetof(adapter_t, proc_stat), proc_show_stat }, | ||
2788 | { "mailbox", offsetof(adapter_t, proc_mbox), proc_show_mbox }, | ||
2789 | #if MEGA_HAVE_ENH_PROC | ||
2790 | { "rebuild-rate", offsetof(adapter_t, proc_rr), proc_show_rebuild_rate }, | ||
2791 | { "battery-status", offsetof(adapter_t, proc_battery), proc_show_battery }, | ||
2792 | { "diskdrives-ch0", offsetof(adapter_t, proc_pdrvstat[0]), proc_show_pdrv_ch0 }, | ||
2793 | { "diskdrives-ch1", offsetof(adapter_t, proc_pdrvstat[1]), proc_show_pdrv_ch1 }, | ||
2794 | { "diskdrives-ch2", offsetof(adapter_t, proc_pdrvstat[2]), proc_show_pdrv_ch2 }, | ||
2795 | { "diskdrives-ch3", offsetof(adapter_t, proc_pdrvstat[3]), proc_show_pdrv_ch3 }, | ||
2796 | { "raiddrives-0-9", offsetof(adapter_t, proc_rdrvstat[0]), proc_show_rdrv_10 }, | ||
2797 | { "raiddrives-10-19", offsetof(adapter_t, proc_rdrvstat[1]), proc_show_rdrv_20 }, | ||
2798 | { "raiddrives-20-29", offsetof(adapter_t, proc_rdrvstat[2]), proc_show_rdrv_30 }, | ||
2799 | { "raiddrives-30-39", offsetof(adapter_t, proc_rdrvstat[3]), proc_show_rdrv_40 }, | ||
2800 | #endif | ||
2801 | { NULL } | ||
2802 | }; | ||
3114 | 2803 | ||
3115 | return len; | 2804 | /** |
2805 | * mega_create_proc_entry() | ||
2806 | * @index - index in soft state array | ||
2807 | * @parent - parent node for this /proc entry | ||
2808 | * | ||
2809 | * Creates /proc entries for our controllers. | ||
2810 | */ | ||
2811 | static void | ||
2812 | mega_create_proc_entry(int index, struct proc_dir_entry *parent) | ||
2813 | { | ||
2814 | const struct mega_proc_file *f; | ||
2815 | adapter_t *adapter = hba_soft_state[index]; | ||
2816 | struct proc_dir_entry *dir, *de, **ppde; | ||
2817 | u8 string[16]; | ||
2818 | |||
2819 | sprintf(string, "hba%d", adapter->host->host_no); | ||
2820 | |||
2821 | dir = adapter->controller_proc_dir_entry = | ||
2822 | proc_mkdir_data(string, 0, parent, adapter); | ||
2823 | if(!dir) { | ||
2824 | printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n"); | ||
2825 | return; | ||
2826 | } | ||
2827 | |||
2828 | for (f = mega_proc_files; f->name; f++) { | ||
2829 | de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops, | ||
2830 | f->show); | ||
2831 | if (!de) { | ||
2832 | printk(KERN_WARNING "\nmegaraid: proc_create failed\n"); | ||
2833 | return; | ||
2834 | } | ||
2835 | |||
2836 | ppde = (void *)adapter + f->ptr_offset; | ||
2837 | *ppde = de; | ||
2838 | } | ||
3116 | } | 2839 | } |
2840 | |||
3117 | #else | 2841 | #else |
3118 | static inline void mega_create_proc_entry(int index, struct proc_dir_entry *parent) | 2842 | static inline void mega_create_proc_entry(int index, struct proc_dir_entry *parent) |
3119 | { | 2843 | { |
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index 4fb2adf6b80d..4d0ce4e78dfd 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -987,24 +987,7 @@ static int mega_init_scb (adapter_t *); | |||
987 | static int mega_is_bios_enabled (adapter_t *); | 987 | static int mega_is_bios_enabled (adapter_t *); |
988 | 988 | ||
989 | #ifdef CONFIG_PROC_FS | 989 | #ifdef CONFIG_PROC_FS |
990 | static int mega_print_inquiry(char *, char *); | ||
991 | static void mega_create_proc_entry(int, struct proc_dir_entry *); | 990 | static void mega_create_proc_entry(int, struct proc_dir_entry *); |
992 | static int proc_read_config(char *, char **, off_t, int, int *, void *); | ||
993 | static int proc_read_stat(char *, char **, off_t, int, int *, void *); | ||
994 | static int proc_read_mbox(char *, char **, off_t, int, int *, void *); | ||
995 | static int proc_rebuild_rate(char *, char **, off_t, int, int *, void *); | ||
996 | static int proc_battery(char *, char **, off_t, int, int *, void *); | ||
997 | static int proc_pdrv_ch0(char *, char **, off_t, int, int *, void *); | ||
998 | static int proc_pdrv_ch1(char *, char **, off_t, int, int *, void *); | ||
999 | static int proc_pdrv_ch2(char *, char **, off_t, int, int *, void *); | ||
1000 | static int proc_pdrv_ch3(char *, char **, off_t, int, int *, void *); | ||
1001 | static int proc_pdrv(adapter_t *, char *, int); | ||
1002 | static int proc_rdrv_10(char *, char **, off_t, int, int *, void *); | ||
1003 | static int proc_rdrv_20(char *, char **, off_t, int, int *, void *); | ||
1004 | static int proc_rdrv_30(char *, char **, off_t, int, int *, void *); | ||
1005 | static int proc_rdrv_40(char *, char **, off_t, int, int *, void *); | ||
1006 | static int proc_rdrv(adapter_t *, char *, int, int); | ||
1007 | |||
1008 | static int mega_adapinq(adapter_t *, dma_addr_t); | 991 | static int mega_adapinq(adapter_t *, dma_addr_t); |
1009 | static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t); | 992 | static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t); |
1010 | #endif | 993 | #endif |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 08685c4cf231..eec052c2670a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -505,19 +505,6 @@ _ctl_fasync(int fd, struct file *filep, int mode) | |||
505 | } | 505 | } |
506 | 506 | ||
507 | /** | 507 | /** |
508 | * _ctl_release - | ||
509 | * @inode - | ||
510 | * @filep - | ||
511 | * | ||
512 | * Called when application releases the fasyn callback handler. | ||
513 | */ | ||
514 | static int | ||
515 | _ctl_release(struct inode *inode, struct file *filep) | ||
516 | { | ||
517 | return fasync_helper(-1, filep, 0, &async_queue); | ||
518 | } | ||
519 | |||
520 | /** | ||
521 | * _ctl_poll - | 508 | * _ctl_poll - |
522 | * @file - | 509 | * @file - |
523 | * @wait - | 510 | * @wait - |
@@ -3027,7 +3014,6 @@ struct device_attribute *mpt2sas_dev_attrs[] = { | |||
3027 | static const struct file_operations ctl_fops = { | 3014 | static const struct file_operations ctl_fops = { |
3028 | .owner = THIS_MODULE, | 3015 | .owner = THIS_MODULE, |
3029 | .unlocked_ioctl = _ctl_ioctl, | 3016 | .unlocked_ioctl = _ctl_ioctl, |
3030 | .release = _ctl_release, | ||
3031 | .poll = _ctl_poll, | 3017 | .poll = _ctl_poll, |
3032 | .fasync = _ctl_fasync, | 3018 | .fasync = _ctl_fasync, |
3033 | #ifdef CONFIG_COMPAT | 3019 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index 054d5231c974..0b402b6f2d26 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c | |||
@@ -503,19 +503,6 @@ _ctl_fasync(int fd, struct file *filep, int mode) | |||
503 | } | 503 | } |
504 | 504 | ||
505 | /** | 505 | /** |
506 | * _ctl_release - | ||
507 | * @inode - | ||
508 | * @filep - | ||
509 | * | ||
510 | * Called when application releases the fasyn callback handler. | ||
511 | */ | ||
512 | static int | ||
513 | _ctl_release(struct inode *inode, struct file *filep) | ||
514 | { | ||
515 | return fasync_helper(-1, filep, 0, &async_queue); | ||
516 | } | ||
517 | |||
518 | /** | ||
519 | * _ctl_poll - | 506 | * _ctl_poll - |
520 | * @file - | 507 | * @file - |
521 | * @wait - | 508 | * @wait - |
@@ -3233,7 +3220,6 @@ struct device_attribute *mpt3sas_dev_attrs[] = { | |||
3233 | static const struct file_operations ctl_fops = { | 3220 | static const struct file_operations ctl_fops = { |
3234 | .owner = THIS_MODULE, | 3221 | .owner = THIS_MODULE, |
3235 | .unlocked_ioctl = _ctl_ioctl, | 3222 | .unlocked_ioctl = _ctl_ioctl, |
3236 | .release = _ctl_release, | ||
3237 | .poll = _ctl_poll, | 3223 | .poll = _ctl_poll, |
3238 | .fasync = _ctl_fasync, | 3224 | .fasync = _ctl_fasync, |
3239 | #ifdef CONFIG_COMPAT | 3225 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index c29d0dbb9660..e7f6661a8862 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c | |||
@@ -76,7 +76,8 @@ int mvme147_detect(struct scsi_host_template *tpnt) | |||
76 | called++; | 76 | called++; |
77 | 77 | ||
78 | tpnt->proc_name = "MVME147"; | 78 | tpnt->proc_name = "MVME147"; |
79 | tpnt->proc_info = &wd33c93_proc_info; | 79 | tpnt->show_info = wd33c93_show_info, |
80 | tpnt->write_info = wd33c93_write_info, | ||
80 | 81 | ||
81 | instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); | 82 | instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); |
82 | if (!instance) | 83 | if (!instance) |
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 1cc0c1c69c88..1e3879dcbdcc 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c | |||
@@ -192,7 +192,7 @@ static int __init init_nsp32 (void); | |||
192 | static void __exit exit_nsp32 (void); | 192 | static void __exit exit_nsp32 (void); |
193 | 193 | ||
194 | /* struct struct scsi_host_template */ | 194 | /* struct struct scsi_host_template */ |
195 | static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); | 195 | static int nsp32_show_info (struct seq_file *, struct Scsi_Host *); |
196 | 196 | ||
197 | static int nsp32_detect (struct pci_dev *pdev); | 197 | static int nsp32_detect (struct pci_dev *pdev); |
198 | static int nsp32_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); | 198 | static int nsp32_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
@@ -268,7 +268,7 @@ static void nsp32_dmessage(const char *, int, int, char *, ...); | |||
268 | static struct scsi_host_template nsp32_template = { | 268 | static struct scsi_host_template nsp32_template = { |
269 | .proc_name = "nsp32", | 269 | .proc_name = "nsp32", |
270 | .name = "Workbit NinjaSCSI-32Bi/UDE", | 270 | .name = "Workbit NinjaSCSI-32Bi/UDE", |
271 | .proc_info = nsp32_proc_info, | 271 | .show_info = nsp32_show_info, |
272 | .info = nsp32_info, | 272 | .info = nsp32_info, |
273 | .queuecommand = nsp32_queuecommand, | 273 | .queuecommand = nsp32_queuecommand, |
274 | .can_queue = 1, | 274 | .can_queue = 1, |
@@ -1442,19 +1442,10 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id) | |||
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | #undef SPRINTF | 1444 | #undef SPRINTF |
1445 | #define SPRINTF(args...) \ | 1445 | #define SPRINTF(args...) seq_printf(m, ##args) |
1446 | do { \ | 1446 | |
1447 | if(length > (pos - buffer)) { \ | 1447 | static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host) |
1448 | pos += snprintf(pos, length - (pos - buffer) + 1, ## args); \ | ||
1449 | nsp32_dbg(NSP32_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ | ||
1450 | } \ | ||
1451 | } while(0) | ||
1452 | |||
1453 | static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start, | ||
1454 | off_t offset, int length, int inout) | ||
1455 | { | 1448 | { |
1456 | char *pos = buffer; | ||
1457 | int thislength; | ||
1458 | unsigned long flags; | 1449 | unsigned long flags; |
1459 | nsp32_hw_data *data; | 1450 | nsp32_hw_data *data; |
1460 | int hostno; | 1451 | int hostno; |
@@ -1463,11 +1454,6 @@ static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1463 | int id, speed; | 1454 | int id, speed; |
1464 | long model; | 1455 | long model; |
1465 | 1456 | ||
1466 | /* Write is not supported, just return. */ | ||
1467 | if (inout == TRUE) { | ||
1468 | return -EINVAL; | ||
1469 | } | ||
1470 | |||
1471 | hostno = host->host_no; | 1457 | hostno = host->host_no; |
1472 | data = (nsp32_hw_data *)host->hostdata; | 1458 | data = (nsp32_hw_data *)host->hostdata; |
1473 | base = host->io_port; | 1459 | base = host->io_port; |
@@ -1527,20 +1513,7 @@ static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1527 | } | 1513 | } |
1528 | SPRINTF("\n"); | 1514 | SPRINTF("\n"); |
1529 | } | 1515 | } |
1530 | 1516 | return 0; | |
1531 | |||
1532 | thislength = pos - (buffer + offset); | ||
1533 | |||
1534 | if(thislength < 0) { | ||
1535 | *start = NULL; | ||
1536 | return 0; | ||
1537 | } | ||
1538 | |||
1539 | |||
1540 | thislength = min(thislength, length); | ||
1541 | *start = buffer + offset; | ||
1542 | |||
1543 | return thislength; | ||
1544 | } | 1517 | } |
1545 | #undef SPRINTF | 1518 | #undef SPRINTF |
1546 | 1519 | ||
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index 2f72c9807b12..62f1a6031765 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c | |||
@@ -388,7 +388,8 @@ int __init pas16_detect(struct scsi_host_template * tpnt) | |||
388 | int count; | 388 | int count; |
389 | 389 | ||
390 | tpnt->proc_name = "pas16"; | 390 | tpnt->proc_name = "pas16"; |
391 | tpnt->proc_info = &pas16_proc_info; | 391 | tpnt->show_info = pas16_show_info; |
392 | tpnt->write_info = pas16_write_info; | ||
392 | 393 | ||
393 | if (pas16_addr != 0) { | 394 | if (pas16_addr != 0) { |
394 | overrides[0].io_port = pas16_addr; | 395 | overrides[0].io_port = pas16_addr; |
diff --git a/drivers/scsi/pas16.h b/drivers/scsi/pas16.h index a04281cace2e..3721342835e9 100644 --- a/drivers/scsi/pas16.h +++ b/drivers/scsi/pas16.h | |||
@@ -163,7 +163,8 @@ static int pas16_bus_reset(Scsi_Cmnd *); | |||
163 | #define NCR5380_queue_command pas16_queue_command | 163 | #define NCR5380_queue_command pas16_queue_command |
164 | #define NCR5380_abort pas16_abort | 164 | #define NCR5380_abort pas16_abort |
165 | #define NCR5380_bus_reset pas16_bus_reset | 165 | #define NCR5380_bus_reset pas16_bus_reset |
166 | #define NCR5380_proc_info pas16_proc_info | 166 | #define NCR5380_show_info pas16_show_info |
167 | #define NCR5380_write_info pas16_write_info | ||
167 | 168 | ||
168 | /* 15 14 12 10 7 5 3 | 169 | /* 15 14 12 10 7 5 3 |
169 | 1101 0100 1010 1000 */ | 170 | 1101 0100 1010 1000 */ |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index b61a753eb896..987fbb1b244e 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -76,7 +76,7 @@ MODULE_PARM_DESC(free_ports, "Release IO ports after configuration? (default: 0 | |||
76 | 76 | ||
77 | static struct scsi_host_template nsp_driver_template = { | 77 | static struct scsi_host_template nsp_driver_template = { |
78 | .proc_name = "nsp_cs", | 78 | .proc_name = "nsp_cs", |
79 | .proc_info = nsp_proc_info, | 79 | .show_info = nsp_show_info, |
80 | .name = "WorkBit NinjaSCSI-3/32Bi(16bit)", | 80 | .name = "WorkBit NinjaSCSI-3/32Bi(16bit)", |
81 | .info = nsp_info, | 81 | .info = nsp_info, |
82 | .queuecommand = nsp_queuecommand, | 82 | .queuecommand = nsp_queuecommand, |
@@ -1365,33 +1365,19 @@ static const char *nsp_info(struct Scsi_Host *shpnt) | |||
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | #undef SPRINTF | 1367 | #undef SPRINTF |
1368 | #define SPRINTF(args...) \ | 1368 | #define SPRINTF(args...) seq_printf(m, ##args) |
1369 | do { \ | 1369 | |
1370 | if(length > (pos - buffer)) { \ | 1370 | static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host) |
1371 | pos += snprintf(pos, length - (pos - buffer) + 1, ## args); \ | ||
1372 | nsp_dbg(NSP_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ | ||
1373 | } \ | ||
1374 | } while(0) | ||
1375 | |||
1376 | static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start, | ||
1377 | off_t offset, int length, int inout) | ||
1378 | { | 1371 | { |
1379 | int id; | 1372 | int id; |
1380 | char *pos = buffer; | ||
1381 | int thislength; | ||
1382 | int speed; | 1373 | int speed; |
1383 | unsigned long flags; | 1374 | unsigned long flags; |
1384 | nsp_hw_data *data; | 1375 | nsp_hw_data *data; |
1385 | int hostno; | 1376 | int hostno; |
1386 | 1377 | ||
1387 | if (inout) { | ||
1388 | return -EINVAL; | ||
1389 | } | ||
1390 | |||
1391 | hostno = host->host_no; | 1378 | hostno = host->host_no; |
1392 | data = (nsp_hw_data *)host->hostdata; | 1379 | data = (nsp_hw_data *)host->hostdata; |
1393 | 1380 | ||
1394 | |||
1395 | SPRINTF("NinjaSCSI status\n\n"); | 1381 | SPRINTF("NinjaSCSI status\n\n"); |
1396 | SPRINTF("Driver version: $Revision: 1.23 $\n"); | 1382 | SPRINTF("Driver version: $Revision: 1.23 $\n"); |
1397 | SPRINTF("SCSI host No.: %d\n", hostno); | 1383 | SPRINTF("SCSI host No.: %d\n", hostno); |
@@ -1458,19 +1444,7 @@ static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1458 | } | 1444 | } |
1459 | SPRINTF("\n"); | 1445 | SPRINTF("\n"); |
1460 | } | 1446 | } |
1461 | 1447 | return 0; | |
1462 | thislength = pos - (buffer + offset); | ||
1463 | |||
1464 | if(thislength < 0) { | ||
1465 | *start = NULL; | ||
1466 | return 0; | ||
1467 | } | ||
1468 | |||
1469 | |||
1470 | thislength = min(thislength, length); | ||
1471 | *start = buffer + offset; | ||
1472 | |||
1473 | return thislength; | ||
1474 | } | 1448 | } |
1475 | #undef SPRINTF | 1449 | #undef SPRINTF |
1476 | 1450 | ||
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index 7fc9a9d0a448..afd64f0adc4b 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h | |||
@@ -292,13 +292,8 @@ static int nsp_cs_config (struct pcmcia_device *link); | |||
292 | /* Linux SCSI subsystem specific functions */ | 292 | /* Linux SCSI subsystem specific functions */ |
293 | static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht); | 293 | static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht); |
294 | static const char *nsp_info (struct Scsi_Host *shpnt); | 294 | static const char *nsp_info (struct Scsi_Host *shpnt); |
295 | static int nsp_proc_info ( | 295 | static int nsp_show_info (struct seq_file *m, |
296 | struct Scsi_Host *host, | 296 | struct Scsi_Host *host); |
297 | char *buffer, | ||
298 | char **start, | ||
299 | off_t offset, | ||
300 | int length, | ||
301 | int inout); | ||
302 | static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt); | 297 | static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt); |
303 | 298 | ||
304 | /* Error handler */ | 299 | /* Error handler */ |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index b46f5e906837..8e1b73775065 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -3599,19 +3599,6 @@ static int pmcraid_chr_open(struct inode *inode, struct file *filep) | |||
3599 | } | 3599 | } |
3600 | 3600 | ||
3601 | /** | 3601 | /** |
3602 | * pmcraid_release - char node "release" entry point | ||
3603 | */ | ||
3604 | static int pmcraid_chr_release(struct inode *inode, struct file *filep) | ||
3605 | { | ||
3606 | struct pmcraid_instance *pinstance = filep->private_data; | ||
3607 | |||
3608 | filep->private_data = NULL; | ||
3609 | fasync_helper(-1, filep, 0, &pinstance->aen_queue); | ||
3610 | |||
3611 | return 0; | ||
3612 | } | ||
3613 | |||
3614 | /** | ||
3615 | * pmcraid_fasync - Async notifier registration from applications | 3602 | * pmcraid_fasync - Async notifier registration from applications |
3616 | * | 3603 | * |
3617 | * This function adds the calling process to a driver global queue. When an | 3604 | * This function adds the calling process to a driver global queue. When an |
@@ -4167,7 +4154,6 @@ static long pmcraid_chr_ioctl( | |||
4167 | static const struct file_operations pmcraid_fops = { | 4154 | static const struct file_operations pmcraid_fops = { |
4168 | .owner = THIS_MODULE, | 4155 | .owner = THIS_MODULE, |
4169 | .open = pmcraid_chr_open, | 4156 | .open = pmcraid_chr_open, |
4170 | .release = pmcraid_chr_release, | ||
4171 | .fasync = pmcraid_chr_fasync, | 4157 | .fasync = pmcraid_chr_fasync, |
4172 | .unlocked_ioctl = pmcraid_chr_ioctl, | 4158 | .unlocked_ioctl = pmcraid_chr_ioctl, |
4173 | #ifdef CONFIG_COMPAT | 4159 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index d164c9639361..1db8b26063b4 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -118,8 +118,9 @@ static inline void ppa_pb_release(ppa_struct *dev) | |||
118 | * Also gives a method to use a script to obtain optimum timings (TODO) | 118 | * Also gives a method to use a script to obtain optimum timings (TODO) |
119 | */ | 119 | */ |
120 | 120 | ||
121 | static inline int ppa_proc_write(ppa_struct *dev, char *buffer, int length) | 121 | static inline int ppa_write_info(struct Scsi_Host *host, char *buffer, int length) |
122 | { | 122 | { |
123 | ppa_struct *dev = ppa_dev(host); | ||
123 | unsigned long x; | 124 | unsigned long x; |
124 | 125 | ||
125 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { | 126 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { |
@@ -137,35 +138,17 @@ static inline int ppa_proc_write(ppa_struct *dev, char *buffer, int length) | |||
137 | return -EINVAL; | 138 | return -EINVAL; |
138 | } | 139 | } |
139 | 140 | ||
140 | static int ppa_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) | 141 | static int ppa_show_info(struct seq_file *m, struct Scsi_Host *host) |
141 | { | 142 | { |
142 | int len = 0; | ||
143 | ppa_struct *dev = ppa_dev(host); | 143 | ppa_struct *dev = ppa_dev(host); |
144 | 144 | ||
145 | if (inout) | 145 | seq_printf(m, "Version : %s\n", PPA_VERSION); |
146 | return ppa_proc_write(dev, buffer, length); | 146 | seq_printf(m, "Parport : %s\n", dev->dev->port->name); |
147 | 147 | seq_printf(m, "Mode : %s\n", PPA_MODE_STRING[dev->mode]); | |
148 | len += sprintf(buffer + len, "Version : %s\n", PPA_VERSION); | ||
149 | len += | ||
150 | sprintf(buffer + len, "Parport : %s\n", | ||
151 | dev->dev->port->name); | ||
152 | len += | ||
153 | sprintf(buffer + len, "Mode : %s\n", | ||
154 | PPA_MODE_STRING[dev->mode]); | ||
155 | #if PPA_DEBUG > 0 | 148 | #if PPA_DEBUG > 0 |
156 | len += | 149 | seq_printf(m, "recon_tmo : %lu\n", dev->recon_tmo); |
157 | sprintf(buffer + len, "recon_tmo : %lu\n", dev->recon_tmo); | ||
158 | #endif | 150 | #endif |
159 | 151 | return 0; | |
160 | /* Request for beyond end of buffer */ | ||
161 | if (offset > length) | ||
162 | return 0; | ||
163 | |||
164 | *start = buffer + offset; | ||
165 | len -= offset; | ||
166 | if (len > length) | ||
167 | len = length; | ||
168 | return len; | ||
169 | } | 152 | } |
170 | 153 | ||
171 | static int device_check(ppa_struct *dev); | 154 | static int device_check(ppa_struct *dev); |
@@ -981,7 +964,8 @@ static int ppa_adjust_queue(struct scsi_device *device) | |||
981 | static struct scsi_host_template ppa_template = { | 964 | static struct scsi_host_template ppa_template = { |
982 | .module = THIS_MODULE, | 965 | .module = THIS_MODULE, |
983 | .proc_name = "ppa", | 966 | .proc_name = "ppa", |
984 | .proc_info = ppa_proc_info, | 967 | .show_info = ppa_show_info, |
968 | .write_info = ppa_write_info, | ||
985 | .name = "Iomega VPI0 (ppa) interface", | 969 | .name = "Iomega VPI0 (ppa) interface", |
986 | .queuecommand = ppa_queuecommand, | 970 | .queuecommand = ppa_queuecommand, |
987 | .eh_abort_handler = ppa_abort, | 971 | .eh_abort_handler = ppa_abort, |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a083715843bd..5307bf86d5e0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -5539,7 +5539,7 @@ static struct pci_driver qla2xxx_pci_driver = { | |||
5539 | .err_handler = &qla2xxx_err_handler, | 5539 | .err_handler = &qla2xxx_err_handler, |
5540 | }; | 5540 | }; |
5541 | 5541 | ||
5542 | static struct file_operations apidev_fops = { | 5542 | static const struct file_operations apidev_fops = { |
5543 | .owner = THIS_MODULE, | 5543 | .owner = THIS_MODULE, |
5544 | .llseek = noop_llseek, | 5544 | .llseek = noop_llseek, |
5545 | }; | 5545 | }; |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 5cda11c07c68..5add6f4e7928 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -2823,31 +2823,27 @@ static const char * scsi_debug_info(struct Scsi_Host * shp) | |||
2823 | /* scsi_debug_proc_info | 2823 | /* scsi_debug_proc_info |
2824 | * Used if the driver currently has no own support for /proc/scsi | 2824 | * Used if the driver currently has no own support for /proc/scsi |
2825 | */ | 2825 | */ |
2826 | static int scsi_debug_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 2826 | static int scsi_debug_write_info(struct Scsi_Host *host, char *buffer, int length) |
2827 | int length, int inout) | ||
2828 | { | 2827 | { |
2829 | int len, pos, begin; | 2828 | char arr[16]; |
2830 | int orig_length; | 2829 | int opts; |
2830 | int minLen = length > 15 ? 15 : length; | ||
2831 | 2831 | ||
2832 | orig_length = length; | 2832 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) |
2833 | 2833 | return -EACCES; | |
2834 | if (inout == 1) { | 2834 | memcpy(arr, buffer, minLen); |
2835 | char arr[16]; | 2835 | arr[minLen] = '\0'; |
2836 | int minLen = length > 15 ? 15 : length; | 2836 | if (1 != sscanf(arr, "%d", &opts)) |
2837 | return -EINVAL; | ||
2838 | scsi_debug_opts = opts; | ||
2839 | if (scsi_debug_every_nth != 0) | ||
2840 | scsi_debug_cmnd_count = 0; | ||
2841 | return length; | ||
2842 | } | ||
2837 | 2843 | ||
2838 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) | 2844 | static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host) |
2839 | return -EACCES; | 2845 | { |
2840 | memcpy(arr, buffer, minLen); | 2846 | seq_printf(m, "scsi_debug adapter driver, version " |
2841 | arr[minLen] = '\0'; | ||
2842 | if (1 != sscanf(arr, "%d", &pos)) | ||
2843 | return -EINVAL; | ||
2844 | scsi_debug_opts = pos; | ||
2845 | if (scsi_debug_every_nth != 0) | ||
2846 | scsi_debug_cmnd_count = 0; | ||
2847 | return length; | ||
2848 | } | ||
2849 | begin = 0; | ||
2850 | pos = len = sprintf(buffer, "scsi_debug adapter driver, version " | ||
2851 | "%s [%s]\n" | 2847 | "%s [%s]\n" |
2852 | "num_tgts=%d, shared (ram) size=%d MB, opts=0x%x, " | 2848 | "num_tgts=%d, shared (ram) size=%d MB, opts=0x%x, " |
2853 | "every_nth=%d(curr:%d)\n" | 2849 | "every_nth=%d(curr:%d)\n" |
@@ -2862,15 +2858,7 @@ static int scsi_debug_proc_info(struct Scsi_Host *host, char *buffer, char **sta | |||
2862 | scsi_debug_sector_size, sdebug_cylinders_per, sdebug_heads, | 2858 | scsi_debug_sector_size, sdebug_cylinders_per, sdebug_heads, |
2863 | sdebug_sectors_per, num_aborts, num_dev_resets, num_bus_resets, | 2859 | sdebug_sectors_per, num_aborts, num_dev_resets, num_bus_resets, |
2864 | num_host_resets, dix_reads, dix_writes, dif_errors); | 2860 | num_host_resets, dix_reads, dix_writes, dif_errors); |
2865 | if (pos < offset) { | 2861 | return 0; |
2866 | len = 0; | ||
2867 | begin = pos; | ||
2868 | } | ||
2869 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
2870 | len -= (offset - begin); | ||
2871 | if (len > length) | ||
2872 | len = length; | ||
2873 | return len; | ||
2874 | } | 2862 | } |
2875 | 2863 | ||
2876 | static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf) | 2864 | static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf) |
@@ -3957,7 +3945,8 @@ write: | |||
3957 | static DEF_SCSI_QCMD(scsi_debug_queuecommand) | 3945 | static DEF_SCSI_QCMD(scsi_debug_queuecommand) |
3958 | 3946 | ||
3959 | static struct scsi_host_template sdebug_driver_template = { | 3947 | static struct scsi_host_template sdebug_driver_template = { |
3960 | .proc_info = scsi_debug_proc_info, | 3948 | .show_info = scsi_debug_show_info, |
3949 | .write_info = scsi_debug_write_info, | ||
3961 | .proc_name = sdebug_proc_name, | 3950 | .proc_name = sdebug_proc_name, |
3962 | .name = "SCSI DEBUG", | 3951 | .name = "SCSI DEBUG", |
3963 | .info = scsi_debug_info, | 3952 | .info = scsi_debug_info, |
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index ad747dc337da..db66357211ed 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c | |||
@@ -45,58 +45,50 @@ static struct proc_dir_entry *proc_scsi; | |||
45 | /* Protect sht->present and sht->proc_dir */ | 45 | /* Protect sht->present and sht->proc_dir */ |
46 | static DEFINE_MUTEX(global_host_template_mutex); | 46 | static DEFINE_MUTEX(global_host_template_mutex); |
47 | 47 | ||
48 | /** | 48 | static ssize_t proc_scsi_host_write(struct file *file, const char __user *buf, |
49 | * proc_scsi_read - handle read from /proc by calling host's proc_info() command | 49 | size_t count, loff_t *ppos) |
50 | * @buffer: passed to proc_info | ||
51 | * @start: passed to proc_info | ||
52 | * @offset: passed to proc_info | ||
53 | * @length: passed to proc_info | ||
54 | * @eof: returns whether length read was less than requested | ||
55 | * @data: pointer to a &struct Scsi_Host | ||
56 | */ | ||
57 | |||
58 | static int proc_scsi_read(char *buffer, char **start, off_t offset, | ||
59 | int length, int *eof, void *data) | ||
60 | { | ||
61 | struct Scsi_Host *shost = data; | ||
62 | int n; | ||
63 | |||
64 | n = shost->hostt->proc_info(shost, buffer, start, offset, length, 0); | ||
65 | *eof = (n < length); | ||
66 | |||
67 | return n; | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * proc_scsi_write_proc - Handle write to /proc by calling host's proc_info() | ||
72 | * @file: not used | ||
73 | * @buf: source of data to write. | ||
74 | * @count: number of bytes (at most PROC_BLOCK_SIZE) to write. | ||
75 | * @data: pointer to &struct Scsi_Host | ||
76 | */ | ||
77 | static int proc_scsi_write_proc(struct file *file, const char __user *buf, | ||
78 | unsigned long count, void *data) | ||
79 | { | 50 | { |
80 | struct Scsi_Host *shost = data; | 51 | struct Scsi_Host *shost = PDE_DATA(file_inode(file)); |
81 | ssize_t ret = -ENOMEM; | 52 | ssize_t ret = -ENOMEM; |
82 | char *page; | 53 | char *page; |
83 | char *start; | ||
84 | 54 | ||
85 | if (count > PROC_BLOCK_SIZE) | 55 | if (count > PROC_BLOCK_SIZE) |
86 | return -EOVERFLOW; | 56 | return -EOVERFLOW; |
87 | 57 | ||
58 | if (!shost->hostt->write_info) | ||
59 | return -EINVAL; | ||
60 | |||
88 | page = (char *)__get_free_page(GFP_KERNEL); | 61 | page = (char *)__get_free_page(GFP_KERNEL); |
89 | if (page) { | 62 | if (page) { |
90 | ret = -EFAULT; | 63 | ret = -EFAULT; |
91 | if (copy_from_user(page, buf, count)) | 64 | if (copy_from_user(page, buf, count)) |
92 | goto out; | 65 | goto out; |
93 | ret = shost->hostt->proc_info(shost, page, &start, 0, count, 1); | 66 | ret = shost->hostt->write_info(shost, page, count); |
94 | } | 67 | } |
95 | out: | 68 | out: |
96 | free_page((unsigned long)page); | 69 | free_page((unsigned long)page); |
97 | return ret; | 70 | return ret; |
98 | } | 71 | } |
99 | 72 | ||
73 | static int proc_scsi_show(struct seq_file *m, void *v) | ||
74 | { | ||
75 | struct Scsi_Host *shost = m->private; | ||
76 | return shost->hostt->show_info(m, shost); | ||
77 | } | ||
78 | |||
79 | static int proc_scsi_host_open(struct inode *inode, struct file *file) | ||
80 | { | ||
81 | return single_open_size(file, proc_scsi_show, PDE_DATA(inode), | ||
82 | 4 * PAGE_SIZE); | ||
83 | } | ||
84 | |||
85 | static const struct file_operations proc_scsi_fops = { | ||
86 | .open = proc_scsi_host_open, | ||
87 | .read = seq_read, | ||
88 | .llseek = seq_lseek, | ||
89 | .write = proc_scsi_host_write | ||
90 | }; | ||
91 | |||
100 | /** | 92 | /** |
101 | * scsi_proc_hostdir_add - Create directory in /proc for a scsi host | 93 | * scsi_proc_hostdir_add - Create directory in /proc for a scsi host |
102 | * @sht: owner of this directory | 94 | * @sht: owner of this directory |
@@ -106,7 +98,7 @@ out: | |||
106 | 98 | ||
107 | void scsi_proc_hostdir_add(struct scsi_host_template *sht) | 99 | void scsi_proc_hostdir_add(struct scsi_host_template *sht) |
108 | { | 100 | { |
109 | if (!sht->proc_info) | 101 | if (!sht->show_info) |
110 | return; | 102 | return; |
111 | 103 | ||
112 | mutex_lock(&global_host_template_mutex); | 104 | mutex_lock(&global_host_template_mutex); |
@@ -125,7 +117,7 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht) | |||
125 | */ | 117 | */ |
126 | void scsi_proc_hostdir_rm(struct scsi_host_template *sht) | 118 | void scsi_proc_hostdir_rm(struct scsi_host_template *sht) |
127 | { | 119 | { |
128 | if (!sht->proc_info) | 120 | if (!sht->show_info) |
129 | return; | 121 | return; |
130 | 122 | ||
131 | mutex_lock(&global_host_template_mutex); | 123 | mutex_lock(&global_host_template_mutex); |
@@ -151,16 +143,12 @@ void scsi_proc_host_add(struct Scsi_Host *shost) | |||
151 | return; | 143 | return; |
152 | 144 | ||
153 | sprintf(name,"%d", shost->host_no); | 145 | sprintf(name,"%d", shost->host_no); |
154 | p = create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, | 146 | p = proc_create_data(name, S_IRUGO | S_IWUSR, |
155 | sht->proc_dir, proc_scsi_read, shost); | 147 | sht->proc_dir, &proc_scsi_fops, shost); |
156 | if (!p) { | 148 | if (!p) |
157 | printk(KERN_ERR "%s: Failed to register host %d in" | 149 | printk(KERN_ERR "%s: Failed to register host %d in" |
158 | "%s\n", __func__, shost->host_no, | 150 | "%s\n", __func__, shost->host_no, |
159 | sht->proc_name); | 151 | sht->proc_name); |
160 | return; | ||
161 | } | ||
162 | |||
163 | p->write_proc = proc_scsi_write_proc; | ||
164 | } | 152 | } |
165 | 153 | ||
166 | /** | 154 | /** |
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 599568299fbe..bac55f7f69f9 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -1171,112 +1171,36 @@ printk("sym_user_command: data=%ld\n", uc->data); | |||
1171 | #endif /* SYM_LINUX_USER_COMMAND_SUPPORT */ | 1171 | #endif /* SYM_LINUX_USER_COMMAND_SUPPORT */ |
1172 | 1172 | ||
1173 | 1173 | ||
1174 | #ifdef SYM_LINUX_USER_INFO_SUPPORT | ||
1175 | /* | ||
1176 | * Informations through the proc file system. | ||
1177 | */ | ||
1178 | struct info_str { | ||
1179 | char *buffer; | ||
1180 | int length; | ||
1181 | int offset; | ||
1182 | int pos; | ||
1183 | }; | ||
1184 | |||
1185 | static void copy_mem_info(struct info_str *info, char *data, int len) | ||
1186 | { | ||
1187 | if (info->pos + len > info->length) | ||
1188 | len = info->length - info->pos; | ||
1189 | |||
1190 | if (info->pos + len < info->offset) { | ||
1191 | info->pos += len; | ||
1192 | return; | ||
1193 | } | ||
1194 | if (info->pos < info->offset) { | ||
1195 | data += (info->offset - info->pos); | ||
1196 | len -= (info->offset - info->pos); | ||
1197 | } | ||
1198 | |||
1199 | if (len > 0) { | ||
1200 | memcpy(info->buffer + info->pos, data, len); | ||
1201 | info->pos += len; | ||
1202 | } | ||
1203 | } | ||
1204 | |||
1205 | static int copy_info(struct info_str *info, char *fmt, ...) | ||
1206 | { | ||
1207 | va_list args; | ||
1208 | char buf[81]; | ||
1209 | int len; | ||
1210 | |||
1211 | va_start(args, fmt); | ||
1212 | len = vsprintf(buf, fmt, args); | ||
1213 | va_end(args); | ||
1214 | |||
1215 | copy_mem_info(info, buf, len); | ||
1216 | return len; | ||
1217 | } | ||
1218 | |||
1219 | /* | 1174 | /* |
1220 | * Copy formatted information into the input buffer. | 1175 | * Copy formatted information into the input buffer. |
1221 | */ | 1176 | */ |
1222 | static int sym_host_info(struct Scsi_Host *shost, char *ptr, off_t offset, int len) | 1177 | static int sym_show_info(struct seq_file *m, struct Scsi_Host *shost) |
1223 | { | 1178 | { |
1179 | #ifdef SYM_LINUX_USER_INFO_SUPPORT | ||
1224 | struct sym_data *sym_data = shost_priv(shost); | 1180 | struct sym_data *sym_data = shost_priv(shost); |
1225 | struct pci_dev *pdev = sym_data->pdev; | 1181 | struct pci_dev *pdev = sym_data->pdev; |
1226 | struct sym_hcb *np = sym_data->ncb; | 1182 | struct sym_hcb *np = sym_data->ncb; |
1227 | struct info_str info; | ||
1228 | |||
1229 | info.buffer = ptr; | ||
1230 | info.length = len; | ||
1231 | info.offset = offset; | ||
1232 | info.pos = 0; | ||
1233 | 1183 | ||
1234 | copy_info(&info, "Chip " NAME53C "%s, device id 0x%x, " | 1184 | seq_printf(m, "Chip " NAME53C "%s, device id 0x%x, " |
1235 | "revision id 0x%x\n", np->s.chip_name, | 1185 | "revision id 0x%x\n", np->s.chip_name, |
1236 | pdev->device, pdev->revision); | 1186 | pdev->device, pdev->revision); |
1237 | copy_info(&info, "At PCI address %s, IRQ %u\n", | 1187 | seq_printf(m, "At PCI address %s, IRQ %u\n", |
1238 | pci_name(pdev), pdev->irq); | 1188 | pci_name(pdev), pdev->irq); |
1239 | copy_info(&info, "Min. period factor %d, %s SCSI BUS%s\n", | 1189 | seq_printf(m, "Min. period factor %d, %s SCSI BUS%s\n", |
1240 | (int) (np->minsync_dt ? np->minsync_dt : np->minsync), | 1190 | (int) (np->minsync_dt ? np->minsync_dt : np->minsync), |
1241 | np->maxwide ? "Wide" : "Narrow", | 1191 | np->maxwide ? "Wide" : "Narrow", |
1242 | np->minsync_dt ? ", DT capable" : ""); | 1192 | np->minsync_dt ? ", DT capable" : ""); |
1243 | 1193 | ||
1244 | copy_info(&info, "Max. started commands %d, " | 1194 | seq_printf(m, "Max. started commands %d, " |
1245 | "max. commands per LUN %d\n", | 1195 | "max. commands per LUN %d\n", |
1246 | SYM_CONF_MAX_START, SYM_CONF_MAX_TAG); | 1196 | SYM_CONF_MAX_START, SYM_CONF_MAX_TAG); |
1247 | 1197 | ||
1248 | return info.pos > info.offset? info.pos - info.offset : 0; | 1198 | return 0; |
1249 | } | ||
1250 | #endif /* SYM_LINUX_USER_INFO_SUPPORT */ | ||
1251 | |||
1252 | /* | ||
1253 | * Entry point of the scsi proc fs of the driver. | ||
1254 | * - func = 0 means read (returns adapter infos) | ||
1255 | * - func = 1 means write (not yet merget from sym53c8xx) | ||
1256 | */ | ||
1257 | static int sym53c8xx_proc_info(struct Scsi_Host *shost, char *buffer, | ||
1258 | char **start, off_t offset, int length, int func) | ||
1259 | { | ||
1260 | int retv; | ||
1261 | |||
1262 | if (func) { | ||
1263 | #ifdef SYM_LINUX_USER_COMMAND_SUPPORT | ||
1264 | retv = sym_user_command(shost, buffer, length); | ||
1265 | #else | ||
1266 | retv = -EINVAL; | ||
1267 | #endif | ||
1268 | } else { | ||
1269 | if (start) | ||
1270 | *start = buffer; | ||
1271 | #ifdef SYM_LINUX_USER_INFO_SUPPORT | ||
1272 | retv = sym_host_info(shost, buffer, offset, length); | ||
1273 | #else | 1199 | #else |
1274 | retv = -EINVAL; | 1200 | return -EINVAL; |
1275 | #endif | 1201 | #endif /* SYM_LINUX_USER_INFO_SUPPORT */ |
1276 | } | ||
1277 | |||
1278 | return retv; | ||
1279 | } | 1202 | } |
1203 | |||
1280 | #endif /* SYM_LINUX_PROC_INFO_SUPPORT */ | 1204 | #endif /* SYM_LINUX_PROC_INFO_SUPPORT */ |
1281 | 1205 | ||
1282 | /* | 1206 | /* |
@@ -1742,7 +1666,10 @@ static struct scsi_host_template sym2_template = { | |||
1742 | .use_clustering = ENABLE_CLUSTERING, | 1666 | .use_clustering = ENABLE_CLUSTERING, |
1743 | .max_sectors = 0xFFFF, | 1667 | .max_sectors = 0xFFFF, |
1744 | #ifdef SYM_LINUX_PROC_INFO_SUPPORT | 1668 | #ifdef SYM_LINUX_PROC_INFO_SUPPORT |
1745 | .proc_info = sym53c8xx_proc_info, | 1669 | .show_info = sym_show_info, |
1670 | #ifdef SYM_LINUX_USER_COMMAND_SUPPORT | ||
1671 | .write_info = sym_user_command, | ||
1672 | #endif | ||
1746 | .proc_name = NAME53C8XX, | 1673 | .proc_name = NAME53C8XX, |
1747 | #endif | 1674 | #endif |
1748 | }; | 1675 | }; |
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index d672d97fb84a..f1e4b4148c75 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c | |||
@@ -201,7 +201,8 @@ int __init t128_detect(struct scsi_host_template * tpnt){ | |||
201 | int sig, count; | 201 | int sig, count; |
202 | 202 | ||
203 | tpnt->proc_name = "t128"; | 203 | tpnt->proc_name = "t128"; |
204 | tpnt->proc_info = &t128_proc_info; | 204 | tpnt->show_info = t128_show_info; |
205 | tpnt->write_info = t128_write_info; | ||
205 | 206 | ||
206 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { | 207 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { |
207 | base = 0; | 208 | base = 0; |
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h index ada1115079c9..1df82c28e56d 100644 --- a/drivers/scsi/t128.h +++ b/drivers/scsi/t128.h | |||
@@ -140,7 +140,8 @@ static int t128_bus_reset(struct scsi_cmnd *); | |||
140 | #define NCR5380_queue_command t128_queue_command | 140 | #define NCR5380_queue_command t128_queue_command |
141 | #define NCR5380_abort t128_abort | 141 | #define NCR5380_abort t128_abort |
142 | #define NCR5380_bus_reset t128_bus_reset | 142 | #define NCR5380_bus_reset t128_bus_reset |
143 | #define NCR5380_proc_info t128_proc_info | 143 | #define NCR5380_show_info t128_show_info |
144 | #define NCR5380_write_info t128_write_info | ||
144 | 145 | ||
145 | /* 15 14 12 10 7 5 3 | 146 | /* 15 14 12 10 7 5 3 |
146 | 1101 0100 1010 1000 */ | 147 | 1101 0100 1010 1000 */ |
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index c0ee4ea28a19..41883a87931d 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c | |||
@@ -2054,22 +2054,16 @@ wd33c93_init(struct Scsi_Host *instance, const wd33c93_regs regs, | |||
2054 | printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE); | 2054 | printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE); |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | int | 2057 | int wd33c93_write_info(struct Scsi_Host *instance, char *buf, int len) |
2058 | wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) | ||
2059 | { | 2058 | { |
2060 | |||
2061 | #ifdef PROC_INTERFACE | 2059 | #ifdef PROC_INTERFACE |
2062 | |||
2063 | char *bp; | 2060 | char *bp; |
2064 | char tbuf[128]; | ||
2065 | struct WD33C93_hostdata *hd; | 2061 | struct WD33C93_hostdata *hd; |
2066 | struct scsi_cmnd *cmd; | ||
2067 | int x; | 2062 | int x; |
2068 | static int stop = 0; | ||
2069 | 2063 | ||
2070 | hd = (struct WD33C93_hostdata *) instance->hostdata; | 2064 | hd = (struct WD33C93_hostdata *) instance->hostdata; |
2071 | 2065 | ||
2072 | /* If 'in' is TRUE we need to _read_ the proc file. We accept the following | 2066 | /* We accept the following |
2073 | * keywords (same format as command-line, but arguments are not optional): | 2067 | * keywords (same format as command-line, but arguments are not optional): |
2074 | * debug | 2068 | * debug |
2075 | * disconnect | 2069 | * disconnect |
@@ -2083,145 +2077,124 @@ wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off | |||
2083 | * nosync | 2077 | * nosync |
2084 | */ | 2078 | */ |
2085 | 2079 | ||
2086 | if (in) { | 2080 | buf[len] = '\0'; |
2087 | buf[len] = '\0'; | 2081 | for (bp = buf; *bp; ) { |
2088 | for (bp = buf; *bp; ) { | 2082 | while (',' == *bp || ' ' == *bp) |
2089 | while (',' == *bp || ' ' == *bp) | 2083 | ++bp; |
2090 | ++bp; | 2084 | if (!strncmp(bp, "debug:", 6)) { |
2091 | if (!strncmp(bp, "debug:", 6)) { | 2085 | hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; |
2092 | hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; | 2086 | } else if (!strncmp(bp, "disconnect:", 11)) { |
2093 | } else if (!strncmp(bp, "disconnect:", 11)) { | 2087 | x = simple_strtoul(bp+11, &bp, 0); |
2094 | x = simple_strtoul(bp+11, &bp, 0); | 2088 | if (x < DIS_NEVER || x > DIS_ALWAYS) |
2095 | if (x < DIS_NEVER || x > DIS_ALWAYS) | 2089 | x = DIS_ADAPTIVE; |
2096 | x = DIS_ADAPTIVE; | 2090 | hd->disconnect = x; |
2097 | hd->disconnect = x; | 2091 | } else if (!strncmp(bp, "period:", 7)) { |
2098 | } else if (!strncmp(bp, "period:", 7)) { | 2092 | x = simple_strtoul(bp+7, &bp, 0); |
2093 | hd->default_sx_per = | ||
2094 | hd->sx_table[round_period((unsigned int) x, | ||
2095 | hd->sx_table)].period_ns; | ||
2096 | } else if (!strncmp(bp, "resync:", 7)) { | ||
2097 | set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); | ||
2098 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2099 | hd->proc = simple_strtoul(bp+5, &bp, 0); | ||
2100 | } else if (!strncmp(bp, "nodma:", 6)) { | ||
2101 | hd->no_dma = simple_strtoul(bp+6, &bp, 0); | ||
2102 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2103 | hd->level2 = simple_strtoul(bp+7, &bp, 0); | ||
2104 | } else if (!strncmp(bp, "burst:", 6)) { | ||
2105 | hd->dma_mode = | ||
2106 | simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; | ||
2107 | } else if (!strncmp(bp, "fast:", 5)) { | ||
2108 | x = !!simple_strtol(bp+5, &bp, 0); | ||
2109 | if (x != hd->fast) | ||
2110 | set_resync(hd, 0xff); | ||
2111 | hd->fast = x; | ||
2112 | } else if (!strncmp(bp, "nosync:", 7)) { | ||
2099 | x = simple_strtoul(bp+7, &bp, 0); | 2113 | x = simple_strtoul(bp+7, &bp, 0); |
2100 | hd->default_sx_per = | 2114 | set_resync(hd, x ^ hd->no_sync); |
2101 | hd->sx_table[round_period((unsigned int) x, | 2115 | hd->no_sync = x; |
2102 | hd->sx_table)].period_ns; | 2116 | } else { |
2103 | } else if (!strncmp(bp, "resync:", 7)) { | 2117 | break; /* unknown keyword,syntax-error,... */ |
2104 | set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); | ||
2105 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2106 | hd->proc = simple_strtoul(bp+5, &bp, 0); | ||
2107 | } else if (!strncmp(bp, "nodma:", 6)) { | ||
2108 | hd->no_dma = simple_strtoul(bp+6, &bp, 0); | ||
2109 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2110 | hd->level2 = simple_strtoul(bp+7, &bp, 0); | ||
2111 | } else if (!strncmp(bp, "burst:", 6)) { | ||
2112 | hd->dma_mode = | ||
2113 | simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; | ||
2114 | } else if (!strncmp(bp, "fast:", 5)) { | ||
2115 | x = !!simple_strtol(bp+5, &bp, 0); | ||
2116 | if (x != hd->fast) | ||
2117 | set_resync(hd, 0xff); | ||
2118 | hd->fast = x; | ||
2119 | } else if (!strncmp(bp, "nosync:", 7)) { | ||
2120 | x = simple_strtoul(bp+7, &bp, 0); | ||
2121 | set_resync(hd, x ^ hd->no_sync); | ||
2122 | hd->no_sync = x; | ||
2123 | } else { | ||
2124 | break; /* unknown keyword,syntax-error,... */ | ||
2125 | } | ||
2126 | } | 2118 | } |
2127 | return len; | ||
2128 | } | 2119 | } |
2120 | return len; | ||
2121 | #else | ||
2122 | return 0; | ||
2123 | #endif | ||
2124 | } | ||
2125 | |||
2126 | int | ||
2127 | wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance) | ||
2128 | { | ||
2129 | #ifdef PROC_INTERFACE | ||
2130 | struct WD33C93_hostdata *hd; | ||
2131 | struct scsi_cmnd *cmd; | ||
2132 | int x; | ||
2133 | |||
2134 | hd = (struct WD33C93_hostdata *) instance->hostdata; | ||
2129 | 2135 | ||
2130 | spin_lock_irq(&hd->lock); | 2136 | spin_lock_irq(&hd->lock); |
2131 | bp = buf; | 2137 | if (hd->proc & PR_VERSION) |
2132 | *bp = '\0'; | 2138 | seq_printf(m, "\nVersion %s - %s.", |
2133 | if (hd->proc & PR_VERSION) { | ||
2134 | sprintf(tbuf, "\nVersion %s - %s.", | ||
2135 | WD33C93_VERSION, WD33C93_DATE); | 2139 | WD33C93_VERSION, WD33C93_DATE); |
2136 | strcat(bp, tbuf); | 2140 | |
2137 | } | ||
2138 | if (hd->proc & PR_INFO) { | 2141 | if (hd->proc & PR_INFO) { |
2139 | sprintf(tbuf, "\nclock_freq=%02x no_sync=%02x no_dma=%d" | 2142 | seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d" |
2140 | " dma_mode=%02x fast=%d", | 2143 | " dma_mode=%02x fast=%d", |
2141 | hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast); | 2144 | hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast); |
2142 | strcat(bp, tbuf); | 2145 | seq_printf(m, "\nsync_xfer[] = "); |
2143 | strcat(bp, "\nsync_xfer[] = "); | 2146 | for (x = 0; x < 7; x++) |
2144 | for (x = 0; x < 7; x++) { | 2147 | seq_printf(m, "\t%02x", hd->sync_xfer[x]); |
2145 | sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); | 2148 | seq_printf(m, "\nsync_stat[] = "); |
2146 | strcat(bp, tbuf); | 2149 | for (x = 0; x < 7; x++) |
2147 | } | 2150 | seq_printf(m, "\t%02x", hd->sync_stat[x]); |
2148 | strcat(bp, "\nsync_stat[] = "); | ||
2149 | for (x = 0; x < 7; x++) { | ||
2150 | sprintf(tbuf, "\t%02x", hd->sync_stat[x]); | ||
2151 | strcat(bp, tbuf); | ||
2152 | } | ||
2153 | } | 2151 | } |
2154 | #ifdef PROC_STATISTICS | 2152 | #ifdef PROC_STATISTICS |
2155 | if (hd->proc & PR_STATISTICS) { | 2153 | if (hd->proc & PR_STATISTICS) { |
2156 | strcat(bp, "\ncommands issued: "); | 2154 | seq_printf(m, "\ncommands issued: "); |
2157 | for (x = 0; x < 7; x++) { | 2155 | for (x = 0; x < 7; x++) |
2158 | sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); | 2156 | seq_printf(m, "\t%ld", hd->cmd_cnt[x]); |
2159 | strcat(bp, tbuf); | 2157 | seq_printf(m, "\ndisconnects allowed:"); |
2160 | } | 2158 | for (x = 0; x < 7; x++) |
2161 | strcat(bp, "\ndisconnects allowed:"); | 2159 | seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]); |
2162 | for (x = 0; x < 7; x++) { | 2160 | seq_printf(m, "\ndisconnects done: "); |
2163 | sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); | 2161 | for (x = 0; x < 7; x++) |
2164 | strcat(bp, tbuf); | 2162 | seq_printf(m, "\t%ld", hd->disc_done_cnt[x]); |
2165 | } | 2163 | seq_printf(m, |
2166 | strcat(bp, "\ndisconnects done: "); | ||
2167 | for (x = 0; x < 7; x++) { | ||
2168 | sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]); | ||
2169 | strcat(bp, tbuf); | ||
2170 | } | ||
2171 | sprintf(tbuf, | ||
2172 | "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO", | 2164 | "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO", |
2173 | hd->int_cnt, hd->dma_cnt, hd->pio_cnt); | 2165 | hd->int_cnt, hd->dma_cnt, hd->pio_cnt); |
2174 | strcat(bp, tbuf); | ||
2175 | } | 2166 | } |
2176 | #endif | 2167 | #endif |
2177 | if (hd->proc & PR_CONNECTED) { | 2168 | if (hd->proc & PR_CONNECTED) { |
2178 | strcat(bp, "\nconnected: "); | 2169 | seq_printf(m, "\nconnected: "); |
2179 | if (hd->connected) { | 2170 | if (hd->connected) { |
2180 | cmd = (struct scsi_cmnd *) hd->connected; | 2171 | cmd = (struct scsi_cmnd *) hd->connected; |
2181 | sprintf(tbuf, " %d:%d(%02x)", | 2172 | seq_printf(m, " %d:%d(%02x)", |
2182 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2173 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2183 | strcat(bp, tbuf); | ||
2184 | } | 2174 | } |
2185 | } | 2175 | } |
2186 | if (hd->proc & PR_INPUTQ) { | 2176 | if (hd->proc & PR_INPUTQ) { |
2187 | strcat(bp, "\ninput_Q: "); | 2177 | seq_printf(m, "\ninput_Q: "); |
2188 | cmd = (struct scsi_cmnd *) hd->input_Q; | 2178 | cmd = (struct scsi_cmnd *) hd->input_Q; |
2189 | while (cmd) { | 2179 | while (cmd) { |
2190 | sprintf(tbuf, " %d:%d(%02x)", | 2180 | seq_printf(m, " %d:%d(%02x)", |
2191 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2181 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2192 | strcat(bp, tbuf); | ||
2193 | cmd = (struct scsi_cmnd *) cmd->host_scribble; | 2182 | cmd = (struct scsi_cmnd *) cmd->host_scribble; |
2194 | } | 2183 | } |
2195 | } | 2184 | } |
2196 | if (hd->proc & PR_DISCQ) { | 2185 | if (hd->proc & PR_DISCQ) { |
2197 | strcat(bp, "\ndisconnected_Q:"); | 2186 | seq_printf(m, "\ndisconnected_Q:"); |
2198 | cmd = (struct scsi_cmnd *) hd->disconnected_Q; | 2187 | cmd = (struct scsi_cmnd *) hd->disconnected_Q; |
2199 | while (cmd) { | 2188 | while (cmd) { |
2200 | sprintf(tbuf, " %d:%d(%02x)", | 2189 | seq_printf(m, " %d:%d(%02x)", |
2201 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2190 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2202 | strcat(bp, tbuf); | ||
2203 | cmd = (struct scsi_cmnd *) cmd->host_scribble; | 2191 | cmd = (struct scsi_cmnd *) cmd->host_scribble; |
2204 | } | 2192 | } |
2205 | } | 2193 | } |
2206 | strcat(bp, "\n"); | 2194 | seq_printf(m, "\n"); |
2207 | spin_unlock_irq(&hd->lock); | 2195 | spin_unlock_irq(&hd->lock); |
2208 | *start = buf; | ||
2209 | if (stop) { | ||
2210 | stop = 0; | ||
2211 | return 0; | ||
2212 | } | ||
2213 | if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */ | ||
2214 | stop = 1; | ||
2215 | if (hd->proc & PR_STOP) /* stop every other time */ | ||
2216 | stop = 1; | ||
2217 | return strlen(bp); | ||
2218 | |||
2219 | #else /* PROC_INTERFACE */ | ||
2220 | |||
2221 | return 0; | ||
2222 | |||
2223 | #endif /* PROC_INTERFACE */ | 2196 | #endif /* PROC_INTERFACE */ |
2224 | 2197 | return 0; | |
2225 | } | 2198 | } |
2226 | 2199 | ||
2227 | EXPORT_SYMBOL(wd33c93_host_reset); | 2200 | EXPORT_SYMBOL(wd33c93_host_reset); |
@@ -2229,4 +2202,5 @@ EXPORT_SYMBOL(wd33c93_init); | |||
2229 | EXPORT_SYMBOL(wd33c93_abort); | 2202 | EXPORT_SYMBOL(wd33c93_abort); |
2230 | EXPORT_SYMBOL(wd33c93_queuecommand); | 2203 | EXPORT_SYMBOL(wd33c93_queuecommand); |
2231 | EXPORT_SYMBOL(wd33c93_intr); | 2204 | EXPORT_SYMBOL(wd33c93_intr); |
2232 | EXPORT_SYMBOL(wd33c93_proc_info); | 2205 | EXPORT_SYMBOL(wd33c93_show_info); |
2206 | EXPORT_SYMBOL(wd33c93_write_info); | ||
diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h index 3b463d7304dc..08abe508e9ad 100644 --- a/drivers/scsi/wd33c93.h +++ b/drivers/scsi/wd33c93.h | |||
@@ -345,7 +345,8 @@ void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs, | |||
345 | int wd33c93_abort (struct scsi_cmnd *cmd); | 345 | int wd33c93_abort (struct scsi_cmnd *cmd); |
346 | int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd); | 346 | int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd); |
347 | void wd33c93_intr (struct Scsi_Host *instance); | 347 | void wd33c93_intr (struct Scsi_Host *instance); |
348 | int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); | 348 | int wd33c93_show_info(struct seq_file *, struct Scsi_Host *); |
349 | int wd33c93_write_info(struct Scsi_Host *, char *, int); | ||
349 | int wd33c93_host_reset (struct scsi_cmnd *); | 350 | int wd33c93_host_reset (struct scsi_cmnd *); |
350 | 351 | ||
351 | #endif /* WD33C93_H */ | 352 | #endif /* WD33C93_H */ |
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index d89a5dfd3ade..f9a6e4b0affe 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -1296,9 +1296,9 @@ static void wd7000_revision(Adapter * host) | |||
1296 | 1296 | ||
1297 | 1297 | ||
1298 | #undef SPRINTF | 1298 | #undef SPRINTF |
1299 | #define SPRINTF(args...) { if (pos < (buffer + length)) pos += sprintf (pos, ## args); } | 1299 | #define SPRINTF(args...) { seq_printf(m, ## args); } |
1300 | 1300 | ||
1301 | static int wd7000_set_info(char *buffer, int length, struct Scsi_Host *host) | 1301 | static int wd7000_set_info(struct Scsi_Host *host, char *buffer, int length) |
1302 | { | 1302 | { |
1303 | dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length); | 1303 | dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length); |
1304 | 1304 | ||
@@ -1310,22 +1310,15 @@ static int wd7000_set_info(char *buffer, int length, struct Scsi_Host *host) | |||
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | 1312 | ||
1313 | static int wd7000_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) | 1313 | static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host) |
1314 | { | 1314 | { |
1315 | Adapter *adapter = (Adapter *)host->hostdata; | 1315 | Adapter *adapter = (Adapter *)host->hostdata; |
1316 | unsigned long flags; | 1316 | unsigned long flags; |
1317 | char *pos = buffer; | ||
1318 | #ifdef WD7000_DEBUG | 1317 | #ifdef WD7000_DEBUG |
1319 | Mailbox *ogmbs, *icmbs; | 1318 | Mailbox *ogmbs, *icmbs; |
1320 | short count; | 1319 | short count; |
1321 | #endif | 1320 | #endif |
1322 | 1321 | ||
1323 | /* | ||
1324 | * Has data been written to the file ? | ||
1325 | */ | ||
1326 | if (inout) | ||
1327 | return (wd7000_set_info(buffer, length, host)); | ||
1328 | |||
1329 | spin_lock_irqsave(host->host_lock, flags); | 1322 | spin_lock_irqsave(host->host_lock, flags); |
1330 | SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2); | 1323 | SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2); |
1331 | SPRINTF(" IO base: 0x%x\n", adapter->iobase); | 1324 | SPRINTF(" IO base: 0x%x\n", adapter->iobase); |
@@ -1368,17 +1361,7 @@ static int wd7000_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1368 | 1361 | ||
1369 | spin_unlock_irqrestore(host->host_lock, flags); | 1362 | spin_unlock_irqrestore(host->host_lock, flags); |
1370 | 1363 | ||
1371 | /* | 1364 | return 0; |
1372 | * Calculate start of next buffer, and return value. | ||
1373 | */ | ||
1374 | *start = buffer + offset; | ||
1375 | |||
1376 | if ((pos - buffer) < offset) | ||
1377 | return (0); | ||
1378 | else if ((pos - buffer - offset) < length) | ||
1379 | return (pos - buffer - offset); | ||
1380 | else | ||
1381 | return (length); | ||
1382 | } | 1365 | } |
1383 | 1366 | ||
1384 | 1367 | ||
@@ -1413,7 +1396,8 @@ static __init int wd7000_detect(struct scsi_host_template *tpnt) | |||
1413 | for (i = 0; i < NUM_CONFIGS; biosptr[i++] = -1); | 1396 | for (i = 0; i < NUM_CONFIGS; biosptr[i++] = -1); |
1414 | 1397 | ||
1415 | tpnt->proc_name = "wd7000"; | 1398 | tpnt->proc_name = "wd7000"; |
1416 | tpnt->proc_info = &wd7000_proc_info; | 1399 | tpnt->show_info = &wd7000_show_info; |
1400 | tpnt->write_info = wd7000_set_info; | ||
1417 | 1401 | ||
1418 | /* | 1402 | /* |
1419 | * Set up SCB free list, which is shared by all adapters | 1403 | * Set up SCB free list, which is shared by all adapters |
@@ -1658,7 +1642,8 @@ MODULE_LICENSE("GPL"); | |||
1658 | 1642 | ||
1659 | static struct scsi_host_template driver_template = { | 1643 | static struct scsi_host_template driver_template = { |
1660 | .proc_name = "wd7000", | 1644 | .proc_name = "wd7000", |
1661 | .proc_info = wd7000_proc_info, | 1645 | .show_info = wd7000_show_info, |
1646 | .write_info = wd7000_set_info, | ||
1662 | .name = "Western Digital WD-7000", | 1647 | .name = "Western Digital WD-7000", |
1663 | .detect = wd7000_detect, | 1648 | .detect = wd7000_detect, |
1664 | .release = wd7000_release, | 1649 | .release = wd7000_release, |