| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Aic94xx SAS/SATA driver SCB management. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2005 Adaptec, Inc. All rights reserved. |
|---|
| 5 | 6 | * 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 | | - * |
|---|
| 25 | 7 | */ |
|---|
| 26 | 8 | |
|---|
| 27 | 9 | #include <linux/gfp.h> |
|---|
| .. | .. |
|---|
| 86 | 68 | struct done_list_struct *dl) |
|---|
| 87 | 69 | { |
|---|
| 88 | 70 | struct asd_ha_struct *asd_ha = ascb->ha; |
|---|
| 89 | | - struct sas_ha_struct *sas_ha = &asd_ha->sas_ha; |
|---|
| 90 | 71 | int phy_id = dl->status_block[0] & DL_PHY_MASK; |
|---|
| 91 | 72 | struct asd_phy *phy = &asd_ha->phys[phy_id]; |
|---|
| 92 | 73 | |
|---|
| .. | .. |
|---|
| 99 | 80 | ASD_DPRINTK("phy%d: device unplugged\n", phy_id); |
|---|
| 100 | 81 | asd_turn_led(asd_ha, phy_id, 0); |
|---|
| 101 | 82 | 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); |
|---|
| 103 | 84 | break; |
|---|
| 104 | 85 | case CURRENT_OOB_DONE: |
|---|
| 105 | 86 | /* hot plugged device */ |
|---|
| .. | .. |
|---|
| 107 | 88 | get_lrate_mode(phy, oob_mode); |
|---|
| 108 | 89 | ASD_DPRINTK("phy%d device plugged: lrate:0x%x, proto:0x%x\n", |
|---|
| 109 | 90 | 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); |
|---|
| 111 | 92 | break; |
|---|
| 112 | 93 | case CURRENT_SPINUP_HOLD: |
|---|
| 113 | 94 | /* hot plug SATA, no COMWAKE sent */ |
|---|
| 114 | 95 | 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); |
|---|
| 116 | 97 | break; |
|---|
| 117 | 98 | case CURRENT_GTO_TIMEOUT: |
|---|
| 118 | 99 | case CURRENT_OOB_ERROR: |
|---|
| .. | .. |
|---|
| 120 | 101 | dl->status_block[1]); |
|---|
| 121 | 102 | asd_turn_led(asd_ha, phy_id, 0); |
|---|
| 122 | 103 | 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); |
|---|
| 124 | 105 | break; |
|---|
| 125 | 106 | } |
|---|
| 126 | 107 | } |
|---|
| .. | .. |
|---|
| 141 | 122 | |
|---|
| 142 | 123 | /** |
|---|
| 143 | 124 | * 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 |
|---|
| 146 | 127 | * |
|---|
| 147 | 128 | * This function extracts the SAS address from an IDENTIFY frame |
|---|
| 148 | 129 | * received. If OOB is SATA, then a SAS address is generated from the |
|---|
| .. | .. |
|---|
| 240 | 221 | int edb_el = edb_id + ascb->edb_index; |
|---|
| 241 | 222 | struct asd_dma_tok *edb = ascb->ha->seq.edb_arr[edb_el]; |
|---|
| 242 | 223 | struct asd_phy *phy = &ascb->ha->phys[phy_id]; |
|---|
| 243 | | - struct sas_ha_struct *sas_ha = phy->sas_phy.ha; |
|---|
| 244 | 224 | u16 size = ((dl->status_block[3] & 7) << 8) | dl->status_block[2]; |
|---|
| 245 | 225 | |
|---|
| 246 | 226 | size = min(size, (u16) sizeof(phy->frame_rcvd)); |
|---|
| .. | .. |
|---|
| 252 | 232 | spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); |
|---|
| 253 | 233 | asd_dump_frame_rcvd(phy, dl); |
|---|
| 254 | 234 | 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); |
|---|
| 256 | 236 | } |
|---|
| 257 | 237 | |
|---|
| 258 | 238 | static void asd_link_reset_err_tasklet(struct asd_ascb *ascb, |
|---|
| .. | .. |
|---|
| 288 | 268 | asd_turn_led(asd_ha, phy_id, 0); |
|---|
| 289 | 269 | sas_phy_disconnected(sas_phy); |
|---|
| 290 | 270 | 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); |
|---|
| 292 | 272 | |
|---|
| 293 | 273 | if (retries_left == 0) { |
|---|
| 294 | 274 | int num = 1; |
|---|
| .. | .. |
|---|
| 333 | 313 | spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); |
|---|
| 334 | 314 | sas_phy->sas_prim = ffs(cont); |
|---|
| 335 | 315 | 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); |
|---|
| 337 | 317 | break; |
|---|
| 338 | 318 | |
|---|
| 339 | 319 | case LmUNKNOWNP: |
|---|
| .. | .. |
|---|
| 354 | 334 | /* The sequencer disables all phys on that port. |
|---|
| 355 | 335 | * We have to re-enable the phys ourselves. */ |
|---|
| 356 | 336 | 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); |
|---|
| 358 | 338 | break; |
|---|
| 359 | 339 | |
|---|
| 360 | 340 | default: |
|---|
| .. | .. |
|---|
| 585 | 565 | /* the device is gone */ |
|---|
| 586 | 566 | sas_phy_disconnected(sas_phy); |
|---|
| 587 | 567 | 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); |
|---|
| 589 | 569 | break; |
|---|
| 590 | 570 | default: |
|---|
| 591 | 571 | ASD_DPRINTK("%s: phy%d: unknown event:0x%x\n", __func__, |
|---|
| .. | .. |
|---|
| 724 | 704 | switch (pd->max_sas_lrate) { |
|---|
| 725 | 705 | case SAS_LINK_RATE_6_0_GBPS: |
|---|
| 726 | 706 | *speed_mask &= ~SAS_SPEED_60_DIS; |
|---|
| 707 | + fallthrough; |
|---|
| 727 | 708 | default: |
|---|
| 728 | 709 | case SAS_LINK_RATE_3_0_GBPS: |
|---|
| 729 | 710 | *speed_mask &= ~SAS_SPEED_30_DIS; |
|---|
| 711 | + fallthrough; |
|---|
| 730 | 712 | case SAS_LINK_RATE_1_5_GBPS: |
|---|
| 731 | 713 | *speed_mask &= ~SAS_SPEED_15_DIS; |
|---|
| 732 | 714 | } |
|---|
| .. | .. |
|---|
| 734 | 716 | switch (pd->min_sas_lrate) { |
|---|
| 735 | 717 | case SAS_LINK_RATE_6_0_GBPS: |
|---|
| 736 | 718 | *speed_mask |= SAS_SPEED_30_DIS; |
|---|
| 719 | + fallthrough; |
|---|
| 737 | 720 | case SAS_LINK_RATE_3_0_GBPS: |
|---|
| 738 | 721 | *speed_mask |= SAS_SPEED_15_DIS; |
|---|
| 739 | 722 | default: |
|---|
| .. | .. |
|---|
| 745 | 728 | switch (pd->max_sata_lrate) { |
|---|
| 746 | 729 | case SAS_LINK_RATE_3_0_GBPS: |
|---|
| 747 | 730 | *speed_mask &= ~SATA_SPEED_30_DIS; |
|---|
| 731 | + fallthrough; |
|---|
| 748 | 732 | default: |
|---|
| 749 | 733 | case SAS_LINK_RATE_1_5_GBPS: |
|---|
| 750 | 734 | *speed_mask &= ~SATA_SPEED_15_DIS; |
|---|
| .. | .. |
|---|
| 803 | 787 | |
|---|
| 804 | 788 | /* link reset retries, this should be nominal */ |
|---|
| 805 | 789 | control_phy->link_reset_retries = 10; |
|---|
| 790 | + fallthrough; |
|---|
| 806 | 791 | |
|---|
| 807 | 792 | case RELEASE_SPINUP_HOLD: /* 0x02 */ |
|---|
| 808 | 793 | /* decide the func_mask */ |
|---|
| .. | .. |
|---|
| 860 | 845 | |
|---|
| 861 | 846 | /** |
|---|
| 862 | 847 | * 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 |
|---|
| 864 | 849 | * |
|---|
| 865 | 850 | * This is the default timeout function which does the most necessary. |
|---|
| 866 | 851 | * Upper layers can implement their own timeout function, say to free |
|---|