Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

r8169: add helper rtl_csi_mod for accessing extended config space

Add a helper for the Realtek-specific mechanism for accessing extended
config space if native access isn't possible.
This avoids code duplication.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/b368fd91-57d7-4cb5-9342-98b4d8fe9aea@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
8c40d99e 3b4f78f9

+16 -10
+16 -10
drivers/net/ethernet/realtek/r8169_main.c
··· 2852 2852 RTL_R32(tp, CSIDR) : ~0; 2853 2853 } 2854 2854 2855 + static void rtl_csi_mod(struct rtl8169_private *tp, int addr, 2856 + u32 mask, u32 set) 2857 + { 2858 + u32 val; 2859 + 2860 + WARN(addr % 4, "Invalid CSI address %#x\n", addr); 2861 + 2862 + netdev_notice_once(tp->dev, 2863 + "No native access to PCI extended config space, falling back to CSI\n"); 2864 + 2865 + val = rtl_csi_read(tp, addr); 2866 + rtl_csi_write(tp, addr, (val & ~mask) | set); 2867 + } 2868 + 2855 2869 static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp) 2856 2870 { 2857 2871 struct pci_dev *pdev = tp->pci_dev; 2858 - u32 csi; 2859 2872 int rc; 2860 2873 u8 val; 2861 2874 ··· 2885 2872 } 2886 2873 } 2887 2874 2888 - netdev_notice_once(tp->dev, 2889 - "No native access to PCI extended config space, falling back to CSI\n"); 2890 - csi = rtl_csi_read(tp, RTL_GEN3_RELATED_OFF); 2891 - rtl_csi_write(tp, RTL_GEN3_RELATED_OFF, csi & ~RTL_GEN3_ZRXDC_NONCOMPL); 2875 + rtl_csi_mod(tp, RTL_GEN3_RELATED_OFF, RTL_GEN3_ZRXDC_NONCOMPL, 0); 2892 2876 } 2893 2877 2894 2878 static void rtl_set_aspm_entry_latency(struct rtl8169_private *tp, u8 val) 2895 2879 { 2896 2880 struct pci_dev *pdev = tp->pci_dev; 2897 - u32 csi; 2898 2881 2899 2882 /* According to Realtek the value at config space address 0x070f 2900 2883 * controls the L0s/L1 entrance latency. We try standard ECAM access ··· 2902 2893 pci_write_config_byte(pdev, 0x070f, val) == PCIBIOS_SUCCESSFUL) 2903 2894 return; 2904 2895 2905 - netdev_notice_once(tp->dev, 2906 - "No native access to PCI extended config space, falling back to CSI\n"); 2907 - csi = rtl_csi_read(tp, 0x070c) & 0x00ffffff; 2908 - rtl_csi_write(tp, 0x070c, csi | val << 24); 2896 + rtl_csi_mod(tp, 0x070c, 0xff000000, val << 24); 2909 2897 } 2910 2898 2911 2899 static void rtl_set_def_aspm_entry_latency(struct rtl8169_private *tp)