Name of user not set #1003143 has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
lib/imd: move struct definitions to a new header file
Signed-off-by: Jakub Czapiga jacz@semihalf.com Change-Id: Iff87cc1990426bee6ac3cc1dfa6f85a787334976 --- A src/include/imd_private.h M src/lib/imd.c 2 files changed, 40 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/46216/1
diff --git a/src/include/imd_private.h b/src/include/imd_private.h new file mode 100644 index 0000000..43c3b7d --- /dev/null +++ b/src/include/imd_private.h @@ -0,0 +1,38 @@ +#ifndef _IMD_PRIVATE_H_ +#define _IMD_PRIVATE_H_ + +#include <commonlib/bsd/helpers.h> + +/* In-memory data structures. */ +struct imd_root_pointer { + uint32_t magic; + /* Relative to upper limit/offset. */ + int32_t root_offset; +} __packed; + +struct imd_entry { + uint32_t magic; + /* start is located relative to imd_root */ + int32_t start_offset; + uint32_t size; + uint32_t id; +} __packed; + +struct imd_root { + uint32_t max_entries; + uint32_t num_entries; + uint32_t flags; + uint32_t entry_align; + /* Used for fixing the size of an imd. Relative to the root. */ + int32_t max_offset; + struct imd_entry entries[0]; +} __packed; + +#define IMD_ROOT_PTR_MAGIC 0xc0389481 +#define IMD_ENTRY_MAGIC (~0xc0389481) +#define SMALL_REGION_ID CBMEM_ID_IMD_SMALL +#define LIMIT_ALIGN 4096 + +#define IMD_FLAG_LOCKED 1 + +#endif /* _IMD_PRIVATE_H */ diff --git a/src/lib/imd.c b/src/lib/imd.c index 0277965..ac19d76 100644 --- a/src/lib/imd.c +++ b/src/lib/imd.c @@ -7,40 +7,11 @@ #include <stdlib.h> #include <string.h> #include <types.h> +#include <imd_private.h> +
/* For more details on implementation and usage please see the imd.h header. */
-static const uint32_t IMD_ROOT_PTR_MAGIC = 0xc0389481; -static const uint32_t IMD_ENTRY_MAGIC = ~0xc0389481; -static const uint32_t SMALL_REGION_ID = CBMEM_ID_IMD_SMALL; - -/* In-memory data structures. */ -struct imd_root_pointer { - uint32_t magic; - /* Relative to upper limit/offset. */ - int32_t root_offset; -} __packed; - -struct imd_entry { - uint32_t magic; - /* start is located relative to imd_root */ - int32_t start_offset; - uint32_t size; - uint32_t id; -} __packed; - -struct imd_root { - uint32_t max_entries; - uint32_t num_entries; - uint32_t flags; - uint32_t entry_align; - /* Used for fixing the size of an imd. Relative to the root. */ - int32_t max_offset; - struct imd_entry entries[0]; -} __packed; - -#define IMD_FLAG_LOCKED 1 - static void *relative_pointer(void *base, ssize_t offset) { intptr_t b = (intptr_t)base;
Name of user not set #1003143 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
Patch Set 1:
Hi,
I'd like to ask you to review my changes.
Regards Jakub
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
Patch Set 1: Code-Review+2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46216/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46216/1//COMMIT_MSG@8 PS1, Line 8: Can you please add the motivation behind the change to the commit message?
Hello build bot (Jenkins), Patrick Georgi, Paul Fagerburg, Julius Werner, Jan Dabros,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46216
to look at the new patch set (#2).
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
lib/imd: move struct definitions to a new header file
Make IMD private structures definitions accessible by other units.
To test IMD API correctness there is a need to access its internal structure. It is only possible when private implementation is visible in testing scope.
Signed-off-by: Jakub Czapiga jacz@semihalf.com Change-Id: Iff87cc1990426bee6ac3cc1dfa6f85a787334976 --- A src/include/imd_private.h M src/lib/imd.c 2 files changed, 40 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/46216/2
Name of user not set #1003143 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46216/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46216/1//COMMIT_MSG@8 PS1, Line 8:
Can you please add the motivation behind the change to the commit message?
Done
Hello build bot (Jenkins), Patrick Georgi, Paul Fagerburg, Julius Werner, Jan Dabros,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46216
to look at the new patch set (#4).
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
lib/imd: move struct definitions to a new header file
Signed-off-by: Jakub Czapiga jacz@semihalf.com Change-Id: Iff87cc1990426bee6ac3cc1dfa6f85a787334976 --- A src/include/imd_private.h M src/lib/imd.c 2 files changed, 40 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/46216/4
Hello build bot (Jenkins), Patrick Georgi, Paul Fagerburg, Julius Werner, Jan Dabros,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46216
to look at the new patch set (#5).
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
lib/imd: move struct definitions to a new header file
Make IMD private structures definitions accessible by other units.
To test IMD API correctness there is a need to access its internal structure. It is only possible when private implementation is visible in testing scope.
Signed-off-by: Jakub Czapiga jacz@semihalf.com Change-Id: Iff87cc1990426bee6ac3cc1dfa6f85a787334976 --- A src/include/imd_private.h M src/lib/imd.c 2 files changed, 40 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/46216/5
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
Patch Set 5: Code-Review+2
Hello build bot (Jenkins), Patrick Georgi, Daniel Gröber, Paul Fagerburg, Angel Pons, Julius Werner, Jan Dabros,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46216
to look at the new patch set (#7).
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
lib/imd: move struct definitions to a new header file
Make IMD private structures definitions accessible by other units.
To test IMD API correctness there is a need to access its internal structure. It is only possible when private implementation is visible in testing scope.
Signed-off-by: Jakub Czapiga jacz@semihalf.com Change-Id: Iff87cc1990426bee6ac3cc1dfa6f85a787334976 --- A src/include/imd_private.h M src/lib/imd.c 2 files changed, 40 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/46216/7
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
Patch Set 7: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46216 )
Change subject: lib/imd: move struct definitions to a new header file ......................................................................
lib/imd: move struct definitions to a new header file
Make IMD private structures definitions accessible by other units.
To test IMD API correctness there is a need to access its internal structure. It is only possible when private implementation is visible in testing scope.
Signed-off-by: Jakub Czapiga jacz@semihalf.com Change-Id: Iff87cc1990426bee6ac3cc1dfa6f85a787334976 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46216 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Paul Fagerburg pfagerburg@chromium.org --- A src/include/imd_private.h M src/lib/imd.c 2 files changed, 40 insertions(+), 31 deletions(-)
Approvals: build bot (Jenkins): Verified Paul Fagerburg: Looks good to me, approved
diff --git a/src/include/imd_private.h b/src/include/imd_private.h new file mode 100644 index 0000000..43c3b7d --- /dev/null +++ b/src/include/imd_private.h @@ -0,0 +1,38 @@ +#ifndef _IMD_PRIVATE_H_ +#define _IMD_PRIVATE_H_ + +#include <commonlib/bsd/helpers.h> + +/* In-memory data structures. */ +struct imd_root_pointer { + uint32_t magic; + /* Relative to upper limit/offset. */ + int32_t root_offset; +} __packed; + +struct imd_entry { + uint32_t magic; + /* start is located relative to imd_root */ + int32_t start_offset; + uint32_t size; + uint32_t id; +} __packed; + +struct imd_root { + uint32_t max_entries; + uint32_t num_entries; + uint32_t flags; + uint32_t entry_align; + /* Used for fixing the size of an imd. Relative to the root. */ + int32_t max_offset; + struct imd_entry entries[0]; +} __packed; + +#define IMD_ROOT_PTR_MAGIC 0xc0389481 +#define IMD_ENTRY_MAGIC (~0xc0389481) +#define SMALL_REGION_ID CBMEM_ID_IMD_SMALL +#define LIMIT_ALIGN 4096 + +#define IMD_FLAG_LOCKED 1 + +#endif /* _IMD_PRIVATE_H */ diff --git a/src/lib/imd.c b/src/lib/imd.c index 0277965..ac19d76 100644 --- a/src/lib/imd.c +++ b/src/lib/imd.c @@ -7,40 +7,11 @@ #include <stdlib.h> #include <string.h> #include <types.h> +#include <imd_private.h> +
/* For more details on implementation and usage please see the imd.h header. */
-static const uint32_t IMD_ROOT_PTR_MAGIC = 0xc0389481; -static const uint32_t IMD_ENTRY_MAGIC = ~0xc0389481; -static const uint32_t SMALL_REGION_ID = CBMEM_ID_IMD_SMALL; - -/* In-memory data structures. */ -struct imd_root_pointer { - uint32_t magic; - /* Relative to upper limit/offset. */ - int32_t root_offset; -} __packed; - -struct imd_entry { - uint32_t magic; - /* start is located relative to imd_root */ - int32_t start_offset; - uint32_t size; - uint32_t id; -} __packed; - -struct imd_root { - uint32_t max_entries; - uint32_t num_entries; - uint32_t flags; - uint32_t entry_align; - /* Used for fixing the size of an imd. Relative to the root. */ - int32_t max_offset; - struct imd_entry entries[0]; -} __packed; - -#define IMD_FLAG_LOCKED 1 - static void *relative_pointer(void *base, ssize_t offset) { intptr_t b = (intptr_t)base;