diff options
author | Ravi Kumar Bokka <rbokka@codeaurora.org> | 2022-04-06 07:34:56 +0530 |
---|---|---|
committer | Shelley Chen <shchen@google.com> | 2022-04-13 02:55:05 +0000 |
commit | 094510d96491a0628a4188454fb57de391fd5378 (patch) | |
tree | e6bba17dc3d02a55566a64014ea884e73b960699 /src | |
parent | 79e61603dc1e7c335a3e3f9c1f70b135cd8cfb96 (diff) |
commonlib/bsd: Add mem_chip_info_size() function
Add a helper function mem_chip_info_size() as the size of
mem_chip_info structure is used in multiple places.
BUG=b:182963902,b:177917361
TEST=Validated on qualcomm sc7280 development board
Signed-off-by: Ravi Kumar Bokka <rbokka@codeaurora.org>
Change-Id: Iaada45d63b82c28495166024a9655d871ba65b20
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63407
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/commonlib/bsd/include/commonlib/bsd/mem_chip_info.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/mem_chip_info.h b/src/commonlib/bsd/include/commonlib/bsd/mem_chip_info.h index 8dc6db3439..d07f4d60d0 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/mem_chip_info.h +++ b/src/commonlib/bsd/include/commonlib/bsd/mem_chip_info.h @@ -3,6 +3,8 @@ #ifndef _COMMONLIB_BSD_MEM_CHIP_INFO_H_ #define _COMMONLIB_BSD_MEM_CHIP_INFO_H_ +#include <stddef.h> + enum mem_chip_type { MEM_CHIP_DDR3 = 0x30, MEM_CHIP_LPDDR3 = 0x38, @@ -25,4 +27,9 @@ struct mem_chip_info { } channel[0]; }; +static inline size_t mem_chip_info_size(struct mem_chip_info *info) +{ + return sizeof(*info) + sizeof(info->channel[0]) * info->num_channels; +}; + #endif /* _COMMONLIB_BSD_MEM_CHIP_INFO_H_ */ |