- 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:
@@ -30,8 +30,6 @@ source "drivers/ddr/Kconfig"
|
||||
|
||||
source "drivers/demo/Kconfig"
|
||||
|
||||
source "drivers/board/Kconfig"
|
||||
|
||||
source "drivers/ddr/fsl/Kconfig"
|
||||
|
||||
source "drivers/dfu/Kconfig"
|
||||
@@ -114,6 +112,8 @@ source "drivers/spi/Kconfig"
|
||||
|
||||
source "drivers/spmi/Kconfig"
|
||||
|
||||
source "drivers/sysinfo/Kconfig"
|
||||
|
||||
source "drivers/sysreset/Kconfig"
|
||||
|
||||
source "drivers/tee/Kconfig"
|
||||
|
||||
@@ -27,9 +27,9 @@ obj-$(CONFIG_$(SPL_TPL_)TIMER) += timer/
|
||||
obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/
|
||||
obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/
|
||||
obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/
|
||||
obj-$(CONFIG_$(SPL_)SYSINFO) += sysinfo/
|
||||
obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/
|
||||
obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += power/acpi_pmc/
|
||||
obj-$(CONFIG_$(SPL_)BOARD) += board/
|
||||
obj-$(CONFIG_XEN) += xen/
|
||||
obj-$(CONFIG_$(SPL_)FPGA) += fpga/
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
menuconfig BOARD
|
||||
bool "Device Information"
|
||||
help
|
||||
Support methods to query hardware configurations from internal
|
||||
mechanisms (e.g. reading GPIO values, determining the presence of
|
||||
devices on busses, etc.). This enables the usage of U-Boot with
|
||||
modular board architectures.
|
||||
|
||||
if BOARD
|
||||
|
||||
config SPL_BOARD
|
||||
depends on SPL_DM
|
||||
bool "Enable board driver support in SPL"
|
||||
|
||||
config BOARD_GAZERBEAM
|
||||
bool "Enable board driver for the Gazerbeam board"
|
||||
help
|
||||
Support querying device information for the gdsys Gazerbeam board.
|
||||
|
||||
config BOARD_SANDBOX
|
||||
bool "Enable board driver for the Sandbox board"
|
||||
help
|
||||
Support querying device information for the Sandbox boards.
|
||||
|
||||
endif
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# (C) Copyright 2017
|
||||
# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
||||
obj-y += board-uclass.o
|
||||
obj-$(CONFIG_BOARD_GAZERBEAM) += gazerbeam.o
|
||||
obj-$(CONFIG_BOARD_SANDBOX) += sandbox.o
|
||||
@@ -1,71 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* (C) Copyright 2017
|
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <board.h>
|
||||
|
||||
int board_get(struct udevice **devp)
|
||||
{
|
||||
return uclass_first_device_err(UCLASS_BOARD, devp);
|
||||
}
|
||||
|
||||
int board_detect(struct udevice *dev)
|
||||
{
|
||||
struct board_ops *ops = board_get_ops(dev);
|
||||
|
||||
if (!ops->detect)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->detect(dev);
|
||||
}
|
||||
|
||||
int board_get_fit_loadable(struct udevice *dev, int index,
|
||||
const char *type, const char **strp)
|
||||
{
|
||||
struct board_ops *ops = board_get_ops(dev);
|
||||
|
||||
if (!ops->get_fit_loadable)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_fit_loadable(dev, index, type, strp);
|
||||
}
|
||||
|
||||
int board_get_bool(struct udevice *dev, int id, bool *val)
|
||||
{
|
||||
struct board_ops *ops = board_get_ops(dev);
|
||||
|
||||
if (!ops->get_bool)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_bool(dev, id, val);
|
||||
}
|
||||
|
||||
int board_get_int(struct udevice *dev, int id, int *val)
|
||||
{
|
||||
struct board_ops *ops = board_get_ops(dev);
|
||||
|
||||
if (!ops->get_int)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_int(dev, id, val);
|
||||
}
|
||||
|
||||
int board_get_str(struct udevice *dev, int id, size_t size, char *val)
|
||||
{
|
||||
struct board_ops *ops = board_get_ops(dev);
|
||||
|
||||
if (!ops->get_str)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_str(dev, id, size, val);
|
||||
}
|
||||
|
||||
UCLASS_DRIVER(board) = {
|
||||
.id = UCLASS_BOARD,
|
||||
.name = "board",
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
};
|
||||
@@ -268,8 +268,7 @@ int acpi_recurse_method(struct acpi_ctx *ctx, struct udevice *parent,
|
||||
if (func) {
|
||||
void *start = ctx->current;
|
||||
|
||||
log_debug("\n");
|
||||
log_debug("- %s %p\n", parent->name, func);
|
||||
log_debug("- method %d, %s %p\n", method, parent->name, func);
|
||||
ret = device_ofdata_to_platdata(parent);
|
||||
if (ret)
|
||||
return log_msg_ret("ofdata", ret);
|
||||
@@ -299,7 +298,6 @@ int acpi_fill_ssdt(struct acpi_ctx *ctx)
|
||||
int ret;
|
||||
|
||||
log_debug("Writing SSDT tables\n");
|
||||
item_count = 0;
|
||||
ret = acpi_recurse_method(ctx, dm_root(), METHOD_FILL_SSDT, TYPE_SSDT);
|
||||
log_debug("Writing SSDT finished, err=%d\n", ret);
|
||||
ret = sort_acpi_item_type(ctx, start, TYPE_SSDT);
|
||||
@@ -315,7 +313,6 @@ int acpi_inject_dsdt(struct acpi_ctx *ctx)
|
||||
int ret;
|
||||
|
||||
log_debug("Writing DSDT tables\n");
|
||||
item_count = 0;
|
||||
ret = acpi_recurse_method(ctx, dm_root(), METHOD_INJECT_DSDT,
|
||||
TYPE_DSDT);
|
||||
log_debug("Writing DSDT finished, err=%d\n", ret);
|
||||
@@ -326,6 +323,11 @@ int acpi_inject_dsdt(struct acpi_ctx *ctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void acpi_reset_items(void)
|
||||
{
|
||||
item_count = 0;
|
||||
}
|
||||
|
||||
int acpi_write_dev_tables(struct acpi_ctx *ctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -193,8 +193,8 @@ static const struct udevice_id intel_intel_gpio_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(gpio_intel) = {
|
||||
.name = "gpio_intel",
|
||||
U_BOOT_DRIVER(intel_gpio) = {
|
||||
.name = "intel_gpio",
|
||||
.id = UCLASS_GPIO,
|
||||
.of_match = intel_intel_gpio_ids,
|
||||
.ops = &gpio_intel_ops,
|
||||
|
||||
@@ -231,8 +231,8 @@ static const struct udevice_id cros_ec_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(cros_ec_i2c) = {
|
||||
.name = "cros_ec_i2c",
|
||||
U_BOOT_DRIVER(google_cros_ec_i2c) = {
|
||||
.name = "google_cros_ec_i2c",
|
||||
.id = UCLASS_CROS_EC,
|
||||
.of_match = cros_ec_ids,
|
||||
.probe = cros_ec_probe,
|
||||
|
||||
@@ -243,8 +243,8 @@ static const struct udevice_id cros_ec_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(cros_ec_lpc) = {
|
||||
.name = "cros_ec_lpc",
|
||||
U_BOOT_DRIVER(google_cros_ec_lpc) = {
|
||||
.name = "google_cros_ec_lpc",
|
||||
.id = UCLASS_CROS_EC,
|
||||
.of_match = cros_ec_ids,
|
||||
.probe = cros_ec_probe,
|
||||
|
||||
@@ -184,8 +184,8 @@ static const struct udevice_id cros_ec_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(cros_ec_spi) = {
|
||||
.name = "cros_ec_spi",
|
||||
U_BOOT_DRIVER(google_cros_ec_spi) = {
|
||||
.name = "google_cros_ec_spi",
|
||||
.id = UCLASS_CROS_EC,
|
||||
.of_match = cros_ec_ids,
|
||||
.probe = cros_ec_probe,
|
||||
|
||||
@@ -154,7 +154,7 @@ static int pinctrl_get_device(uint pad, struct udevice **devp)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
printf("pad %d not found\n", pad);
|
||||
log_debug("pad %d not found\n", pad);
|
||||
|
||||
return -ENOTBLK;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ static const struct udevice_id apl_gpio_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(apl_pinctrl_drv) = {
|
||||
U_BOOT_DRIVER(intel_apl_pinctrl) = {
|
||||
.name = "intel_apl_pinctrl",
|
||||
.id = UCLASS_PINCTRL,
|
||||
.of_match = apl_gpio_ids,
|
||||
|
||||
@@ -246,8 +246,8 @@ static const struct udevice_id rtc_mc146818_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(rtc_mc146818) = {
|
||||
.name = "rtc_mc146818",
|
||||
U_BOOT_DRIVER(motorola_mc146818) = {
|
||||
.name = "motorola_mc146818",
|
||||
.id = UCLASS_RTC,
|
||||
.of_match = rtc_mc146818_ids,
|
||||
.probe = rtc_mc146818_probe,
|
||||
|
||||
@@ -54,13 +54,13 @@ static int da7219_acpi_fill_ssdt(const struct udevice *dev,
|
||||
acpigen_write_name(ctx, "_CRS");
|
||||
acpigen_write_resourcetemplate_header(ctx);
|
||||
ret = acpi_device_write_i2c_dev(ctx, dev);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return log_msg_ret("i2c", ret);
|
||||
|
||||
/* Use either Interrupt() or GpioInt() */
|
||||
ret = acpi_device_write_interrupt_or_gpio(ctx, (struct udevice *)dev,
|
||||
"req-gpios");
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return log_msg_ret("irq_gpio", ret);
|
||||
acpigen_write_resourcetemplate_footer(ctx);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static int max98357a_acpi_fill_ssdt(const struct udevice *dev,
|
||||
acpigen_write_name(ctx, "_CRS");
|
||||
acpigen_write_resourcetemplate_header(ctx);
|
||||
ret = acpi_device_write_gpio_desc(ctx, &priv->sdmode_gpio);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return log_msg_ret("gpio", ret);
|
||||
acpigen_write_resourcetemplate_footer(ctx);
|
||||
|
||||
|
||||
33
drivers/sysinfo/Kconfig
Normal file
33
drivers/sysinfo/Kconfig
Normal file
@@ -0,0 +1,33 @@
|
||||
menuconfig SYSINFO
|
||||
bool "Device System Information"
|
||||
help
|
||||
Support methods to query hardware configurations from internal
|
||||
mechanisms (e.g. reading GPIO values, determining the presence of
|
||||
devices on busses, etc.). This enables the usage of U-Boot with
|
||||
modular board architectures.
|
||||
|
||||
if SYSINFO
|
||||
|
||||
config SPL_SYSINFO
|
||||
depends on SPL_DM
|
||||
bool "Enable board driver support in SPL"
|
||||
|
||||
config SYSINFO_GAZERBEAM
|
||||
bool "Enable sysinfo driver for the Gazerbeam board"
|
||||
help
|
||||
Support querying device information for the gdsys Gazerbeam board.
|
||||
|
||||
config SYSINFO_SANDBOX
|
||||
bool "Enable sysinfo driver for the Sandbox board"
|
||||
help
|
||||
Support querying device information for the Sandbox boards.
|
||||
|
||||
config SYSINFO_SMBIOS
|
||||
bool "Provide a default sysinfo driver for SMBIOS information"
|
||||
help
|
||||
Some boards want to specify the manufacturer or product name but do
|
||||
not need to have their own sysinfo driver. This includes a default
|
||||
one which provides a way to specify this SMBIOS information in the
|
||||
devicetree, without needing any board-specific functionality.
|
||||
|
||||
endif
|
||||
8
drivers/sysinfo/Makefile
Normal file
8
drivers/sysinfo/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# (C) Copyright 2017
|
||||
# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
||||
obj-y += sysinfo-uclass.o
|
||||
obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o
|
||||
obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o
|
||||
obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.o
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <board.h>
|
||||
#include <sysinfo.h>
|
||||
#include <i2c.h>
|
||||
#include <log.h>
|
||||
#include <asm/gpio.h>
|
||||
@@ -27,16 +27,16 @@ static const int SC_GPIO_NO;
|
||||
static const int CON_GPIO_NO = 1;
|
||||
|
||||
/**
|
||||
* struct board_gazerbeam_priv - Private data structure for the gazerbeam board
|
||||
* driver.
|
||||
* @reset_gpios: GPIOs for the board's reset GPIOs.
|
||||
* @var_gpios: GPIOs for the board's hardware variant GPIOs
|
||||
* @ver_gpios: GPIOs for the board's hardware version GPIOs
|
||||
* @variant: Container for the board's hardware variant (CON/CPU)
|
||||
* @multichannel: Container for the board's multichannel variant (MC4/MC2/SC)
|
||||
* @hwversion: Container for the board's hardware version
|
||||
* struct sysinfo_gazerbeam_priv - Private data structure for the gazerbeam
|
||||
* sysinfo driver
|
||||
* @reset_gpios: GPIOs for the sysinfo's reset GPIOs.
|
||||
* @var_gpios: GPIOs for the sysinfo's hardware variant GPIOs
|
||||
* @ver_gpios: GPIOs for the sysinfo's hardware version GPIOs
|
||||
* @variant: Container for the sysinfo's hardware variant (CON/CPU)
|
||||
* @multichannel: Container for the sysinfo's multichannel variant (MC4/MC2/SC)
|
||||
* @hwversion: Container for the sysinfo's hardware version
|
||||
*/
|
||||
struct board_gazerbeam_priv {
|
||||
struct sysinfo_gazerbeam_priv {
|
||||
struct gpio_desc reset_gpios[2];
|
||||
struct gpio_desc var_gpios[2];
|
||||
struct gpio_desc ver_gpios[4];
|
||||
@@ -46,19 +46,19 @@ struct board_gazerbeam_priv {
|
||||
};
|
||||
|
||||
/**
|
||||
* _read_board_variant_data() - Read variant information from the hardware.
|
||||
* @dev: The board device for which to determine the multichannel and device
|
||||
* _read_sysinfo_variant_data() - Read variant information from the hardware.
|
||||
* @dev: The sysinfo device for which to determine the multichannel and device
|
||||
* type information.
|
||||
*
|
||||
* The data read from the board's hardware (mostly hard-wired GPIOs) is stored
|
||||
* The data read from the sysinfo's hardware (mostly hard-wired GPIOs) is stored
|
||||
* in the private data structure of the driver to be used by other driver
|
||||
* methods.
|
||||
*
|
||||
* Return: 0 if OK, -ve on error.
|
||||
*/
|
||||
static int _read_board_variant_data(struct udevice *dev)
|
||||
static int _read_sysinfo_variant_data(struct udevice *dev)
|
||||
{
|
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
struct udevice *i2c_bus;
|
||||
struct udevice *dummy;
|
||||
char *listname;
|
||||
@@ -129,10 +129,10 @@ static int _read_board_variant_data(struct udevice *dev)
|
||||
}
|
||||
|
||||
/**
|
||||
* _read_hwversion() - Read the hardware version from the board.
|
||||
* @dev: The board device for which to read the hardware version.
|
||||
* _read_hwversion() - Read the hardware version from the sysinfo.
|
||||
* @dev: The sysinfo device for which to read the hardware version.
|
||||
*
|
||||
* The hardware version read from the board (from hard-wired GPIOs) is stored
|
||||
* The hardware version read from the sysinfo (from hard-wired GPIOs) is stored
|
||||
* in the private data structure of the driver to be used by other driver
|
||||
* methods.
|
||||
*
|
||||
@@ -140,7 +140,7 @@ static int _read_board_variant_data(struct udevice *dev)
|
||||
*/
|
||||
static int _read_hwversion(struct udevice *dev)
|
||||
{
|
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
int res;
|
||||
|
||||
res = gpio_request_list_by_name(dev, "ver-gpios", priv->ver_gpios,
|
||||
@@ -172,11 +172,11 @@ static int _read_hwversion(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int board_gazerbeam_detect(struct udevice *dev)
|
||||
static int sysinfo_gazerbeam_detect(struct udevice *dev)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = _read_board_variant_data(dev);
|
||||
res = _read_sysinfo_variant_data(dev);
|
||||
if (res) {
|
||||
debug("%s: Error reading multichannel variant (err = %d)\n",
|
||||
dev->name, res);
|
||||
@@ -193,9 +193,9 @@ static int board_gazerbeam_detect(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int board_gazerbeam_get_int(struct udevice *dev, int id, int *val)
|
||||
static int sysinfo_gazerbeam_get_int(struct udevice *dev, int id, int *val)
|
||||
{
|
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
|
||||
switch (id) {
|
||||
case BOARD_MULTICHANNEL:
|
||||
@@ -215,19 +215,19 @@ static int board_gazerbeam_get_int(struct udevice *dev, int id, int *val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct udevice_id board_gazerbeam_ids[] = {
|
||||
{ .compatible = "gdsys,board_gazerbeam" },
|
||||
static const struct udevice_id sysinfo_gazerbeam_ids[] = {
|
||||
{ .compatible = "gdsys,sysinfo-gazerbeam" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct board_ops board_gazerbeam_ops = {
|
||||
.detect = board_gazerbeam_detect,
|
||||
.get_int = board_gazerbeam_get_int,
|
||||
static const struct sysinfo_ops sysinfo_gazerbeam_ops = {
|
||||
.detect = sysinfo_gazerbeam_detect,
|
||||
.get_int = sysinfo_gazerbeam_get_int,
|
||||
};
|
||||
|
||||
static int board_gazerbeam_probe(struct udevice *dev)
|
||||
static int sysinfo_gazerbeam_probe(struct udevice *dev)
|
||||
{
|
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev);
|
||||
int gpio_num, i;
|
||||
|
||||
gpio_num = gpio_request_list_by_name(dev, "reset-gpios",
|
||||
@@ -255,11 +255,11 @@ static int board_gazerbeam_probe(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_DRIVER(board_gazerbeam) = {
|
||||
.name = "board_gazerbeam",
|
||||
.id = UCLASS_BOARD,
|
||||
.of_match = board_gazerbeam_ids,
|
||||
.ops = &board_gazerbeam_ops,
|
||||
.priv_auto_alloc_size = sizeof(struct board_gazerbeam_priv),
|
||||
.probe = board_gazerbeam_probe,
|
||||
U_BOOT_DRIVER(sysinfo_gazerbeam) = {
|
||||
.name = "sysinfo_gazerbeam",
|
||||
.id = UCLASS_SYSINFO,
|
||||
.of_match = sysinfo_gazerbeam_ids,
|
||||
.ops = &sysinfo_gazerbeam_ops,
|
||||
.priv_auto_alloc_size = sizeof(struct sysinfo_gazerbeam_priv),
|
||||
.probe = sysinfo_gazerbeam_probe,
|
||||
};
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <board.h>
|
||||
#include <sysinfo.h>
|
||||
|
||||
#include "sandbox.h"
|
||||
|
||||
struct board_sandbox_priv {
|
||||
struct sysinfo_sandbox_priv {
|
||||
bool called_detect;
|
||||
int test_i1;
|
||||
int test_i2;
|
||||
@@ -19,9 +19,9 @@ struct board_sandbox_priv {
|
||||
char vacation_spots[][64] = {"R'lyeh", "Dreamlands", "Plateau of Leng",
|
||||
"Carcosa", "Yuggoth", "The Nameless City"};
|
||||
|
||||
int board_sandbox_detect(struct udevice *dev)
|
||||
int sysinfo_sandbox_detect(struct udevice *dev)
|
||||
{
|
||||
struct board_sandbox_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_sandbox_priv *priv = dev_get_priv(dev);
|
||||
|
||||
priv->called_detect = true;
|
||||
priv->test_i2 = 100;
|
||||
@@ -29,9 +29,9 @@ int board_sandbox_detect(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_sandbox_get_bool(struct udevice *dev, int id, bool *val)
|
||||
int sysinfo_sandbox_get_bool(struct udevice *dev, int id, bool *val)
|
||||
{
|
||||
struct board_sandbox_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_sandbox_priv *priv = dev_get_priv(dev);
|
||||
|
||||
switch (id) {
|
||||
case BOOL_CALLED_DETECT:
|
||||
@@ -43,9 +43,9 @@ int board_sandbox_get_bool(struct udevice *dev, int id, bool *val)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
int board_sandbox_get_int(struct udevice *dev, int id, int *val)
|
||||
int sysinfo_sandbox_get_int(struct udevice *dev, int id, int *val)
|
||||
{
|
||||
struct board_sandbox_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_sandbox_priv *priv = dev_get_priv(dev);
|
||||
|
||||
switch (id) {
|
||||
case INT_TEST1:
|
||||
@@ -63,9 +63,9 @@ int board_sandbox_get_int(struct udevice *dev, int id, int *val)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
int board_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val)
|
||||
int sysinfo_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val)
|
||||
{
|
||||
struct board_sandbox_priv *priv = dev_get_priv(dev);
|
||||
struct sysinfo_sandbox_priv *priv = dev_get_priv(dev);
|
||||
int i1 = priv->test_i1;
|
||||
int i2 = priv->test_i2;
|
||||
int index = (i1 * i2) % ARRAY_SIZE(vacation_spots);
|
||||
@@ -80,28 +80,28 @@ int board_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static const struct udevice_id board_sandbox_ids[] = {
|
||||
{ .compatible = "sandbox,board_sandbox" },
|
||||
static const struct udevice_id sysinfo_sandbox_ids[] = {
|
||||
{ .compatible = "sandbox,sysinfo-sandbox" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct board_ops board_sandbox_ops = {
|
||||
.detect = board_sandbox_detect,
|
||||
.get_bool = board_sandbox_get_bool,
|
||||
.get_int = board_sandbox_get_int,
|
||||
.get_str = board_sandbox_get_str,
|
||||
static const struct sysinfo_ops sysinfo_sandbox_ops = {
|
||||
.detect = sysinfo_sandbox_detect,
|
||||
.get_bool = sysinfo_sandbox_get_bool,
|
||||
.get_int = sysinfo_sandbox_get_int,
|
||||
.get_str = sysinfo_sandbox_get_str,
|
||||
};
|
||||
|
||||
int board_sandbox_probe(struct udevice *dev)
|
||||
int sysinfo_sandbox_probe(struct udevice *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_DRIVER(board_sandbox) = {
|
||||
.name = "board_sandbox",
|
||||
.id = UCLASS_BOARD,
|
||||
.of_match = board_sandbox_ids,
|
||||
.ops = &board_sandbox_ops,
|
||||
.priv_auto_alloc_size = sizeof(struct board_sandbox_priv),
|
||||
.probe = board_sandbox_probe,
|
||||
U_BOOT_DRIVER(sysinfo_sandbox) = {
|
||||
.name = "sysinfo_sandbox",
|
||||
.id = UCLASS_SYSINFO,
|
||||
.of_match = sysinfo_sandbox_ids,
|
||||
.ops = &sysinfo_sandbox_ops,
|
||||
.priv_auto_alloc_size = sizeof(struct sysinfo_sandbox_priv),
|
||||
.probe = sysinfo_sandbox_probe,
|
||||
};
|
||||
24
drivers/sysinfo/smbios.c
Normal file
24
drivers/sysinfo/smbios.c
Normal file
@@ -0,0 +1,24 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
* Written by Simon Glass <sjg@chromium.org>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <sysinfo.h>
|
||||
|
||||
static const struct udevice_id sysinfo_smbios_ids[] = {
|
||||
{ .compatible = "u-boot,sysinfo-smbios" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct sysinfo_ops sysinfo_smbios_ops = {
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(sysinfo_smbios) = {
|
||||
.name = "sysinfo_smbios",
|
||||
.id = UCLASS_SYSINFO,
|
||||
.of_match = sysinfo_smbios_ids,
|
||||
.ops = &sysinfo_smbios_ops,
|
||||
};
|
||||
71
drivers/sysinfo/sysinfo-uclass.c
Normal file
71
drivers/sysinfo/sysinfo-uclass.c
Normal file
@@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* (C) Copyright 2017
|
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <sysinfo.h>
|
||||
|
||||
int sysinfo_get(struct udevice **devp)
|
||||
{
|
||||
return uclass_first_device_err(UCLASS_SYSINFO, devp);
|
||||
}
|
||||
|
||||
int sysinfo_detect(struct udevice *dev)
|
||||
{
|
||||
struct sysinfo_ops *ops = sysinfo_get_ops(dev);
|
||||
|
||||
if (!ops->detect)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->detect(dev);
|
||||
}
|
||||
|
||||
int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type,
|
||||
const char **strp)
|
||||
{
|
||||
struct sysinfo_ops *ops = sysinfo_get_ops(dev);
|
||||
|
||||
if (!ops->get_fit_loadable)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_fit_loadable(dev, index, type, strp);
|
||||
}
|
||||
|
||||
int sysinfo_get_bool(struct udevice *dev, int id, bool *val)
|
||||
{
|
||||
struct sysinfo_ops *ops = sysinfo_get_ops(dev);
|
||||
|
||||
if (!ops->get_bool)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_bool(dev, id, val);
|
||||
}
|
||||
|
||||
int sysinfo_get_int(struct udevice *dev, int id, int *val)
|
||||
{
|
||||
struct sysinfo_ops *ops = sysinfo_get_ops(dev);
|
||||
|
||||
if (!ops->get_int)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_int(dev, id, val);
|
||||
}
|
||||
|
||||
int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val)
|
||||
{
|
||||
struct sysinfo_ops *ops = sysinfo_get_ops(dev);
|
||||
|
||||
if (!ops->get_str)
|
||||
return -ENOSYS;
|
||||
|
||||
return ops->get_str(dev, id, size, val);
|
||||
}
|
||||
|
||||
UCLASS_DRIVER(sysinfo) = {
|
||||
.id = UCLASS_SYSINFO,
|
||||
.name = "sysinfo",
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
};
|
||||
@@ -148,8 +148,8 @@ static struct sysreset_ops x86_sysreset_ops = {
|
||||
.get_last = x86_sysreset_get_last,
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(x86_sysreset) = {
|
||||
.name = "x86-sysreset",
|
||||
U_BOOT_DRIVER(x86_reset) = {
|
||||
.name = "x86_reset",
|
||||
.id = UCLASS_SYSRESET,
|
||||
.of_match = x86_sysreset_ids,
|
||||
.ops = &x86_sysreset_ops,
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <board.h>
|
||||
#include <clk.h>
|
||||
#include <dm.h>
|
||||
#include <irq_func.h>
|
||||
#include <log.h>
|
||||
#include <status_led.h>
|
||||
#include <sysinfo.h>
|
||||
#include <time.h>
|
||||
#include <timer.h>
|
||||
#include <watchdog.h>
|
||||
@@ -97,7 +97,7 @@ int interrupt_init(void)
|
||||
{
|
||||
immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
|
||||
struct udevice *csb;
|
||||
struct udevice *board;
|
||||
struct udevice *sysinfo;
|
||||
struct udevice *timer;
|
||||
struct mpc83xx_timer_priv *timer_priv;
|
||||
struct clk clock;
|
||||
@@ -112,12 +112,12 @@ int interrupt_init(void)
|
||||
|
||||
timer_priv = dev_get_priv(timer);
|
||||
|
||||
if (board_get(&board)) {
|
||||
debug("%s: board device could not be fetched.\n", __func__);
|
||||
if (sysinfo_get(&sysinfo)) {
|
||||
debug("%s: sysinfo device could not be fetched.\n", __func__);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
ret = uclass_get_device_by_phandle(UCLASS_SIMPLE_BUS, board,
|
||||
ret = uclass_get_device_by_phandle(UCLASS_SIMPLE_BUS, sysinfo,
|
||||
"csb", &csb);
|
||||
if (ret) {
|
||||
debug("%s: Could not retrieve CSB device (error: %d)",
|
||||
|
||||
@@ -482,8 +482,8 @@ static const struct udevice_id tsc_timer_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(tsc_timer) = {
|
||||
.name = "tsc_timer",
|
||||
U_BOOT_DRIVER(x86_tsc_timer) = {
|
||||
.name = "x86_tsc_timer",
|
||||
.id = UCLASS_TIMER,
|
||||
.of_match = tsc_timer_ids,
|
||||
.probe = tsc_timer_probe,
|
||||
|
||||
Reference in New Issue
Block a user