Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
87b385da
Commit
87b385da
authored
Jun 25, 2006
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC]: Add unique device_node IDs and a ".node" property.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
fb7cd9d9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
36 deletions
+75
-36
arch/sparc/kernel/prom.c
arch/sparc/kernel/prom.c
+35
-18
arch/sparc64/kernel/prom.c
arch/sparc64/kernel/prom.c
+36
-18
include/asm-sparc/prom.h
include/asm-sparc/prom.h
+2
-0
include/asm-sparc64/prom.h
include/asm-sparc64/prom.h
+2
-0
No files found.
arch/sparc/kernel/prom.c
View file @
87b385da
...
@@ -407,7 +407,9 @@ static char * __init build_full_name(struct device_node *dp)
...
@@ -407,7 +407,9 @@ static char * __init build_full_name(struct device_node *dp)
return
n
;
return
n
;
}
}
static
struct
property
*
__init
build_one_prop
(
phandle
node
,
char
*
prev
)
static
unsigned
int
unique_id
;
static
struct
property
*
__init
build_one_prop
(
phandle
node
,
char
*
prev
,
char
*
special_name
,
void
*
special_val
,
int
special_len
)
{
{
static
struct
property
*
tmp
=
NULL
;
static
struct
property
*
tmp
=
NULL
;
struct
property
*
p
;
struct
property
*
p
;
...
@@ -417,10 +419,17 @@ static struct property * __init build_one_prop(phandle node, char *prev)
...
@@ -417,10 +419,17 @@ static struct property * __init build_one_prop(phandle node, char *prev)
p
=
tmp
;
p
=
tmp
;
memset
(
p
,
0
,
sizeof
(
*
p
)
+
32
);
memset
(
p
,
0
,
sizeof
(
*
p
)
+
32
);
tmp
=
NULL
;
tmp
=
NULL
;
}
else
}
else
{
p
=
prom_early_alloc
(
sizeof
(
struct
property
)
+
32
);
p
=
prom_early_alloc
(
sizeof
(
struct
property
)
+
32
);
p
->
unique_id
=
unique_id
++
;
}
p
->
name
=
(
char
*
)
(
p
+
1
);
p
->
name
=
(
char
*
)
(
p
+
1
);
if
(
special_name
)
{
p
->
length
=
special_len
;
p
->
value
=
prom_early_alloc
(
special_len
);
memcpy
(
p
->
value
,
special_val
,
special_len
);
}
else
{
if
(
prev
==
NULL
)
{
if
(
prev
==
NULL
)
{
prom_firstprop
(
node
,
p
->
name
);
prom_firstprop
(
node
,
p
->
name
);
}
else
{
}
else
{
...
@@ -434,8 +443,10 @@ static struct property * __init build_one_prop(phandle node, char *prev)
...
@@ -434,8 +443,10 @@ static struct property * __init build_one_prop(phandle node, char *prev)
if
(
p
->
length
<=
0
)
{
if
(
p
->
length
<=
0
)
{
p
->
length
=
0
;
p
->
length
=
0
;
}
else
{
}
else
{
p
->
value
=
prom_early_alloc
(
p
->
length
);
p
->
value
=
prom_early_alloc
(
p
->
length
+
1
);
len
=
prom_getproperty
(
node
,
p
->
name
,
p
->
value
,
p
->
length
);
prom_getproperty
(
node
,
p
->
name
,
p
->
value
,
p
->
length
);
((
unsigned
char
*
)
p
->
value
)[
p
->
length
]
=
'\0'
;
}
}
}
return
p
;
return
p
;
}
}
...
@@ -444,9 +455,14 @@ static struct property * __init build_prop_list(phandle node)
...
@@ -444,9 +455,14 @@ static struct property * __init build_prop_list(phandle node)
{
{
struct
property
*
head
,
*
tail
;
struct
property
*
head
,
*
tail
;
head
=
tail
=
build_one_prop
(
node
,
NULL
);
head
=
tail
=
build_one_prop
(
node
,
NULL
,
".node"
,
&
node
,
sizeof
(
node
));
tail
->
next
=
build_one_prop
(
node
,
NULL
,
NULL
,
NULL
,
0
);
tail
=
tail
->
next
;
while
(
tail
)
{
while
(
tail
)
{
tail
->
next
=
build_one_prop
(
node
,
tail
->
name
);
tail
->
next
=
build_one_prop
(
node
,
tail
->
name
,
NULL
,
NULL
,
0
);
tail
=
tail
->
next
;
tail
=
tail
->
next
;
}
}
...
@@ -475,6 +491,7 @@ static struct device_node * __init create_node(phandle node)
...
@@ -475,6 +491,7 @@ static struct device_node * __init create_node(phandle node)
return
NULL
;
return
NULL
;
dp
=
prom_early_alloc
(
sizeof
(
*
dp
));
dp
=
prom_early_alloc
(
sizeof
(
*
dp
));
dp
->
unique_id
=
unique_id
++
;
kref_init
(
&
dp
->
kref
);
kref_init
(
&
dp
->
kref
);
...
...
arch/sparc64/kernel/prom.c
View file @
87b385da
...
@@ -584,7 +584,9 @@ static char * __init build_full_name(struct device_node *dp)
...
@@ -584,7 +584,9 @@ static char * __init build_full_name(struct device_node *dp)
return
n
;
return
n
;
}
}
static
struct
property
*
__init
build_one_prop
(
phandle
node
,
char
*
prev
)
static
unsigned
int
unique_id
;
static
struct
property
*
__init
build_one_prop
(
phandle
node
,
char
*
prev
,
char
*
special_name
,
void
*
special_val
,
int
special_len
)
{
{
static
struct
property
*
tmp
=
NULL
;
static
struct
property
*
tmp
=
NULL
;
struct
property
*
p
;
struct
property
*
p
;
...
@@ -593,10 +595,18 @@ static struct property * __init build_one_prop(phandle node, char *prev)
...
@@ -593,10 +595,18 @@ static struct property * __init build_one_prop(phandle node, char *prev)
p
=
tmp
;
p
=
tmp
;
memset
(
p
,
0
,
sizeof
(
*
p
)
+
32
);
memset
(
p
,
0
,
sizeof
(
*
p
)
+
32
);
tmp
=
NULL
;
tmp
=
NULL
;
}
else
}
else
{
p
=
prom_early_alloc
(
sizeof
(
struct
property
)
+
32
);
p
=
prom_early_alloc
(
sizeof
(
struct
property
)
+
32
);
p
->
unique_id
=
unique_id
++
;
}
p
->
name
=
(
char
*
)
(
p
+
1
);
p
->
name
=
(
char
*
)
(
p
+
1
);
if
(
special_name
)
{
strcpy
(
p
->
name
,
special_name
);
p
->
length
=
special_len
;
p
->
value
=
prom_early_alloc
(
special_len
);
memcpy
(
p
->
value
,
special_val
,
special_len
);
}
else
{
if
(
prev
==
NULL
)
{
if
(
prev
==
NULL
)
{
prom_firstprop
(
node
,
p
->
name
);
prom_firstprop
(
node
,
p
->
name
);
}
else
{
}
else
{
...
@@ -610,8 +620,10 @@ static struct property * __init build_one_prop(phandle node, char *prev)
...
@@ -610,8 +620,10 @@ static struct property * __init build_one_prop(phandle node, char *prev)
if
(
p
->
length
<=
0
)
{
if
(
p
->
length
<=
0
)
{
p
->
length
=
0
;
p
->
length
=
0
;
}
else
{
}
else
{
p
->
value
=
prom_early_alloc
(
p
->
length
);
p
->
value
=
prom_early_alloc
(
p
->
length
+
1
);
prom_getproperty
(
node
,
p
->
name
,
p
->
value
,
p
->
length
);
prom_getproperty
(
node
,
p
->
name
,
p
->
value
,
p
->
length
);
((
unsigned
char
*
)
p
->
value
)[
p
->
length
]
=
'\0'
;
}
}
}
return
p
;
return
p
;
}
}
...
@@ -620,9 +632,14 @@ static struct property * __init build_prop_list(phandle node)
...
@@ -620,9 +632,14 @@ static struct property * __init build_prop_list(phandle node)
{
{
struct
property
*
head
,
*
tail
;
struct
property
*
head
,
*
tail
;
head
=
tail
=
build_one_prop
(
node
,
NULL
);
head
=
tail
=
build_one_prop
(
node
,
NULL
,
".node"
,
&
node
,
sizeof
(
node
));
tail
->
next
=
build_one_prop
(
node
,
NULL
,
NULL
,
NULL
,
0
);
tail
=
tail
->
next
;
while
(
tail
)
{
while
(
tail
)
{
tail
->
next
=
build_one_prop
(
node
,
tail
->
name
);
tail
->
next
=
build_one_prop
(
node
,
tail
->
name
,
NULL
,
NULL
,
0
);
tail
=
tail
->
next
;
tail
=
tail
->
next
;
}
}
...
@@ -651,6 +668,7 @@ static struct device_node * __init create_node(phandle node)
...
@@ -651,6 +668,7 @@ static struct device_node * __init create_node(phandle node)
return
NULL
;
return
NULL
;
dp
=
prom_early_alloc
(
sizeof
(
*
dp
));
dp
=
prom_early_alloc
(
sizeof
(
*
dp
));
dp
->
unique_id
=
unique_id
++
;
kref_init
(
&
dp
->
kref
);
kref_init
(
&
dp
->
kref
);
...
...
include/asm-sparc/prom.h
View file @
87b385da
...
@@ -36,6 +36,7 @@ struct property {
...
@@ -36,6 +36,7 @@ struct property {
void
*
value
;
void
*
value
;
struct
property
*
next
;
struct
property
*
next
;
unsigned
long
_flags
;
unsigned
long
_flags
;
unsigned
int
unique_id
;
};
};
struct
device_node
{
struct
device_node
{
...
@@ -59,6 +60,7 @@ struct device_node {
...
@@ -59,6 +60,7 @@ struct device_node {
struct
kref
kref
;
struct
kref
kref
;
unsigned
long
_flags
;
unsigned
long
_flags
;
void
*
data
;
void
*
data
;
unsigned
int
unique_id
;
};
};
/* flag descriptions */
/* flag descriptions */
...
...
include/asm-sparc64/prom.h
View file @
87b385da
...
@@ -36,6 +36,7 @@ struct property {
...
@@ -36,6 +36,7 @@ struct property {
void
*
value
;
void
*
value
;
struct
property
*
next
;
struct
property
*
next
;
unsigned
long
_flags
;
unsigned
long
_flags
;
unsigned
int
unique_id
;
};
};
struct
device_node
{
struct
device_node
{
...
@@ -59,6 +60,7 @@ struct device_node {
...
@@ -59,6 +60,7 @@ struct device_node {
struct
kref
kref
;
struct
kref
kref
;
unsigned
long
_flags
;
unsigned
long
_flags
;
void
*
data
;
void
*
data
;
unsigned
int
unique_id
;
};
};
/* flag descriptions */
/* flag descriptions */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment