aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4/t4_hw.c')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c728
1 files changed, 728 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 5ed8db977432..5959e3ae72da 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -625,6 +625,734 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr,
625 return 0; 625 return 0;
626} 626}
627 627
628/**
629 * t4_get_regs_len - return the size of the chips register set
630 * @adapter: the adapter
631 *
632 * Returns the size of the chip's BAR0 register space.
633 */
634unsigned int t4_get_regs_len(struct adapter *adapter)
635{
636 unsigned int chip_version = CHELSIO_CHIP_VERSION(adapter->params.chip);
637
638 switch (chip_version) {
639 case CHELSIO_T4:
640 return T4_REGMAP_SIZE;
641
642 case CHELSIO_T5:
643 return T5_REGMAP_SIZE;
644 }
645
646 dev_err(adapter->pdev_dev,
647 "Unsupported chip version %d\n", chip_version);
648 return 0;
649}
650
651/**
652 * t4_get_regs - read chip registers into provided buffer
653 * @adap: the adapter
654 * @buf: register buffer
655 * @buf_size: size (in bytes) of register buffer
656 *
657 * If the provided register buffer isn't large enough for the chip's
658 * full register range, the register dump will be truncated to the
659 * register buffer's size.
660 */
661void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size)
662{
663 static const unsigned int t4_reg_ranges[] = {
664 0x1008, 0x1108,
665 0x1180, 0x11b4,
666 0x11fc, 0x123c,
667 0x1300, 0x173c,
668 0x1800, 0x18fc,
669 0x3000, 0x30d8,
670 0x30e0, 0x5924,
671 0x5960, 0x59d4,
672 0x5a00, 0x5af8,
673 0x6000, 0x6098,
674 0x6100, 0x6150,
675 0x6200, 0x6208,
676 0x6240, 0x6248,
677 0x6280, 0x6338,
678 0x6370, 0x638c,
679 0x6400, 0x643c,
680 0x6500, 0x6524,
681 0x6a00, 0x6a38,
682 0x6a60, 0x6a78,
683 0x6b00, 0x6b84,
684 0x6bf0, 0x6c84,
685 0x6cf0, 0x6d84,
686 0x6df0, 0x6e84,
687 0x6ef0, 0x6f84,
688 0x6ff0, 0x7084,
689 0x70f0, 0x7184,
690 0x71f0, 0x7284,
691 0x72f0, 0x7384,
692 0x73f0, 0x7450,
693 0x7500, 0x7530,
694 0x7600, 0x761c,
695 0x7680, 0x76cc,
696 0x7700, 0x7798,
697 0x77c0, 0x77fc,
698 0x7900, 0x79fc,
699 0x7b00, 0x7c38,
700 0x7d00, 0x7efc,
701 0x8dc0, 0x8e1c,
702 0x8e30, 0x8e78,
703 0x8ea0, 0x8f6c,
704 0x8fc0, 0x9074,
705 0x90fc, 0x90fc,
706 0x9400, 0x9458,
707 0x9600, 0x96bc,
708 0x9800, 0x9808,
709 0x9820, 0x983c,
710 0x9850, 0x9864,
711 0x9c00, 0x9c6c,
712 0x9c80, 0x9cec,
713 0x9d00, 0x9d6c,
714 0x9d80, 0x9dec,
715 0x9e00, 0x9e6c,
716 0x9e80, 0x9eec,
717 0x9f00, 0x9f6c,
718 0x9f80, 0x9fec,
719 0xd004, 0xd03c,
720 0xdfc0, 0xdfe0,
721 0xe000, 0xea7c,
722 0xf000, 0x11110,
723 0x11118, 0x11190,
724 0x19040, 0x1906c,
725 0x19078, 0x19080,
726 0x1908c, 0x19124,
727 0x19150, 0x191b0,
728 0x191d0, 0x191e8,
729 0x19238, 0x1924c,
730 0x193f8, 0x19474,
731 0x19490, 0x194f8,
732 0x19800, 0x19f30,
733 0x1a000, 0x1a06c,
734 0x1a0b0, 0x1a120,
735 0x1a128, 0x1a138,
736 0x1a190, 0x1a1c4,
737 0x1a1fc, 0x1a1fc,
738 0x1e040, 0x1e04c,
739 0x1e284, 0x1e28c,
740 0x1e2c0, 0x1e2c0,
741 0x1e2e0, 0x1e2e0,
742 0x1e300, 0x1e384,
743 0x1e3c0, 0x1e3c8,
744 0x1e440, 0x1e44c,
745 0x1e684, 0x1e68c,
746 0x1e6c0, 0x1e6c0,
747 0x1e6e0, 0x1e6e0,
748 0x1e700, 0x1e784,
749 0x1e7c0, 0x1e7c8,
750 0x1e840, 0x1e84c,
751 0x1ea84, 0x1ea8c,
752 0x1eac0, 0x1eac0,
753 0x1eae0, 0x1eae0,
754 0x1eb00, 0x1eb84,
755 0x1ebc0, 0x1ebc8,
756 0x1ec40, 0x1ec4c,
757 0x1ee84, 0x1ee8c,
758 0x1eec0, 0x1eec0,
759 0x1eee0, 0x1eee0,
760 0x1ef00, 0x1ef84,
761 0x1efc0, 0x1efc8,
762 0x1f040, 0x1f04c,
763 0x1f284, 0x1f28c,
764 0x1f2c0, 0x1f2c0,
765 0x1f2e0, 0x1f2e0,
766 0x1f300, 0x1f384,
767 0x1f3c0, 0x1f3c8,
768 0x1f440, 0x1f44c,
769 0x1f684, 0x1f68c,
770 0x1f6c0, 0x1f6c0,
771 0x1f6e0, 0x1f6e0,
772 0x1f700, 0x1f784,
773 0x1f7c0, 0x1f7c8,
774 0x1f840, 0x1f84c,
775 0x1fa84, 0x1fa8c,
776 0x1fac0, 0x1fac0,
777 0x1fae0, 0x1fae0,
778 0x1fb00, 0x1fb84,
779 0x1fbc0, 0x1fbc8,
780 0x1fc40, 0x1fc4c,
781 0x1fe84, 0x1fe8c,
782 0x1fec0, 0x1fec0,
783 0x1fee0, 0x1fee0,
784 0x1ff00, 0x1ff84,
785 0x1ffc0, 0x1ffc8,
786 0x20000, 0x2002c,
787 0x20100, 0x2013c,
788 0x20190, 0x201c8,
789 0x20200, 0x20318,
790 0x20400, 0x20528,
791 0x20540, 0x20614,
792 0x21000, 0x21040,
793 0x2104c, 0x21060,
794 0x210c0, 0x210ec,
795 0x21200, 0x21268,
796 0x21270, 0x21284,
797 0x212fc, 0x21388,
798 0x21400, 0x21404,
799 0x21500, 0x21518,
800 0x2152c, 0x2153c,
801 0x21550, 0x21554,
802 0x21600, 0x21600,
803 0x21608, 0x21628,
804 0x21630, 0x2163c,
805 0x21700, 0x2171c,
806 0x21780, 0x2178c,
807 0x21800, 0x21c38,
808 0x21c80, 0x21d7c,
809 0x21e00, 0x21e04,
810 0x22000, 0x2202c,
811 0x22100, 0x2213c,
812 0x22190, 0x221c8,
813 0x22200, 0x22318,
814 0x22400, 0x22528,
815 0x22540, 0x22614,
816 0x23000, 0x23040,
817 0x2304c, 0x23060,
818 0x230c0, 0x230ec,
819 0x23200, 0x23268,
820 0x23270, 0x23284,
821 0x232fc, 0x23388,
822 0x23400, 0x23404,
823 0x23500, 0x23518,
824 0x2352c, 0x2353c,
825 0x23550, 0x23554,
826 0x23600, 0x23600,
827 0x23608, 0x23628,
828 0x23630, 0x2363c,
829 0x23700, 0x2371c,
830 0x23780, 0x2378c,
831 0x23800, 0x23c38,
832 0x23c80, 0x23d7c,
833 0x23e00, 0x23e04,
834 0x24000, 0x2402c,
835 0x24100, 0x2413c,
836 0x24190, 0x241c8,
837 0x24200, 0x24318,
838 0x24400, 0x24528,
839 0x24540, 0x24614,
840 0x25000, 0x25040,
841 0x2504c, 0x25060,
842 0x250c0, 0x250ec,
843 0x25200, 0x25268,
844 0x25270, 0x25284,
845 0x252fc, 0x25388,
846 0x25400, 0x25404,
847 0x25500, 0x25518,
848 0x2552c, 0x2553c,
849 0x25550, 0x25554,
850 0x25600, 0x25600,
851 0x25608, 0x25628,
852 0x25630, 0x2563c,
853 0x25700, 0x2571c,
854 0x25780, 0x2578c,
855 0x25800, 0x25c38,
856 0x25c80, 0x25d7c,
857 0x25e00, 0x25e04,
858 0x26000, 0x2602c,
859 0x26100, 0x2613c,
860 0x26190, 0x261c8,
861 0x26200, 0x26318,
862 0x26400, 0x26528,
863 0x26540, 0x26614,
864 0x27000, 0x27040,
865 0x2704c, 0x27060,
866 0x270c0, 0x270ec,
867 0x27200, 0x27268,
868 0x27270, 0x27284,
869 0x272fc, 0x27388,
870 0x27400, 0x27404,
871 0x27500, 0x27518,
872 0x2752c, 0x2753c,
873 0x27550, 0x27554,
874 0x27600, 0x27600,
875 0x27608, 0x27628,
876 0x27630, 0x2763c,
877 0x27700, 0x2771c,
878 0x27780, 0x2778c,
879 0x27800, 0x27c38,
880 0x27c80, 0x27d7c,
881 0x27e00, 0x27e04
882 };
883
884 static const unsigned int t5_reg_ranges[] = {
885 0x1008, 0x1148,
886 0x1180, 0x11b4,
887 0x11fc, 0x123c,
888 0x1280, 0x173c,
889 0x1800, 0x18fc,
890 0x3000, 0x3028,
891 0x3060, 0x30d8,
892 0x30e0, 0x30fc,
893 0x3140, 0x357c,
894 0x35a8, 0x35cc,
895 0x35ec, 0x35ec,
896 0x3600, 0x5624,
897 0x56cc, 0x575c,
898 0x580c, 0x5814,
899 0x5890, 0x58bc,
900 0x5940, 0x59dc,
901 0x59fc, 0x5a18,
902 0x5a60, 0x5a9c,
903 0x5b9c, 0x5bfc,
904 0x6000, 0x6040,
905 0x6058, 0x614c,
906 0x7700, 0x7798,
907 0x77c0, 0x78fc,
908 0x7b00, 0x7c54,
909 0x7d00, 0x7efc,
910 0x8dc0, 0x8de0,
911 0x8df8, 0x8e84,
912 0x8ea0, 0x8f84,
913 0x8fc0, 0x90f8,
914 0x9400, 0x9470,
915 0x9600, 0x96f4,
916 0x9800, 0x9808,
917 0x9820, 0x983c,
918 0x9850, 0x9864,
919 0x9c00, 0x9c6c,
920 0x9c80, 0x9cec,
921 0x9d00, 0x9d6c,
922 0x9d80, 0x9dec,
923 0x9e00, 0x9e6c,
924 0x9e80, 0x9eec,
925 0x9f00, 0x9f6c,
926 0x9f80, 0xa020,
927 0xd004, 0xd03c,
928 0xdfc0, 0xdfe0,
929 0xe000, 0x11088,
930 0x1109c, 0x11110,
931 0x11118, 0x1117c,
932 0x11190, 0x11204,
933 0x19040, 0x1906c,
934 0x19078, 0x19080,
935 0x1908c, 0x19124,
936 0x19150, 0x191b0,
937 0x191d0, 0x191e8,
938 0x19238, 0x19290,
939 0x193f8, 0x19474,
940 0x19490, 0x194cc,
941 0x194f0, 0x194f8,
942 0x19c00, 0x19c60,
943 0x19c94, 0x19e10,
944 0x19e50, 0x19f34,
945 0x19f40, 0x19f50,
946 0x19f90, 0x19fe4,
947 0x1a000, 0x1a06c,
948 0x1a0b0, 0x1a120,
949 0x1a128, 0x1a138,
950 0x1a190, 0x1a1c4,
951 0x1a1fc, 0x1a1fc,
952 0x1e008, 0x1e00c,
953 0x1e040, 0x1e04c,
954 0x1e284, 0x1e290,
955 0x1e2c0, 0x1e2c0,
956 0x1e2e0, 0x1e2e0,
957 0x1e300, 0x1e384,
958 0x1e3c0, 0x1e3c8,
959 0x1e408, 0x1e40c,
960 0x1e440, 0x1e44c,
961 0x1e684, 0x1e690,
962 0x1e6c0, 0x1e6c0,
963 0x1e6e0, 0x1e6e0,
964 0x1e700, 0x1e784,
965 0x1e7c0, 0x1e7c8,
966 0x1e808, 0x1e80c,
967 0x1e840, 0x1e84c,
968 0x1ea84, 0x1ea90,
969 0x1eac0, 0x1eac0,
970 0x1eae0, 0x1eae0,
971 0x1eb00, 0x1eb84,
972 0x1ebc0, 0x1ebc8,
973 0x1ec08, 0x1ec0c,
974 0x1ec40, 0x1ec4c,
975 0x1ee84, 0x1ee90,
976 0x1eec0, 0x1eec0,
977 0x1eee0, 0x1eee0,
978 0x1ef00, 0x1ef84,
979 0x1efc0, 0x1efc8,
980 0x1f008, 0x1f00c,
981 0x1f040, 0x1f04c,
982 0x1f284, 0x1f290,
983 0x1f2c0, 0x1f2c0,
984 0x1f2e0, 0x1f2e0,
985 0x1f300, 0x1f384,
986 0x1f3c0, 0x1f3c8,
987 0x1f408, 0x1f40c,
988 0x1f440, 0x1f44c,
989 0x1f684, 0x1f690,
990 0x1f6c0, 0x1f6c0,
991 0x1f6e0, 0x1f6e0,
992 0x1f700, 0x1f784,
993 0x1f7c0, 0x1f7c8,
994 0x1f808, 0x1f80c,
995 0x1f840, 0x1f84c,
996 0x1fa84, 0x1fa90,
997 0x1fac0, 0x1fac0,
998 0x1fae0, 0x1fae0,
999 0x1fb00, 0x1fb84,
1000 0x1fbc0, 0x1fbc8,
1001 0x1fc08, 0x1fc0c,
1002 0x1fc40, 0x1fc4c,
1003 0x1fe84, 0x1fe90,
1004 0x1fec0, 0x1fec0,
1005 0x1fee0, 0x1fee0,
1006 0x1ff00, 0x1ff84,
1007 0x1ffc0, 0x1ffc8,
1008 0x30000, 0x30030,
1009 0x30100, 0x30144,
1010 0x30190, 0x301d0,
1011 0x30200, 0x30318,
1012 0x30400, 0x3052c,
1013 0x30540, 0x3061c,
1014 0x30800, 0x30834,
1015 0x308c0, 0x30908,
1016 0x30910, 0x309ac,
1017 0x30a00, 0x30a04,
1018 0x30a0c, 0x30a2c,
1019 0x30a44, 0x30a50,
1020 0x30a74, 0x30c24,
1021 0x30d08, 0x30d14,
1022 0x30d1c, 0x30d20,
1023 0x30d3c, 0x30d50,
1024 0x31200, 0x3120c,
1025 0x31220, 0x31220,
1026 0x31240, 0x31240,
1027 0x31600, 0x31600,
1028 0x31608, 0x3160c,
1029 0x31a00, 0x31a1c,
1030 0x31e04, 0x31e20,
1031 0x31e38, 0x31e3c,
1032 0x31e80, 0x31e80,
1033 0x31e88, 0x31ea8,
1034 0x31eb0, 0x31eb4,
1035 0x31ec8, 0x31ed4,
1036 0x31fb8, 0x32004,
1037 0x32208, 0x3223c,
1038 0x32600, 0x32630,
1039 0x32a00, 0x32abc,
1040 0x32b00, 0x32b70,
1041 0x33000, 0x33048,
1042 0x33060, 0x3309c,
1043 0x330f0, 0x33148,
1044 0x33160, 0x3319c,
1045 0x331f0, 0x332e4,
1046 0x332f8, 0x333e4,
1047 0x333f8, 0x33448,
1048 0x33460, 0x3349c,
1049 0x334f0, 0x33548,
1050 0x33560, 0x3359c,
1051 0x335f0, 0x336e4,
1052 0x336f8, 0x337e4,
1053 0x337f8, 0x337fc,
1054 0x33814, 0x33814,
1055 0x3382c, 0x3382c,
1056 0x33880, 0x3388c,
1057 0x338e8, 0x338ec,
1058 0x33900, 0x33948,
1059 0x33960, 0x3399c,
1060 0x339f0, 0x33ae4,
1061 0x33af8, 0x33b10,
1062 0x33b28, 0x33b28,
1063 0x33b3c, 0x33b50,
1064 0x33bf0, 0x33c10,
1065 0x33c28, 0x33c28,
1066 0x33c3c, 0x33c50,
1067 0x33cf0, 0x33cfc,
1068 0x34000, 0x34030,
1069 0x34100, 0x34144,
1070 0x34190, 0x341d0,
1071 0x34200, 0x34318,
1072 0x34400, 0x3452c,
1073 0x34540, 0x3461c,
1074 0x34800, 0x34834,
1075 0x348c0, 0x34908,
1076 0x34910, 0x349ac,
1077 0x34a00, 0x34a04,
1078 0x34a0c, 0x34a2c,
1079 0x34a44, 0x34a50,
1080 0x34a74, 0x34c24,
1081 0x34d08, 0x34d14,
1082 0x34d1c, 0x34d20,
1083 0x34d3c, 0x34d50,
1084 0x35200, 0x3520c,
1085 0x35220, 0x35220,
1086 0x35240, 0x35240,
1087 0x35600, 0x35600,
1088 0x35608, 0x3560c,
1089 0x35a00, 0x35a1c,
1090 0x35e04, 0x35e20,
1091 0x35e38, 0x35e3c,
1092 0x35e80, 0x35e80,
1093 0x35e88, 0x35ea8,
1094 0x35eb0, 0x35eb4,
1095 0x35ec8, 0x35ed4,
1096 0x35fb8, 0x36004,
1097 0x36208, 0x3623c,
1098 0x36600, 0x36630,
1099 0x36a00, 0x36abc,
1100 0x36b00, 0x36b70,
1101 0x37000, 0x37048,
1102 0x37060, 0x3709c,
1103 0x370f0, 0x37148,
1104 0x37160, 0x3719c,
1105 0x371f0, 0x372e4,
1106 0x372f8, 0x373e4,
1107 0x373f8, 0x37448,
1108 0x37460, 0x3749c,
1109 0x374f0, 0x37548,
1110 0x37560, 0x3759c,
1111 0x375f0, 0x376e4,
1112 0x376f8, 0x377e4,
1113 0x377f8, 0x377fc,
1114 0x37814, 0x37814,
1115 0x3782c, 0x3782c,
1116 0x37880, 0x3788c,
1117 0x378e8, 0x378ec,
1118 0x37900, 0x37948,
1119 0x37960, 0x3799c,
1120 0x379f0, 0x37ae4,
1121 0x37af8, 0x37b10,
1122 0x37b28, 0x37b28,
1123 0x37b3c, 0x37b50,
1124 0x37bf0, 0x37c10,
1125 0x37c28, 0x37c28,
1126 0x37c3c, 0x37c50,
1127 0x37cf0, 0x37cfc,
1128 0x38000, 0x38030,
1129 0x38100, 0x38144,
1130 0x38190, 0x381d0,
1131 0x38200, 0x38318,
1132 0x38400, 0x3852c,
1133 0x38540, 0x3861c,
1134 0x38800, 0x38834,
1135 0x388c0, 0x38908,
1136 0x38910, 0x389ac,
1137 0x38a00, 0x38a04,
1138 0x38a0c, 0x38a2c,
1139 0x38a44, 0x38a50,
1140 0x38a74, 0x38c24,
1141 0x38d08, 0x38d14,
1142 0x38d1c, 0x38d20,
1143 0x38d3c, 0x38d50,
1144 0x39200, 0x3920c,
1145 0x39220, 0x39220,
1146 0x39240, 0x39240,
1147 0x39600, 0x39600,
1148 0x39608, 0x3960c,
1149 0x39a00, 0x39a1c,
1150 0x39e04, 0x39e20,
1151 0x39e38, 0x39e3c,
1152 0x39e80, 0x39e80,
1153 0x39e88, 0x39ea8,
1154 0x39eb0, 0x39eb4,
1155 0x39ec8, 0x39ed4,
1156 0x39fb8, 0x3a004,
1157 0x3a208, 0x3a23c,
1158 0x3a600, 0x3a630,
1159 0x3aa00, 0x3aabc,
1160 0x3ab00, 0x3ab70,
1161 0x3b000, 0x3b048,
1162 0x3b060, 0x3b09c,
1163 0x3b0f0, 0x3b148,
1164 0x3b160, 0x3b19c,
1165 0x3b1f0, 0x3b2e4,
1166 0x3b2f8, 0x3b3e4,
1167 0x3b3f8, 0x3b448,
1168 0x3b460, 0x3b49c,
1169 0x3b4f0, 0x3b548,
1170 0x3b560, 0x3b59c,
1171 0x3b5f0, 0x3b6e4,
1172 0x3b6f8, 0x3b7e4,
1173 0x3b7f8, 0x3b7fc,
1174 0x3b814, 0x3b814,
1175 0x3b82c, 0x3b82c,
1176 0x3b880, 0x3b88c,
1177 0x3b8e8, 0x3b8ec,
1178 0x3b900, 0x3b948,
1179 0x3b960, 0x3b99c,
1180 0x3b9f0, 0x3bae4,
1181 0x3baf8, 0x3bb10,
1182 0x3bb28, 0x3bb28,
1183 0x3bb3c, 0x3bb50,
1184 0x3bbf0, 0x3bc10,
1185 0x3bc28, 0x3bc28,
1186 0x3bc3c, 0x3bc50,
1187 0x3bcf0, 0x3bcfc,
1188 0x3c000, 0x3c030,
1189 0x3c100, 0x3c144,
1190 0x3c190, 0x3c1d0,
1191 0x3c200, 0x3c318,
1192 0x3c400, 0x3c52c,
1193 0x3c540, 0x3c61c,
1194 0x3c800, 0x3c834,
1195 0x3c8c0, 0x3c908,
1196 0x3c910, 0x3c9ac,
1197 0x3ca00, 0x3ca04,
1198 0x3ca0c, 0x3ca2c,
1199 0x3ca44, 0x3ca50,
1200 0x3ca74, 0x3cc24,
1201 0x3cd08, 0x3cd14,
1202 0x3cd1c, 0x3cd20,
1203 0x3cd3c, 0x3cd50,
1204 0x3d200, 0x3d20c,
1205 0x3d220, 0x3d220,
1206 0x3d240, 0x3d240,
1207 0x3d600, 0x3d600,
1208 0x3d608, 0x3d60c,
1209 0x3da00, 0x3da1c,
1210 0x3de04, 0x3de20,
1211 0x3de38, 0x3de3c,
1212 0x3de80, 0x3de80,
1213 0x3de88, 0x3dea8,
1214 0x3deb0, 0x3deb4,
1215 0x3dec8, 0x3ded4,
1216 0x3dfb8, 0x3e004,
1217 0x3e208, 0x3e23c,
1218 0x3e600, 0x3e630,
1219 0x3ea00, 0x3eabc,
1220 0x3eb00, 0x3eb70,
1221 0x3f000, 0x3f048,
1222 0x3f060, 0x3f09c,
1223 0x3f0f0, 0x3f148,
1224 0x3f160, 0x3f19c,
1225 0x3f1f0, 0x3f2e4,
1226 0x3f2f8, 0x3f3e4,
1227 0x3f3f8, 0x3f448,
1228 0x3f460, 0x3f49c,
1229 0x3f4f0, 0x3f548,
1230 0x3f560, 0x3f59c,
1231 0x3f5f0, 0x3f6e4,
1232 0x3f6f8, 0x3f7e4,
1233 0x3f7f8, 0x3f7fc,
1234 0x3f814, 0x3f814,
1235 0x3f82c, 0x3f82c,
1236 0x3f880, 0x3f88c,
1237 0x3f8e8, 0x3f8ec,
1238 0x3f900, 0x3f948,
1239 0x3f960, 0x3f99c,
1240 0x3f9f0, 0x3fae4,
1241 0x3faf8, 0x3fb10,
1242 0x3fb28, 0x3fb28,
1243 0x3fb3c, 0x3fb50,
1244 0x3fbf0, 0x3fc10,
1245 0x3fc28, 0x3fc28,
1246 0x3fc3c, 0x3fc50,
1247 0x3fcf0, 0x3fcfc,
1248 0x40000, 0x4000c,
1249 0x40040, 0x40068,
1250 0x40080, 0x40144,
1251 0x40180, 0x4018c,
1252 0x40200, 0x40298,
1253 0x402ac, 0x4033c,
1254 0x403f8, 0x403fc,
1255 0x41304, 0x413c4,
1256 0x41400, 0x4141c,
1257 0x41480, 0x414d0,
1258 0x44000, 0x44078,
1259 0x440c0, 0x44278,
1260 0x442c0, 0x44478,
1261 0x444c0, 0x44678,
1262 0x446c0, 0x44878,
1263 0x448c0, 0x449fc,
1264 0x45000, 0x45068,
1265 0x45080, 0x45084,
1266 0x450a0, 0x450b0,
1267 0x45200, 0x45268,
1268 0x45280, 0x45284,
1269 0x452a0, 0x452b0,
1270 0x460c0, 0x460e4,
1271 0x47000, 0x4708c,
1272 0x47200, 0x47250,
1273 0x47400, 0x47420,
1274 0x47600, 0x47618,
1275 0x47800, 0x47814,
1276 0x48000, 0x4800c,
1277 0x48040, 0x48068,
1278 0x48080, 0x48144,
1279 0x48180, 0x4818c,
1280 0x48200, 0x48298,
1281 0x482ac, 0x4833c,
1282 0x483f8, 0x483fc,
1283 0x49304, 0x493c4,
1284 0x49400, 0x4941c,
1285 0x49480, 0x494d0,
1286 0x4c000, 0x4c078,
1287 0x4c0c0, 0x4c278,
1288 0x4c2c0, 0x4c478,
1289 0x4c4c0, 0x4c678,
1290 0x4c6c0, 0x4c878,
1291 0x4c8c0, 0x4c9fc,
1292 0x4d000, 0x4d068,
1293 0x4d080, 0x4d084,
1294 0x4d0a0, 0x4d0b0,
1295 0x4d200, 0x4d268,
1296 0x4d280, 0x4d284,
1297 0x4d2a0, 0x4d2b0,
1298 0x4e0c0, 0x4e0e4,
1299 0x4f000, 0x4f08c,
1300 0x4f200, 0x4f250,
1301 0x4f400, 0x4f420,
1302 0x4f600, 0x4f618,
1303 0x4f800, 0x4f814,
1304 0x50000, 0x500cc,
1305 0x50400, 0x50400,
1306 0x50800, 0x508cc,
1307 0x50c00, 0x50c00,
1308 0x51000, 0x5101c,
1309 0x51300, 0x51308,
1310 };
1311
1312 u32 *buf_end = (u32 *)((char *)buf + buf_size);
1313 const unsigned int *reg_ranges;
1314 int reg_ranges_size, range;
1315 unsigned int chip_version = CHELSIO_CHIP_VERSION(adap->params.chip);
1316
1317 /* Select the right set of register ranges to dump depending on the
1318 * adapter chip type.
1319 */
1320 switch (chip_version) {
1321 case CHELSIO_T4:
1322 reg_ranges = t4_reg_ranges;
1323 reg_ranges_size = ARRAY_SIZE(t4_reg_ranges);
1324 break;
1325
1326 case CHELSIO_T5:
1327 reg_ranges = t5_reg_ranges;
1328 reg_ranges_size = ARRAY_SIZE(t5_reg_ranges);
1329 break;
1330
1331 default:
1332 dev_err(adap->pdev_dev,
1333 "Unsupported chip version %d\n", chip_version);
1334 return;
1335 }
1336
1337 /* Clear the register buffer and insert the appropriate register
1338 * values selected by the above register ranges.
1339 */
1340 memset(buf, 0, buf_size);
1341 for (range = 0; range < reg_ranges_size; range += 2) {
1342 unsigned int reg = reg_ranges[range];
1343 unsigned int last_reg = reg_ranges[range + 1];
1344 u32 *bufp = (u32 *)((char *)buf + reg);
1345
1346 /* Iterate across the register range filling in the register
1347 * buffer but don't write past the end of the register buffer.
1348 */
1349 while (reg <= last_reg && bufp < buf_end) {
1350 *bufp++ = t4_read_reg(adap, reg);
1351 reg += sizeof(u32);
1352 }
1353 }
1354}
1355
628#define EEPROM_STAT_ADDR 0x7bfc 1356#define EEPROM_STAT_ADDR 0x7bfc
629#define VPD_BASE 0x400 1357#define VPD_BASE 0x400
630#define VPD_BASE_OLD 0 1358#define VPD_BASE_OLD 0