Page MenuHomeFreeBSD

bhnd: Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding
ClosedPublic

Authored by landonf on Nov 26 2016, 12:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 6:23 PM
Unknown Object (File)
Mon, Nov 18, 5:55 PM
Unknown Object (File)
Mon, Nov 18, 6:36 AM
Unknown Object (File)
Oct 1 2024, 4:29 PM
Unknown Object (File)
Sep 30 2024, 12:39 AM
Unknown Object (File)
Sep 13 2024, 8:12 PM
Unknown Object (File)
Sep 12 2024, 4:07 AM
Unknown Object (File)
Sep 12 2024, 4:07 AM
Subscribers
None

Details

Summary
  • Defined an abstract NVRAM I/O API (bhnd_nvram_io), decoupling NVRAM/SPROM parsing from the actual underlying NVRAM data provider (e.g. CFE firmware devices).
  • Defined an abstract NVRAM data API (bhnd_nvram_data), decoupling higher-level NVRAM operations (indexed lookup, data conversion, etc) from the underlying NVRAM file format parsing/serialization.
  • Implemented a new high-level bhnd_nvram_store API, providing indexed variable lookup, pending write tracking, etc on top of an arbitrary bhnd_nvram_data instance.
  • Migrated all NVRAM device drivers to the common bhnd_nvram_store API.
  • Implemented a common bhnd_nvram_val API for parsing/encoding NVRAM variable values, including applying format-specific behavior when converting to/from the NVRAM string representations.
  • Dropped the now unnecessary bhnd_nvram driver, and moved the broadcom/mips-specific CFE NVRAM driver out into sys/mips/broadcom.
  • Implemented a new nvram_map file format:
    • Variable definitions are now defined separately from the SPROM layout information, allowing us to independently define SPROM layouts that reference the common variable definitions. Later, this should also allow us to define CIS tuple NVRAM mappings with the same common NVRAM variable definitions.
    • Variables can now be defined within arbitrary named groups.
    • Textual descriptions and help information can be defined inline for both variables and variable groups.
  • Implemented a new, compact encoding of SPROM image layout offsets:
    • The encoding is loosely modeled on Apple dyld compressed LINKEDIT symbol binding opcodes; it provides a compact state-machine encoding of the mapping between NVRAM variables and the SPROM image offset, mask, and shift instructions necessary to decode or encode the SPROM variable data.
    • The compact encoding reduces the size of the generated SPROM variable layout data from roughly 60KB to 3KB. The sequential nature SPROM layout opcode tables also simplify iteration of the SPROM variables, as it's no longer neccessary to iterate the full NVRAM variable definition table, but instead simply scan the SPROM revision's layout opcode table.
  • Added source-level (but not build system) support for building the NVRAM file format APIs (bhnd_nvram_io, bhnd_nvram_data, bhnd_nvram_store) as a userspace library.
Test Plan

Tested for bhnd(4)/bwn(4) regressions against:

  • BCM4321
  • BCM43225
  • BCM4331
  • Netgear WGT634U
  • Asus RT-N16
  • Asus RT-N53

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6065
Build 6329: arc lint + arc unit

Event Timeline

landonf updated this revision to Diff 22521.
landonf retitled this revision from to bhnd: Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.
landonf updated this object.
landonf edited the test plan for this revision. (Show Details)
landonf added reviewers: adrian, mizhka.

Fixed comment spelling errors.

adrian edited edge metadata.

.. wow. :)

This revision is now accepted and ready to land.Nov 26 2016, 4:29 AM
mizhka edited edge metadata.