mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-25 18:55:24 +00:00
Reduce attributes size to comply with msc limitations.
It turned out that shared verified boot library fails to work properly when compiled by msc in BIOS environment. The culprit was identified as failing 64 bit logical operations by preprocessor. It is probably possible to come up with a certain compile flag set to fix the operations, but it is not easy to modify and control the BIOS compilation environment. The alternative solution is to limit the size of the field in question to 16 bits (especially since this is the only part of the attributes field which is supposed to be altered by firmware. A union is being introduced in firmware/lib/cgptlib/include/gpt.h:GptEntry to allow accessing the field both as a 64 bit entity and a top 16 bit field. All places where this field is used are being modified appropriately. tests/Makefile is being fixed to allow controlling test run from the top level directory. Tested by building everything and running tests. All tests pass. Review URL: http://codereview.chromium.org/2799019
This commit is contained in:
@@ -93,7 +93,7 @@ int GptUpdateKernelEntry(GptData* gpt, uint32_t update_type) {
|
||||
GptHeader* header = (GptHeader*)gpt->primary_header;
|
||||
GptEntry* entries = (GptEntry*)gpt->primary_entries;
|
||||
GptEntry* e = entries + gpt->current_kernel;
|
||||
uint64_t previous_attr = e->attributes;
|
||||
uint16_t previous_attr = e->attrs.fields.gpt_att;
|
||||
|
||||
if (gpt->current_kernel == CGPT_KERNEL_ENTRY_NOT_FOUND)
|
||||
return GPT_ERROR_INVALID_UPDATE_TYPE;
|
||||
@@ -117,9 +117,10 @@ int GptUpdateKernelEntry(GptData* gpt, uint32_t update_type) {
|
||||
}
|
||||
case GPT_UPDATE_ENTRY_BAD: {
|
||||
/* Giving up on this partition entirely. */
|
||||
e->attributes &= ~(CGPT_ATTRIBUTE_SUCCESSFUL_MASK |
|
||||
CGPT_ATTRIBUTE_TRIES_MASK |
|
||||
CGPT_ATTRIBUTE_PRIORITY_MASK);
|
||||
e->attrs.fields.gpt_att = previous_attr & ~(
|
||||
CGPT_ATTRIBUTE_SUCCESSFUL_MASK |
|
||||
CGPT_ATTRIBUTE_TRIES_MASK |
|
||||
CGPT_ATTRIBUTE_PRIORITY_MASK);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -127,7 +128,7 @@ int GptUpdateKernelEntry(GptData* gpt, uint32_t update_type) {
|
||||
}
|
||||
|
||||
/* If no change to attributes, we're done */
|
||||
if (e->attributes == previous_attr)
|
||||
if (e->attrs.fields.gpt_att == previous_attr)
|
||||
return GPT_SUCCESS;
|
||||
|
||||
/* Update the CRCs */
|
||||
|
||||
Reference in New Issue
Block a user