/drivers/scsi/aic7xxx_old/aic7xxx_proc.c

http://github.com/mirrors/linux · C · 270 lines · 204 code · 11 blank · 55 comment · 31 complexity · 88c4467b23585dcfe368206964174def MD5 · raw file

  1. /*+M*************************************************************************
  2. * Adaptec AIC7xxx device driver proc support for Linux.
  3. *
  4. * Copyright (c) 1995, 1996 Dean W. Gehnert
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2, or (at your option)
  9. * any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; see the file COPYING. If not, write to
  18. * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. * ----------------------------------------------------------------
  21. * o Modified from the EATA-DMA /proc support.
  22. * o Additional support for device block statistics provided by
  23. * Matthew Jacob.
  24. * o Correction of overflow by Heinz Mauelshagen
  25. * o Adittional corrections by Doug Ledford
  26. *
  27. * Dean W. Gehnert, deang@teleport.com, 05/01/96
  28. *
  29. * $Id: aic7xxx_proc.c,v 4.1 1997/06/97 08:23:42 deang Exp $
  30. *-M*************************************************************************/
  31. #define HDRB \
  32. " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+"
  33. /*+F*************************************************************************
  34. * Function:
  35. * aic7xxx_show_info
  36. *
  37. * Description:
  38. * Return information to handle /proc support for the driver.
  39. *-F*************************************************************************/
  40. int
  41. aic7xxx_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
  42. {
  43. struct aic7xxx_host *p;
  44. struct aic_dev_data *aic_dev;
  45. struct scsi_device *sdptr;
  46. unsigned char i;
  47. unsigned char tindex;
  48. for(p=first_aic7xxx; p && p->host != HBAptr; p=p->next)
  49. ;
  50. if (!p)
  51. {
  52. seq_printf(m, "Can't find adapter for host number %d\n", HBAptr->host_no);
  53. return 0;
  54. }
  55. p = (struct aic7xxx_host *) HBAptr->hostdata;
  56. seq_printf(m, "Adaptec AIC7xxx driver version: ");
  57. seq_printf(m, "%s/", AIC7XXX_C_VERSION);
  58. seq_printf(m, "%s", AIC7XXX_H_VERSION);
  59. seq_printf(m, "\n");
  60. seq_printf(m, "Adapter Configuration:\n");
  61. seq_printf(m, " SCSI Adapter: %s\n",
  62. board_names[p->board_name_index]);
  63. if (p->flags & AHC_TWIN)
  64. seq_printf(m, " Twin Channel Controller ");
  65. else
  66. {
  67. char *channel = "";
  68. char *ultra = "";
  69. char *wide = "Narrow ";
  70. if (p->flags & AHC_MULTI_CHANNEL)
  71. {
  72. channel = " Channel A";
  73. if (p->flags & (AHC_CHNLB|AHC_CHNLC))
  74. channel = (p->flags & AHC_CHNLB) ? " Channel B" : " Channel C";
  75. }
  76. if (p->features & AHC_WIDE)
  77. wide = "Wide ";
  78. if (p->features & AHC_ULTRA3)
  79. {
  80. switch(p->chip & AHC_CHIPID_MASK)
  81. {
  82. case AHC_AIC7892:
  83. case AHC_AIC7899:
  84. ultra = "Ultra-160/m LVD/SE ";
  85. break;
  86. default:
  87. ultra = "Ultra-3 LVD/SE ";
  88. break;
  89. }
  90. }
  91. else if (p->features & AHC_ULTRA2)
  92. ultra = "Ultra-2 LVD/SE ";
  93. else if (p->features & AHC_ULTRA)
  94. ultra = "Ultra ";
  95. seq_printf(m, " %s%sController%s ",
  96. ultra, wide, channel);
  97. }
  98. switch(p->chip & ~AHC_CHIPID_MASK)
  99. {
  100. case AHC_VL:
  101. seq_printf(m, "at VLB slot %d\n", p->pci_device_fn);
  102. break;
  103. case AHC_EISA:
  104. seq_printf(m, "at EISA slot %d\n", p->pci_device_fn);
  105. break;
  106. default:
  107. seq_printf(m, "at PCI %d/%d/%d\n", p->pci_bus,
  108. PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn));
  109. break;
  110. }
  111. if( !(p->maddr) )
  112. {
  113. seq_printf(m, " Programmed I/O Base: %lx\n", p->base);
  114. }
  115. else
  116. {
  117. seq_printf(m, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase);
  118. }
  119. if( (p->chip & (AHC_VL | AHC_EISA)) )
  120. {
  121. seq_printf(m, " BIOS Memory Address: 0x%08x\n", p->bios_address);
  122. }
  123. seq_printf(m, " Adapter SEEPROM Config: %s\n",
  124. (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." :
  125. ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." :
  126. "SEEPROM not found, using leftover BIOS values.") );
  127. seq_printf(m, " Adaptec SCSI BIOS: %s\n",
  128. (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled");
  129. seq_printf(m, " IRQ: %d\n", HBAptr->irq);
  130. seq_printf(m, " SCBs: Active %d, Max Active %d,\n",
  131. p->activescbs, p->max_activescbs);
  132. seq_printf(m, " Allocated %d, HW %d, "
  133. "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs,
  134. p->scb_data->maxscbs);
  135. if (p->flags & AHC_EXTERNAL_SRAM)
  136. seq_printf(m, " Using External SCB SRAM\n");
  137. seq_printf(m, " Interrupts: %ld", p->isr_count);
  138. if (p->chip & AHC_EISA)
  139. {
  140. seq_printf(m, " %s\n",
  141. (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)");
  142. }
  143. else
  144. {
  145. seq_printf(m, "\n");
  146. }
  147. seq_printf(m, " BIOS Control Word: 0x%04x\n",
  148. p->bios_control);
  149. seq_printf(m, " Adapter Control Word: 0x%04x\n",
  150. p->adapter_control);
  151. seq_printf(m, " Extended Translation: %sabled\n",
  152. (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis");
  153. seq_printf(m, "Disconnect Enable Flags: 0x%04x\n", p->discenable);
  154. if (p->features & (AHC_ULTRA | AHC_ULTRA2))
  155. {
  156. seq_printf(m, " Ultra Enable Flags: 0x%04x\n", p->ultraenb);
  157. }
  158. seq_printf(m, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth);
  159. seq_printf(m, " Tagged Queue By Device array for aic7xxx host "
  160. "instance %d:\n", p->instance);
  161. seq_printf(m, " {");
  162. for(i=0; i < (MAX_TARGETS - 1); i++)
  163. seq_printf(m, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]);
  164. seq_printf(m, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]);
  165. seq_printf(m, "\n");
  166. seq_printf(m, "Statistics:\n\n");
  167. list_for_each_entry(aic_dev, &p->aic_devs, list)
  168. {
  169. sdptr = aic_dev->SDptr;
  170. tindex = sdptr->channel << 3 | sdptr->id;
  171. seq_printf(m, "(scsi%d:%d:%d:%d)\n",
  172. p->host_no, sdptr->channel, sdptr->id, sdptr->lun);
  173. seq_printf(m, " Device using %s/%s",
  174. (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ?
  175. "Wide" : "Narrow",
  176. (aic_dev->cur.offset != 0) ?
  177. "Sync transfers at " : "Async transfers.\n" );
  178. if (aic_dev->cur.offset != 0)
  179. {
  180. struct aic7xxx_syncrate *sync_rate;
  181. unsigned char options = aic_dev->cur.options;
  182. int period = aic_dev->cur.period;
  183. int rate = (aic_dev->cur.width ==
  184. MSG_EXT_WDTR_BUS_16_BIT) ? 1 : 0;
  185. sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options);
  186. if (sync_rate != NULL)
  187. {
  188. seq_printf(m, "%s MByte/sec, offset %d\n",
  189. sync_rate->rate[rate],
  190. aic_dev->cur.offset );
  191. }
  192. else
  193. {
  194. seq_printf(m, "3.3 MByte/sec, offset %d\n",
  195. aic_dev->cur.offset );
  196. }
  197. }
  198. seq_printf(m, " Transinfo settings: ");
  199. seq_printf(m, "current(%d/%d/%d/%d), ",
  200. aic_dev->cur.period,
  201. aic_dev->cur.offset,
  202. aic_dev->cur.width,
  203. aic_dev->cur.options);
  204. seq_printf(m, "goal(%d/%d/%d/%d), ",
  205. aic_dev->goal.period,
  206. aic_dev->goal.offset,
  207. aic_dev->goal.width,
  208. aic_dev->goal.options);
  209. seq_printf(m, "user(%d/%d/%d/%d)\n",
  210. p->user[tindex].period,
  211. p->user[tindex].offset,
  212. p->user[tindex].width,
  213. p->user[tindex].options);
  214. if(sdptr->simple_tags)
  215. {
  216. 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);
  217. }
  218. if(aic_dev->barrier_total)
  219. seq_printf(m, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n",
  220. aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total,
  221. aic_dev->barrier_total, aic_dev->ordered_total);
  222. else
  223. seq_printf(m, " Total transfers %ld:\n (%ld/%ld reads/writes)\n",
  224. aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total);
  225. seq_printf(m, "%s\n", HDRB);
  226. seq_printf(m, " Reads:");
  227. for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++)
  228. {
  229. seq_printf(m, " %10ld", aic_dev->r_bins[i]);
  230. }
  231. seq_printf(m, "\n");
  232. seq_printf(m, " Writes:");
  233. for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++)
  234. {
  235. seq_printf(m, " %10ld", aic_dev->w_bins[i]);
  236. }
  237. seq_printf(m, "\n");
  238. seq_printf(m, "\n\n");
  239. }
  240. return 0;
  241. }
  242. /*
  243. * Overrides for Emacs so that we follow Linus's tabbing style.
  244. * Emacs will notice this stuff at the end of the file and automatically
  245. * adjust the settings for this buffer only. This must remain at the end
  246. * of the file.
  247. * ---------------------------------------------------------------------------
  248. * Local variables:
  249. * c-indent-level: 2
  250. * c-brace-imaginary-offset: 0
  251. * c-brace-offset: -2
  252. * c-argdecl-indent: 2
  253. * c-label-offset: -2
  254. * c-continued-statement-offset: 2
  255. * c-continued-brace-offset: 0
  256. * indent-tabs-mode: nil
  257. * tab-width: 8
  258. * End:
  259. */