aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c254
1 files changed, 0 insertions, 254 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 2b6104daacb0..84db911318c6 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -119,19 +119,6 @@ module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR);
119MODULE_PARM_DESC(ql2xloginretrycount, 119MODULE_PARM_DESC(ql2xloginretrycount,
120 "Specify an alternate value for the NVRAM login retry count."); 120 "Specify an alternate value for the NVRAM login retry count.");
121 121
122/*
123 * Proc structures and functions
124 */
125struct info_str {
126 char *buffer;
127 int length;
128 off_t offset;
129 int pos;
130};
131
132static void copy_mem_info(struct info_str *, char *, int);
133static int copy_info(struct info_str *, char *, ...);
134
135static void qla2x00_free_device(scsi_qla_host_t *); 122static void qla2x00_free_device(scsi_qla_host_t *);
136 123
137static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); 124static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha);
@@ -151,14 +138,9 @@ static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
151static int qla2x00_loop_reset(scsi_qla_host_t *ha); 138static int qla2x00_loop_reset(scsi_qla_host_t *ha);
152static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *); 139static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *);
153 140
154static int qla2x00_proc_info(struct Scsi_Host *, char *, char **,
155 off_t, int, int);
156
157static struct scsi_host_template qla2x00_driver_template = { 141static struct scsi_host_template qla2x00_driver_template = {
158 .module = THIS_MODULE, 142 .module = THIS_MODULE,
159 .name = "qla2xxx", 143 .name = "qla2xxx",
160 .proc_name = "qla2xxx",
161 .proc_info = qla2x00_proc_info,
162 .queuecommand = qla2x00_queuecommand, 144 .queuecommand = qla2x00_queuecommand,
163 145
164 .eh_abort_handler = qla2xxx_eh_abort, 146 .eh_abort_handler = qla2xxx_eh_abort,
@@ -1020,7 +1002,6 @@ qla2xxx_slave_alloc(struct scsi_device *sdev)
1020 found++; 1002 found++;
1021 break; 1003 break;
1022 } 1004 }
1023
1024 } 1005 }
1025 if (!found) 1006 if (!found)
1026 return -ENXIO; 1007 return -ENXIO;
@@ -1484,241 +1465,6 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1484 pci_disable_device(ha->pdev); 1465 pci_disable_device(ha->pdev);
1485} 1466}
1486 1467
1487
1488/*
1489 * The following support functions are adopted to handle
1490 * the re-entrant qla2x00_proc_info correctly.
1491 */
1492static void
1493copy_mem_info(struct info_str *info, char *data, int len)
1494{
1495 if (info->pos + len > info->offset + info->length)
1496 len = info->offset + info->length - info->pos;
1497
1498 if (info->pos + len < info->offset) {
1499 info->pos += len;
1500 return;
1501 }
1502
1503 if (info->pos < info->offset) {
1504 off_t partial;
1505
1506 partial = info->offset - info->pos;
1507 data += partial;
1508 info->pos += partial;
1509 len -= partial;
1510 }
1511
1512 if (len > 0) {
1513 memcpy(info->buffer, data, len);
1514 info->pos += len;
1515 info->buffer += len;
1516 }
1517}
1518
1519static int
1520copy_info(struct info_str *info, char *fmt, ...)
1521{
1522 va_list args;
1523 char buf[256];
1524 int len;
1525
1526 va_start(args, fmt);
1527 len = vsprintf(buf, fmt, args);
1528 va_end(args);
1529
1530 copy_mem_info(info, buf, len);
1531
1532 return (len);
1533}
1534
1535/*************************************************************************
1536* qla2x00_proc_info
1537*
1538* Description:
1539* Return information to handle /proc support for the driver.
1540*
1541* inout : decides the direction of the dataflow and the meaning of the
1542* variables
1543* buffer: If inout==0 data is being written to it else read from it
1544* (ptr to a page buffer)
1545* *start: If inout==0 start of the valid data in the buffer
1546* offset: If inout==0 starting offset from the beginning of all
1547* possible data to return.
1548* length: If inout==0 max number of bytes to be written into the buffer
1549* else number of bytes in "buffer"
1550* Returns:
1551* < 0: error. errno value.
1552* >= 0: sizeof data returned.
1553*************************************************************************/
1554int
1555qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,
1556 char **start, off_t offset, int length, int inout)
1557{
1558 struct info_str info;
1559 int retval = -EINVAL;
1560 uint32_t tmp_sn;
1561 uint32_t *flags;
1562 uint8_t *loop_state;
1563 scsi_qla_host_t *ha;
1564 char fw_info[30];
1565
1566 DEBUG3(printk(KERN_INFO
1567 "Entering proc_info buff_in=%p, offset=0x%lx, length=0x%x\n",
1568 buffer, offset, length);)
1569
1570 ha = (scsi_qla_host_t *) shost->hostdata;
1571
1572 if (inout) {
1573 /* Has data been written to the file? */
1574 DEBUG3(printk(
1575 "%s: has data been written to the file. \n",
1576 __func__);)
1577
1578 return -ENOSYS;
1579 }
1580
1581 if (start) {
1582 *start = buffer;
1583 }
1584
1585 info.buffer = buffer;
1586 info.length = length;
1587 info.offset = offset;
1588 info.pos = 0;
1589
1590 /* start building the print buffer */
1591 copy_info(&info,
1592 "QLogic PCI to Fibre Channel Host Adapter for %s:\n"
1593 " Firmware version %s, ",
1594 ha->model_number, qla2x00_get_fw_version_str(ha, fw_info));
1595
1596 copy_info(&info, "Driver version %s\n", qla2x00_version_str);
1597
1598 tmp_sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) |
1599 ha->serial1;
1600 copy_info(&info, "ISP: %s, Serial# %c%05d\n",
1601 ha->brd_info->isp_name, ('A' + tmp_sn/100000), (tmp_sn%100000));
1602
1603 copy_info(&info,
1604 "Request Queue = 0x%llx, Response Queue = 0x%llx\n",
1605 (unsigned long long)ha->request_dma,
1606 (unsigned long long)ha->response_dma);
1607
1608 copy_info(&info,
1609 "Request Queue count = %d, Response Queue count = %d\n",
1610 ha->request_q_length, ha->response_q_length);
1611
1612 copy_info(&info,
1613 "Total number of active commands = %ld\n",
1614 ha->actthreads);
1615
1616 copy_info(&info,
1617 "Total number of interrupts = %ld\n",
1618 (long)ha->total_isr_cnt);
1619
1620 copy_info(&info,
1621 " Device queue depth = 0x%x\n",
1622 (ql2xmaxqdepth == 0) ? 16 : ql2xmaxqdepth);
1623
1624 copy_info(&info,
1625 "Number of free request entries = %d\n", ha->req_q_cnt);
1626
1627 copy_info(&info,
1628 "Number of mailbox timeouts = %ld\n", ha->total_mbx_timeout);
1629
1630 copy_info(&info,
1631 "Number of ISP aborts = %ld\n", ha->total_isp_aborts);
1632
1633 copy_info(&info,
1634 "Number of loop resyncs = %ld\n", ha->total_loop_resync);
1635
1636 copy_info(&info,
1637 "Number of retries for empty slots = %ld\n",
1638 qla2x00_stats.outarray_full);
1639
1640 flags = (uint32_t *) &ha->flags;
1641
1642 if (atomic_read(&ha->loop_state) == LOOP_DOWN) {
1643 loop_state = "DOWN";
1644 } else if (atomic_read(&ha->loop_state) == LOOP_UP) {
1645 loop_state = "UP";
1646 } else if (atomic_read(&ha->loop_state) == LOOP_READY) {
1647 loop_state = "READY";
1648 } else if (atomic_read(&ha->loop_state) == LOOP_TIMEOUT) {
1649 loop_state = "TIMEOUT";
1650 } else if (atomic_read(&ha->loop_state) == LOOP_UPDATE) {
1651 loop_state = "UPDATE";
1652 } else {
1653 loop_state = "UNKNOWN";
1654 }
1655
1656 copy_info(&info,
1657 "Host adapter:loop state = <%s>, flags = 0x%lx\n",
1658 loop_state , *flags);
1659
1660 copy_info(&info, "Dpc flags = 0x%lx\n", ha->dpc_flags);
1661
1662 copy_info(&info, "MBX flags = 0x%x\n", ha->mbx_flags);
1663
1664 copy_info(&info, "Link down Timeout = %3.3d\n",
1665 ha->link_down_timeout);
1666
1667 copy_info(&info, "Port down retry = %3.3d\n",
1668 ha->port_down_retry_count);
1669
1670 copy_info(&info, "Login retry count = %3.3d\n",
1671 ha->login_retry_count);
1672
1673 copy_info(&info,
1674 "Commands retried with dropped frame(s) = %d\n",
1675 ha->dropped_frame_error_cnt);
1676
1677 copy_info(&info,
1678 "Product ID = %04x %04x %04x %04x\n", ha->product_id[0],
1679 ha->product_id[1], ha->product_id[2], ha->product_id[3]);
1680
1681 copy_info(&info, "\n");
1682
1683 /* 2.25 node/port display to proc */
1684 /* Display the node name for adapter */
1685 copy_info(&info, "\nSCSI Device Information:\n");
1686 copy_info(&info,
1687 "scsi-qla%d-adapter-node="
1688 "%02x%02x%02x%02x%02x%02x%02x%02x;\n",
1689 (int)ha->instance,
1690 ha->init_cb->node_name[0],
1691 ha->init_cb->node_name[1],
1692 ha->init_cb->node_name[2],
1693 ha->init_cb->node_name[3],
1694 ha->init_cb->node_name[4],
1695 ha->init_cb->node_name[5],
1696 ha->init_cb->node_name[6],
1697 ha->init_cb->node_name[7]);
1698
1699 /* display the port name for adapter */
1700 copy_info(&info,
1701 "scsi-qla%d-adapter-port="
1702 "%02x%02x%02x%02x%02x%02x%02x%02x;\n",
1703 (int)ha->instance,
1704 ha->init_cb->port_name[0],
1705 ha->init_cb->port_name[1],
1706 ha->init_cb->port_name[2],
1707 ha->init_cb->port_name[3],
1708 ha->init_cb->port_name[4],
1709 ha->init_cb->port_name[5],
1710 ha->init_cb->port_name[6],
1711 ha->init_cb->port_name[7]);
1712
1713 retval = info.pos > info.offset ? info.pos - info.offset : 0;
1714
1715 DEBUG3(printk(KERN_INFO
1716 "Exiting proc_info: info.pos=%d, offset=0x%lx, "
1717 "length=0x%x\n", info.pos, offset, length);)
1718
1719 return (retval);
1720}
1721
1722/* 1468/*
1723 * qla2x00_mark_device_lost Updates fcport state when device goes offline. 1469 * qla2x00_mark_device_lost Updates fcport state when device goes offline.
1724 * 1470 *