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>
This commit is contained in:
		
				
					committed by
					
						 Shelley Chen
						Shelley Chen
					
				
			
			
				
	
			
			
			
						parent
						
							79e61603dc
						
					
				
				
					commit
					094510d964
				
			| @@ -3,6 +3,8 @@ | |||||||
| #ifndef _COMMONLIB_BSD_MEM_CHIP_INFO_H_ | #ifndef _COMMONLIB_BSD_MEM_CHIP_INFO_H_ | ||||||
| #define _COMMONLIB_BSD_MEM_CHIP_INFO_H_ | #define _COMMONLIB_BSD_MEM_CHIP_INFO_H_ | ||||||
|  |  | ||||||
|  | #include <stddef.h> | ||||||
|  |  | ||||||
| enum mem_chip_type { | enum mem_chip_type { | ||||||
| 	MEM_CHIP_DDR3 = 0x30, | 	MEM_CHIP_DDR3 = 0x30, | ||||||
| 	MEM_CHIP_LPDDR3 = 0x38, | 	MEM_CHIP_LPDDR3 = 0x38, | ||||||
| @@ -25,4 +27,9 @@ struct mem_chip_info { | |||||||
| 	} channel[0]; | 	} 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_ */ | #endif /* _COMMONLIB_BSD_MEM_CHIP_INFO_H_ */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user