aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic79xx_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aic7xxx/aic79xx_proc.c')
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_proc.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index e01cd6175e34..32be1f55998c 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -49,7 +49,7 @@ static void ahd_dump_target_state(struct ahd_softc *ahd,
49 u_int our_id, char channel, 49 u_int our_id, char channel,
50 u_int target_id, u_int target_offset); 50 u_int target_id, u_int target_offset);
51static void ahd_dump_device_state(struct info_str *info, 51static void ahd_dump_device_state(struct info_str *info,
52 struct ahd_linux_device *dev); 52 struct scsi_device *sdev);
53static int ahd_proc_write_seeprom(struct ahd_softc *ahd, 53static int ahd_proc_write_seeprom(struct ahd_softc *ahd,
54 char *buffer, int length); 54 char *buffer, int length);
55 55
@@ -167,6 +167,7 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info,
167 u_int target_offset) 167 u_int target_offset)
168{ 168{
169 struct ahd_linux_target *targ; 169 struct ahd_linux_target *targ;
170 struct scsi_target *starget;
170 struct ahd_initiator_tinfo *tinfo; 171 struct ahd_initiator_tinfo *tinfo;
171 struct ahd_tmode_tstate *tstate; 172 struct ahd_tmode_tstate *tstate;
172 int lun; 173 int lun;
@@ -176,20 +177,20 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info,
176 copy_info(info, "Target %d Negotiation Settings\n", target_id); 177 copy_info(info, "Target %d Negotiation Settings\n", target_id);
177 copy_info(info, "\tUser: "); 178 copy_info(info, "\tUser: ");
178 ahd_format_transinfo(info, &tinfo->user); 179 ahd_format_transinfo(info, &tinfo->user);
179 targ = ahd->platform_data->targets[target_offset]; 180 starget = ahd->platform_data->starget[target_offset];
180 if (targ == NULL) 181 if (starget == NULL)
181 return; 182 return;
183 targ = scsi_transport_target_data(starget);
182 184
183 copy_info(info, "\tGoal: "); 185 copy_info(info, "\tGoal: ");
184 ahd_format_transinfo(info, &tinfo->goal); 186 ahd_format_transinfo(info, &tinfo->goal);
185 copy_info(info, "\tCurr: "); 187 copy_info(info, "\tCurr: ");
186 ahd_format_transinfo(info, &tinfo->curr); 188 ahd_format_transinfo(info, &tinfo->curr);
187 copy_info(info, "\tTransmission Errors %ld\n", targ->errors_detected);
188 189
189 for (lun = 0; lun < AHD_NUM_LUNS; lun++) { 190 for (lun = 0; lun < AHD_NUM_LUNS; lun++) {
190 struct ahd_linux_device *dev; 191 struct scsi_device *dev;
191 192
192 dev = targ->devices[lun]; 193 dev = targ->sdev[lun];
193 194
194 if (dev == NULL) 195 if (dev == NULL)
195 continue; 196 continue;
@@ -199,10 +200,13 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info,
199} 200}
200 201
201static void 202static void
202ahd_dump_device_state(struct info_str *info, struct ahd_linux_device *dev) 203ahd_dump_device_state(struct info_str *info, struct scsi_device *sdev)
203{ 204{
205 struct ahd_linux_device *dev = scsi_transport_device_data(sdev);
206
204 copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", 207 copy_info(info, "\tChannel %c Target %d Lun %d Settings\n",
205 dev->target->channel + 'A', dev->target->target, dev->lun); 208 sdev->sdev_target->channel + 'A',
209 sdev->sdev_target->id, sdev->lun);
206 210
207 copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); 211 copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued);
208 copy_info(info, "\t\tCommands Active %d\n", dev->active); 212 copy_info(info, "\t\tCommands Active %d\n", dev->active);
@@ -278,36 +282,16 @@ done:
278 * Return information to handle /proc support for the driver. 282 * Return information to handle /proc support for the driver.
279 */ 283 */
280int 284int
281#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
282ahd_linux_proc_info(char *buffer, char **start, off_t offset,
283 int length, int hostno, int inout)
284#else
285ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, 285ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
286 off_t offset, int length, int inout) 286 off_t offset, int length, int inout)
287#endif
288{ 287{
289 struct ahd_softc *ahd; 288 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata;
290 struct info_str info; 289 struct info_str info;
291 char ahd_info[256]; 290 char ahd_info[256];
292 u_long l;
293 u_int max_targ; 291 u_int max_targ;
294 u_int i; 292 u_int i;
295 int retval; 293 int retval;
296 294
297 retval = -EINVAL;
298 ahd_list_lock(&l);
299#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
300 TAILQ_FOREACH(ahd, &ahd_tailq, links) {
301 if (ahd->platform_data->host->host_no == hostno)
302 break;
303 }
304#else
305 ahd = ahd_find_softc(*(struct ahd_softc **)shost->hostdata);
306#endif
307
308 if (ahd == NULL)
309 goto done;
310
311 /* Has data been written to the file? */ 295 /* Has data been written to the file? */
312 if (inout == TRUE) { 296 if (inout == TRUE) {
313 retval = ahd_proc_write_seeprom(ahd, buffer, length); 297 retval = ahd_proc_write_seeprom(ahd, buffer, length);
@@ -357,6 +341,5 @@ ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
357 } 341 }
358 retval = info.pos > info.offset ? info.pos - info.offset : 0; 342 retval = info.pos > info.offset ? info.pos - info.offset : 0;
359done: 343done:
360 ahd_list_unlock(&l);
361 return (retval); 344 return (retval);
362} 345}