Commit d062c134 authored by Tom Rini's avatar Tom Rini
Browse files

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Add a new SMBIOS parser and enable it when booting from coreboot
- Fix up various driver names to avoid dtoc warnings
- Fully enable ACPI support on Google Chromebook Coral
- Add a way to set SMBIOS properties using the devicetree
- Update existing boards to use devicetree for SMBIOS using a new
  default sysinfo driver
parents 71d3fa7e e4f8e543
...@@ -198,6 +198,8 @@ config X86 ...@@ -198,6 +198,8 @@ config X86
imply RTC_MC146818 imply RTC_MC146818
imply IRQ imply IRQ
imply ACPIGEN if !QEMU imply ACPIGEN if !QEMU
imply SYSINFO if GENERATE_SMBIOS_TABLE
imply SYSINFO_SMBIOS if GENERATE_SMBIOS_TABLE
# Thing to enable for when SPL/TPL are enabled: SPL # Thing to enable for when SPL/TPL are enabled: SPL
imply SPL_DM imply SPL_DM
......
// SPDX-License-Identifier: GPL-2.0+ // SPDX-License-Identifier: GPL-2.0+
/ {
smbios {
compatible = "u-boot,sysinfo-smbios";
smbios {
system {
product = "uDPU";
};
baseboard {
product = "uDPU";
};
chassis {
product = "uDPU";
};
};
};
};
&spi0 { &spi0 {
u-boot,dm-pre-reloc; u-boot,dm-pre-reloc;
......
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2020 Linumiz
* Author: Parthiban Nallathambi <parthiban@linumiz.com>
*/
/ {
smbios {
compatible = "u-boot,sysinfo-smbios";
smbios {
system {
manufacturer = "MYiR";
};
baseboard {
manufacturer = "MYiR";
};
chassis {
manufacturer = "MYiR";
};
};
};
};
...@@ -6,6 +6,29 @@ ...@@ -6,6 +6,29 @@
#include "meson-gx-u-boot.dtsi" #include "meson-gx-u-boot.dtsi"
/ {
smbios {
compatible = "u-boot,sysinfo-smbios";
smbios {
system {
manufacturer = "Hardkernel Co., Ltd.";
product = "ODROID-C2";
};
baseboard {
manufacturer = "Hardkernel Co., Ltd.";
product = "ODROID-C2";
};
chassis {
manufacturer = "Hardkernel Co., Ltd.";
product = "ODROID-C2";
};
};
};
};
&usb0 { &usb0 {
status = "disabled"; status = "disabled";
}; };
......
...@@ -9,6 +9,27 @@ ...@@ -9,6 +9,27 @@
chosen { chosen {
u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc; u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc;
}; };
smbios {
compatible = "u-boot,sysinfo-smbios";
smbios {
system {
manufacturer = "firefly";
product = "roc-rk3328-cc";
};
baseboard {
manufacturer = "firefly";
product = "roc-rk3328-cc";
};
chassis {
manufacturer = "firefly";
product = "roc-rk3328-cc";
};
};
};
}; };
&gpio0 { &gpio0 {
......
...@@ -6,6 +6,29 @@ ...@@ -6,6 +6,29 @@
#include "rk3328-u-boot.dtsi" #include "rk3328-u-boot.dtsi"
#include "rk3328-sdram-ddr3-666.dtsi" #include "rk3328-sdram-ddr3-666.dtsi"
/ {
smbios {
compatible = "u-boot,sysinfo-smbios";
smbios {
system {
manufacturer = "radxa";
product = "rock-pi-e_rk3328";
};
baseboard {
manufacturer = "radxa";
product = "rock-pi-e_rk3328";
};
chassis {
manufacturer = "radxa";
product = "rock-pi-e_rk3328";
};
};
};
};
&gpio0 { &gpio0 {
u-boot,dm-spl; u-boot,dm-spl;
}; };
......
...@@ -9,6 +9,27 @@ ...@@ -9,6 +9,27 @@
chosen { chosen {
u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc; u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc;
}; };
smbios {
compatible = "u-boot,sysinfo-smbios";
smbios {
system {
manufacturer = "pine64";
product = "rock64_rk3328";
};
baseboard {
manufacturer = "pine64";
product = "rock64_rk3328";
};
chassis {
manufacturer = "pine64";
product = "rock64_rk3328";
};
};
};
}; };
&gpio0 { &gpio0 {
......
...@@ -14,6 +14,26 @@ ...@@ -14,6 +14,26 @@
u-boot,spl-boot-order = &emmc, &sdmmc; u-boot,spl-boot-order = &emmc, &sdmmc;
}; };
smbios {
compatible = "u-boot,sysinfo-smbios";
smbios {
system {
manufacturer = "rockchip";
product = "sheep_rk3368";
};
baseboard {
manufacturer = "rockchip";
product = "sheep_rk3368";
};
chassis {
manufacturer = "rockchip";
product = "sheep_rk3368";
};
};
};
}; };
&pinctrl { &pinctrl {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
}; };
board { board {
compatible = "gdsys,board_gazerbeam"; compatible = "gdsys,sysinfo-gazerbeam";
csb = <&board_soc>; csb = <&board_soc>;
serdes = <&SERDES>; serdes = <&SERDES>;
rxaui0 = <&RXAUI0_0>; rxaui0 = <&RXAUI0_0>;
......
...@@ -1103,10 +1103,6 @@ ...@@ -1103,10 +1103,6 @@
compatible = "sandbox,sandbox_osd"; compatible = "sandbox,sandbox_osd";
}; };
board {
compatible = "sandbox,board_sandbox";
};
sandbox_tee { sandbox_tee {
compatible = "sandbox,tee"; compatible = "sandbox,tee";
}; };
...@@ -1242,6 +1238,10 @@ ...@@ -1242,6 +1238,10 @@
reset-names = "valid", "no_mask", "out_of_range"; reset-names = "valid", "no_mask", "out_of_range";
}; };
sysinfo {
compatible = "sandbox,sysinfo-sandbox";
};
some_regmapped-bus { some_regmapped-bus {
#address-cells = <0x1>; #address-cells = <0x1>;
#size-cells = <0x1>; #size-cells = <0x1>;
......
...@@ -65,6 +65,21 @@ int arch_write_sci_irq_select(uint scis) ...@@ -65,6 +65,21 @@ int arch_write_sci_irq_select(uint scis)
return 0; return 0;
} }
/**
* chromeos_init_acpi() - Initialise basic data to boot Chrome OS
*
* This tells Chrome OS to boot in developer mode
*
* @cros: Structure to initialise
*/
static void chromeos_init_acpi(struct chromeos_acpi_gnvs *cros)
{
cros->active_main_fw = 1;
cros->active_main_fw = 1; /* A */
cros->switches = CHSW_DEVELOPER_SWITCH;
cros->main_fw_type = 2; /* Developer */
}
int acpi_create_gnvs(struct acpi_global_nvs *gnvs) int acpi_create_gnvs(struct acpi_global_nvs *gnvs)
{ {
struct udevice *cpu; struct udevice *cpu;
...@@ -75,11 +90,9 @@ int acpi_create_gnvs(struct acpi_global_nvs *gnvs) ...@@ -75,11 +90,9 @@ int acpi_create_gnvs(struct acpi_global_nvs *gnvs)
/* TODO(sjg@chromium.org): Add the console log to gnvs->cbmc */ /* TODO(sjg@chromium.org): Add the console log to gnvs->cbmc */
#ifdef CONFIG_CHROMEOS if (IS_ENABLED(CONFIG_CHROMEOS))
/* Initialise Verified Boot data */ chromeos_init_acpi(&gnvs->chromeos);
chromeos_init_acpi(&gnvs->chromeos);
gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO;
#endif
/* Set unknown wake source */ /* Set unknown wake source */
gnvs->pm1i = ~0ULL; gnvs->pm1i = ~0ULL;
...@@ -92,6 +105,8 @@ int acpi_create_gnvs(struct acpi_global_nvs *gnvs) ...@@ -92,6 +105,8 @@ int acpi_create_gnvs(struct acpi_global_nvs *gnvs)
gnvs->pcnt = ret; gnvs->pcnt = ret;
} }
gnvs->dpte = 1;
return 0; return 0;
} }
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include <asm/cpu_x86.h> #include <asm/cpu_x86.h>
#include <asm/intel_acpi.h> #include <asm/intel_acpi.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/mtrr.h>
#include <asm/arch/cpu.h>
#include <asm/arch/iomap.h>
#include <dm/acpi.h> #include <dm/acpi.h>
#define CSTATE_RES(address_space, width, offset, address) \ #define CSTATE_RES(address_space, width, offset, address) \
...@@ -86,6 +89,86 @@ static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx) ...@@ -86,6 +89,86 @@ static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
return 0; return 0;
} }
static void update_fixed_mtrrs(void)
{
native_write_msr(MTRR_FIX_64K_00000_MSR,
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
native_write_msr(MTRR_FIX_16K_80000_MSR,
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
native_write_msr(MTRR_FIX_4K_E0000_MSR,
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
native_write_msr(MTRR_FIX_4K_E8000_MSR,
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
native_write_msr(MTRR_FIX_4K_F0000_MSR,
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
native_write_msr(MTRR_FIX_4K_F8000_MSR,
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
}
static void setup_core_msrs(void)
{
wrmsrl(MSR_PMG_CST_CONFIG_CONTROL,
PKG_C_STATE_LIMIT_C2_MASK | CORE_C_STATE_LIMIT_C10_MASK |
IO_MWAIT_REDIRECT_MASK | CST_CFG_LOCK_MASK);
/* Power Management I/O base address for I/O trapping to C-states */
wrmsrl(MSR_PMG_IO_CAPTURE_ADR, ACPI_PMIO_CST_REG |
(PMG_IO_BASE_CST_RNG_BLK_SIZE << 16));
/* Disable C1E */
msr_clrsetbits_64(MSR_POWER_CTL, 0x2, 0);
/* Disable support for MONITOR and MWAIT instructions */
msr_clrsetbits_64(MSR_IA32_MISC_ENABLE, MISC_ENABLE_MWAIT, 0);
/*
* Enable and Lock the Advanced Encryption Standard (AES-NI)
* feature register
*/
msr_clrsetbits_64(MSR_FEATURE_CONFIG, FEATURE_CONFIG_RESERVED_MASK,
FEATURE_CONFIG_LOCK);
update_fixed_mtrrs();
}
static int soc_core_init(void)
{
struct udevice *pmc;
int ret;
/* Clear out pending MCEs */
cpu_mca_configure();
/* Set core MSRs */
setup_core_msrs();
/*
* Enable ACPI PM timer emulation, which also lets microcode know
* location of ACPI_BASE_ADDRESS. This also enables other features
* implemented in microcode.
*/
ret = uclass_first_device_err(UCLASS_ACPI_PMC, &pmc);
if (ret)
return log_msg_ret("PMC", ret);
enable_pm_timer_emulation(pmc);
return 0;
}
static int cpu_apl_probe(struct udevice *dev)
{
if (gd->flags & GD_FLG_RELOC) {
int ret;
ret = soc_core_init();
if (ret)
return log_ret(ret);
}
return 0;
}
struct acpi_ops apl_cpu_acpi_ops = { struct acpi_ops apl_cpu_acpi_ops = {
.fill_ssdt = acpi_cpu_fill_ssdt, .fill_ssdt = acpi_cpu_fill_ssdt,
}; };
...@@ -102,11 +185,12 @@ static const struct udevice_id cpu_x86_apl_ids[] = { ...@@ -102,11 +185,12 @@ static const struct udevice_id cpu_x86_apl_ids[] = {
{ } { }
}; };
U_BOOT_DRIVER(cpu_x86_apl_drv) = { U_BOOT_DRIVER(intel_apl_cpu) = {
.name = "cpu_x86_apl", .name = "intel_apl_cpu",
.id = UCLASS_CPU, .id = UCLASS_CPU,
.of_match = cpu_x86_apl_ids, .of_match = cpu_x86_apl_ids,
.bind = cpu_x86_bind, .bind = cpu_x86_bind,
.probe = cpu_apl_probe,
.ops = &cpu_x86_apl_ops, .ops = &cpu_x86_apl_ops,
ACPI_OPS_PTR(&apl_cpu_acpi_ops) ACPI_OPS_PTR(&apl_cpu_acpi_ops)
.flags = DM_FLAG_PRE_RELOC, .flags = DM_FLAG_PRE_RELOC,
......
...@@ -4,8 +4,13 @@ ...@@ -4,8 +4,13 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <log.h>
#include <asm/cpu_common.h> #include <asm/cpu_common.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/arch/cpu.h>
#include <asm/arch/iomap.h>
#include <power/acpi_pmc.h>
void cpu_flush_l1d_to_l2(void) void cpu_flush_l1d_to_l2(void)
{ {
...@@ -15,3 +20,23 @@ void cpu_flush_l1d_to_l2(void) ...@@ -15,3 +20,23 @@ void cpu_flush_l1d_to_l2(void)
msr.lo |= FLUSH_DL1_L2; msr.lo |= FLUSH_DL1_L2;
msr_write(MSR_POWER_MISC, msr); msr_write(MSR_POWER_MISC, msr);
} }
void enable_pm_timer_emulation(const struct udevice *pmc)
{
struct acpi_pmc_upriv *upriv = dev_get_uclass_priv(pmc);
msr_t msr;
/*
* The derived frequency is calculated as follows:
* (CTC_FREQ * msr[63:32]) >> 32 = target frequency.
*
* Back-solve the multiplier so the 3.579545MHz ACPI timer frequency is
* used.
*/
msr.hi = (3579545ULL << 32) / CTC_FREQ;
/* Set PM1 timer IO port and enable */
msr.lo = EMULATE_PM_TMR_EN | (upriv->acpi_base + R_ACPI_PM1_TMR);
debug("PM timer %x %x\n", msr.hi, msr.lo);
msr_write(MSR_EMULATE_PM_TIMER, msr);
}
...@@ -114,26 +114,6 @@ static int fast_spi_cache_bios_region(void) ...@@ -114,26 +114,6 @@ static int fast_spi_cache_bios_region(void)
return 0; return 0;
} }
static void enable_pm_timer_emulation(struct udevice *pmc)
{
struct acpi_pmc_upriv *upriv = dev_get_uclass_priv(pmc);
msr_t msr;
/*
* The derived frequency is calculated as follows:
* (CTC_FREQ * msr[63:32]) >> 32 = target frequency.
*
* Back-solve the multiplier so the 3.579545MHz ACPI timer frequency is
* used.
*/
msr.hi = (3579545ULL << 32) / CTC_FREQ;
/* Set PM1 timer IO port and enable */
msr.lo = EMULATE_PM_TMR_EN | (upriv->acpi_base + R_ACPI_PM1_TMR);
debug("PM timer %x %x\n", msr.hi, msr.lo);
msr_write(MSR_EMULATE_PM_TIMER, msr);
}
static void google_chromeec_ioport_range(uint *out_basep, uint *out_sizep) static void google_chromeec_ioport_range(uint *out_basep, uint *out_sizep)
{ {
uint base; uint base;
......
...@@ -116,10 +116,10 @@ static int set_power_limits(struct udevice *dev) ...@@ -116,10 +116,10 @@ static int set_power_limits(struct udevice *dev)
/* Program package power limits in RAPL MSR */ /* Program package power limits in RAPL MSR */
msr_write(MSR_PKG_POWER_LIMIT, limit); msr_write(MSR_PKG_POWER_LIMIT, limit);
log_info("RAPL PL1 %d.%dW\n", tdp / power_unit, log_debug("RAPL PL1 %d.%dW\n", tdp / power_unit,
100 * (tdp % power_unit) / power_unit); 100 * (tdp % power_unit) / power_unit);
log_info("RAPL PL2 %d.%dW\n", pl2_val / power_unit, log_debug("RAPL PL2 %d.%dW\n", pl2_val / power_unit,
100 * (pl2_val % power_unit) / power_unit); 100 * (pl2_val % power_unit) / power_unit);
/* /*
* Sett RAPL MMIO register for Power limits. RAPL driver is using MSR * Sett RAPL MMIO register for Power limits. RAPL driver is using MSR
......
...@@ -396,7 +396,7 @@ static const struct udevice_id apl_hostbridge_ids[] = { ...@@ -396,7 +396,7 @@ static const struct udevice_id apl_hostbridge_ids[] = {
{ } { }
}; };
U_BOOT_DRIVER(apl_hostbridge_drv) = { U_BOOT_DRIVER(intel_apl_hostbridge) = {
.name = "intel_apl_hostbridge", .name = "intel_apl_hostbridge",
.id = UCLASS_NORTHBRIDGE, .id = UCLASS_NORTHBRIDGE,
.of_match = apl_hostbridge_ids, .of_match = apl_hostbridge_ids,
......
...@@ -133,7 +133,7 @@ static const struct udevice_id apl_lpc_ids[] = { ...@@ -133,7 +133,7 @@ static const struct udevice_id apl_lpc_ids[] = {
}; };
/* All pads are LPC already configured by the hostbridge, so no probing here */ /* All pads are LPC already configured by the hostbridge, so no probing here */
U_BOOT_DRIVER(apl_lpc_drv) = { U_BOOT_DRIVER(intel_apl_lpc) = {
.name = "intel_apl_lpc", .name = "intel_apl_lpc",
.id = UCLASS_LPC, .id = UCLASS_LPC,
.of_match = apl_lpc_ids, .of_match = apl_lpc_ids,
......
...@@ -28,8 +28,8 @@ static const struct udevice_id apl_pch_ids[] = { ...@@ -28,8 +28,8 @@ static const struct udevice_id apl_pch_ids[] = {
{ } { }
}; };
U_BOOT_DRIVER(apl_pch) = { U_BOOT_DRIVER(intel_apl_pch) = {
.name = "apl_pch", .name = "intel_apl_pch",
.id = UCLASS_PCH, .id = UCLASS_PCH,
.of_match = apl_pch_ids, .of_match = apl_pch_ids,
.ops = &apl_pch_ops, .ops = &apl_pch_ops,
......
...@@ -217,7 +217,7 @@ static const struct udevice_id apl_pmc_ids[] = { ...@@ -217,7 +217,7 @@ static const struct udevice_id apl_pmc_ids[] = {
{ } { }
}; };
U_BOOT_DRIVER(apl_pmc) = { U_BOOT_DRIVER(intel_apl_pmc) = {
.name = "intel_apl_pmc", .name = "intel_apl_pmc",
.id = UCLASS_ACPI_PMC, .id = UCLASS_ACPI_PMC,
.of_match = apl_pmc_ids, .of_match = apl_pmc_ids,
......
...@@ -88,8 +88,8 @@ static const struct udevice_id apl_syscon_ids[] = { ...@@ -88,8 +88,8 @@ static const struct udevice_id apl_syscon_ids[] = {
{ } { }
}; };
U_BOOT_DRIVER(syscon_intel_punit) = { U_BOOT_DRIVER(intel_apl_punit) = {
.name = "intel_punit_syscon", .name = "intel_apl_punit",
.id = UCLASS_SYSCON, .id = UCLASS_SYSCON,
.of_match = apl_syscon_ids, .of_match = apl_syscon_ids,
.probe = apl_punit_probe, .probe = apl_punit_probe,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment