forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/scsi/aic94xx/aic94xx_scb.c
....@@ -1,27 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Aic94xx SAS/SATA driver SCB management.
34 *
45 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
56 * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
6
- *
7
- * This file is licensed under GPLv2.
8
- *
9
- * This file is part of the aic94xx driver.
10
- *
11
- * The aic94xx driver is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU General Public License as
13
- * published by the Free Software Foundation; version 2 of the
14
- * License.
15
- *
16
- * The aic94xx driver is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
- * General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with the aic94xx driver; if not, write to the Free Software
23
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
- *
257 */
268
279 #include <linux/gfp.h>
....@@ -86,7 +68,6 @@
8668 struct done_list_struct *dl)
8769 {
8870 struct asd_ha_struct *asd_ha = ascb->ha;
89
- struct sas_ha_struct *sas_ha = &asd_ha->sas_ha;
9071 int phy_id = dl->status_block[0] & DL_PHY_MASK;
9172 struct asd_phy *phy = &asd_ha->phys[phy_id];
9273
....@@ -99,7 +80,7 @@
9980 ASD_DPRINTK("phy%d: device unplugged\n", phy_id);
10081 asd_turn_led(asd_ha, phy_id, 0);
10182 sas_phy_disconnected(&phy->sas_phy);
102
- sas_ha->notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL);
83
+ sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL);
10384 break;
10485 case CURRENT_OOB_DONE:
10586 /* hot plugged device */
....@@ -107,12 +88,12 @@
10788 get_lrate_mode(phy, oob_mode);
10889 ASD_DPRINTK("phy%d device plugged: lrate:0x%x, proto:0x%x\n",
10990 phy_id, phy->sas_phy.linkrate, phy->sas_phy.iproto);
110
- sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE);
91
+ sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE);
11192 break;
11293 case CURRENT_SPINUP_HOLD:
11394 /* hot plug SATA, no COMWAKE sent */
11495 asd_turn_led(asd_ha, phy_id, 1);
115
- sas_ha->notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD);
96
+ sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD);
11697 break;
11798 case CURRENT_GTO_TIMEOUT:
11899 case CURRENT_OOB_ERROR:
....@@ -120,7 +101,7 @@
120101 dl->status_block[1]);
121102 asd_turn_led(asd_ha, phy_id, 0);
122103 sas_phy_disconnected(&phy->sas_phy);
123
- sas_ha->notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR);
104
+ sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR);
124105 break;
125106 }
126107 }
....@@ -141,8 +122,8 @@
141122
142123 /**
143124 * asd_get_attached_sas_addr -- extract/generate attached SAS address
144
- * phy: pointer to asd_phy
145
- * sas_addr: pointer to buffer where the SAS address is to be written
125
+ * @phy: pointer to asd_phy
126
+ * @sas_addr: pointer to buffer where the SAS address is to be written
146127 *
147128 * This function extracts the SAS address from an IDENTIFY frame
148129 * received. If OOB is SATA, then a SAS address is generated from the
....@@ -240,7 +221,6 @@
240221 int edb_el = edb_id + ascb->edb_index;
241222 struct asd_dma_tok *edb = ascb->ha->seq.edb_arr[edb_el];
242223 struct asd_phy *phy = &ascb->ha->phys[phy_id];
243
- struct sas_ha_struct *sas_ha = phy->sas_phy.ha;
244224 u16 size = ((dl->status_block[3] & 7) << 8) | dl->status_block[2];
245225
246226 size = min(size, (u16) sizeof(phy->frame_rcvd));
....@@ -252,7 +232,7 @@
252232 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags);
253233 asd_dump_frame_rcvd(phy, dl);
254234 asd_form_port(ascb->ha, phy);
255
- sas_ha->notify_port_event(&phy->sas_phy, PORTE_BYTES_DMAED);
235
+ sas_notify_port_event(&phy->sas_phy, PORTE_BYTES_DMAED);
256236 }
257237
258238 static void asd_link_reset_err_tasklet(struct asd_ascb *ascb,
....@@ -288,7 +268,7 @@
288268 asd_turn_led(asd_ha, phy_id, 0);
289269 sas_phy_disconnected(sas_phy);
290270 asd_deform_port(asd_ha, phy);
291
- sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
271
+ sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
292272
293273 if (retries_left == 0) {
294274 int num = 1;
....@@ -333,7 +313,7 @@
333313 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
334314 sas_phy->sas_prim = ffs(cont);
335315 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
336
- sas_ha->notify_port_event(sas_phy,PORTE_BROADCAST_RCVD);
316
+ sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
337317 break;
338318
339319 case LmUNKNOWNP:
....@@ -354,7 +334,7 @@
354334 /* The sequencer disables all phys on that port.
355335 * We have to re-enable the phys ourselves. */
356336 asd_deform_port(asd_ha, phy);
357
- sas_ha->notify_port_event(sas_phy, PORTE_HARD_RESET);
337
+ sas_notify_port_event(sas_phy, PORTE_HARD_RESET);
358338 break;
359339
360340 default:
....@@ -585,7 +565,7 @@
585565 /* the device is gone */
586566 sas_phy_disconnected(sas_phy);
587567 asd_deform_port(asd_ha, phy);
588
- sas_ha->notify_port_event(sas_phy, PORTE_TIMER_EVENT);
568
+ sas_notify_port_event(sas_phy, PORTE_TIMER_EVENT);
589569 break;
590570 default:
591571 ASD_DPRINTK("%s: phy%d: unknown event:0x%x\n", __func__,
....@@ -724,9 +704,11 @@
724704 switch (pd->max_sas_lrate) {
725705 case SAS_LINK_RATE_6_0_GBPS:
726706 *speed_mask &= ~SAS_SPEED_60_DIS;
707
+ fallthrough;
727708 default:
728709 case SAS_LINK_RATE_3_0_GBPS:
729710 *speed_mask &= ~SAS_SPEED_30_DIS;
711
+ fallthrough;
730712 case SAS_LINK_RATE_1_5_GBPS:
731713 *speed_mask &= ~SAS_SPEED_15_DIS;
732714 }
....@@ -734,6 +716,7 @@
734716 switch (pd->min_sas_lrate) {
735717 case SAS_LINK_RATE_6_0_GBPS:
736718 *speed_mask |= SAS_SPEED_30_DIS;
719
+ fallthrough;
737720 case SAS_LINK_RATE_3_0_GBPS:
738721 *speed_mask |= SAS_SPEED_15_DIS;
739722 default:
....@@ -745,6 +728,7 @@
745728 switch (pd->max_sata_lrate) {
746729 case SAS_LINK_RATE_3_0_GBPS:
747730 *speed_mask &= ~SATA_SPEED_30_DIS;
731
+ fallthrough;
748732 default:
749733 case SAS_LINK_RATE_1_5_GBPS:
750734 *speed_mask &= ~SATA_SPEED_15_DIS;
....@@ -803,6 +787,7 @@
803787
804788 /* link reset retries, this should be nominal */
805789 control_phy->link_reset_retries = 10;
790
+ fallthrough;
806791
807792 case RELEASE_SPINUP_HOLD: /* 0x02 */
808793 /* decide the func_mask */
....@@ -860,7 +845,7 @@
860845
861846 /**
862847 * asd_ascb_timedout -- called when a pending SCB's timer has expired
863
- * @data: unsigned long, a pointer to the ascb in question
848
+ * @t: Timer context used to fetch the SCB
864849 *
865850 * This is the default timeout function which does the most necessary.
866851 * Upper layers can implement their own timeout function, say to free