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
6760d28b
Commit
6760d28b
authored
Jun 21, 2006
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64]: Convert sun4v virtual-device layer to in-kernel PROM device tree.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
27cc64c7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
88 deletions
+56
-88
arch/sparc64/kernel/devices.c
arch/sparc64/kernel/devices.c
+35
-69
drivers/serial/sunhv.c
drivers/serial/sunhv.c
+18
-17
include/asm-sparc64/vdev.h
include/asm-sparc64/vdev.h
+3
-2
No files found.
arch/sparc64/kernel/devices.c
View file @
6760d28b
...
@@ -33,7 +33,7 @@ extern void cpu_probe(void);
...
@@ -33,7 +33,7 @@ extern void cpu_probe(void);
extern
void
central_probe
(
void
);
extern
void
central_probe
(
void
);
u32
sun4v_vdev_devhandle
;
u32
sun4v_vdev_devhandle
;
int
sun4v_vdev_root
;
struct
device_node
*
sun4v_vdev_root
;
struct
vdev_intmap
{
struct
vdev_intmap
{
unsigned
int
phys
;
unsigned
int
phys
;
...
@@ -50,102 +50,68 @@ struct vdev_intmask {
...
@@ -50,102 +50,68 @@ struct vdev_intmask {
static
struct
vdev_intmap
*
vdev_intmap
;
static
struct
vdev_intmap
*
vdev_intmap
;
static
int
vdev_num_intmap
;
static
int
vdev_num_intmap
;
static
struct
vdev_intmask
vdev_intmask
;
static
struct
vdev_intmask
*
vdev_intmask
;
static
void
__init
sun4v_virtual_device_probe
(
void
)
static
void
__init
sun4v_virtual_device_probe
(
void
)
{
{
struct
linux_prom64_registers
regs
;
struct
linux_prom64_registers
*
regs
;
struct
vdev_intmap
*
ip
;
struct
property
*
prop
;
int
node
,
sz
,
err
;
struct
device_node
*
dp
;
int
sz
;
if
(
tlb_type
!=
hypervisor
)
if
(
tlb_type
!=
hypervisor
)
return
;
return
;
node
=
prom_getchild
(
prom_root_node
);
dp
=
of_find_node_by_name
(
NULL
,
"virtual-devices"
);
node
=
prom_searchsiblings
(
node
,
"virtual-devices"
);
if
(
!
dp
)
{
if
(
!
node
)
{
prom_printf
(
"SUN4V: Fatal error, no virtual-devices node.
\n
"
);
prom_printf
(
"SUN4V: Fatal error, no virtual-devices node.
\n
"
);
prom_halt
();
prom_halt
();
}
}
sun4v_vdev_root
=
node
;
sun4v_vdev_root
=
dp
;
prom_getproperty
(
node
,
"reg"
,
(
char
*
)
&
regs
,
sizeof
(
regs
));
prop
=
of_find_property
(
dp
,
"reg"
,
NULL
);
sun4v_vdev_devhandle
=
(
regs
.
phys_addr
>>
32UL
)
&
0x0fffffff
;
regs
=
prop
->
value
;
sun4v_vdev_devhandle
=
(
regs
[
0
].
phys_addr
>>
32UL
)
&
0x0fffffff
;
sz
=
prom_getproplen
(
node
,
"interrupt-map"
);
prop
=
of_find_property
(
dp
,
"interrupt-map"
,
&
sz
);
if
(
sz
<=
0
)
{
vdev_intmap
=
prop
->
value
;
prom_printf
(
"SUN4V: Error, no vdev interrupt-map.
\n
"
);
vdev_num_intmap
=
sz
/
sizeof
(
struct
vdev_intmap
);
prom_halt
();
}
if
((
sz
%
sizeof
(
*
ip
))
!=
0
)
{
prom_printf
(
"SUN4V: Bogus interrupt-map property size %d
\n
"
,
sz
);
prom_halt
();
}
vdev_intmap
=
ip
=
alloc_bootmem_low_pages
(
sz
);
if
(
!
vdev_intmap
)
{
prom_printf
(
"SUN4V: Error, cannot allocate vdev_intmap.
\n
"
);
prom_halt
();
}
err
=
prom_getproperty
(
node
,
"interrupt-map"
,
(
char
*
)
ip
,
sz
);
if
(
err
==
-
1
)
{
prom_printf
(
"SUN4V: Fatal error, no vdev interrupt-map.
\n
"
);
prom_halt
();
}
if
(
err
!=
sz
)
{
prom_printf
(
"SUN4V: Inconsistent interrupt-map size, "
"proplen(%d) vs getprop(%d).
\n
"
,
sz
,
err
);
prom_halt
();
}
vdev_num_intmap
=
err
/
sizeof
(
*
ip
);
err
=
prom_getproperty
(
node
,
"interrupt-map-mask"
,
prop
=
of_find_property
(
dp
,
"interrupt-map-mask"
,
NULL
);
(
char
*
)
&
vdev_intmask
,
vdev_intmask
=
prop
->
value
;
sizeof
(
vdev_intmask
));
if
(
err
<=
0
)
{
prom_printf
(
"SUN4V: Fatal error, no vdev "
"interrupt-map-mask.
\n
"
);
prom_halt
();
}
if
(
err
%
sizeof
(
vdev_intmask
))
{
prom_printf
(
"SUN4V: Bogus interrupt-map-mask "
"property size %d
\n
"
,
err
);
prom_halt
();
}
printk
(
"
SUN4V: virtual-device
s devhandle[%x]
\n
"
,
printk
(
"
%s: Virtual Device Bu
s devhandle[%x]
\n
"
,
sun4v_vdev_devhandle
);
dp
->
full_name
,
sun4v_vdev_devhandle
);
}
}
unsigned
int
sun4v_vdev_device_interrupt
(
unsigned
int
dev_node
)
unsigned
int
sun4v_vdev_device_interrupt
(
struct
device_node
*
dev_node
)
{
{
struct
property
*
prop
;
unsigned
int
irq
,
reg
;
unsigned
int
irq
,
reg
;
int
err
,
i
;
int
i
;
err
=
prom_getproperty
(
dev_node
,
"interrupts"
,
prop
=
of_find_property
(
dev_node
,
"interrupts"
,
NULL
);
(
char
*
)
&
irq
,
sizeof
(
irq
));
if
(
!
prop
)
{
if
(
err
<=
0
)
{
printk
(
"VDEV: Cannot get
\"
interrupts
\"
"
printk
(
"VDEV: Cannot get
\"
interrupts
\"
"
"property for OBP node %x
\n
"
,
dev_node
);
"property for OBP node %s
\n
"
,
dev_node
->
full_name
);
return
0
;
return
0
;
}
}
irq
=
*
(
unsigned
int
*
)
prop
->
value
;
err
=
prom_getproperty
(
dev_node
,
"reg"
,
prop
=
of_find_property
(
dev_node
,
"reg"
,
NULL
);
(
char
*
)
&
reg
,
sizeof
(
reg
));
if
(
!
prop
)
{
if
(
err
<=
0
)
{
printk
(
"VDEV: Cannot get
\"
reg
\"
"
printk
(
"VDEV: Cannot get
\"
reg
\"
"
"property for OBP node %x
\n
"
,
dev_node
);
"property for OBP node %s
\n
"
,
dev_node
->
full_name
);
return
0
;
return
0
;
}
}
reg
=
*
(
unsigned
int
*
)
prop
->
value
;
for
(
i
=
0
;
i
<
vdev_num_intmap
;
i
++
)
{
for
(
i
=
0
;
i
<
vdev_num_intmap
;
i
++
)
{
if
(
vdev_intmap
[
i
].
phys
==
(
reg
&
vdev_intmask
.
phys
)
&&
if
(
vdev_intmap
[
i
].
phys
==
(
reg
&
vdev_intmask
->
phys
)
&&
vdev_intmap
[
i
].
irq
==
(
irq
&
vdev_intmask
.
interrupt
))
{
vdev_intmap
[
i
].
irq
==
(
irq
&
vdev_intmask
->
interrupt
))
{
irq
=
vdev_intmap
[
i
].
cinterrupt
;
irq
=
vdev_intmap
[
i
].
cinterrupt
;
break
;
break
;
}
}
...
@@ -153,7 +119,7 @@ unsigned int sun4v_vdev_device_interrupt(unsigned int dev_node)
...
@@ -153,7 +119,7 @@ unsigned int sun4v_vdev_device_interrupt(unsigned int dev_node)
if
(
i
==
vdev_num_intmap
)
{
if
(
i
==
vdev_num_intmap
)
{
printk
(
"VDEV: No matching interrupt map entry "
printk
(
"VDEV: No matching interrupt map entry "
"for OBP node %
x
\n
"
,
dev_nod
e
);
"for OBP node %
s
\n
"
,
dev_node
->
full_nam
e
);
return
0
;
return
0
;
}
}
...
...
drivers/serial/sunhv.c
View file @
6760d28b
...
@@ -427,31 +427,32 @@ static int __init hv_console_compatible(char *buf, int len)
...
@@ -427,31 +427,32 @@ static int __init hv_console_compatible(char *buf, int len)
static
unsigned
int
__init
get_interrupt
(
void
)
static
unsigned
int
__init
get_interrupt
(
void
)
{
{
const
char
*
cons_str
=
"console"
;
struct
device_node
*
dev_node
;
const
char
*
compat_str
=
"compatible"
;
int
node
=
prom_getchild
(
sun4v_vdev_root
);
char
buf
[
64
];
int
err
,
len
;
node
=
prom_searchsiblings
(
node
,
cons_str
);
if
(
!
node
)
return
0
;
len
=
prom_getproplen
(
node
,
compat_str
)
;
dev_node
=
sun4v_vdev_root
->
child
;
if
(
len
==
0
||
len
==
-
1
)
while
(
dev_node
!=
NULL
)
{
return
0
;
struct
property
*
prop
;
err
=
prom_getproperty
(
node
,
compat_str
,
buf
,
64
);
if
(
strcmp
(
dev_node
->
name
,
"console"
))
if
(
err
==
-
1
)
goto
next_sibling
;
return
0
;
prop
=
of_find_property
(
dev_node
,
"compatible"
,
NULL
);
if
(
!
prop
)
goto
next_sibling
;
if
(
!
hv_console_compatible
(
buf
,
len
))
if
(
hv_console_compatible
(
prop
->
value
,
prop
->
length
))
break
;
next_sibling:
dev_node
=
dev_node
->
sibling
;
}
if
(
!
dev_node
)
return
0
;
return
0
;
/* Ok, the this is the OBP node for the sun4v hypervisor
/* Ok, the this is the OBP node for the sun4v hypervisor
* console device. Decode the interrupt.
* console device. Decode the interrupt.
*/
*/
return
sun4v_vdev_device_interrupt
(
node
);
return
sun4v_vdev_device_interrupt
(
dev_
node
);
}
}
static
int
__init
sunhv_init
(
void
)
static
int
__init
sunhv_init
(
void
)
...
...
include/asm-sparc64/vdev.h
View file @
6760d28b
...
@@ -7,10 +7,11 @@
...
@@ -7,10 +7,11 @@
#define _SPARC64_VDEV_H
#define _SPARC64_VDEV_H
#include <linux/types.h>
#include <linux/types.h>
#include <asm/prom.h>
extern
u32
sun4v_vdev_devhandle
;
extern
u32
sun4v_vdev_devhandle
;
extern
int
sun4v_vdev_root
;
extern
struct
device_node
*
sun4v_vdev_root
;
extern
unsigned
int
sun4v_vdev_device_interrupt
(
unsigned
int
);
extern
unsigned
int
sun4v_vdev_device_interrupt
(
struct
device_node
*
dev_node
);
#endif
/* !(_SPARC64_VDEV_H) */
#endif
/* !(_SPARC64_VDEV_H) */
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