Re: [PATCH 2/7] wifi: rtlwifi: Convert to use PCIe capability accessors

From: Bjorn Helgaas
Date: Fri Nov 17 2023 - 17:37:43 EST


On Fri, Nov 17, 2023 at 11:44:20AM +0200, Ilpo Järvinen wrote:
> The rtlwifi driver accesses PCIe capabilities through custom config
> offsets.
>
> Convert the accesses to use the normal PCIe capability accessors.
> pcibridge_pciehdr_offset in the struct mp_adapter becomes unused after
> the conversion and can be removed.

More good stuff. I guess patch [1/7] was specifically for the RMW
things, and this one is for the rest?

> @@ -219,7 +220,7 @@ static void rtl_pci_disable_aspm(struct ieee80211_hw *hw)
> }
>
> /*for promising device will in L0 state after an I/O. */
> - pci_read_config_byte(rtlpci->pdev, 0x80, &tmp_u1b);
> + pcie_capability_read_word(rtlpci->pdev, PCI_EXP_LNKCTL, &tmp_u1b);
>
> /*Set corresponding value. */
> aspmlevel |= BIT(0) | BIT(1);

I guess this is PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1?

There's also a similar u_pcibridge_aspmsetting mask in
rtl_pci_enable_aspm().

And some scary looking stuff in rtl_pci_get_amd_l1_patch(). And
platform_enable_dma64(). No clue what either of those does.