Lines Matching defs:phy
36 static void get_lrate_mode(struct asd_phy *phy, u8 oob_mode)
38 struct sas_phy *sas_phy = phy->sas_phy.phy;
43 phy->sas_phy.linkrate = SAS_LINK_RATE_6_0_GBPS;
44 phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_6_0_GBPS;
47 phy->sas_phy.linkrate = SAS_LINK_RATE_3_0_GBPS;
48 phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_3_0_GBPS;
51 phy->sas_phy.linkrate = SAS_LINK_RATE_1_5_GBPS;
52 phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_1_5_GBPS;
55 sas_phy->negotiated_linkrate = phy->sas_phy.linkrate;
58 sas_phy->maximum_linkrate = phy->phy_desc->max_sas_lrate;
59 sas_phy->minimum_linkrate = phy->phy_desc->min_sas_lrate;
62 phy->sas_phy.oob_mode = SAS_OOB_MODE;
64 phy->sas_phy.oob_mode = SATA_OOB_MODE;
72 struct asd_phy *phy = &asd_ha->phys[phy_id];
80 ASD_DPRINTK("phy%d: device unplugged\n", phy_id);
82 sas_phy_disconnected(&phy->sas_phy);
83 sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL,
89 get_lrate_mode(phy, oob_mode);
90 ASD_DPRINTK("phy%d device plugged: lrate:0x%x, proto:0x%x\n",
91 phy_id, phy->sas_phy.linkrate, phy->sas_phy.iproto);
92 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
97 sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD,
102 ASD_DPRINTK("phy%d error while OOB: oob status:0x%x\n", phy_id,
105 sas_phy_disconnected(&phy->sas_phy);
106 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC);
112 static unsigned ord_phy(struct asd_ha_struct *asd_ha, struct asd_phy *phy)
118 if (&asd_ha->phys[i] == phy)
127 * @phy: pointer to asd_phy
137 static void asd_get_attached_sas_addr(struct asd_phy *phy, u8 *sas_addr)
139 if (phy->sas_phy.frame_rcvd[0] == 0x34
140 && phy->sas_phy.oob_mode == SATA_OOB_MODE) {
141 struct asd_ha_struct *asd_ha = phy->sas_phy.ha->lldd_ha;
143 u64 addr = be64_to_cpu(*(__be64 *)phy->phy_desc->sas_addr);
145 addr += asd_ha->hw_prof.sata_name_base + ord_phy(asd_ha, phy);
149 (void *) phy->sas_phy.frame_rcvd;
154 static void asd_form_port(struct asd_ha_struct *asd_ha, struct asd_phy *phy)
159 struct asd_sas_phy *sas_phy = &phy->sas_phy;
163 if (!phy->asd_port) {
195 phy->asd_port = port;
197 ASD_DPRINTK("%s: updating phy_mask 0x%x for phy%d\n",
198 __func__, phy->asd_port->phy_mask, sas_phy->id);
199 asd_update_port_links(asd_ha, phy);
203 static void asd_deform_port(struct asd_ha_struct *asd_ha, struct asd_phy *phy)
205 struct asd_port *port = phy->asd_port;
206 struct asd_sas_phy *sas_phy = &phy->sas_phy;
213 phy->asd_port = NULL;
225 struct asd_phy *phy = &ascb->ha->phys[phy_id];
228 size = min(size, (u16) sizeof(phy->frame_rcvd));
230 spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
231 memcpy(phy->sas_phy.frame_rcvd, edb->vaddr, size);
232 phy->sas_phy.frame_rcvd_size = size;
233 asd_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr);
234 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags);
235 asd_dump_frame_rcvd(phy, dl);
236 asd_form_port(ascb->ha, phy);
237 sas_notify_port_event(&phy->sas_phy, PORTE_BYTES_DMAED, GFP_ATOMIC);
247 struct asd_phy *phy = &asd_ha->phys[phy_id];
253 ASD_DPRINTK("phy%d: Receive ID timer expired\n", phy_id);
256 ASD_DPRINTK("phy%d: Loss of signal\n", phy_id);
259 ASD_DPRINTK("phy%d: Loss of dword sync\n", phy_id);
262 ASD_DPRINTK("phy%d: Receive FIS timeout\n", phy_id);
265 ASD_DPRINTK("phy%d: unknown link reset error code: 0x%x\n",
272 asd_deform_port(asd_ha, phy);
283 ASD_DPRINTK("phy%d: retries:0 performing link reset seq\n",
301 struct asd_phy *phy = &asd_ha->phys[phy_id];
313 ASD_DPRINTK("phy%d: BROADCAST change received:%d\n",
323 ASD_DPRINTK("phy%d: unknown BREAK\n", phy_id);
327 ASD_DPRINTK("phy%d: primitive reg:0x%x, cont:0x%04x\n",
335 ASD_DPRINTK("phy%d: HARD_RESET primitive rcvd\n",
339 asd_deform_port(asd_ha, phy);
345 ASD_DPRINTK("phy%d: primitive reg:0x%x, cont:0x%04x\n",
408 struct asd_phy *phy = &asd_ha->phys[phy_id];
548 ASD_DPRINTK("%s: phy%d: BYTES_DMAED\n", __func__, phy_id);
552 ASD_DPRINTK("%s: phy%d: PRIMITIVE_RECVD\n", __func__,
557 ASD_DPRINTK("%s: phy%d: PHY_EVENT\n", __func__, phy_id);
561 ASD_DPRINTK("%s: phy%d: LINK_RESET_ERROR\n", __func__,
566 ASD_DPRINTK("%s: phy%d: TIMER_EVENT, lost dw sync\n",
571 asd_deform_port(asd_ha, phy);
575 ASD_DPRINTK("%s: phy%d: unknown event:0x%x\n", __func__,
633 struct asd_phy *phy = &ascb->ha->phys[phy_id];
641 ASD_DPRINTK("%s: phy%d status block opcode:0x%x\n",
651 ASD_DPRINTK("%s: disable phy%d\n", __func__, phy_id);
658 get_lrate_mode(phy, oob_mode);
660 ASD_DPRINTK("%s: phy%d, lrate:0x%x, proto:0x%x\n",
661 __func__, phy_id,phy->sas_phy.linkrate,
662 phy->sas_phy.iproto);
666 ASD_DPRINTK("%s: phy%d, spinup hold\n", __func__,
670 ASD_DPRINTK("%s: phy%d: error: oob status:0x%02x\n",
676 ASD_DPRINTK("%s: phy%d: hot plug or device present\n",
681 ASD_DPRINTK("%s: phy%d: no device present: "
689 ASD_DPRINTK("%s: phy%d: sub_func:0x%x\n", __func__,
694 ASD_DPRINTK("%s: phy%d: sub_func:0x%x?\n", __func__,
756 * @phy_id: phy id to control, integer
757 * @subfunc: subfunction, what to actually to do the phy
768 struct asd_phy *phy = &ascb->ha->phys[phy_id];
783 set_speed_mask(&control_phy->speed_mask, phy->phy_desc);
786 if (phy->sas_phy.role == PHY_ROLE_INITIATOR)
788 else if (phy->sas_phy.role == PHY_ROLE_TARGET)
801 if (phy->phy_desc->flags & ASD_SATA_SPINUP_HOLD)
824 asd_printk("phy%d: link adm task 0x%x completed with error "
827 ASD_DPRINTK("phy%d: link adm task 0x%x: 0x%x\n",
890 int asd_control_phy(struct asd_sas_phy *phy, enum phy_func func, void *arg)
892 struct asd_ha_struct *asd_ha = phy->ha->lldd_ha;
893 struct asd_phy_desc *pd = asd_ha->phys[phy->id].phy_desc;
922 asd_build_control_phy(ascb, phy->id, phy_func_table[func]);