Page MenuHomeFreeBSD

Add pci_find_next_cap, pci_find_next_extcap, and pci_find_next_htcap
ClosedPublic

Authored by bryanv on Feb 11 2018, 9:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 20, 2:32 AM
Unknown Object (File)
Jan 21 2025, 9:09 AM
Unknown Object (File)
Dec 6 2024, 9:30 PM
Unknown Object (File)
Nov 26 2024, 9:05 AM
Unknown Object (File)
Sep 29 2024, 2:52 PM
Unknown Object (File)
Sep 21 2024, 9:20 AM
Unknown Object (File)
Sep 20 2024, 10:15 AM
Unknown Object (File)
Sep 17 2024, 3:37 PM
Subscribers

Details

Summary

This is used in VirtIO v1 to iterate over all the VENDOR capabilities.

Test Plan

VirtIO PCI v1 is working with pci_find_next_cap. I don't have a way to test the others.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Looks fine overall, just some suggestions / nits.

share/man/man9/pci.9
355 ↗(On Diff #39189)

Nit, drop 'the' here and in the other two places.

sys/dev/pci/pci.c
1420 ↗(On Diff #39189)

Perhaps add a KASSERT() that that 'pci_read_config(child, start + PCICAP_ID, 1) == PCIY_HT'? More paranoid would be to add a further assertion that the nested capbility in PCIR_HT_COMMAND from 'start' matches 'capability'.

1427 ↗(On Diff #39189)

Do you think this should use 'pci_find_next_cap(PCIY_HT)'?

1517 ↗(On Diff #39189)

I would add 'KASSERT(pci_read_config(child, start + PCICAP_ID, 1) == capability)' at the start.

1585 ↗(On Diff #39189)

I would change this to:

ecap = pci_read_config(child, start, 4);
KASSERT(PCI_EXTCAP_ID(ecap) == capability, ...);
ptr = PCI_EXTCAP_NEXTPTR(ecap);
bryanv added inline comments.
sys/dev/pci/pci.c
1427 ↗(On Diff #39189)

Yes. I'll change pci_find_htcap_method too.

This revision is now accepted and ready to land.Feb 16 2018, 12:11 AM
This revision was automatically updated to reflect the committed changes.
bryanv marked 2 inline comments as done.