29 for (
size_t i = 0; i <
strlen(str); i++) {
31 if (str[i] ==
'_' || str[i] ==
' ')
40 char compat_string[80] = {};
44 snprintf(compat_string,
sizeof(compat_string),
45 "%s,%s-rev%u-sku%u", CONFIG_MAINBOARD_VENDOR,
52 snprintf(compat_string,
sizeof(compat_string),
"%s,%s-rev%u",
53 CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER,
60 snprintf(compat_string,
sizeof(compat_string),
"%s,%s-sku%u",
61 CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER,
67 snprintf(compat_string,
sizeof(compat_string),
"%s,%s",
68 CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER);
178 int offset = start_offset;
198 const char *compat_name)
200 int bytes = compat_prop->
size;
201 const char *compat_str = compat_prop->
data;
203 for (
int pos = 0; bytes && compat_str[0]; pos++) {
204 if (!
strncmp(compat_str, compat_name, bytes))
206 int len =
strlen(compat_str) + 1;
215 const char *path[] = {
"chosen",
NULL };
225 const char *path[] = {
"chosen",
NULL };
230 u64 end = start + ramdisk_size;
260 return 0x1ULL << (size_cells * 32 - 1);
266 u64 full_size = end - start;
269 const u64 size =
MIN(max_size, full_size);
306 if (new_start != new_end)
326 compat_node =
xzalloc(
sizeof(*compat_node));
338 u32 addr_cells = 1, size_cells = 1;
350 if (devtype && !
strcmp(devtype,
"memory"))
356 node->
name =
"memory";
409 if (!
config->compat.name) {
410 void *fdt_blob =
config->fdt->data;
416 "external compatible property, skipping.\n",
422 if (
config->overlays.next) {
430 "for config %s, skipping.\n",
470 const char *default_config_name =
NULL;
484 "(lowest to highest priority) :");
504 config->ramdisk->compression < 0) {
506 "an unsupported algorithm, discarding config %s."
515 if (default_config_name &&
527 if (
config->compat.name) {
529 int bytes =
config->compat.size;
530 const char *compat_str =
config->compat.data;
531 for (
int pos = 0; bytes && compat_str[0]; pos++) {
533 if (pos ==
config->compat_pos)
535 int len =
strlen(compat_str) + 1;
540 if (
config->compat_rank >= 0 && (!compat_config ||
549 to_boot = compat_config;
552 }
else if (default_config) {
553 to_boot = default_config;
#define assert(statement)
static struct sdram_info params
#define UNDEFINED_STRAPPING_ID
bool bootmem_walk_os_mem(range_action_t action, void *arg)
Walk memory tables from OS point of view and call the provided function, for every region.
#define DIV_ROUND_UP(x, y)
#define printk(level,...)
static int tolower(int c)
void dt_read_cell_props(const struct device_tree_node *node, u32 *addrcp, u32 *sizecp)
struct device_tree_node * dt_find_node(struct device_tree_node *parent, const char **path, u32 *addrcp, u32 *sizecp, int create)
void dt_add_bin_prop(struct device_tree_node *node, const char *name, void *data, size_t size)
int fdt_next_property(const void *blob, uint32_t offset, struct fdt_property *prop)
int fdt_node_name(const void *blob, uint32_t offset, const char **name)
void dt_add_string_prop(struct device_tree_node *node, const char *name, const char *str)
struct device_tree_node * dt_find_node_by_path(struct device_tree *tree, const char *path, u32 *addrcp, u32 *sizecp, int create)
struct device_tree * fdt_unflatten(const void *blob)
const char * dt_find_string_prop(const struct device_tree_node *node, const char *name)
void dt_add_u64_prop(struct device_tree_node *node, const char *name, u64 val)
void dt_write_int(u8 *dest, u64 src, size_t length)
uint32_t board_id(void)
board_id() - Get the board version
static struct fit_image_node * find_image(const char *name)
static void config_node(struct device_tree_node *node)
static struct fit_image_node * find_image_with_overlays(const char *name, int bytes, struct list_node *prev)
static struct list_node config_nodes
static int fit_update_compat(struct fit_config_node *config)
static char * clean_compat_string(char *str)
void fit_add_compat_string(const char *str)
static bool walk_memory_table(const struct range_entry *r, void *arg)
static int fit_check_compat(struct fdt_property *compat_prop, const char *compat_name)
static int fdt_find_compat(const void *blob, uint32_t start_offset, struct fdt_property *prop)
static void fit_add_default_compat_strings(void)
static void update_mem_property(u64 start, u64 end, struct entry_params *params)
void fit_update_chosen(struct device_tree *tree, const char *cmd_line)
struct fit_config_node * fit_load(void *fit)
static struct list_node compat_strings
void fit_add_ramdisk(struct device_tree *tree, void *ramdisk_addr, size_t ramdisk_size)
static void update_reserve_map(uint64_t start, uint64_t end, struct device_tree *tree)
static struct list_node image_nodes
static void fit_unpack(struct device_tree *tree, const char **default_config)
void fit_update_memory(struct device_tree *tree)
static void image_node(struct device_tree_node *node)
static uint64_t max_range(unsigned int size_cells)
#define list_for_each(ptr, head, member)
void list_insert_after(struct list_node *node, struct list_node *after)
void list_remove(struct list_node *node)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
static resource_t range_entry_base(const struct range_entry *r)
static resource_t range_entry_end(const struct range_entry *r)
#define memranges_each_entry(r, ranges)
static unsigned long range_entry_tag(const struct range_entry *r)
void memranges_teardown(struct memranges *ranges)
void memranges_insert(struct memranges *ranges, resource_t base, resource_t size, unsigned long tag)
#define memranges_init_empty(__ranges, __free, __num_free)
static resource_t range_entry_size(const struct range_entry *r)
unsigned long long uint64_t
int strcmp(const char *s1, const char *s2)
int strncmp(const char *s1, const char *s2, int maxlen)
size_t strnlen(const char *src, size_t max)
char * strdup(const char *s)
size_t strlen(const char *src)
const char * compat_string
struct list_node list_node
struct list_node list_node
struct list_node children
struct list_node properties
struct list_node list_node
struct list_node reserve_map
struct device_tree_node * root
const char * compat_string
struct list_node list_node
struct fit_image_node * overlay
struct list_node list_node
struct memranges reserved
int snprintf(char *buf, size_t size, const char *fmt,...)
Note: This file is only for POSIX compatibility, and is meant to be chain-included via string....