Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
reform-boundary-uboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Humbert
reform-boundary-uboot
Commits
aeff6d50
Commit
aeff6d50
authored
17 years ago
by
Wolfgang Denk
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
git://www.denx.de/git/u-boot-fdt
parents
a1b215e2
c2a545ce
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
README
+0
-13
0 additions, 13 deletions
README
common/cmd_fdt.c
+67
-70
67 additions, 70 deletions
common/cmd_fdt.c
common/ft_build.c
+0
-113
0 additions, 113 deletions
common/ft_build.c
cpu/mpc8xx/Makefile
+23
-10
23 additions, 10 deletions
cpu/mpc8xx/Makefile
lib_ppc/bootm.c
+0
-12
0 additions, 12 deletions
lib_ppc/bootm.c
with
90 additions
and
218 deletions
README
+
0
−
13
View file @
aeff6d50
...
...
@@ -372,19 +372,6 @@ The following options need to be configured:
boards with QUICC Engines require OF_QE to set UCC mac addresses
CONFIG_OF_HAS_BD_T
* CONFIG_OF_LIBFDT - enables the "fdt bd_t" command
* CONFIG_OF_FLAT_TREE - The resulting flat device tree
will have a copy of the bd_t. Space should be
pre-allocated in the dts for the bd_t.
CONFIG_OF_HAS_UBOOT_ENV
* CONFIG_OF_LIBFDT - enables the "fdt env" command
* CONFIG_OF_FLAT_TREE - The resulting flat device tree
will have a copy of u-boot's environment variables
CONFIG_OF_BOARD_SETUP
Board code has addition modification that it wants to make
...
...
This diff is collapsed.
Click to expand it.
common/cmd_fdt.c
+
67
−
70
View file @
aeff6d50
...
...
@@ -42,8 +42,7 @@
DECLARE_GLOBAL_DATA_PTR
;
static
int
fdt_valid
(
void
);
static
int
fdt_parse_prop
(
char
*
pathp
,
char
*
prop
,
char
*
newval
,
char
*
data
,
int
*
len
);
static
int
fdt_parse_prop
(
char
**
newval
,
int
count
,
char
*
data
,
int
*
len
);
static
int
fdt_print
(
const
char
*
pathp
,
char
*
prop
,
int
depth
);
/*
...
...
@@ -202,7 +201,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
if
(
argc
==
4
)
{
len
=
0
;
}
else
{
ret
=
fdt_parse_prop
(
pathp
,
prop
,
argv
[
4
]
,
data
,
&
len
);
ret
=
fdt_parse_prop
(
&
argv
[
4
],
argc
-
4
,
data
,
&
len
);
if
(
ret
!=
0
)
return
ret
;
}
...
...
@@ -464,69 +463,77 @@ static int fdt_valid(void)
/*
* Parse the user's input, partially heuristic. Valid formats:
* <00> - hex byte
* <0011> - hex half word (16 bits)
* <00112233> - hex word (32 bits)
* - hex double words (64 bits) are not supported, must use
* a byte stream instead.
* <0x00112233 4 05> - an array of cells. Numbers follow standard
* C conventions.
* [00 11 22 .. nn] - byte stream
* "string" - If the the value doesn't start with "<" or "[", it is
* treated as a string. Note that the quotes are
* stripped by the parser before we get the string.
* newval: An array of strings containing the new property as specified
* on the command line
* count: The number of strings in the array
* data: A bytestream to be placed in the property
* len: The length of the resulting bytestream
*/
static
int
fdt_parse_prop
(
char
*
pathp
,
char
*
prop
,
char
*
newval
,
char
*
data
,
int
*
len
)
static
int
fdt_parse_prop
(
char
**
newval
,
int
count
,
char
*
data
,
int
*
len
)
{
char
*
cp
;
/* temporary char pointer */
char
*
newp
;
/* temporary newval char pointer */
unsigned
long
tmp
;
/* holds converted values */
int
stridx
=
0
;
if
(
*
newval
==
'<'
)
{
*
len
=
0
;
newp
=
newval
[
0
];
/* An array of cells */
if
(
*
newp
==
'<'
)
{
newp
++
;
while
((
*
newp
!=
'>'
)
&&
(
stridx
<
count
))
{
/*
* Bigger values than bytes.
* Keep searching until we find that last ">"
* That way users don't have to escape the spaces
*/
*
len
=
0
;
newval
++
;
while
((
*
newval
!=
'>'
)
&&
(
*
newval
!=
'\0'
))
{
cp
=
newval
;
tmp
=
simple_strtoul
(
cp
,
&
newval
,
16
);
if
((
newval
-
cp
)
<=
2
)
{
*
data
=
tmp
&
0xFF
;
data
+=
1
;
*
len
+=
1
;
}
else
if
((
newval
-
cp
)
<=
4
)
{
*
(
uint16_t
*
)
data
=
__cpu_to_be16
(
tmp
);
data
+=
2
;
*
len
+=
2
;
}
else
if
((
newval
-
cp
)
<=
8
)
{
if
(
*
newp
==
'\0'
)
{
newp
=
newval
[
++
stridx
];
continue
;
}
cp
=
newp
;
tmp
=
simple_strtoul
(
cp
,
&
newp
,
0
);
*
(
uint32_t
*
)
data
=
__cpu_to_be32
(
tmp
);
data
+=
4
;
*
len
+=
4
;
}
else
{
/* If the ptr didn't advance, something went wrong */
if
((
newp
-
cp
)
<=
0
)
{
printf
(
"Sorry, I could not convert
\"
%s
\"\n
"
,
cp
);
return
1
;
}
while
(
*
newval
==
' '
)
newval
++
;
while
(
*
newp
==
' '
)
newp
++
;
}
if
(
*
newval
!=
'>'
)
{
printf
(
"Unexpected character '%c'
\n
"
,
*
newval
);
if
(
*
newp
!=
'>'
)
{
printf
(
"Unexpected character '%c'
\n
"
,
*
newp
);
return
1
;
}
}
else
if
(
*
new
val
==
'['
)
{
}
else
if
(
*
new
p
==
'['
)
{
/*
* Byte stream. Convert the values.
*/
*
len
=
0
;
newval
++
;
while
((
*
newval
!=
']'
)
&&
(
*
newval
!=
'\0'
))
{
tmp
=
simple_strtoul
(
newval
,
&
newval
,
16
);
newp
++
;
while
((
*
newp
!=
']'
)
&&
(
stridx
<
count
))
{
tmp
=
simple_strtoul
(
newp
,
&
newp
,
16
);
*
data
++
=
tmp
&
0xFF
;
*
len
=
*
len
+
1
;
while
(
*
newval
==
' '
)
newval
++
;
while
(
*
newp
==
' '
)
newp
++
;
if
(
*
newp
!=
'\0'
)
newp
=
newval
[
++
stridx
];
}
if
(
*
new
val
!=
']'
)
{
if
(
*
new
p
!=
']'
)
{
printf
(
"Unexpected character '%c'
\n
"
,
*
newval
);
return
1
;
}
...
...
@@ -535,8 +542,11 @@ static int fdt_parse_prop(char *pathp, char *prop, char *newval,
* Assume it is a string. Copy it into our data area for
* convenience (including the terminating '\0').
*/
*
len
=
strlen
(
newval
)
+
1
;
strcpy
(
data
,
newval
);
while
(
stridx
<
count
)
{
*
len
=
strlen
(
newp
)
+
1
;
strcpy
(
data
,
newp
);
newp
=
newval
[
++
stridx
];
}
}
return
0
;
}
...
...
@@ -593,7 +603,6 @@ static int is_printable_string(const void *data, int len)
static
void
print_data
(
const
void
*
data
,
int
len
)
{
int
j
;
const
u8
*
s
;
/* no data, don't print */
if
(
len
==
0
)
...
...
@@ -616,32 +625,20 @@ static void print_data(const void *data, int len)
return
;
}
switch
(
len
)
{
case
1
:
/* byte */
printf
(
"<0x%02x>"
,
(
*
(
u8
*
)
data
)
&
0xff
);
break
;
case
2
:
/* half-word */
printf
(
"<0x%04x>"
,
be16_to_cpu
(
*
(
u16
*
)
data
)
&
0xffff
);
break
;
case
4
:
/* word */
printf
(
"<0x%08x>"
,
be32_to_cpu
(
*
(
u32
*
)
data
)
&
0xffffffffU
);
break
;
case
8
:
/* double-word */
#if __WORDSIZE == 64
printf
(
"<0x%016llx>"
,
be64_to_cpu
(
*
(
uint64_t
*
)
data
));
#else
printf
(
"<0x%08x "
,
be32_to_cpu
(
*
(
u32
*
)
data
)
&
0xffffffffU
);
data
+=
4
;
printf
(
"0x%08x>"
,
be32_to_cpu
(
*
(
u32
*
)
data
)
&
0xffffffffU
);
#endif
break
;
default:
/* anything else... hexdump */
if
((
len
%
4
)
==
0
)
{
const
u32
*
p
;
printf
(
"<"
);
for
(
j
=
0
,
p
=
data
;
j
<
len
/
4
;
j
++
)
printf
(
"0x%x%s"
,
p
[
j
],
j
<
(
len
/
4
-
1
)
?
" "
:
""
);
printf
(
">"
);
}
else
{
/* anything else... hexdump */
const
u8
*
s
;
printf
(
"["
);
for
(
j
=
0
,
s
=
data
;
j
<
len
;
j
++
)
printf
(
"%02x%s"
,
s
[
j
],
j
<
len
-
1
?
" "
:
""
);
printf
(
"]"
);
break
;
}
}
...
...
@@ -771,7 +768,7 @@ static int fdt_print(const char *pathp, char *prop, int depth)
/********************************************************************/
U_BOOT_CMD
(
fdt
,
5
,
0
,
do_fdt
,
fdt
,
25
5
,
0
,
do_fdt
,
"fdt - flattened device tree utility commands
\n
"
,
"addr <addr> [<length>] - Set the fdt location to <addr>
\n
"
#ifdef CONFIG_OF_BOARD_SETUP
...
...
This diff is collapsed.
Click to expand it.
common/ft_build.c
+
0
−
113
View file @
aeff6d50
...
...
@@ -399,72 +399,12 @@ void *ft_get_prop(void *bphp, const char *propname, int *szp)
/* Function that returns a character from the environment */
extern
uchar
(
*
env_get_char
)
(
int
);
#define BDM(x) { .name = #x, .offset = offsetof(bd_t, bi_ ##x ) }
#ifdef CONFIG_OF_HAS_BD_T
static
const
struct
{
const
char
*
name
;
int
offset
;
}
bd_map
[]
=
{
BDM
(
memstart
),
BDM
(
memsize
),
BDM
(
flashstart
),
BDM
(
flashsize
),
BDM
(
flashoffset
),
BDM
(
sramstart
),
BDM
(
sramsize
),
#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260) \
|| defined(CONFIG_E500)
BDM
(
immr_base
),
#endif
#if defined(CONFIG_MPC5xxx)
BDM
(
mbar_base
),
#endif
#if defined(CONFIG_MPC83XX)
BDM
(
immrbar
),
#endif
#if defined(CONFIG_MPC8220)
BDM
(
mbar_base
),
BDM
(
inpfreq
),
BDM
(
pcifreq
),
BDM
(
pevfreq
),
BDM
(
flbfreq
),
BDM
(
vcofreq
),
#endif
BDM
(
bootflags
),
BDM
(
ip_addr
),
BDM
(
intfreq
),
BDM
(
busfreq
),
#ifdef CONFIG_CPM2
BDM
(
cpmfreq
),
BDM
(
brgfreq
),
BDM
(
sccfreq
),
BDM
(
vco
),
#endif
#if defined(CONFIG_MPC5xxx)
BDM
(
ipbfreq
),
BDM
(
pcifreq
),
#endif
BDM
(
baudrate
),
};
#endif
void
ft_setup
(
void
*
blob
,
bd_t
*
bd
,
ulong
initrd_start
,
ulong
initrd_end
)
{
u32
*
p
;
int
len
;
struct
ft_cxt
cxt
;
ulong
clock
;
#if defined(CONFIG_OF_HAS_UBOOT_ENV)
int
k
,
nxt
;
#endif
#if defined(CONFIG_OF_HAS_BD_T)
u8
*
end
;
#endif
#if defined(CONFIG_OF_HAS_UBOOT_ENV) || defined(CONFIG_OF_HAS_BD_T)
int
i
;
static
char
tmpenv
[
256
];
#endif
/* disable OF tree; booting old kernel */
if
(
getenv
(
"disable_of"
)
!=
NULL
)
{
...
...
@@ -485,30 +425,6 @@ void ft_setup(void *blob, bd_t * bd, ulong initrd_start, ulong initrd_end)
/* back into root */
ft_backtrack_node
(
&
cxt
);
#ifdef CONFIG_OF_HAS_UBOOT_ENV
ft_begin_node
(
&
cxt
,
"u-boot-env"
);
for
(
i
=
0
;
env_get_char
(
i
)
!=
'\0'
;
i
=
nxt
+
1
)
{
char
*
s
,
*
lval
,
*
rval
;
for
(
nxt
=
i
;
env_get_char
(
nxt
)
!=
'\0'
;
++
nxt
)
;
s
=
tmpenv
;
for
(
k
=
i
;
k
<
nxt
&&
s
<
&
tmpenv
[
sizeof
(
tmpenv
)
-
1
];
++
k
)
*
s
++
=
env_get_char
(
k
);
*
s
++
=
'\0'
;
lval
=
tmpenv
;
s
=
strchr
(
tmpenv
,
'='
);
if
(
s
!=
NULL
)
{
*
s
++
=
'\0'
;
rval
=
s
;
}
else
continue
;
ft_prop_str
(
&
cxt
,
lval
,
rval
);
}
ft_end_node
(
&
cxt
);
#endif
ft_begin_node
(
&
cxt
,
"chosen"
);
ft_prop_str
(
&
cxt
,
"name"
,
"chosen"
);
...
...
@@ -529,36 +445,7 @@ void ft_setup(void *blob, bd_t * bd, ulong initrd_start, ulong initrd_end)
ft_end_tree
(
&
cxt
);
ft_finalize_tree
(
&
cxt
);
#ifdef CONFIG_OF_HAS_BD_T
/* paste the bd_t at the end of the flat tree */
end
=
(
char
*
)
blob
+
be32_to_cpu
(((
struct
boot_param_header
*
)
blob
)
->
totalsize
);
memcpy
(
end
,
bd
,
sizeof
(
*
bd
));
#endif
#ifdef CONFIG_PPC
#ifdef CONFIG_OF_HAS_BD_T
for
(
i
=
0
;
i
<
sizeof
(
bd_map
)
/
sizeof
(
bd_map
[
0
]);
i
++
)
{
uint32_t
v
;
sprintf
(
tmpenv
,
"/bd_t/%s"
,
bd_map
[
i
].
name
);
v
=
*
(
uint32_t
*
)((
char
*
)
bd
+
bd_map
[
i
].
offset
);
p
=
ft_get_prop
(
blob
,
tmpenv
,
&
len
);
if
(
p
!=
NULL
)
*
p
=
cpu_to_be32
(
v
);
}
p
=
ft_get_prop
(
blob
,
"/bd_t/enetaddr"
,
&
len
);
if
(
p
!=
NULL
)
memcpy
(
p
,
bd
->
bi_enetaddr
,
6
);
p
=
ft_get_prop
(
blob
,
"/bd_t/ethspeed"
,
&
len
);
if
(
p
!=
NULL
)
*
p
=
cpu_to_be32
((
uint32_t
)
bd
->
bi_ethspeed
);
#endif
clock
=
bd
->
bi_intfreq
;
p
=
ft_get_prop
(
blob
,
"/cpus/"
OF_CPU
"/clock-frequency"
,
&
len
);
if
(
p
!=
NULL
)
...
...
This diff is collapsed.
Click to expand it.
cpu/mpc8xx/Makefile
+
23
−
10
View file @
aeff6d50
...
...
@@ -27,16 +27,29 @@ include $(TOPDIR)/config.mk
LIB
=
$(
obj
)
lib
$(
CPU
)
.a
START
=
start.o kgdb.o
COBJS
=
bedbug_860.o commproc.o cpu.o cpu_init.o
\
fec.o fdt.o i2c.o interrupts.o lcd.o scc.o
\
serial.o speed.o spi.o
\
traps.o upatch.o video.o
SOBJS
=
plprcr_write.o
SRCS
:=
$(
START:.o
=
.S
)
$(
SOBJS:.o
=
.S
)
$(
COBJS:.o
=
.c
)
OBJS
:=
$(
addprefix
$(
obj
)
,
$(
SOBJS
)
$(
COBJS
))
START
:=
$(
addprefix
$(
obj
)
,
$(
START
))
START-y
+=
start.o
START-y
+=
kgdb.o
COBJS-y
+=
bedbug_860.o
COBJS-y
+=
commproc.o
COBJS-y
+=
cpu.o
COBJS-y
+=
cpu_init.o
COBJS-y
+=
fec.o
COBJS-$(CONFIG_OF_LIBFDT)
+=
fdt.o
COBJS-y
+=
i2c.o
COBJS-y
+=
interrupts.o
COBJS-y
+=
lcd.o
COBJS-y
+=
scc.o
COBJS-y
+=
serial.o
COBJS-y
+=
speed.o
COBJS-y
+=
spi.o
COBJS-y
+=
traps.o
COBJS-y
+=
upatch.o
COBJS-y
+=
video.o
SOBJS-y
+=
plprcr_write.o
SRCS
:=
$(
START-y:.o
=
.S
)
$(
SOBJS-y:.o
=
.S
)
$(
COBJS-y:.o
=
.c
)
OBJS
:=
$(
addprefix
$(
obj
)
,
$(
SOBJS-y
)
$(
COBJS-y
))
START
:=
$(
addprefix
$(
obj
)
,
$(
START-y
))
all
:
$(obj).depend $(START) $(LIB)
...
...
This diff is collapsed.
Click to expand it.
lib_ppc/bootm.c
+
0
−
12
View file @
aeff6d50
...
...
@@ -184,18 +184,6 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
fdt_error
(
"/chosen node create failed"
);
goto
error
;
}
#ifdef CONFIG_OF_HAS_UBOOT_ENV
if
(
fdt_env
(
of_flat_tree
)
<
0
)
{
fdt_error
(
"/u-boot-env node create failed"
);
goto
error
;
}
#endif
#ifdef CONFIG_OF_HAS_BD_T
if
(
fdt_bd_t
(
of_flat_tree
)
<
0
)
{
fdt_error
(
"/bd_t node create failed"
);
goto
error
;
}
#endif
#ifdef CONFIG_OF_BOARD_SETUP
/* Call the board-specific fixup routine */
ft_board_setup
(
of_flat_tree
,
gd
->
bd
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment