| @@ -297,7 +297,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx, · 296 unmodified lines |
| 297 | 297 | * (see CMA_CONFIG_ALIGNMENT) |
| 298 | 298 | */ |
| 299 | 299 | dev_err(&sndev->stdev->dev, |
| 300 | | − "ERROR: Memory window address is not aligned to it's size!\n"); |
| 300 | + "ERROR: Memory window address is not aligned to its size!\n"); |
| 301 | 301 | return -EINVAL; |
| 302 | 302 | } |
| 303 | 303 | |
| @@ -419,8 +419,10 @@ static void switchtec_ntb_part_link_speed(struct switchtec_ntb *sndev, · 115 unmodified lines |
| 419 | 419 | enum ntb_width *width) |
| 420 | 420 | { |
| 421 | 421 | struct switchtec_dev *stdev = sndev->stdev; |
| 422 | + struct part_cfg_regs __iomem *part_cfg = |
| 423 | + &stdev->mmio_part_cfg_all[partition]; |
| 422 | 424 | |
| 423 | | − u32 pff = ioread32(&stdev->mmio_part_cfg[partition].vep_pff_inst_id); |
| 425 | + u32 pff = ioread32(&part_cfg->vep_pff_inst_id) & 0xFF; |
| 424 | 426 | u32 linksta = ioread32(&stdev->mmio_pff_csr[pff].pci_cap_region[13]); |
| 425 | 427 | |
| 426 | 428 | if (speed) |
| @@ -840,7 +842,6 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) · 413 unmodified lines |
| 840 | 842 | u64 tpart_vec; |
| 841 | 843 | int self; |
| 842 | 844 | u64 part_map; |
| 843 | | − int bit; |
| 844 | 845 | |
| 845 | 846 | sndev->ntb.pdev = sndev->stdev->pdev; |
| 846 | 847 | sndev->ntb.topo = NTB_TOPO_SWITCH; |
| @@ -859,31 +860,31 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) · 12 unmodified lines |
| 859 | 860 | tpart_vec |= ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_low); |
| 860 | 861 | |
| 861 | 862 | part_map = ioread64(&sndev->mmio_ntb->ep_map); |
| 863 | + tpart_vec &= part_map; |
| 862 | 864 | part_map &= ~(1 << sndev->self_partition); |
| 863 | 865 | |
| 864 | | − if (!ffs(tpart_vec)) { |
| 866 | + if (!tpart_vec) { |
| 865 | 867 | if (sndev->stdev->partition_count != 2) { |
| 866 | 868 | dev_err(&sndev->stdev->dev, |
| 867 | 869 | "ntb target partition not defined\n"); |
| 868 | 870 | return -ENODEV; |
| 869 | 871 | } |
| 870 | 872 | |
| 871 | | − bit = ffs(part_map); |
| 872 | | − if (!bit) { |
| 873 | + if (!part_map) { |
| 873 | 874 | dev_err(&sndev->stdev->dev, |
| 874 | 875 | "peer partition is not NT partition\n"); |
| 875 | 876 | return -ENODEV; |
| 876 | 877 | } |
| 877 | 878 | |
| 878 | | − sndev->peer_partition = bit - 1; |
| 879 | + sndev->peer_partition = __ffs64(part_map); |
| 879 | 880 | } else { |
| 880 | | − if (ffs(tpart_vec) != fls(tpart_vec)) { |
| 881 | + if (__ffs64(tpart_vec) != (fls64(tpart_vec) - 1)) { |
| 881 | 882 | dev_err(&sndev->stdev->dev, |
| 882 | 883 | "ntb driver only supports 1 pair of 1-1 ntb mapping\n"); |
| 883 | 884 | return -ENODEV; |
| 884 | 885 | } |
| 885 | 886 | |
| 886 | | − sndev->peer_partition = ffs(tpart_vec) - 1; |
| 887 | + sndev->peer_partition = __ffs64(tpart_vec); |
| 887 | 888 | if (!(part_map & (1ULL << sndev->peer_partition))) { |
| 888 | 889 | dev_err(&sndev->stdev->dev, |
| 889 | 890 | "ntb target partition is not NT partition\n"); |
| @@ -954,7 +955,7 @@ static int config_req_id_table(struct switchtec_ntb *sndev, · 64 unmodified lines |
| 954 | 955 | u32 error; |
| 955 | 956 | u32 proxy_id; |
| 956 | 957 | |
| 957 | | − if (ioread32(&mmio_ctrl->req_id_table_size) < count) { |
| 958 | + if (ioread16(&mmio_ctrl->req_id_table_size) < count) { |
| 958 | 959 | dev_err(&sndev->stdev->dev, |
| 959 | 960 | "Not enough requester IDs available.\n"); |
| 960 | 961 | return -EFAULT; |
| @@ -966,9 +967,6 @@ static int config_req_id_table(struct switchtec_ntb *sndev, · 5 unmodified lines |
| 966 | 967 | if (rc) |
| 967 | 968 | return rc; |
| 968 | 969 | |
| 969 | | − iowrite32(NTB_PART_CTRL_ID_PROT_DIS, |
| 970 | | − &mmio_ctrl->partition_ctrl); |
| 971 | | − |
| 972 | 970 | for (i = 0; i < count; i++) { |
| 973 | 971 | iowrite32(req_ids[i] << 16 | NTB_CTRL_REQ_ID_EN, |
| 974 | 972 | &mmio_ctrl->req_id_table[i]); |
| @@ -1090,7 +1088,7 @@ static int crosslink_enum_partition(struct switchtec_ntb *sndev, · 115 unmodified lines |
| 1090 | 1088 | { |
| 1091 | 1089 | struct part_cfg_regs __iomem *part_cfg = |
| 1092 | 1090 | &sndev->stdev->mmio_part_cfg_all[sndev->peer_partition]; |
| 1093 | | − u32 pff = ioread32(&part_cfg->vep_pff_inst_id); |
| 1091 | + u32 pff = ioread32(&part_cfg->vep_pff_inst_id) & 0xFF; |
| 1094 | 1092 | struct pff_csr_regs __iomem *mmio_pff = |
| 1095 | 1093 | &sndev->stdev->mmio_pff_csr[pff]; |
| 1096 | 1094 | const u64 bar_space = 0x1000000000LL; |