Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/fdt/fdt_loader_cmd.c
Show All 25 Lines | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <stand.h> | #include <stand.h> | ||||
#include <inttypes.h> | |||||
#include <fdt.h> | #include <fdt.h> | ||||
#include <libfdt.h> | #include <libfdt.h> | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/linker.h> | #include <sys/linker.h> | ||||
#include <machine/elf.h> | #include <machine/elf.h> | ||||
#include "bootstrap.h" | #include "bootstrap.h" | ||||
#include "fdt_platform.h" | #include "fdt_platform.h" | ||||
▲ Show 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | if (fdt_load_dtb(bfp->f_addr) == 0) { | ||||
bfp->f_name); | bfp->f_name); | ||||
return (0); | return (0); | ||||
} | } | ||||
} | } | ||||
/* If we were given the address of a valid blob in memory, use it. */ | /* If we were given the address of a valid blob in memory, use it. */ | ||||
if (fdt_to_load != NULL) { | if (fdt_to_load != NULL) { | ||||
if (fdt_load_dtb_addr(fdt_to_load) == 0) { | if (fdt_load_dtb_addr(fdt_to_load) == 0) { | ||||
printf("Using DTB from memory address 0x%08X.\n", | printf("Using DTB from memory address 0x%" PRIxPTR | ||||
(unsigned int)fdt_to_load); | ".\n", (uintptr_t)fdt_to_load); | ||||
andrew: `%p` | |||||
return (0); | return (0); | ||||
} | } | ||||
} | } | ||||
if (fdt_platform_load_dtb() == 0) | if (fdt_platform_load_dtb() == 0) | ||||
return (0); | return (0); | ||||
/* If there is a dtb compiled into the kernel, use it. */ | /* If there is a dtb compiled into the kernel, use it. */ | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | while (o != -FDT_ERR_NOTFOUND && o2 != -FDT_ERR_NOTFOUND) { | ||||
fdt_setprop_inplace_cell(fdtp, lo, "bus-frequency", | fdt_setprop_inplace_cell(fdtp, lo, "bus-frequency", | ||||
(uint32_t)busfreq); | (uint32_t)busfreq); | ||||
lo = MIN(o, o2); | lo = MIN(o, o2); | ||||
} | } | ||||
} | } | ||||
#ifdef notyet | |||||
adrianUnsubmitted Not Done Inline Actionswhy's this ifdef'ed out? adrian: why's this ifdef'ed out? | |||||
Not Done Inline ActionsThis is a static function that is not called by any other function in sys/boot/fdt/fdt_loader_cmd.c and gcc was spitting out warnings about it. Not being sure whether it's still useful to someone or not I decided to ifdef it out. Sgalabov_gmail.com: This is a static function that is not called by any other function in… | |||||
static int | static int | ||||
fdt_reg_valid(uint32_t *reg, int len, int addr_cells, int size_cells) | fdt_reg_valid(uint32_t *reg, int len, int addr_cells, int size_cells) | ||||
{ | { | ||||
int cells_in_tuple, i, tuples, tuple_size; | int cells_in_tuple, i, tuples, tuple_size; | ||||
uint32_t cur_start, cur_size; | uint32_t cur_start, cur_size; | ||||
cells_in_tuple = (addr_cells + size_cells); | cells_in_tuple = (addr_cells + size_cells); | ||||
tuple_size = cells_in_tuple * sizeof(uint32_t); | tuple_size = cells_in_tuple * sizeof(uint32_t); | ||||
Show All 15 Lines | for (i = 0; i < tuples; i++) { | ||||
if (cur_size == 0) | if (cur_size == 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
debugf(" reg#%d (start: 0x%0x size: 0x%0x) valid!\n", | debugf(" reg#%d (start: 0x%0x size: 0x%0x) valid!\n", | ||||
i, cur_start, cur_size); | i, cur_start, cur_size); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif | |||||
void | void | ||||
fdt_fixup_memory(struct fdt_mem_region *region, size_t num) | fdt_fixup_memory(struct fdt_mem_region *region, size_t num) | ||||
{ | { | ||||
struct fdt_mem_region *curmr; | struct fdt_mem_region *curmr; | ||||
uint32_t addr_cells, size_cells; | uint32_t addr_cells, size_cells; | ||||
uint32_t *addr_cellsp, *size_cellsp; | uint32_t *addr_cellsp, *size_cellsp; | ||||
int err, i, len, memory, root; | int err, i, len, memory, root; | ||||
▲ Show 20 Lines • Show All 1,108 Lines • Show Last 20 Lines |
%p