diff options
Diffstat (limited to 'arch/powerpc/kernel/vio.c')
-rw-r--r-- | arch/powerpc/kernel/vio.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index cb87301ccd55..7a421e8fe7ca 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <asm/page.h> | 37 | #include <asm/page.h> |
38 | #include <asm/hvcall.h> | 38 | #include <asm/hvcall.h> |
39 | 39 | ||
40 | static struct bus_type vio_bus_type; | ||
41 | |||
42 | static struct vio_dev vio_bus_device = { /* fake "parent" device */ | 40 | static struct vio_dev vio_bus_device = { /* fake "parent" device */ |
43 | .name = "vio", | 41 | .name = "vio", |
44 | .type = "", | 42 | .type = "", |
@@ -625,7 +623,7 @@ struct dma_map_ops vio_dma_mapping_ops = { | |||
625 | * vio_cmo_set_dev_desired - Set desired entitlement for a device | 623 | * vio_cmo_set_dev_desired - Set desired entitlement for a device |
626 | * | 624 | * |
627 | * @viodev: struct vio_dev for device to alter | 625 | * @viodev: struct vio_dev for device to alter |
628 | * @new_desired: new desired entitlement level in bytes | 626 | * @desired: new desired entitlement level in bytes |
629 | * | 627 | * |
630 | * For use by devices to request a change to their entitlement at runtime or | 628 | * For use by devices to request a change to their entitlement at runtime or |
631 | * through sysfs. The desired entitlement level is changed and a balancing | 629 | * through sysfs. The desired entitlement level is changed and a balancing |
@@ -1262,7 +1260,7 @@ static int vio_bus_remove(struct device *dev) | |||
1262 | 1260 | ||
1263 | /** | 1261 | /** |
1264 | * vio_register_driver: - Register a new vio driver | 1262 | * vio_register_driver: - Register a new vio driver |
1265 | * @drv: The vio_driver structure to be registered. | 1263 | * @viodrv: The vio_driver structure to be registered. |
1266 | */ | 1264 | */ |
1267 | int __vio_register_driver(struct vio_driver *viodrv, struct module *owner, | 1265 | int __vio_register_driver(struct vio_driver *viodrv, struct module *owner, |
1268 | const char *mod_name) | 1266 | const char *mod_name) |
@@ -1282,7 +1280,7 @@ EXPORT_SYMBOL(__vio_register_driver); | |||
1282 | 1280 | ||
1283 | /** | 1281 | /** |
1284 | * vio_unregister_driver - Remove registration of vio driver. | 1282 | * vio_unregister_driver - Remove registration of vio driver. |
1285 | * @driver: The vio_driver struct to be removed form registration | 1283 | * @viodrv: The vio_driver struct to be removed form registration |
1286 | */ | 1284 | */ |
1287 | void vio_unregister_driver(struct vio_driver *viodrv) | 1285 | void vio_unregister_driver(struct vio_driver *viodrv) |
1288 | { | 1286 | { |
@@ -1397,21 +1395,27 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) | |||
1397 | viodev->name = of_node->name; | 1395 | viodev->name = of_node->name; |
1398 | viodev->dev.of_node = of_node_get(of_node); | 1396 | viodev->dev.of_node = of_node_get(of_node); |
1399 | 1397 | ||
1400 | if (firmware_has_feature(FW_FEATURE_CMO)) | ||
1401 | vio_cmo_set_dma_ops(viodev); | ||
1402 | else | ||
1403 | set_dma_ops(&viodev->dev, &dma_iommu_ops); | ||
1404 | set_iommu_table_base(&viodev->dev, vio_build_iommu_table(viodev)); | ||
1405 | set_dev_node(&viodev->dev, of_node_to_nid(of_node)); | 1398 | set_dev_node(&viodev->dev, of_node_to_nid(of_node)); |
1406 | 1399 | ||
1407 | /* init generic 'struct device' fields: */ | 1400 | /* init generic 'struct device' fields: */ |
1408 | viodev->dev.parent = &vio_bus_device.dev; | 1401 | viodev->dev.parent = &vio_bus_device.dev; |
1409 | viodev->dev.bus = &vio_bus_type; | 1402 | viodev->dev.bus = &vio_bus_type; |
1410 | viodev->dev.release = vio_dev_release; | 1403 | viodev->dev.release = vio_dev_release; |
1411 | /* needed to ensure proper operation of coherent allocations | 1404 | |
1412 | * later, in case driver doesn't set it explicitly */ | 1405 | if (of_get_property(viodev->dev.of_node, "ibm,my-dma-window", NULL)) { |
1413 | dma_set_mask(&viodev->dev, DMA_BIT_MASK(64)); | 1406 | if (firmware_has_feature(FW_FEATURE_CMO)) |
1414 | dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64)); | 1407 | vio_cmo_set_dma_ops(viodev); |
1408 | else | ||
1409 | set_dma_ops(&viodev->dev, &dma_iommu_ops); | ||
1410 | |||
1411 | set_iommu_table_base(&viodev->dev, | ||
1412 | vio_build_iommu_table(viodev)); | ||
1413 | |||
1414 | /* needed to ensure proper operation of coherent allocations | ||
1415 | * later, in case driver doesn't set it explicitly */ | ||
1416 | dma_set_mask(&viodev->dev, DMA_BIT_MASK(64)); | ||
1417 | dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64)); | ||
1418 | } | ||
1415 | 1419 | ||
1416 | /* register with generic device framework */ | 1420 | /* register with generic device framework */ |
1417 | if (device_register(&viodev->dev)) { | 1421 | if (device_register(&viodev->dev)) { |
@@ -1491,12 +1495,18 @@ static int __init vio_bus_init(void) | |||
1491 | if (firmware_has_feature(FW_FEATURE_CMO)) | 1495 | if (firmware_has_feature(FW_FEATURE_CMO)) |
1492 | vio_cmo_bus_init(); | 1496 | vio_cmo_bus_init(); |
1493 | 1497 | ||
1498 | return 0; | ||
1499 | } | ||
1500 | postcore_initcall(vio_bus_init); | ||
1501 | |||
1502 | static int __init vio_device_init(void) | ||
1503 | { | ||
1494 | vio_bus_scan_register_devices("vdevice"); | 1504 | vio_bus_scan_register_devices("vdevice"); |
1495 | vio_bus_scan_register_devices("ibm,platform-facilities"); | 1505 | vio_bus_scan_register_devices("ibm,platform-facilities"); |
1496 | 1506 | ||
1497 | return 0; | 1507 | return 0; |
1498 | } | 1508 | } |
1499 | __initcall(vio_bus_init); | 1509 | device_initcall(vio_device_init); |
1500 | 1510 | ||
1501 | static ssize_t name_show(struct device *dev, | 1511 | static ssize_t name_show(struct device *dev, |
1502 | struct device_attribute *attr, char *buf) | 1512 | struct device_attribute *attr, char *buf) |
@@ -1568,7 +1578,7 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env) | |||
1568 | return 0; | 1578 | return 0; |
1569 | } | 1579 | } |
1570 | 1580 | ||
1571 | static struct bus_type vio_bus_type = { | 1581 | struct bus_type vio_bus_type = { |
1572 | .name = "vio", | 1582 | .name = "vio", |
1573 | .dev_attrs = vio_dev_attrs, | 1583 | .dev_attrs = vio_dev_attrs, |
1574 | .uevent = vio_hotplug, | 1584 | .uevent = vio_hotplug, |