diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 111 |
1 files changed, 96 insertions, 15 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index fc25cd834668..48e460eef05a 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1,20 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * QLOGIC LINUX SOFTWARE | 2 | * QLogic Fibre Channel HBA Driver |
3 | * | 3 | * Copyright (c) 2003-2005 QLogic Corporation |
4 | * QLogic ISP2x00 device driver for Linux 2.6.x | ||
5 | * Copyright (C) 2003-2005 QLogic Corporation | ||
6 | * (www.qlogic.com) | ||
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 as published by the | ||
10 | * Free Software Foundation; either version 2, or (at your option) any | ||
11 | * later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | 4 | * |
5 | * See LICENSE.qla2xxx for copyright and licensing details. | ||
18 | */ | 6 | */ |
19 | #include "qla_def.h" | 7 | #include "qla_def.h" |
20 | 8 | ||
@@ -319,6 +307,83 @@ qla2x00_state_show(struct class_device *cdev, char *buf) | |||
319 | return len; | 307 | return len; |
320 | } | 308 | } |
321 | 309 | ||
310 | static ssize_t | ||
311 | qla2x00_zio_show(struct class_device *cdev, char *buf) | ||
312 | { | ||
313 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
314 | int len = 0; | ||
315 | |||
316 | switch (ha->zio_mode) { | ||
317 | case QLA_ZIO_MODE_5: | ||
318 | len += snprintf(buf + len, PAGE_SIZE-len, "Mode 5\n"); | ||
319 | break; | ||
320 | case QLA_ZIO_MODE_6: | ||
321 | len += snprintf(buf + len, PAGE_SIZE-len, "Mode 6\n"); | ||
322 | break; | ||
323 | case QLA_ZIO_DISABLED: | ||
324 | len += snprintf(buf + len, PAGE_SIZE-len, "Disabled\n"); | ||
325 | break; | ||
326 | } | ||
327 | return len; | ||
328 | } | ||
329 | |||
330 | static ssize_t | ||
331 | qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) | ||
332 | { | ||
333 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
334 | int val = 0; | ||
335 | uint16_t zio_mode; | ||
336 | |||
337 | if (sscanf(buf, "%d", &val) != 1) | ||
338 | return -EINVAL; | ||
339 | |||
340 | switch (val) { | ||
341 | case 1: | ||
342 | zio_mode = QLA_ZIO_MODE_5; | ||
343 | break; | ||
344 | case 2: | ||
345 | zio_mode = QLA_ZIO_MODE_6; | ||
346 | break; | ||
347 | default: | ||
348 | zio_mode = QLA_ZIO_DISABLED; | ||
349 | break; | ||
350 | } | ||
351 | |||
352 | /* Update per-hba values and queue a reset. */ | ||
353 | if (zio_mode != QLA_ZIO_DISABLED || ha->zio_mode != QLA_ZIO_DISABLED) { | ||
354 | ha->zio_mode = zio_mode; | ||
355 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | ||
356 | } | ||
357 | return strlen(buf); | ||
358 | } | ||
359 | |||
360 | static ssize_t | ||
361 | qla2x00_zio_timer_show(struct class_device *cdev, char *buf) | ||
362 | { | ||
363 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
364 | |||
365 | return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); | ||
366 | } | ||
367 | |||
368 | static ssize_t | ||
369 | qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | ||
370 | size_t count) | ||
371 | { | ||
372 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
373 | int val = 0; | ||
374 | uint16_t zio_timer; | ||
375 | |||
376 | if (sscanf(buf, "%d", &val) != 1) | ||
377 | return -EINVAL; | ||
378 | if (val > 25500 || val < 100) | ||
379 | return -ERANGE; | ||
380 | |||
381 | zio_timer = (uint16_t)(val / 100); | ||
382 | ha->zio_timer = zio_timer; | ||
383 | |||
384 | return strlen(buf); | ||
385 | } | ||
386 | |||
322 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, | 387 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, |
323 | NULL); | 388 | NULL); |
324 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); | 389 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); |
@@ -329,6 +394,10 @@ static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); | |||
329 | static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); | 394 | static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); |
330 | static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); | 395 | static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); |
331 | static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); | 396 | static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); |
397 | static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, | ||
398 | qla2x00_zio_store); | ||
399 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, | ||
400 | qla2x00_zio_timer_store); | ||
332 | 401 | ||
333 | struct class_device_attribute *qla2x00_host_attrs[] = { | 402 | struct class_device_attribute *qla2x00_host_attrs[] = { |
334 | &class_device_attr_driver_version, | 403 | &class_device_attr_driver_version, |
@@ -340,6 +409,8 @@ struct class_device_attribute *qla2x00_host_attrs[] = { | |||
340 | &class_device_attr_model_desc, | 409 | &class_device_attr_model_desc, |
341 | &class_device_attr_pci_info, | 410 | &class_device_attr_pci_info, |
342 | &class_device_attr_state, | 411 | &class_device_attr_state, |
412 | &class_device_attr_zio, | ||
413 | &class_device_attr_zio_timer, | ||
343 | NULL, | 414 | NULL, |
344 | }; | 415 | }; |
345 | 416 | ||
@@ -432,6 +503,15 @@ qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) | |||
432 | rport->dev_loss_tmo = ha->port_down_retry_count + 5; | 503 | rport->dev_loss_tmo = ha->port_down_retry_count + 5; |
433 | } | 504 | } |
434 | 505 | ||
506 | static int | ||
507 | qla2x00_issue_lip(struct Scsi_Host *shost) | ||
508 | { | ||
509 | scsi_qla_host_t *ha = to_qla_host(shost); | ||
510 | |||
511 | set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags); | ||
512 | return 0; | ||
513 | } | ||
514 | |||
435 | struct fc_function_template qla2xxx_transport_functions = { | 515 | struct fc_function_template qla2xxx_transport_functions = { |
436 | 516 | ||
437 | .show_host_node_name = 1, | 517 | .show_host_node_name = 1, |
@@ -455,6 +535,7 @@ struct fc_function_template qla2xxx_transport_functions = { | |||
455 | .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo, | 535 | .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo, |
456 | .show_rport_dev_loss_tmo = 1, | 536 | .show_rport_dev_loss_tmo = 1, |
457 | 537 | ||
538 | .issue_fc_host_lip = qla2x00_issue_lip, | ||
458 | }; | 539 | }; |
459 | 540 | ||
460 | void | 541 | void |