lkml.org 
[lkml]   [2021]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3] PCI: dwc: Add support for vendor specific capability search
From
Date


On 5/22/2021 5:01 AM, Krzysztof Wilczyński wrote:
> External email: Use caution opening links or attachments
>
>
> Hi Shradha,
>
> [...]
>> +u16 dw_pcie_find_vsec_capability(struct dw_pcie *pci, u8 vsec_cap)
>> +{
>> + u16 vsec = 0;
>> + u32 header;
>> +
>> + while ((vsec = dw_pcie_find_next_ext_capability(pci, vsec,
>> + PCI_EXT_CAP_ID_VNDR))) {
>> + header = dw_pcie_readl_dbi(pci, vsec + PCI_VNDR_HEADER);
>> + if (PCI_VNDR_HEADER_ID(header) == vsec_cap)
>> + return vsec;
>> + }
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(dw_pcie_find_vsec_capability);
>
> A small question as I am curious: why not use pci_find_vsec_capability()
> here? The implementation looks very similar, which is why I am asking,
> but it might be that I am missing something, and for that I apologise in
> advance.
pci_find_vsec_capability() expects struct pci_dev * which we get only
after enumeration is done. In the current scenario, we are still in
pre-link up phase and don't have struct pci_dev * yet, hence this
implementation, right Shradha??

>
> Krzysztof
>

\
 
 \ /
  Last update: 2021-05-27 13:50    [W:2.636 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site