blob: b7c9e44ef180bab4b019dbb60da1f738eeb318ca [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * IBM PowerPC Virtual I/O Infrastructure Support.
3 *
Stephen Rothwell19dbd0f2005-07-12 17:50:26 +10004 * Copyright (c) 2003-2005 IBM Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * Dave Engebretsen engebret@us.ibm.com
6 * Santiago Leon santil@us.ibm.com
7 * Hollis Blanchard <hollisb@us.ibm.com>
Stephen Rothwell19dbd0f2005-07-12 17:50:26 +10008 * Stephen Rothwell
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 *
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
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100016#include <linux/types.h>
17#include <linux/device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/init.h>
19#include <linux/console.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/mm.h>
22#include <linux/dma-mapping.h>
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100023#include <linux/kobject.h>
24
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <asm/iommu.h>
26#include <asm/dma.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <asm/vio.h>
Olaf Hering143dcec2005-11-08 21:34:36 -080028#include <asm/prom.h>
Stephen Rothwelle10fa772006-04-27 17:18:21 +100029#include <asm/firmware.h>
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100030#include <asm/tce.h>
31#include <asm/abs_addr.h>
32#include <asm/page.h>
33#include <asm/hvcall.h>
34#include <asm/iseries/vio.h>
35#include <asm/iseries/hv_types.h>
36#include <asm/iseries/hv_lp_config.h>
37#include <asm/iseries/hv_call_xm.h>
38#include <asm/iseries/iommu.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Greg Kroah-Hartman823bccf2007-04-13 13:15:19 -070040extern struct kset devices_subsys; /* needed for vio_find_name() */
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100041
Stephen Rothwell6fccab22007-09-21 14:32:05 +100042static struct bus_type vio_bus_type;
43
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100044static struct vio_dev vio_bus_device = { /* fake "parent" device */
Stephen Rothwellac5b33c2005-06-21 17:15:54 -070045 .name = vio_bus_device.dev.bus_id,
46 .type = "",
Stephen Rothwellac5b33c2005-06-21 17:15:54 -070047 .dev.bus_id = "vio",
48 .dev.bus = &vio_bus_type,
49};
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100051static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
52{
Stephen Rothwelldd9b67a2007-10-11 14:55:02 +100053 const unsigned char *dma_window;
54 struct iommu_table *tbl;
55 unsigned long offset, size;
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100056
Stephen Rothwelldd9b67a2007-10-11 14:55:02 +100057 if (firmware_has_feature(FW_FEATURE_ISERIES))
58 return vio_build_iommu_table_iseries(dev);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100059
Stephen Rothwelldd9b67a2007-10-11 14:55:02 +100060 dma_window = of_get_property(dev->dev.archdata.of_node,
61 "ibm,my-dma-window", NULL);
62 if (!dma_window)
63 return NULL;
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100064
Stephen Rothwelldd9b67a2007-10-11 14:55:02 +100065 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100066
Stephen Rothwelldd9b67a2007-10-11 14:55:02 +100067 of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
68 &tbl->it_index, &offset, &size);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100069
Stephen Rothwelldd9b67a2007-10-11 14:55:02 +100070 /* TCE table size - measured in tce entries */
71 tbl->it_size = size >> IOMMU_PAGE_SHIFT;
72 /* offset for VIO should always be 0 */
73 tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
74 tbl->it_busno = 0;
75 tbl->it_type = TCE_VB;
76
77 return iommu_init_table(tbl, -1);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +100078}
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Stephen Rothwelle10fa772006-04-27 17:18:21 +100080/**
81 * vio_match_device: - Tell if a VIO device has a matching
82 * VIO device id structure.
83 * @ids: array of VIO device id structures to search in
84 * @dev: the VIO device structure to match against
85 *
86 * Used by a driver to check whether a VIO device present in the
87 * system is in its list of supported devices. Returns the matching
88 * vio_device_id structure or NULL if there is no match.
89 */
90static const struct vio_device_id *vio_match_device(
91 const struct vio_device_id *ids, const struct vio_dev *dev)
92{
93 while (ids->type[0] != '\0') {
Stephen Rothwelldd721ff2006-04-27 17:21:46 +100094 if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) &&
Stephen Rothwell55b61fe2007-05-03 17:26:52 +100095 of_device_is_compatible(dev->dev.archdata.of_node,
Benjamin Herrenschmidt12d04ee2006-11-11 17:25:02 +110096 ids->compat))
Stephen Rothwelle10fa772006-04-27 17:18:21 +100097 return ids;
98 ids++;
99 }
100 return NULL;
101}
102
Stephen Rothwell5c0b4b82005-08-17 16:37:35 +1000103/*
104 * Convert from struct device to struct vio_dev and pass to driver.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 * dev->driver has already been set by generic code because vio_bus_match
Stephen Rothwell5c0b4b82005-08-17 16:37:35 +1000106 * succeeded.
107 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108static int vio_bus_probe(struct device *dev)
109{
110 struct vio_dev *viodev = to_vio_dev(dev);
111 struct vio_driver *viodrv = to_vio_driver(dev->driver);
112 const struct vio_device_id *id;
113 int error = -ENODEV;
114
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 if (!viodrv->probe)
116 return error;
117
118 id = vio_match_device(viodrv->id_table, viodev);
Stephen Rothwell5c0b4b82005-08-17 16:37:35 +1000119 if (id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 error = viodrv->probe(viodev, id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121
122 return error;
123}
124
125/* convert from struct device to struct vio_dev and pass to driver. */
126static int vio_bus_remove(struct device *dev)
127{
128 struct vio_dev *viodev = to_vio_dev(dev);
129 struct vio_driver *viodrv = to_vio_driver(dev->driver);
130
Stephen Rothwell5c0b4b82005-08-17 16:37:35 +1000131 if (viodrv->remove)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 return viodrv->remove(viodev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
134 /* driver can't remove */
135 return 1;
136}
137
138/**
139 * vio_register_driver: - Register a new vio driver
140 * @drv: The vio_driver structure to be registered.
141 */
142int vio_register_driver(struct vio_driver *viodrv)
143{
144 printk(KERN_DEBUG "%s: driver %s registering\n", __FUNCTION__,
Stephen Rothwell6fdf5392005-10-24 14:53:21 +1000145 viodrv->driver.name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
147 /* fill in 'struct driver' fields */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 viodrv->driver.bus = &vio_bus_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
150 return driver_register(&viodrv->driver);
151}
152EXPORT_SYMBOL(vio_register_driver);
153
154/**
155 * vio_unregister_driver - Remove registration of vio driver.
156 * @driver: The vio_driver struct to be removed form registration
157 */
158void vio_unregister_driver(struct vio_driver *viodrv)
159{
160 driver_unregister(&viodrv->driver);
161}
162EXPORT_SYMBOL(vio_unregister_driver);
163
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000164/* vio_dev refcount hit 0 */
165static void __devinit vio_dev_release(struct device *dev)
166{
Mariusz Kozlowski6690fae2007-01-02 12:38:36 +0100167 /* XXX should free TCE table */
168 of_node_put(dev->archdata.of_node);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000169 kfree(to_vio_dev(dev));
170}
171
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172/**
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000173 * vio_register_device_node: - Register a new vio device.
174 * @of_node: The OF node for this device.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 *
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000176 * Creates and initializes a vio_dev structure from the data in
Benjamin Herrenschmidt12d04ee2006-11-11 17:25:02 +1100177 * of_node and adds it to the list of virtual devices.
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000178 * Returns a pointer to the created vio_dev or NULL if node has
179 * NULL device_type or compatible fields.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180 */
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000181struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182{
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000183 struct vio_dev *viodev;
Jeremy Kerra7f67bd2006-07-12 15:35:54 +1000184 const unsigned int *unit_address;
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000185
186 /* we need the 'device_type' property, in order to match with drivers */
187 if (of_node->type == NULL) {
188 printk(KERN_WARNING "%s: node %s missing 'device_type'\n",
189 __FUNCTION__,
190 of_node->name ? of_node->name : "<unknown>");
191 return NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 }
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000193
Stephen Rothwelle2eb6392007-04-03 22:26:41 +1000194 unit_address = of_get_property(of_node, "reg", NULL);
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000195 if (unit_address == NULL) {
196 printk(KERN_WARNING "%s: node %s missing 'reg'\n",
197 __FUNCTION__,
198 of_node->name ? of_node->name : "<unknown>");
199 return NULL;
200 }
201
202 /* allocate a vio_dev for this node */
203 viodev = kzalloc(sizeof(struct vio_dev), GFP_KERNEL);
204 if (viodev == NULL)
205 return NULL;
206
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +1000207 viodev->irq = irq_of_parse_and_map(of_node, 0);
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000208
209 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
210 viodev->name = of_node->name;
211 viodev->type = of_node->type;
212 viodev->unit_address = *unit_address;
213 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
Stephen Rothwelle2eb6392007-04-03 22:26:41 +1000214 unit_address = of_get_property(of_node,
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000215 "linux,unit_address", NULL);
216 if (unit_address != NULL)
217 viodev->unit_address = *unit_address;
218 }
Benjamin Herrenschmidt12d04ee2006-11-11 17:25:02 +1100219 viodev->dev.archdata.of_node = of_node_get(of_node);
220 viodev->dev.archdata.dma_ops = &dma_iommu_ops;
221 viodev->dev.archdata.dma_data = vio_build_iommu_table(viodev);
222 viodev->dev.archdata.numa_node = of_node_to_nid(of_node);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000223
224 /* init generic 'struct device' fields: */
225 viodev->dev.parent = &vio_bus_device.dev;
226 viodev->dev.bus = &vio_bus_type;
227 viodev->dev.release = vio_dev_release;
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000228
229 /* register with generic device framework */
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000230 if (device_register(&viodev->dev)) {
231 printk(KERN_ERR "%s: failed to register device %s\n",
232 __FUNCTION__, viodev->dev.bus_id);
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000233 /* XXX free TCE table */
234 kfree(viodev);
235 return NULL;
236 }
237
238 return viodev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239}
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000240EXPORT_SYMBOL(vio_register_device_node);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242/**
243 * vio_bus_init: - Initialize the virtual IO bus
244 */
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000245static int __init vio_bus_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246{
247 int err;
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000248 struct device_node *node_vroot;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249
Stephen Rothwellc8680782007-09-21 14:31:02 +1000250 if (firmware_has_feature(FW_FEATURE_ISERIES))
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000251 iommu_vio_init();
Stephen Rothwell63122362005-07-12 17:45:27 +1000252
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253 err = bus_register(&vio_bus_type);
254 if (err) {
255 printk(KERN_ERR "failed to register VIO bus\n");
256 return err;
257 }
258
Stephen Rothwell5c0b4b82005-08-17 16:37:35 +1000259 /*
260 * The fake parent of all vio devices, just to give us
Stephen Rothwell3e494c82005-07-12 17:40:17 +1000261 * a nice directory
262 */
Stephen Rothwellac5b33c2005-06-21 17:15:54 -0700263 err = device_register(&vio_bus_device.dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 if (err) {
Stephen Rothwell3e494c82005-07-12 17:40:17 +1000265 printk(KERN_WARNING "%s: device_register returned %i\n",
266 __FUNCTION__, err);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 return err;
268 }
269
Stephen Rothwell30686ba2007-04-24 13:53:04 +1000270 node_vroot = of_find_node_by_name(NULL, "vdevice");
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000271 if (node_vroot) {
272 struct device_node *of_node;
273
274 /*
275 * Create struct vio_devices for each virtual device in
276 * the device tree. Drivers will associate with them later.
277 */
278 for (of_node = node_vroot->child; of_node != NULL;
Stephen Rothwellc5467262007-09-21 14:29:28 +1000279 of_node = of_node->sibling)
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000280 vio_register_device_node(of_node);
Stephen Rothwell30686ba2007-04-24 13:53:04 +1000281 of_node_put(node_vroot);
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000282 }
283
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 return 0;
285}
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000286__initcall(vio_bus_init);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000288static ssize_t name_show(struct device *dev,
Stephen Rothwell5c0b4b82005-08-17 16:37:35 +1000289 struct device_attribute *attr, char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290{
291 return sprintf(buf, "%s\n", to_vio_dev(dev)->name);
292}
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000293
294static ssize_t devspec_show(struct device *dev,
295 struct device_attribute *attr, char *buf)
296{
Benjamin Herrenschmidt12d04ee2006-11-11 17:25:02 +1100297 struct device_node *of_node = dev->archdata.of_node;
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000298
299 return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
300}
301
302static struct device_attribute vio_dev_attrs[] = {
303 __ATTR_RO(name),
304 __ATTR_RO(devspec),
305 __ATTR_NULL
306};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308void __devinit vio_unregister_device(struct vio_dev *viodev)
309{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310 device_unregister(&viodev->dev);
311}
312EXPORT_SYMBOL(vio_unregister_device);
313
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314static int vio_bus_match(struct device *dev, struct device_driver *drv)
315{
316 const struct vio_dev *vio_dev = to_vio_dev(dev);
317 struct vio_driver *vio_drv = to_vio_driver(drv);
318 const struct vio_device_id *ids = vio_drv->id_table;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319
Stephen Rothwell5c0b4b82005-08-17 16:37:35 +1000320 return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321}
322
Olaf Hering143dcec2005-11-08 21:34:36 -0800323static int vio_hotplug(struct device *dev, char **envp, int num_envp,
324 char *buffer, int buffer_size)
325{
326 const struct vio_dev *vio_dev = to_vio_dev(dev);
Benjamin Herrenschmidt12d04ee2006-11-11 17:25:02 +1100327 struct device_node *dn;
Jeremy Kerra7f67bd2006-07-12 15:35:54 +1000328 const char *cp;
Olaf Hering143dcec2005-11-08 21:34:36 -0800329 int length;
330
331 if (!num_envp)
332 return -ENOMEM;
333
Benjamin Herrenschmidt12d04ee2006-11-11 17:25:02 +1100334 dn = dev->archdata.of_node;
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000335 if (!dn)
Olaf Hering143dcec2005-11-08 21:34:36 -0800336 return -ENODEV;
Stephen Rothwelle2eb6392007-04-03 22:26:41 +1000337 cp = of_get_property(dn, "compatible", &length);
Olaf Hering143dcec2005-11-08 21:34:36 -0800338 if (!cp)
339 return -ENODEV;
340
341 envp[0] = buffer;
342 length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s",
343 vio_dev->type, cp);
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000344 if ((buffer_size - length) <= 0)
Olaf Hering143dcec2005-11-08 21:34:36 -0800345 return -ENOMEM;
346 envp[1] = NULL;
347 return 0;
348}
349
Stephen Rothwell6fccab22007-09-21 14:32:05 +1000350static struct bus_type vio_bus_type = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 .name = "vio",
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000352 .dev_attrs = vio_dev_attrs,
Kay Sievers312c0042005-11-16 09:00:00 +0100353 .uevent = vio_hotplug,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 .match = vio_bus_match,
Russell King2f53a802006-01-05 14:36:47 +0000355 .probe = vio_bus_probe,
356 .remove = vio_bus_remove,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357};
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000358
359/**
360 * vio_get_attribute: - get attribute for virtual device
361 * @vdev: The vio device to get property.
362 * @which: The property/attribute to be extracted.
363 * @length: Pointer to length of returned data size (unused if NULL).
364 *
Stephen Rothwelle2eb6392007-04-03 22:26:41 +1000365 * Calls prom.c's of_get_property() to return the value of the
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000366 * attribute specified by @which
367*/
368const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
369{
Stephen Rothwelle2eb6392007-04-03 22:26:41 +1000370 return of_get_property(vdev->dev.archdata.of_node, which, length);
Stephen Rothwelle10fa772006-04-27 17:18:21 +1000371}
372EXPORT_SYMBOL(vio_get_attribute);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000373
374#ifdef CONFIG_PPC_PSERIES
375/* vio_find_name() - internal because only vio.c knows how we formatted the
376 * kobject name
377 * XXX once vio_bus_type.devices is actually used as a kset in
378 * drivers/base/bus.c, this function should be removed in favor of
379 * "device_find(kobj_name, &vio_bus_type)"
380 */
381static struct vio_dev *vio_find_name(const char *kobj_name)
382{
383 struct kobject *found;
384
Greg Kroah-Hartman823bccf2007-04-13 13:15:19 -0700385 found = kset_find_obj(&devices_subsys, kobj_name);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000386 if (!found)
387 return NULL;
388
389 return to_vio_dev(container_of(found, struct device, kobj));
390}
391
392/**
393 * vio_find_node - find an already-registered vio_dev
394 * @vnode: device_node of the virtual device we're looking for
395 */
396struct vio_dev *vio_find_node(struct device_node *vnode)
397{
Jeremy Kerra7f67bd2006-07-12 15:35:54 +1000398 const uint32_t *unit_address;
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000399 char kobj_name[BUS_ID_SIZE];
400
401 /* construct the kobject name from the device node */
Stephen Rothwelle2eb6392007-04-03 22:26:41 +1000402 unit_address = of_get_property(vnode, "reg", NULL);
Stephen Rothwellc7f0e8c2006-04-27 17:23:32 +1000403 if (!unit_address)
404 return NULL;
405 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
406
407 return vio_find_name(kobj_name);
408}
409EXPORT_SYMBOL(vio_find_node);
410
411int vio_enable_interrupts(struct vio_dev *dev)
412{
413 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_ENABLE);
414 if (rc != H_SUCCESS)
415 printk(KERN_ERR "vio: Error 0x%x enabling interrupts\n", rc);
416 return rc;
417}
418EXPORT_SYMBOL(vio_enable_interrupts);
419
420int vio_disable_interrupts(struct vio_dev *dev)
421{
422 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_DISABLE);
423 if (rc != H_SUCCESS)
424 printk(KERN_ERR "vio: Error 0x%x disabling interrupts\n", rc);
425 return rc;
426}
427EXPORT_SYMBOL(vio_disable_interrupts);
428#endif /* CONFIG_PPC_PSERIES */