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

Josua Mayer josua at solid-run.com
Tue May 16 13:41:50 CEST 2023


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 <sr at denx.de>
Cc: Baruch Siach <baruch at tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
-- 
2.35.3



More information about the U-Boot mailing list