Lines Matching +defs:phy +defs:handle

238  * __mpi3mr_expander_find_by_handle - expander search by handle
240 * @handle: Firmware device handle of the expander
244 * This searches for expander device based on handle, then
250 *mrioc, u16 handle)
256 if (sas_expander->handle != handle)
281 * mpi3mr_get_sas_address - retrieve sas_address for handle
283 * @handle: Firmware device handle
287 * handle and gets the SAS address and return it back
291 static int mpi3mr_get_sas_address(struct mpi3mr_ioc *mrioc, u16 handle,
302 handle))) {
308 ioc_err(mrioc, "device page read failed for handle(0x%04x), with ioc_status(0x%04x) failure at %s:%d/%s()!\n",
309 handle, ioc_status, __FILE__, __LINE__, __func__);
513 * mpi3mr_parent_present - Is parent present for a phy
515 * @phy: SAS transport layer phy object
519 static int mpi3mr_parent_present(struct mpi3mr_ioc *mrioc, struct sas_phy *phy)
522 struct mpi3mr_hba_port *hba_port = phy->hostdata;
526 phy->identify.sas_address,
586 * mpi3mr_delete_sas_phy - Remove a single phy from port
599 dev_info(&mr_sas_phy->phy->dev,
600 "remove: sas_address(0x%016llx), phy(%d)\n",
608 sas_port_delete_phy(mr_sas_port->port, mr_sas_phy->phy);
613 * mpi3mr_add_sas_phy - Adding a single phy to a port
626 dev_info(&mr_sas_phy->phy->dev,
627 "add: sas_address(0x%016llx), phy(%d)\n", (unsigned long long)
635 sas_port_add_phy(mr_sas_port->port, mr_sas_phy->phy);
640 * mpi3mr_add_phy_to_an_existing_port - add phy to existing port
644 * @sas_address: SAS address of device/expander were phy needs
709 * mpi3mr_del_phy_from_an_existing_port - del phy from a port
762 if ((mr_sas_node->phy[i].remote_identify.sas_address !=
763 sas_address) || (mr_sas_node->phy[i].hba_port != hba_port))
765 if (mr_sas_node->phy[i].phy_belongs_to_port == 1)
767 mr_sas_node, &mr_sas_node->phy[i]);
774 * @handle: Firmware device handle
781 static int mpi3mr_set_identify(struct mpi3mr_ioc *mrioc, u16 handle,
796 sizeof(device_pg0), MPI3_DEVICE_PGAD_FORM_HANDLE, handle))) {
802 ioc_err(mrioc, "device page read failed for handle(0x%04x), with ioc_status(0x%04x) failure at %s:%d/%s()!\n",
803 handle, ioc_status, __FILE__, __LINE__, __func__);
814 /* phy number of the parent device this device is linked to */
853 * mpi3mr_add_host_phy - report sas_host phy to SAS transport
856 * @phy_pg0: SAS phy page 0
865 struct sas_phy *phy;
870 phy = sas_phy_alloc(parent_dev, phy_index);
871 if (!phy) {
876 if ((mpi3mr_set_identify(mrioc, mr_sas_phy->handle,
880 sas_phy_free(phy);
883 phy->identify = mr_sas_phy->identify;
888 phy->identify.phy_identifier = mr_sas_phy->phy_id;
889 phy->negotiated_linkrate = mpi3mr_convert_phy_link_rate(
893 phy->minimum_linkrate_hw = mpi3mr_convert_phy_link_rate(
895 phy->maximum_linkrate_hw = mpi3mr_convert_phy_link_rate(
897 phy->minimum_linkrate = mpi3mr_convert_phy_link_rate(
899 phy->maximum_linkrate = mpi3mr_convert_phy_link_rate(
901 phy->hostdata = mr_sas_phy->hba_port;
903 if ((sas_phy_add(phy))) {
906 sas_phy_free(phy);
910 dev_info(&phy->dev,
911 "add: handle(0x%04x), sas_address(0x%016llx)\n"
913 mr_sas_phy->handle, (unsigned long long)
918 mr_sas_phy->phy = phy;
923 * mpi3mr_add_expander_phy - report expander phy to transport
936 struct sas_phy *phy;
940 phy = sas_phy_alloc(parent_dev, phy_index);
941 if (!phy) {
946 if ((mpi3mr_set_identify(mrioc, mr_sas_phy->handle,
950 sas_phy_free(phy);
953 phy->identify = mr_sas_phy->identify;
959 phy->identify.phy_identifier = mr_sas_phy->phy_id;
960 phy->negotiated_linkrate = mpi3mr_convert_phy_link_rate(
964 phy->minimum_linkrate_hw = mpi3mr_convert_phy_link_rate(
966 phy->maximum_linkrate_hw = mpi3mr_convert_phy_link_rate(
968 phy->minimum_linkrate = mpi3mr_convert_phy_link_rate(
970 phy->maximum_linkrate = mpi3mr_convert_phy_link_rate(
972 phy->hostdata = mr_sas_phy->hba_port;
974 if ((sas_phy_add(phy))) {
977 sas_phy_free(phy);
981 dev_info(&phy->dev,
982 "add: handle(0x%04x), sas_address(0x%016llx)\n"
984 mr_sas_phy->handle, (unsigned long long)
989 mr_sas_phy->phy = phy;
1042 * mpi3mr_update_links - refreshing SAS phy link changes
1045 * @handle: Firmware device handle of attached device
1053 u64 sas_address_parent, u16 handle, u8 phy_number, u8 link_rate,
1071 mr_sas_phy = &mr_sas_node->phy[phy_number];
1072 mr_sas_phy->attached_handle = handle;
1074 if (handle && (link_rate >= MPI3_SAS_NEG_LINK_RATE_1_5)) {
1075 mpi3mr_set_identify(mrioc, handle,
1084 if (mr_sas_phy->phy)
1085 mr_sas_phy->phy->negotiated_linkrate =
1089 dev_info(&mr_sas_phy->phy->dev,
1091 "\tlink_rate(0x%02x), phy(%d)\n"
1094 link_rate, phy_number, handle, (unsigned long long)
1102 * This function refreshes the controllers phy information and
1132 mrioc->sas_hba.handle = 0;
1140 if (!mrioc->sas_hba.handle)
1141 mrioc->sas_hba.handle = le16_to_cpu(
1148 mrioc->sas_hba.phy[i].handle = mrioc->sas_hba.handle;
1153 mrioc->sas_hba.phy[i].hba_port =
1157 mrioc->sas_hba.phy[i].hba_port);
1167 * This function creates the controllers phy information and
1201 mrioc->sas_hba.phy = kcalloc(num_phys,
1203 if (!mrioc->sas_hba.phy)
1220 mrioc->sas_hba.handle = 0;
1239 if (!mrioc->sas_hba.handle)
1240 mrioc->sas_hba.handle = le16_to_cpu(
1248 mrioc->sas_hba.phy[i].handle = mrioc->sas_hba.handle;
1249 mrioc->sas_hba.phy[i].phy_id = i;
1250 mrioc->sas_hba.phy[i].hba_port =
1252 mpi3mr_add_host_phy(mrioc, &mrioc->sas_hba.phy[i],
1257 mrioc->sas_hba.handle))) {
1262 ioc_err(mrioc, "device page read failed for handle(0x%04x), with ioc_status(0x%04x) failure at %s:%d/%s()!\n",
1263 mrioc->sas_hba.handle, ioc_status, __FILE__, __LINE__,
1273 "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
1274 mrioc->sas_hba.handle,
1295 * @handle: Firmware device handle of the attached device
1307 u16 handle, u64 sas_address_parent, struct mpi3mr_hba_port *hba_port)
1341 if ((mpi3mr_set_identify(mrioc, handle,
1363 if ((mr_sas_node->phy[i].remote_identify.sas_address !=
1365 (mr_sas_node->phy[i].hba_port != hba_port))
1373 list_add_tail(&mr_sas_node->phy[i].port_siblings,
1417 "add: handle(0x%04x), sas_address(0x%016llx), phy(%d)\n",
1418 handle, (unsigned long long)
1421 sas_port_add_phy(port, mr_sas_phy->phy);
1450 "%s: added: handle(0x%04x), sas_address(0x%016llx)\n",
1451 __func__, handle, (unsigned long long)
1549 if (mr_sas_node->phy[i].remote_identify.sas_address ==
1551 memset(&mr_sas_node->phy[i].remote_identify, 0,
1565 "remove: sas_address(0x%016llx), phy(%d)\n",
1572 mr_sas_phy->phy);
1592 * @phy_mask: phy mask of host port
1593 * @handle: Device Handle of attached device
1596 * @lowest_phy: lowest phy ID of host port
1601 u16 handle;
1651 mr_sas_phy = &mrioc->sas_hba.phy[i];
1663 mr_sas_phy = &mrioc->sas_hba.phy[i];
1712 if (h_port[j].handle == attached_handle) {
1724 "failed to read dev_pg0 for handle(0x%04x) at %s:%d/%s()!\n",
1730 "ioc_status(0x%x) while reading dev_pg0 for handle(0x%04x) at %s:%d/%s()!\n",
1739 h_port[port_idx].handle = attached_handle;
1755 "port_id:%d, sas_address:(0x%016llx), phy_mask:(0x%x), lowest phy id:%d\n",
1764 "port_id:%d, sas_address:(0x%016llx), phy_mask:(0x%x), lowest phy id:%d\n",
1777 /* First check for matching lowest phy */
1793 /* In case if lowest phy is got enabled or disabled during reset */
1845 u16 ioc_status, handle;
1859 handle = 0xffff;
1865 MPI3_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
1867 "failed to read exp pg0 for handle(0x%04x) at %s:%d/%s()!\n",
1868 handle, __FILE__, __LINE__, __func__);
1874 "ioc_status(0x%x) while reading exp pg0 for handle:(0x%04x), %s:%d/%s()!\n",
1875 ioc_status, handle, __FILE__, __LINE__, __func__);
1879 handle = le16_to_cpu(expander_pg0.dev_handle);
1885 mpi3mr_expander_add(mrioc, handle);
1897 mpi3mr_expander_add(mrioc, handle);
1902 if (sas_expander->handle == handle)
1905 sas_expander->handle = handle;
1907 sas_expander->phy[i].handle = handle;
1951 * @handle: Expander firmware device handle
1959 int mpi3mr_expander_add(struct mpi3mr_ioc *mrioc, u16 handle)
1975 if (!handle)
1982 sizeof(expander_pg0), MPI3_SAS_EXPAND_PGAD_FORM_HANDLE, handle))) {
2024 * speed, attached dev handle and sas address.
2048 if (temp_handle != handle)
2054 handle, i, link_rate, hba_port);
2073 sas_expander->handle = handle;
2080 "expander_add: handle(0x%04x), parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
2081 handle, parent_handle, (unsigned long long)
2088 sas_expander->phy = kcalloc(sas_expander->num_phys,
2090 if (!sas_expander->phy) {
2096 mr_sas_port = mpi3mr_sas_port_add(mrioc, handle, sas_address_parent,
2109 handle;
2126 sas_expander->phy[i].handle = handle;
2127 sas_expander->phy[i].phy_id = i;
2128 sas_expander->phy[i].hba_port = hba_port;
2130 if ((mpi3mr_add_expander_phy(mrioc, &sas_expander->phy[i],
2157 kfree(sas_expander->phy);
2204 ioc_info(mrioc, "expander_remove: handle(0x%04x), sas_addr(0x%016llx), port:%d\n",
2205 sas_expander->handle, (unsigned long long)
2212 kfree(sas_expander->phy);
2255 * attached directly or through expander and issues sas phy
2256 * page0 or expander phy page1 and gets the link rate, if there
2410 * mpi3mr_get_port_id_by_sas_phy - Get port ID of the given phy
2411 * @phy: SAS transport layer phy object
2415 static inline u8 mpi3mr_get_port_id_by_sas_phy(struct sas_phy *phy)
2418 struct mpi3mr_hba_port *hba_port = phy->hostdata;
2430 * @rphy: SAS transport layer remote phy object
2473 static inline struct mpi3mr_ioc *phy_to_mrioc(struct sas_phy *phy)
2475 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
2487 /* report phy error log structure */
2498 /* report phy error log reply structure */
2518 * @phy: The SAS transport layer phy object
2524 struct sas_phy *phy)
2565 phy_error_log_request->phy_identifier = phy->number;
2571 mpi_request.io_unit_port = (u8) mpi3mr_get_port_id_by_sas_phy(phy);
2572 mpi_request.sas_address = cpu_to_le64(phy->identify.sas_address);
2581 "sending phy error log SMP request to sas_address(0x%016llx), phy_id(%d)\n",
2582 (unsigned long long)phy->identify.sas_address, phy->number);
2589 "phy error log SMP request completed with ioc_status(0x%04x)\n",
2594 "phy error log - reply data transfer size(%d)\n",
2602 "phy error log - function_result(%d)\n",
2605 phy->invalid_dword_count =
2607 phy->running_disparity_error_count =
2609 phy->loss_of_dword_sync_count =
2611 phy->phy_reset_problem_count =
2625 * mpi3mr_transport_get_linkerrors - return phy error counters
2626 * @phy: The SAS transport layer phy object
2628 * This function retrieves the phy error log information of the
2629 * HBA or expander for which the phy belongs to
2633 static int mpi3mr_transport_get_linkerrors(struct sas_phy *phy)
2635 struct mpi3mr_ioc *mrioc = phy_to_mrioc(phy);
2640 rc = mpi3mr_parent_present(mrioc, phy);
2644 if (phy->identify.sas_address != mrioc->sas_hba.sas_address)
2645 return mpi3mr_get_expander_phy_error_log(mrioc, phy);
2648 /* get hba phy error logs */
2651 MPI3_SAS_PHY_PGAD_FORM_PHY_NUMBER, phy->number))) {
2662 phy->invalid_dword_count = le32_to_cpu(phy_pg1.invalid_dword_count);
2663 phy->running_disparity_error_count =
2665 phy->loss_of_dword_sync_count =
2667 phy->phy_reset_problem_count =
2674 * @rphy: The SAS transport layer remote phy object
2678 * phy object.
2710 * @rphy: The SAS transport layer remote phy object
2712 * Returns the slot id for the device pointed by the remote phy
2738 /* phy control request structure */
2755 /* phy control reply structure */
2768 * mpi3mr_expander_phy_control - expander phy control
2770 * @phy: The SAS transport layer phy object
2771 * @phy_operation: The phy operation to be executed
2773 * Issues SMP passthru phy control request to execute a specific
2774 * phy operation for a given expander device.
2780 struct sas_phy *phy, u8 phy_operation)
2825 phy_control_request->phy_identifier = phy->number;
2828 phy->minimum_linkrate << 4;
2830 phy->maximum_linkrate << 4;
2836 mpi_request.io_unit_port = (u8) mpi3mr_get_port_id_by_sas_phy(phy);
2837 mpi_request.sas_address = cpu_to_le64(phy->identify.sas_address);
2846 "sending phy control SMP request to sas_address(0x%016llx), phy_id(%d) opcode(%d)\n",
2847 (unsigned long long)phy->identify.sas_address, phy->number,
2855 "phy control SMP request completed with ioc_status(0x%04x)\n",
2860 "phy control - reply data transfer size(%d)\n",
2867 "phy control - function_result(%d)\n",
2880 * mpi3mr_transport_phy_reset - Reset a given phy
2881 * @phy: The SAS transport layer phy object
2887 mpi3mr_transport_phy_reset(struct sas_phy *phy, int hard_reset)
2889 struct mpi3mr_ioc *mrioc = phy_to_mrioc(phy);
2897 rc = mpi3mr_parent_present(mrioc, phy);
2901 /* handle expander phys */
2902 if (phy->identify.sas_address != mrioc->sas_hba.sas_address)
2903 return mpi3mr_expander_phy_control(mrioc, phy,
2907 /* handle hba phys */
2916 phy->number;
2919 "sending phy reset request to sas_address(0x%016llx), phy_id(%d) hard_reset(%d)\n",
2920 (unsigned long long)phy->identify.sas_address, phy->number,
2930 "phy reset request completed with ioc_status(0x%04x)\n",
2938 * @phy: The SAS transport layer phy object
2939 * @enable: flag to enable/disable, enable phy when true
2942 * configuration page changes or expander phy control command
2947 mpi3mr_transport_phy_enable(struct sas_phy *phy, int enable)
2949 struct mpi3mr_ioc *mrioc = phy_to_mrioc(phy);
2956 rc = mpi3mr_parent_present(mrioc, phy);
2960 /* handle expander phys */
2961 if (phy->identify.sas_address != mrioc->sas_hba.sas_address)
2962 return mpi3mr_expander_phy_control(mrioc, phy,
2966 /* handle hba phys */
2987 "discovery is active on port = %d, phy = %d\n"
2999 if ((sas_io_unit_pg0->phy_data[phy->number].phy_flags &
3026 sas_io_unit_pg1->phy_data[phy->number].phy_flags
3029 sas_io_unit_pg1->phy_data[phy->number].phy_flags
3036 mpi3mr_transport_phy_reset(phy, 0);
3045 * mpi3mr_transport_phy_speed - set phy min/max speed
3046 * @phy: The SAS transport later phy object
3050 * argument to the given phy by executing required configuration
3051 * page changes or expander phy control command
3056 mpi3mr_transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates)
3058 struct mpi3mr_ioc *mrioc = phy_to_mrioc(phy);
3064 rc = mpi3mr_parent_present(mrioc, phy);
3069 rates->minimum_linkrate = phy->minimum_linkrate;
3070 else if (rates->minimum_linkrate < phy->minimum_linkrate_hw)
3071 rates->minimum_linkrate = phy->minimum_linkrate_hw;
3074 rates->maximum_linkrate = phy->maximum_linkrate;
3075 else if (rates->maximum_linkrate > phy->maximum_linkrate_hw)
3076 rates->maximum_linkrate = phy->maximum_linkrate_hw;
3078 /* handle expander phys */
3079 if (phy->identify.sas_address != mrioc->sas_hba.sas_address) {
3080 phy->minimum_linkrate = rates->minimum_linkrate;
3081 phy->maximum_linkrate = rates->maximum_linkrate;
3082 return mpi3mr_expander_phy_control(mrioc, phy,
3086 /* handle hba phys */
3103 sas_io_unit_pg1->phy_data[phy->number].max_min_link_rate =
3114 mpi3mr_transport_phy_reset(phy, 0);
3116 /* read phy page 0, then update the rates in the sas transport phy */
3119 MPI3_SAS_PHY_PGAD_FORM_PHY_NUMBER, phy->number) &&
3121 phy->minimum_linkrate = mpi3mr_convert_phy_link_rate(
3124 phy->maximum_linkrate = mpi3mr_convert_phy_link_rate(
3126 phy->negotiated_linkrate =