usb4_switch_nvm_write(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’Ύ usb4_switch_nvm_write(9) β€” kernel API manual, bestie edition ✨

Okay so bestie, listen β€” this is a page from the Kernel API Manual about usb4_switch_nvm_write, and it's lowkey iconic. We're writing bytes straight into a router's NVM. No cap. Let's get into it πŸ’…


🌸 NAME 🌸

usb4_switch_nvm_write β€” write to the router NVM πŸŽ€


✨ SYNOPSIS ✨

int usb4_switch_nvm_write (struct tb_switch *sw , unsigned int address ,
const void *buf , size_t size );

That's the whole vibe right there. Four arguments, one int coming back at you 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • sw β€” the USB4 router you're doing this to. main character energy, honestly πŸ‘‘
  • address β€” the start address where the write happens, measured in bytes. Where we begin, bestie πŸ“
  • buf β€” a pointer to the data you're writing. this is the payload, the moment, the whole point πŸ’–
  • size β€” how big buf is, in bytes. gotta know how much we're working with πŸ“

πŸ’œ DESCRIPTION πŸ’œ

So what does it do? It writes buf to the router NVM, using USB4 router operations. That's it. That's the slay. Straight-up persistent-ish storage writing through router ops, no drama πŸ”₯

Like… it's literally giving "I know exactly what I'm doing." NVM write through the proper USB4 router path, periodt πŸ’…


⭐ RETURN ⭐

  • 0 β€” write completed successfully. we love a win πŸŽ‰
  • -EOPNOTSUPP β€” NVM write not supported. so like, this router said "not today" 😭
  • Negative errno β€” another error occurred. some other little gremlin showed up, check your errno πŸ™ˆ

🌈 SEE ALSO 🌈

Everything lives in the kernel file ./drivers/thunderbolt/usb4.c, and honestly the whole friend group is here β€” go say hi to all of them 🫢:

usb4_switch_check_wakes(9), usb4_switch_setup(9), usb4_switch_configuration_valid(9), usb4_switch_read_uid(9), usb4_switch_drom_read(9), usb4_switch_lane_bonding_possible(9), usb4_switch_set_wake(9), usb4_switch_set_sleep(9), usb4_switch_nvm_sector_size(9), usb4_switch_nvm_read(9), usb4_switch_nvm_set_offset(9), usb4_switch_nvm_authenticate(9), usb4_switch_nvm_authenticate_status(9), usb4_switch_credits_init(9), usb4_switch_query_dp_resource(9), usb4_switch_alloc_dp_resource(9), usb4_switch_dealloc_dp_resource(9), usb4_port_index(9), usb4_switch_map_pcie_down(9), usb4_switch_map_usb3_down(9), usb4_switch_add_ports(9), usb4_switch_remove_ports(9), usb4_port_unlock(9), usb4_port_hotplug_enable(9), usb4_port_reset(9), usb4_port_configure(9), usb4_port_unconfigure(9), usb4_port_configure_xdomain(9), usb4_port_unconfigure_xdomain(9), usb4_port_sb_read(9), usb4_port_sb_write(9), usb4_port_router_offline(9), usb4_port_router_online(9), usb4_port_enumerate_retimers(9), usb4_port_clx_supported(9), usb4_port_asym_supported(9), usb4_port_asym_set_link_width(9), usb4_port_asym_start(9), usb4_port_margining_caps(9), usb4_port_hw_margin(9), usb4_port_sw_margin(9), usb4_port_sw_margin_errors(9), usb4_port_retimer_set_inbound_sbtx(9), usb4_port_retimer_unset_inbound_sbtx(9), usb4_port_retimer_is_last(9), usb4_port_retimer_is_cable(9), usb4_port_retimer_nvm_sector_size(9), usb4_port_retimer_nvm_set_offset(9), usb4_port_retimer_nvm_write(9), usb4_port_retimer_nvm_authenticate(9), usb4_port_retimer_nvm_authenticate_status(9), usb4_port_retimer_nvm_read(9), usb4_usb3_port_max_link_rate(9), usb4_usb3_port_allocated_bandwidth(9), usb4_usb3_port_allocate_bandwidth(9), usb4_usb3_port_release_bandwidth(9), usb4_dp_port_set_cm_id(9), usb4_dp_port_bandwidth_mode_supported(9), usb4_dp_port_bandwidth_mode_enabled(9), usb4_dp_port_set_cm_bandwidth_mode_supported(9), usb4_dp_port_group_id(9), usb4_dp_port_set_group_id(9), usb4_dp_port_nrd(9), usb4_dp_port_set_nrd(9), usb4_dp_port_granularity(9), usb4_dp_port_set_granularity(9), usb4_dp_port_set_estimated_bandwidth(9), usb4_dp_port_allocated_bandwidth(9), usb4_dp_port_allocate_bandwidth(9), usb4_dp_port_requested_bandwidth(9), usb4_pci_port_set_ext_encapsulation(9), usb4_pci_port_ltssm_state(9)


Heads up bestie: -EOPNOTSUPP means the router genuinely can't do NVM writes β€” it's not you, it's the hardware πŸ’€

And that's the page!! This one's filed under ./drivers/thunderbolt, dated October 2026, from the Kernel API Manual β€” ty for reading, ily, go write some NVM bytes responsibly πŸ§šπŸ’–βœ¨

πŸ“¦ where this page comes from