Lean Sheng Tan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85780?usp=email )
Change subject: Fix up CFR's open issues ......................................................................
Fix up CFR's open issues
Signed-off-by: Lean Sheng Tan sheng.tan@9elements.com Change-Id: Id66808382b93e32c58024462c18b20c2a89d6d23 --- M Documentation/drivers/cfr.md M src/commonlib/include/commonlib/cfr.h M src/drivers/option/cfr.c 3 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/80/85780/1
diff --git a/Documentation/drivers/cfr.md b/Documentation/drivers/cfr.md index ade6d2b..0405f5c 100644 --- a/Documentation/drivers/cfr.md +++ b/Documentation/drivers/cfr.md @@ -26,7 +26,7 @@ All strings are in ASCII.
The boot options are grouped into forms, where each form hold -one ore more options. Boot options that are not used in the current +one or more options. Boot options that are not used in the current boot flow, and are never reachable should be marked as hidden. Dependecies between options can be defined in the code and should be evaluated by the CFR parser/UI. @@ -66,7 +66,7 @@ ## Implementation design ### Tags Tags identify the structure defined in `src/commonlib/include/commonlib/cfr.h`. -Every struct might be immideatly followed by additional structs (so called +Every struct might be immediately followed by additional structs (so called sub nodes), having their own tag and size field. The sum of all sub nodes size fields plus the size of the struct itself equals the size field.
@@ -208,7 +208,7 @@
Prevents writes to the variable.
-* `CFR_OPTFLAG_GRAYOUT` +* `CFR_OPTFLAG_INACTIVE`
Implies `READONLY`. The option is visible, but cannot be modified because one of the dependencies are not given. However there's a diff --git a/src/commonlib/include/commonlib/cfr.h b/src/commonlib/include/commonlib/cfr.h index 22058e9..cc8431a 100644 --- a/src/commonlib/include/commonlib/cfr.h +++ b/src/commonlib/include/commonlib/cfr.h @@ -68,7 +68,7 @@ * effect on the non-volatile variable. * CFR_OPTFLAG_READONLY: * Prevents writes to the variable. - * CFR_OPTFLAG_GRAYOUT: + * CFR_OPTFLAG_INACTIVE: * Implies READONLY. The option is visible, but cannot be modified * because one of the dependencies are not given. However there's a * possibility to enable the option by changing runtime configuration. @@ -93,7 +93,7 @@ */ enum cfr_option_flags { CFR_OPTFLAG_READONLY = 1 << 0, - CFR_OPTFLAG_GRAYOUT = 1 << 1, + CFR_OPTFLAG_INACTIVE = 1 << 1, CFR_OPTFLAG_SUPPRESS = 1 << 2, CFR_OPTFLAG_VOLATILE = 1 << 3, CFR_OPTFLAG_RUNTIME = 1 << 4, diff --git a/src/drivers/option/cfr.c b/src/drivers/option/cfr.c index b323b43..c99bb01 100644 --- a/src/drivers/option/cfr.c +++ b/src/drivers/option/cfr.c @@ -29,7 +29,7 @@
static uint32_t write_cfr_varchar(char *current, const char *string, uint32_t tag) { - uint8_t *data; + char *data; size_t padding;
ASSERT(string); @@ -39,7 +39,7 @@ struct lb_cfr_varbinary *cfr_str = (struct lb_cfr_varbinary *)current; cfr_str->tag = tag; cfr_str->data_length = strlen(string) + 1; - char *data = current + sizeof(*cfr_str); + *data = current + sizeof(*cfr_str); memcpy(data, string, cfr_str->data_length);
/* Make sure that every TAG/SIZE field is always aligned to LB_ENTRY_ALIGN */ @@ -98,7 +98,7 @@ option->object_id = object_id; option->dependency_id = dep_id; option->flags = flags; - if (option->flags & (CFR_OPTFLAG_GRAYOUT | CFR_OPTFLAG_VOLATILE)) + if (option->flags & (CFR_OPTFLAG_INACTIVE | CFR_OPTFLAG_VOLATILE)) option->flags |= CFR_OPTFLAG_READONLY; option->default_value = default_value; option->size = sizeof(*option); @@ -163,7 +163,7 @@ option->object_id = object_id; option->dependency_id = dep_id; option->flags = sm_varchar->flags; - if (option->flags & (CFR_OPTFLAG_GRAYOUT | CFR_OPTFLAG_VOLATILE)) + if (option->flags & (CFR_OPTFLAG_INACTIVE | CFR_OPTFLAG_VOLATILE)) option->flags |= CFR_OPTFLAG_READONLY; option->size = sizeof(*option);
@@ -193,7 +193,7 @@ comment->object_id = object_id; comment->dependency_id = dep_id; comment->flags = sm_comment->flags; - if (comment->flags & (CFR_OPTFLAG_GRAYOUT | CFR_OPTFLAG_VOLATILE)) + if (comment->flags & (CFR_OPTFLAG_INACTIVE | CFR_OPTFLAG_VOLATILE)) comment->flags |= CFR_OPTFLAG_READONLY; comment->size = sizeof(*comment);
@@ -228,7 +228,7 @@ form->object_id = object_id; form->dependency_id = dep_id; form->flags = sm_form->flags; - if (form->flags & (CFR_OPTFLAG_GRAYOUT | CFR_OPTFLAG_VOLATILE)) + if (form->flags & (CFR_OPTFLAG_INACTIVE | CFR_OPTFLAG_VOLATILE)) form->flags |= CFR_OPTFLAG_READONLY; form->size = sizeof(*form);