coreboot/util/intelp2m/fields/fields.go
Maxim Polyakov 85054dbccb util/intelp2m: Rework platforms and fields packages
- embed the base platform and redefine its methods if they differ;
- separate the macro structures from the platform;
- move more functions to common;
- undo use of a single global instance of the microstructure.

TEST:
1) 'make test' = PASS
2) './intelp2m -p cnl -iiii -file inteltool.log' = gpio.h before and
   after the commit is the same.

Change-Id: I2e0aa56efa2430ac6524c6977f8b6fd13113edf9
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71167
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-03-03 21:44:09 +00:00

21 lines
737 B
Go

package fields
import (
"review.coreboot.org/coreboot.git/util/intelp2m/config/p2m"
"review.coreboot.org/coreboot.git/util/intelp2m/fields/cb"
"review.coreboot.org/coreboot.git/util/intelp2m/fields/fsp"
"review.coreboot.org/coreboot.git/util/intelp2m/fields/raw"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
)
// InterfaceSet - set the interface for decoding configuration
// registers DW0 and DW1.
func Get() common.FieldsIf {
var fldstylemap = map[p2m.FieldType]common.FieldsIf{
p2m.NoFlds: cb.FieldCollection{}, // analyze fields using cb macros
p2m.CbFlds: cb.FieldCollection{},
p2m.FspFlds: fsp.FieldCollection{},
p2m.RawFlds: raw.FieldCollection{},
}
return fldstylemap[p2m.Config.Field]
}