mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 01:41:39 +00:00
![Linus Torvalds](/assets/img/avatar_default.png)
Generally minor changes. A bunch of bug fixes, particularly for initialization and some refactoring. Most notable change if feeding the entire flattened tree into the random pool at boot. May not be significant, but shouldn't hurt either. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJSL12LAAoJEEFnBt12D9kB64gP/RBipnYbo3RPanHg+lE/J1V7 KSVFNGKWJHxTg47VVC1YJGIG21jqxAilpdS2MQL5FP7iyd+IzvtHpQiJgp+2G+pq di06yrdyrYErxRgZgGQi8IpR538ZzOEVLCKJGdb09YelkRzPT5au7CC1MAsX3qco yba7PHk0/Nc4hZE4aGbgR1DlRmn86ob7mM0KFE/LORaSN2BueMgWcwKhQXYNGyoh assX4yNhAbUG6Bgw7paBLDGqHh8c5Ei5AppU8yPb+N094jgYHBJryUoDlzzUHD23 qqiEqHhUKT0TpgHNs8KH0WZFugcmjKvYEbzdzadBxqfXnJN4fKSEcdfF3iz4T14j U6EZks89GoHwA523OghUZkKNOqlsUdWfdKz+8/grQqKisYwDcf3fCxEYk/4weDCQ b6fFlOv6+AI3btjXp6F511ZKxyT4ZZzkHjp/ZSrhBygyamNZfax0ma0j+ZS9AZql kPxQS0nOve6NKaP7vXxMmW5sGMnL19ER/Hm31wthGcWI43GVebUdklnzfGaEeSjs pmP8oiCNemceqVpiPKxcOxiguf/eyIjP1SFXbguASygUmQeTDbbJ8n1FYznCitue xJgWttKWsEf/aMR3eJtQ3aBmHR3rijAV4E28Wlq8XMkocwvpQm2zMocS2Z5BJ80S hi1kQVy8+RxNX96tOSp1 =GSWl -----END PGP SIGNATURE----- Merge tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux Pull device tree core updates from Grant Likely: "Generally minor changes. A bunch of bug fixes, particularly for initialization and some refactoring. Most notable change if feeding the entire flattened tree into the random pool at boot. May not be significant, but shouldn't hurt either" Tim Bird questions whether the boot time cost of the random feeding may be noticeable. And "add_device_randomness()" is definitely not some speed deamon of a function. * tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux: of/platform: add error reporting to of_amba_device_create() irq/of: Fix comment typo for irq_of_parse_and_map of: Feed entire flattened device tree into the random pool of/fdt: Clean up casting in unflattening path of/fdt: Remove duplicate memory clearing on FDT unflattening gpio: implement gpio-ranges binding document fix of: call __of_parse_phandle_with_args from of_parse_phandle of: introduce of_parse_phandle_with_fixed_args of: move of_parse_phandle() of: move documentation of of_parse_phandle_with_args of: Fix missing memory initialization on FDT unflattening of: consolidate definition of early_init_dt_alloc_memory_arch() of: Make of_get_phy_mode() return int i.s.o. const int include: dt-binding: input: create a DT header defining key codes. of/platform: Staticize of_platform_device_create_pdata() of: Specify initrd location using 64-bit dt: Typo fix OF: make of_property_for_each_{u32|string}() use parameters if OF is not enabled
127 lines
4.7 KiB
C
127 lines
4.7 KiB
C
/*
|
|
* Definitions for working with the Flattened Device Tree data format
|
|
*
|
|
* Copyright 2009 Benjamin Herrenschmidt, IBM Corp
|
|
* benh@kernel.crashing.org
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* version 2 as published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef _LINUX_OF_FDT_H
|
|
#define _LINUX_OF_FDT_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/init.h>
|
|
|
|
/* Definitions used by the flattened device tree */
|
|
#define OF_DT_HEADER 0xd00dfeed /* marker */
|
|
#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
|
|
#define OF_DT_END_NODE 0x2 /* End node */
|
|
#define OF_DT_PROP 0x3 /* Property: name off, size,
|
|
* content */
|
|
#define OF_DT_NOP 0x4 /* nop */
|
|
#define OF_DT_END 0x9
|
|
|
|
#define OF_DT_VERSION 0x10
|
|
|
|
#ifndef __ASSEMBLY__
|
|
/*
|
|
* This is what gets passed to the kernel by prom_init or kexec
|
|
*
|
|
* The dt struct contains the device tree structure, full pathes and
|
|
* property contents. The dt strings contain a separate block with just
|
|
* the strings for the property names, and is fully page aligned and
|
|
* self contained in a page, so that it can be kept around by the kernel,
|
|
* each property name appears only once in this page (cheap compression)
|
|
*
|
|
* the mem_rsvmap contains a map of reserved ranges of physical memory,
|
|
* passing it here instead of in the device-tree itself greatly simplifies
|
|
* the job of everybody. It's just a list of u64 pairs (base/size) that
|
|
* ends when size is 0
|
|
*/
|
|
struct boot_param_header {
|
|
__be32 magic; /* magic word OF_DT_HEADER */
|
|
__be32 totalsize; /* total size of DT block */
|
|
__be32 off_dt_struct; /* offset to structure */
|
|
__be32 off_dt_strings; /* offset to strings */
|
|
__be32 off_mem_rsvmap; /* offset to memory reserve map */
|
|
__be32 version; /* format version */
|
|
__be32 last_comp_version; /* last compatible version */
|
|
/* version 2 fields below */
|
|
__be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
|
|
/* version 3 fields below */
|
|
__be32 dt_strings_size; /* size of the DT strings block */
|
|
/* version 17 fields below */
|
|
__be32 dt_struct_size; /* size of the DT structure block */
|
|
};
|
|
|
|
#if defined(CONFIG_OF_FLATTREE)
|
|
|
|
struct device_node;
|
|
|
|
/* For scanning an arbitrary device-tree at any time */
|
|
extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);
|
|
extern void *of_fdt_get_property(struct boot_param_header *blob,
|
|
unsigned long node,
|
|
const char *name,
|
|
unsigned long *size);
|
|
extern int of_fdt_is_compatible(struct boot_param_header *blob,
|
|
unsigned long node,
|
|
const char *compat);
|
|
extern int of_fdt_match(struct boot_param_header *blob, unsigned long node,
|
|
const char *const *compat);
|
|
extern void of_fdt_unflatten_tree(unsigned long *blob,
|
|
struct device_node **mynodes);
|
|
|
|
/* TBD: Temporary export of fdt globals - remove when code fully merged */
|
|
extern int __initdata dt_root_addr_cells;
|
|
extern int __initdata dt_root_size_cells;
|
|
extern struct boot_param_header *initial_boot_params;
|
|
|
|
/* For scanning the flat device-tree at boot time */
|
|
extern char *find_flat_dt_string(u32 offset);
|
|
extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
|
|
int depth, void *data),
|
|
void *data);
|
|
extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
|
|
unsigned long *size);
|
|
extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
|
|
extern int of_flat_dt_match(unsigned long node, const char *const *matches);
|
|
extern unsigned long of_get_flat_dt_root(void);
|
|
extern int of_scan_flat_dt_by_path(const char *path,
|
|
int (*it)(unsigned long node, const char *name, int depth, void *data),
|
|
void *data);
|
|
|
|
extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
|
|
int depth, void *data);
|
|
extern void early_init_dt_check_for_initrd(unsigned long node);
|
|
extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
|
|
int depth, void *data);
|
|
extern void early_init_dt_add_memory_arch(u64 base, u64 size);
|
|
extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
|
|
extern u64 dt_mem_next_cell(int s, __be32 **cellp);
|
|
|
|
/*
|
|
* If BLK_DEV_INITRD, the fdt early init code will call this function,
|
|
* to be provided by the arch code. start and end are specified as
|
|
* physical addresses.
|
|
*/
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
|
extern void early_init_dt_setup_initrd_arch(u64 start, u64 end);
|
|
#endif
|
|
|
|
/* Early flat tree scan hooks */
|
|
extern int early_init_dt_scan_root(unsigned long node, const char *uname,
|
|
int depth, void *data);
|
|
|
|
/* Other Prototypes */
|
|
extern void unflatten_device_tree(void);
|
|
extern void early_init_devtree(void *);
|
|
#else /* CONFIG_OF_FLATTREE */
|
|
static inline void unflatten_device_tree(void) {}
|
|
#endif /* CONFIG_OF_FLATTREE */
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* _LINUX_OF_FDT_H */
|