genvif: add override XML initialization
You can now feed in a VIF XML file with fields that you want to override and these will get set instead of using the CONFIG_ initialization for those fields. $ build/morphius/util/genvif -o build/morphius \ -b morphius_sku5_dvt2 \ --over board/morphius/sku5_dvt2.xml Where the override file is a valid VIF file (no matter how partial it is). Tags such as <? .... ?> and comments <!-- .... --> are ignored. In the above example the override file looked as followed: <?xml version="1.0" encoding="UTF-8"?> <VIF> <Model_Part_Number>Morphius SKU5</Model_Part_Number> <Product_Revision>DVT2</Product_Revision> </VIF> The Model_Part_Number and Product_Revision used this override value instead of "morphius" and "FIX-ME". The values can also be used to set other values. I added a couple of those but the uses of get_vif_field can be added to create more automated generation. Here are a couple of examples: static bool is_src(void) { int override_value; bool was_overridden; /* Determine if we are DRP, SRC or SNK */ was_overridden = get_vif_field_tag_number( &vif.Component[0] .vif_field[Type_C_State_Machine], &override_value); if (was_overridden) { switch (override_value) { case SRC: case DRP: return true; case SNK: return false; default: break; } } return src_pdo_cnt; } and /* Determine if we are DRP, SRC or SNK */ was_overridden = get_vif_field_tag_number( &vif->Component[0] .vif_field[Type_C_State_Machine], &override_value); if (was_overridden) { switch (override_value) { case SRC: case SNK: case DRP: type = (enum dtype)override_value; break; default: was_overridden = false; } } if (!was_overridden) { if (is_drp()) type = DRP; else if (is_src() && is_snk()) /* No DRP with SRC and SNK PDOs detected. So ignore. */ /* ie. Twinkie or Plankton */ return 0; else if (is_src()) type = SRC; else if (is_snk()) type = SNK; else return 1; } Bumped the version to 3.0.0.6. BUG=b:172489443 BRANCH=none TEST=use --over to override fields within the XML Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ic1ecd3e0d2f643c3315bcc8abecdf7490fb69b8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535672 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
This commit is contained in:
parent
c0a778cef3
commit
21f1d75e7b
2358
util/genvif.c
2358
util/genvif.c
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
struct vif_field_t {
|
||||
char *name;
|
||||
const char *name;
|
||||
char *tag_value;
|
||||
char *str_value;
|
||||
};
|
||||
|
@ -378,9 +378,6 @@ struct vif_Product_t {
|
|||
|
||||
enum vif_indexes {
|
||||
VIF_Specification, /* version */
|
||||
VIF_App_Vendor, /* nonEmptyString */
|
||||
VIF_App_Name, /* nonEmptyString */
|
||||
VIF_App_Version, /* version */
|
||||
Vendor_Name, /* nonEmptyString */
|
||||
Model_Part_Number, /* nonEmptyString */
|
||||
Product_Revision, /* nonEmptyString */
|
||||
|
@ -389,8 +386,15 @@ enum vif_indexes {
|
|||
Certification_Type, /* numericFieldType */
|
||||
VIF_Indexes
|
||||
};
|
||||
enum vif_app_indexes {
|
||||
Vendor, /* nonEmptyString */
|
||||
Name, /* nonEmptyString */
|
||||
Version, /* version */
|
||||
VIF_App_Indexes
|
||||
};
|
||||
struct vif_t {
|
||||
struct vif_field_t vif_field[VIF_Indexes];
|
||||
struct vif_field_t vif_app_field[VIF_App_Indexes];
|
||||
|
||||
struct vif_Product_t Product;
|
||||
struct vif_Component_t Component[MAX_NUM_COMPONENTS];
|
||||
|
|
Loading…
Reference in New Issue