Commit a93192a5d245a262dc52fa426de5b20467308a77

Authored by Alexandre Bounine
Committed by Linus Torvalds
1 parent e6d7202b66

rapidio: use common destid storage for endpoints and switches

Change code to use one storage location common for switches and endpoints.
This eliminates unnecessary device type checks during basic access
operations.  Logic that assigns destid to RIO devices stays unchanged - as
before, switches use an associated destid because they do not have their
own.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Micha Nelissen <micha@neli.hopto.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 8 changed files with 141 additions and 265 deletions Side-by-side Diff

drivers/rapidio/rio-scan.c
... ... @@ -437,10 +437,16 @@
437 437 next_destid++;
438 438 } else
439 439 rdev->destid = rio_get_device_id(port, destid, hopcount);
440   - } else
441   - /* Switch device has an associated destID */
442   - rdev->destid = RIO_INVALID_DESTID;
443 440  
  441 + rdev->hopcount = 0xff;
  442 + } else {
  443 + /* Switch device has an associated destID which
  444 + * will be adjusted later
  445 + */
  446 + rdev->destid = destid;
  447 + rdev->hopcount = hopcount;
  448 + }
  449 +
444 450 /* If a PE has both switch and other functions, show it as a switch */
445 451 if (rio_is_switch(rdev)) {
446 452 rswitch = kzalloc(sizeof(*rswitch) +
... ... @@ -450,8 +456,6 @@
450 456 if (!rswitch)
451 457 goto cleanup;
452 458 rswitch->switchid = next_switchid;
453   - rswitch->hopcount = hopcount;
454   - rswitch->destid = destid;
455 459 rswitch->port_ok = 0;
456 460 rswitch->route_table = kzalloc(sizeof(u8)*
457 461 RIO_MAX_ROUTE_ENTRIES(port->sys_size),
... ... @@ -632,8 +636,7 @@
632 636  
633 637 /**
634 638 * rio_route_add_entry- Add a route entry to a switch routing table
635   - * @mport: Master port to send transaction
636   - * @rswitch: Switch device
  639 + * @rdev: RIO device
637 640 * @table: Routing table ID
638 641 * @route_destid: Destination ID to be routed
639 642 * @route_port: Port number to be routed
640 643  
641 644  
642 645  
643 646  
... ... @@ -647,31 +650,31 @@
647 650 * on failure.
648 651 */
649 652 static int
650   -rio_route_add_entry(struct rio_mport *mport, struct rio_switch *rswitch,
  653 +rio_route_add_entry(struct rio_dev *rdev,
651 654 u16 table, u16 route_destid, u8 route_port, int lock)
652 655 {
653 656 int rc;
654 657  
655 658 if (lock) {
656   - rc = rio_lock_device(mport, rswitch->destid,
657   - rswitch->hopcount, 1000);
  659 + rc = rio_lock_device(rdev->net->hport, rdev->destid,
  660 + rdev->hopcount, 1000);
658 661 if (rc)
659 662 return rc;
660 663 }
661 664  
662   - rc = rswitch->add_entry(mport, rswitch->destid,
663   - rswitch->hopcount, table,
664   - route_destid, route_port);
  665 + rc = rdev->rswitch->add_entry(rdev->net->hport, rdev->destid,
  666 + rdev->hopcount, table,
  667 + route_destid, route_port);
665 668 if (lock)
666   - rio_unlock_device(mport, rswitch->destid, rswitch->hopcount);
  669 + rio_unlock_device(rdev->net->hport, rdev->destid,
  670 + rdev->hopcount);
667 671  
668 672 return rc;
669 673 }
670 674  
671 675 /**
672 676 * rio_route_get_entry- Read a route entry in a switch routing table
673   - * @mport: Master port to send transaction
674   - * @rswitch: Switch device
  677 + * @rdev: RIO device
675 678 * @table: Routing table ID
676 679 * @route_destid: Destination ID to be routed
677 680 * @route_port: Pointer to read port number into
678 681  
679 682  
680 683  
... ... @@ -685,23 +688,24 @@
685 688 * on failure.
686 689 */
687 690 static int
688   -rio_route_get_entry(struct rio_mport *mport, struct rio_switch *rswitch, u16 table,
  691 +rio_route_get_entry(struct rio_dev *rdev, u16 table,
689 692 u16 route_destid, u8 *route_port, int lock)
690 693 {
691 694 int rc;
692 695  
693 696 if (lock) {
694   - rc = rio_lock_device(mport, rswitch->destid,
695   - rswitch->hopcount, 1000);
  697 + rc = rio_lock_device(rdev->net->hport, rdev->destid,
  698 + rdev->hopcount, 1000);
696 699 if (rc)
697 700 return rc;
698 701 }
699 702  
700   - rc = rswitch->get_entry(mport, rswitch->destid,
701   - rswitch->hopcount, table,
702   - route_destid, route_port);
  703 + rc = rdev->rswitch->get_entry(rdev->net->hport, rdev->destid,
  704 + rdev->hopcount, table,
  705 + route_destid, route_port);
703 706 if (lock)
704   - rio_unlock_device(mport, rswitch->destid, rswitch->hopcount);
  707 + rio_unlock_device(rdev->net->hport, rdev->destid,
  708 + rdev->hopcount);
705 709  
706 710 return rc;
707 711 }
708 712  
... ... @@ -811,14 +815,14 @@
811 815 if (rio_is_switch(rdev)) {
812 816 next_switchid++;
813 817 sw_inport = RIO_GET_PORT_NUM(rdev->swpinfo);
814   - rio_route_add_entry(port, rdev->rswitch, RIO_GLOBAL_TABLE,
  818 + rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
815 819 port->host_deviceid, sw_inport, 0);
816 820 rdev->rswitch->route_table[port->host_deviceid] = sw_inport;
817 821  
818 822 for (destid = 0; destid < next_destid; destid++) {
819 823 if (destid == port->host_deviceid)
820 824 continue;
821   - rio_route_add_entry(port, rdev->rswitch, RIO_GLOBAL_TABLE,
  825 + rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
822 826 destid, sw_inport, 0);
823 827 rdev->rswitch->route_table[destid] = sw_inport;
824 828 }
... ... @@ -850,8 +854,7 @@
850 854 "RIO: scanning device on port %d\n",
851 855 port_num);
852 856 rdev->rswitch->port_ok |= (1 << port_num);
853   - rio_route_add_entry(port, rdev->rswitch,
854   - RIO_GLOBAL_TABLE,
  857 + rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
855 858 RIO_ANY_DESTID(port->sys_size),
856 859 port_num, 0);
857 860  
... ... @@ -865,7 +868,7 @@
865 868 destid < next_destid; destid++) {
866 869 if (destid == port->host_deviceid)
867 870 continue;
868   - rio_route_add_entry(port, rdev->rswitch,
  871 + rio_route_add_entry(rdev,
869 872 RIO_GLOBAL_TABLE,
870 873 destid,
871 874 port_num,
... ... @@ -904,7 +907,7 @@
904 907 next_destid++;
905 908 }
906 909  
907   - rdev->rswitch->destid = sw_destid;
  910 + rdev->destid = sw_destid;
908 911 } else
909 912 pr_debug("RIO: found %s (vid %4.4x did %4.4x)\n",
910 913 rio_name(rdev), rdev->vid, rdev->did);
... ... @@ -958,7 +961,7 @@
958 961 next_switchid++;
959 962  
960 963 /* Associated destid is how we accessed this switch */
961   - rdev->rswitch->destid = destid;
  964 + rdev->destid = destid;
962 965  
963 966 pr_debug(
964 967 "RIO: found %s (vid %4.4x did %4.4x) with %d ports\n",
... ... @@ -981,7 +984,7 @@
981 984 for (ndestid = 0;
982 985 ndestid < RIO_ANY_DESTID(port->sys_size);
983 986 ndestid++) {
984   - rio_route_get_entry(port, rdev->rswitch,
  987 + rio_route_get_entry(rdev,
985 988 RIO_GLOBAL_TABLE,
986 989 ndestid,
987 990 &route_port, 0);
... ... @@ -1076,7 +1079,7 @@
1076 1079  
1077 1080 list_for_each_entry(rdev, &rio_devices, global_list) {
1078 1081  
1079   - destid = (rio_is_switch(rdev))?rdev->rswitch->destid:rdev->destid;
  1082 + destid = rdev->destid;
1080 1083  
1081 1084 list_for_each_entry(rswitch, &rio_switches, node) {
1082 1085  
1083 1086  
... ... @@ -1085,13 +1088,13 @@
1085 1088  
1086 1089 if (RIO_INVALID_ROUTE == rswitch->route_table[destid]) {
1087 1090 /* Skip if destid ends in empty switch*/
1088   - if (rswitch->destid == destid)
  1091 + if (rswitch->rdev->destid == destid)
1089 1092 continue;
1090 1093  
1091 1094 sport = RIO_GET_PORT_NUM(rswitch->rdev->swpinfo);
1092 1095  
1093 1096 if (rswitch->add_entry) {
1094   - rio_route_add_entry(port, rswitch,
  1097 + rio_route_add_entry(rswitch->rdev,
1095 1098 RIO_GLOBAL_TABLE, destid,
1096 1099 sport, 0);
1097 1100 rswitch->route_table[destid] = sport;
1098 1101  
1099 1102  
... ... @@ -1203,21 +1206,20 @@
1203 1206  
1204 1207 list_for_each_entry(rdev, &rio_devices, global_list)
1205 1208 if (rio_is_switch(rdev)) {
1206   - rio_lock_device(rdev->net->hport, rdev->rswitch->destid,
1207   - rdev->rswitch->hopcount, 1000);
  1209 + rio_lock_device(rdev->net->hport, rdev->destid,
  1210 + rdev->hopcount, 1000);
1208 1211 for (i = 0;
1209 1212 i < RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size);
1210 1213 i++) {
1211   - if (rio_route_get_entry
1212   - (rdev->net->hport, rdev->rswitch,
1213   - RIO_GLOBAL_TABLE, i, &sport, 0) < 0)
  1214 + if (rio_route_get_entry(rdev,
  1215 + RIO_GLOBAL_TABLE, i, &sport, 0) < 0)
1214 1216 continue;
1215 1217 rdev->rswitch->route_table[i] = sport;
1216 1218 }
1217 1219  
1218 1220 rio_unlock_device(rdev->net->hport,
1219   - rdev->rswitch->destid,
1220   - rdev->rswitch->hopcount);
  1221 + rdev->destid,
  1222 + rdev->hopcount);
1221 1223 }
1222 1224 }
1223 1225  
drivers/rapidio/rio.c
... ... @@ -471,16 +471,9 @@
471 471 */
472 472 int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock)
473 473 {
474   - u8 hopcount = 0xff;
475   - u16 destid = rdev->destid;
476 474 u32 regval;
477 475  
478   - if (rdev->rswitch) {
479   - destid = rdev->rswitch->destid;
480   - hopcount = rdev->rswitch->hopcount;
481   - }
482   -
483   - rio_mport_read_config_32(rdev->net->hport, destid, hopcount,
  476 + rio_read_config_32(rdev,
484 477 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum),
485 478 &regval);
486 479 if (lock)
... ... @@ -488,7 +481,7 @@
488 481 else
489 482 regval &= ~RIO_PORT_N_CTL_LOCKOUT;
490 483  
491   - rio_mport_write_config_32(rdev->net->hport, destid, hopcount,
  484 + rio_write_config_32(rdev,
492 485 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum),
493 486 regval);
494 487 return 0;
... ... @@ -507,7 +500,7 @@
507 500 rio_chk_dev_route(struct rio_dev *rdev, struct rio_dev **nrdev, int *npnum)
508 501 {
509 502 u32 result;
510   - int p_port, dstid, rc = -EIO;
  503 + int p_port, rc = -EIO;
511 504 struct rio_dev *prev = NULL;
512 505  
513 506 /* Find switch with failed RIO link */
... ... @@ -522,9 +515,7 @@
522 515 if (prev == NULL)
523 516 goto err_out;
524 517  
525   - dstid = (rdev->pef & RIO_PEF_SWITCH) ?
526   - rdev->rswitch->destid : rdev->destid;
527   - p_port = prev->rswitch->route_table[dstid];
  518 + p_port = prev->rswitch->route_table[rdev->destid];
528 519  
529 520 if (p_port != RIO_INVALID_ROUTE) {
530 521 pr_debug("RIO: link failed on [%s]-P%d\n",
... ... @@ -567,15 +558,8 @@
567 558 */
568 559 static int rio_chk_dev_access(struct rio_dev *rdev)
569 560 {
570   - u8 hopcount = 0xff;
571   - u16 destid = rdev->destid;
572   -
573   - if (rdev->rswitch) {
574   - destid = rdev->rswitch->destid;
575   - hopcount = rdev->rswitch->hopcount;
576   - }
577   -
578   - return rio_mport_chk_dev_access(rdev->net->hport, destid, hopcount);
  561 + return rio_mport_chk_dev_access(rdev->net->hport,
  562 + rdev->destid, rdev->hopcount);
579 563 }
580 564  
581 565 /**
582 566  
583 567  
... ... @@ -588,23 +572,20 @@
588 572 static int
589 573 rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
590 574 {
591   - struct rio_mport *mport = rdev->net->hport;
592   - u16 destid = rdev->rswitch->destid;
593   - u8 hopcount = rdev->rswitch->hopcount;
594 575 u32 regval;
595 576 int checkcount;
596 577  
597 578 if (lnkresp) {
598 579 /* Read from link maintenance response register
599 580 * to clear valid bit */
600   - rio_mport_read_config_32(mport, destid, hopcount,
  581 + rio_read_config_32(rdev,
601 582 rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
602 583 &regval);
603 584 udelay(50);
604 585 }
605 586  
606 587 /* Issue Input-status command */
607   - rio_mport_write_config_32(mport, destid, hopcount,
  588 + rio_write_config_32(rdev,
608 589 rdev->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(pnum),
609 590 RIO_MNT_REQ_CMD_IS);
610 591  
... ... @@ -615,7 +596,7 @@
615 596 checkcount = 3;
616 597 while (checkcount--) {
617 598 udelay(50);
618   - rio_mport_read_config_32(mport, destid, hopcount,
  599 + rio_read_config_32(rdev,
619 600 rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
620 601 &regval);
621 602 if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
622 603  
... ... @@ -635,15 +616,12 @@
635 616 */
636 617 static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status)
637 618 {
638   - struct rio_mport *mport = rdev->net->hport;
639   - u16 destid = rdev->rswitch->destid;
640   - u8 hopcount = rdev->rswitch->hopcount;
641 619 struct rio_dev *nextdev = rdev->rswitch->nextdev[pnum];
642 620 u32 regval;
643 621 u32 far_ackid, far_linkstat, near_ackid;
644 622  
645 623 if (err_status == 0)
646   - rio_mport_read_config_32(mport, destid, hopcount,
  624 + rio_read_config_32(rdev,
647 625 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
648 626 &err_status);
649 627  
... ... @@ -661,7 +639,7 @@
661 639 pnum, regval);
662 640 far_ackid = (regval & RIO_PORT_N_MNT_RSP_ASTAT) >> 5;
663 641 far_linkstat = regval & RIO_PORT_N_MNT_RSP_LSTAT;
664   - rio_mport_read_config_32(mport, destid, hopcount,
  642 + rio_read_config_32(rdev,
665 643 rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
666 644 &regval);
667 645 pr_debug("RIO_EM: SP%d_ACK_STS_CSR=0x%08x\n", pnum, regval);
... ... @@ -679,9 +657,8 @@
679 657 /* Align near outstanding/outbound ackIDs with
680 658 * far inbound.
681 659 */
682   - rio_mport_write_config_32(mport, destid,
683   - hopcount, rdev->phys_efptr +
684   - RIO_PORT_N_ACK_STS_CSR(pnum),
  660 + rio_write_config_32(rdev,
  661 + rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
685 662 (near_ackid << 24) |
686 663 (far_ackid << 8) | far_ackid);
687 664 /* Align far outstanding/outbound ackIDs with
... ... @@ -698,7 +675,7 @@
698 675 pr_debug("RIO_EM: Invalid nextdev pointer (NULL)\n");
699 676 }
700 677 rd_err:
701   - rio_mport_read_config_32(mport, destid, hopcount,
  678 + rio_read_config_32(rdev,
702 679 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
703 680 &err_status);
704 681 pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
... ... @@ -710,7 +687,7 @@
710 687 RIO_GET_PORT_NUM(nextdev->swpinfo), NULL);
711 688 udelay(50);
712 689  
713   - rio_mport_read_config_32(mport, destid, hopcount,
  690 + rio_read_config_32(rdev,
714 691 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
715 692 &err_status);
716 693 pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
... ... @@ -730,9 +707,6 @@
730 707 int rio_inb_pwrite_handler(union rio_pw_msg *pw_msg)
731 708 {
732 709 struct rio_dev *rdev;
733   - struct rio_mport *mport;
734   - u8 hopcount;
735   - u16 destid;
736 710 u32 err_status, em_perrdet, em_ltlerrdet;
737 711 int rc, portnum;
738 712  
739 713  
... ... @@ -800,17 +774,13 @@
800 774 return 0;
801 775 }
802 776  
803   - mport = rdev->net->hport;
804   - destid = rdev->rswitch->destid;
805   - hopcount = rdev->rswitch->hopcount;
806   -
807 777 /*
808 778 * Process the port-write notification from switch
809 779 */
810 780 if (rdev->rswitch->em_handle)
811 781 rdev->rswitch->em_handle(rdev, portnum);
812 782  
813   - rio_mport_read_config_32(mport, destid, hopcount,
  783 + rio_read_config_32(rdev,
814 784 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
815 785 &err_status);
816 786 pr_debug("RIO_PW: SP%d_ERR_STS_CSR=0x%08x\n", portnum, err_status);
... ... @@ -840,7 +810,7 @@
840 810 rdev->rswitch->port_ok &= ~(1 << portnum);
841 811 rio_set_port_lockout(rdev, portnum, 1);
842 812  
843   - rio_mport_write_config_32(mport, destid, hopcount,
  813 + rio_write_config_32(rdev,
844 814 rdev->phys_efptr +
845 815 RIO_PORT_N_ACK_STS_CSR(portnum),
846 816 RIO_PORT_N_ACK_CLEAR);
847 817  
848 818  
849 819  
850 820  
... ... @@ -851,28 +821,28 @@
851 821 }
852 822 }
853 823  
854   - rio_mport_read_config_32(mport, destid, hopcount,
  824 + rio_read_config_32(rdev,
855 825 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet);
856 826 if (em_perrdet) {
857 827 pr_debug("RIO_PW: RIO_EM_P%d_ERR_DETECT=0x%08x\n",
858 828 portnum, em_perrdet);
859 829 /* Clear EM Port N Error Detect CSR */
860   - rio_mport_write_config_32(mport, destid, hopcount,
  830 + rio_write_config_32(rdev,
861 831 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), 0);
862 832 }
863 833  
864   - rio_mport_read_config_32(mport, destid, hopcount,
  834 + rio_read_config_32(rdev,
865 835 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet);
866 836 if (em_ltlerrdet) {
867 837 pr_debug("RIO_PW: RIO_EM_LTL_ERR_DETECT=0x%08x\n",
868 838 em_ltlerrdet);
869 839 /* Clear EM L/T Layer Error Detect CSR */
870   - rio_mport_write_config_32(mport, destid, hopcount,
  840 + rio_write_config_32(rdev,
871 841 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0);
872 842 }
873 843  
874 844 /* Clear remaining error bits and Port-Write Pending bit */
875   - rio_mport_write_config_32(mport, destid, hopcount,
  845 + rio_write_config_32(rdev,
876 846 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
877 847 err_status);
878 848  
drivers/rapidio/switches/idt_gen2.c
... ... @@ -209,9 +209,6 @@
209 209 static int
210 210 idtg2_em_init(struct rio_dev *rdev)
211 211 {
212   - struct rio_mport *mport = rdev->net->hport;
213   - u16 destid = rdev->rswitch->destid;
214   - u8 hopcount = rdev->rswitch->hopcount;
215 212 u32 regval;
216 213 int i, tmp;
217 214  
218 215  
219 216  
220 217  
... ... @@ -220,29 +217,25 @@
220 217 * All standard EM configuration should be performed at upper level.
221 218 */
222 219  
223   - pr_debug("RIO: %s [%d:%d]\n", __func__, destid, hopcount);
  220 + pr_debug("RIO: %s [%d:%d]\n", __func__, rdev->destid, rdev->hopcount);
224 221  
225 222 /* Set Port-Write info CSR: PRIO=3 and CRF=1 */
226   - rio_mport_write_config_32(mport, destid, hopcount,
227   - IDT_PW_INFO_CSR, 0x0000e000);
  223 + rio_write_config_32(rdev, IDT_PW_INFO_CSR, 0x0000e000);
228 224  
229 225 /*
230 226 * Configure LT LAYER error reporting.
231 227 */
232 228  
233 229 /* Enable standard (RIO.p8) error reporting */
234   - rio_mport_write_config_32(mport, destid, hopcount,
235   - IDT_LT_ERR_REPORT_EN,
  230 + rio_write_config_32(rdev, IDT_LT_ERR_REPORT_EN,
236 231 REM_LTL_ERR_ILLTRAN | REM_LTL_ERR_UNSOLR |
237 232 REM_LTL_ERR_UNSUPTR);
238 233  
239 234 /* Use Port-Writes for LT layer error reporting.
240 235 * Enable per-port reset
241 236 */
242   - rio_mport_read_config_32(mport, destid, hopcount,
243   - IDT_DEV_CTRL_1, &regval);
244   - rio_mport_write_config_32(mport, destid, hopcount,
245   - IDT_DEV_CTRL_1,
  237 + rio_read_config_32(rdev, IDT_DEV_CTRL_1, &regval);
  238 + rio_write_config_32(rdev, IDT_DEV_CTRL_1,
246 239 regval | IDT_DEV_CTRL_1_GENPW | IDT_DEV_CTRL_1_PRSTBEH);
247 240  
248 241 /*
249 242  
250 243  
251 244  
252 245  
253 246  
... ... @@ -250,45 +243,40 @@
250 243 */
251 244  
252 245 /* Report all RIO.p8 errors supported by device */
253   - rio_mport_write_config_32(mport, destid, hopcount,
254   - IDT_PORT_ERR_REPORT_EN_BC, 0x807e8037);
  246 + rio_write_config_32(rdev, IDT_PORT_ERR_REPORT_EN_BC, 0x807e8037);
255 247  
256 248 /* Configure reporting of implementation specific errors/events */
257   - rio_mport_write_config_32(mport, destid, hopcount,
258   - IDT_PORT_ISERR_REPORT_EN_BC, IDT_PORT_INIT_TX_ACQUIRED);
  249 + rio_write_config_32(rdev, IDT_PORT_ISERR_REPORT_EN_BC,
  250 + IDT_PORT_INIT_TX_ACQUIRED);
259 251  
260 252 /* Use Port-Writes for port error reporting and enable error logging */
261 253 tmp = RIO_GET_TOTAL_PORTS(rdev->swpinfo);
262 254 for (i = 0; i < tmp; i++) {
263   - rio_mport_read_config_32(mport, destid, hopcount,
264   - IDT_PORT_OPS(i), &regval);
265   - rio_mport_write_config_32(mport, destid, hopcount,
  255 + rio_read_config_32(rdev, IDT_PORT_OPS(i), &regval);
  256 + rio_write_config_32(rdev,
266 257 IDT_PORT_OPS(i), regval | IDT_PORT_OPS_GENPW |
267 258 IDT_PORT_OPS_PL_ELOG |
268 259 IDT_PORT_OPS_LL_ELOG |
269 260 IDT_PORT_OPS_LT_ELOG);
270 261 }
271 262 /* Overwrite error log if full */
272   - rio_mport_write_config_32(mport, destid, hopcount,
273   - IDT_ERR_CAP, IDT_ERR_CAP_LOG_OVERWR);
  263 + rio_write_config_32(rdev, IDT_ERR_CAP, IDT_ERR_CAP_LOG_OVERWR);
274 264  
275 265 /*
276 266 * Configure LANE error reporting.
277 267 */
278 268  
279 269 /* Disable line error reporting */
280   - rio_mport_write_config_32(mport, destid, hopcount,
281   - IDT_LANE_ERR_REPORT_EN_BC, 0);
  270 + rio_write_config_32(rdev, IDT_LANE_ERR_REPORT_EN_BC, 0);
282 271  
283 272 /* Use Port-Writes for lane error reporting (when enabled)
284 273 * (do per-lane update because lanes may have different configuration)
285 274 */
286 275 tmp = (rdev->did == RIO_DID_IDTCPS1848) ? 48 : 16;
287 276 for (i = 0; i < tmp; i++) {
288   - rio_mport_read_config_32(mport, destid, hopcount,
289   - IDT_LANE_CTRL(i), &regval);
290   - rio_mport_write_config_32(mport, destid, hopcount,
291   - IDT_LANE_CTRL(i), regval | IDT_LANE_CTRL_GENPW);
  277 + rio_read_config_32(rdev, IDT_LANE_CTRL(i), &regval);
  278 + rio_write_config_32(rdev, IDT_LANE_CTRL(i),
  279 + regval | IDT_LANE_CTRL_GENPW);
292 280 }
293 281  
294 282 /*
295 283  
296 284  
297 285  
298 286  
299 287  
300 288  
... ... @@ -296,41 +284,32 @@
296 284 */
297 285  
298 286 /* Disable JTAG and I2C Error capture */
299   - rio_mport_write_config_32(mport, destid, hopcount,
300   - IDT_AUX_PORT_ERR_CAP_EN, 0);
  287 + rio_write_config_32(rdev, IDT_AUX_PORT_ERR_CAP_EN, 0);
301 288  
302 289 /* Disable JTAG and I2C Error reporting/logging */
303   - rio_mport_write_config_32(mport, destid, hopcount,
304   - IDT_AUX_ERR_REPORT_EN, 0);
  290 + rio_write_config_32(rdev, IDT_AUX_ERR_REPORT_EN, 0);
305 291  
306 292 /* Disable Port-Write notification from JTAG */
307   - rio_mport_write_config_32(mport, destid, hopcount,
308   - IDT_JTAG_CTRL, 0);
  293 + rio_write_config_32(rdev, IDT_JTAG_CTRL, 0);
309 294  
310 295 /* Disable Port-Write notification from I2C */
311   - rio_mport_read_config_32(mport, destid, hopcount,
312   - IDT_I2C_MCTRL, &regval);
313   - rio_mport_write_config_32(mport, destid, hopcount,
314   - IDT_I2C_MCTRL,
315   - regval & ~IDT_I2C_MCTRL_GENPW);
  296 + rio_read_config_32(rdev, IDT_I2C_MCTRL, &regval);
  297 + rio_write_config_32(rdev, IDT_I2C_MCTRL, regval & ~IDT_I2C_MCTRL_GENPW);
316 298  
317 299 /*
318 300 * Configure CFG_BLK error reporting.
319 301 */
320 302  
321 303 /* Disable Configuration Block error capture */
322   - rio_mport_write_config_32(mport, destid, hopcount,
323   - IDT_CFGBLK_ERR_CAPTURE_EN, 0);
  304 + rio_write_config_32(rdev, IDT_CFGBLK_ERR_CAPTURE_EN, 0);
324 305  
325 306 /* Disable Port-Writes for Configuration Block error reporting */
326   - rio_mport_read_config_32(mport, destid, hopcount,
327   - IDT_CFGBLK_ERR_REPORT, &regval);
328   - rio_mport_write_config_32(mport, destid, hopcount,
329   - IDT_CFGBLK_ERR_REPORT,
330   - regval & ~IDT_CFGBLK_ERR_REPORT_GENPW);
  307 + rio_read_config_32(rdev, IDT_CFGBLK_ERR_REPORT, &regval);
  308 + rio_write_config_32(rdev, IDT_CFGBLK_ERR_REPORT,
  309 + regval & ~IDT_CFGBLK_ERR_REPORT_GENPW);
331 310  
332 311 /* set TVAL = ~50us */
333   - rio_mport_write_config_32(mport, destid, hopcount,
  312 + rio_write_config_32(rdev,
334 313 rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8);
335 314  
336 315 return 0;
337 316  
338 317  
... ... @@ -339,18 +318,15 @@
339 318 static int
340 319 idtg2_em_handler(struct rio_dev *rdev, u8 portnum)
341 320 {
342   - struct rio_mport *mport = rdev->net->hport;
343   - u16 destid = rdev->rswitch->destid;
344   - u8 hopcount = rdev->rswitch->hopcount;
345 321 u32 regval, em_perrdet, em_ltlerrdet;
346 322  
347   - rio_mport_read_config_32(mport, destid, hopcount,
  323 + rio_read_config_32(rdev,
348 324 rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet);
349 325 if (em_ltlerrdet) {
350 326 /* Service Logical/Transport Layer Error(s) */
351 327 if (em_ltlerrdet & REM_LTL_ERR_IMPSPEC) {
352 328 /* Implementation specific error reported */
353   - rio_mport_read_config_32(mport, destid, hopcount,
  329 + rio_read_config_32(rdev,
354 330 IDT_ISLTL_ADDRESS_CAP, &regval);
355 331  
356 332 pr_debug("RIO: %s Implementation Specific LTL errors" \
357 333  
... ... @@ -358,13 +334,12 @@
358 334 rio_name(rdev), em_ltlerrdet, regval);
359 335  
360 336 /* Clear implementation specific address capture CSR */
361   - rio_mport_write_config_32(mport, destid, hopcount,
362   - IDT_ISLTL_ADDRESS_CAP, 0);
  337 + rio_write_config_32(rdev, IDT_ISLTL_ADDRESS_CAP, 0);
363 338  
364 339 }
365 340 }
366 341  
367   - rio_mport_read_config_32(mport, destid, hopcount,
  342 + rio_read_config_32(rdev,
368 343 rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet);
369 344 if (em_perrdet) {
370 345 /* Service Port-Level Error(s) */
371 346  
... ... @@ -372,14 +347,14 @@
372 347 /* Implementation Specific port error reported */
373 348  
374 349 /* Get IS errors reported */
375   - rio_mport_read_config_32(mport, destid, hopcount,
  350 + rio_read_config_32(rdev,
376 351 IDT_PORT_ISERR_DET(portnum), &regval);
377 352  
378 353 pr_debug("RIO: %s Implementation Specific Port" \
379 354 " errors 0x%x\n", rio_name(rdev), regval);
380 355  
381 356 /* Clear all implementation specific events */
382   - rio_mport_write_config_32(mport, destid, hopcount,
  357 + rio_write_config_32(rdev,
383 358 IDT_PORT_ISERR_DET(portnum), 0);
384 359 }
385 360 }
386 361  
... ... @@ -391,14 +366,10 @@
391 366 idtg2_show_errlog(struct device *dev, struct device_attribute *attr, char *buf)
392 367 {
393 368 struct rio_dev *rdev = to_rio_dev(dev);
394   - struct rio_mport *mport = rdev->net->hport;
395   - u16 destid = rdev->rswitch->destid;
396   - u8 hopcount = rdev->rswitch->hopcount;
397 369 ssize_t len = 0;
398 370 u32 regval;
399 371  
400   - while (!rio_mport_read_config_32(mport, destid, hopcount,
401   - IDT_ERR_RD, &regval)) {
  372 + while (!rio_read_config_32(rdev, IDT_ERR_RD, &regval)) {
402 373 if (!regval) /* 0 = end of log */
403 374 break;
404 375 len += snprintf(buf + len, PAGE_SIZE - len,
drivers/rapidio/switches/idtcps.c
... ... @@ -117,10 +117,6 @@
117 117  
118 118 static int idtcps_switch_init(struct rio_dev *rdev, int do_enum)
119 119 {
120   - struct rio_mport *mport = rdev->net->hport;
121   - u16 destid = rdev->rswitch->destid;
122   - u8 hopcount = rdev->rswitch->hopcount;
123   -
124 120 pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
125 121 rdev->rswitch->add_entry = idtcps_route_add_entry;
126 122 rdev->rswitch->get_entry = idtcps_route_get_entry;
... ... @@ -132,7 +128,7 @@
132 128  
133 129 if (do_enum) {
134 130 /* set TVAL = ~50us */
135   - rio_mport_write_config_32(mport, destid, hopcount,
  131 + rio_write_config_32(rdev,
136 132 rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8);
137 133 }
138 134  
drivers/rapidio/switches/tsi568.c
... ... @@ -113,22 +113,17 @@
113 113 static int
114 114 tsi568_em_init(struct rio_dev *rdev)
115 115 {
116   - struct rio_mport *mport = rdev->net->hport;
117   - u16 destid = rdev->rswitch->destid;
118   - u8 hopcount = rdev->rswitch->hopcount;
119 116 u32 regval;
120 117 int portnum;
121 118  
122   - pr_debug("TSI568 %s [%d:%d]\n", __func__, destid, hopcount);
  119 + pr_debug("TSI568 %s [%d:%d]\n", __func__, rdev->destid, rdev->hopcount);
123 120  
124 121 /* Make sure that Port-Writes are disabled (for all ports) */
125 122 for (portnum = 0;
126 123 portnum < RIO_GET_TOTAL_PORTS(rdev->swpinfo); portnum++) {
127   - rio_mport_read_config_32(mport, destid, hopcount,
128   - TSI568_SP_MODE(portnum), &regval);
129   - rio_mport_write_config_32(mport, destid, hopcount,
130   - TSI568_SP_MODE(portnum),
131   - regval | TSI568_SP_MODE_PW_DIS);
  124 + rio_read_config_32(rdev, TSI568_SP_MODE(portnum), &regval);
  125 + rio_write_config_32(rdev, TSI568_SP_MODE(portnum),
  126 + regval | TSI568_SP_MODE_PW_DIS);
132 127 }
133 128  
134 129 return 0;
drivers/rapidio/switches/tsi57x.c
... ... @@ -158,48 +158,45 @@
158 158 static int
159 159 tsi57x_em_init(struct rio_dev *rdev)
160 160 {
161   - struct rio_mport *mport = rdev->net->hport;
162   - u16 destid = rdev->rswitch->destid;
163   - u8 hopcount = rdev->rswitch->hopcount;
164 161 u32 regval;
165 162 int portnum;
166 163  
167   - pr_debug("TSI578 %s [%d:%d]\n", __func__, destid, hopcount);
  164 + pr_debug("TSI578 %s [%d:%d]\n", __func__, rdev->destid, rdev->hopcount);
168 165  
169 166 for (portnum = 0;
170 167 portnum < RIO_GET_TOTAL_PORTS(rdev->swpinfo); portnum++) {
171 168 /* Make sure that Port-Writes are enabled (for all ports) */
172   - rio_mport_read_config_32(mport, destid, hopcount,
  169 + rio_read_config_32(rdev,
173 170 TSI578_SP_MODE(portnum), &regval);
174   - rio_mport_write_config_32(mport, destid, hopcount,
  171 + rio_write_config_32(rdev,
175 172 TSI578_SP_MODE(portnum),
176 173 regval & ~TSI578_SP_MODE_PW_DIS);
177 174  
178 175 /* Clear all pending interrupts */
179   - rio_mport_read_config_32(mport, destid, hopcount,
  176 + rio_read_config_32(rdev,
180 177 rdev->phys_efptr +
181 178 RIO_PORT_N_ERR_STS_CSR(portnum),
182 179 &regval);
183   - rio_mport_write_config_32(mport, destid, hopcount,
  180 + rio_write_config_32(rdev,
184 181 rdev->phys_efptr +
185 182 RIO_PORT_N_ERR_STS_CSR(portnum),
186 183 regval & 0x07120214);
187 184  
188   - rio_mport_read_config_32(mport, destid, hopcount,
  185 + rio_read_config_32(rdev,
189 186 TSI578_SP_INT_STATUS(portnum), &regval);
190   - rio_mport_write_config_32(mport, destid, hopcount,
  187 + rio_write_config_32(rdev,
191 188 TSI578_SP_INT_STATUS(portnum),
192 189 regval & 0x000700bd);
193 190  
194 191 /* Enable all interrupts to allow ports to send a port-write */
195   - rio_mport_read_config_32(mport, destid, hopcount,
  192 + rio_read_config_32(rdev,
196 193 TSI578_SP_CTL_INDEP(portnum), &regval);
197   - rio_mport_write_config_32(mport, destid, hopcount,
  194 + rio_write_config_32(rdev,
198 195 TSI578_SP_CTL_INDEP(portnum),
199 196 regval | 0x000b0000);
200 197  
201 198 /* Skip next (odd) port if the current port is in x4 mode */
202   - rio_mport_read_config_32(mport, destid, hopcount,
  199 + rio_read_config_32(rdev,
203 200 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum),
204 201 &regval);
205 202 if ((regval & RIO_PORT_N_CTL_PWIDTH) == RIO_PORT_N_CTL_PWIDTH_4)
... ... @@ -207,7 +204,7 @@
207 204 }
208 205  
209 206 /* set TVAL = ~50us */
210   - rio_mport_write_config_32(mport, destid, hopcount,
  207 + rio_write_config_32(rdev,
211 208 rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x9a << 8);
212 209  
213 210 return 0;
214 211  
... ... @@ -217,14 +214,12 @@
217 214 tsi57x_em_handler(struct rio_dev *rdev, u8 portnum)
218 215 {
219 216 struct rio_mport *mport = rdev->net->hport;
220   - u16 destid = rdev->rswitch->destid;
221   - u8 hopcount = rdev->rswitch->hopcount;
222 217 u32 intstat, err_status;
223 218 int sendcount, checkcount;
224 219 u8 route_port;
225 220 u32 regval;
226 221  
227   - rio_mport_read_config_32(mport, destid, hopcount,
  222 + rio_read_config_32(rdev,
228 223 rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
229 224 &err_status);
230 225  
231 226  
232 227  
... ... @@ -232,15 +227,15 @@
232 227 (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
233 228 RIO_PORT_N_ERR_STS_PW_INP_ES))) {
234 229 /* Remove any queued packets by locking/unlocking port */
235   - rio_mport_read_config_32(mport, destid, hopcount,
  230 + rio_read_config_32(rdev,
236 231 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum),
237 232 &regval);
238 233 if (!(regval & RIO_PORT_N_CTL_LOCKOUT)) {
239   - rio_mport_write_config_32(mport, destid, hopcount,
  234 + rio_write_config_32(rdev,
240 235 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum),
241 236 regval | RIO_PORT_N_CTL_LOCKOUT);
242 237 udelay(50);
243   - rio_mport_write_config_32(mport, destid, hopcount,
  238 + rio_write_config_32(rdev,
244 239 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(portnum),
245 240 regval);
246 241 }
... ... @@ -248,7 +243,7 @@
248 243 /* Read from link maintenance response register to clear
249 244 * valid bit
250 245 */
251   - rio_mport_read_config_32(mport, destid, hopcount,
  246 + rio_read_config_32(rdev,
252 247 rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(portnum),
253 248 &regval);
254 249  
255 250  
... ... @@ -257,13 +252,12 @@
257 252 */
258 253 sendcount = 3;
259 254 while (sendcount) {
260   - rio_mport_write_config_32(mport, destid, hopcount,
  255 + rio_write_config_32(rdev,
261 256 TSI578_SP_CS_TX(portnum), 0x40fc8000);
262 257 checkcount = 3;
263 258 while (checkcount--) {
264 259 udelay(50);
265   - rio_mport_read_config_32(
266   - mport, destid, hopcount,
  260 + rio_read_config_32(rdev,
267 261 rdev->phys_efptr +
268 262 RIO_PORT_N_MNT_RSP_CSR(portnum),
269 263 &regval);
270 264  
271 265  
272 266  
273 267  
... ... @@ -277,25 +271,23 @@
277 271  
278 272 exit_es:
279 273 /* Clear implementation specific error status bits */
280   - rio_mport_read_config_32(mport, destid, hopcount,
281   - TSI578_SP_INT_STATUS(portnum), &intstat);
  274 + rio_read_config_32(rdev, TSI578_SP_INT_STATUS(portnum), &intstat);
282 275 pr_debug("TSI578[%x:%x] SP%d_INT_STATUS=0x%08x\n",
283   - destid, hopcount, portnum, intstat);
  276 + rdev->destid, rdev->hopcount, portnum, intstat);
284 277  
285 278 if (intstat & 0x10000) {
286   - rio_mport_read_config_32(mport, destid, hopcount,
  279 + rio_read_config_32(rdev,
287 280 TSI578_SP_LUT_PEINF(portnum), &regval);
288 281 regval = (mport->sys_size) ? (regval >> 16) : (regval >> 24);
289 282 route_port = rdev->rswitch->route_table[regval];
290 283 pr_debug("RIO: TSI578[%s] P%d LUT Parity Error (destID=%d)\n",
291 284 rio_name(rdev), portnum, regval);
292   - tsi57x_route_add_entry(mport, destid, hopcount,
  285 + tsi57x_route_add_entry(mport, rdev->destid, rdev->hopcount,
293 286 RIO_GLOBAL_TABLE, regval, route_port);
294 287 }
295 288  
296   - rio_mport_write_config_32(mport, destid, hopcount,
297   - TSI578_SP_INT_STATUS(portnum),
298   - intstat & 0x000700bd);
  289 + rio_write_config_32(rdev, TSI578_SP_INT_STATUS(portnum),
  290 + intstat & 0x000700bd);
299 291  
300 292 return 0;
301 293 }
... ... @@ -98,7 +98,8 @@
98 98 * @dev: Device model device
99 99 * @riores: RIO resources this device owns
100 100 * @pwcback: port-write callback function for this device
101   - * @destid: Network destination ID
  101 + * @destid: Network destination ID (or associated destid for switch)
  102 + * @hopcount: Hopcount to this device
102 103 * @prev: Previous RIO device connected to the current one
103 104 */
104 105 struct rio_dev {
... ... @@ -126,6 +127,7 @@
126 127 struct resource riores[RIO_MAX_DEV_RESOURCES];
127 128 int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);
128 129 u16 destid;
  130 + u8 hopcount;
129 131 struct rio_dev *prev;
130 132 };
131 133  
... ... @@ -229,8 +231,6 @@
229 231 * @node: Node in global list of switches
230 232 * @rdev: Associated RIO device structure
231 233 * @switchid: Switch ID that is unique across a network
232   - * @hopcount: Hopcount to this switch
233   - * @destid: Associated destid in the path
234 234 * @route_table: Copy of switch routing table
235 235 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
236 236 * @add_entry: Callback for switch-specific route add function
... ... @@ -247,8 +247,6 @@
247 247 struct list_head node;
248 248 struct rio_dev *rdev;
249 249 u16 switchid;
250   - u16 hopcount;
251   - u16 destid;
252 250 u8 *route_table;
253 251 u32 port_ok;
254 252 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
include/linux/rio_drv.h
... ... @@ -150,16 +150,8 @@
150 150 static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset,
151 151 u32 * data)
152 152 {
153   - u8 hopcount = 0xff;
154   - u16 destid = rdev->destid;
155   -
156   - if (rdev->rswitch) {
157   - destid = rdev->rswitch->destid;
158   - hopcount = rdev->rswitch->hopcount;
159   - }
160   -
161   - return rio_mport_read_config_32(rdev->net->hport, destid, hopcount,
162   - offset, data);
  153 + return rio_mport_read_config_32(rdev->net->hport, rdev->destid,
  154 + rdev->hopcount, offset, data);
163 155 };
164 156  
165 157 /**
... ... @@ -174,16 +166,8 @@
174 166 static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset,
175 167 u32 data)
176 168 {
177   - u8 hopcount = 0xff;
178   - u16 destid = rdev->destid;
179   -
180   - if (rdev->rswitch) {
181   - destid = rdev->rswitch->destid;
182   - hopcount = rdev->rswitch->hopcount;
183   - }
184   -
185   - return rio_mport_write_config_32(rdev->net->hport, destid, hopcount,
186   - offset, data);
  169 + return rio_mport_write_config_32(rdev->net->hport, rdev->destid,
  170 + rdev->hopcount, offset, data);
187 171 };
188 172  
189 173 /**
... ... @@ -198,16 +182,8 @@
198 182 static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset,
199 183 u16 * data)
200 184 {
201   - u8 hopcount = 0xff;
202   - u16 destid = rdev->destid;
203   -
204   - if (rdev->rswitch) {
205   - destid = rdev->rswitch->destid;
206   - hopcount = rdev->rswitch->hopcount;
207   - }
208   -
209   - return rio_mport_read_config_16(rdev->net->hport, destid, hopcount,
210   - offset, data);
  185 + return rio_mport_read_config_16(rdev->net->hport, rdev->destid,
  186 + rdev->hopcount, offset, data);
211 187 };
212 188  
213 189 /**
... ... @@ -222,16 +198,8 @@
222 198 static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset,
223 199 u16 data)
224 200 {
225   - u8 hopcount = 0xff;
226   - u16 destid = rdev->destid;
227   -
228   - if (rdev->rswitch) {
229   - destid = rdev->rswitch->destid;
230   - hopcount = rdev->rswitch->hopcount;
231   - }
232   -
233   - return rio_mport_write_config_16(rdev->net->hport, destid, hopcount,
234   - offset, data);
  201 + return rio_mport_write_config_16(rdev->net->hport, rdev->destid,
  202 + rdev->hopcount, offset, data);
235 203 };
236 204  
237 205 /**
... ... @@ -245,16 +213,8 @@
245 213 */
246 214 static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data)
247 215 {
248   - u8 hopcount = 0xff;
249   - u16 destid = rdev->destid;
250   -
251   - if (rdev->rswitch) {
252   - destid = rdev->rswitch->destid;
253   - hopcount = rdev->rswitch->hopcount;
254   - }
255   -
256   - return rio_mport_read_config_8(rdev->net->hport, destid, hopcount,
257   - offset, data);
  216 + return rio_mport_read_config_8(rdev->net->hport, rdev->destid,
  217 + rdev->hopcount, offset, data);
258 218 };
259 219  
260 220 /**
... ... @@ -268,16 +228,8 @@
268 228 */
269 229 static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data)
270 230 {
271   - u8 hopcount = 0xff;
272   - u16 destid = rdev->destid;
273   -
274   - if (rdev->rswitch) {
275   - destid = rdev->rswitch->destid;
276   - hopcount = rdev->rswitch->hopcount;
277   - }
278   -
279   - return rio_mport_write_config_8(rdev->net->hport, destid, hopcount,
280   - offset, data);
  231 + return rio_mport_write_config_8(rdev->net->hport, rdev->destid,
  232 + rdev->hopcount, offset, data);
281 233 };
282 234  
283 235 extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid,