Page MenuHomeFreeBSD

thunderbolt: Support writing to router config space
ClosedPublic

Authored by obiwac on Jul 13 2026, 8:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 20, 11:15 AM
Unknown Object (File)
Sun, Sep 20, 11:14 AM
Unknown Object (File)
Sun, Sep 20, 11:14 AM
Unknown Object (File)
Sun, Sep 20, 11:14 AM
Unknown Object (File)
Sat, Sep 19, 12:57 AM
Unknown Object (File)
Wed, Sep 16, 11:10 PM
Unknown Object (File)
Tue, Sep 15, 9:17 PM
Unknown Object (File)
Mon, Sep 14, 1:41 AM
Subscribers

Details

Summary

Not to be confused with PCI config space; we write to a router's config
space by preparing a write command and enqueuing it on our NHI's
transmit ring.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76880
Build 73763: arc lint + arc unit

Event Timeline

sys/dev/thunderbolt/router.c
643

size_t instead of int seems more appropropriate, but I see that this type is passed through a bunch of callers.

651–659

Would you please replace 4 with a more usable constant / reference to some documentation that describes where this constraint is defined (I realize router_prepare_read needs similar treatment)?

sys/dev/thunderbolt/tbcfg_reg.h
67 ↗(On Diff #181891)

Why remove this comment?

add back 60 dword limit comment

sys/dev/thunderbolt/router.c
643

i'm eventually going to factor out a router_prepare_cmd() function, so I'll do it that point if that's okay

651–659

sure. This is because the last 4 bytes of data contain the CRC, so we calculate the crc for just the data. ill include this comment in router_prepare_cmd()

sys/dev/thunderbolt/tbcfg_reg.h
67 ↗(On Diff #181891)

no idea lol

sys/dev/thunderbolt/router.c
643

i'm eventually going to factor out a router_prepare_cmd() function, so I'll do it that point if that's okay

Works for me!

659

Ok. One ask then to make this a bit more style(9) compliant.

667

Is the 4 here related to the 4 you're adding above? If so, it really seems deserving of a named constant (or maybe sizeof(int)?).

sys/dev/thunderbolt/router.c
667

it's the size of a dword according to the usb4 spec

sys/dev/thunderbolt/router.c
667

maybe i should replace all references to 4 as dword size with a constant - but this is used in a lot of places so i won't do that right now

obiwac marked 2 inline comments as done.

style(9)

Accepting, noting the other work you did with D59668.

This revision is now accepted and ready to land.Mon, Sep 14, 3:08 PM