Commit 121181f3 authored by John Garry's avatar John Garry Committed by Martin K. Petersen

scsi: libsas: Remove notifier indirection

LLDDs report events to libsas with .notify_port_event and .notify_phy_event
callbacks.

These callbacks are fixed and so there is no reason why the functions
cannot be called directly, so do that.

This neatens the code slightly, makes it more obvious, and reduces function
pointer usage, which is generally a good thing. Downside is that there are
2x more symbol exports.

[a.darwish@linutronix.de: Remove the now unused "sas_ha" local variables]

Link: https://lore.kernel.org/r/20210118100955.1761652-3-a.darwish@linutronix.deReviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarAhmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 3f901c81
...@@ -189,12 +189,8 @@ num_phys ...@@ -189,12 +189,8 @@ num_phys
The event interface:: The event interface::
/* LLDD calls these to notify the class of an event. */ /* LLDD calls these to notify the class of an event. */
void (*notify_port_event)(struct sas_phy *, enum port_event); void sas_notify_port_event(struct sas_phy *, enum port_event);
void (*notify_phy_event)(struct sas_phy *, enum phy_event); void sas_notify_phy_event(struct sas_phy *, enum phy_event);
When sas_register_ha() returns, those are set and can be
called by the LLDD to notify the SAS layer of such events
the SAS layer.
The port notification:: The port notification::
......
...@@ -68,7 +68,6 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb, ...@@ -68,7 +68,6 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb,
struct done_list_struct *dl) struct done_list_struct *dl)
{ {
struct asd_ha_struct *asd_ha = ascb->ha; struct asd_ha_struct *asd_ha = ascb->ha;
struct sas_ha_struct *sas_ha = &asd_ha->sas_ha;
int phy_id = dl->status_block[0] & DL_PHY_MASK; int phy_id = dl->status_block[0] & DL_PHY_MASK;
struct asd_phy *phy = &asd_ha->phys[phy_id]; struct asd_phy *phy = &asd_ha->phys[phy_id];
...@@ -81,7 +80,7 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb, ...@@ -81,7 +80,7 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb,
ASD_DPRINTK("phy%d: device unplugged\n", phy_id); ASD_DPRINTK("phy%d: device unplugged\n", phy_id);
asd_turn_led(asd_ha, phy_id, 0); asd_turn_led(asd_ha, phy_id, 0);
sas_phy_disconnected(&phy->sas_phy); sas_phy_disconnected(&phy->sas_phy);
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL); sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL);
break; break;
case CURRENT_OOB_DONE: case CURRENT_OOB_DONE:
/* hot plugged device */ /* hot plugged device */
...@@ -89,12 +88,12 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb, ...@@ -89,12 +88,12 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb,
get_lrate_mode(phy, oob_mode); get_lrate_mode(phy, oob_mode);
ASD_DPRINTK("phy%d device plugged: lrate:0x%x, proto:0x%x\n", ASD_DPRINTK("phy%d device plugged: lrate:0x%x, proto:0x%x\n",
phy_id, phy->sas_phy.linkrate, phy->sas_phy.iproto); phy_id, phy->sas_phy.linkrate, phy->sas_phy.iproto);
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE);
break; break;
case CURRENT_SPINUP_HOLD: case CURRENT_SPINUP_HOLD:
/* hot plug SATA, no COMWAKE sent */ /* hot plug SATA, no COMWAKE sent */
asd_turn_led(asd_ha, phy_id, 1); asd_turn_led(asd_ha, phy_id, 1);
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD); sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD);
break; break;
case CURRENT_GTO_TIMEOUT: case CURRENT_GTO_TIMEOUT:
case CURRENT_OOB_ERROR: case CURRENT_OOB_ERROR:
...@@ -102,7 +101,7 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb, ...@@ -102,7 +101,7 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb,
dl->status_block[1]); dl->status_block[1]);
asd_turn_led(asd_ha, phy_id, 0); asd_turn_led(asd_ha, phy_id, 0);
sas_phy_disconnected(&phy->sas_phy); sas_phy_disconnected(&phy->sas_phy);
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR);
break; break;
} }
} }
...@@ -222,7 +221,6 @@ static void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb, ...@@ -222,7 +221,6 @@ static void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb,
int edb_el = edb_id + ascb->edb_index; int edb_el = edb_id + ascb->edb_index;
struct asd_dma_tok *edb = ascb->ha->seq.edb_arr[edb_el]; struct asd_dma_tok *edb = ascb->ha->seq.edb_arr[edb_el];
struct asd_phy *phy = &ascb->ha->phys[phy_id]; struct asd_phy *phy = &ascb->ha->phys[phy_id];
struct sas_ha_struct *sas_ha = phy->sas_phy.ha;
u16 size = ((dl->status_block[3] & 7) << 8) | dl->status_block[2]; u16 size = ((dl->status_block[3] & 7) << 8) | dl->status_block[2];
size = min(size, (u16) sizeof(phy->frame_rcvd)); size = min(size, (u16) sizeof(phy->frame_rcvd));
...@@ -234,7 +232,7 @@ static void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb, ...@@ -234,7 +232,7 @@ static void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb,
spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags);
asd_dump_frame_rcvd(phy, dl); asd_dump_frame_rcvd(phy, dl);
asd_form_port(ascb->ha, phy); asd_form_port(ascb->ha, phy);
sas_ha->notify_port_event(&phy->sas_phy, PORTE_BYTES_DMAED); sas_notify_port_event(&phy->sas_phy, PORTE_BYTES_DMAED);
} }
static void asd_link_reset_err_tasklet(struct asd_ascb *ascb, static void asd_link_reset_err_tasklet(struct asd_ascb *ascb,
...@@ -270,7 +268,7 @@ static void asd_link_reset_err_tasklet(struct asd_ascb *ascb, ...@@ -270,7 +268,7 @@ static void asd_link_reset_err_tasklet(struct asd_ascb *ascb,
asd_turn_led(asd_ha, phy_id, 0); asd_turn_led(asd_ha, phy_id, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
asd_deform_port(asd_ha, phy); asd_deform_port(asd_ha, phy);
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
if (retries_left == 0) { if (retries_left == 0) {
int num = 1; int num = 1;
...@@ -315,7 +313,7 @@ static void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb, ...@@ -315,7 +313,7 @@ static void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb,
spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
sas_phy->sas_prim = ffs(cont); sas_phy->sas_prim = ffs(cont);
spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
sas_ha->notify_port_event(sas_phy,PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
break; break;
case LmUNKNOWNP: case LmUNKNOWNP:
...@@ -336,7 +334,7 @@ static void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb, ...@@ -336,7 +334,7 @@ static void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb,
/* The sequencer disables all phys on that port. /* The sequencer disables all phys on that port.
* We have to re-enable the phys ourselves. */ * We have to re-enable the phys ourselves. */
asd_deform_port(asd_ha, phy); asd_deform_port(asd_ha, phy);
sas_ha->notify_port_event(sas_phy, PORTE_HARD_RESET); sas_notify_port_event(sas_phy, PORTE_HARD_RESET);
break; break;
default: default:
...@@ -567,7 +565,7 @@ static void escb_tasklet_complete(struct asd_ascb *ascb, ...@@ -567,7 +565,7 @@ static void escb_tasklet_complete(struct asd_ascb *ascb,
/* the device is gone */ /* the device is gone */
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
asd_deform_port(asd_ha, phy); asd_deform_port(asd_ha, phy);
sas_ha->notify_port_event(sas_phy, PORTE_TIMER_EVENT); sas_notify_port_event(sas_phy, PORTE_TIMER_EVENT);
break; break;
default: default:
ASD_DPRINTK("%s: phy%d: unknown event:0x%x\n", __func__, ASD_DPRINTK("%s: phy%d: unknown event:0x%x\n", __func__,
......
...@@ -616,7 +616,6 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no) ...@@ -616,7 +616,6 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no)
{ {
struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct sas_ha_struct *sas_ha;
if (!phy->phy_attached) if (!phy->phy_attached)
return; return;
...@@ -627,8 +626,7 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no) ...@@ -627,8 +626,7 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no)
return; return;
} }
sas_ha = &hisi_hba->sha; sas_notify_phy_event(sas_phy, PHYE_OOB_DONE);
sas_ha->notify_phy_event(sas_phy, PHYE_OOB_DONE);
if (sas_phy->phy) { if (sas_phy->phy) {
struct sas_phy *sphy = sas_phy->phy; struct sas_phy *sphy = sas_phy->phy;
...@@ -656,7 +654,7 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no) ...@@ -656,7 +654,7 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no)
} }
sas_phy->frame_rcvd_size = phy->frame_rcvd_size; sas_phy->frame_rcvd_size = phy->frame_rcvd_size;
sas_ha->notify_port_event(sas_phy, PORTE_BYTES_DMAED); sas_notify_port_event(sas_phy, PORTE_BYTES_DMAED);
} }
static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device)
...@@ -1411,7 +1409,6 @@ static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba) ...@@ -1411,7 +1409,6 @@ static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba)
static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state)
{ {
struct sas_ha_struct *sas_ha = &hisi_hba->sha;
struct asd_sas_port *_sas_port = NULL; struct asd_sas_port *_sas_port = NULL;
int phy_no; int phy_no;
...@@ -1432,7 +1429,7 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) ...@@ -1432,7 +1429,7 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state)
_sas_port = sas_port; _sas_port = sas_port;
if (dev_is_expander(dev->dev_type)) if (dev_is_expander(dev->dev_type))
sas_ha->notify_port_event(sas_phy, sas_notify_port_event(sas_phy,
PORTE_BROADCAST_RCVD); PORTE_BROADCAST_RCVD);
} }
} else { } else {
...@@ -2194,7 +2191,6 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy) ...@@ -2194,7 +2191,6 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy)
{ {
struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct sas_ha_struct *sas_ha = &hisi_hba->sha;
struct device *dev = hisi_hba->dev; struct device *dev = hisi_hba->dev;
if (rdy) { if (rdy) {
...@@ -2210,7 +2206,7 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy) ...@@ -2210,7 +2206,7 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy)
return; return;
} }
/* Phy down and not ready */ /* Phy down and not ready */
sas_ha->notify_phy_event(sas_phy, PHYE_LOSS_OF_SIGNAL); sas_notify_phy_event(sas_phy, PHYE_LOSS_OF_SIGNAL);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
if (port) { if (port) {
......
...@@ -1408,7 +1408,6 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p) ...@@ -1408,7 +1408,6 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p)
struct hisi_sas_phy *phy = p; struct hisi_sas_phy *phy = p;
struct hisi_hba *hisi_hba = phy->hisi_hba; struct hisi_hba *hisi_hba = phy->hisi_hba;
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct sas_ha_struct *sha = &hisi_hba->sha;
struct device *dev = hisi_hba->dev; struct device *dev = hisi_hba->dev;
int phy_no = sas_phy->id; int phy_no = sas_phy->id;
u32 irq_value; u32 irq_value;
...@@ -1424,7 +1423,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p) ...@@ -1424,7 +1423,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p)
} }
if (!test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) if (!test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags))
sha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
end: end:
hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT2, hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT2,
......
...@@ -2818,14 +2818,13 @@ static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba) ...@@ -2818,14 +2818,13 @@ static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba)
{ {
struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct sas_ha_struct *sas_ha = &hisi_hba->sha;
u32 bcast_status; u32 bcast_status;
hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1); hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1);
bcast_status = hisi_sas_phy_read32(hisi_hba, phy_no, RX_PRIMS_STATUS); bcast_status = hisi_sas_phy_read32(hisi_hba, phy_no, RX_PRIMS_STATUS);
if ((bcast_status & RX_BCAST_CHG_MSK) && if ((bcast_status & RX_BCAST_CHG_MSK) &&
!test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) !test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags))
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0, hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0,
CHL_INT0_SL_RX_BCST_ACK_MSK); CHL_INT0_SL_RX_BCST_ACK_MSK);
hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 0); hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 0);
......
...@@ -1595,14 +1595,13 @@ static irqreturn_t phy_bcast_v3_hw(int phy_no, struct hisi_hba *hisi_hba) ...@@ -1595,14 +1595,13 @@ static irqreturn_t phy_bcast_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
{ {
struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct sas_ha_struct *sas_ha = &hisi_hba->sha;
u32 bcast_status; u32 bcast_status;
hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1); hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1);
bcast_status = hisi_sas_phy_read32(hisi_hba, phy_no, RX_PRIMS_STATUS); bcast_status = hisi_sas_phy_read32(hisi_hba, phy_no, RX_PRIMS_STATUS);
if ((bcast_status & RX_BCAST_CHG_MSK) && if ((bcast_status & RX_BCAST_CHG_MSK) &&
!test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) !test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags))
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0, hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0,
CHL_INT0_SL_RX_BCST_ACK_MSK); CHL_INT0_SL_RX_BCST_ACK_MSK);
hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 0); hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 0);
......
...@@ -164,7 +164,7 @@ static void isci_port_bc_change_received(struct isci_host *ihost, ...@@ -164,7 +164,7 @@ static void isci_port_bc_change_received(struct isci_host *ihost,
"%s: isci_phy = %p, sas_phy = %p\n", "%s: isci_phy = %p, sas_phy = %p\n",
__func__, iphy, &iphy->sas_phy); __func__, iphy, &iphy->sas_phy);
ihost->sas_ha.notify_port_event(&iphy->sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(&iphy->sas_phy, PORTE_BROADCAST_RCVD);
sci_port_bcn_enable(iport); sci_port_bcn_enable(iport);
} }
...@@ -223,8 +223,7 @@ static void isci_port_link_up(struct isci_host *isci_host, ...@@ -223,8 +223,7 @@ static void isci_port_link_up(struct isci_host *isci_host,
/* Notify libsas that we have an address frame, if indeed /* Notify libsas that we have an address frame, if indeed
* we've found an SSP, SMP, or STP target */ * we've found an SSP, SMP, or STP target */
if (success) if (success)
isci_host->sas_ha.notify_port_event(&iphy->sas_phy, sas_notify_port_event(&iphy->sas_phy, PORTE_BYTES_DMAED);
PORTE_BYTES_DMAED);
} }
...@@ -270,7 +269,7 @@ static void isci_port_link_down(struct isci_host *isci_host, ...@@ -270,7 +269,7 @@ static void isci_port_link_down(struct isci_host *isci_host,
* isci_port_deformed and isci_dev_gone functions. * isci_port_deformed and isci_dev_gone functions.
*/ */
sas_phy_disconnected(&isci_phy->sas_phy); sas_phy_disconnected(&isci_phy->sas_phy);
isci_host->sas_ha.notify_phy_event(&isci_phy->sas_phy, sas_notify_phy_event(&isci_phy->sas_phy,
PHYE_LOSS_OF_SIGNAL); PHYE_LOSS_OF_SIGNAL);
dev_dbg(&isci_host->pdev->dev, dev_dbg(&isci_host->pdev->dev,
......
...@@ -109,7 +109,7 @@ void sas_enable_revalidation(struct sas_ha_struct *ha) ...@@ -109,7 +109,7 @@ void sas_enable_revalidation(struct sas_ha_struct *ha)
sas_phy = container_of(port->phy_list.next, struct asd_sas_phy, sas_phy = container_of(port->phy_list.next, struct asd_sas_phy,
port_phy_el); port_phy_el);
ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
} }
mutex_unlock(&ha->disco_mutex); mutex_unlock(&ha->disco_mutex);
} }
...@@ -131,7 +131,7 @@ static void sas_phy_event_worker(struct work_struct *work) ...@@ -131,7 +131,7 @@ static void sas_phy_event_worker(struct work_struct *work)
sas_free_event(ev); sas_free_event(ev);
} }
static int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event) int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event)
{ {
struct asd_sas_event *ev; struct asd_sas_event *ev;
struct sas_ha_struct *ha = phy->ha; struct sas_ha_struct *ha = phy->ha;
...@@ -151,6 +151,7 @@ static int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event) ...@@ -151,6 +151,7 @@ static int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(sas_notify_port_event);
int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event) int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event)
{ {
...@@ -172,11 +173,5 @@ int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event) ...@@ -172,11 +173,5 @@ int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(sas_notify_phy_event);
int sas_init_events(struct sas_ha_struct *sas_ha)
{
sas_ha->notify_port_event = sas_notify_port_event;
sas_ha->notify_phy_event = sas_notify_phy_event;
return 0;
}
...@@ -123,12 +123,6 @@ int sas_register_ha(struct sas_ha_struct *sas_ha) ...@@ -123,12 +123,6 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
goto Undo_phys; goto Undo_phys;
} }
error = sas_init_events(sas_ha);
if (error) {
pr_notice("couldn't start event thread:%d\n", error);
goto Undo_ports;
}
error = -ENOMEM; error = -ENOMEM;
snprintf(name, sizeof(name), "%s_event_q", dev_name(sas_ha->dev)); snprintf(name, sizeof(name), "%s_event_q", dev_name(sas_ha->dev));
sas_ha->event_q = create_singlethread_workqueue(name); sas_ha->event_q = create_singlethread_workqueue(name);
......
...@@ -54,7 +54,6 @@ void sas_free_event(struct asd_sas_event *event); ...@@ -54,7 +54,6 @@ void sas_free_event(struct asd_sas_event *event);
int sas_register_ports(struct sas_ha_struct *sas_ha); int sas_register_ports(struct sas_ha_struct *sas_ha);
void sas_unregister_ports(struct sas_ha_struct *sas_ha); void sas_unregister_ports(struct sas_ha_struct *sas_ha);
int sas_init_events(struct sas_ha_struct *sas_ha);
void sas_disable_revalidation(struct sas_ha_struct *ha); void sas_disable_revalidation(struct sas_ha_struct *ha);
void sas_enable_revalidation(struct sas_ha_struct *ha); void sas_enable_revalidation(struct sas_ha_struct *ha);
void __sas_drain_work(struct sas_ha_struct *ha); void __sas_drain_work(struct sas_ha_struct *ha);
......
...@@ -220,7 +220,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i) ...@@ -220,7 +220,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)
{ {
struct mvs_phy *phy = &mvi->phy[i]; struct mvs_phy *phy = &mvi->phy[i];
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct sas_ha_struct *sas_ha;
if (!phy->phy_attached) if (!phy->phy_attached)
return; return;
...@@ -229,8 +229,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i) ...@@ -229,8 +229,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)
return; return;
} }
sas_ha = mvi->sas; sas_notify_phy_event(sas_phy, PHYE_OOB_DONE);
sas_ha->notify_phy_event(sas_phy, PHYE_OOB_DONE);
if (sas_phy->phy) { if (sas_phy->phy) {
struct sas_phy *sphy = sas_phy->phy; struct sas_phy *sphy = sas_phy->phy;
...@@ -262,8 +261,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i) ...@@ -262,8 +261,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)
sas_phy->frame_rcvd_size = phy->frame_rcvd_size; sas_phy->frame_rcvd_size = phy->frame_rcvd_size;
mvi->sas->notify_port_event(sas_phy, sas_notify_port_event(sas_phy, PORTE_BYTES_DMAED);
PORTE_BYTES_DMAED);
} }
void mvs_scan_start(struct Scsi_Host *shost) void mvs_scan_start(struct Scsi_Host *shost)
...@@ -1880,7 +1878,6 @@ static void mvs_work_queue(struct work_struct *work) ...@@ -1880,7 +1878,6 @@ static void mvs_work_queue(struct work_struct *work)
struct mvs_info *mvi = mwq->mvi; struct mvs_info *mvi = mwq->mvi;
unsigned long flags; unsigned long flags;
u32 phy_no = (unsigned long) mwq->data; u32 phy_no = (unsigned long) mwq->data;
struct sas_ha_struct *sas_ha = mvi->sas;
struct mvs_phy *phy = &mvi->phy[phy_no]; struct mvs_phy *phy = &mvi->phy[phy_no];
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
...@@ -1895,7 +1892,7 @@ static void mvs_work_queue(struct work_struct *work) ...@@ -1895,7 +1892,7 @@ static void mvs_work_queue(struct work_struct *work)
if (!(tmp & PHY_READY_MASK)) { if (!(tmp & PHY_READY_MASK)) {
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
mvs_phy_disconnected(phy); mvs_phy_disconnected(phy);
sas_ha->notify_phy_event(sas_phy, sas_notify_phy_event(sas_phy,
PHYE_LOSS_OF_SIGNAL); PHYE_LOSS_OF_SIGNAL);
mv_dprintk("phy%d Removed Device\n", phy_no); mv_dprintk("phy%d Removed Device\n", phy_no);
} else { } else {
...@@ -1908,8 +1905,7 @@ static void mvs_work_queue(struct work_struct *work) ...@@ -1908,8 +1905,7 @@ static void mvs_work_queue(struct work_struct *work)
} }
} else if (mwq->handler & EXP_BRCT_CHG) { } else if (mwq->handler & EXP_BRCT_CHG) {
phy->phy_event &= ~EXP_BRCT_CHG; phy->phy_event &= ~EXP_BRCT_CHG;
sas_ha->notify_port_event(sas_phy, sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
PORTE_BROADCAST_RCVD);
mv_dprintk("phy%d Got Broadcast Change\n", phy_no); mv_dprintk("phy%d Got Broadcast Change\n", phy_no);
} }
list_del(&mwq->entry); list_del(&mwq->entry);
......
...@@ -3185,7 +3185,7 @@ void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i) ...@@ -3185,7 +3185,7 @@ void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i)
pm8001_dbg(pm8001_ha, MSG, "phy %d byte dmaded.\n", i); pm8001_dbg(pm8001_ha, MSG, "phy %d byte dmaded.\n", i);
sas_phy->frame_rcvd_size = phy->frame_rcvd_size; sas_phy->frame_rcvd_size = phy->frame_rcvd_size;
pm8001_ha->sas->notify_port_event(sas_phy, PORTE_BYTES_DMAED); sas_notify_port_event(sas_phy, PORTE_BYTES_DMAED);
} }
/* Get the link rate speed */ /* Get the link rate speed */
...@@ -3299,7 +3299,6 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3299,7 +3299,6 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate);
u8 portstate = (u8)(npip_portstate & 0x0000000F); u8 portstate = (u8)(npip_portstate & 0x0000000F);
struct pm8001_port *port = &pm8001_ha->port[port_id]; struct pm8001_port *port = &pm8001_ha->port[port_id];
struct sas_ha_struct *sas_ha = pm8001_ha->sas;
struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
unsigned long flags; unsigned long flags;
u8 deviceType = pPayload->sas_identify.dev_type; u8 deviceType = pPayload->sas_identify.dev_type;
...@@ -3343,7 +3342,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3343,7 +3342,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
else if (phy->identify.device_type != SAS_PHY_UNUSED) else if (phy->identify.device_type != SAS_PHY_UNUSED)
phy->identify.target_port_protocols = SAS_PROTOCOL_SMP; phy->identify.target_port_protocols = SAS_PROTOCOL_SMP;
phy->sas_phy.oob_mode = SAS_OOB_MODE; phy->sas_phy.oob_mode = SAS_OOB_MODE;
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE);
spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
memcpy(phy->frame_rcvd, &pPayload->sas_identify, memcpy(phy->frame_rcvd, &pPayload->sas_identify,
sizeof(struct sas_identify_frame)-4); sizeof(struct sas_identify_frame)-4);
...@@ -3375,7 +3374,6 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3375,7 +3374,6 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate);
u8 portstate = (u8)(npip_portstate & 0x0000000F); u8 portstate = (u8)(npip_portstate & 0x0000000F);
struct pm8001_port *port = &pm8001_ha->port[port_id]; struct pm8001_port *port = &pm8001_ha->port[port_id];
struct sas_ha_struct *sas_ha = pm8001_ha->sas;
struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
unsigned long flags; unsigned long flags;
pm8001_dbg(pm8001_ha, DEVIO, "HW_EVENT_SATA_PHY_UP port id = %d, phy id = %d\n", pm8001_dbg(pm8001_ha, DEVIO, "HW_EVENT_SATA_PHY_UP port id = %d, phy id = %d\n",
...@@ -3387,7 +3385,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3387,7 +3385,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
phy->phy_type |= PORT_TYPE_SATA; phy->phy_type |= PORT_TYPE_SATA;
phy->phy_attached = 1; phy->phy_attached = 1;
phy->sas_phy.oob_mode = SATA_OOB_MODE; phy->sas_phy.oob_mode = SATA_OOB_MODE;
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE);
spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4), memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4),
sizeof(struct dev_to_host_fis)); sizeof(struct dev_to_host_fis));
...@@ -3734,11 +3732,11 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3734,11 +3732,11 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
break; break;
case HW_EVENT_SATA_SPINUP_HOLD: case HW_EVENT_SATA_SPINUP_HOLD:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_SPINUP_HOLD\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_SPINUP_HOLD\n");
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD); sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD);
break; break;
case HW_EVENT_PHY_DOWN: case HW_EVENT_PHY_DOWN:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_DOWN\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_DOWN\n");
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL); sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL);
phy->phy_attached = 0; phy->phy_attached = 0;
phy->phy_state = 0; phy->phy_state = 0;
hw_event_phy_down(pm8001_ha, piomb); hw_event_phy_down(pm8001_ha, piomb);
...@@ -3747,7 +3745,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3747,7 +3745,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_INVALID\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_INVALID\n");
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
/* the broadcast change primitive received, tell the LIBSAS this event /* the broadcast change primitive received, tell the LIBSAS this event
to revalidate the sas domain*/ to revalidate the sas domain*/
...@@ -3758,20 +3756,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3758,20 +3756,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE; sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE;
spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
break; break;
case HW_EVENT_PHY_ERROR: case HW_EVENT_PHY_ERROR:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_ERROR\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_ERROR\n");
sas_phy_disconnected(&phy->sas_phy); sas_phy_disconnected(&phy->sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR);
break; break;
case HW_EVENT_BROADCAST_EXP: case HW_EVENT_BROADCAST_EXP:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_EXP\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_EXP\n");
spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP; sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP;
spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
break; break;
case HW_EVENT_LINK_ERR_INVALID_DWORD: case HW_EVENT_LINK_ERR_INVALID_DWORD:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
...@@ -3780,7 +3778,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3780,7 +3778,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
HW_EVENT_LINK_ERR_INVALID_DWORD, port_id, phy_id, 0, 0); HW_EVENT_LINK_ERR_INVALID_DWORD, port_id, phy_id, 0, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_LINK_ERR_DISPARITY_ERROR: case HW_EVENT_LINK_ERR_DISPARITY_ERROR:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
...@@ -3790,7 +3788,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3790,7 +3788,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_LINK_ERR_CODE_VIOLATION: case HW_EVENT_LINK_ERR_CODE_VIOLATION:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
...@@ -3800,7 +3798,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3800,7 +3798,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH: case HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
...@@ -3810,7 +3808,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3810,7 +3808,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_MALFUNCTION: case HW_EVENT_MALFUNCTION:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_MALFUNCTION\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_MALFUNCTION\n");
...@@ -3820,7 +3818,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3820,7 +3818,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
sas_phy->sas_prim = HW_EVENT_BROADCAST_SES; sas_phy->sas_prim = HW_EVENT_BROADCAST_SES;
spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
break; break;
case HW_EVENT_INBOUND_CRC_ERROR: case HW_EVENT_INBOUND_CRC_ERROR:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_INBOUND_CRC_ERROR\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_INBOUND_CRC_ERROR\n");
...@@ -3830,13 +3828,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3830,13 +3828,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
break; break;
case HW_EVENT_HARD_RESET_RECEIVED: case HW_EVENT_HARD_RESET_RECEIVED:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_HARD_RESET_RECEIVED\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_HARD_RESET_RECEIVED\n");
sas_ha->notify_port_event(sas_phy, PORTE_HARD_RESET); sas_notify_port_event(sas_phy, PORTE_HARD_RESET);
break; break;
case HW_EVENT_ID_FRAME_TIMEOUT: case HW_EVENT_ID_FRAME_TIMEOUT:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_ID_FRAME_TIMEOUT\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_ID_FRAME_TIMEOUT\n");
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_LINK_ERR_PHY_RESET_FAILED: case HW_EVENT_LINK_ERR_PHY_RESET_FAILED:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
...@@ -3846,20 +3844,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) ...@@ -3846,20 +3844,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_PORT_RESET_TIMER_TMO: case HW_EVENT_PORT_RESET_TIMER_TMO:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_TIMER_TMO\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_TIMER_TMO\n");
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_PORT_RECOVERY_TIMER_TMO: case HW_EVENT_PORT_RECOVERY_TIMER_TMO:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
"HW_EVENT_PORT_RECOVERY_TIMER_TMO\n"); "HW_EVENT_PORT_RECOVERY_TIMER_TMO\n");
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_PORT_RECOVER: case HW_EVENT_PORT_RECOVER:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RECOVER\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RECOVER\n");
......
...@@ -158,7 +158,6 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, ...@@ -158,7 +158,6 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
int rc = 0, phy_id = sas_phy->id; int rc = 0, phy_id = sas_phy->id;
struct pm8001_hba_info *pm8001_ha = NULL; struct pm8001_hba_info *pm8001_ha = NULL;
struct sas_phy_linkrates *rates; struct sas_phy_linkrates *rates;
struct sas_ha_struct *sas_ha;
struct pm8001_phy *phy; struct pm8001_phy *phy;
DECLARE_COMPLETION_ONSTACK(completion); DECLARE_COMPLETION_ONSTACK(completion);
unsigned long flags; unsigned long flags;
...@@ -207,18 +206,16 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, ...@@ -207,18 +206,16 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
if (pm8001_ha->chip_id != chip_8001) { if (pm8001_ha->chip_id != chip_8001) {
if (pm8001_ha->phy[phy_id].phy_state == if (pm8001_ha->phy[phy_id].phy_state ==
PHY_STATE_LINK_UP_SPCV) { PHY_STATE_LINK_UP_SPCV) {
sas_ha = pm8001_ha->sas;
sas_phy_disconnected(&phy->sas_phy); sas_phy_disconnected(&phy->sas_phy);
sas_ha->notify_phy_event(&phy->sas_phy, sas_notify_phy_event(&phy->sas_phy,
PHYE_LOSS_OF_SIGNAL); PHYE_LOSS_OF_SIGNAL);
phy->phy_attached = 0; phy->phy_attached = 0;
} }
} else { } else {
if (pm8001_ha->phy[phy_id].phy_state == if (pm8001_ha->phy[phy_id].phy_state ==
PHY_STATE_LINK_UP_SPC) { PHY_STATE_LINK_UP_SPC) {
sas_ha = pm8001_ha->sas;
sas_phy_disconnected(&phy->sas_phy); sas_phy_disconnected(&phy->sas_phy);
sas_ha->notify_phy_event(&phy->sas_phy, sas_notify_phy_event(&phy->sas_phy,
PHYE_LOSS_OF_SIGNAL); PHYE_LOSS_OF_SIGNAL);
phy->phy_attached = 0; phy->phy_attached = 0;
} }
......
...@@ -3294,7 +3294,6 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3294,7 +3294,6 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
u8 portstate = (u8)(phyid_npip_portstate & 0x0000000F); u8 portstate = (u8)(phyid_npip_portstate & 0x0000000F);
struct pm8001_port *port = &pm8001_ha->port[port_id]; struct pm8001_port *port = &pm8001_ha->port[port_id];
struct sas_ha_struct *sas_ha = pm8001_ha->sas;
struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
unsigned long flags; unsigned long flags;
u8 deviceType = pPayload->sas_identify.dev_type; u8 deviceType = pPayload->sas_identify.dev_type;
...@@ -3339,7 +3338,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3339,7 +3338,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
else if (phy->identify.device_type != SAS_PHY_UNUSED) else if (phy->identify.device_type != SAS_PHY_UNUSED)
phy->identify.target_port_protocols = SAS_PROTOCOL_SMP; phy->identify.target_port_protocols = SAS_PROTOCOL_SMP;
phy->sas_phy.oob_mode = SAS_OOB_MODE; phy->sas_phy.oob_mode = SAS_OOB_MODE;
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE);
spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
memcpy(phy->frame_rcvd, &pPayload->sas_identify, memcpy(phy->frame_rcvd, &pPayload->sas_identify,
sizeof(struct sas_identify_frame)-4); sizeof(struct sas_identify_frame)-4);
...@@ -3373,7 +3372,6 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3373,7 +3372,6 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
u8 portstate = (u8)(phyid_npip_portstate & 0x0000000F); u8 portstate = (u8)(phyid_npip_portstate & 0x0000000F);
struct pm8001_port *port = &pm8001_ha->port[port_id]; struct pm8001_port *port = &pm8001_ha->port[port_id];
struct sas_ha_struct *sas_ha = pm8001_ha->sas;
struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
unsigned long flags; unsigned long flags;
pm8001_dbg(pm8001_ha, DEVIO, pm8001_dbg(pm8001_ha, DEVIO,
...@@ -3387,7 +3385,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3387,7 +3385,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
phy->phy_type |= PORT_TYPE_SATA; phy->phy_type |= PORT_TYPE_SATA;
phy->phy_attached = 1; phy->phy_attached = 1;
phy->sas_phy.oob_mode = SATA_OOB_MODE; phy->sas_phy.oob_mode = SATA_OOB_MODE;
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE);
spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4), memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4),
sizeof(struct dev_to_host_fis)); sizeof(struct dev_to_host_fis));
...@@ -3469,11 +3467,8 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3469,11 +3467,8 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
break; break;
} }
if (port_sata && (portstate != PORT_IN_RESET)) { if (port_sata && (portstate != PORT_IN_RESET))
struct sas_ha_struct *sas_ha = pm8001_ha->sas; sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL);
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL);
}
} }
static int mpi_phy_start_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) static int mpi_phy_start_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
...@@ -3571,7 +3566,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3571,7 +3566,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
break; break;
case HW_EVENT_SATA_SPINUP_HOLD: case HW_EVENT_SATA_SPINUP_HOLD:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_SPINUP_HOLD\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_SPINUP_HOLD\n");
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD); sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD);
break; break;
case HW_EVENT_PHY_DOWN: case HW_EVENT_PHY_DOWN:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_DOWN\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_DOWN\n");
...@@ -3587,7 +3582,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3587,7 +3582,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_INVALID\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_INVALID\n");
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
/* the broadcast change primitive received, tell the LIBSAS this event /* the broadcast change primitive received, tell the LIBSAS this event
to revalidate the sas domain*/ to revalidate the sas domain*/
...@@ -3598,20 +3593,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3598,20 +3593,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE; sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE;
spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
break; break;
case HW_EVENT_PHY_ERROR: case HW_EVENT_PHY_ERROR:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_ERROR\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_ERROR\n");
sas_phy_disconnected(&phy->sas_phy); sas_phy_disconnected(&phy->sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR);
break; break;
case HW_EVENT_BROADCAST_EXP: case HW_EVENT_BROADCAST_EXP:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_EXP\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_EXP\n");
spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP; sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP;
spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
break; break;
case HW_EVENT_LINK_ERR_INVALID_DWORD: case HW_EVENT_LINK_ERR_INVALID_DWORD:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
...@@ -3648,7 +3643,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3648,7 +3643,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
sas_phy->sas_prim = HW_EVENT_BROADCAST_SES; sas_phy->sas_prim = HW_EVENT_BROADCAST_SES;
spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
break; break;
case HW_EVENT_INBOUND_CRC_ERROR: case HW_EVENT_INBOUND_CRC_ERROR:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_INBOUND_CRC_ERROR\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_INBOUND_CRC_ERROR\n");
...@@ -3658,13 +3653,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3658,13 +3653,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
break; break;
case HW_EVENT_HARD_RESET_RECEIVED: case HW_EVENT_HARD_RESET_RECEIVED:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_HARD_RESET_RECEIVED\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_HARD_RESET_RECEIVED\n");
sas_ha->notify_port_event(sas_phy, PORTE_HARD_RESET); sas_notify_port_event(sas_phy, PORTE_HARD_RESET);
break; break;
case HW_EVENT_ID_FRAME_TIMEOUT: case HW_EVENT_ID_FRAME_TIMEOUT:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_ID_FRAME_TIMEOUT\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_ID_FRAME_TIMEOUT\n");
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_LINK_ERR_PHY_RESET_FAILED: case HW_EVENT_LINK_ERR_PHY_RESET_FAILED:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, MSG,
...@@ -3674,7 +3669,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3674,7 +3669,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
break; break;
case HW_EVENT_PORT_RESET_TIMER_TMO: case HW_EVENT_PORT_RESET_TIMER_TMO:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_TIMER_TMO\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_TIMER_TMO\n");
...@@ -3682,7 +3677,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3682,7 +3677,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
if (pm8001_ha->phy[phy_id].reset_completion) { if (pm8001_ha->phy[phy_id].reset_completion) {
pm8001_ha->phy[phy_id].port_reset_status = pm8001_ha->phy[phy_id].port_reset_status =
PORT_RESET_TMO; PORT_RESET_TMO;
...@@ -3699,7 +3694,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3699,7 +3694,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
for (i = 0; i < pm8001_ha->chip->n_phy; i++) { for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
if (port->wide_port_phymap & (1 << i)) { if (port->wide_port_phymap & (1 << i)) {
phy = &pm8001_ha->phy[i]; phy = &pm8001_ha->phy[i];
sas_ha->notify_phy_event(&phy->sas_phy, sas_notify_phy_event(&phy->sas_phy,
PHYE_LOSS_OF_SIGNAL); PHYE_LOSS_OF_SIGNAL);
port->wide_port_phymap &= ~(1 << i); port->wide_port_phymap &= ~(1 << i);
} }
......
...@@ -391,10 +391,6 @@ struct sas_ha_struct { ...@@ -391,10 +391,6 @@ struct sas_ha_struct {
int strict_wide_ports; /* both sas_addr and attached_sas_addr must match int strict_wide_ports; /* both sas_addr and attached_sas_addr must match
* their siblings when forming wide ports */ * their siblings when forming wide ports */
/* LLDD calls these to notify the class of an event. */
int (*notify_port_event)(struct asd_sas_phy *, enum port_event);
int (*notify_phy_event)(struct asd_sas_phy *, enum phy_event);
void *lldd_ha; /* not touched by sas class code */ void *lldd_ha; /* not touched by sas class code */
struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */ struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */
...@@ -706,4 +702,7 @@ struct sas_phy *sas_get_local_phy(struct domain_device *dev); ...@@ -706,4 +702,7 @@ struct sas_phy *sas_get_local_phy(struct domain_device *dev);
int sas_request_addr(struct Scsi_Host *shost, u8 *addr); int sas_request_addr(struct Scsi_Host *shost, u8 *addr);
int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event);
int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event);
#endif /* _SASLIB_H_ */ #endif /* _SASLIB_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment