26 #include <linux/slab.h>
35 #include "../scsi_sas_internal.h"
43 INIT_LIST_HEAD(&dev->
ssp_dev.eh_list_node);
47 INIT_LIST_HEAD(&dev->
ex_dev.children);
73 dev = sas_alloc_device();
95 && (fis->
device & ~0x10) == 0)
101 struct sas_identify_frame *
id =
102 (
struct sas_identify_frame *) dev->
frame_rcvd;
104 dev->
iproto = id->initiator_bits;
105 dev->
tproto = id->target_bits;
141 rphy->
identify.phy_identifier = phy->
phy->identify.phy_identifier;
143 sas_fill_in_rphy(dev, rphy);
153 port->
disc.max_level = 0;
169 sas_phy_set_target(phy, dev);
170 spin_unlock_irq(&port->phy_list_lock);
184 if (!i->
dft->lldd_dev_found)
187 res = i->
dft->lldd_dev_found(dev);
189 printk(
"sas: driver on pcidev %s cannot handle "
190 "device %llx, error:%d\n",
191 dev_name(sas_ha->
dev),
195 kref_get(&dev->kref);
206 if (!i->
dft->lldd_dev_gone)
210 i->
dft->lldd_dev_gone(dev);
237 sas_fail_probe(dev, __func__, err);
243 static void sas_suspend_devices(
struct work_struct *work)
267 if (si->
dft->lldd_port_formed)
268 si->
dft->lldd_port_deformed(phy);
274 static void sas_resume_devices(
struct work_struct *work)
312 sas_put_device(dev->
parent);
314 sas_port_put_phy(dev->
phy);
321 if (dev_is_sata(dev) && dev->
sata_dev.ap) {
341 if (dev_is_sata(dev))
345 spin_lock_irq(&ha->
lock);
347 !list_empty(&dev->
ssp_dev.eh_list_node)) {
348 list_del_init(&dev->
ssp_dev.eh_list_node);
351 spin_unlock_irq(&ha->
lock);
356 static void sas_destruct_devices(
struct work_struct *work)
369 sas_unregister_common_dev(port, dev);
380 sas_unregister_common_dev(port, dev);
422 sas_port_put_phy(dev->
phy);
439 static void sas_discover_domain(
struct work_struct *work)
451 error = sas_get_port_device(port);
456 SAS_DPRINTK(
"DOING DISCOVERY on port %d, pid:%d\n", port->
id,
469 #ifdef CONFIG_SCSI_SAS_ATA
473 SAS_DPRINTK(
"ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
493 SAS_DPRINTK(
"DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->
id,
497 static void sas_revalidate_domain(
struct work_struct *work)
507 SAS_DPRINTK(
"REVALIDATION DEFERRED on port %d, pid:%d\n",
514 SAS_DPRINTK(
"REVALIDATING DOMAIN on port %d, pid:%d\n", port->
id,
520 SAS_DPRINTK(
"done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
538 static void sas_chain_event(
int event,
unsigned long *
pending,
546 sas_chain_work(ha, sw);
547 spin_unlock_irqrestore(&ha->
lock, flags);
587 INIT_SAS_WORK(&disc->
disc_work[i].work, sas_event_fns[i]);