lib/bootmem: Introduce custom bootmem tags
Introduce bootmem custom memory tags and use them instead of reusing LB_MEM tags. Use asserts in bootmem_add_range to verify parameters. Tested with uImage payload on Cavium SoC. Change-Id: I7be8fa792fc7933ca218ecd43d250d3a9c55caa6 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/25633 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
		
				
					committed by
					
						 Patrick Georgi
						Patrick Georgi
					
				
			
			
				
	
			
			
			
						parent
						
							666c172d38
						
					
				
				
					commit
					9ab9db0bc5
				
			| @@ -20,6 +20,22 @@ | ||||
| #include <stdint.h> | ||||
| #include <boot/coreboot_tables.h> | ||||
|  | ||||
| /** | ||||
|  * Bootmem types match to LB_MEM tags. | ||||
|  * Start at 0x10000 to make sure that the caller doesn't provide LB_MEM tags. | ||||
|  */ | ||||
| enum bootmem_type { | ||||
| 	BM_MEM_FIRST = 0x10000,	/* First entry in this list */ | ||||
| 	BM_MEM_RAM,		/* Memory anyone can use */ | ||||
| 	BM_MEM_RESERVED,	/* Don't use this memory region */ | ||||
| 	BM_MEM_ACPI,		/* ACPI Tables */ | ||||
| 	BM_MEM_NVS,		/* ACPI NVS Memory */ | ||||
| 	BM_MEM_UNUSABLE,	/* Unusable address space */ | ||||
| 	BM_MEM_VENDOR_RSVD,	/* Vendor Reserved */ | ||||
| 	BM_MEM_TABLE,		/* Ram configuration tables are kept in */ | ||||
| 	BM_MEM_LAST,		/* Last entry in this list */ | ||||
| }; | ||||
|  | ||||
| /* Write memory coreboot table. Current resource map is serialized into | ||||
|  * memtable (LB_MEM_* types). bootmem library is unusable until this function | ||||
|  * is called first in the write tables path before payload is loaded. */ | ||||
| @@ -30,7 +46,8 @@ void bootmem_write_memory_table(struct lb_memory *mem); | ||||
| void bootmem_arch_add_ranges(void); | ||||
|  | ||||
| /* Add a range of a given type to the bootmem address space. */ | ||||
| void bootmem_add_range(uint64_t start, uint64_t size, uint32_t type); | ||||
| void bootmem_add_range(uint64_t start, uint64_t size, | ||||
| 		       const enum bootmem_type tag); | ||||
|  | ||||
| /* Print current range map of boot memory. */ | ||||
| void bootmem_dump_ranges(void); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user