int do_printk(int msg_level, const char *fmt, ...) { va_list args; int i; if (!console_log_level(msg_level)) return 0; #if CONFIG_SQUELCH_EARLY_SMP && defined(__PRE_RAM__) if (!boot_cpu()) return 0; #endif DISABLE_TRACE; spin_lock(&console_lock); va_start(args, fmt); i = vtxprintf(wrap_putchar, fmt, args, NULL); va_end(args); console_tx_flush(); spin_unlock(&console_lock); ENABLE_TRACE; return i; }
void platform_fsp_memory_init_params_cb(FSPM_UPD *fspm_upd, uint32_t version) { FSPM_ARCH_UPD *aupd; const struct device *dev; const struct soc_intel_quark_config *config; void *rmu_data; size_t rmu_data_len; FSP_M_CONFIG *upd; /* Clear SMI and wake events */ clear_smi_and_wake_events(); /* Locate the RMU data file in flash */ rmu_data = locate_rmu_file(&rmu_data_len); if (!rmu_data) die("Microcode file (rmu.bin) not found."); /* Locate the configuration data from devicetree.cb */ dev = dev_find_slot(0, LPC_DEV_FUNC); if (!dev) die("ERROR - LPC device not found!"); config = dev->chip_info; /* Update the architectural UPD values. */ aupd = &fspm_upd->FspmArchUpd; aupd->BootLoaderTolumSize = cbmem_overhead_size(); aupd->StackBase = (void *)(CONFIG_FSP_ESRAM_LOC - aupd->StackSize); aupd->BootMode = FSP_BOOT_WITH_FULL_CONFIGURATION; /* Display the ESRAM layout */ if (IS_ENABLED(CONFIG_DISPLAY_ESRAM_LAYOUT)) { printk(BIOS_SPEW, "\nESRAM Layout:\n\n"); printk(BIOS_SPEW, "+-------------------+ 0x80080000 - ESRAM end\n"); printk(BIOS_SPEW, "| FSP binary |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%08x (CONFIG_FSP_ESRAM_LOC)\n", CONFIG_FSP_ESRAM_LOC); printk(BIOS_SPEW, "| FSP stack |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%p\n", aupd->StackBase); printk(BIOS_SPEW, "| |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%p\n", _car_relocatable_data_end); printk(BIOS_SPEW, "| coreboot data |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%p\n", _car_stack_end); printk(BIOS_SPEW, "| coreboot stack |\n"); printk(BIOS_SPEW, "+-------------------+ 0x80000000 - ESRAM start\n\n"); } /* Update the UPD data for MemoryInit */ upd = &fspm_upd->FspmConfig; upd->AddrMode = config->AddrMode; upd->ChanMask = config->ChanMask; upd->ChanWidth = config->ChanWidth; upd->DramDensity = config->DramDensity; upd->DramRonVal = config->DramRonVal; upd->DramRttNomVal = config->DramRttNomVal; upd->DramRttWrVal = config->DramRttWrVal; upd->DramSpeed = config->DramSpeed; upd->DramType = config->DramType; upd->DramWidth = config->DramWidth; upd->EccScrubBlkSize = config->EccScrubBlkSize; upd->EccScrubInterval = config->EccScrubInterval; upd->Flags = config->Flags; upd->FspReservedMemoryLength = config->FspReservedMemoryLength; upd->RankMask = config->RankMask; upd->RmuBaseAddress = (uintptr_t)rmu_data; upd->RmuLength = rmu_data_len; upd->SerialPortWriteChar = console_log_level(BIOS_SPEW) ? (uintptr_t)fsp_write_line : 0; upd->SmmTsegSize = IS_ENABLED(CONFIG_HAVE_SMI_HANDLER) ? config->SmmTsegSize : 0; upd->SocRdOdtVal = config->SocRdOdtVal; upd->SocWrRonVal = config->SocWrRonVal; upd->SocWrSlewRate = config->SocWrSlewRate; upd->SrInt = config->SrInt; upd->SrTemp = config->SrTemp; upd->tCL = config->tCL; upd->tFAW = config->tFAW; upd->tRAS = config->tRAS; upd->tRRD = config->tRRD; upd->tWTR = config->tWTR; }
/* Initialize the UPD parameters for MemoryInit */ void soc_memory_init_params(struct romstage_params *params, MEMORY_INIT_UPD *upd) { const struct device *dev; const struct soc_intel_quark_config *config; void *rmu_data; size_t rmu_data_len; /* Locate the configuration data from devicetree.cb */ dev = dev_find_slot(0, LPC_DEV_FUNC); if (!dev) { printk(BIOS_CRIT, "Error! Device (PCI:0:%02x.%01x) not found, " "soc_memory_init_params!\n", PCI_DEVICE_NUMBER_QNC_LPC, PCI_FUNCTION_NUMBER_QNC_LPC); return; } config = dev->chip_info; /* Clear SMI and wake events */ clear_smi_and_wake_events(); /* Locate the RMU data file in flash */ rmu_data = locate_rmu_file(&rmu_data_len); if (!rmu_data) die("Microcode file (rmu.bin) not found."); /* Display the ESRAM layout */ if (IS_ENABLED(CONFIG_DISPLAY_ESRAM_LAYOUT)) { printk(BIOS_SPEW, "\nESRAM Layout:\n\n"); printk(BIOS_SPEW, "+-------------------+ 0x80080000 - ESRAM end\n"); if (_car_relocatable_data_end != (void *)0x80080000) { printk(BIOS_SPEW, "| |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%p\n", _car_relocatable_data_end); } printk(BIOS_SPEW, "| coreboot data |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%p\n", _car_stack_end); printk(BIOS_SPEW, "| coreboot stack |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%p", _car_stack_start); if (IS_ENABLED(CONFIG_VBOOT_SEPARATE_VERSTAGE)) { printk(BIOS_SPEW, "\n"); printk(BIOS_SPEW, "| vboot data |\n"); printk(BIOS_SPEW, "+-------------------+ 0x%08x", CONFIG_DCACHE_RAM_BASE); } printk(BIOS_SPEW, " (CONFIG_DCACHE_RAM_BASE)\n"); printk(BIOS_SPEW, "| FSP data |\n"); printk(BIOS_SPEW, "+-------------------+\n"); printk(BIOS_SPEW, "| FSP stack |\n"); printk(BIOS_SPEW, "+-------------------+\n"); printk(BIOS_SPEW, "| FSP binary |\n"); printk(BIOS_SPEW, "+-------------------+ 0x80000000 - ESRAM start\n\n"); } /* Update the UPD data for MemoryInit */ upd->AddrMode = config->AddrMode; upd->ChanMask = config->ChanMask; upd->ChanWidth = config->ChanWidth; upd->DramDensity = config->DramDensity; upd->DramRonVal = config->DramRonVal; upd->DramRttNomVal = config->DramRttNomVal; upd->DramRttWrVal = config->DramRttWrVal; upd->DramSpeed = config->DramSpeed; upd->DramType = config->DramType; upd->DramWidth = config->DramWidth; upd->EccScrubBlkSize = config->EccScrubBlkSize; upd->EccScrubInterval = config->EccScrubInterval; upd->Flags = config->Flags; upd->FspReservedMemoryLength = config->FspReservedMemoryLength; upd->RankMask = config->RankMask; upd->RmuBaseAddress = (uintptr_t)rmu_data; upd->RmuLength = rmu_data_len; upd->SerialPortWriteChar = console_log_level(BIOS_SPEW) ? (uintptr_t)fsp_write_line : 0; upd->SmmTsegSize = IS_ENABLED(CONFIG_HAVE_SMI_HANDLER) ? config->SmmTsegSize : 0; upd->SocRdOdtVal = config->SocRdOdtVal; upd->SocWrRonVal = config->SocWrRonVal; upd->SocWrSlewRate = config->SocWrSlewRate; upd->SrInt = config->SrInt; upd->SrTemp = config->SrTemp; upd->tCL = config->tCL; upd->tFAW = config->tFAW; upd->tRAS = config->tRAS; upd->tRRD = config->tRRD; upd->tWTR = config->tWTR; }