soc/intel/apollolake: Use SMM library to get tseg region information
This patch uses smm common library function to get tseg base address and size. Hence removing definitions of smm_region() from soc directory. BRANCH=none BUG=b:63974384 TEST=Build and boot reef successfully. Change-Id: I091ca90cf576c0da35cf3fe010f8c22a18ef82d9 Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/21291 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
		@@ -178,7 +178,7 @@ static void get_smm_info(uintptr_t *perm_smbase, size_t *perm_smsize,
 | 
				
			|||||||
	const uint32_t rmask = ~((1 << 12) - 1);
 | 
						const uint32_t rmask = ~((1 << 12) - 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Initialize global tracking state. */
 | 
						/* Initialize global tracking state. */
 | 
				
			||||||
	smm_region(&smm_base, &smm_size);
 | 
						smm_region_info(&smm_base, &smm_size);
 | 
				
			||||||
	smm_subregion(SMM_SUBREGION_HANDLER, &handler_base, &handler_size);
 | 
						smm_subregion(SMM_SUBREGION_HANDLER, &handler_base, &handler_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	relo_attrs.smbase = (uint32_t)smm_base;
 | 
						relo_attrs.smbase = (uint32_t)smm_base;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,40 +28,24 @@
 | 
				
			|||||||
#include <cbmem.h>
 | 
					#include <cbmem.h>
 | 
				
			||||||
#include <device/pci.h>
 | 
					#include <device/pci.h>
 | 
				
			||||||
#include <fsp/memmap.h>
 | 
					#include <fsp/memmap.h>
 | 
				
			||||||
 | 
					#include <intelblocks/smm.h>
 | 
				
			||||||
#include <soc/systemagent.h>
 | 
					#include <soc/systemagent.h>
 | 
				
			||||||
#include <soc/pci_devs.h>
 | 
					#include <soc/pci_devs.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uintptr_t smm_region_start(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return ALIGN_DOWN(pci_read_config32(SA_DEV_ROOT, TSEG), 1*MiB);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static size_t smm_region_size(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	uintptr_t smm_end =
 | 
					 | 
				
			||||||
		ALIGN_DOWN(pci_read_config32(SA_DEV_ROOT, BGSM), 1*MiB);
 | 
					 | 
				
			||||||
	return smm_end - smm_region_start();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void *cbmem_top(void)
 | 
					void *cbmem_top(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return (void *)smm_region_start();
 | 
						return (void *)sa_get_tseg_base();
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void smm_region(void **start, size_t *size)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	*start = (void *)smm_region_start();
 | 
					 | 
				
			||||||
	*size = smm_region_size();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int smm_subregion(int sub, void **start, size_t *size)
 | 
					int smm_subregion(int sub, void **start, size_t *size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uintptr_t sub_base;
 | 
						uintptr_t sub_base;
 | 
				
			||||||
	size_t sub_size;
 | 
						size_t sub_size;
 | 
				
			||||||
 | 
						void *smm_base;
 | 
				
			||||||
	const size_t cache_size = CONFIG_SMM_RESERVED_SIZE;
 | 
						const size_t cache_size = CONFIG_SMM_RESERVED_SIZE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sub_base = smm_region_start();
 | 
						smm_region_info(&smm_base, &sub_size);
 | 
				
			||||||
	sub_size = smm_region_size();
 | 
						sub_base = (uintptr_t)smm_base;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert(sub_size > CONFIG_SMM_RESERVED_SIZE);
 | 
						assert(sub_size > CONFIG_SMM_RESERVED_SIZE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,6 +33,7 @@
 | 
				
			|||||||
#include <fsp/memmap.h>
 | 
					#include <fsp/memmap.h>
 | 
				
			||||||
#include <fsp/util.h>
 | 
					#include <fsp/util.h>
 | 
				
			||||||
#include <intelblocks/cpulib.h>
 | 
					#include <intelblocks/cpulib.h>
 | 
				
			||||||
 | 
					#include <intelblocks/smm.h>
 | 
				
			||||||
#include <intelblocks/systemagent.h>
 | 
					#include <intelblocks/systemagent.h>
 | 
				
			||||||
#include <intelblocks/pmclib.h>
 | 
					#include <intelblocks/pmclib.h>
 | 
				
			||||||
#include <reset.h>
 | 
					#include <reset.h>
 | 
				
			||||||
@@ -269,7 +270,7 @@ asmlinkage void car_stage_entry(void)
 | 
				
			|||||||
	* when relocating the SMM handler as well as using the TSEG
 | 
						* when relocating the SMM handler as well as using the TSEG
 | 
				
			||||||
	* region for other purposes.
 | 
						* region for other purposes.
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	smm_region(&smm_base, &smm_size);
 | 
						smm_region_info(&smm_base, &smm_size);
 | 
				
			||||||
	tseg_base = (uintptr_t)smm_base;
 | 
						tseg_base = (uintptr_t)smm_base;
 | 
				
			||||||
	postcar_frame_add_mtrr(&pcf, tseg_base, smm_size, MTRR_TYPE_WRBACK);
 | 
						postcar_frame_add_mtrr(&pcf, tseg_base, smm_size, MTRR_TYPE_WRBACK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user