[PATCH] ppc64: split pSeries specific parts out of vio.c

This patch just splits out the pSeries specific parts of vio.c.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Stephen Rothwell and committed by
Paul Mackerras
19dbd0f6 6312236f

+284 -279
+1
arch/ppc64/kernel/Makefile
··· 51 51 obj-$(CONFIG_BOOTX_TEXT) += btext.o 52 52 obj-$(CONFIG_HVCS) += hvcserver.o 53 53 54 + vio-obj-$(CONFIG_PPC_PSERIES) += pSeries_vio.o 54 55 vio-obj-$(CONFIG_PPC_ISERIES) += iSeries_vio.o 55 56 obj-$(CONFIG_IBMVIO) += vio.o $(vio-obj-y) 56 57 obj-$(CONFIG_XICS) += xics.o
+1 -1
arch/ppc64/kernel/iSeries_vio.c
··· 131 131 { 132 132 int err; 133 133 134 - err = vio_bus_init(vio_match_device_iseries); 134 + err = vio_bus_init(vio_match_device_iseries, NULL, NULL); 135 135 if (err == 0) { 136 136 iommu_vio_init(); 137 137 vio_bus_device.iommu_table = &vio_iommu_table;
+266
arch/ppc64/kernel/pSeries_vio.c
··· 1 + /* 2 + * IBM PowerPC pSeries Virtual I/O Infrastructure Support. 3 + * 4 + * Copyright (c) 2003-2005 IBM Corp. 5 + * Dave Engebretsen engebret@us.ibm.com 6 + * Santiago Leon santil@us.ibm.com 7 + * Hollis Blanchard <hollisb@us.ibm.com> 8 + * Stephen Rothwell 9 + * 10 + * This program is free software; you can redistribute it and/or 11 + * modify it under the terms of the GNU General Public License 12 + * as published by the Free Software Foundation; either version 13 + * 2 of the License, or (at your option) any later version. 14 + */ 15 + 16 + #include <linux/init.h> 17 + #include <linux/module.h> 18 + #include <linux/mm.h> 19 + #include <linux/kobject.h> 20 + #include <asm/iommu.h> 21 + #include <asm/dma.h> 22 + #include <asm/vio.h> 23 + #include <asm/hvcall.h> 24 + 25 + extern struct subsystem devices_subsys; /* needed for vio_find_name() */ 26 + 27 + static void probe_bus_pseries(void) 28 + { 29 + struct device_node *node_vroot, *of_node; 30 + 31 + node_vroot = find_devices("vdevice"); 32 + if ((node_vroot == NULL) || (node_vroot->child == NULL)) 33 + /* this machine doesn't do virtual IO, and that's ok */ 34 + return; 35 + 36 + /* 37 + * Create struct vio_devices for each virtual device in the device tree. 38 + * Drivers will associate with them later. 39 + */ 40 + for (of_node = node_vroot->child; of_node != NULL; 41 + of_node = of_node->sibling) { 42 + printk(KERN_DEBUG "%s: processing %p\n", __FUNCTION__, of_node); 43 + vio_register_device_node(of_node); 44 + } 45 + } 46 + 47 + /** 48 + * vio_match_device_pseries: - Tell if a pSeries VIO device matches a 49 + * vio_device_id 50 + */ 51 + static int vio_match_device_pseries(const struct vio_device_id *id, 52 + const struct vio_dev *dev) 53 + { 54 + return (strncmp(dev->type, id->type, strlen(id->type)) == 0) && 55 + device_is_compatible(dev->dev.platform_data, id->compat); 56 + } 57 + 58 + static void vio_release_device_pseries(struct device *dev) 59 + { 60 + /* XXX free TCE table */ 61 + of_node_put(dev->platform_data); 62 + } 63 + 64 + static ssize_t viodev_show_devspec(struct device *dev, 65 + struct device_attribute *attr, char *buf) 66 + { 67 + struct device_node *of_node = dev->platform_data; 68 + 69 + return sprintf(buf, "%s\n", of_node->full_name); 70 + } 71 + DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL); 72 + 73 + static void vio_unregister_device_pseries(struct vio_dev *viodev) 74 + { 75 + device_remove_file(&viodev->dev, &dev_attr_devspec); 76 + } 77 + 78 + /** 79 + * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus 80 + */ 81 + static int __init vio_bus_init_pseries(void) 82 + { 83 + int err; 84 + 85 + err = vio_bus_init(vio_match_device_pseries, 86 + vio_unregister_device_pseries, 87 + vio_release_device_pseries); 88 + if (err == 0) 89 + probe_bus_pseries(); 90 + return err; 91 + } 92 + 93 + __initcall(vio_bus_init_pseries); 94 + 95 + /** 96 + * vio_build_iommu_table: - gets the dma information from OF and 97 + * builds the TCE tree. 98 + * @dev: the virtual device. 99 + * 100 + * Returns a pointer to the built tce tree, or NULL if it can't 101 + * find property. 102 + */ 103 + static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) 104 + { 105 + unsigned int *dma_window; 106 + struct iommu_table *newTceTable; 107 + unsigned long offset; 108 + int dma_window_property_size; 109 + 110 + dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size); 111 + if(!dma_window) { 112 + return NULL; 113 + } 114 + 115 + newTceTable = (struct iommu_table *) kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 116 + 117 + /* There should be some code to extract the phys-encoded offset 118 + using prom_n_addr_cells(). However, according to a comment 119 + on earlier versions, it's always zero, so we don't bother */ 120 + offset = dma_window[1] >> PAGE_SHIFT; 121 + 122 + /* TCE table size - measured in tce entries */ 123 + newTceTable->it_size = dma_window[4] >> PAGE_SHIFT; 124 + /* offset for VIO should always be 0 */ 125 + newTceTable->it_offset = offset; 126 + newTceTable->it_busno = 0; 127 + newTceTable->it_index = (unsigned long)dma_window[0]; 128 + newTceTable->it_type = TCE_VB; 129 + 130 + return iommu_init_table(newTceTable); 131 + } 132 + 133 + /** 134 + * vio_register_device_node: - Register a new vio device. 135 + * @of_node: The OF node for this device. 136 + * 137 + * Creates and initializes a vio_dev structure from the data in 138 + * of_node (dev.platform_data) and adds it to the list of virtual devices. 139 + * Returns a pointer to the created vio_dev or NULL if node has 140 + * NULL device_type or compatible fields. 141 + */ 142 + struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) 143 + { 144 + struct vio_dev *viodev; 145 + unsigned int *unit_address; 146 + unsigned int *irq_p; 147 + 148 + /* we need the 'device_type' property, in order to match with drivers */ 149 + if ((NULL == of_node->type)) { 150 + printk(KERN_WARNING 151 + "%s: node %s missing 'device_type'\n", __FUNCTION__, 152 + of_node->name ? of_node->name : "<unknown>"); 153 + return NULL; 154 + } 155 + 156 + unit_address = (unsigned int *)get_property(of_node, "reg", NULL); 157 + if (!unit_address) { 158 + printk(KERN_WARNING "%s: node %s missing 'reg'\n", __FUNCTION__, 159 + of_node->name ? of_node->name : "<unknown>"); 160 + return NULL; 161 + } 162 + 163 + /* allocate a vio_dev for this node */ 164 + viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); 165 + if (!viodev) { 166 + return NULL; 167 + } 168 + memset(viodev, 0, sizeof(struct vio_dev)); 169 + 170 + viodev->dev.platform_data = of_node_get(of_node); 171 + 172 + viodev->irq = NO_IRQ; 173 + irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL); 174 + if (irq_p) { 175 + int virq = virt_irq_create_mapping(*irq_p); 176 + if (virq == NO_IRQ) { 177 + printk(KERN_ERR "Unable to allocate interrupt " 178 + "number for %s\n", of_node->full_name); 179 + } else 180 + viodev->irq = irq_offset_up(virq); 181 + } 182 + 183 + snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address); 184 + 185 + /* register with generic device framework */ 186 + if (vio_register_device_common(viodev, of_node->name, of_node->type, 187 + *unit_address, vio_build_iommu_table(viodev)) 188 + == NULL) { 189 + /* XXX free TCE table */ 190 + kfree(viodev); 191 + return NULL; 192 + } 193 + device_create_file(&viodev->dev, &dev_attr_devspec); 194 + 195 + return viodev; 196 + } 197 + EXPORT_SYMBOL(vio_register_device_node); 198 + 199 + /** 200 + * vio_get_attribute: - get attribute for virtual device 201 + * @vdev: The vio device to get property. 202 + * @which: The property/attribute to be extracted. 203 + * @length: Pointer to length of returned data size (unused if NULL). 204 + * 205 + * Calls prom.c's get_property() to return the value of the 206 + * attribute specified by the preprocessor constant @which 207 + */ 208 + const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length) 209 + { 210 + return get_property(vdev->dev.platform_data, (char*)which, length); 211 + } 212 + EXPORT_SYMBOL(vio_get_attribute); 213 + 214 + /* vio_find_name() - internal because only vio.c knows how we formatted the 215 + * kobject name 216 + * XXX once vio_bus_type.devices is actually used as a kset in 217 + * drivers/base/bus.c, this function should be removed in favor of 218 + * "device_find(kobj_name, &vio_bus_type)" 219 + */ 220 + static struct vio_dev *vio_find_name(const char *kobj_name) 221 + { 222 + struct kobject *found; 223 + 224 + found = kset_find_obj(&devices_subsys.kset, kobj_name); 225 + if (!found) 226 + return NULL; 227 + 228 + return to_vio_dev(container_of(found, struct device, kobj)); 229 + } 230 + 231 + /** 232 + * vio_find_node - find an already-registered vio_dev 233 + * @vnode: device_node of the virtual device we're looking for 234 + */ 235 + struct vio_dev *vio_find_node(struct device_node *vnode) 236 + { 237 + uint32_t *unit_address; 238 + char kobj_name[BUS_ID_SIZE]; 239 + 240 + /* construct the kobject name from the device node */ 241 + unit_address = (uint32_t *)get_property(vnode, "reg", NULL); 242 + if (!unit_address) 243 + return NULL; 244 + snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); 245 + 246 + return vio_find_name(kobj_name); 247 + } 248 + EXPORT_SYMBOL(vio_find_node); 249 + 250 + int vio_enable_interrupts(struct vio_dev *dev) 251 + { 252 + int rc = h_vio_signal(dev->unit_address, VIO_IRQ_ENABLE); 253 + if (rc != H_Success) 254 + printk(KERN_ERR "vio: Error 0x%x enabling interrupts\n", rc); 255 + return rc; 256 + } 257 + EXPORT_SYMBOL(vio_enable_interrupts); 258 + 259 + int vio_disable_interrupts(struct vio_dev *dev) 260 + { 261 + int rc = h_vio_signal(dev->unit_address, VIO_IRQ_DISABLE); 262 + if (rc != H_Success) 263 + printk(KERN_ERR "vio: Error 0x%x disabling interrupts\n", rc); 264 + return rc; 265 + } 266 + EXPORT_SYMBOL(vio_disable_interrupts);
+13 -277
arch/ppc64/kernel/vio.c
··· 1 1 /* 2 2 * IBM PowerPC Virtual I/O Infrastructure Support. 3 3 * 4 - * Copyright (c) 2003 IBM Corp. 4 + * Copyright (c) 2003-2005 IBM Corp. 5 5 * Dave Engebretsen engebret@us.ibm.com 6 6 * Santiago Leon santil@us.ibm.com 7 7 * Hollis Blanchard <hollisb@us.ibm.com> 8 + * Stephen Rothwell 8 9 * 9 10 * This program is free software; you can redistribute it and/or 10 11 * modify it under the terms of the GNU General Public License ··· 15 14 16 15 #include <linux/init.h> 17 16 #include <linux/console.h> 18 - #include <linux/version.h> 19 17 #include <linux/module.h> 20 - #include <linux/kobject.h> 21 18 #include <linux/mm.h> 22 19 #include <linux/dma-mapping.h> 23 - #include <asm/rtas.h> 24 20 #include <asm/iommu.h> 25 21 #include <asm/dma.h> 26 - #include <asm/ppcdebug.h> 27 22 #include <asm/vio.h> 28 - #include <asm/hvcall.h> 29 - 30 - #define DBGENTER() pr_debug("%s entered\n", __FUNCTION__) 31 - 32 - extern struct subsystem devices_subsys; /* needed for vio_find_name() */ 33 23 34 24 static const struct vio_device_id *vio_match_device( 35 25 const struct vio_device_id *, const struct vio_dev *); 36 26 37 - #ifdef CONFIG_PPC_PSERIES 38 - static struct iommu_table *vio_build_iommu_table(struct vio_dev *); 39 - static int vio_num_address_cells; 40 - #endif 41 27 struct vio_dev vio_bus_device = { /* fake "parent" device */ 42 28 .name = vio_bus_device.dev.bus_id, 43 29 .type = "", ··· 34 46 35 47 static int (*is_match)(const struct vio_device_id *id, 36 48 const struct vio_dev *dev); 49 + static void (*unregister_device_callback)(struct vio_dev *dev); 50 + static void (*release_device_callback)(struct device *dev); 37 51 38 52 /* convert from struct device to struct vio_dev and pass to driver. 39 53 * dev->driver has already been set by generic code because vio_bus_match ··· 46 56 struct vio_driver *viodrv = to_vio_driver(dev->driver); 47 57 const struct vio_device_id *id; 48 58 int error = -ENODEV; 49 - 50 - DBGENTER(); 51 59 52 60 if (!viodrv->probe) 53 61 return error; ··· 63 75 { 64 76 struct vio_dev *viodev = to_vio_dev(dev); 65 77 struct vio_driver *viodrv = to_vio_driver(dev->driver); 66 - 67 - DBGENTER(); 68 78 69 79 if (viodrv->remove) { 70 80 return viodrv->remove(viodev); ··· 113 127 static const struct vio_device_id * vio_match_device(const struct vio_device_id *ids, 114 128 const struct vio_dev *dev) 115 129 { 116 - DBGENTER(); 117 - 118 130 while (ids->type) { 119 131 if (is_match(ids, dev)) 120 132 return ids; ··· 121 137 return NULL; 122 138 } 123 139 124 - #ifdef CONFIG_PPC_PSERIES 125 - static void probe_bus_pseries(void) 126 - { 127 - struct device_node *node_vroot, *of_node; 128 - 129 - node_vroot = find_devices("vdevice"); 130 - if ((node_vroot == NULL) || (node_vroot->child == NULL)) 131 - /* this machine doesn't do virtual IO, and that's ok */ 132 - return; 133 - 134 - vio_num_address_cells = prom_n_addr_cells(node_vroot->child); 135 - 136 - /* 137 - * Create struct vio_devices for each virtual device in the device tree. 138 - * Drivers will associate with them later. 139 - */ 140 - for (of_node = node_vroot->child; of_node != NULL; 141 - of_node = of_node->sibling) { 142 - printk(KERN_DEBUG "%s: processing %p\n", __FUNCTION__, of_node); 143 - vio_register_device_node(of_node); 144 - } 145 - } 146 - #endif 147 - 148 140 /** 149 141 * vio_bus_init: - Initialize the virtual IO bus 150 142 */ 151 143 int __init vio_bus_init(int (*match_func)(const struct vio_device_id *id, 152 - const struct vio_dev *dev)) 144 + const struct vio_dev *dev), 145 + void (*unregister_dev)(struct vio_dev *), 146 + void (*release_dev)(struct device *)) 153 147 { 154 148 int err; 155 149 156 150 is_match = match_func; 151 + unregister_device_callback = unregister_dev; 152 + release_device_callback = release_dev; 157 153 158 154 err = bus_register(&vio_bus_type); 159 155 if (err) { ··· 154 190 return 0; 155 191 } 156 192 157 - #ifdef CONFIG_PPC_PSERIES 158 - /** 159 - * vio_match_device_pseries: - Tell if a pSeries VIO device matches a 160 - * vio_device_id 161 - */ 162 - static int vio_match_device_pseries(const struct vio_device_id *id, 163 - const struct vio_dev *dev) 164 - { 165 - return (strncmp(dev->type, id->type, strlen(id->type)) == 0) && 166 - device_is_compatible(dev->dev.platform_data, id->compat); 167 - } 168 - 169 - /** 170 - * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus 171 - */ 172 - static int __init vio_bus_init_pseries(void) 173 - { 174 - int err; 175 - 176 - err = vio_bus_init(vio_match_device_pseries); 177 - if (err == 0) 178 - probe_bus_pseries(); 179 - return err; 180 - } 181 - 182 - __initcall(vio_bus_init_pseries); 183 - #endif 184 - 185 193 /* vio_dev refcount hit 0 */ 186 194 static void __devinit vio_dev_release(struct device *dev) 187 195 { 188 - DBGENTER(); 189 - 190 - #ifdef CONFIG_PPC_PSERIES 191 - /* XXX free TCE table */ 192 - of_node_put(dev->platform_data); 193 - #endif 196 + if (release_device_callback) 197 + release_device_callback(dev); 194 198 kfree(to_vio_dev(dev)); 195 199 } 196 - 197 - #ifdef CONFIG_PPC_PSERIES 198 - static ssize_t viodev_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) 199 - { 200 - struct device_node *of_node = dev->platform_data; 201 - 202 - return sprintf(buf, "%s\n", of_node->full_name); 203 - } 204 - DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL); 205 - #endif 206 200 207 201 static ssize_t viodev_show_name(struct device *dev, struct device_attribute *attr, char *buf) 208 202 { ··· 172 250 struct vio_dev *viodev, char *name, char *type, 173 251 uint32_t unit_address, struct iommu_table *iommu_table) 174 252 { 175 - DBGENTER(); 176 - 177 253 viodev->name = name; 178 254 viodev->type = type; 179 255 viodev->unit_address = unit_address; ··· 192 272 return viodev; 193 273 } 194 274 195 - #ifdef CONFIG_PPC_PSERIES 196 - /** 197 - * vio_register_device_node: - Register a new vio device. 198 - * @of_node: The OF node for this device. 199 - * 200 - * Creates and initializes a vio_dev structure from the data in 201 - * of_node (dev.platform_data) and adds it to the list of virtual devices. 202 - * Returns a pointer to the created vio_dev or NULL if node has 203 - * NULL device_type or compatible fields. 204 - */ 205 - struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) 206 - { 207 - struct vio_dev *viodev; 208 - unsigned int *unit_address; 209 - unsigned int *irq_p; 210 - 211 - DBGENTER(); 212 - 213 - /* we need the 'device_type' property, in order to match with drivers */ 214 - if ((NULL == of_node->type)) { 215 - printk(KERN_WARNING 216 - "%s: node %s missing 'device_type'\n", __FUNCTION__, 217 - of_node->name ? of_node->name : "<unknown>"); 218 - return NULL; 219 - } 220 - 221 - unit_address = (unsigned int *)get_property(of_node, "reg", NULL); 222 - if (!unit_address) { 223 - printk(KERN_WARNING "%s: node %s missing 'reg'\n", __FUNCTION__, 224 - of_node->name ? of_node->name : "<unknown>"); 225 - return NULL; 226 - } 227 - 228 - /* allocate a vio_dev for this node */ 229 - viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); 230 - if (!viodev) { 231 - return NULL; 232 - } 233 - memset(viodev, 0, sizeof(struct vio_dev)); 234 - 235 - viodev->dev.platform_data = of_node_get(of_node); 236 - 237 - viodev->irq = NO_IRQ; 238 - irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL); 239 - if (irq_p) { 240 - int virq = virt_irq_create_mapping(*irq_p); 241 - if (virq == NO_IRQ) { 242 - printk(KERN_ERR "Unable to allocate interrupt " 243 - "number for %s\n", of_node->full_name); 244 - } else 245 - viodev->irq = irq_offset_up(virq); 246 - } 247 - 248 - snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address); 249 - 250 - /* register with generic device framework */ 251 - if (vio_register_device_common(viodev, of_node->name, of_node->type, 252 - *unit_address, vio_build_iommu_table(viodev)) 253 - == NULL) { 254 - /* XXX free TCE table */ 255 - kfree(viodev); 256 - return NULL; 257 - } 258 - device_create_file(&viodev->dev, &dev_attr_devspec); 259 - 260 - return viodev; 261 - } 262 - EXPORT_SYMBOL(vio_register_device_node); 263 - #endif 264 - 265 275 void __devinit vio_unregister_device(struct vio_dev *viodev) 266 276 { 267 - DBGENTER(); 268 - #ifdef CONFIG_PPC_PSERIES 269 - device_remove_file(&viodev->dev, &dev_attr_devspec); 270 - #endif 277 + if (unregister_device_callback) 278 + unregister_device_callback(viodev); 271 279 device_remove_file(&viodev->dev, &dev_attr_name); 272 280 device_unregister(&viodev->dev); 273 281 } 274 282 EXPORT_SYMBOL(vio_unregister_device); 275 - 276 - #ifdef CONFIG_PPC_PSERIES 277 - /** 278 - * vio_get_attribute: - get attribute for virtual device 279 - * @vdev: The vio device to get property. 280 - * @which: The property/attribute to be extracted. 281 - * @length: Pointer to length of returned data size (unused if NULL). 282 - * 283 - * Calls prom.c's get_property() to return the value of the 284 - * attribute specified by the preprocessor constant @which 285 - */ 286 - const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length) 287 - { 288 - return get_property(vdev->dev.platform_data, (char*)which, length); 289 - } 290 - EXPORT_SYMBOL(vio_get_attribute); 291 - 292 - /* vio_find_name() - internal because only vio.c knows how we formatted the 293 - * kobject name 294 - * XXX once vio_bus_type.devices is actually used as a kset in 295 - * drivers/base/bus.c, this function should be removed in favor of 296 - * "device_find(kobj_name, &vio_bus_type)" 297 - */ 298 - static struct vio_dev *vio_find_name(const char *kobj_name) 299 - { 300 - struct kobject *found; 301 - 302 - found = kset_find_obj(&devices_subsys.kset, kobj_name); 303 - if (!found) 304 - return NULL; 305 - 306 - return to_vio_dev(container_of(found, struct device, kobj)); 307 - } 308 - 309 - /** 310 - * vio_find_node - find an already-registered vio_dev 311 - * @vnode: device_node of the virtual device we're looking for 312 - */ 313 - struct vio_dev *vio_find_node(struct device_node *vnode) 314 - { 315 - uint32_t *unit_address; 316 - char kobj_name[BUS_ID_SIZE]; 317 - 318 - /* construct the kobject name from the device node */ 319 - unit_address = (uint32_t *)get_property(vnode, "reg", NULL); 320 - if (!unit_address) 321 - return NULL; 322 - snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); 323 - 324 - return vio_find_name(kobj_name); 325 - } 326 - EXPORT_SYMBOL(vio_find_node); 327 - 328 - /** 329 - * vio_build_iommu_table: - gets the dma information from OF and builds the TCE tree. 330 - * @dev: the virtual device. 331 - * 332 - * Returns a pointer to the built tce tree, or NULL if it can't 333 - * find property. 334 - */ 335 - static struct iommu_table * vio_build_iommu_table(struct vio_dev *dev) 336 - { 337 - unsigned int *dma_window; 338 - struct iommu_table *newTceTable; 339 - unsigned long offset; 340 - int dma_window_property_size; 341 - 342 - dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size); 343 - if(!dma_window) { 344 - return NULL; 345 - } 346 - 347 - newTceTable = (struct iommu_table *) kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 348 - 349 - /* There should be some code to extract the phys-encoded offset 350 - using prom_n_addr_cells(). However, according to a comment 351 - on earlier versions, it's always zero, so we don't bother */ 352 - offset = dma_window[1] >> PAGE_SHIFT; 353 - 354 - /* TCE table size - measured in tce entries */ 355 - newTceTable->it_size = dma_window[4] >> PAGE_SHIFT; 356 - /* offset for VIO should always be 0 */ 357 - newTceTable->it_offset = offset; 358 - newTceTable->it_busno = 0; 359 - newTceTable->it_index = (unsigned long)dma_window[0]; 360 - newTceTable->it_type = TCE_VB; 361 - 362 - return iommu_init_table(newTceTable); 363 - } 364 - 365 - int vio_enable_interrupts(struct vio_dev *dev) 366 - { 367 - int rc = h_vio_signal(dev->unit_address, VIO_IRQ_ENABLE); 368 - if (rc != H_Success) { 369 - printk(KERN_ERR "vio: Error 0x%x enabling interrupts\n", rc); 370 - } 371 - return rc; 372 - } 373 - EXPORT_SYMBOL(vio_enable_interrupts); 374 - 375 - int vio_disable_interrupts(struct vio_dev *dev) 376 - { 377 - int rc = h_vio_signal(dev->unit_address, VIO_IRQ_DISABLE); 378 - if (rc != H_Success) { 379 - printk(KERN_ERR "vio: Error 0x%x disabling interrupts\n", rc); 380 - } 381 - return rc; 382 - } 383 - EXPORT_SYMBOL(vio_disable_interrupts); 384 - #endif 385 283 386 284 static dma_addr_t vio_map_single(struct device *dev, void *vaddr, 387 285 size_t size, enum dma_data_direction direction) ··· 263 525 struct vio_driver *vio_drv = to_vio_driver(drv); 264 526 const struct vio_device_id *ids = vio_drv->id_table; 265 527 const struct vio_device_id *found_id; 266 - 267 - DBGENTER(); 268 528 269 529 if (!ids) 270 530 return 0;
+3 -1
include/asm-ppc64/vio.h
··· 106 106 } 107 107 108 108 extern int vio_bus_init(int (*is_match)(const struct vio_device_id *id, 109 - const struct vio_dev *dev)); 109 + const struct vio_dev *dev), 110 + void (*)(struct vio_dev *), 111 + void (*)(struct device *)); 110 112 111 113 #endif /* _ASM_VIO_H */