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)
Jan 13 2024, 3:41 AM
Unknown Object (File)
Dec 23 2023, 1:52 PM
Unknown Object (File)
Nov 16 2023, 12:33 AM
Unknown Object (File)
Nov 10 2023, 6:36 PM
Unknown Object (File)
Nov 10 2023, 1:10 PM
Unknown Object (File)
Nov 8 2023, 1:01 PM
Unknown Object (File)
Nov 7 2023, 8:49 AM
Unknown Object (File)
Nov 5 2023, 4:06 AM
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.