aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorMoore, Eric <Eric.Moore@lsil.com>2006-03-14 11:14:12 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-03-14 15:34:08 -0500
commit4b766471e388352f35a6171563dfc0d272f12b59 (patch)
tree8b143cdbd379a7eaeadedbf237da92c90f031667 /drivers/message/fusion
parent914c2d8e597798d62c2e0a3cba737bf6f611eecf (diff)
[SCSI] fusion - cleanup mptsas event handling functions
Cleanup of mptsas firmware event handlers. Signed-off-by: Eric Moore <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/mptsas.c96
1 files changed, 57 insertions, 39 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index ba555a60bf7f..84643ac6c70f 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1441,6 +1441,17 @@ mptsas_find_phyinfo_by_target(MPT_ADAPTER *ioc, u32 id)
1441 return phy_info; 1441 return phy_info;
1442} 1442}
1443 1443
1444/*
1445 * Work queue thread to clear the persitency table
1446 */
1447static void
1448mptscsih_sas_persist_clear_table(void * arg)
1449{
1450 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
1451
1452 mptbase_sas_persist_operation(ioc, MPI_SAS_OP_CLEAR_NOT_PRESENT);
1453}
1454
1444static void 1455static void
1445mptsas_hotplug_work(void *arg) 1456mptsas_hotplug_work(void *arg)
1446{ 1457{
@@ -1537,7 +1548,7 @@ mptsas_hotplug_work(void *arg)
1537 break; 1548 break;
1538 } 1549 }
1539 printk(MYIOC_s_INFO_FMT 1550 printk(MYIOC_s_INFO_FMT
1540 "attaching device, channel %d, id %d\n", 1551 "attaching raid volume, channel %d, id %d\n",
1541 ioc->name, ioc->num_ports, ev->id); 1552 ioc->name, ioc->num_ports, ev->id);
1542 scsi_add_device(ioc->sh, 1553 scsi_add_device(ioc->sh,
1543 ioc->num_ports, 1554 ioc->num_ports,
@@ -1554,7 +1565,7 @@ mptsas_hotplug_work(void *arg)
1554 if (!sdev) 1565 if (!sdev)
1555 break; 1566 break;
1556 printk(MYIOC_s_INFO_FMT 1567 printk(MYIOC_s_INFO_FMT
1557 "removing device, channel %d, id %d\n", 1568 "removing raid volume, channel %d, id %d\n",
1558 ioc->name, ioc->num_ports, ev->id); 1569 ioc->name, ioc->num_ports, ev->id);
1559 scsi_remove_device(sdev); 1570 scsi_remove_device(sdev);
1560 scsi_device_put(sdev); 1571 scsi_device_put(sdev);
@@ -1579,35 +1590,51 @@ mptscsih_send_sas_event(MPT_ADAPTER *ioc,
1579 MPI_SAS_DEVICE_INFO_SATA_DEVICE )) == 0) 1590 MPI_SAS_DEVICE_INFO_SATA_DEVICE )) == 0)
1580 return; 1591 return;
1581 1592
1582 if ((sas_event_data->ReasonCode & 1593 switch (sas_event_data->ReasonCode) {
1583 (MPI_EVENT_SAS_DEV_STAT_RC_ADDED | 1594 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED:
1584 MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING)) == 0) 1595 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING:
1585 return; 1596 ev = kmalloc(sizeof(*ev), GFP_ATOMIC);
1597 if (!ev) {
1598 printk(KERN_WARNING "mptsas: lost hotplug event\n");
1599 break;
1600 }
1586 1601
1587 ev = kmalloc(sizeof(*ev), GFP_ATOMIC); 1602 INIT_WORK(&ev->work, mptsas_hotplug_work, ev);
1588 if (!ev) { 1603 ev->ioc = ioc;
1589 printk(KERN_WARNING "mptsas: lost hotplug event\n"); 1604 ev->handle = le16_to_cpu(sas_event_data->DevHandle);
1590 return; 1605 ev->parent_handle =
1606 le16_to_cpu(sas_event_data->ParentDevHandle);
1607 ev->channel = sas_event_data->Bus;
1608 ev->id = sas_event_data->TargetID;
1609 ev->phy_id = sas_event_data->PhyNum;
1610 memcpy(&sas_address, &sas_event_data->SASAddress,
1611 sizeof(__le64));
1612 ev->sas_address = le64_to_cpu(sas_address);
1613 ev->device_info = device_info;
1614
1615 if (sas_event_data->ReasonCode &
1616 MPI_EVENT_SAS_DEV_STAT_RC_ADDED)
1617 ev->event_type = MPTSAS_ADD_DEVICE;
1618 else
1619 ev->event_type = MPTSAS_DEL_DEVICE;
1620 schedule_work(&ev->work);
1621 break;
1622 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED:
1623 /*
1624 * Persistent table is full.
1625 */
1626 INIT_WORK(&ioc->mptscsih_persistTask,
1627 mptscsih_sas_persist_clear_table,
1628 (void *)ioc);
1629 schedule_work(&ioc->mptscsih_persistTask);
1630 break;
1631 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
1632 /* TODO */
1633 case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET:
1634 /* TODO */
1635 default:
1636 break;
1591 } 1637 }
1592
1593
1594 INIT_WORK(&ev->work, mptsas_hotplug_work, ev);
1595 ev->ioc = ioc;
1596 ev->handle = le16_to_cpu(sas_event_data->DevHandle);
1597 ev->parent_handle = le16_to_cpu(sas_event_data->ParentDevHandle);
1598 ev->channel = sas_event_data->Bus;
1599 ev->id = sas_event_data->TargetID;
1600 ev->phy_id = sas_event_data->PhyNum;
1601 memcpy(&sas_address, &sas_event_data->SASAddress, sizeof(__le64));
1602 ev->sas_address = le64_to_cpu(sas_address);
1603 ev->device_info = device_info;
1604
1605 if (sas_event_data->ReasonCode & MPI_EVENT_SAS_DEV_STAT_RC_ADDED)
1606 ev->event_type = MPTSAS_ADD_DEVICE;
1607 else
1608 ev->event_type = MPTSAS_DEL_DEVICE;
1609
1610 schedule_work(&ev->work);
1611} 1638}
1612 1639
1613static void 1640static void
@@ -1657,16 +1684,6 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc,
1657 schedule_work(&ev->work); 1684 schedule_work(&ev->work);
1658} 1685}
1659 1686
1660/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1661/* work queue thread to clear the persitency table */
1662static void
1663mptscsih_sas_persist_clear_table(void * arg)
1664{
1665 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
1666
1667 mptbase_sas_persist_operation(ioc, MPI_SAS_OP_CLEAR_NOT_PRESENT);
1668}
1669
1670static int 1687static int
1671mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply) 1688mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
1672{ 1689{
@@ -1691,6 +1708,7 @@ mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
1691 (void *)ioc); 1708 (void *)ioc);
1692 schedule_work(&ioc->mptscsih_persistTask); 1709 schedule_work(&ioc->mptscsih_persistTask);
1693 break; 1710 break;
1711 case MPI_EVENT_SAS_DISCOVERY:
1694 default: 1712 default:
1695 rc = mptscsih_event_process(ioc, reply); 1713 rc = mptscsih_event_process(ioc, reply);
1696 break; 1714 break;