arch/x86,lib: Migrate SMBIOS implementation to common code
SMBIOS is not specific to architecture, and this is mostly a generic implementation. Therefore, move it to common code, having architecture-specific code define some functions to fill this data. Change-Id: I030c853f83f8427da4a4c661b82a6487938b24e6 Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75886 Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
		
				
					committed by
					
						
						Lean Sheng Tan
					
				
			
			
				
	
			
			
			
						parent
						
							57241a27d1
						
					
				
				
					commit
					ea13dc3562
				
			@@ -276,7 +276,6 @@ ramstage-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS) += null_breakpoint.c
 | 
				
			|||||||
ramstage-$(CONFIG_GENERATE_PIRQ_TABLE) += pirq_routing.c
 | 
					ramstage-$(CONFIG_GENERATE_PIRQ_TABLE) += pirq_routing.c
 | 
				
			||||||
ramstage-y += rdrand.c
 | 
					ramstage-y += rdrand.c
 | 
				
			||||||
ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
 | 
					ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
 | 
				
			||||||
ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios_defaults.c
 | 
					 | 
				
			||||||
ramstage-y += tables.c
 | 
					ramstage-y += tables.c
 | 
				
			||||||
ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
 | 
					ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
 | 
				
			||||||
ramstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S
 | 
					ramstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -6,6 +6,14 @@
 | 
				
			|||||||
#include <types.h>
 | 
					#include <types.h>
 | 
				
			||||||
#include <memory_info.h>
 | 
					#include <memory_info.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define update_max(len, max_len, stmt)		\
 | 
				
			||||||
 | 
						do {					\
 | 
				
			||||||
 | 
							int tmp = stmt;			\
 | 
				
			||||||
 | 
											\
 | 
				
			||||||
 | 
							max_len = MAX(max_len, tmp);	\
 | 
				
			||||||
 | 
							len += tmp;			\
 | 
				
			||||||
 | 
						} while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned long smbios_write_tables(unsigned long start);
 | 
					unsigned long smbios_write_tables(unsigned long start);
 | 
				
			||||||
int smbios_add_string(u8 *start, const char *str);
 | 
					int smbios_add_string(u8 *start, const char *str);
 | 
				
			||||||
int smbios_string_table_len(u8 *start);
 | 
					int smbios_string_table_len(u8 *start);
 | 
				
			||||||
@@ -1210,6 +1218,24 @@ struct smbios_type127 {
 | 
				
			|||||||
	u8 eos[2];
 | 
						u8 eos[2];
 | 
				
			||||||
} __packed;
 | 
					} __packed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Provided to help architecture code */
 | 
				
			||||||
 | 
					int smbios_write_type7(unsigned long *current,
 | 
				
			||||||
 | 
							       const int handle,
 | 
				
			||||||
 | 
							       const u8 level,
 | 
				
			||||||
 | 
							       const u8 sram_type,
 | 
				
			||||||
 | 
							       const enum smbios_cache_associativity associativity,
 | 
				
			||||||
 | 
							       const enum smbios_cache_type type,
 | 
				
			||||||
 | 
							       const size_t max_cache_size,
 | 
				
			||||||
 | 
							       const size_t cache_size);
 | 
				
			||||||
 | 
					enum smbios_cache_associativity smbios_cache_associativity(const u8 num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Must be defined by architecture code */
 | 
				
			||||||
 | 
					int smbios_write_type4(unsigned long *current, int handle);
 | 
				
			||||||
 | 
					int smbios_write_type7_cache_parameters(unsigned long *current,
 | 
				
			||||||
 | 
										int *handle,
 | 
				
			||||||
 | 
										int *max_struct_size,
 | 
				
			||||||
 | 
										struct smbios_type4 *type4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
 | 
					void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
 | 
				
			||||||
	struct smbios_type17 *t);
 | 
						struct smbios_type17 *t);
 | 
				
			||||||
void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm,
 | 
					void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -134,6 +134,8 @@ ramstage-y += prog_ops.c
 | 
				
			|||||||
ramstage-y += hardwaremain.c
 | 
					ramstage-y += hardwaremain.c
 | 
				
			||||||
ramstage-y += selfboot.c
 | 
					ramstage-y += selfboot.c
 | 
				
			||||||
ramstage-y += coreboot_table.c
 | 
					ramstage-y += coreboot_table.c
 | 
				
			||||||
 | 
					ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
 | 
				
			||||||
 | 
					ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios_defaults.c
 | 
				
			||||||
ramstage-y += bootmem.c
 | 
					ramstage-y += bootmem.c
 | 
				
			||||||
ramstage-y += fmap.c
 | 
					ramstage-y += fmap.c
 | 
				
			||||||
ramstage-y += memchr.c
 | 
					ramstage-y += memchr.c
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1283
									
								
								src/lib/smbios.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1283
									
								
								src/lib/smbios.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user