On 19.10.2009, at 21:34, Gerd Hoffmann wrote:
+VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)
+{
+ VirtIOS390Bus *bus;
+
+ bus = (VirtIOS390Bus *)qbus_create(&s390_virtio_bus_info,
NULL, "s390-virtio");
While a cast works the political correct way to do this is using
DO_UPCAST.
Oh - that one's new to me :-)
Also I'd suggest to add a sysbus -> s390-virtio bus bridge device,
so your bus gets properly hooked up in the device tree. Have a look
at the (quite simple) "isabus-bridge" device in isa-bus.c, which is
used with 'qemu -M isapc'. You'll see the s390-virtio bus and all
virtio devices attached to it in 'info qtree' then.
Uh, ok :o. Is that really important?
+ bus = (VirtIOS390Bus *)dev->qdev.parent_bus;
DO_UPCAST().
+VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus)
+{
+ return bus->console;
+}
What this is needed for?
We need to know the console to do early printk. I figured it'd be
better to have a function returning it, so we could possibly change
semantics later.
Alex