mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-17 20:51:39 +00:00
libfdt: Make fdt_check_header() public
Changed _fdt_check_header() to fdt_check_header() and made it part of the interface - it is a useful routine. Also did some asthetics cleanup to the include files (headers).
This commit is contained in:
parent
25b0806fff
commit
6679f92995
6 changed files with 49 additions and 7 deletions
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* libfdt - Flat Device Tree manipulation
|
||||||
|
* Copyright (C) 2006 David Gibson, IBM Corporation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _FDT_H
|
#ifndef _FDT_H
|
||||||
#define _FDT_H
|
#define _FDT_H
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#ifndef _LIBFDT_H
|
|
||||||
#define _LIBFDT_H
|
|
||||||
/*
|
/*
|
||||||
* libfdt - Flat Device Tree manipulation
|
* libfdt - Flat Device Tree manipulation
|
||||||
* Copyright (C) 2006 David Gibson, IBM Corporation.
|
* Copyright (C) 2006 David Gibson, IBM Corporation.
|
||||||
|
@ -19,6 +17,9 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _LIBFDT_H
|
||||||
|
#define _LIBFDT_H
|
||||||
|
|
||||||
#include <fdt.h>
|
#include <fdt.h>
|
||||||
#include <libfdt_env.h>
|
#include <libfdt_env.h>
|
||||||
|
|
||||||
|
@ -60,6 +61,8 @@
|
||||||
#define fdt_set_header(fdt, field, val) \
|
#define fdt_set_header(fdt, field, val) \
|
||||||
((struct fdt_header *)(fdt))->field = cpu_to_fdt32(val)
|
((struct fdt_header *)(fdt))->field = cpu_to_fdt32(val)
|
||||||
|
|
||||||
|
int fdt_check_header(const void *fdt);
|
||||||
|
|
||||||
void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
|
void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
|
||||||
|
|
||||||
#define fdt_offset_ptr_typed(fdt, offset, var) \
|
#define fdt_offset_ptr_typed(fdt, offset, var) \
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*
|
||||||
|
* libfdt - Flat Device Tree manipulation (build/run environment adaptation)
|
||||||
|
* Copyright (C) 2007 Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com
|
||||||
|
* Original version written by David Gibson, IBM Corporation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _LIBFDT_ENV_H
|
#ifndef _LIBFDT_ENV_H
|
||||||
#define _LIBFDT_ENV_H
|
#define _LIBFDT_ENV_H
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "libfdt_internal.h"
|
#include "libfdt_internal.h"
|
||||||
|
|
||||||
int _fdt_check_header(const void *fdt)
|
int fdt_check_header(const void *fdt)
|
||||||
{
|
{
|
||||||
if (fdt_magic(fdt) == FDT_MAGIC) {
|
if (fdt_magic(fdt) == FDT_MAGIC) {
|
||||||
/* Complete tree */
|
/* Complete tree */
|
||||||
|
@ -72,7 +72,7 @@ const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
|
||||||
|
|
||||||
int fdt_move(const void *fdt, void *buf, int bufsize)
|
int fdt_move(const void *fdt, void *buf, int bufsize)
|
||||||
{
|
{
|
||||||
int err = _fdt_check_header(fdt);
|
int err = fdt_check_header(fdt);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#define CHECK_HEADER(fdt) { \
|
#define CHECK_HEADER(fdt) { \
|
||||||
int err; \
|
int err; \
|
||||||
if ((err = _fdt_check_header(fdt)) != 0) \
|
if ((err = fdt_check_header(fdt)) != 0) \
|
||||||
return err; \
|
return err; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ struct fdt_property *fdt_get_property(const void *fdt,
|
||||||
int offset, nextoffset;
|
int offset, nextoffset;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((err = _fdt_check_header(fdt)) != 0)
|
if ((err = fdt_check_header(fdt)) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
err = -FDT_ERR_BADOFFSET;
|
err = -FDT_ERR_BADOFFSET;
|
||||||
|
|
|
@ -27,7 +27,7 @@ static int rw_check_header(void *fdt)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((err = _fdt_check_header(fdt)))
|
if ((err = fdt_check_header(fdt)))
|
||||||
return err;
|
return err;
|
||||||
if (fdt_version(fdt) < 0x11)
|
if (fdt_version(fdt) < 0x11)
|
||||||
return -FDT_ERR_BADVERSION;
|
return -FDT_ERR_BADVERSION;
|
||||||
|
|
Loading…
Add table
Reference in a new issue