diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-13 23:42:16 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:12:44 -0500 |
commit | e77227eb4e17591a6a511b9c0ff6e8ad7350c575 (patch) | |
tree | be8b7f13fd2ff0543879286b04045f6c3587dda3 | |
parent | d5eb4004303b4dd04ec83b926b5fc2d9ceda4b2e (diff) |
[SPARC64]: Probe virtual-devices root node on sun4v.
This is where we learn how to get the interrupts
for things like the hypervisor console device.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc64/kernel/devices.c | 58 | ||||
-rw-r--r-- | include/asm-sparc64/vdev.h | 18 |
2 files changed, 76 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/devices.c b/arch/sparc64/kernel/devices.c index ac11d872ef74..817132826e09 100644 --- a/arch/sparc64/kernel/devices.c +++ b/arch/sparc64/kernel/devices.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/bootmem.h> | ||
15 | 16 | ||
16 | #include <asm/page.h> | 17 | #include <asm/page.h> |
17 | #include <asm/oplib.h> | 18 | #include <asm/oplib.h> |
@@ -20,6 +21,7 @@ | |||
20 | #include <asm/spitfire.h> | 21 | #include <asm/spitfire.h> |
21 | #include <asm/timer.h> | 22 | #include <asm/timer.h> |
22 | #include <asm/cpudata.h> | 23 | #include <asm/cpudata.h> |
24 | #include <asm/vdev.h> | ||
23 | 25 | ||
24 | /* Used to synchronize acceses to NatSemi SUPER I/O chip configure | 26 | /* Used to synchronize acceses to NatSemi SUPER I/O chip configure |
25 | * operations in asm/ns87303.h | 27 | * operations in asm/ns87303.h |
@@ -29,6 +31,61 @@ DEFINE_SPINLOCK(ns87303_lock); | |||
29 | extern void cpu_probe(void); | 31 | extern void cpu_probe(void); |
30 | extern void central_probe(void); | 32 | extern void central_probe(void); |
31 | 33 | ||
34 | u32 sun4v_vdev_devhandle; | ||
35 | int sun4v_vdev_root; | ||
36 | struct linux_prom_pci_intmap *sun4v_vdev_intmap; | ||
37 | int sun4v_vdev_num_intmap; | ||
38 | struct linux_prom_pci_intmap sun4v_vdev_intmask; | ||
39 | |||
40 | static void __init sun4v_virtual_device_probe(void) | ||
41 | { | ||
42 | struct linux_prom64_registers regs; | ||
43 | struct linux_prom_pci_intmap *ip; | ||
44 | int node, sz, err; | ||
45 | |||
46 | if (tlb_type != hypervisor) | ||
47 | return; | ||
48 | |||
49 | node = prom_getchild(prom_root_node); | ||
50 | node = prom_searchsiblings(node, "virtual-devices"); | ||
51 | if (!node) { | ||
52 | prom_printf("SUN4V: Fatal error, no virtual-devices node.\n"); | ||
53 | prom_halt(); | ||
54 | } | ||
55 | |||
56 | sun4v_vdev_root = node; | ||
57 | |||
58 | prom_getproperty(node, "reg", (char *)®s, sizeof(regs)); | ||
59 | sun4v_vdev_devhandle = (regs.phys_addr >> 32UL) & 0x0fffffff; | ||
60 | |||
61 | sz = sizeof(*ip) * 64; | ||
62 | sun4v_vdev_intmap = ip = alloc_bootmem_low_pages(sz); | ||
63 | if (!sun4v_vdev_intmap) { | ||
64 | prom_printf("SUN4V: Error, cannot allocate vdev intmap.\n"); | ||
65 | prom_halt(); | ||
66 | } | ||
67 | |||
68 | err = prom_getproperty(node, "interrupt-map", (char *) ip, sz); | ||
69 | if (err == -1) { | ||
70 | prom_printf("SUN4V: Fatal error, no vdev interrupt-map.\n"); | ||
71 | prom_halt(); | ||
72 | } | ||
73 | |||
74 | sun4v_vdev_num_intmap = err / sizeof(*ip); | ||
75 | |||
76 | err = prom_getproperty(node, "interrupt-map-mask", | ||
77 | (char *) &sun4v_vdev_intmask, | ||
78 | sizeof(sun4v_vdev_intmask)); | ||
79 | if (err == -1) { | ||
80 | prom_printf("SUN4V: Fatal error, no vdev " | ||
81 | "interrupt-map-mask.\n"); | ||
82 | prom_halt(); | ||
83 | } | ||
84 | |||
85 | printk("SUN4V: virtual-devices devhandle[%x]\n", | ||
86 | sun4v_vdev_devhandle); | ||
87 | } | ||
88 | |||
32 | static const char *cpu_mid_prop(void) | 89 | static const char *cpu_mid_prop(void) |
33 | { | 90 | { |
34 | if (tlb_type == spitfire) | 91 | if (tlb_type == spitfire) |
@@ -177,6 +234,7 @@ void __init device_scan(void) | |||
177 | } | 234 | } |
178 | #endif | 235 | #endif |
179 | 236 | ||
237 | sun4v_virtual_device_probe(); | ||
180 | central_probe(); | 238 | central_probe(); |
181 | 239 | ||
182 | cpu_probe(); | 240 | cpu_probe(); |
diff --git a/include/asm-sparc64/vdev.h b/include/asm-sparc64/vdev.h new file mode 100644 index 000000000000..ebaac41a6e1a --- /dev/null +++ b/include/asm-sparc64/vdev.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* vdev.h: SUN4V virtual device interfaces and defines. | ||
2 | * | ||
3 | * Copyright (C) 2006 David S. Miller <davem@davemloft.net> | ||
4 | */ | ||
5 | |||
6 | #ifndef _SPARC64_VDEV_H | ||
7 | #define _SPARC64_VDEV_H | ||
8 | |||
9 | #include <linux/types.h> | ||
10 | #include <asm/oplib.h> | ||
11 | |||
12 | extern u32 sun4v_vdev_devhandle; | ||
13 | extern int sun4v_vdev_root; | ||
14 | extern struct linux_prom_pci_intmap *sun4v_vdev_intmap; | ||
15 | extern int sun4v_vdev_num_intmap; | ||
16 | extern struct linux_prom_pci_intmap sun4v_vdev_intmask; | ||
17 | |||
18 | #endif /* !(_SPARC64_VDEV_H) */ | ||