diff options
| author | David S. Miller <davem@sunset.davemloft.net> | 2006-06-30 03:07:40 -0400 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-30 17:13:41 -0400 |
| commit | 6e990b50ed0b45d506ff6809034508d3e210497d (patch) | |
| tree | 167fd890356b2c55b9f60c4940a8325d1daa42b5 | |
| parent | 93872ba21d1087cde1d5f9603f3265c1c54d471c (diff) | |
[SPARC64]: Kill sun4v virtual device layer.
Replace with a simple IRQ translater in the PROM
device tree builder.
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | arch/sparc64/kernel/devices.c | 97 | ||||
| -rw-r--r-- | arch/sparc64/kernel/prom.c | 23 | ||||
| -rw-r--r-- | include/asm-sparc64/vdev.h | 17 |
3 files changed, 23 insertions, 114 deletions
diff --git a/arch/sparc64/kernel/devices.c b/arch/sparc64/kernel/devices.c index 389301c95cb2..26adb64ddb34 100644 --- a/arch/sparc64/kernel/devices.c +++ b/arch/sparc64/kernel/devices.c | |||
| @@ -21,8 +21,6 @@ | |||
| 21 | #include <asm/spitfire.h> | 21 | #include <asm/spitfire.h> |
| 22 | #include <asm/timer.h> | 22 | #include <asm/timer.h> |
| 23 | #include <asm/cpudata.h> | 23 | #include <asm/cpudata.h> |
| 24 | #include <asm/vdev.h> | ||
| 25 | #include <asm/irq.h> | ||
| 26 | 24 | ||
| 27 | /* Used to synchronize acceses to NatSemi SUPER I/O chip configure | 25 | /* Used to synchronize acceses to NatSemi SUPER I/O chip configure |
| 28 | * operations in asm/ns87303.h | 26 | * operations in asm/ns87303.h |
| @@ -32,100 +30,6 @@ DEFINE_SPINLOCK(ns87303_lock); | |||
| 32 | extern void cpu_probe(void); | 30 | extern void cpu_probe(void); |
| 33 | extern void central_probe(void); | 31 | extern void central_probe(void); |
| 34 | 32 | ||
| 35 | u32 sun4v_vdev_devhandle; | ||
| 36 | struct device_node *sun4v_vdev_root; | ||
| 37 | |||
| 38 | struct vdev_intmap { | ||
| 39 | unsigned int phys; | ||
| 40 | unsigned int irq; | ||
| 41 | unsigned int cnode; | ||
| 42 | unsigned int cinterrupt; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct vdev_intmask { | ||
| 46 | unsigned int phys; | ||
| 47 | unsigned int interrupt; | ||
| 48 | unsigned int __unused; | ||
| 49 | }; | ||
| 50 | |||
| 51 | static struct vdev_intmap *vdev_intmap; | ||
| 52 | static int vdev_num_intmap; | ||
| 53 | static struct vdev_intmask *vdev_intmask; | ||
| 54 | |||
| 55 | static void __init sun4v_virtual_device_probe(void) | ||
| 56 | { | ||
| 57 | struct linux_prom64_registers *regs; | ||
| 58 | struct property *prop; | ||
| 59 | struct device_node *dp; | ||
| 60 | int sz; | ||
| 61 | |||
| 62 | if (tlb_type != hypervisor) | ||
| 63 | return; | ||
| 64 | |||
| 65 | dp = of_find_node_by_name(NULL, "virtual-devices"); | ||
| 66 | if (!dp) { | ||
| 67 | prom_printf("SUN4V: Fatal error, no virtual-devices node.\n"); | ||
| 68 | prom_halt(); | ||
| 69 | } | ||
| 70 | |||
| 71 | sun4v_vdev_root = dp; | ||
| 72 | |||
| 73 | prop = of_find_property(dp, "reg", NULL); | ||
| 74 | regs = prop->value; | ||
| 75 | sun4v_vdev_devhandle = (regs[0].phys_addr >> 32UL) & 0x0fffffff; | ||
| 76 | |||
| 77 | prop = of_find_property(dp, "interrupt-map", &sz); | ||
| 78 | vdev_intmap = prop->value; | ||
| 79 | vdev_num_intmap = sz / sizeof(struct vdev_intmap); | ||
| 80 | |||
| 81 | prop = of_find_property(dp, "interrupt-map-mask", NULL); | ||
| 82 | vdev_intmask = prop->value; | ||
| 83 | |||
| 84 | printk("%s: Virtual Device Bus devhandle[%x]\n", | ||
| 85 | dp->full_name, sun4v_vdev_devhandle); | ||
| 86 | } | ||
| 87 | |||
| 88 | unsigned int sun4v_vdev_device_interrupt(struct device_node *dev_node) | ||
| 89 | { | ||
| 90 | struct property *prop; | ||
| 91 | unsigned int irq, reg; | ||
| 92 | int i; | ||
| 93 | |||
| 94 | prop = of_find_property(dev_node, "interrupts", NULL); | ||
| 95 | if (!prop) { | ||
| 96 | printk("VDEV: Cannot get \"interrupts\" " | ||
| 97 | "property for OBP node %s\n", | ||
| 98 | dev_node->full_name); | ||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | irq = *(unsigned int *) prop->value; | ||
| 102 | |||
| 103 | prop = of_find_property(dev_node, "reg", NULL); | ||
| 104 | if (!prop) { | ||
| 105 | printk("VDEV: Cannot get \"reg\" " | ||
| 106 | "property for OBP node %s\n", | ||
| 107 | dev_node->full_name); | ||
| 108 | return 0; | ||
| 109 | } | ||
| 110 | reg = *(unsigned int *) prop->value; | ||
| 111 | |||
| 112 | for (i = 0; i < vdev_num_intmap; i++) { | ||
| 113 | if (vdev_intmap[i].phys == (reg & vdev_intmask->phys) && | ||
| 114 | vdev_intmap[i].irq == (irq & vdev_intmask->interrupt)) { | ||
| 115 | irq = vdev_intmap[i].cinterrupt; | ||
| 116 | break; | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | if (i == vdev_num_intmap) { | ||
| 121 | printk("VDEV: No matching interrupt map entry " | ||
| 122 | "for OBP node %s\n", dev_node->full_name); | ||
| 123 | return 0; | ||
| 124 | } | ||
| 125 | |||
| 126 | return sun4v_build_irq(sun4v_vdev_devhandle, irq); | ||
| 127 | } | ||
| 128 | |||
| 129 | static const char *cpu_mid_prop(void) | 33 | static const char *cpu_mid_prop(void) |
| 130 | { | 34 | { |
| 131 | if (tlb_type == spitfire) | 35 | if (tlb_type == spitfire) |
| @@ -290,7 +194,6 @@ void __init device_scan(void) | |||
| 290 | } | 194 | } |
| 291 | #endif | 195 | #endif |
| 292 | 196 | ||
| 293 | sun4v_virtual_device_probe(); | ||
| 294 | central_probe(); | 197 | central_probe(); |
| 295 | 198 | ||
| 296 | cpu_probe(); | 199 | cpu_probe(); |
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index 8a70c52c0447..fa484d4f241e 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c | |||
| @@ -1008,6 +1008,27 @@ static struct irq_trans pci_irq_trans_table[] = { | |||
| 1008 | }; | 1008 | }; |
| 1009 | #endif | 1009 | #endif |
| 1010 | 1010 | ||
| 1011 | static unsigned int sun4v_vdev_irq_build(struct device_node *dp, | ||
| 1012 | unsigned int devino, | ||
| 1013 | void *_data) | ||
| 1014 | { | ||
| 1015 | u32 devhandle = (u32) (unsigned long) _data; | ||
| 1016 | |||
| 1017 | return sun4v_build_irq(devhandle, devino); | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | static void sun4v_vdev_irq_trans_init(struct device_node *dp) | ||
| 1021 | { | ||
| 1022 | struct linux_prom64_registers *regs; | ||
| 1023 | |||
| 1024 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); | ||
| 1025 | dp->irq_trans->irq_build = sun4v_vdev_irq_build; | ||
| 1026 | |||
| 1027 | regs = of_get_property(dp, "reg", NULL); | ||
| 1028 | dp->irq_trans->data = (void *) (unsigned long) | ||
| 1029 | ((regs->phys_addr >> 32UL) & 0x0fffffff); | ||
| 1030 | } | ||
| 1031 | |||
| 1011 | static void irq_trans_init(struct device_node *dp) | 1032 | static void irq_trans_init(struct device_node *dp) |
| 1012 | { | 1033 | { |
| 1013 | const char *model; | 1034 | const char *model; |
| @@ -1034,6 +1055,8 @@ static void irq_trans_init(struct device_node *dp) | |||
| 1034 | #endif | 1055 | #endif |
| 1035 | if (!strcmp(dp->name, "central")) | 1056 | if (!strcmp(dp->name, "central")) |
| 1036 | return central_irq_trans_init(dp->child); | 1057 | return central_irq_trans_init(dp->child); |
| 1058 | if (!strcmp(dp->name, "virtual-devices")) | ||
| 1059 | return sun4v_vdev_irq_trans_init(dp); | ||
| 1037 | } | 1060 | } |
| 1038 | 1061 | ||
| 1039 | static int is_root_node(const struct device_node *dp) | 1062 | static int is_root_node(const struct device_node *dp) |
diff --git a/include/asm-sparc64/vdev.h b/include/asm-sparc64/vdev.h deleted file mode 100644 index 25637c57675d..000000000000 --- a/include/asm-sparc64/vdev.h +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 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/prom.h> | ||
| 11 | |||
| 12 | extern u32 sun4v_vdev_devhandle; | ||
| 13 | extern struct device_node *sun4v_vdev_root; | ||
| 14 | |||
| 15 | extern unsigned int sun4v_vdev_device_interrupt(struct device_node *dev_node); | ||
| 16 | |||
| 17 | #endif /* !(_SPARC64_VDEV_H) */ | ||
