blob: a691133c31a22c983c45af0503ea4a2af68cc63e [file] [log] [blame]
Jing Huang7725ccf2009-09-23 17:46:15 -07001/*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18/**
19 * bfa_attr.c Linux driver configuration interface module.
20 */
21
22#include "bfad_drv.h"
23#include "bfad_im.h"
24#include "bfad_trcmod.h"
25#include "bfad_attr.h"
26
27/**
28 * FC_transport_template FC transport template
29 */
30
31/**
32 * FC transport template entry, get SCSI target port ID.
33 */
34void
35bfad_im_get_starget_port_id(struct scsi_target *starget)
36{
37 struct Scsi_Host *shost;
38 struct bfad_im_port_s *im_port;
39 struct bfad_s *bfad;
40 struct bfad_itnim_s *itnim = NULL;
41 u32 fc_id = -1;
42 unsigned long flags;
43
44 shost = bfad_os_starget_to_shost(starget);
45 im_port = (struct bfad_im_port_s *) shost->hostdata[0];
46 bfad = im_port->bfad;
47 spin_lock_irqsave(&bfad->bfad_lock, flags);
48
49 itnim = bfad_os_get_itnim(im_port, starget->id);
50 if (itnim)
51 fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim);
52
53 fc_starget_port_id(starget) = fc_id;
54 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
55}
56
57/**
58 * FC transport template entry, get SCSI target nwwn.
59 */
60void
61bfad_im_get_starget_node_name(struct scsi_target *starget)
62{
63 struct Scsi_Host *shost;
64 struct bfad_im_port_s *im_port;
65 struct bfad_s *bfad;
66 struct bfad_itnim_s *itnim = NULL;
67 u64 node_name = 0;
68 unsigned long flags;
69
70 shost = bfad_os_starget_to_shost(starget);
71 im_port = (struct bfad_im_port_s *) shost->hostdata[0];
72 bfad = im_port->bfad;
73 spin_lock_irqsave(&bfad->bfad_lock, flags);
74
75 itnim = bfad_os_get_itnim(im_port, starget->id);
76 if (itnim)
77 node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim);
78
79 fc_starget_node_name(starget) = bfa_os_htonll(node_name);
80 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
81}
82
83/**
84 * FC transport template entry, get SCSI target pwwn.
85 */
86void
87bfad_im_get_starget_port_name(struct scsi_target *starget)
88{
89 struct Scsi_Host *shost;
90 struct bfad_im_port_s *im_port;
91 struct bfad_s *bfad;
92 struct bfad_itnim_s *itnim = NULL;
93 u64 port_name = 0;
94 unsigned long flags;
95
96 shost = bfad_os_starget_to_shost(starget);
97 im_port = (struct bfad_im_port_s *) shost->hostdata[0];
98 bfad = im_port->bfad;
99 spin_lock_irqsave(&bfad->bfad_lock, flags);
100
101 itnim = bfad_os_get_itnim(im_port, starget->id);
102 if (itnim)
103 port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim);
104
105 fc_starget_port_name(starget) = bfa_os_htonll(port_name);
106 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
107}
108
109/**
110 * FC transport template entry, get SCSI host port ID.
111 */
112void
113bfad_im_get_host_port_id(struct Scsi_Host *shost)
114{
115 struct bfad_im_port_s *im_port =
116 (struct bfad_im_port_s *) shost->hostdata[0];
117 struct bfad_port_s *port = im_port->port;
118
119 fc_host_port_id(shost) =
120 bfa_os_hton3b(bfa_fcs_port_get_fcid(port->fcs_port));
121}
122
123
124
125
126
127struct Scsi_Host *
128bfad_os_starget_to_shost(struct scsi_target *starget)
129{
130 return dev_to_shost(starget->dev.parent);
131}
132
133/**
134 * FC transport template entry, get SCSI host port type.
135 */
136static void
137bfad_im_get_host_port_type(struct Scsi_Host *shost)
138{
139 struct bfad_im_port_s *im_port =
140 (struct bfad_im_port_s *) shost->hostdata[0];
141 struct bfad_s *bfad = im_port->bfad;
142 struct bfa_pport_attr_s attr;
143
Krishna Gudipati1c8a4c32010-03-05 19:37:37 -0800144 bfa_fcport_get_attr(&bfad->bfa, &attr);
Jing Huang7725ccf2009-09-23 17:46:15 -0700145
146 switch (attr.port_type) {
147 case BFA_PPORT_TYPE_NPORT:
148 fc_host_port_type(shost) = FC_PORTTYPE_NPORT;
149 break;
150 case BFA_PPORT_TYPE_NLPORT:
151 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT;
152 break;
153 case BFA_PPORT_TYPE_P2P:
154 fc_host_port_type(shost) = FC_PORTTYPE_PTP;
155 break;
156 case BFA_PPORT_TYPE_LPORT:
157 fc_host_port_type(shost) = FC_PORTTYPE_LPORT;
158 break;
159 default:
160 fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN;
161 break;
162 }
163}
164
165/**
166 * FC transport template entry, get SCSI host port state.
167 */
168static void
169bfad_im_get_host_port_state(struct Scsi_Host *shost)
170{
171 struct bfad_im_port_s *im_port =
172 (struct bfad_im_port_s *) shost->hostdata[0];
173 struct bfad_s *bfad = im_port->bfad;
174 struct bfa_pport_attr_s attr;
175
Krishna Gudipati1c8a4c32010-03-05 19:37:37 -0800176 bfa_fcport_get_attr(&bfad->bfa, &attr);
Jing Huang7725ccf2009-09-23 17:46:15 -0700177
178 switch (attr.port_state) {
179 case BFA_PPORT_ST_LINKDOWN:
180 fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN;
181 break;
182 case BFA_PPORT_ST_LINKUP:
183 fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
184 break;
185 case BFA_PPORT_ST_UNINIT:
186 case BFA_PPORT_ST_ENABLING_QWAIT:
187 case BFA_PPORT_ST_ENABLING:
188 case BFA_PPORT_ST_DISABLING_QWAIT:
189 case BFA_PPORT_ST_DISABLING:
190 case BFA_PPORT_ST_DISABLED:
191 case BFA_PPORT_ST_STOPPED:
192 case BFA_PPORT_ST_IOCDOWN:
193 default:
194 fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
195 break;
196 }
197}
198
199/**
200 * FC transport template entry, get SCSI host active fc4s.
201 */
202static void
203bfad_im_get_host_active_fc4s(struct Scsi_Host *shost)
204{
205 struct bfad_im_port_s *im_port =
206 (struct bfad_im_port_s *) shost->hostdata[0];
207 struct bfad_port_s *port = im_port->port;
208
209 memset(fc_host_active_fc4s(shost), 0,
210 sizeof(fc_host_active_fc4s(shost)));
211
212 if (port->supported_fc4s &
213 (BFA_PORT_ROLE_FCP_IM | BFA_PORT_ROLE_FCP_TM))
214 fc_host_active_fc4s(shost)[2] = 1;
215
216 if (port->supported_fc4s & BFA_PORT_ROLE_FCP_IPFC)
217 fc_host_active_fc4s(shost)[3] = 0x20;
218
219 fc_host_active_fc4s(shost)[7] = 1;
220}
221
222/**
223 * FC transport template entry, get SCSI host link speed.
224 */
225static void
226bfad_im_get_host_speed(struct Scsi_Host *shost)
227{
228 struct bfad_im_port_s *im_port =
229 (struct bfad_im_port_s *) shost->hostdata[0];
230 struct bfad_s *bfad = im_port->bfad;
231 struct bfa_pport_attr_s attr;
Krishna Gudipati4c147dd2010-03-03 17:42:11 -0800232 unsigned long flags;
Jing Huang7725ccf2009-09-23 17:46:15 -0700233
Krishna Gudipati4c147dd2010-03-03 17:42:11 -0800234 spin_lock_irqsave(shost->host_lock, flags);
Krishna Gudipati1c8a4c32010-03-05 19:37:37 -0800235 bfa_fcport_get_attr(&bfad->bfa, &attr);
Jing Huang7725ccf2009-09-23 17:46:15 -0700236 switch (attr.speed) {
237 case BFA_PPORT_SPEED_8GBPS:
238 fc_host_speed(shost) = FC_PORTSPEED_8GBIT;
239 break;
240 case BFA_PPORT_SPEED_4GBPS:
241 fc_host_speed(shost) = FC_PORTSPEED_4GBIT;
242 break;
243 case BFA_PPORT_SPEED_2GBPS:
244 fc_host_speed(shost) = FC_PORTSPEED_2GBIT;
245 break;
246 case BFA_PPORT_SPEED_1GBPS:
247 fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
248 break;
249 default:
250 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
251 break;
252 }
Krishna Gudipati4c147dd2010-03-03 17:42:11 -0800253 spin_unlock_irqrestore(shost->host_lock, flags);
Jing Huang7725ccf2009-09-23 17:46:15 -0700254}
255
256/**
257 * FC transport template entry, get SCSI host port type.
258 */
259static void
260bfad_im_get_host_fabric_name(struct Scsi_Host *shost)
261{
262 struct bfad_im_port_s *im_port =
263 (struct bfad_im_port_s *) shost->hostdata[0];
264 struct bfad_port_s *port = im_port->port;
265 wwn_t fabric_nwwn = 0;
266
267 fabric_nwwn = bfa_fcs_port_get_fabric_name(port->fcs_port);
268
269 fc_host_fabric_name(shost) = bfa_os_htonll(fabric_nwwn);
270
271}
272
273/**
274 * FC transport template entry, get BFAD statistics.
275 */
276static struct fc_host_statistics *
277bfad_im_get_stats(struct Scsi_Host *shost)
278{
279 struct bfad_im_port_s *im_port =
280 (struct bfad_im_port_s *) shost->hostdata[0];
281 struct bfad_s *bfad = im_port->bfad;
282 struct bfad_hal_comp fcomp;
283 struct fc_host_statistics *hstats;
284 bfa_status_t rc;
285 unsigned long flags;
286
287 hstats = &bfad->link_stats;
288 init_completion(&fcomp.comp);
289 spin_lock_irqsave(&bfad->bfad_lock, flags);
290 memset(hstats, 0, sizeof(struct fc_host_statistics));
291 rc = bfa_pport_get_stats(&bfad->bfa,
292 (union bfa_pport_stats_u *) hstats,
293 bfad_hcb_comp, &fcomp);
294 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
295 if (rc != BFA_STATUS_OK)
296 return NULL;
297
298 wait_for_completion(&fcomp.comp);
299
300 return hstats;
301}
302
303/**
304 * FC transport template entry, reset BFAD statistics.
305 */
306static void
307bfad_im_reset_stats(struct Scsi_Host *shost)
308{
309 struct bfad_im_port_s *im_port =
310 (struct bfad_im_port_s *) shost->hostdata[0];
311 struct bfad_s *bfad = im_port->bfad;
312 struct bfad_hal_comp fcomp;
313 unsigned long flags;
314 bfa_status_t rc;
315
316 init_completion(&fcomp.comp);
317 spin_lock_irqsave(&bfad->bfad_lock, flags);
318 rc = bfa_pport_clear_stats(&bfad->bfa, bfad_hcb_comp, &fcomp);
319 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
320
321 if (rc != BFA_STATUS_OK)
322 return;
323
324 wait_for_completion(&fcomp.comp);
325
326 return;
327}
328
329/**
330 * FC transport template entry, get rport loss timeout.
331 */
332static void
333bfad_im_get_rport_loss_tmo(struct fc_rport *rport)
334{
335 struct bfad_itnim_data_s *itnim_data = rport->dd_data;
336 struct bfad_itnim_s *itnim = itnim_data->itnim;
337 struct bfad_s *bfad = itnim->im->bfad;
338 unsigned long flags;
339
340 spin_lock_irqsave(&bfad->bfad_lock, flags);
341 rport->dev_loss_tmo = bfa_fcpim_path_tov_get(&bfad->bfa);
342 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
343}
344
345/**
346 * FC transport template entry, set rport loss timeout.
347 */
348static void
349bfad_im_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout)
350{
351 struct bfad_itnim_data_s *itnim_data = rport->dd_data;
352 struct bfad_itnim_s *itnim = itnim_data->itnim;
353 struct bfad_s *bfad = itnim->im->bfad;
354 unsigned long flags;
355
356 if (timeout > 0) {
357 spin_lock_irqsave(&bfad->bfad_lock, flags);
358 bfa_fcpim_path_tov_set(&bfad->bfa, timeout);
359 rport->dev_loss_tmo = bfa_fcpim_path_tov_get(&bfad->bfa);
360 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
361 }
362
363}
364
365struct fc_function_template bfad_im_fc_function_template = {
366
367 /* Target dynamic attributes */
368 .get_starget_port_id = bfad_im_get_starget_port_id,
369 .show_starget_port_id = 1,
370 .get_starget_node_name = bfad_im_get_starget_node_name,
371 .show_starget_node_name = 1,
372 .get_starget_port_name = bfad_im_get_starget_port_name,
373 .show_starget_port_name = 1,
374
375 /* Host dynamic attribute */
376 .get_host_port_id = bfad_im_get_host_port_id,
377 .show_host_port_id = 1,
378
379 /* Host fixed attributes */
380 .show_host_node_name = 1,
381 .show_host_port_name = 1,
382 .show_host_supported_classes = 1,
383 .show_host_supported_fc4s = 1,
384 .show_host_supported_speeds = 1,
385 .show_host_maxframe_size = 1,
386
387 /* More host dynamic attributes */
388 .show_host_port_type = 1,
389 .get_host_port_type = bfad_im_get_host_port_type,
390 .show_host_port_state = 1,
391 .get_host_port_state = bfad_im_get_host_port_state,
392 .show_host_active_fc4s = 1,
393 .get_host_active_fc4s = bfad_im_get_host_active_fc4s,
394 .show_host_speed = 1,
395 .get_host_speed = bfad_im_get_host_speed,
396 .show_host_fabric_name = 1,
397 .get_host_fabric_name = bfad_im_get_host_fabric_name,
398
399 .show_host_symbolic_name = 1,
400
401 /* Statistics */
402 .get_fc_host_stats = bfad_im_get_stats,
403 .reset_fc_host_stats = bfad_im_reset_stats,
404
405 /* Allocation length for host specific data */
406 .dd_fcrport_size = sizeof(struct bfad_itnim_data_s *),
407
408 /* Remote port fixed attributes */
409 .show_rport_maxframe_size = 1,
410 .show_rport_supported_classes = 1,
411 .show_rport_dev_loss_tmo = 1,
412 .get_rport_dev_loss_tmo = bfad_im_get_rport_loss_tmo,
413 .set_rport_dev_loss_tmo = bfad_im_set_rport_loss_tmo,
414};
415
416/**
417 * Scsi_Host_attrs SCSI host attributes
418 */
419static ssize_t
420bfad_im_serial_num_show(struct device *dev, struct device_attribute *attr,
421 char *buf)
422{
423 struct Scsi_Host *shost = class_to_shost(dev);
424 struct bfad_im_port_s *im_port =
425 (struct bfad_im_port_s *) shost->hostdata[0];
426 struct bfad_s *bfad = im_port->bfad;
427 struct bfa_ioc_attr_s ioc_attr;
428
429 memset(&ioc_attr, 0, sizeof(ioc_attr));
430 bfa_get_attr(&bfad->bfa, &ioc_attr);
431 return snprintf(buf, PAGE_SIZE, "%s\n",
432 ioc_attr.adapter_attr.serial_num);
433}
434
435static ssize_t
436bfad_im_model_show(struct device *dev, struct device_attribute *attr,
437 char *buf)
438{
439 struct Scsi_Host *shost = class_to_shost(dev);
440 struct bfad_im_port_s *im_port =
441 (struct bfad_im_port_s *) shost->hostdata[0];
442 struct bfad_s *bfad = im_port->bfad;
443 struct bfa_ioc_attr_s ioc_attr;
444
445 memset(&ioc_attr, 0, sizeof(ioc_attr));
446 bfa_get_attr(&bfad->bfa, &ioc_attr);
447 return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.model);
448}
449
450static ssize_t
451bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr,
452 char *buf)
453{
454 struct Scsi_Host *shost = class_to_shost(dev);
455 struct bfad_im_port_s *im_port =
456 (struct bfad_im_port_s *) shost->hostdata[0];
457 struct bfad_s *bfad = im_port->bfad;
458 struct bfa_ioc_attr_s ioc_attr;
459
460 memset(&ioc_attr, 0, sizeof(ioc_attr));
461 bfa_get_attr(&bfad->bfa, &ioc_attr);
462 return snprintf(buf, PAGE_SIZE, "%s\n",
463 ioc_attr.adapter_attr.model_descr);
464}
465
466static ssize_t
467bfad_im_node_name_show(struct device *dev, struct device_attribute *attr,
468 char *buf)
469{
470 struct Scsi_Host *shost = class_to_shost(dev);
471 struct bfad_im_port_s *im_port =
472 (struct bfad_im_port_s *) shost->hostdata[0];
473 struct bfad_port_s *port = im_port->port;
474 u64 nwwn;
475
476 nwwn = bfa_fcs_port_get_nwwn(port->fcs_port);
477 return snprintf(buf, PAGE_SIZE, "0x%llx\n", bfa_os_htonll(nwwn));
478}
479
480static ssize_t
481bfad_im_symbolic_name_show(struct device *dev, struct device_attribute *attr,
482 char *buf)
483{
484 struct Scsi_Host *shost = class_to_shost(dev);
485 struct bfad_im_port_s *im_port =
486 (struct bfad_im_port_s *) shost->hostdata[0];
487 struct bfad_s *bfad = im_port->bfad;
488 struct bfa_ioc_attr_s ioc_attr;
489
490 memset(&ioc_attr, 0, sizeof(ioc_attr));
491 bfa_get_attr(&bfad->bfa, &ioc_attr);
492
493 return snprintf(buf, PAGE_SIZE, "Brocade %s FV%s DV%s\n",
494 ioc_attr.adapter_attr.model,
495 ioc_attr.adapter_attr.fw_ver, BFAD_DRIVER_VERSION);
496}
497
498static ssize_t
499bfad_im_hw_version_show(struct device *dev, struct device_attribute *attr,
500 char *buf)
501{
502 struct Scsi_Host *shost = class_to_shost(dev);
503 struct bfad_im_port_s *im_port =
504 (struct bfad_im_port_s *) shost->hostdata[0];
505 struct bfad_s *bfad = im_port->bfad;
506 struct bfa_ioc_attr_s ioc_attr;
507
508 memset(&ioc_attr, 0, sizeof(ioc_attr));
509 bfa_get_attr(&bfad->bfa, &ioc_attr);
510 return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.hw_ver);
511}
512
513static ssize_t
514bfad_im_drv_version_show(struct device *dev, struct device_attribute *attr,
515 char *buf)
516{
517 return snprintf(buf, PAGE_SIZE, "%s\n", BFAD_DRIVER_VERSION);
518}
519
520static ssize_t
521bfad_im_optionrom_version_show(struct device *dev,
522 struct device_attribute *attr, char *buf)
523{
524 struct Scsi_Host *shost = class_to_shost(dev);
525 struct bfad_im_port_s *im_port =
526 (struct bfad_im_port_s *) shost->hostdata[0];
527 struct bfad_s *bfad = im_port->bfad;
528 struct bfa_ioc_attr_s ioc_attr;
529
530 memset(&ioc_attr, 0, sizeof(ioc_attr));
531 bfa_get_attr(&bfad->bfa, &ioc_attr);
532 return snprintf(buf, PAGE_SIZE, "%s\n",
533 ioc_attr.adapter_attr.optrom_ver);
534}
535
536static ssize_t
537bfad_im_fw_version_show(struct device *dev, struct device_attribute *attr,
538 char *buf)
539{
540 struct Scsi_Host *shost = class_to_shost(dev);
541 struct bfad_im_port_s *im_port =
542 (struct bfad_im_port_s *) shost->hostdata[0];
543 struct bfad_s *bfad = im_port->bfad;
544 struct bfa_ioc_attr_s ioc_attr;
545
546 memset(&ioc_attr, 0, sizeof(ioc_attr));
547 bfa_get_attr(&bfad->bfa, &ioc_attr);
548 return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.fw_ver);
549}
550
551static ssize_t
552bfad_im_num_of_ports_show(struct device *dev, struct device_attribute *attr,
553 char *buf)
554{
555 struct Scsi_Host *shost = class_to_shost(dev);
556 struct bfad_im_port_s *im_port =
557 (struct bfad_im_port_s *) shost->hostdata[0];
558 struct bfad_s *bfad = im_port->bfad;
559 struct bfa_ioc_attr_s ioc_attr;
560
561 memset(&ioc_attr, 0, sizeof(ioc_attr));
562 bfa_get_attr(&bfad->bfa, &ioc_attr);
563 return snprintf(buf, PAGE_SIZE, "%d\n", ioc_attr.adapter_attr.nports);
564}
565
566static ssize_t
567bfad_im_drv_name_show(struct device *dev, struct device_attribute *attr,
568 char *buf)
569{
570 return snprintf(buf, PAGE_SIZE, "%s\n", BFAD_DRIVER_NAME);
571}
572
573static ssize_t
574bfad_im_num_of_discovered_ports_show(struct device *dev,
575 struct device_attribute *attr, char *buf)
576{
577 struct Scsi_Host *shost = class_to_shost(dev);
578 struct bfad_im_port_s *im_port =
579 (struct bfad_im_port_s *) shost->hostdata[0];
580 struct bfad_port_s *port = im_port->port;
581 struct bfad_s *bfad = im_port->bfad;
582 int nrports = 2048;
583 wwn_t *rports = NULL;
584 unsigned long flags;
585
586 rports = kzalloc(sizeof(wwn_t) * nrports , GFP_ATOMIC);
587 if (rports == NULL)
588 return -ENOMEM;
589
590 spin_lock_irqsave(&bfad->bfad_lock, flags);
591 bfa_fcs_port_get_rports(port->fcs_port, rports, &nrports);
592 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
593 kfree(rports);
594
595 return snprintf(buf, PAGE_SIZE, "%d\n", nrports);
596}
597
598static DEVICE_ATTR(serial_number, S_IRUGO,
599 bfad_im_serial_num_show, NULL);
600static DEVICE_ATTR(model, S_IRUGO, bfad_im_model_show, NULL);
601static DEVICE_ATTR(model_description, S_IRUGO,
602 bfad_im_model_desc_show, NULL);
603static DEVICE_ATTR(node_name, S_IRUGO, bfad_im_node_name_show, NULL);
604static DEVICE_ATTR(symbolic_name, S_IRUGO,
605 bfad_im_symbolic_name_show, NULL);
606static DEVICE_ATTR(hardware_version, S_IRUGO,
607 bfad_im_hw_version_show, NULL);
608static DEVICE_ATTR(driver_version, S_IRUGO,
609 bfad_im_drv_version_show, NULL);
610static DEVICE_ATTR(option_rom_version, S_IRUGO,
611 bfad_im_optionrom_version_show, NULL);
612static DEVICE_ATTR(firmware_version, S_IRUGO,
613 bfad_im_fw_version_show, NULL);
614static DEVICE_ATTR(number_of_ports, S_IRUGO,
615 bfad_im_num_of_ports_show, NULL);
616static DEVICE_ATTR(driver_name, S_IRUGO, bfad_im_drv_name_show, NULL);
617static DEVICE_ATTR(number_of_discovered_ports, S_IRUGO,
618 bfad_im_num_of_discovered_ports_show, NULL);
619
620struct device_attribute *bfad_im_host_attrs[] = {
621 &dev_attr_serial_number,
622 &dev_attr_model,
623 &dev_attr_model_description,
624 &dev_attr_node_name,
625 &dev_attr_symbolic_name,
626 &dev_attr_hardware_version,
627 &dev_attr_driver_version,
628 &dev_attr_option_rom_version,
629 &dev_attr_firmware_version,
630 &dev_attr_number_of_ports,
631 &dev_attr_driver_name,
632 &dev_attr_number_of_discovered_ports,
633 NULL,
634};
635
636struct device_attribute *bfad_im_vport_attrs[] = {
637 &dev_attr_serial_number,
638 &dev_attr_model,
639 &dev_attr_model_description,
640 &dev_attr_node_name,
641 &dev_attr_symbolic_name,
642 &dev_attr_hardware_version,
643 &dev_attr_driver_version,
644 &dev_attr_option_rom_version,
645 &dev_attr_firmware_version,
646 &dev_attr_number_of_ports,
647 &dev_attr_driver_name,
648 &dev_attr_number_of_discovered_ports,
649 NULL,
650};
651
652