util/spd_tools: Document adding support for a new memory technology

Add documentation describing how to add support for a new memory
technology to spd_tools:
- Add a section to the README.
- Document the memTech interface in spd_gen.go.

BUG=b:191776301
TEST=None

Signed-off-by: Reka Norman <rekanorman@google.com>
Change-Id: Ie710c1c686ddf5288db35cf43e5f1ac9b1974305
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59005
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Reka Norman
2021-11-08 11:18:42 +11:00
committed by Tim Wawrzynczak
parent b455dd3486
commit e6a1ebe55b
2 changed files with 72 additions and 0 deletions

View File

@ -28,10 +28,37 @@ type memPart struct {
}
type memTech interface {
/*
* Returns the set -> platform mapping for the memory technology. Platforms with the
* same SPD requirements should be grouped together into a single set.
*/
getSetMap() map[int][]int
/*
* Takes the name and attributes of a part, as read from the memory_parts JSON file.
* Validates the attributes, returning an error if any attribute has an invalid value.
* Stores the name and attributes internally to be used later.
*/
addNewPart(string, interface{}) error
/*
* Takes the name of a part and a set number.
* Retrieves the part's attributes which were stored by addNewPart(). Updates them by
* setting any optional attributes which weren't specified in the JSON file to their
* default values.
* Returns these updated attributes.
*/
getSPDAttribs(string, int) (interface{}, error)
/*
* Returns the size of an SPD file for this memory technology.
*/
getSPDLen() int
/*
* Takes an SPD byte index and the attributes of a part.
* Returns the value which that SPD byte should be set to based on the attributes.
*/
getSPDByte(int, interface{}) byte
}