summaryrefslogtreecommitdiff
path: root/firmware/lib/cgptlib/include
diff options
context:
space:
mode:
authorvbendeb <vbendeb@chromium.org>2010-06-21 08:44:16 -0700
committervbendeb <vbendeb@chromium.org>2010-06-21 08:44:16 -0700
commitf7a45cc01d7e4056482b2cdc23080bfabbbffc76 (patch)
tree15e826191fb3359c621903be6dd5405c90199c04 /firmware/lib/cgptlib/include
parent6216f5abe9901e9c47789d55ae90243c6cc50aeb (diff)
downloadvboot-f7a45cc01d7e4056482b2cdc23080bfabbbffc76.tar.gz
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
Diffstat (limited to 'firmware/lib/cgptlib/include')
-rw-r--r--firmware/lib/cgptlib/include/cgptlib_internal.h6
-rw-r--r--firmware/lib/cgptlib/include/gpt.h8
2 files changed, 10 insertions, 4 deletions
diff --git a/firmware/lib/cgptlib/include/cgptlib_internal.h b/firmware/lib/cgptlib/include/cgptlib_internal.h
index f4a4d199..5252b6a0 100644
--- a/firmware/lib/cgptlib/include/cgptlib_internal.h
+++ b/firmware/lib/cgptlib/include/cgptlib_internal.h
@@ -28,17 +28,17 @@
* 1 -- UEFI: partition is not mapped
* 0 -- UEFI: partition is required
*/
-#define CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET 56
+#define CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET (56 - 48)
#define CGPT_ATTRIBUTE_MAX_SUCCESSFUL (1ULL)
#define CGPT_ATTRIBUTE_SUCCESSFUL_MASK (CGPT_ATTRIBUTE_MAX_SUCCESSFUL << \
CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET)
-#define CGPT_ATTRIBUTE_TRIES_OFFSET 52
+#define CGPT_ATTRIBUTE_TRIES_OFFSET (52 - 48)
#define CGPT_ATTRIBUTE_MAX_TRIES (15ULL)
#define CGPT_ATTRIBUTE_TRIES_MASK (CGPT_ATTRIBUTE_MAX_TRIES << \
CGPT_ATTRIBUTE_TRIES_OFFSET)
-#define CGPT_ATTRIBUTE_PRIORITY_OFFSET 48
+#define CGPT_ATTRIBUTE_PRIORITY_OFFSET (48 - 48)
#define CGPT_ATTRIBUTE_MAX_PRIORITY (15ULL)
#define CGPT_ATTRIBUTE_PRIORITY_MASK (CGPT_ATTRIBUTE_MAX_PRIORITY << \
CGPT_ATTRIBUTE_PRIORITY_OFFSET)
diff --git a/firmware/lib/cgptlib/include/gpt.h b/firmware/lib/cgptlib/include/gpt.h
index a65317fb..1e8f47ff 100644
--- a/firmware/lib/cgptlib/include/gpt.h
+++ b/firmware/lib/cgptlib/include/gpt.h
@@ -96,7 +96,13 @@ typedef struct {
Guid unique;
uint64_t starting_lba;
uint64_t ending_lba;
- uint64_t attributes;
+ union {
+ struct {
+ uint64_t : 48;
+ uint16_t gpt_att : 16;
+ } __attribute__((packed)) fields;
+ uint64_t whole;
+ } attrs;
uint16_t name[36]; /* UTF-16 encoded partition name */
uint8_t reserved[]; /* nothing, really */
} __attribute__((packed)) GptEntry;