aboutsummaryrefslogtreecommitdiffstats
path: root/hw/qdev.h
AgeCommit message (Collapse)AuthorFilesLines
2009-09-12Fix sys-queue.h conflict for goodBlue Swirl1-5/+5
Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-10qdev: add property type for 32bit signed integers.Gerd Hoffmann1-0/+5
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-09qdev: integrate vmstateGerd Hoffmann1-0/+3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09qdev: integrate resetGerd Hoffmann1-0/+3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09qdev/scsi: add scsi bus support to qdev, convert drivers.Gerd Hoffmann1-4/+0
* Add SCSIBus. * Add SCSIDeviceInfo, move device callbacks here. * add qdev/scsi helper functions. * convert drivers. Adding scsi disks via -device works now, i.e. you can do: -drive id=sda,if=none,... -device lsi -device scsi-disk,drive=sda legacy command lines (-drive if=scsi,...) continue to work. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27qdev: add return value to init() callbacks.Gerd Hoffmann1-2/+2
Sorry folks, but it has to be. One more of these invasive qdev patches. We have a serious design bug in the qdev interface: device init callbacks can't signal failure because the init() callback has no return value. This patch fixes it. We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault. This patch fixes it. With usb+scsi being converted to qdev we'll get more devices where the init callback can fail for various reasons. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27move useful type definitons to osdep.hJuan Quintela1-3/+0
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-10Fix virtio-blkAnthony Liguori1-1/+1
Reported-by: Christoph Hellwig Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-10rename "info qdrv" to "info qdm"Gerd Hoffmann1-1/+3
As requested by avi: driver != device model. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-08-10qdev/prop: add CharDriverState property.Gerd Hoffmann1-0/+6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-08-10qdev/prop: macros for creating typechecked properties.Gerd Hoffmann1-0/+38
There are DEFINE_PROP_$TYPE("name", struct, field, default) macros for each property type. These macros link the qdev_prop_$name struct to the type used by that property. typeof(struct->field) is verifyed to be the correct one for the given property. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-08-10qdev/prop: add drive property.Gerd Hoffmann1-0/+4
Adds a (host) drive property, intended to be used by virtual disk backend drivers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-08-10QemuOpts: switch over -device.Gerd Hoffmann1-2/+3
Make -device switch use the QemuOpts framework. Everything should continue to work like it did before. New: "-set device.$id.$property=$value" works. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-07-30qdev/core: add monitor command to list all driversGerd Hoffmann1-0/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27qdev: bus walker + qdev_device_add()Gerd Hoffmann1-0/+1
This patch implements a parser and qdev tree walker for bus paths and adds qdev_device_add on top of this. A bus path can be: (1) full path, i.e. /i440FX-pcihost/pci.0/lsi/scsi.0 (2) bus name, i.e. "scsi.0". Best used together with id= to make sure this is unique. (3) relative path starting with a bus name, i.e. "pci.0/lsi/scsi.0" For the (common) case of a single child bus being attached to a device it is enougth to specify the device only, i.e. "pci.0/lsi" will be accepted too. qdev_device_add() adds devices and accepts bus= parameters to find the bus the device should be attached to. Without bus= being specified it takes the first bus it finds where the device can be attached to (i.e. first pci bus for pci devices, ...). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27qdev: create default bus names.Gerd Hoffmann1-0/+1
Create a default bus name if none is passed to qbus_create(). If the parent device has DeviceState->id set it will be used to create the bus name,. i.e. -device lsi,id=foo will give you a scsi bus named "foo.0". If there is no id BusInfo->name (lowercased) will be used instead, i.e. -device lsi will give you a scsi bus named "scsi.0". A scsi adapter with two scsi busses would have "scsi.0" and "scsi.1" or "$id.0" and "$id.1" busses. The numbers of the child busses are per device, i.e. when adding two lsi adapters both will have a "*.0" child bus. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27qdev/prop: add pci devfn propertyGerd Hoffmann1-0/+1
So we can parse "$slot.$fn" strings into devfn numbers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-21qdev: add 64 bit typeBlue Swirl1-0/+4
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-17Suppress a Sparse warningBlue Swirl1-0/+3
Move the export to a file used by both qdev.c and sysbus.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-16qdev: add user-specified identifier to devices.Gerd Hoffmann1-0/+1
Add id field to DeviceState. Make "info qtree" print it. This helps users and management apps identifying devices in monitor output, which is especially useful with otherwise identical devices such as two virtio disks. This patch doesn't add a way to set the id, followup patches will do. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16qdev: add no_user, alias and descGerd Hoffmann1-0/+3
no_user: prevent users from adding certain devices. desc: description of the device. alias: to allow user friendly shortcuts on the command line, i.e. -device usbmouse instead of -device "QEMU USB Mouse" or -device lsi instead of -device lsi53c895a Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16qdev/compat: compat property infrastructure.Gerd Hoffmann1-0/+11
This add support for switching devices into a compatibility mode using device properties. Machine types can have a list of properties for specific devices attached to allow the easy creation of machine types compatible to older qemu versions. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16qdev: rework device properties.Gerd Hoffmann1-25/+48
This patch is a major overhaul of the device properties. The properties are saved directly in the device state struct now, the linked list of property values is gone. Advantages: * We don't have to maintain the list with the property values. * The value in the property list and the value actually used by the device can't go out of sync any more (used to happen for the pci.devfn == -1 case) because there is only one place where the value is stored. * A record describing the property is required now, you can't set random properties any more. There are bus-specific and device-specific properties. The former should be used for properties common to all bus drivers. Typical use case is bus addressing, i.e. pci.devfn and i2c.address. Properties have a PropertyInfo struct attached with name, size and function pointers to parse and print properties. A few common property types have PropertyInfos defined in qdev-properties.c. Drivers are free to implement their own very special property parsers if needed. Properties can have default values. If unset they are zero-filled. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-09qdev: remove DeviceTypeGerd Hoffmann1-4/+3
The only purpose DeviceType serves is creating a linked list of DeviceInfo structs. This removes DeviceType and add a next field to DeviceInfo instead, so the DeviceInfo structs can be changed that way. Elimitates a pointless extra level of indirection. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-07-09qdev: replace bus_type enum with bus_info struct.Gerd Hoffmann1-12/+11
BusInfo is filled with name and size (pretty much like I did for DeviceInfo as well). There is also a function pointer to print bus-specific device information to the monitor. sysbus is hooked up there, I've also added a print function for PCI. Device creation is slightly modified as well: The device type search loop now also checks the bus type while scanning the list instead of complaining thereafter in case of a mismatch. This effectively gives each bus a private namespace for device names. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-11qdev: move name+size into DeviceInfo (v2)Gerd Hoffmann1-2/+6
Rationale: move device information from code to data structures. v2: Adapt the drivers missed in the first version. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-05qdev: add monitor command to dump the tree.Gerd Hoffmann1-0/+5
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-05Record device property typesPaul Brook1-0/+15
Record device property types, and provide a list of properties at device registration time. Add a "device" property type that holds a reference to annother device. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-04qdev: kill DeviceState->nameGerd Hoffmann1-1/+0
is redundant with DeviceState->type->name Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-05-26Remove qdev irq sink handlingPaul Brook1-4/+1
We have both IRQ sinks and GPIO inputs. These are in principle exactly the same thing, so remove the former. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-23Add common BusStatePaul Brook1-12/+42
Implement and use a common device bus state. The main side-effect is that creating a bus and attaching it to a parent device are no longer separate operations. For legacy code we allow a NULL parent, but that should go away eventually. Also tweak creation code to veriry theat a device in on the right bus. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-17Consistently use uint64_t for int propertiesPaul Brook1-1/+1
I apparently failed to do this properly on the first attempt. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14PCI network qdev conversionPaul Brook1-0/+2
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14qdev scsi bus infrastructurePaul Brook1-0/+4
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14qdev child bus supportPaul Brook1-0/+6
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14Basic qdev infrastructure.Paul Brook1-0/+67
Signed-off-by: Paul Brook <paul@codesourcery.com>