mb/lenovo/m900_tiny: Put options in CFR cbtable
Change-Id: I259f88a3ceb9aee54016bb88a7d4de2b58dffa83 Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/87048 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
parent
26d6da4533
commit
cb86b9a089
4 changed files with 113 additions and 4 deletions
|
|
@ -6,6 +6,8 @@ if BOARD_LENOVO_THINKCENTRE_M900_TINY
|
|||
config BOARD_SPECIFIC_OPTIONS
|
||||
def_bool y
|
||||
select BOARD_ROMSIZE_KB_16384
|
||||
select DRIVERS_EFI_VARIABLE_STORE
|
||||
select DRIVERS_OPTION_CFR
|
||||
select DRIVERS_UART_8250IO
|
||||
select HAVE_ACPI_RESUME
|
||||
select HAVE_ACPI_TABLES
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ bootblock-y += gpio_early.c
|
|||
|
||||
romstage-y += romstage.c
|
||||
|
||||
ramstage-$(CONFIG_DRIVERS_OPTION_CFR) += cfr.c
|
||||
ramstage-y += gpio.c
|
||||
ramstage-y += hda_verb.c
|
||||
ramstage-y += ramstage.c
|
||||
|
|
|
|||
79
src/mainboard/lenovo/m900_tiny/cfr.c
Normal file
79
src/mainboard/lenovo/m900_tiny/cfr.c
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <boot/coreboot_tables.h>
|
||||
#include <drivers/option/cfr_frontend.h>
|
||||
|
||||
struct sm_object wifi_slot_enable = SM_DECLARE_BOOL({
|
||||
.flags = CFR_OPTFLAG_RUNTIME,
|
||||
.opt_name = "wifi_slot_enable",
|
||||
.ui_name = "Enable Wi-Fi card slot",
|
||||
.ui_helptext = "Enable or disable detection of devices in the Wi-Fi card slot",
|
||||
.default_value = true,
|
||||
});
|
||||
|
||||
struct sm_object ssd_slot_enable = SM_DECLARE_BOOL({
|
||||
.flags = CFR_OPTFLAG_RUNTIME,
|
||||
.opt_name = "ssd_slot_enable",
|
||||
.ui_name = "Enable SSD slot",
|
||||
.ui_helptext = "Enable or disable detection of devices in the SSD slot",
|
||||
.default_value = true,
|
||||
});
|
||||
|
||||
struct sm_object hdd_slot_enable = SM_DECLARE_BOOL({
|
||||
.flags = CFR_OPTFLAG_RUNTIME,
|
||||
.opt_name = "hdd_slot_enable",
|
||||
.ui_name = "Enable 2.5 inch disk slot",
|
||||
.ui_helptext = "Enable or disable detection of devices in the 2.5 inch disk slot",
|
||||
.default_value = true,
|
||||
});
|
||||
|
||||
static struct sm_obj_form devices = {
|
||||
.ui_name = "Devices",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&wifi_slot_enable,
|
||||
&ssd_slot_enable,
|
||||
&hdd_slot_enable,
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
struct sm_object ps2_enable = SM_DECLARE_BOOL({
|
||||
.flags = CFR_OPTFLAG_RUNTIME,
|
||||
.opt_name = "ps2_enable",
|
||||
.ui_name = "PS/2 controller",
|
||||
.ui_helptext = "Enable or disable the PS/2 controller",
|
||||
.default_value = true,
|
||||
});
|
||||
|
||||
struct sm_object power_on_after_fail = SM_DECLARE_ENUM({
|
||||
.flags = CFR_OPTFLAG_RUNTIME,
|
||||
.opt_name = "power_on_after_fail",
|
||||
.ui_name = "Power state after fail",
|
||||
.ui_helptext = "State of the platform after external power is restored",
|
||||
.default_value = CONFIG_MAINBOARD_POWER_FAILURE_STATE,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Off", 0 },
|
||||
{ "On", 1 },
|
||||
{ "Previous", 2 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
static struct sm_obj_form superio = {
|
||||
.ui_name = "Super I/O",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&ps2_enable,
|
||||
&power_on_after_fail,
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form *sm_root[] = {
|
||||
&devices,
|
||||
&superio,
|
||||
NULL
|
||||
};
|
||||
|
||||
void mb_cfr_setup_menu(struct lb_cfr *cfr_root)
|
||||
{
|
||||
cfr_write_setup_menu(cfr_root, sm_root);
|
||||
}
|
||||
|
|
@ -2,10 +2,14 @@
|
|||
|
||||
#include <console/console.h>
|
||||
#include <device/device.h>
|
||||
#include <device/pci_def.h>
|
||||
#include <drivers/intel/gma/int15.h>
|
||||
#include <gpio.h>
|
||||
#include <mainboard/gpio.h>
|
||||
#include <option.h>
|
||||
#include <soc/ramstage.h>
|
||||
#include <static.h>
|
||||
#include <superio/nuvoton/nct6687d/nct6687d.h>
|
||||
|
||||
static void print_board_id(void)
|
||||
{
|
||||
|
|
@ -32,19 +36,42 @@ static void print_board_id(void)
|
|||
}
|
||||
|
||||
printk(BIOS_INFO, "Serial header %spopulated\n", !gpio_get(GPP_A22) ? "" : "un");
|
||||
|
||||
printk(BIOS_INFO, "PS/2 header %spopulated\n", !gpio_get(GPP_D14) ? "" : "un");
|
||||
|
||||
printk(BIOS_INFO, "USB header %spopulated\n", !gpio_get(GPP_C19) ? "" : "un");
|
||||
|
||||
printk(BIOS_INFO, "DisplayPort header %spopulated\n", !gpio_get(GPP_B15) ? "" : "un");
|
||||
|
||||
printk(BIOS_INFO, "PCIe / SATA header %spopulated\n", !gpio_get(GPP_B21) ? "" : "un");
|
||||
}
|
||||
|
||||
static void devtree_update(void)
|
||||
{
|
||||
config_t *cfg = config_of_soc();
|
||||
struct device *wifi_dev = DEV_PTR(pcie_rp7);
|
||||
struct device *ssd_dev = DEV_PTR(pcie_rp17);
|
||||
struct device *ps2_dev = dev_find_slot_pnp(0x2e, NCT6687D_KBC);
|
||||
|
||||
if (get_uint_option("wifi_slot_enable", 1) == 0) {
|
||||
cfg->usb2_ports[8].enable = 0;
|
||||
wifi_dev->enabled = 0;
|
||||
}
|
||||
|
||||
if (get_uint_option("ssd_slot_enable", 1) == 0) {
|
||||
cfg->SataPortsEnable[4] = 0;
|
||||
ssd_dev->enabled = 0;
|
||||
}
|
||||
|
||||
if (get_uint_option("hdd_slot_enable", 1) == 0) {
|
||||
cfg->SataPortsEnable[0] = 0;
|
||||
cfg->SataPortsEnable[1] = 0;
|
||||
}
|
||||
|
||||
if (get_uint_option("ps2_enable", 1) == 0)
|
||||
ps2_dev->enabled = 0;
|
||||
}
|
||||
|
||||
static void mainboard_enable(struct device *dev)
|
||||
{
|
||||
mainboard_configure_gpios();
|
||||
devtree_update();
|
||||
print_board_id();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue