commit
d24c1d0f4d
@ -0,0 +1,46 @@ |
||||
gdsys Gazerbeam board driver |
||||
|
||||
This driver provides capabilities to access the gdsys Gazerbeam board's device |
||||
information. Furthermore, phandles to some internal devices are provided for |
||||
the board files. |
||||
|
||||
Required properties: |
||||
- compatible: should be "gdsys,board_gazerbeam" |
||||
- csb: phandle to the board's coherent system bus (CSB) device node |
||||
- rxaui[0-3]: phandles to the rxaui control device nodes |
||||
- fpga[0-1]: phandles to the board's gdsys FPGA device nodes |
||||
- ioep[0-1]: phandles to the board's IO endpoint device nodes |
||||
- ver-gpios: GPIO list to read the hardware version from |
||||
- var-gpios: GPIO list to read the hardware variant information from |
||||
- reset-gpios: GPIO list for the board's reset GPIOs |
||||
|
||||
Example: |
||||
|
||||
|
||||
board { |
||||
compatible = "gdsys,board_gazerbeam"; |
||||
csb = <&board_soc>; |
||||
serdes = <&SERDES>; |
||||
rxaui0 = <&RXAUI0>; |
||||
rxaui1 = <&RXAUI1>; |
||||
rxaui2 = <&RXAUI2>; |
||||
rxaui3 = <&RXAUI3>; |
||||
fpga0 = <&FPGA0>; |
||||
fpga1 = <&FPGA1>; |
||||
ioep0 = <&IOEP0>; |
||||
ioep1 = <&IOEP1>; |
||||
|
||||
ver-gpios = <&PPCPCA 12 0 |
||||
&PPCPCA 13 0 |
||||
&PPCPCA 14 0 |
||||
&PPCPCA 15 0>; |
||||
|
||||
/* MC2/SC-Board */ |
||||
var-gpios-mc2 = <&GPIO_VB0 0 0 /* VAR-MC_SC */ |
||||
&GPIO_VB0 11 0>; /* VAR-CON */ |
||||
/* MC4-Board */ |
||||
var-gpios-mc4 = <&GPIO_VB1 0 0 /* VAR-MC_SC */ |
||||
&GPIO_VB1 11 0>; /* VAR-CON */ |
||||
|
||||
reset-gpios = <&gpio0 1 0 &gpio0 2 1>; |
||||
}; |
@ -0,0 +1,22 @@ |
||||
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 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 |
@ -0,0 +1,7 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# (C) Copyright 2017
|
||||
# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
||||
obj-$(CONFIG_BOARD) += board-uclass.o
|
||||
obj-$(CONFIG_BOARD_GAZERBEAM) += gazerbeam.o
|
||||
obj-$(CONFIG_BOARD_SANDBOX) += sandbox.o
|
@ -0,0 +1,60 @@ |
||||
// 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_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, |
||||
}; |
@ -0,0 +1,262 @@ |
||||
// 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> |
||||
#include <i2c.h> |
||||
#include <asm/gpio.h> |
||||
|
||||
#include "gazerbeam.h" |
||||
|
||||
/* Sequence number of I2C bus that holds the GPIO expanders */ |
||||
static const int I2C_BUS_SEQ_NO = 1; |
||||
|
||||
/* I2C address of SC/MC2 expander */ |
||||
static const int MC2_EXPANDER_ADDR = 0x20; |
||||
/* I2C address of MC4 expander */ |
||||
static const int MC4_EXPANDER_ADDR = 0x22; |
||||
|
||||
/* Number of the GPIO to read the SC data from */ |
||||
static const int SC_GPIO_NO; |
||||
/* Number of the GPIO to read the CON data from */ |
||||
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 board_gazerbeam_priv { |
||||
struct gpio_desc reset_gpios[2]; |
||||
struct gpio_desc var_gpios[2]; |
||||
struct gpio_desc ver_gpios[4]; |
||||
int variant; |
||||
int multichannel; |
||||
int hwversion; |
||||
}; |
||||
|
||||
/**
|
||||
* _read_board_variant_data() - Read variant information from the hardware. |
||||
* @dev: The board 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 |
||||
* 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) |
||||
{ |
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev); |
||||
struct udevice *i2c_bus; |
||||
struct udevice *dummy; |
||||
char *listname; |
||||
int mc4, mc2, sc, con; |
||||
int gpio_num; |
||||
int res; |
||||
|
||||
res = uclass_get_device_by_seq(UCLASS_I2C, I2C_BUS_SEQ_NO, &i2c_bus); |
||||
if (res) { |
||||
debug("%s: Could not get I2C bus %d (err = %d)\n", |
||||
dev->name, I2C_BUS_SEQ_NO, res); |
||||
return res; |
||||
} |
||||
|
||||
if (!i2c_bus) { |
||||
debug("%s: Could not get I2C bus %d\n", |
||||
dev->name, I2C_BUS_SEQ_NO); |
||||
return -EIO; |
||||
} |
||||
|
||||
mc2 = !dm_i2c_probe(i2c_bus, MC2_EXPANDER_ADDR, 0, &dummy); |
||||
mc4 = !dm_i2c_probe(i2c_bus, MC4_EXPANDER_ADDR, 0, &dummy); |
||||
|
||||
if (mc2 && mc4) { |
||||
debug("%s: Board hardware configuration inconsistent.\n", |
||||
dev->name); |
||||
return -EINVAL; |
||||
} |
||||
|
||||
listname = mc2 ? "var-gpios-mc2" : "var-gpios-mc4"; |
||||
|
||||
gpio_num = gpio_request_list_by_name(dev, listname, priv->var_gpios, |
||||
ARRAY_SIZE(priv->var_gpios), |
||||
GPIOD_IS_IN); |
||||
if (gpio_num < 0) { |
||||
debug("%s: Requesting gpio list %s failed (err = %d).\n", |
||||
dev->name, listname, gpio_num); |
||||
return gpio_num; |
||||
} |
||||
|
||||
sc = dm_gpio_get_value(&priv->var_gpios[SC_GPIO_NO]); |
||||
if (sc < 0) { |
||||
debug("%s: Error while reading 'sc' GPIO (err = %d)", |
||||
dev->name, sc); |
||||
return sc; |
||||
} |
||||
|
||||
con = dm_gpio_get_value(&priv->var_gpios[CON_GPIO_NO]); |
||||
if (con < 0) { |
||||
debug("%s: Error while reading 'con' GPIO (err = %d)", |
||||
dev->name, con); |
||||
return con; |
||||
} |
||||
|
||||
if ((sc && mc2) || (sc && mc4) || (!sc && !mc2 && !mc4)) { |
||||
debug("%s: Board hardware configuration inconsistent.\n", |
||||
dev->name); |
||||
return -EINVAL; |
||||
} |
||||
|
||||
priv->variant = con ? VAR_CON : VAR_CPU; |
||||
|
||||
priv->multichannel = mc4 ? 4 : (mc2 ? 2 : (sc ? 1 : 0)); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
/**
|
||||
* _read_hwversion() - Read the hardware version from the board. |
||||
* @dev: The board device for which to read the hardware version. |
||||
* |
||||
* The hardware version read from the board (from 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_hwversion(struct udevice *dev) |
||||
{ |
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev); |
||||
int res; |
||||
|
||||
res = gpio_request_list_by_name(dev, "ver-gpios", priv->ver_gpios, |
||||
ARRAY_SIZE(priv->ver_gpios), |
||||
GPIOD_IS_IN); |
||||
if (res < 0) { |
||||
debug("%s: Error getting GPIO list 'ver-gpios' (err = %d)\n", |
||||
dev->name, res); |
||||
return -ENODEV; |
||||
} |
||||
|
||||
res = dm_gpio_get_values_as_int(priv->ver_gpios, |
||||
ARRAY_SIZE(priv->ver_gpios)); |
||||
if (res < 0) { |
||||
debug("%s: Error reading HW version from expander (err = %d)\n", |
||||
dev->name, res); |
||||
return res; |
||||
} |
||||
|
||||
priv->hwversion = res; |
||||
|
||||
res = gpio_free_list(dev, priv->ver_gpios, ARRAY_SIZE(priv->ver_gpios)); |
||||
if (res < 0) { |
||||
debug("%s: Error freeing HW version GPIO list (err = %d)\n", |
||||
dev->name, res); |
||||
return res; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
static int board_gazerbeam_detect(struct udevice *dev) |
||||
{ |
||||
int res; |
||||
|
||||
res = _read_board_variant_data(dev); |
||||
if (res) { |
||||
debug("%s: Error reading multichannel variant (err = %d)\n", |
||||
dev->name, res); |
||||
return res; |
||||
} |
||||
|
||||
res = _read_hwversion(dev); |
||||
if (res) { |
||||
debug("%s: Error reading hardware version (err = %d)\n", |
||||
dev->name, res); |
||||
return res; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
static int board_gazerbeam_get_int(struct udevice *dev, int id, int *val) |
||||
{ |
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev); |
||||
|
||||
switch (id) { |
||||
case BOARD_MULTICHANNEL: |
||||
*val = priv->multichannel; |
||||
break; |
||||
case BOARD_VARIANT: |
||||
*val = priv->variant; |
||||
break; |
||||
case BOARD_HWVERSION: |
||||
*val = priv->hwversion; |
||||
break; |
||||
default: |
||||
debug("%s: Integer value %d unknown\n", dev->name, id); |
||||
return -EINVAL; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
static const struct udevice_id board_gazerbeam_ids[] = { |
||||
{ .compatible = "gdsys,board_gazerbeam" }, |
||||
{ /* sentinel */ } |
||||
}; |
||||
|
||||
static const struct board_ops board_gazerbeam_ops = { |
||||
.detect = board_gazerbeam_detect, |
||||
.get_int = board_gazerbeam_get_int, |
||||
}; |
||||
|
||||
static int board_gazerbeam_probe(struct udevice *dev) |
||||
{ |
||||
struct board_gazerbeam_priv *priv = dev_get_priv(dev); |
||||
int gpio_num, i; |
||||
|
||||
gpio_num = gpio_request_list_by_name(dev, "reset-gpios", |
||||
priv->reset_gpios, |
||||
ARRAY_SIZE(priv->reset_gpios), |
||||
GPIOD_IS_OUT); |
||||
|
||||
if (gpio_num < 0) { |
||||
debug("%s: Error getting GPIO list 'reset-gpios' (err = %d)\n", |
||||
dev->name, gpio_num); |
||||
return gpio_num; |
||||
} |
||||
|
||||
/* Set startup-finished GPIOs */ |
||||
for (i = 0; i < ARRAY_SIZE(priv->reset_gpios); i++) { |
||||
int res = dm_gpio_set_value(&priv->reset_gpios[i], 0); |
||||
|
||||
if (res) { |
||||
debug("%s: Error while setting GPIO %d (err = %d)\n", |
||||
dev->name, i, res); |
||||
return res; |
||||
} |
||||
} |
||||
|
||||
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, |
||||
}; |
@ -0,0 +1,18 @@ |
||||
/* SPDX-License-Identifier: GPL-2.0+ */ |
||||
/*
|
||||
* (C) Copyright 2017 |
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
enum { |
||||
BOARD_MULTICHANNEL, |
||||
BOARD_VARIANT, |
||||
BOARD_HWVERSION, |
||||
}; |
||||
|
||||
enum { |
||||
VAR_CON, |
||||
VAR_CPU, |
||||
}; |
@ -0,0 +1,107 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* (C) Copyright 2018 |
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <board.h> |
||||
|
||||
#include "sandbox.h" |
||||
|
||||
struct board_sandbox_priv { |
||||
bool called_detect; |
||||
int test_i1; |
||||
int test_i2; |
||||
}; |
||||
|
||||
char vacation_spots[][64] = {"R'lyeh", "Dreamlands", "Plateau of Leng", |
||||
"Carcosa", "Yuggoth", "The Nameless City"}; |
||||
|
||||
int board_sandbox_detect(struct udevice *dev) |
||||
{ |
||||
struct board_sandbox_priv *priv = dev_get_priv(dev); |
||||
|
||||
priv->called_detect = true; |
||||
priv->test_i2 = 100; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int board_sandbox_get_bool(struct udevice *dev, int id, bool *val) |
||||
{ |
||||
struct board_sandbox_priv *priv = dev_get_priv(dev); |
||||
|
||||
switch (id) { |
||||
case BOOL_CALLED_DETECT: |
||||
/* Checks if the dectect method has been called */ |
||||
*val = priv->called_detect; |
||||
return 0; |
||||
} |
||||
|
||||
return -ENOENT; |
||||
} |
||||
|
||||
int board_sandbox_get_int(struct udevice *dev, int id, int *val) |
||||
{ |
||||
struct board_sandbox_priv *priv = dev_get_priv(dev); |
||||
|
||||
switch (id) { |
||||
case INT_TEST1: |
||||
*val = priv->test_i1; |
||||
/* Increments with every call */ |
||||
priv->test_i1++; |
||||
return 0; |
||||
case INT_TEST2: |
||||
*val = priv->test_i2; |
||||
/* Decrements with every call */ |
||||
priv->test_i2--; |
||||
return 0; |
||||
} |
||||
|
||||
return -ENOENT; |
||||
} |
||||
|
||||
int board_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val) |
||||
{ |
||||
struct board_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); |
||||
|
||||
switch (id) { |
||||
case STR_VACATIONSPOT: |
||||
/* Picks a vacation spot depending on i1 and i2 */ |
||||
snprintf(val, size, vacation_spots[index]); |
||||
return 0; |
||||
} |
||||
|
||||
return -ENOENT; |
||||
} |
||||
|
||||
static const struct udevice_id board_sandbox_ids[] = { |
||||
{ .compatible = "sandbox,board_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, |
||||
}; |
||||
|
||||
int board_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, |
||||
}; |
@ -0,0 +1,12 @@ |
||||
/* SPDX-License-Identifier: GPL-2.0+ */ |
||||
/*
|
||||
* (C) Copyright 2018 |
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc |
||||
*/ |
||||
|
||||
enum { |
||||
BOOL_CALLED_DETECT, |
||||
INT_TEST1, |
||||
INT_TEST2, |
||||
STR_VACATIONSPOT, |
||||
}; |
@ -1,3 +1,4 @@ |
||||
obj-$(CONFIG_FIRMWARE) += firmware-uclass.o
|
||||
obj-$(CONFIG_ARM_PSCI_FW) += psci.o
|
||||
obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o
|
||||
obj-$(CONFIG_SANDBOX) += firmware-sandbox.o
|
||||
|
@ -0,0 +1,20 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* sandbox firmware driver |
||||
* |
||||
* Copyright (C) 2018 Xilinx, Inc. |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
|
||||
static const struct udevice_id generic_sandbox_firmware_ids[] = { |
||||
{ .compatible = "sandbox,firmware" }, |
||||
{ } |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sandbox_firmware) = { |
||||
.name = "sandbox_firmware", |
||||
.id = UCLASS_FIRMWARE, |
||||
.of_match = generic_sandbox_firmware_ids, |
||||
}; |
@ -0,0 +1,139 @@ |
||||
/* SPDX-License-Identifier: GPL-2.0+ */ |
||||
/*
|
||||
* (C) Copyright 2017 |
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc |
||||
*/ |
||||
|
||||
/*
|
||||
* This uclass encapsulates hardware methods to gather information about a |
||||
* board or a specific device such as hard-wired GPIOs on GPIO expanders, |
||||
* read-only data in flash ICs, or similar. |
||||
* |
||||
* The interface offers functions to read the usual standard data types (bool, |
||||
* int, string) from the device, each of which is identified by a static |
||||
* numeric ID (which will usually be defined as a enum in a header file). |
||||
* |
||||
* If for example the board had a read-only serial number flash IC, we could |
||||
* call |
||||
* |
||||
* ret = board_detect(dev); |
||||
* if (ret) { |
||||
* debug("board device not found."); |
||||
* return ret; |
||||
* } |
||||
* |
||||
* ret = board_get_int(dev, ID_SERIAL_NUMBER, &serial); |
||||
* if (ret) { |
||||
* debug("Error when reading serial number from device."); |
||||
* return ret; |
||||
* } |
||||
* |
||||
* to read the serial number. |
||||
*/ |
||||
|
||||
struct board_ops { |
||||
/**
|
||||
* detect() - Run the hardware info detection procedure for this |
||||
* device. |
||||
* @dev: The device containing the information |
||||
* |
||||
* This operation might take a long time (e.g. read from EEPROM, |
||||
* check the presence of a device on a bus etc.), hence this is not |
||||
* done in the probe() method, but later during operation in this |
||||
* dedicated method. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int (*detect)(struct udevice *dev); |
||||
|
||||
/**
|
||||
* get_bool() - Read a specific bool data value that describes the |
||||
* hardware setup. |
||||
* @dev: The board instance to gather the data. |
||||
* @id: A unique identifier for the bool value to be read. |
||||
* @val: Pointer to a buffer that receives the value read. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int (*get_bool)(struct udevice *dev, int id, bool *val); |
||||
|
||||
/**
|
||||
* get_int() - Read a specific int data value that describes the |
||||
* hardware setup. |
||||
* @dev: The board instance to gather the data. |
||||
* @id: A unique identifier for the int value to be read. |
||||
* @val: Pointer to a buffer that receives the value read. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int (*get_int)(struct udevice *dev, int id, int *val); |
||||
|
||||
/**
|
||||
* get_str() - Read a specific string data value that describes the |
||||
* hardware setup. |
||||
* @dev: The board instance to gather the data. |
||||
* @id: A unique identifier for the string value to be read. |
||||
* @size: The size of the buffer to receive the string data. |
||||
* @val: Pointer to a buffer that receives the value read. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int (*get_str)(struct udevice *dev, int id, size_t size, char *val); |
||||
}; |
||||
|
||||
#define board_get_ops(dev) ((struct board_ops *)(dev)->driver->ops) |
||||
|
||||
/**
|
||||
* board_detect() - Run the hardware info detection procedure for this device. |
||||
* |
||||
* @dev: The device containing the information |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int board_detect(struct udevice *dev); |
||||
|
||||
/**
|
||||
* board_get_bool() - Read a specific bool data value that describes the |
||||
* hardware setup. |
||||
* @dev: The board instance to gather the data. |
||||
* @id: A unique identifier for the bool value to be read. |
||||
* @val: Pointer to a buffer that receives the value read. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int board_get_bool(struct udevice *dev, int id, bool *val); |
||||
|
||||
/**
|
||||
* board_get_int() - Read a specific int data value that describes the |
||||
* hardware setup. |
||||
* @dev: The board instance to gather the data. |
||||
* @id: A unique identifier for the int value to be read. |
||||
* @val: Pointer to a buffer that receives the value read. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int board_get_int(struct udevice *dev, int id, int *val); |
||||
|
||||
/**
|
||||
* board_get_str() - Read a specific string data value that describes the |
||||
* hardware setup. |
||||
* @dev: The board instance to gather the data. |
||||
* @id: A unique identifier for the string value to be read. |
||||
* @size: The size of the buffer to receive the string data. |
||||
* @val: Pointer to a buffer that receives the value read. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int board_get_str(struct udevice *dev, int id, size_t size, char *val); |
||||
|
||||
/**
|
||||
* board_get() - Return the board device for the board in question. |
||||
* @devp: Pointer to structure to receive the board device. |
||||
* |
||||
* Since there can only be at most one board instance, the API can supply a |
||||
* function that returns the unique device. This is especially useful for use |
||||
* in board files. |
||||
* |
||||
* Return: 0 if OK, -ve on error. |
||||
*/ |
||||
int board_get(struct udevice **devp); |
@ -0,0 +1,57 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* (C) Copyright 2018 |
||||
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <dm/test.h> |
||||
#include <board.h> |
||||
#include <test/ut.h> |
||||
|
||||
#include "../../drivers/board/sandbox.h" |
||||
|
||||
static int dm_test_board(struct unit_test_state *uts) |
||||
{ |
||||
struct udevice *board; |
||||
bool called_detect; |
||||
char str[64]; |
||||
int i; |
||||
|
||||
board_get(&board); |
||||
ut_assert(board); |
||||
|
||||
board_get_bool(board, BOOL_CALLED_DETECT, &called_detect); |
||||
ut_assert(!called_detect); |
||||
|
||||
board_detect(board); |
||||
|
||||
board_get_bool(board, BOOL_CALLED_DETECT, &called_detect); |
||||
ut_assert(called_detect); |
||||
|
||||
board_get_str(board, STR_VACATIONSPOT, sizeof(str), str); |
||||
ut_assertok(strcmp(str, "R'lyeh")); |
||||
|
||||
board_get_int(board, INT_TEST1, &i); |
||||
ut_asserteq(0, i); |
||||
|
||||
board_get_int(board, INT_TEST2, &i); |
||||
ut_asserteq(100, i); |
||||
|
||||
board_get_str(board, STR_VACATIONSPOT, sizeof(str), str); |
||||
ut_assertok(strcmp(str, "Carcosa")); |
||||
|
||||
board_get_int(board, INT_TEST1, &i); |
||||
ut_asserteq(1, i); |
||||
|
||||
board_get_int(board, INT_TEST2, &i); |
||||
ut_asserteq(99, i); |
||||
|
||||
board_get_str(board, STR_VACATIONSPOT, sizeof(str), str); |
||||
ut_assertok(strcmp(str, "Yuggoth")); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
DM_TEST(dm_test_board, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |
@ -0,0 +1,22 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2018 Xilinx, Inc. |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <syscon.h> |
||||
#include <asm/test.h> |
||||
#include <dm/test.h> |
||||
#include <test/ut.h> |
||||
|
||||
/* Base test of firmware probe */ |
||||
static int dm_test_firmware_probe(struct unit_test_state *uts) |
||||
{ |
||||
struct udevice *dev; |
||||
|
||||
ut_assertok(uclass_get_device_by_name(UCLASS_FIRMWARE, |
||||
"sandbox-firmware", &dev)); |
||||
return 0; |
||||
} |
||||
DM_TEST(dm_test_firmware_probe, DM_TESTF_SCAN_FDT); |
@ -0,0 +1,33 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2018 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for U-Boot device tree files |
||||
# |
||||
|
||||
import state |
||||
|
||||
from entry import Entry |
||||
from blob import Entry_blob |
||||
|
||||
class Entry_blob_dtb(Entry_blob): |
||||
"""A blob that holds a device tree |
||||
|
||||
This is a blob containing a device tree. The contents of the blob are |
||||
obtained from the list of available device-tree files, managed by the |
||||
'state' module. |
||||
""" |
||||
def __init__(self, section, etype, node): |
||||
Entry_blob.__init__(self, section, etype, node) |
||||
|
||||
def ObtainContents(self): |
||||
"""Get the device-tree from the list held by the 'state' module""" |
||||
self._filename = self.GetDefaultFilename() |
||||
self._pathname, data = state.GetFdtContents(self._filename) |
||||
self.SetContents(data) |
||||
return True |
||||
|
||||
def ProcessContents(self): |
||||
"""Re-read the DTB contents so that we get any calculated properties""" |
||||
_, data = state.GetFdtContents(self._filename) |
||||
self.SetContents(data) |
@ -0,0 +1,57 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2018 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for a set of files which are placed in individual |
||||
# sub-entries |
||||
# |
||||
|
||||
import glob |
||||
import os |
||||
|
||||
from section import Entry_section |
||||
import fdt_util |
||||
import state |
||||
import tools |
||||
|
||||
import bsection |
||||
|
||||
class Entry_files(Entry_section): |
||||
"""Entry containing a set of files |
||||
|
||||
Properties / Entry arguments: |
||||
- pattern: Filename pattern to match the files to include |
||||
- compress: Compression algorithm to use: |
||||
none: No compression |
||||
lz4: Use lz4 compression (via 'lz4' command-line utility) |
||||
|
||||
This entry reads a number of files and places each in a separate sub-entry |
||||
within this entry. To access these you need to enable device-tree updates |
||||
at run-time so you can obtain the file positions. |
||||
""" |
||||
def __init__(self, section, etype, node): |
||||
Entry_section.__init__(self, section, etype, node) |
||||
self._pattern = fdt_util.GetString(self._node, 'pattern') |
||||
if not self._pattern: |
||||
self.Raise("Missing 'pattern' property") |
||||
self._compress = fdt_util.GetString(self._node, 'compress', 'none') |
||||
self._require_matches = fdt_util.GetBool(self._node, |
||||
'require-matches') |
||||
|
||||
def ExpandEntries(self): |
||||
files = tools.GetInputFilenameGlob(self._pattern) |
||||
if self._require_matches and not files: |
||||
self.Raise("Pattern '%s' matched no files" % self._pattern) |
||||
for fname in files: |
||||
if not os.path.isfile(fname): |
||||
continue |
||||
name = os.path.basename(fname) |
||||
subnode = self._node.FindNode(name) |
||||
if not subnode: |
||||
subnode = state.AddSubnode(self._node, name) |
||||
state.AddString(subnode, 'type', 'blob') |
||||
state.AddString(subnode, 'filename', fname) |
||||
state.AddString(subnode, 'compress', self._compress) |
||||
|
||||
# Read entries again, now that we have some |
||||
self._section._ReadEntries() |
@ -0,0 +1,39 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2018 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for U-Boot ELF image |
||||
# |
||||
|
||||
from entry import Entry |
||||
from blob import Entry_blob |
||||
|
||||
import fdt_util |
||||
import tools |
||||
|
||||
class Entry_u_boot_elf(Entry_blob): |
||||
"""U-Boot ELF image |
||||
|
||||
Properties / Entry arguments: |
||||
- filename: Filename of u-boot (default 'u-boot') |
||||
|
||||
This is the U-Boot ELF image. It does not include a device tree but can be |
||||
relocated to any address for execution. |
||||
""" |
||||
def __init__(self, section, etype, node): |
||||
Entry_blob.__init__(self, section, etype, node) |
||||
self._strip = fdt_util.GetBool(self._node, 'strip') |
||||
|
||||
def ReadBlobContents(self): |
||||
if self._strip: |
||||
uniq = self.GetUniqueName() |
||||
out_fname = tools.GetOutputFilename('%s.stripped' % uniq) |
||||
tools.WriteFile(out_fname, tools.ReadFile(self._pathname)) |
||||
tools.Run('strip', out_fname) |
||||
self.SetContents(tools.ReadFile(out_fname)) |
||||
else: |
||||
self.SetContents(tools.ReadFile(self._pathname)) |
||||
return True |
||||
|
||||
def GetDefaultFilename(self): |
||||
return 'u-boot' |
@ -0,0 +1,24 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2018 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for U-Boot SPL ELF image |
||||
# |
||||
|
||||
from entry import Entry |
||||
from blob import Entry_blob |
||||
|
||||
class Entry_u_boot_spl_elf(Entry_blob): |
||||
"""U-Boot SPL ELF image |
||||
|
||||
Properties / Entry arguments: |
||||
- filename: Filename of SPL u-boot (default 'spl/u-boot') |
||||
|
||||
This is the U-Boot SPL ELF image. It does not include a device tree but can |
||||
be relocated to any address for execution. |
||||
""" |
||||
def __init__(self, section, etype, node): |
||||
Entry_blob.__init__(self, section, etype, node) |
||||
|
||||
def GetDefaultFilename(self): |
||||
return 'spl/u-boot-spl' |
@ -0,0 +1,25 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2016 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for U-Boot device tree with the microcode removed |
||||
# |
||||
|
||||
import control |
||||
from entry import Entry |
||||
from u_boot_dtb_with_ucode import Entry_u_boot_dtb_with_ucode |
||||
import tools |
||||
|
||||
class Entry_u_boot_tpl_dtb_with_ucode(Entry_u_boot_dtb_with_ucode): |
||||
"""U-Boot TPL with embedded microcode pointer |
||||
|
||||
This is used when TPL must set up the microcode for U-Boot. |
||||
|
||||
See Entry_u_boot_ucode for full details of the entries involved in this |
||||
process. |
||||
""" |
||||
def __init__(self, section, etype, node): |
||||
Entry_u_boot_dtb_with_ucode.__init__(self, section, etype, node) |
||||
|
||||
def GetDefaultFilename(self): |
||||
return 'tpl/u-boot-tpl.dtb' |
@ -0,0 +1,27 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2016 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for an TPL binary with an embedded microcode pointer |
||||
# |
||||
|
||||
import struct |
||||
|
||||
import command |
||||
from entry import Entry |
||||
from blob import Entry_blob |
||||
from u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr |
||||
import tools |
||||
|
||||
class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr): |
||||
"""U-Boot TPL with embedded microcode pointer |
||||
|
||||
See Entry_u_boot_ucode for full details of the entries involved in this |
||||
process. |
||||
""" |
||||
def __init__(self, section, etype, node): |
||||
Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node) |
||||
self.elf_fname = 'tpl/u-boot-tpl' |
||||
|
||||
def GetDefaultFilename(self): |
||||
return 'tpl/u-boot-tpl-nodtb.bin' |
@ -0,0 +1,30 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2018 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for the 16-bit x86 start-up code for U-Boot TPL |
||||
# |
||||
|
||||
from entry import Entry |
||||
from blob import Entry_blob |
||||
|
||||
class Entry_x86_start16_tpl(Entry_blob): |
||||
"""x86 16-bit start-up code for TPL |
||||
|
||||
Properties / Entry arguments: |
||||
- filename: Filename of tpl/u-boot-x86-16bit-tpl.bin (default |
||||
'tpl/u-boot-x86-16bit-tpl.bin') |
||||
|
||||
x86 CPUs start up in 16-bit mode, even if they are 64-bit CPUs. This code |
||||
must be placed at a particular address. This entry holds that code. It is |
||||
typically placed at offset CONFIG_SYS_X86_START16. The code is responsible |
||||
for changing to 32-bit mode and starting TPL, which in turn jumps to SPL. |
||||
|
||||
If TPL is not being used, the 'x86_start16_spl or 'x86_start16' entry types |
||||
may be used instead. |
||||
""" |
||||
def __init__(self, section, etype, node): |
||||
Entry_blob.__init__(self, section, etype, node) |
||||
|
||||
def GetDefaultFilename(self): |
||||
return 'tpl/u-boot-x86-16bit-tpl.bin' |
@ -0,0 +1,253 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright 2018 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Holds and modifies the state information held by binman |
||||
# |
||||
|
||||
import hashlib |
||||
import re |
||||
from sets import Set |
||||
|
||||
import os |
||||
import tools |
||||
|
||||
# Records the device-tree files known to binman, keyed by filename (e.g. |
||||
# 'u-boot-spl.dtb') |
||||
fdt_files = {} |
||||
|
||||
# Arguments passed to binman to provide arguments to entries |
||||
entry_args = {} |
||||
|
||||
# True to use fake device-tree files for testing (see U_BOOT_DTB_DATA in |
||||
# ftest.py) |
||||
use_fake_dtb = False |
||||
|
||||
# Set of all device tree files references by images |
||||
fdt_set = Set() |
||||
|
||||
# Same as above, but excluding the main one |
||||
fdt_subset = Set() |
||||
|
||||
# The DTB which contains the full image information |
||||
main_dtb = None |
||||
|
||||
def GetFdt(fname): |
||||
"""Get the Fdt object for a particular device-tree filename |
||||
|
||||
Binman keeps track of at least one device-tree file called u-boot.dtb but |
||||
can also have others (e.g. for SPL). This function looks up the given |
||||
filename and returns the associated Fdt object. |
||||
|
||||
Args: |
||||
fname: Filename to look up (e.g. 'u-boot.dtb'). |
||||
|
||||
Returns: |
||||
Fdt object associated with the filename |
||||
""" |
||||
return fdt_files[fname] |
||||
|
||||
def GetFdtPath(fname): |
||||
"""Get the full pathname of a particular Fdt object |
||||
|
||||
Similar to GetFdt() but returns the pathname associated with the Fdt. |
||||
|
||||
Args: |
||||
fname: Filename to look up (e.g. 'u-boot.dtb'). |
||||
|
||||
Returns: |
||||
Full path name to the associated Fdt |
||||
""" |
||||
return fdt_files[fname]._fname |
||||
|
||||
def GetFdtContents(fname): |
||||
"""Looks up the FDT pathname and contents |
||||
|
||||
This is used to obtain the Fdt pathname and contents when needed by an |
||||
entry. It supports a 'fake' dtb, allowing tests to substitute test data for |
||||
the real dtb. |
||||
|
||||
Args: |
||||
fname: Filename to look up (e.g. 'u-boot.dtb'). |
||||
|
||||
Returns: |
||||
tuple: |
||||
pathname to Fdt |
||||
Fdt data (as bytes) |
||||
""" |
||||
if fname in fdt_files and not use_fake_dtb: |
||||
pathname = GetFdtPath(fname) |
||||
data = GetFdt(fname).GetContents() |
||||
else: |
||||
pathname = tools.GetInputFilename(fname) |
||||
data = tools.ReadFile(pathname) |
||||
return pathname, data |
||||
|
||||
def SetEntryArgs(args): |
||||
"""Set the value of the entry args |
||||
|
||||
This sets up the entry_args dict which is used to supply entry arguments to |
||||
entries. |
||||
|
||||
Args: |
||||
args: List of entry arguments, each in the format "name=value" |
||||
""" |
||||
global entry_args |
||||
|
||||
entry_args = {} |
||||
if args: |
||||
for arg in args: |
||||
m = re.match('([^=]*)=(.*)', arg) |
||||
if not m: |
||||
raise ValueError("Invalid entry arguemnt '%s'" % arg) |
||||
entry_args[m.group(1)] = m.group(2) |
||||
|
||||
def GetEntryArg(name): |
||||
"""Get the value of an entry argument |
||||
|
||||
Args: |
||||
name: Name of argument to retrieve |
||||
|
||||
Returns: |
||||
String value of argument |
||||
""" |
||||
return entry_args.get(name) |
||||
|
||||
def Prepare(images, dtb): |
||||
"""Get device tree files ready for use |
||||
|
||||
This sets up a set of device tree files that can be retrieved by GetFdts(). |
||||
At present there is only one, that for U-Boot proper. |
||||
|
||||
Args: |
||||
images: List of images being used |
||||
dtb: Main dtb |
||||
""" |
||||
global fdt_set, fdt_subset, fdt_files, main_dtb |
||||
# Import these here in case libfdt.py is not available, in which case |
||||
# the above help option still works. |
||||
import fdt |
||||
import fdt_util |
||||
|
||||
# If we are updating the DTBs we need to put these updated versions |
||||
# where Entry_blob_dtb can find them. We can ignore 'u-boot.dtb' |
||||
# since it is assumed to be the one passed in with options.dt, and |
||||
# was handled just above. |
||||
main_dtb = dtb |
||||
fdt_files.clear() |
||||
fdt_files['u-boot.dtb'] = dtb |
||||
fdt_subset = Set() |
||||
if not use_fake_dtb: |
||||
for image in images.values(): |
||||
fdt_subset.update(image.GetFdtSet()) |
||||
fdt_subset.discard('u-boot.dtb') |
||||
for other_fname in fdt_subset: |
||||
infile = tools.GetInputFilename(other_fname) |
||||
other_fname_dtb = fdt_util.EnsureCompiled(infile) |
||||
out_fname = tools.GetOutputFilename('%s.out' % |
||||
os.path.split(other_fname)[1]) |
||||
tools.WriteFile(out_fname, tools.ReadFile(other_fname_dtb)) |
||||
other_dtb = fdt.FdtScan(out_fname) |
||||
fdt_files[other_fname] = other_dtb |
||||
|
||||
def GetFdts(): |
||||
"""Yield all device tree files being used by binman |
||||
|
||||
Yields: |
||||
Device trees being used (U-Boot proper, SPL, TPL) |
||||
""" |
||||
yield main_dtb |
||||
for other_fname in fdt_subset: |
||||
yield fdt_files[other_fname] |
||||
|
||||
def GetUpdateNodes(node): |
||||
"""Yield all the nodes that need to be updated in all device trees |
||||
|
||||
The property referenced by this node is added to any device trees which |
||||
have the given node. Due to removable of unwanted notes, SPL and TPL may |
||||
not have this node. |
||||
|
||||
Args: |
||||
node: Node object in the main device tree to look up |
||||
|
||||
Yields: |
||||
Node objects in each device tree that is in use (U-Boot proper, which |
||||
is node, SPL and TPL) |
||||
""" |
||||
yield node |
||||
for dtb in fdt_files.values(): |
||||
if dtb != node.GetFdt(): |
||||
other_node = dtb.GetNode(node.path) |
||||
if other_node: |
||||
yield other_node |
||||
|
||||
def AddZeroProp(node, prop): |
||||
"""Add a new property to affected device trees with an integer value of 0. |
||||
|
||||
Args: |
||||
prop_name: Name of property |
||||
""" |
||||
for n in GetUpdateNodes(node): |
||||
n.AddZeroProp(prop) |
||||
|
||||
def AddSubnode(node, name): |
||||
"""Add a new subnode to a node in affected device trees |
||||
|
||||
Args: |
||||
node: Node to add to |
||||
name: name of node to add |
||||
|
||||
Returns: |
||||
New subnode that was created in main tree |
||||
""" |
||||
first = None |
||||
for n in GetUpdateNodes(node): |
||||
subnode = n.AddSubnode(name) |
||||
if not first: |
||||
first = subnode |
||||
return first |
||||
|
||||
def AddString(node, prop, value): |
||||
"""Add a new string property to affected device trees |
||||
|
||||
Args: |
||||
prop_name: Name of property |
||||
value: String value (which will be \0-terminated in the DT) |
||||
""" |
||||
for n in GetUpdateNodes(node): |
||||
n.AddString(prop, value) |
||||
|
||||
def SetInt(node, prop, value): |
||||
"""Update an integer property in affected device trees with an integer value |
||||
|
||||
This is not allowed to change the size of the FDT. |
||||
|
||||
Args: |
||||
prop_name: Name of property |
||||
""" |
||||
for n in GetUpdateNodes(node): |
||||
n.SetInt(prop, value) |
||||
|
||||
def CheckAddHashProp(node): |
||||
hash_node = node.FindNode('hash') |
||||
if hash_node: |
||||
algo = hash_node.props.get('algo') |
||||
if not algo: |
||||
return "Missing 'algo' property for hash node" |
||||
if algo.value == 'sha256': |
||||
size = 32 |
||||
else: |
||||
return "Unknown hash algorithm '%s'" % algo |
||||
for n in GetUpdateNodes(hash_node): |
||||
n.AddEmptyProp('value', size) |
||||
|
||||
def CheckSetHashValue(node, get_data_func): |
||||
hash_node = node.FindNode('hash') |
||||
if hash_node: |
||||
algo = hash_node.props.get('algo').value |
||||
if algo == 'sha256': |
||||
m = hashlib.sha256() |
||||
m.update(get_data_func()) |
||||
data = m.digest() |
||||
for n in GetUpdateNodes(hash_node): |
||||
n.SetData('value', data) |
@ -0,0 +1,15 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
size = <16>; |
||||
fill { |
||||
size = <0>; |
||||
fill-byte = [ff]; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,14 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
size = <16>; |
||||
|
||||
x86-start16-tpl { |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,18 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
section { |
||||
u-boot-dtb { |
||||
}; |
||||
}; |
||||
u-boot-spl-dtb { |
||||
}; |
||||
u-boot-tpl-dtb { |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,11 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
blob { |
||||
filename = "compress"; |
||||
compress = "lz4"; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,11 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
files { |
||||
pattern = "files/*.dat"; |
||||
compress = "none"; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,11 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
files { |
||||
pattern = "files/*.dat"; |
||||
compress = "lz4"; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,12 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
files { |
||||
pattern = "files/*.none"; |
||||
compress = "none"; |
||||
require-matches; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,11 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
files { |
||||
compress = "none"; |
||||
require-matches; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,43 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
size = <40>; |
||||
fill { |
||||
expand-size; |
||||
fill-byte = [61]; |
||||
size = <0>; |
||||
}; |
||||
u-boot { |
||||
offset = <8>; |
||||
}; |
||||
section { |
||||
expand-size; |
||||
pad-byte = <0x62>; |
||||
intel-mrc { |
||||
}; |
||||
}; |
||||
u-boot2 { |
||||
type = "u-boot"; |
||||
offset = <16>; |
||||
}; |
||||
section2 { |
||||
type = "section"; |
||||
fill { |
||||
expand-size; |
||||
fill-byte = [63]; |
||||
size = <0>; |
||||
}; |
||||
u-boot { |
||||
offset = <8>; |
||||
}; |
||||
}; |
||||
fill2 { |
||||
type = "fill"; |
||||
expand-size; |
||||
fill-byte = [64]; |
||||
size = <0>; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,14 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
_testing { |
||||
expand-size; |
||||
return-contents-once; |
||||
}; |
||||
u-boot { |
||||
offset = <8>; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,12 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
u-boot { |
||||
hash { |
||||
algo = "sha256"; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,11 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
u-boot { |
||||
hash { |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,12 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
u-boot { |
||||
hash { |
||||
algo = "invalid"; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,29 @@ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
sort-by-offset; |
||||
end-at-4gb; |
||||
size = <0x200>; |
||||
u-boot-tpl-with-ucode-ptr { |
||||
}; |
||||
|
||||
u-boot-tpl-dtb-with-ucode { |
||||
}; |
||||
|
||||
u-boot-ucode { |
||||
}; |
||||
}; |
||||
|
||||
microcode { |
||||
update@0 { |
||||
data = <0x12345678 0x12345679>; |
||||
}; |
||||
update@1 { |
||||
data = <0xabcd0000 0x78235609>; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,20 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
end-at-4gb; |
||||
size = <0x100>; |
||||
pad-byte = <0x61>; |
||||
u-boot { |
||||
}; |
||||
intel-mrc { |
||||
}; |
||||
fmap { |
||||
offset = <0xffffff20>; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,22 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
end-at-4gb; |
||||
size = <0x100>; |
||||
u-boot { |
||||
}; |
||||
section { |
||||
pad-byte = <0x62>; |
||||
intel-mrc { |
||||
}; |
||||
fmap { |
||||
offset = <0x20>; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,14 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
u-boot-elf { |
||||
}; |
||||
u-boot-spl-elf { |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,15 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
u-boot-elf { |
||||
strip; |
||||
}; |
||||
u-boot-spl-elf { |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,18 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
binman { |
||||
section { |
||||
u-boot { |
||||
}; |
||||
fill { |
||||
size = <0x10>; |
||||
fill-byte = [61]; |
||||
}; |
||||
hash { |
||||
algo = "sha256"; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1 @@ |
||||
sorry I'm late |
@ -0,0 +1 @@ |
||||
Oh, don't bother apologising, I'm sorry you're alive |
@ -0,0 +1 @@ |
||||
this does not have a .dat extenion |
Loading…
Reference in new issue