Skip to content

RFC lib: tlv_eeprom: refactor API

Josua Mayer u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest3 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib: add tlv_eeprom librarycmd/Kconfig include/tlv_eeprom.h lib/Kconfig +4 more+899 -00 replies
2/3mvebu: clearfog: convert tlv parsing to use new libraryboard/solidrun/common/tlv_data.c configs/clearfog_defconfig+20 -300 replies
3/3cmd: tlv_eeprom: port to new shared tlv librarycmd/Kconfig cmd/tlv_eeprom.c configs/clearfog_defconfig +1 more+92 -5740 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC v2 0/3] lib: tlv_eeprom: refactor API

The existing tlv_eeprom functionality has been designed as a single application living as a uboot command.
The split into individual library and command, as well as attempts using this functionality extensively for board-identification have revealed several short-comings, such as:
- Inconsistent naming convention
- Inconsistent order of arguments
- Stateful functions
- Complex inter-dependencies between functions
- Control of low-level information such as header checksums by command
- Difficult to extend
- No clear separation between eeprom access and tlv format
- No support for multiple entries with same code (e.g. vendor extension)

Introduce a new API with clear names and support for duplicate tlv codes. Further rewrite the tlv_eeprom command, and the solidrun clearfog board logic to utilize these new functions.

This is the second draft, I am looking for:
- comments on the library functions names + descriptions
- comments on the use of udevice pointers, especially wrt. "tlv_eeprom_get_by_index" function that I am not sure about keeping

Please note that there are still bugs and untested functions in this version. I am planning to provide a complete result in the coming weeks.

Josua Mayer (3):
lib: add tlv_eeprom library
mvebu: clearfog: convert tlv parsing to use new library
cmd: tlv_eeprom: port to new shared tlv library

 board/solidrun/common/tlv_data.c |  46 +--
 cmd/Kconfig                      |   7 +-
 cmd/tlv_eeprom.c                 | 507 +++++---------------------
 configs/clearfog_defconfig       |   2 +
 include/tlv_eeprom.h             | 242 ++++++++++---
 lib/Kconfig                      |   2 +
 lib/Makefile                     |   2 +
 lib/tlv/Kconfig                  |  18 +
 lib/tlv/Makefile                 |   4 +
 lib/tlv/tlv_eeprom.c             | 599 +++++++++++++++++++++++++++++++
 10 files changed, 918 insertions(+), 511 deletions(-)
 create mode 100644 lib/tlv/Kconfig
 create mode 100644 lib/tlv/Makefile
 create mode 100644 lib/tlv/tlv_eeprom.c
Cc Stefan Roese <[email protected]>
Cc Baruch Siach <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Signature · 1 line
2.35.3