26 #include <linux/module.h>
27 #include <linux/slab.h>
29 #include <linux/device.h>
39 #include "../scsi_sas_internal.h"
45 struct sas_task *
task = kmem_cache_zalloc(sas_task_cache, flags);
48 INIT_LIST_HEAD(&task->
list);
90 const u32 poly = 0x00DB2777;
94 for (i = 0; i < 8; i++) {
96 for (b = 7; b >= 0; b--) {
98 if ((1 << b) & sas_addr[i]) {
99 if (!(r & 0x01000000))
101 }
else if (r & 0x01000000)
106 hashed[0] = (r >> 16) & 0xFF;
107 hashed[1] = (r >> 8) & 0xFF ;
108 hashed[2] = r & 0xFF;
139 INIT_LIST_HEAD(&sas_ha->
defer_q);
164 "running in direct mode\n", error);
187 spin_lock_irq(&sas_ha->
lock);
189 spin_unlock_irq(&sas_ha->
lock);
196 sas_disable_events(sas_ha);
212 static int sas_get_linkerrors(
struct sas_phy *
phy)
233 dev = asd_phy->
port->port_dev;
239 if (dev && dev_is_sata(dev)) {
254 static int transport_sas_phy_reset(
struct sas_phy *phy,
int hard_reset)
272 return i->
dft->lldd_control_phy(asd_phy, reset_type,
NULL);
278 if (ata_dev && !hard_reset) {
298 struct Scsi_Host *shost = dev_to_shost(phy->
dev.parent);
305 ret = transport_sas_phy_reset(phy, 0);
307 ret = i->
dft->lldd_control_phy(asd_phy, cmd,
NULL);
313 ret = transport_sas_phy_reset(phy, 0);
334 struct Scsi_Host *shost = dev_to_shost(phy->
dev.parent);
340 ret = i->
dft->lldd_control_phy(asd_phy, reset_type,
NULL);
369 struct Scsi_Host *shost = dev_to_shost(phy->
dev.parent);
395 for (i = 0; i < ha->
num_phys; i++) {
410 for (i = 0; i < ha->
num_phys; i++) {
431 i = phys_suspended(ha);
433 dev_info(ha->
dev,
"waiting up to 25 seconds for %d phy%s to resume\n",
434 i, i > 1 ?
"s" :
"");
436 for (i = 0; i < ha->
num_phys; i++) {
457 sas_disable_events(ha);
459 for (i = 0; i < ha->
num_phys; i++) {
472 static void sas_phy_release(
struct sas_phy *phy)
485 static void phy_enable_work(
struct work_struct *work)
492 static int sas_phy_setup(
struct sas_phy *phy)
500 INIT_SAS_WORK(&d->
reset_work, phy_reset_work);
508 static int queue_phy_reset(
struct sas_phy *phy,
int hard_reset)
510 struct Scsi_Host *shost = dev_to_shost(phy->
dev.parent);
523 spin_lock_irq(&ha->
lock);
525 spin_unlock_irq(&ha->
lock);
535 static int queue_phy_enable(
struct sas_phy *phy,
int enable)
537 struct Scsi_Host *shost = dev_to_shost(phy->
dev.parent);
550 spin_lock_irq(&ha->
lock);
552 spin_unlock_irq(&ha->
lock);
563 .phy_enable = queue_phy_enable,
564 .phy_reset = queue_phy_reset,
565 .phy_setup = sas_phy_setup,
566 .phy_release = sas_phy_release,
568 .get_linkerrors = sas_get_linkerrors,
600 static int __init sas_class_init(
void)
609 static void __exit sas_class_exit(
void)