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.

PCI/TPH: Expose pcie_tph_get_st_table_size()

Expose pcie_tph_get_st_table_size() to be used by drivers as will be
done in the next patch from the series.

Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/9ae851e0ee42cc56d2a30276e116b65091030ceb.1752752567.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Yishai Hadas and committed by
Leon Romanovsky
0a61ec9c 9a0048e0

+7 -5
+6 -5
drivers/pci/tph.c
··· 168 168 * Return the size of ST table. If ST table is not in TPH Requester Extended 169 169 * Capability space, return 0. Otherwise return the ST Table Size + 1. 170 170 */ 171 - static u16 get_st_table_size(struct pci_dev *pdev) 171 + u16 pcie_tph_get_st_table_size(struct pci_dev *pdev) 172 172 { 173 173 u32 reg; 174 174 u32 loc; ··· 185 185 186 186 return FIELD_GET(PCI_TPH_CAP_ST_MASK, reg) + 1; 187 187 } 188 + EXPORT_SYMBOL(pcie_tph_get_st_table_size); 188 189 189 190 /* Return device's Root Port completer capability */ 190 191 static u8 get_rp_completer_type(struct pci_dev *pdev) ··· 212 211 int offset; 213 212 214 213 /* Check if index is out of bound */ 215 - st_table_size = get_st_table_size(pdev); 214 + st_table_size = pcie_tph_get_st_table_size(pdev); 216 215 if (index >= st_table_size) 217 216 return -ENXIO; 218 217 ··· 444 443 pci_write_config_dword(pdev, pdev->tph_cap + PCI_TPH_CTRL, *cap++); 445 444 st_entry = (u16 *)cap; 446 445 offset = PCI_TPH_BASE_SIZEOF; 447 - num_entries = get_st_table_size(pdev); 446 + num_entries = pcie_tph_get_st_table_size(pdev); 448 447 for (i = 0; i < num_entries; i++) { 449 448 pci_write_config_word(pdev, pdev->tph_cap + offset, 450 449 *st_entry++); ··· 476 475 /* Save all ST entries in extended capability structure */ 477 476 st_entry = (u16 *)cap; 478 477 offset = PCI_TPH_BASE_SIZEOF; 479 - num_entries = get_st_table_size(pdev); 478 + num_entries = pcie_tph_get_st_table_size(pdev); 480 479 for (i = 0; i < num_entries; i++) { 481 480 pci_read_config_word(pdev, pdev->tph_cap + offset, 482 481 st_entry++); ··· 500 499 if (!pdev->tph_cap) 501 500 return; 502 501 503 - num_entries = get_st_table_size(pdev); 502 + num_entries = pcie_tph_get_st_table_size(pdev); 504 503 save_size = sizeof(u32) + num_entries * sizeof(u16); 505 504 pci_add_ext_cap_save_buffer(pdev, PCI_EXT_CAP_ID_TPH, save_size); 506 505 }
+1
include/linux/pci-tph.h
··· 28 28 unsigned int cpu_uid, u16 *tag); 29 29 void pcie_disable_tph(struct pci_dev *pdev); 30 30 int pcie_enable_tph(struct pci_dev *pdev, int mode); 31 + u16 pcie_tph_get_st_table_size(struct pci_dev *pdev); 31 32 #else 32 33 static inline int pcie_tph_set_st_entry(struct pci_dev *pdev, 33 34 unsigned int index, u16 tag)