Commit 7b8a8ec2 authored by Yishai Hadas's avatar Yishai Hadas Committed by Leon Romanovsky
Browse files

PCI/TPH: Expose pcie_tph_get_st_table_loc()



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

Signed-off-by: default avatarYishai Hadas <yishaih@nvidia.com>
Signed-off-by: default avatarEdward Srouji <edwards@nvidia.com>
Link: https://patch.msgid.link/20251027-st-direct-mode-v1-1-e0ad953866b6@nvidia.com


Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent eea31f21
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -155,7 +155,16 @@ static u8 get_st_modes(struct pci_dev *pdev)
	return reg;
}

static u32 get_st_table_loc(struct pci_dev *pdev)
/**
 * pcie_tph_get_st_table_loc - Return the device's ST table location
 * @pdev: PCI device to query
 *
 * Return:
 *  PCI_TPH_LOC_NONE - Not present
 *  PCI_TPH_LOC_CAP  - Located in the TPH Requester Extended Capability
 *  PCI_TPH_LOC_MSIX - Located in the MSI-X Table
 */
u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
{
	u32 reg;

@@ -163,6 +172,7 @@ static u32 get_st_table_loc(struct pci_dev *pdev)

	return FIELD_GET(PCI_TPH_CAP_LOC_MASK, reg);
}
EXPORT_SYMBOL(pcie_tph_get_st_table_loc);

/*
 * Return the size of ST table. If ST table is not in TPH Requester Extended
@@ -174,7 +184,7 @@ u16 pcie_tph_get_st_table_size(struct pci_dev *pdev)
	u32 loc;

	/* Check ST table location first */
	loc = get_st_table_loc(pdev);
	loc = pcie_tph_get_st_table_loc(pdev);

	/* Convert loc to match with PCI_TPH_LOC_* defined in pci_regs.h */
	loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);
@@ -299,7 +309,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)
	 */
	set_ctrl_reg_req_en(pdev, PCI_TPH_REQ_DISABLE);

	loc = get_st_table_loc(pdev);
	loc = pcie_tph_get_st_table_loc(pdev);
	/* Convert loc to match with PCI_TPH_LOC_* */
	loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);

+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ int pcie_tph_get_cpu_st(struct pci_dev *dev,
void pcie_disable_tph(struct pci_dev *pdev);
int pcie_enable_tph(struct pci_dev *pdev, int mode);
u16 pcie_tph_get_st_table_size(struct pci_dev *pdev);
u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
#else
static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
					unsigned int index, u16 tag)