Commit Graph

2898 Commits

Author SHA1 Message Date
Gerd Hoffmann 508ef9367e eepro100: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:40 -05:00
Gerd Hoffmann 97b156213e virtio: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:40 -05:00
Gerd Hoffmann 254111ecc8 rtl8139: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:40 -05:00
Gerd Hoffmann 94e1a912b2 pcnet: split away lance.c (sparc32 code).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:40 -05:00
Gerd Hoffmann 7622483395 pcnet: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:39 -05:00
Gerd Hoffmann fbdaa00259 e1000: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:39 -05:00
Gerd Hoffmann a783cc3e55 ne2k_pci: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:39 -05:00
Gerd Hoffmann dc7aff118b prepare pci nic init path for qdev property configuration.
Initialization path will work with both converted and not-converted
drivers, so we can convert drivers one by one.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:38 -05:00
Gerd Hoffmann d8ed79aea7 qdev: add qdev_prop_exists()
Function test whenever a driver has a specific property.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:38 -05:00
Gerd Hoffmann 93db66850d ne2k_isa: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:38 -05:00
Gerd Hoffmann ed16ab5afa qdev/net: common nic property bits
Add a new type for properties common to all nics.
Add helper functions and macros to deal with it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:38 -05:00
Gerd Hoffmann 851bec091d qdev: add vlan property
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:37 -05:00
Gerd Hoffmann 2ef924b416 qdev: add netdev property
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:37 -05:00
Gerd Hoffmann 1503fff343 qdev: mac addr property fixups
Make the mac property use the newly added type for the mac address.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:37 -05:00
Stefan Weil 5fa9a0ae49 eepro100: Restructure code
This patch only moves about 150 lines of code from
function eepro100_cu_command to a new function action_command.

A goto statement was replaced by a for loop.

There are no functional changes. Nor did I change comments
starting with // (they will be removed by future patches).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27 12:28:34 -05:00
Blue Swirl f79ca11027 sparc32: tcx: remove unused include directive
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-25 15:04:43 +00:00
Blue Swirl b280fcdfde sparc32: convert sbi to VMState, vmsd and vmstate reset
Also remove unused include directive.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 20:08:43 +00:00
Blue Swirl 9a2070d3c0 sparc32: convert Sun4c interrupt controller to reset + vmsd
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 19:49:15 +00:00
Blue Swirl 78971d57bb sparc32: convert interrupt controller to reset + vmsd
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 19:44:37 +00:00
Blue Swirl 1a522e8a67 sparc32: convert IOMMU to reset + vmsd
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 19:39:17 +00:00
Blue Swirl 49ef6c9055 sparc32: convert DMA controller to reset + vmsd, fix reset on init
Add a missing call to reset on device init.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 19:35:32 +00:00
Blue Swirl 285e468d64 m48t59: convert to vmstate reset
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 19:22:56 +00:00
Blue Swirl 0e0bfeea68 sparc32: convert slavio_timer to reset + vmsd
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 17:35:13 +00:00
Blue Swirl 2be3783328 fdc: convert to reset + vmsd
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 16:56:20 +00:00
Blue Swirl 63235df8a1 esp: convert to reset + vmsd
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 16:34:21 +00:00
Blue Swirl 82d4c6e683 sparc32: convert cs4231 to VMState, vmsd and reset
Also remove unused include directive.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 16:20:32 +00:00
Blue Swirl 09330e90fe escc: add chipset docs
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 16:09:01 +00:00
Blue Swirl bdb78cae61 escc: convert to VMState, vmsd and reset
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 16:07:10 +00:00
Blue Swirl 5ac574c4d3 sparc32: add chipset docs for eccmemctl
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 15:27:28 +00:00
Blue Swirl 1795057a8f sparc32: convert slavio_misc to reset + vmsd
Also remove unused include directive.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 15:27:23 +00:00
Blue Swirl 0284dc5410 sparc32: convert eccmemctl to reset + vmsd
Also remove unused include directive.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 14:14:39 +00:00
Blue Swirl 1c6a50e71c sparc64: remove unused variables
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-24 09:15:22 +00:00
Gerd Hoffmann 59419663a1 qdev: add string property.
Patchworks-ID: 35755
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-21 13:35:37 -05:00
Amit Shah b6b8df560c char: rename CHR_EVENT_RESET to CHR_EVENT_OPENED
The char event RESET is emitted when a char device is opened.
Give it a better name.

Patchworks-ID: 35287
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-21 13:35:37 -05:00
Blue Swirl 747bbdf79f Suppress warnings about 'warn_unused_result' attribute directive
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-18 16:26:06 +00:00
Roy Tam 5041fccd8e MIPS jazz: create isa bus
As i8259 in mips_jazz.c is not correctly connected to the isa bus, the
mc146818rtc isa devices fails to be created.

Signed-off-by: Roy Tam <roytam@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-10-15 19:49:11 +02:00
Adam Lackorzynski bf854d65a5 multiboot: Limit number of multiboot modules
Add size checks to avoid overwriting the multiboot structure
when too many modules are loaded.

Patchworks-ID: 35700
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:04 -05:00
Adam Lackorzynski 3f3d583efd multiboot: Fix cmdline of modules
Fix address specified for cmdline value of module in multiboot structure.

Patchworks-ID: 35699
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:04 -05:00
Jan Kiszka de41ac924b pcnet: Extend hardware reset
Update the IRQ state and stop the poll timer on reset. Moreover,
register the reset function with qemu.

Patchworks-ID: 35462
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:04 -05:00
Mark McLoughlin 283c7c63f5 net: allow NICs to be connected to netdevs
Introduce a 'peer' member to VLANClientState as an alternative
to a vlan. The idea being that packets are transfered directly
from peer clients rather than going through a vlan.

Patchworks-ID: 35516
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:02 -05:00
Mark McLoughlin f6b134ac30 net: handle -netdevice options
Same as for -net except for:

- only tap, user, vde and socket types are supported
- the vlan parameter is not allowed
- the name parameter is not allowed but the id parameter is
required

Patchworks-ID: 35517
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:01 -05:00
Mark McLoughlin dea7b3b95a net: remove id field from NICInfo
Just use the name field instead since we now use the id paramater as
the name, if supplied. Only implication with this change is that if
id is not supplied, the value of the name paramater is used as an
id.

Patchworks-ID: 35512
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:00 -05:00
Mark McLoughlin 9844937122 hotplug: safely iterate bus's sibling list while removing a device
Without this, I'm seeing a segfault when unpluging a NIC.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Patchworks-ID: 35519
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:00 -05:00
Stefan Weil 3706c43f02 eepro100: Remove unused device status entries
Once upon the time when QEMU hacking was fun
there was a brave knight who wanted to have
a driver for a special intel nic.

So he started by cloning ne2000.c which also
meant that the new born eepro100.c was
immediately three years old.

Other knights who also wanted to have fun and
take their part in the battle thought that it
would be a good idea to remove stupid code
which says "missing nic load, missing nic save".

They saved everything they saw, man and women,
ne2000 code and runtime address offsets, and
put all saved elements in a prison called
vm data.

When the first knight came back and noticed
the unhappy prisoners, he wanted to set them
free. But the keepers of the keys told him
that they would have to stay there forever
for compatibility reasons.

So our brave knight now takes a new effort
to save the souls of the poor prisoners by
removing their names.

Their bodies will have to rot in the dungeons
of compatibility forever, watched by the
keepers of the keys.

Patchworks-ID: 35635
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15 09:32:00 -05:00
Artyom Tarasenko 6550f2e676 scsi disk block descriptor v2
The SCSI-2 documentation suggests, that although the block
descriptor is optional for an arbitrary SCSI-2 device (chapter 8.2.10,
http://ldkelley.com/SCSI2/SCSI2/SCSI2/SCSI2/SCSI2-08.html )
it is mandatory for a disk: chapters 9.1.2, 9.3.3
( http://ldkelley.com/SCSI2/SCSI2/SCSI2/SCSI2-09.html ) don't say
"optional" any more, just "The block descriptor in the MODE SENSE
data describes the block lengths that are used on the medium."

v2: limit the number of sectors reported in the block descriptor to 24 bits.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-14 18:31:02 +00:00
Blue Swirl 930f3fe11f Add some chipset doc links
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-13 18:56:27 +00:00
François Revol 2ca2078e28 Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.

Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:32 -05:00
Gerd Hoffmann b96bf49306 rom loader: also try filename as-is.
In case qemu_find_file fails try to open the file as-is.

Patchworks-ID: 35263
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:32 -05:00
Gerd Hoffmann 3c178e72e0 rom loader: fix sparc -kernel boot.
Changes:
(1) register pstrcpy_targphys() in rom list, it is used for kernel
command lines by a number of architectures.
(2) add rom_ptr() function to get a pointer for applying changes
to loaded images.  Needed for example to tell the linux kernel
where it finds the initrd image by updating the header.
(3) make sparc use rom_ptr for initrd setup.

booting sparc-test works now, and 'info roms' shows this:

(qemu) info roms
addr=0000000000000000 size=0x2a3828 mem=ram name="phdr #0: vmlinux-2.6.11+tcx"
addr=00000000007ff000 size=0x00000e mem=ram name="cmdline"
addr=0000000000800000 size=0x400000 mem=ram name="/root/qemu-test/sparc-test/linux.img"
addr=0000000070000000 size=0x0e4000 mem=rom name="phdr #0: /home/kraxel/projects/qemu/build-zfull/pc-bios/openbios-sparc32"

reboot via 'system_reset' works too.

Patchworks-ID: 35262
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:31 -05:00
Juan Quintela ce88f890bd TARGET_I386 is always defined if TARGET_X86_64 is defined
Patchworks-ID: 35378
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:31 -05:00
Juan Quintela d1570baa57 ide: BMDMAState don't need a pci_dev field anymore
Patchworks-ID: 35306
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:31 -05:00
Juan Quintela 0cde1b4ca0 ide: cmd646 ->unit has just the value that we want
Patchworks-ID: 35307
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:31 -05:00
Juan Quintela 61f58e5934 ide: cmd646 we can get the pci device with container_of
Patchworks-ID: 35305
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela 7e078316fd ide: 'secondary' field is only used by cmd646
Patchworks-ID: 35303
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela 58c0e7326e ide: PCIIDEState type field is not needed anymore
We have split the functions that needed it for cmd646

Patchworks-ID: 35302
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela 4c3df0ecc2 ide: split cmd646 and piix from pci.c
This patch splits cmd646 specific code from pci.c.
This patch splits piix4 specific code from pci.c.
And compile new piix.o and cmd646.o when they are needed.
The only change that is not code movemet is removal of cmd646 specific parts
in bmdma_readb/writeb for piix.

Patchworks-ID: 35301
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela 3e7e1558af ide: export needed ide-pci functions for split
Patchworks-ID: 35300
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela 65c0f1351f ide: create ide/pci.h for common ide pci definitions
Patchworks-ID: 35299
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela 18c0fb307c ide: remove uselsess casts from void *
Patchworks-ID: 35298
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela edcca5a3b8 ide: Remove duplicated definitions
Patchworks-ID: 35297
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela e6a7830acd ide: Remove cast in pci_register_bar
We already have a PCIDevice at that point

Patchworks-ID: 35296
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
Juan Quintela 61073e0f53 ide: change cast to DO_UPCAST
Patchworks-ID: 35293
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-12 09:42:30 -05:00
malc cef290b878 Fix Windows host breakage by 45a50b1668 (TeLeMan)
Signed-off-by: malc <av1474@comtv.ru>
2009-10-10 19:02:40 +04:00
Jan Kiszka ad323081aa pcnet: Restart poll timer on pcnet_start
Just like we call into pcnet_poll_timer on stop, we need to call it on
start to trigger the setup of the poll timer.

Patchworks-ID: 35313
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-08 21:17:22 -05:00
Jan Kiszka efb56cf7c2 pcnet: Drop unused recv_pos field
This state field was never used, simply remained 0. Drop it from the
PCNetState and update the save/restore code accordingly, keeping
backward compatibility.

Patchworks-ID: 35314
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-08 21:17:21 -05:00
Markus Armbruster 5c17ca2505 Clean up test for qdev_init() failure
Some callers test for != 0, some for < 0.  Normalize to < 0.

Patchworks-ID: 35171
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-07 08:54:55 -05:00
Markus Armbruster dde8bbb44d Warn if value of qdev_init() isn't checked
After qdev_init() fails, the device is gone.  Failure to check runs a
high risk of use-after-free.

Patchworks-ID: 35166
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-07 08:54:55 -05:00
Markus Armbruster 3f66aa9c07 Make isa_create() terminate program on failure
Callers don't check the return value anyway.

Patchworks-ID: 35172
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-07 08:54:54 -05:00
Markus Armbruster e23a1b33b5 New qdev_init_nofail()
Like qdev_init(), but terminate program via hw_error() instead of
returning an error value.

Use it instead of qdev_init() where terminating the program on failure
is okay, either because it's during machine construction, or because
we know that failure can't happen.

Because relying in the latter is somewhat unclean, and the former is
not always obvious, it would be nice to go back to qdev_init() in the
not-so-obvious cases, only with proper error handling.  I'm leaving
that for another day, because it involves making sure that error
values are properly checked by all callers.

Patchworks-ID: 35168
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-07 08:54:54 -05:00
Markus Armbruster 33e66b86d8 Check return value of qdev_init()
But do so only where it may actually fail.  Leave the rest for the
next commit.

Patchworks-ID: 35167
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-07 08:54:54 -05:00
Markus Armbruster 18cfeb52d1 Make qdev_init() destroy the device on failure
Before, every caller had to do this.  Only two actually did.

Patchworks-ID: 35170
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-07 08:54:53 -05:00
Gerd Hoffmann cdaed7c793 qdev: move comment
Move comment back next to main_system_bus to avoid confusion.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:46:10 -05:00
Michael S. Tsirkin 0f457d91c4 qemu/pci: make pci not depend on msix
Making pci device cleanup msix automatically makes pci.c depend on
msix.c, which is IMO messy.  Since devices do msix_init it's easy and
natural for them to also do msix_uninit.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:13 -05:00
Michael S. Tsirkin 05fcfada5e qemu/pci: clarify pci config load routine
PCI load routine has to be called with size equal to 256 (otherwise it
will crash in weird ways).  So assert this, making code clearer.
Also avoid dynamically sized array on stack - good for portability.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:13 -05:00
Mark McLoughlin dc1c9fe8b7 Final net cleanup after conversion to QemuOpts
Now that net_client_init() has no users, kill it off and rename
net_client_init_from_opts().

There is no further need for the old code in net_client_parse() either.
We use qemu_opts_parse() 'firstname' facitity for that. Instead, move
the special handling of the 'vmchannel' type there.

Simplify the vl.c code into merely call net_client_parse() for each
-net command line option and then calling net_init_clients() later
to iterate over the options and create the clients.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:13 -05:00
Mark McLoughlin c59c7ea947 Port PCI NIC hotplug to QemuOpts
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:13 -05:00
Mark McLoughlin 9203f5202b Make NICInfo string fields non-const
We now only assign strdup()ed strings to these fields, never static
strings.

aliguori: fix build for ppc_prep and mips_jazz

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:10 -05:00
Anthony Liguori e52eb611db Revert "Fix exit on 'pci_add' Monitor command"
This reverts commit 0148fde54c.

As requested by Luiz.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:09 -05:00
Gerd Hoffmann 45a50b1668 Reorganize option rom (+linux kernel) loading.
This patch adds infrastructure to maintain memory regions which must be
restored on reset.  That includes roms (vga bios and option roms on pc),
but is also used when loading linux kernels directly.  Features:

  - loading files is supported.
  - passing blobs is supported.
  - target address range is supported (for optionrom area).
  - fixed target memory address is supported (linux kernel).

New in v2:
  - writes to ROM are done only at initial boot.
  - also handle aout and uimage loaders.
  - drop unused fread_targphys() function.

The final memory layout is created once all memory regions are
registered.  The option roms get addresses assigned and the
registered regions are checked against overlaps.  Finally all data
is copyed to the guest memory.

Advantages:

  (1) Filling memory on initial boot and on reset takes the same
      code path, making reset more robust.
  (2) The need to keep track of the option rom load address is gone.
  (3) Due to (2) option roms can be loaded outside pc_init().  This
      allows to move the pxe rom loading into the nic drivers for
      example.

Additional bonus:  There is a 'info roms' monitor command now.

The patch also switches over pc.c and removes the
option_rom_setup_reset() and load_option_rom() functions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:08 -05:00
=?UTF-8?q?Reimar=20D=C3=B6ffinger?= dbbaaff686 eepro100: support 16 bit read from SCBCmd (== 2)
This is necessary to support OpenBSD 4.2 install, without
this change it triggers an assert.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06 14:36:08 -05:00
Justin M. Forbes 850810d01b Improve error reporting on file access
By making the error reporting include strerror(errno), it gives the user
a bit more indication as to why qemu failed.  This is particularly
important for people running qemu as a non root user.

Signed-off-by: Justin M. Forbes <jforbes@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 14:02:08 -05:00
Markus Armbruster 499cf1027f Rename pci_create_noinit() to pci_create()
It's qdev_create() specialized for PCI, so name it accordingly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Markus Armbruster 3312958dba pci_create() is now unused, remove it
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Markus Armbruster 07caea315a Fix pci_add nic not to exit on bad model
Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to
create the NIC.  When MODEL is unknown or "?", this prints to stderr
and terminates the program.

Change pci_nic_init() not to treat "?" specially, and to return NULL
on failure.  Switch uses during startup to new convenience wrapper
pci_nic_init_nofail(), which behaves just like pci_nic_init() used to
do.

Bonus bug fix: we now check for qdev_init() failing there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Markus Armbruster 9ee05825d9 Make it obvious that pci_nic_init() can't fail
Before this patch, pci_nic_init() returns NULL when it can't find the
model in pci_nic_models[].  Except this can't happen, because
qemu_check_nic_model_list() just searched for model in
pci_nic_models[], and terminated the program on failure.

Repeating the search here is pointless.  Instead, change
qemu_check_nic_model_list() to return the model's array index.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Markus Armbruster 49bd1458da Fix pci_add storage not to exit on bad first argument
Monitor command "pci_add ADDR storage ..." does its work in
qemu_pci_hot_add_nic().  It called pci_create(..., ADDR) to create the
device.  That's wrong, because pci_create() terminates the program
when ADDR is invalid.

Use pci_get_bus_devfn() and pci_create_noinit() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Markus Armbruster 48042d861e Fix pci_vga_init() not to ignore bus argument
Commit a414c306 converted all VGA devices to qdev.  It used
pci_create_simple() for all devices, except for this one it used
pci_create().  That's wrong, because it uses PCI bus#0 regardless of
the bus argument.  Fix by switching to pci_create_noinit().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Gleb Natapov 19a2223fea set correct CS seg limit and flags on sipi
TCG works with incorrect values somehow.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
=?UTF-8?q?Reimar=20D=C3=B6ffinger?= f4e94dfefb Set revision in eeprom correctly for 82557 versions.
This is necessary to make FreeBSD recognize the device as 82557 - otherwise its
driver will use unsupported features and fail to work.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Amit Shah 25fe365483 virtio-pci: return error if virtio_console_init fails
Currently only one virtio_console device is supported. Trying to add
multiple devices fails and such failure should be reported back to the
qdev init functions.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:53 -05:00
Amit Shah c8cd1fcd66 qdev: show name of device that fails init
When initialising a device fails, show the name of the failing device.

The current behaviour is to silently exit on such errors.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:52 -05:00
Kevin Wolf 7f1e9d4e13 eepro100: Don't allow guests to fail assertions
The idea of using assert() for input validation is rather questionable.
Let's remove it from eepro100, so that guests need to find more interesting
ways if they want to crash qemu.

This patch replaces asserts that are directly dependent on guest-accessible
data by other means of error handling.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:52 -05:00
Michael S. Tsirkin 85352471ce qemu/virtio-pci: remove unnecessary check
it's safe to call msix_write_config if msix
is disabled, so call it unconditionally on
pci config write.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:52 -05:00
Michael S. Tsirkin 5a1fc5e852 qemu: clean up target page usage in msix
Since cpu_register_phys_memory does not require size to be a multiple of
target page size, simply make msix page size 0x1000.  Do this in msix,
reverting part of 5e520a7d50, as we no
longer have to pass target page around.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:52 -05:00
Michael S. Tsirkin c0b1905b28 qemu/pci: reset device registers on bus reset
Reset BARs and a couple of other registers on bus reset, as per PCI
spec.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:51 -05:00
Michael S. Tsirkin 5330de099a qemu/pci: refactor code/symbolic constants
refactor code slightly, adding symbolic constants and functions, and
using macros where possible.  This will also make following reset
patches easier.

No functional changes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:51 -05:00
Michael S. Tsirkin e489030df2 qemu/virtio: fix reset with device removal
virtio pci registers its own reset handler, but fails to unregister it,
which will lead to crashes after device removal.  Solve this problem by
switching to qdev reset handler, which is automatically unregistered.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:50 -05:00
Michael S. Tsirkin 7f23f812c4 qemu/qdev: type safety in reset handler
Add type safety to qdev reset handlers, by declaring them as
DeviceState * rather than void *.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:50 -05:00
Gerd Hoffmann ac0be99800 serial: convert isa to qdev
Everything using standard isa I/O ports and IRQ windup is considerd
being an actual isa device.  That are all serial_init() users except
mips_mipssim() which seems to have a non-standard IRQ windup.

baud rate is fixed at 115200 now as no caller passed in something else.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:50 -05:00
Gerd Hoffmann 41b5e892b7 qdev: don't crash on unset drive properties.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:50 -05:00
Gerd Hoffmann 99244fa151 floppy: move dma setup + drive connect to fdctrl_init_common()
isa-fdc is completely qdev-ified with this patch applied, all
configuration uses properties.

sysbus-fdc needs dma_channel config fixed.  There is only one user
(mips_jazz) which uses dma channel 0.  Can anyone knowing this
platform suggest how to deal with it?  Is hardcoding fine?

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:50 -05:00
Gerd Hoffmann fd8014e132 floppy: add drive properties.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann ef80b46623 store a pointer to QemuOpts in DeviceState, release it when zapping a device.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann 7101174e5c allow if=none for drive_add
Allow adding unconnected host drives by specifying if=none like it is
possible with -drive.  They can be put in use with drive attributes,
like this:

  drive_add dummy if=none,id=mydisk,file=/some/disk.img
  device_add virtio-blk-pci,drive=mydisk

which is the monitor aequivalent to these command line switches:

  -drive if=none,id=mydisk,file=/some/disk.img
  -device virtio-blk-pci,drive=mydisk

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann 4db49dc087 refactor drive_hot_add
move pci device lookup into the "case IF_SCSI" section, so we
can do something else for other interface types.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann 56a1493880 drive cleanup fixes.
Changes:
  * drive_uninit() wants a DriveInfo now.
  * drive_uninit() also calls bdrv_delete(),
    so callers don't need to do that.
  * drive_uninit() calls are moved over to the ->exit()
    callbacks, destroy_bdrvs() is zapped.
  * setting bdrv->private is not needed any more as the
    only user (destroy_bdrvs) is gone.
  * usb-storage needs no drive_uninit, scsi-disk will
    handle that.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann 3f84865ade pci: windup acpi-based hotplug
Switch over acpi-based PCI hotplug for pc over to the new
qdev-based pci hotplugging.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann ee995ffbf7 pci: hotplug windup
Create qdev infrastructure for pci hotplug.  PCI bus implementations
must register a handler for hotplug.  Creating a new PCI device will
automagically hot-plug it in case the PCI bus in question supports this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann cb23117be7 scsi: hotplug windup
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:49 -05:00
Gerd Hoffmann ef816d831f usb: hotplug windup
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann 3418bd25e1 qdev hotplug: infrastructure and monitor commands.
Adds device_add and device_del commands.  device_add accepts accepts
the same syntax like the -device command line switch.  device_del
expects a device id.  So you should tag your devices with ids if you
want to remove them later on, like this:

  device_add pci-ohci,id=ohci
  device_del ohci

Unplugging via pci_del or usb_del works too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann a8e662b547 usb: hook unplug into qdev, cleanups + fixes.
Hook into DeviceInfo->exit().

handle_destroy() must not free the state struct, this is handled
by the new usb_qdev_exit() function now.

qdev_free(usb_device) works now.

Fix usb hub to qdev_free() all connected devices on unplug.
Unplugging a usb hub works now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann e3936fa574 pci: move unregister from PCIDevice to PCIDeviceInfo
One more cleanup while being at it ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann a36a344dcd pci: use qdev for device destruction.
pci_unregister_device is static now and hooked into Devicestate->exit.
qdev_free(pci_device) works now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann 01985dcf38 Implement scsi device destruction
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann d29275f103 Add exit callback to DeviceInfo.
This adds a exit callback for device destruction to DeviceInfo, so
we can hook cleanups into qdev device destruction.

Followup patches will put that into use.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann 131ec1bd7d qdev: device free fixups.
Two bug fixes:
 * When freeing a device we unregister even stuff we didn't register in
   the first place because the ->init() callback failed.
 * When freeing a device with child busses attached, we fail to zap the
   child bus (and the devices attached to it).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:48 -05:00
Gerd Hoffmann 021f067459 parallel: convert isa to qdev
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:47 -05:00
Gerd Hoffmann 7cd9eee0f6 piix_pci: kill PIIX3IrqState
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:47 -05:00
Gerd Hoffmann 0358718275 convert pci bridge to qdev
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:47 -05:00
Gerd Hoffmann 21eea4b38f support inplace allocation for pci bus, split irq init.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:47 -05:00
Gerd Hoffmann 1f850f1064 switch ide bus to inplace allocation.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:47 -05:00
Gerd Hoffmann b2317837f0 switch usb bus to inplace allocation.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:46 -05:00
Gerd Hoffmann ca9c39faed switch scsi bus to inplace allocation.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:46 -05:00
Gerd Hoffmann cd739fb6e9 allow qdev busses allocations be inplace
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:45 -05:00
Jan Kiszka 6875204c78 Enable host-clock-based RTC
Switch RTC emulations to the new host_clock instead of vm_clock by
default. This has the advantage that the emulated RTC will follow
automatically the host time while it might be tuned via NTP. vm_clock
can still be selected by passing '-rtc clock=vm' on the command line.

Note that some RTC emulations (at least M48T59) already use the host
time unconditionally while others (namely MC146818) do not. This patch
introduces the required infrastructure for selecting the base clock but
only converts MC146818 for now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:45 -05:00
Luiz Capitulino 0148fde54c Fix exit on 'pci_add' Monitor command
If the user issues one of the following commands to the Monitor:

pci_add pci_addr=auto nic model=None
pci_add pci_addr=auto nic model=?

QEMU will exit, because the function used to perform sanity
checks (qemu_check_nic_model_list()) exits on error.

This function is used by the startup code, where it makes
sense to exit on error, but in the Monitor it doesn't.

Changing qemu_check_nic_model_list() to not exit on error
is not possible though, as it's used by the board init
code (the PC one), where all board specific code must have
void return.

The way I've chosen to fix this was to introduce a new function
called pci_nic_supported(), which checks if the NIC is supported
and returns true or false accordingly.

The new function is used only by the Monitor, it performs the
necessary check and returns an error in case the NIC is not
supported, thus qemu_check_nic_model_list()'s exit is never trigged.

The following should be observed:

1. Only the specified NIC is checked, the default one is assumed
to be supported

2. The NIC query command (model=?) won't work with pci_add, the
right way to do this with the Monitor is to add a new command

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:44 -05:00
Jan Kiszka d5b61ddd65 musicpal: Add VMState support
Register all relevant fields of Musicpal device states with the VMState
framework. This involves a few type changes of state variables.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:44 -05:00
Jan Kiszka c88d6bded6 musicpal: Make PIT emulation more robust
Stop the periodic timers of the PIT on reset, disabling via the control
register and invalid parameters.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Jan Kiszka 267c48404f musicpal: True reset support for audio device
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Jan Kiszka 30624c926c musicpal: True reset support for GPIO
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Jan Kiszka 49fedd0d64 musicpal: Coding style fixes
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Jan Kiszka 243cd13ca9 musicpal: Clean up typecasts
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Jan Kiszka 708afdf3a4 musicpal: Rework GPIO input events
The qdev_gpio conversion of 343ec8e caused come polarity mismatch of key
event pins and left an overly complex solution behind. Take this chance
and refactor the GPIO input system of the Musicpal, moving it closer to
reality:
 - Instantiate all 32 GPIO input pins and do the routing only via
   qdev_connect_gpio_out.
 - Implement IMR and IER registers. They manage the GPIO pin IRQ. IMR
   seems to enable IRQs on rising edges, IER on falling ones. At least
   this matches what the Musicpal fireware require.
 - Move key pin logic inversion from the GPIO layer to musicpal_key.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Jan Kiszka 2e87c5b937 musicpal: Catch null TX qeueues
They likely represent invalid queues that should be skipped. We already
do this for RX queues. Wish I had a spec...

Credits go to malc for analyzing the issue and suggesting this fix.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Juan Quintela f11f6a5fff vmstate: Add suppot for field_exist() test
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:43 -05:00
Juan Quintela f89a8e4ede Add *TL functions to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:42 -05:00
Juan Quintela 6b0e766f4c vmstate: remove i2c_slave_load/save
All its users moved to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:39 -05:00
Juan Quintela aa1e3b286c vmstate: port lm832x device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:39 -05:00
Juan Quintela e69f0602ee lm832x: make fields to have the same types that they are saved/loaded
They were saved as uint8_t already.  To make things simpler, I just
reg == -1 used to indicate an error, I create LM832x_GENERAL_ERROR
with vale 0xff to represet it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:39 -05:00
Juan Quintela 19df438b63 vmstate: add support for arrays of pointers
We need this to send arrays of timers

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:39 -05:00
Juan Quintela f0495f56c9 vmstate: port twl92230 device
Just don't look.  struct tm members are ints' and they are sent as uint16_t.
VMState code complains as it should.  Have to create hacky int32_as_uint16
type.  Don't ever think about copying it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:39 -05:00
Juan Quintela b53d44e513 twl92230: change pwrbtn_state to uint8_t
its value is always the level of an interrupt, 0 or 1

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela 371a446863 vmstate: port tmp105 device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela 6f3a7798ec tmp105: change len and alorm to uint8_t
They were using only with very small integers, and they are sent/read as
bytes.  They can't become negative as far as I can see

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela 289070c715 vmstate: create VMSTATE_INT16_ARRAY
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela aed7278dbd vmstate: port ssd0303 device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela 0211364d37 vmstate: port pxa2xx_i2c device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela 840e9cef84 vmstate: create VMSTATE_STRUCT_POINTER
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela 7cb45faabd vmstate: port max7310 device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela c1d803b354 vmstate: port wm8750 device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela 1894839f86 vmstate: create VMSTATE_I2C_SLAVE
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela b6bd0bdc55 vmstate: add uint8 array
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:38 -05:00
Juan Quintela bcbe8068b7 vmstate: port i2c_slave device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:37 -05:00
Juan Quintela 8d0eb050d6 vmstate: port i2c_bus device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:37 -05:00
Juan Quintela 5b7f53270a i2c: addresses are load/save as uint8_t values, change types to reflect this
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:37 -05:00
Juan Quintela c7cc172d20 qdev: Add support for uint8_t
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:37 -05:00
Juan Quintela 6680f01c8c vmstate: Add support for sending partial arrays
This one is needed for changees happening on fdc.  It allows you to send
arrays of structs whose size we want to send it is another field with type
uint8_t.  (If you have been able to read the whole sentence without
stoping for breathing, you can use it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:37 -05:00
Juan Quintela db596c53a1 vmstate: remove ps2_kbd_load_old()
Now that we have version_id on post_load() we don't need the old load
function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:37 -05:00
Juan Quintela d4bfa4d7c6 vmstate: remove const from pre_save() functions
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:37 -05:00
Juan Quintela e59fb3741b vmstate: add version_id argument to post_load
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:36 -05:00
Juan Quintela 84e2e3eb5f vmstate: remove const for put operations
In a later patch, we introduce pre_save() and post_save() functions.
The whole point of that operation is to change things in the state.
Without this patch, we have to remove the const qualifier in each
use with a cast

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:36 -05:00
Juan Quintela 50af324697 vga: move back dirty_log functions to vga.c
They are needed there on qemu-kvm.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:36 -05:00
Juan Quintela f22f5b077c cirrus_vga: also assign gr0/1 when writting shadow_gr0/1
This is a regression/bug caused by previous vga_cleanup.  This fixes
Ubuntu installer reported by:
	 Pierre Riteau

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:36 -05:00
Aurelien Jarno 4e3db91706 Revert "eepro100: Remove unused device status entries"
This reverts commit 3031efabd0.
2009-10-05 16:29:33 +02:00
Stefan Weil c4c270e227 eepro100: Add more i825xx devices
The new devices added here are still not functional -
partially because some patches are still missing,
partially because I cannot test them. Nevertheless
they belong to the same family and will be supported
by this driver some day.

As soon as they work, they will also be added to hw/pci.c.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-10-04 14:59:33 +02:00
Stefan Weil 3031efabd0 eepro100: Remove unused device status entries
A lot of entries are unused (they were added by copy + paste
from other drivers during development of eepro100.c).

Removing them from nic_save, nic_load makes any
old saved status incompatible, so a new version
for the virtual machine data was needed, too.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-10-04 14:54:44 +02:00
Michael S. Tsirkin 317b7e67db hw/omap_dma: add matching {} in if 0
MULTI_REQ is never defined, so it doesn't matter much, but since
we have an if statement there, let's add {} to clarify what it
should do if it's uncommented, and indent the code properly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-10-04 13:24:45 +02:00
Anthony Liguori c227f0995e Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem.  Something
like this _must_ be presented on the list first so people can provide input
and cope with it.

This reverts commit 99a0949b72.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01 16:12:16 -05:00
malc 99a0949b72 Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the time
being.

Signed-off-by: malc <av1474@comtv.ru>
2009-10-01 22:45:02 +04:00
Michael S. Tsirkin 084bd07198 escc: fix another coding style nit
Fix another place with =- to be "= -".
to avoid confusion with old-style "-="
(which we also have, and needs to be fixed).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-30 18:56:44 +00:00
Michael S. Tsirkin bdd7e1bc6f twl92230: fix old style increment/decrement usage
Modern compilers do not parse "=-" as decrement:
you must use "-=" for that. Same for "=+"/"+=".

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-30 18:45:50 +00:00
Michael S. Tsirkin f90554ad75 omap_dma: fix unbalanced { in commented out code
Fix unbalanced {} in commented out code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-30 18:45:50 +00:00
Michael S. Tsirkin a0d98a712f escc: fix coding style nit
Put space between = and - assigning a negative number
to avoid confusion with old-style "-="
(which we also have, and needs to be fixed).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-30 18:45:50 +00:00
Stefan Weil 067d01de29 eepro100: Fix format strings in debug messages
size_t arguments need %zu instead of %d.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-26 23:48:23 +02:00
Stefan Weil 41cbc23c5c eepro100: Replace sprintf by snprintf
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-26 23:48:17 +02:00
Stefan Weil fd9ae2ec06 eepro100: Remove unused code
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-26 23:48:10 +02:00
Stefan Weil aac443e66d eepro100: Enhanced logging and comments
* Use TRACE macro to allow different logging flags.
* Add new debugging messages and clean existing ones.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-26 23:48:03 +02:00
Mark McLoughlin 3df04ac3c6 Fix coding style issue
Replace:

  if (-1 == foo())

with:

  if (foo() == -1)

While this coding style is not in direct contravention of our currently
ratified CODING_STYLE treaty, it could be argued that the Article 3 of
the European Convention on Human Rights (prohibiting torture and "inhuman
or degrading treatment") reads on the matter.

[This commit message was brought to you without humour, as is evidenced
by the absence of any emoticons]

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-25 19:57:51 +00:00
Juan Quintela 3897293825 gcc wants 1st static and then const
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-25 19:52:06 +00:00
Juan Quintela 86178a576b static and inline should came before the type of the functions
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-25 19:51:45 +00:00
Juan Quintela 2b321d697b Use proper typedef syntax
Why this ever compiled is a mistery to me.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-25 19:51:09 +00:00
Stefan Weil 979ba184aa Fix spelling in comment
replace Convery -> Convert

Cc: Paul Brook <paul@codesourcery.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-25 16:34:20 +02:00
Stefan Weil d89c682f20 Suppress some variants of English in comments
Replace surpress, supress by suppress.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-25 16:31:35 +02:00
Blue Swirl 16d55035d7 Fix Sparse warning about invalid access past the end of 'mode'
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-21 20:21:53 +00:00
Blue Swirl 284b08f174 Fix Sparse warning about obsolete struct initializer
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-21 19:50:05 +00:00
Blue Swirl 6f4fc3679c Add 'static' to please Sparse
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-21 18:39:26 +00:00
Blue Swirl b9d38e9510 Fix Sparse warnings about using plain integer as NULL pointer
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-21 18:11:34 +00:00
Blue Swirl bd390e6425 Compile ne2000 only once
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-20 16:19:32 +00:00
Blue Swirl afcea8cbde ioports: remove unused env parameter and compile only once
The CPU state parameter is not used, remove it and adjust callers. Now we
can compile ioport.c once for all targets.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-20 16:05:47 +00:00
Blue Swirl 5e520a7d50 Compile msix only once
Get page size in device init.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-20 15:35:55 +00:00
Blue Swirl ca20cf32ab Compile loader only once
Callers must pass ELF machine, byte swapping and symbol LSB clearing
information to ELF loader. A.out loader needs page size information, pass
that too as a parameter.

Extract prototypes to a separate file. Move loader.[ch] and elf_ops.h under hw.

Adjust callers. Also use target_phys_addr_t instead of target_ulong for
addresses: loader addresses aren't virtual.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-20 14:58:02 +00:00
Blue Swirl 9801c7b436 Compile wdt_i6300esb only once
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-20 08:02:28 +00:00
Blue Swirl cdd0935cbd PPC: make system bus parent of PCI bus
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-19 17:59:10 +00:00
Blue Swirl cc9952f3ac ESP: convert to VMState
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-19 15:44:50 +00:00
malc 4f4cc0efde audio: use muldiv64 where it makes sense
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
Juergen Lock 2d6ee8e7e1 qemu serial: lost tx irqs (affecting FreeBSD's new uart(4) driver)
Well one problem seems to be the rx condition,
        ... if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR))
is not enough to trigger an irq, yet still causes the following
conditions not to be checked anymore at all.

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Acked-by: Jan Kiszka <jan.kiszka@web.de>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-16 20:58:56 +02:00
Aurelien Jarno e1a0e47f76 escc: fix IRQ routing, broken by 6c319c8222
The logic of Zilog makes channel B the first device and channel A the
second one.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-16 00:15:33 +02:00
Gerd Hoffmann dea21e97f4 ide/isa: convert to qdev.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-15 20:05:00 +00:00
Gerd Hoffmann feef310217 ide/pci: convert to qdev.
With this patch applied ide drives (when attached to a pci adapter) can
be created via -device, like this:

  -drive if=none,id=mydisk,file=/path/to/disk.img
  -device ide-drive,drive=mydisk,bus=ide.0,unit=0

Note that creating a master on ide1 doesn't work that way.  That is a
side effect of qemu creating a cdrom automagically even if you don't
ask for it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-15 20:04:24 +00:00