Commit Graph

2875 Commits

Author SHA1 Message Date
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
Gerd Hoffmann 9a43dba0d6 ide/pci: fix indention
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-15 20:00:53 +00:00
Gerd Hoffmann da4d04197a ide/qdev: add ide bus.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-15 19:23:34 +00:00
Gerd Hoffmann 88804180fd split away drive init from ide_init2()
This allows the ide bus being initialized without drives attached
and the drives being attached and initialization later on as
separate step.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-15 19:23:30 +00:00
Gerd Hoffmann 71077c1cb0 qdev/pci: add pci_create_noinit()
Like pci_create_simple() but doesn't call qdev_init(), so one can
set properties before initializing the device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-15 19:23:25 +00:00
Aurelien Jarno ffabf03718 mips malta: ensure that the serial ports are associated with a device
The serial ports should be present even if associated with a null device
as some firmware wants to initialize them.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-15 01:17:57 +02:00
Aurelien Jarno 387f4a5a71 hw/serial: don't create a char device if none is specified
When creating null devices, there is no way to ensure the unicity of
the labels. Bail out with an error message instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-15 01:16:28 +02:00
Gerd Hoffmann b37fc148bb unbreak ppc/prep
Changes:
  * added isa bus, hooked up to the system bus. Not sure this is correct,
    but 'info pci' lists lists no pci-isa bridge in the machine ...).
  * switches the default cpu to one which actually works.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-14 16:40:43 +00:00
Blue Swirl f80237d450 Add an ISA bus version of m48t59
Many thanks to Gerd Hoffmann for finding and fixing a bug in the initial
version.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-14 15:33:28 +00:00
Daniel Jacobowitz 042eb37a04 Fix Linux task preemption on Versatile board
Recent versions of the Linux kernel will not preempt CPU-intensive
tasks unless the clock used by sched_clock() works.  On -M versatilepb
that's the 24MHz timer in the system controller.  It's a very simple
timer, so implement it.

Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-14 11:16:50 +02:00
Edgar E. Iglesias fad8c772ef pflash_cfi01: Correct debug build, no functional changes.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-09-14 10:44:26 +02:00
malc a61241035b ne2000-isa: Do not free memory owned by qdev
Signed-off-by: malc <av1474@comtv.ru>
2009-09-14 09:21:00 +04:00
Blue Swirl c5ff6d5472 Sparc64: make system bus parent of PCI bus
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-13 08:32:40 +00:00
Blue Swirl 075cd324df x86: move a declaration to header
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-13 08:32:39 +00:00
Blue Swirl 675d6f8210 x86: add 'const'
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-13 08:32:37 +00:00
Reimar Döffinger 6a0b9cc91f Make string arrays used to convert numbers to strings when DEBUG_EEPRO100 is enabled const.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-12 15:20:24 +00:00
Jan Kiszka d8becc354b Fix xen build after sys-queue renaming
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-12 15:00:28 +00:00
Blue Swirl 72cf2d4f0e Fix sys-queue.h conflict for good
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 15cc923584,
f40d753718,
96555a96d7 and
3990d09adf 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-12 07:36:22 +00:00
malc 057fa65c5d audio: remove lsbindex/popcount in favour of host-utils's ctz32
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12 02:50:58 +04:00
malc 435c247a9f gus: Do not manually free the state, qdev does it for us
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12 02:50:58 +04:00
Juan Quintela 7e72abc382 vmstate: port cirrus_vga device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:09 -05:00
Juan Quintela 747791f11a vmstate: port serial device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:09 -05:00
Juan Quintela e6cb4d4589 vmstate: port hpet device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:09 -05:00
Juan Quintela 67f0875ebc hpet: it is imposible that qemu_timer field is NULL at this point
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:08 -05:00
Juan Quintela 3e9e98889b vmstate: port ioapic device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:08 -05:00
Juan Quintela 80a04bbe90 vmstate: add uint64 array support
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:08 -05:00
Juan Quintela 3c619b5975 vmstate: port pckbd device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:08 -05:00
Juan Quintela bcb58d9ac9 vmstate: port vmmouse device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:08 -05:00
Juan Quintela 7b5045c555 vmstate: port dma device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:07 -05:00
Juan Quintela 632cf0730c vmstate: add support for arrays of uint16_t
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:06 -05:00
Juan Quintela d7a6c27035 vmstate: port fdc device
We can't move fifo back to an embeded array because it needs to be aligned

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:06 -05:00
Juan Quintela 80cd83e7b2 vmstate: add support for uint8_t equal
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:06 -05:00
Juan Quintela 77eea83830 vmstate: port i8259 device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:06 -05:00
Juan Quintela 7d2edd40fb vmstate: port fw_cfg device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:06 -05:00
Juan Quintela 8fb0791d30 vmstate: Add pre/post_save() hooks
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:05 -05:00
Juan Quintela fd4d52deab vmstate: Add pre_load() hook
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:05 -05:00
Juan Quintela 752ff2fa31 vmstate: rename run_after_load() -> post_load()
This naming was used in kvm tree, and is easier to remember

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:05 -05:00
Juan Quintela 1eb7538b77 vmstate: add sensible arguments to vmstate_unregister()
vmsd alone is not enugh, because we can have several structs saved with the same description (vmsd).

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:05 -05:00
Juan Quintela 6ee093c907 Unexport ticks_per_sec variable. Create get_ticks_per_sec() function
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:52 -05:00
Gerd Hoffmann 06113719be qdev: add parser for chardev properties
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:49 -05:00
Gerd Hoffmann dc1c21e60c convert braille chardev to QemuOpts.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:48 -05:00
Gerd Hoffmann f0457e8d88 convert msmouse chardev to QemuOpts.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:48 -05:00
Markus Armbruster d03f09ccde qdev: Fix i6300 upcast
Use DO_UPCAST() instead of container_of() to go from PCIDevice to
I6300State.  This ensures that PCIDevice is the first member of struct
I6300State.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:47 -05:00
Yan Vugenfirer ed757e140c VirtIO: Fix QEMU crash during Windows PNP tests
Hello,

In some cases bus driver can deassert "bus master" bit in PCI command
register. The driver will no longer be able to update related registers in
the device. Eventually it will cause QEMU to exit in "virtqueue_num_heads"
function.

Attached path that fixes the described issue.

Best regards,
Yan Vugenfirer.

>From 3fdafbdfad676ec8479dc073cff70bf356868bfe Mon Sep 17 00:00:00 2001
From: Yan Vugenfirer <yvugenfi@redhat.com>
Date: Tue, 8 Sep 2009 10:08:14 -0400
Subject: [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:47 -05:00
Christoph Hellwig aa659be3dc virtio-blk: add volatile writecache feature
Add a new VIRTIO_BLK_F_WCACHE feature to virtio-blk to indicate that we have
a volatile write cache that needs controlled flushing.  Implement a
VIRTIO_BLK_T_FLUSH operation to flush it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:46 -05:00
Christoph Hellwig b0484ae464 ide: use bdrv_aio_flush
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:46 -05:00
Christoph Hellwig e900a7b748 block: add enable_write_cache flag
Add a enable_write_cache flag in the block driver state, and use it to
decide if we claim to have a volatile write cache that needs controlled
flushing from the guest.  The flag is off if cache=writethrough is
defined because O_DSYNC guarantees that every write goes to stable
storage, and it is on for cache=none and cache=writeback.

Both scsi-disk and ide now use the new flage, changing from their
defaults of always off (ide) or always on (scsi-disk).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:46 -05:00
Michael S. Tsirkin b8193adbda qemu: init all queues to NO_VECTOR value
initialize vectors for all vqs to VIRTIO_NO_VECTOR rather than 0 which
is a valid vector. This fixes migration which happened before driver
was loaded.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Amit Shah <amit.shah@redhat.com>
Tested-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:46 -05:00
Michael S. Tsirkin 711bf3d954 qemu: make virtio-blk PCI compliant by default
commit bf011293fa made virtio-blk-pci not
PCI-compliant, since it makes region 0 (which is an i/o region)
size > 256, and, since PCI 2.1, i/o regions are limited to 256 bytes size.

When the ATA serial number feature is off, which is the default,
make the device spec compliant again, by making region 0 smaller.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Vadim Rozenfeld <vrozenfe@redhat.com>
Tested-by: Vadim Rozenfeld <vrozenfe@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:46 -05:00
Kevin Wolf 91553dcc9e virtio-blk: Use bdrv_aio_multiwrite
It is quite common for virtio-blk to submit more than one write request in a
row to the qemu block layer. Use bdrv_aio_multiwrite to allow block drivers to
optimize its handling of the requests.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:18:06 -05:00
Anthony Liguori 1c3173b9ed Revert "don't call cpu_sychronize_state from reset handlers"
This reverts commit 733318ea9c.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:18:06 -05:00
malc 31226166bb Fix formatting 2009-09-10 19:59:50 +04:00
malc a5e8e46bfb Fix formatting, get rid of conf and fix description 2009-09-10 19:59:41 +04:00
malc 41875be5b4 Fix formatting and and description field 2009-09-10 19:59:00 +04:00
Gerd Hoffmann 32e0c8260d qdev/isa: convert real time clock
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:01 +04:00
Gerd Hoffmann 11d23c352d qdev/isa: finish pckbd conversion
drop old init path and switch remaining users to
isa_create_simple().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:01 +04:00
Gerd Hoffmann 9453c5bc26 qdev/isa: convert ne2000
Also split the isa bits into a separate source file, so we don't drag in
a dependency for isa-bus.o for machines which want ne2k_pci only.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:01 +04:00
Gerd Hoffmann 9df34396d5 qdev/isa: convert gravis ultrasound
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:00 +04:00
Gerd Hoffmann f8ba784657 qdev/isa: convert cs4231a sound card
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:00 +04:00
Gerd Hoffmann f7b4f61f63 qdev/isa: convert soundblaster
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:00 +04:00
Gerd Hoffmann 924f6d72d3 qdev: add isa_create() function
Like isa_create_simple, but doesn't call qdev_init, so one can set
properties after creating and before initializing the device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 787aa97a3e qdev: tag isabus-bridge as no-user
isabus-bridge isn't supposed to be added via -device ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 2e15e23b8a qdev: simplify isa irq assignments
isa-bus owns the isa irqs now, so it can hand them out directly.
There is no need for the separate isa_connect_irqs step, drop it.

Also hard-code isa interrupts which can't be configured anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 86c8615784 qdev: drop iobase properties from isa bus
Lot of ISA devices work at fixed addresses, so having iobase
as bus property doesn't make much sense.  Devices which can
have different iobases will get a device property.

Also simply hard-code stuff which can't be configured anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:58 +04:00
Gerd Hoffmann 316940b062 qdev: add property type for 32bit signed integers.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:58 +04:00
Gerd Hoffmann 679a37afc4 isapc: pick a more sane default cpu for such old hardware.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:58 +04:00
Gerd Hoffmann 2c8d934020 isapc: Fix irq routing
Only send irqs to ioapic in case we have one.
Fixes qemu segfault.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:57 +04:00
Juan Quintela 13f5545daa Fix VMSTATE_PCI_DEVICE version
PCI device entries have to have a default version, not 2, because they are
used in the midle of other structures that can have _any_ version number.

We can't use proper versioning here until we have SubSections support.
Why we didn't noticed before?  Because in a PC, the only device ported with
a version less that 2 is piix_pm, and for that one, default pci values are
right.  If you use a virtio-console, you will see that its state it is not
loaded back.

Thanks to Amit Shah for reporting the problem and help debug the fix.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 18:20:58 -05:00
Glauber Costa 733318ea9c don't call cpu_sychronize_state from reset handlers
Doing this will make the vcpu ioctl be issued from the I/O thread, instead
of cpu thread. The correct behaviour is to call it from within the cpu thread,
as soon as we are ready to go.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 17:31:27 -05:00
Bernhard Kauer 98815437f7 RTC polling mode broken
The RTC emulation does not set the IRQ flags independent of the IRQ enable bits.

The original MC146818A datasheet from 1984 notes:
        "flag bits in Register C [...] are set independent of the
        state of the corresponding enable bits in Register B"
Similar sections can be found in newer documentation e.g. in rtc82885.

Qemu and Bochs set the IRQ flags only if they are enabled,
which breaks drivers polling on them.

The following patch corrects this for the update-ended-flag in Qemu only.
It does not fix the handling of the other flags.

Signed-off-by: Bernhard Kauer <kauer@tudos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 17:31:27 -05:00
Naphtali Sprei 0859df68df Fix for commit 3f9cb1c14d
Here's a patch to fix the issue introduced by me, as Reimar Döffinger pointed out,

Reimar Döffinger wrote:
> On Thu, Aug 13, 2009 at 03:01:20PM +0300, Naphtali Sprei wrote:
>> Bug fix for segfault when run as i82551 HW:
>> Use Extended TBD only when HW supports it (i82558 and up).
>>
>> Added assertions to guard from such buffer overflow
>> Introduce the MAX_TCB_BYTE_COUNT macro
>> Allocate buf big enough as HW needs (MAX_ETH_FRAME_SIZE -> MAX_TCB_BYTE_COUNT)
>>
>>
>> I don't feel 100% OK with the "s->device >= i82558B" condition
>> since it relies on the numeric (hex) value of those defines, which currently
>> is correct, but changes (which I don't forsee now) might break it.
>
> It seems this was applied. Unfortunately this breaks things on FreeBSD.
> There seem to be multiple issues.
> First, the intel document says the 82551, 82550, 82559 models are all
> supersets of the 82558. Or in other words: they all support this
> feature.
> Only the 82557 does not.
> But then even for that the FreeBSD driver will fail.
> The reason for that is this line:
>     eeprom_contents[0xa] = 0x4000;
> the value here must be 0x01000 for all 82557 models it seems.

 Correct the logic of determining devices that supports
 extended TxCB: only the 82557 do not support it.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:57:21 -05:00
Stefan Weil d6fd1e6603 eepro100: Clean code which sets the PCI device id
* Use function pci_config_set_device_id
* Use new macro PCI_DEVICE_ID_INTEL_82557

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:57:21 -05:00
Gerd Hoffmann 20bb82770e qdev: convert tcx to reset + vmsd
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:57:20 -05:00
Gerd Hoffmann 391a079edb qdev: integrate vmstate
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:57:20 -05:00
Gerd Hoffmann f82de8f08a qdev: convert rtl8139 to reset
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:57:20 -05:00
Gerd Hoffmann 959f733a29 qdev: integrate reset
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:57:20 -05:00
Gerd Hoffmann 7fc2f2c086 qdev/scsi+usb: convert usb-storage to qdev.
Full coverage with properties and everything.  You can add virtual usb
sticks this way now:

  -drive if=none,id=pendrive,path=/some/where
  -device usb-storage,drive=pendrive

-usbdevice disk:/path/to/image continues to work.

Other side effects:
usb storage is listed in 'info block' now.
kvm tree should be able to boot from usb via extboot (untested though).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:57:19 -05:00
Gerd Hoffmann d52affa7f6 qdev/scsi: add scsi bus support to qdev, convert drivers.
* 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-09-09 14:57:19 -05:00
Gerd Hoffmann 5b19d9a247 qdev/usb: convert ohci.
Drop num_ports argument for usb_ohci_init_pci(), everybody
calls it with num_ports == 3, so it is pointless.

Convert ohci pci device into qdev.
TODO: convert non-pci ohci adapters.

You can add a OHCI USB Controller to your virtual pc now using
'-device pci-ohci'.  Specifying a id is a good idea, so you can
attach usb devices to it, like this:

  -device pci-ohci,id=ohci
  -device usb-mouse,bus=ohci.0

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:18 -05:00
Gerd Hoffmann 6cf9b6f17a qdev/usb: convert uhci.
Hookup pci device into qdev.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:18 -05:00
Gerd Hoffmann 274945b633 qdev/usb: add some convinience aliases.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:18 -05:00
Gerd Hoffmann a5d2f7273c qdev/usb: make qemu aware of usb busses.
Move usb code from vl.c to usb-bus.c and make it use the new data
structures added by qdev conversion.  qemu usb core should be able
to handle multiple USB busses just fine now (untested though).

Kill some usb_*_init() legacy functions, use usb_create_simple()
instead.

Kill some FIXMEs added by the first qdev/usb patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:17 -05:00
Gerd Hoffmann 806b602482 qdev/usb: add usb bus support to qdev, convert drivers.
* Add USBBus.
 * Add USBDeviceInfo, move device callbacks here.
 * Add usb-qdev helper functions.
 * Switch drivers to qdev.

TODO:
 * make the rest of qemu aware of usb busses and kill the FIXMEs
   added by this patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:17 -05:00
Gerd Hoffmann 7557008854 qdev: add error message to qdev_device_add().
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:17 -05:00
Juan Quintela 93ec8b321c cirrus_vga: CIRRUS_HOOK_* is not used anymore
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:16 -05:00
Juan Quintela 4ec1ce048e cirrus_vga: rename cirrus_hook_write_cr() cirrus_vga_write_cr()
Simplify the logic to do everything inside the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:16 -05:00
Juan Quintela b863d51490 cirrus_vga: rename cirrus_hook_read_cr() cirrus_vga_read_cr()
Simplify the logic to do everything inside the function.  Return 0xff if index is out of range independetly of DEBUG_CIRRUS

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:16 -05:00
Juan Quintela 22286bc646 cirrus_vga: rename cirrus_hook_write_gr() cirrus_vga_write_gr()
Simplify the logic to do everything inside the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:15 -05:00
Juan Quintela f705db9df0 cirrus_vga: rename cirrus_hook_read_gr() cirrus_vga_read_gr()
Simplify the logic to do everything inside the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:15 -05:00
Juan Quintela 86948bb104 cirrus_vga: rename cirrus_hook_write_palette() cirrus_vga_write_palette()
Simplify the logic to do everything inside the function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:15 -05:00
Juan Quintela 5deaeee32f cirrus_vga: rename cirrus_hook_read_palette() cirrus_vga_read_palette()
Simplify the logic to do everything inside the function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:15 -05:00
Juan Quintela 31c63201c9 cirrus_vga: rename cirrus_hook_write_sr() cirrus_vga_write_sr()
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:15 -05:00
Juan Quintela 8a82c322ce cirrus_vga: rename cirrus_hook_read_sr() cirrus_vga_read_sr()
And make it a real function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:14 -05:00
Juan Quintela cedd91d20f vga: Rename last VGAState occurrences to VGACommonState
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:14 -05:00
Juan Quintela a46007a021 vga and cirrus_vga: substitute switch for equivalent assigntment
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:14 -05:00
Juan Quintela 957c9db562 cirrus_vga: make cirrus_read_hidden_dac() return its result
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:14 -05:00
Juan Quintela e9b43ea36a vga: change tabs to spaces
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:14 -05:00
Juan Quintela b634307306 cirrus_vga: Add a VGACommonState local var to cirrus_vga_ioport_{read, write}
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:13 -05:00
Juan Quintela 25a18cbd27 vga and cirrus_vga: create vga_ioport_invalid() and use it everywhere
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:13 -05:00
Juan Quintela 79b97bf2e7 vga: split vga-isa-mm.o
It is only used in mips softmmu, compile only there.
it_shift field was only used for vga_isa_mm, move it from VGACommonState
to ISAVGAMMstate.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:11 -05:00
Juan Quintela f97e36b9d6 vga: export vga_mem_{read,write}
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:11 -05:00
Juan Quintela 76323919df vga: split isa bits inco vga-isa.c
Adjust all the VGAState in VGACommonState
Compile vga-isa.o in the targets that use it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:11 -05:00
Juan Quintela 47d37dd9c8 vga: split pci bits into vga-pci.c
Adjust all the VGAState in VGACommonState
Compile vga-pci.o only for targets that use it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:11 -05:00
Juan Quintela 0d65ddc384 vga: split vga_{load, save} into pci and common parts
Once there adjust VGAState <-> VGACommonState
Export vga_common_save/vga_common_load (nreeded by wmvare_vga
Remove vga.pci_dev field, it is not needed anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:11 -05:00
Juan Quintela 43bf782b1a vga: export vga_ioport_{read,write}
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:10 -05:00
Juan Quintela 0ceac75b8c cirrus_vga: prefix vga_ioport_{read, write} with cirrus
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:10 -05:00
Juan Quintela 1a5ab75712 vga: remove useless cast from void *
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09 14:55:10 -05:00
Blue Swirl 1e43a8e4d2 Sparc64: use ISA bus for i8042
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-06 16:34:18 +00:00
Blue Swirl 5bc89ef61b Sparc64: remove unused variables
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-06 16:32:34 +00:00
Blue Swirl 82663ee220 Fix indentation
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-06 16:31:58 +00:00
Artyom Tarasenko f2818f2201 esp: handle "select without attention"
Up to now "select without attention" was handled the same way as
"select with attention". According to

http://www.ibiblio.org/pub/historic-linux/early-ports/Sparc/NCR/NCR53C9X.txt

select without ATN sends the CDB (Command Descriptor Block) directly,
whereas select with ATN sends one message phase byte
followed by 6, 10, or 12 command phase bytes.

The attached patch implements the behaviour described above.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
[blauwirbel@gmail.com: cleaned up formatting]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-05 06:24:47 +00:00
Stefan Weil ae027ad3c5 mips malta: Fix fdc regression and use qdev for i8042 setup
8baf73adf6 (qdev/isa: convert fdc)
breaks MIPS Malta:

Tried to create isa device isa-fdc with no isa bus present

Fix this by creating an isa bus for piix4.
This change also requires some more qdev related changes
(similar changes were applied to pc.c) and allows
cleaning of piix3/piix4 code.

Thanks to Gerd Hoffmann for his hints.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:34 -05:00
Luiz Capitulino 1d4daa91ff monitor: Port handler_3 to use QDict
This commit ports command handlers that receive three arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino f18c16de4a monitor: Port handler_2 to use QDict
This commit ports command handlers that receive two arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino d54908a55b monitor: Port handler_1 to use QDict
This commit ports command handlers that receive one argument to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino 3818318682 Add wrappers to functions used by the Monitor
Some functions exported to be used by the Monitor as command
handlers are also called in other places as regular functions.

When those functions got ported to use the Monitor dictionary
to pass argments, the callers will have to setup a dictionary
to be able to call them.

To avoid this problem, this commit add wrappers to those functions,
so that we change the wrapper to accept the dictionary, letting
the current functions as is.

The following wrappers are being added:

- do_help_cmd()
- do_pci_device_hot_remove()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:29 -05:00
Gerd Hoffmann 9cdd03a791 ide: move cmd+irq from IDEState to IDEBus.
These variables are per bus, not per drive.  Lets move them and
cleanup things a bit.  And fix the cmd migration bug for real.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:27 -05:00
Gerd Hoffmann f455e98cf4 ide: pass down DriveInfo instead of BlockDriverState
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:27 -05:00
Amit Shah b84a5c6fa7 Remove typedef for bool from eepro100.c
eepro100.c shouldn't have the need to do this in its local header file.

And I recently started getting this:

$ make -j3
...
  CC    x86_64-softmmu/eepro100.o
/home/amit/src/qemu/hw/eepro100.c:112: error: two or more data types
in declaration specifiers
/home/amit/src/qemu/hw/eepro100.c:112: warning: useless type name in
empty declaration
make[1]: *** [eepro100.o] Error 1

so just remove the typedef and include <stdbool.h> instead.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:26 -05:00
Juan Quintela d1f171bd3a piix3: use new vmstate infrastructure
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:26 -05:00
Juan Quintela 0c7d19e538 i440fx: use new vmstate infrastructure
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:25 -05:00
Juan Quintela da64182c4e Update SaveVM versions
Now that we have all fields belonging to a PCIDevice, save each field
on the device that it belongs.  This means moving pci_irq_levels
from PCII440FXState to PIIX3State.
Old formats are loaded, but we only save on the new saner format.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:25 -05:00
Juan Quintela 8372615d3f pci_irq_levels[] belong to PIIX3State
With previous cleanups, now it is possible to put it where it belongs

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:25 -05:00
Juan Quintela 867a0d7dd0 Save irq_state into PCII440FXState
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:24 -05:00