- 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
This commit is contained in:
Tom Rini
2020-11-06 08:41:49 -05:00
144 changed files with 1645 additions and 590 deletions

View File

@@ -4,7 +4,9 @@
*/
#include <common.h>
#include <asm/arch/sysinfo.h>
#include <init.h>
#include <smbios.h>
int board_early_init_r(void)
{
@@ -16,3 +18,46 @@ int board_early_init_r(void)
return 0;
}
#ifdef CONFIG_SMBIOS_PARSER
int show_board_info(void)
{
const struct smbios_entry *smbios = smbios_entry(lib_sysinfo.smbios_start, lib_sysinfo.smbios_size);
if (!smbios)
goto fallback;
const struct smbios_header *bios = smbios_header(smbios, SMBIOS_BIOS_INFORMATION);
const struct smbios_header *system = smbios_header(smbios, SMBIOS_SYSTEM_INFORMATION);
const struct smbios_type0 *t0 = (struct smbios_type0 *)bios;
const struct smbios_type1 *t1 = (struct smbios_type1 *)system;
if (!t0 || !t1)
goto fallback;
const char *bios_ver = smbios_string(bios, t0->bios_ver);
const char *model = smbios_string(system, t1->product_name);
const char *manufacturer = smbios_string(system, t1->manufacturer);
if (!model || !manufacturer || !bios_ver)
goto fallback;
printf("Vendor: %s\n", manufacturer);
printf("Model: %s\n", model);
printf("BIOS Version: %s\n", bios_ver);
return 0;
fallback:
#ifdef CONFIG_OF_CONTROL
DECLARE_GLOBAL_DATA_PTR;
model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
if (model)
printf("Model: %s\n", model);
#endif
return checkboard();
}
#endif

View File

@@ -16,7 +16,7 @@
#include <dm.h>
#include <misc.h>
#include <regmap.h>
#include <board.h>
#include <sysinfo.h>
#include "../../../drivers/misc/gdsys_soc.h"
#include "../../../drivers/misc/gdsys_ioep.h"
@@ -506,11 +506,11 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct udevice *ioep = NULL;
struct udevice *board;
struct udevice *sysinfo;
char name[8];
int ret;
if (board_get(&board))
if (sysinfo_get(&sysinfo))
return CMD_RET_FAILURE;
if (argc > 1) {
@@ -518,7 +518,8 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
snprintf(name, sizeof(name), "ioep%d", i);
ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &ioep);
ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo, name,
&ioep);
if (ret || !ioep) {
printf("Invalid IOEP %d\n", i);
@@ -532,7 +533,8 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
while (1) {
snprintf(name, sizeof(name), "ioep%d", i);
ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &ioep);
ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo,
name, &ioep);
if (ret || !ioep)
break;

View File

@@ -6,7 +6,6 @@
*/
#include <common.h>
#include <board.h>
#include <command.h>
#include <dm.h>
#include <env.h>
@@ -15,11 +14,12 @@
#include <init.h>
#include <miiphy.h>
#include <misc.h>
#include <sysinfo.h>
#include <tpm-v1.h>
#include <video_osd.h>
#include "../common/ihs_mdio.h"
#include "../../../drivers/board/gazerbeam.h"
#include "../../../drivers/sysinfo/gazerbeam.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -43,22 +43,22 @@ static int get_tpm(struct udevice **devp)
int board_early_init_r(void)
{
struct udevice *board;
struct udevice *sysinfo;
struct udevice *serdes;
int mc = 0;
int con = 0;
if (board_get(&board))
puts("Could not find board information device.\n");
if (sysinfo_get(&sysinfo))
puts("Could not find sysinfo information device.\n");
/* Initialize serdes */
uclass_get_device_by_phandle(UCLASS_MISC, board, "serdes", &serdes);
uclass_get_device_by_phandle(UCLASS_MISC, sysinfo, "serdes", &serdes);
if (board_detect(board))
if (sysinfo_detect(sysinfo))
puts("Device information detection failed.\n");
board_get_int(board, BOARD_MULTICHANNEL, &mc);
board_get_int(board, BOARD_VARIANT, &con);
sysinfo_get_int(sysinfo, BOARD_MULTICHANNEL, &mc);
sysinfo_get_int(sysinfo, BOARD_VARIANT, &con);
if (mc == 2 || mc == 1)
dev_disable_by_path("/immr@e0000000/i2c@3100/pca9698@22");
@@ -84,18 +84,18 @@ int board_early_init_r(void)
return 0;
}
int checkboard(void)
int checksysinfo(void)
{
struct udevice *board;
struct udevice *sysinfo;
char *s = env_get("serial#");
int mc = 0;
int con = 0;
if (board_get(&board))
puts("Could not find board information device.\n");
if (sysinfo_get(&sysinfo))
puts("Could not find sysinfo information device.\n");
board_get_int(board, BOARD_MULTICHANNEL, &mc);
board_get_int(board, BOARD_VARIANT, &con);
sysinfo_get_int(sysinfo, BOARD_MULTICHANNEL, &mc);
sysinfo_get_int(sysinfo, BOARD_VARIANT, &con);
puts("Board: Gazerbeam ");
printf("%s ", mc == 4 ? "MC4" : mc == 2 ? "MC2" : "SC");
@@ -123,20 +123,22 @@ int last_stage_init(void)
{
int fpga_hw_rev = 0;
int i;
struct udevice *board;
struct udevice *sysinfo;
struct udevice *osd;
struct video_osd_info osd_info;
struct udevice *tpm;
int ret;
if (board_get(&board))
puts("Could not find board information device.\n");
if (sysinfo_get(&sysinfo))
puts("Could not find sysinfo information device.\n");
if (board) {
int res = board_get_int(board, BOARD_HWVERSION, &fpga_hw_rev);
if (sysinfo) {
int res = sysinfo_get_int(sysinfo, BOARD_HWVERSION,
&fpga_hw_rev);
if (res)
printf("Could not determind FPGA HW revision (res = %d)\n", res);
printf("Could not determind FPGA HW revision (res = %d)\n",
res);
}
env_set_ulong("fpga_hw_rev", fpga_hw_rev);
@@ -154,7 +156,8 @@ int last_stage_init(void)
snprintf(name, sizeof(name), "rxaui%d", i);
/* Disable RXAUI polarity inversion */
ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &rxaui);
ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo,
name, &rxaui);
if (!ret)
misc_set_enabled(rxaui, false);
}

View File

@@ -150,7 +150,7 @@ static const struct udevice_id coral_ids[] = {
U_BOOT_DRIVER(coral_drv) = {
.name = "coral",
.id = UCLASS_BOARD,
.id = UCLASS_SYSINFO,
.of_match = coral_ids,
ACPI_OPS_PTR(&coral_acpi_ops)
};

View File

@@ -22,15 +22,4 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select BOARD_ROMSIZE_KB_1024
select SPI_FLASH_WINBOND
config SMBIOS_PRODUCT_NAME
default "GalileoGen2"
help
Override the default product name U-Boot reports in the SMBIOS
table, to be compatible with the Intel provided UEFI BIOS, as
Linux kernel drivers (drivers/mfd/intel_quark_i2c_gpio.c and
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c) make use of
it to do different board level configuration.
This can be "Galileo" for GEN1 Galileo board.
endif