aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorJamie Wellnitz <Jamie.Wellnitz@emulex.com>2006-02-28 19:25:27 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-28 20:00:36 -0500
commit41415862a23f422b80eccc92cf885935139e2415 (patch)
treee3a9537653e472f15405778c4dcc678a56304848 /drivers/scsi/lpfc/lpfc_attr.c
parentd9d959c41f013439508e0fa1d31f5644d8d626ef (diff)
[SCSI] lpfc 8.1.2: Add ERROR and WARM_START modes for diagnostic purposes.
Add ERROR and WARM_START modes for diagnostic purposes. Signed-off-by: Jamie Wellnitz <Jamie.Wellnitz@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index c8fb43d60882..e7aca3c4b26e 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2005 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2006 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -149,6 +149,8 @@ lpfc_state_show(struct class_device *cdev, char *buf)
149 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; 149 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
150 int len = 0; 150 int len = 0;
151 switch (phba->hba_state) { 151 switch (phba->hba_state) {
152 case LPFC_STATE_UNKNOWN:
153 case LPFC_WARM_START:
152 case LPFC_INIT_START: 154 case LPFC_INIT_START:
153 case LPFC_INIT_MBX_CMDS: 155 case LPFC_INIT_MBX_CMDS:
154 case LPFC_LINK_DOWN: 156 case LPFC_LINK_DOWN:
@@ -279,6 +281,58 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf,
279} 281}
280 282
281static ssize_t 283static ssize_t
284lpfc_board_mode_show(struct class_device *cdev, char *buf)
285{
286 struct Scsi_Host *host = class_to_shost(cdev);
287 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
288 char * state;
289
290 if (phba->hba_state == LPFC_HBA_ERROR)
291 state = "error";
292 else if (phba->hba_state == LPFC_WARM_START)
293 state = "warm start";
294 else if (phba->hba_state == LPFC_INIT_START)
295 state = "offline";
296 else
297 state = "online";
298
299 return snprintf(buf, PAGE_SIZE, "%s\n", state);
300}
301
302static ssize_t
303lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count)
304{
305 struct Scsi_Host *host = class_to_shost(cdev);
306 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
307 struct completion online_compl;
308 int status=0;
309
310 init_completion(&online_compl);
311
312 if(strncmp(buf, "online", sizeof("online") - 1) == 0)
313 lpfc_workq_post_event(phba, &status, &online_compl,
314 LPFC_EVT_ONLINE);
315 else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0)
316 lpfc_workq_post_event(phba, &status, &online_compl,
317 LPFC_EVT_OFFLINE);
318 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0)
319 lpfc_workq_post_event(phba, &status, &online_compl,
320 LPFC_EVT_WARM_START);
321 else if (strncmp(buf, "error", sizeof("error") - 1) == 0)
322 lpfc_workq_post_event(phba, &status, &online_compl,
323 LPFC_EVT_KILL);
324 else
325 return -EINVAL;
326
327 wait_for_completion(&online_compl);
328
329 if (!status)
330 return strlen(buf);
331 else
332 return -EIO;
333}
334
335static ssize_t
282lpfc_poll_show(struct class_device *cdev, char *buf) 336lpfc_poll_show(struct class_device *cdev, char *buf)
283{ 337{
284 struct Scsi_Host *host = class_to_shost(cdev); 338 struct Scsi_Host *host = class_to_shost(cdev);
@@ -480,6 +534,8 @@ static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show,
480 NULL); 534 NULL);
481static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, 535static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR,
482 lpfc_board_online_show, lpfc_board_online_store); 536 lpfc_board_online_show, lpfc_board_online_store);
537static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR,
538 lpfc_board_mode_show, lpfc_board_mode_store);
483 539
484static int lpfc_poll = 0; 540static int lpfc_poll = 0;
485module_param(lpfc_poll, int, 0); 541module_param(lpfc_poll, int, 0);
@@ -674,6 +730,7 @@ struct class_device_attribute *lpfc_host_attrs[] = {
674 &class_device_attr_nport_evt_cnt, 730 &class_device_attr_nport_evt_cnt,
675 &class_device_attr_management_version, 731 &class_device_attr_management_version,
676 &class_device_attr_board_online, 732 &class_device_attr_board_online,
733 &class_device_attr_board_mode,
677 &class_device_attr_lpfc_poll, 734 &class_device_attr_lpfc_poll,
678 &class_device_attr_lpfc_poll_tmo, 735 &class_device_attr_lpfc_poll_tmo,
679 NULL, 736 NULL,
@@ -883,8 +940,11 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count)
883 case MBX_DUMP_MEMORY: 940 case MBX_DUMP_MEMORY:
884 case MBX_DOWN_LOAD: 941 case MBX_DOWN_LOAD:
885 case MBX_UPDATE_CFG: 942 case MBX_UPDATE_CFG:
943 case MBX_KILL_BOARD:
886 case MBX_LOAD_AREA: 944 case MBX_LOAD_AREA:
887 case MBX_LOAD_EXP_ROM: 945 case MBX_LOAD_EXP_ROM:
946 case MBX_BEACON:
947 case MBX_DEL_LD_ENTRY:
888 break; 948 break;
889 case MBX_READ_SPARM64: 949 case MBX_READ_SPARM64:
890 case MBX_READ_LA: 950 case MBX_READ_LA:
@@ -1042,6 +1102,8 @@ lpfc_get_host_port_state(struct Scsi_Host *shost)
1042 fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; 1102 fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
1043 else { 1103 else {
1044 switch (phba->hba_state) { 1104 switch (phba->hba_state) {
1105 case LPFC_STATE_UNKNOWN:
1106 case LPFC_WARM_START:
1045 case LPFC_INIT_START: 1107 case LPFC_INIT_START:
1046 case LPFC_INIT_MBX_CMDS: 1108 case LPFC_INIT_MBX_CMDS:
1047 case LPFC_LINK_DOWN: 1109 case LPFC_LINK_DOWN: