aboutsummaryrefslogtreecommitdiff
path: root/hw/misc/macio
AgeCommit message (Collapse)AuthorFilesLines
2016-04-19cuda: fix off-by-one error in SET_TIME commandAurelien Jarno1-2/+2
With the new framework the cuda_cmd_set_time command directly receive the data, without the command byte. Therefore the time is stored at in_data[0], not at in_data[1]. This fixes the "hwclock --systohc" command in a guest. Cc: Hervé Poussineau <hpoussin@reactos.org> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Hervé Poussineau <hpoussin@reactos.org> [this fixes a regression introduced by e647317 "cuda: port SET_TIME command to new framework"] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-03-22util: move declarations out of qemu-common.hVeronia Bahaa1-0/+1
Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22Replaced get_tick_per_sec() by NANOSECONDS_PER_SECONDRutuja Shah2-9/+9
This patch replaces get_ticks_per_sec() calls with the macro NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec() is then removed. This replacement improves the readability and understandability of code. For example, timer_mod(fdctrl->result_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50)); NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns matches the unit of the expression on the right side of the plus. Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22include/qemu/osdep.h: Don't include qapi/error.hMarkus Armbruster1-0/+1
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the Error typedef. Since then, we've moved to include qemu/osdep.h everywhere. Its file comment explains: "To avoid getting into possible circular include dependencies, this file should not include any other QEMU headers, with the exceptions of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which are doing a similar job to this file and are under similar constraints." qapi/error.h doesn't do a similar job, and it doesn't adhere to similar constraints: it includes qapi-types.h. That's in excess of 100KiB of crap most .c files don't actually need. Add the typedef to qemu/typedefs.h, and include that instead of qapi/error.h. Include qapi/error.h in .c files that need it and don't get it now. Include qapi-types.h in qom/object.h for uint16List. Update scripts/clean-includes accordingly. Update it further to match reality: replace config.h by config-target.h, add sysemu/os-posix.h, sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h comment quoted above similarly. This reduces the number of objects depending on qapi/error.h from "all of them" to less than a third. Unfortunately, the number depending on qapi-types.h shrinks only a little. More work is needed for that one. Signed-off-by: Markus Armbruster <armbru@redhat.com> [Fix compilation without the spice devel packages. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-02-28dbdma: warn when using unassigned channelHervé Poussineau1-2/+23
With this, it's easier to know if a guest uses an invalid and/or unimplemented DMA channel. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commandsHervé Poussineau1-23/+0
We currently don't emulate the I2C bus provided by CUDA. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: remove GET_6805_ADDR commandHervé Poussineau1-3/+0
It doesn't seem to be used, and operating systems should accept a 'unknown command' answer. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port SET_TIME command to new frameworkHervé Poussineau1-6/+18
Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port GET_TIME command to new frameworkHervé Poussineau1-8/+21
Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port SET_POWER_MESSAGES command to new frameworkHervé Poussineau1-3/+16
Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port FILE_SERVER_FLAG command to new frameworkHervé Poussineau1-1/+16
This command tells if computer should automatically wake-up after a power loss. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port RESET_SYSTEM command to new frameworkHervé Poussineau1-4/+13
Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port POWERDOWN command to new frameworkHervé Poussineau1-4/+13
Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port SET_DEVICE_LIST command to new frameworkHervé Poussineau1-2/+16
Also implement the command, by taking device list mask into account when polling ADB devices. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port SET_AUTO_RATE command to new frameworkHervé Poussineau1-6/+30
Also implement the command, by removing the hardcoded period of 20 ms/50 Hz and replacing it by the one requested by user. Update VMState version to store this new parameter. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: port AUTOPOLL command to new frameworkHervé Poussineau1-15/+25
Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: move unknown commands reject out of switchHervé Poussineau1-14/+16
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-02-17cuda: add a framework to handle commandsHervé Poussineau1-0/+34
Next commits will port existing CUDA commands to this framework. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-30cuda.c: return error for unknown commandsAlyssa Milburn1-0/+5
This avoids MacsBug hanging at startup in the absence of ADB mouse input, by replying with an error (which is also what MOL does) when it sends an unknown command (0x1c). Signed-off-by: Alyssa Milburn <fuzzie@fuzzie.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-30cuda: add missing fields to VMStateDescriptionMark Cave-Ayland1-2/+5
Include some fields missed from the previous VMState conversion to the migration stream, as well as the new SR_INT delay timer. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-30mac_dbdma: add DBDMA controller state to VMStateDescriptionMark Cave-Ayland1-4/+36
Make sure that we include the DBDMA controller state in the migration stream. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-29ppc: Clean up includesPeter Maydell3-0/+3
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1453832250-766-6-git-send-email-peter.maydell@linaro.org
2015-11-30mac_dbdma: always initialize channel field in DBDMA_channelHervé Poussineau1-1/+1
dbdma_from_ch() uses channel field to return the right DBDMA object. Previous code was working if guest OS was only using registered DMA channels. However, it lead to QEMU crashes if guest OS was using unregistered DMA channels. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: add delay to setting of SR_INT bitMark Cave-Ayland1-11/+33
MacOS 9 is racy when it comes to accessing the shift register. Fix this by introducing a small delay between data accesses and raising the SR_INT interrupt bit. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: fix T2 timer and enable its interruptMark Cave-Ayland1-9/+24
Fix the counter loading logic and enable the T2 interrupt when the timer expires. Otherwise MacOS 9 hangs on boot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: rename get_counter() state variable from s to ti for consistencyMark Cave-Ayland1-9/+9
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: refactor get_tb() so that the time can be passed inMark Cave-Ayland1-5/+6
This is in preparation for sharing the code between timers. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: add defines for CUDA registersMark Cave-Ayland1-34/+53
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: fix CUDA SR interrupt clearingMark Cave-Ayland1-1/+3
Make sure that we also clear the data and clock interrupts at the same time. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: implement dummy IIC access commandsMark Cave-Ayland1-0/+18
These are used by MacOS 9 on boot. Here we return an error except for 4-byte commands which write to the IIC bus in a similar manner to MOL. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: implement simple CUDA_GET_6805_ADDR commandMark Cave-Ayland1-0/+3
This simply returns an empty response with no error status as implemented by MOL to allow MacOS 9 boot to proceed further. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: fix CUDA_PACKET response packet formatMark Cave-Ayland1-19/+5
According to comments in MOL, the response to a CUDA_PACKET should be one of the following: Reply: (CUDA_PACKET, status, cmd) Error: (ERROR_PACKET, status, CUDA_PACKET, cmd) Update cuda_receive_packet() accordingly to reflect this in order to make MacOS 9 happy. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-11-12cuda.c: fix CUDA ADB error packet formatMark Cave-Ayland1-2/+4
According to MOL, ADB error packets should be of the form (type, status, cmd) rather than just (type, status). This fixes ADB device detection under MacOS 9. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-10-23macio: add to bridge categoryLaurent Vivier1-0/+1
macio is a bridge between the PCI bus and the Mac nvram, IDE controller and PIC, so add it to the bridge category. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-10-23cuda: add to bridge categoryLaurent Vivier1-0/+1
Cuda is a bridge between PowerMac system bus and the ADB controller, real-time clock, pram and the power management unit. So add it to the bridge category. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-10-09macio: move DBDMA_init from instance_init to realizePaolo Bonzini1-4/+4
DBDMA_init is not idempotent, and calling it from instance_init breaks a simple object_new/object_unref pair. Work around this, pending qdev-ification of DBDMA, by moving the call to realize. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1443689999-12182-4-git-send-email-armbru@redhat.com>
2015-10-09hw: do not pass NULL to memory_region_init from instance_initPaolo Bonzini2-4/+4
This causes the region to outlive the object, because it attaches the region to /machine. This is not nice for the "realize" method, but much worse for "instance_init" because it can cause dangling pointers after a simple object_new/object_unref pair. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1443689999-12182-3-git-send-email-armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2015-09-20mac_dbdma: always clear FLUSH bit once DBDMA channel flush is completeMark Cave-Ayland1-7/+5
The code to flush the DBDMA channel was effectively duplicated in dbdma_control_write(), except for the fact that the copy executed outside of a RUN bit transition was broken by not clearing the FLUSH bit once the flush was complete. Newer PPC Linux kernels would timeout waiting for the FLUSH bit to clear again after submitting a FLUSH command. Fix this by always clearing the FLUSH bit once the channel flush is complete and removing the repeated code. Reported-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-07-07macio: remove nonexistent interrupt on pin 1Cormac O'Brien1-2/+0
The current macio implementation declares an interrupt that doesn't appear to exist in the hardware or any other emulator implementation. OpenBIOS detects this interrupt and generates an 'interrupts' property in the macio device tree entry. Mac OS 9 halts boot when it detects this interrupt, so it has been removed to permit further progress in the boot process. Signed-off-by: Cormac O'Brien <i.am.cormac.obrien@gmail.com> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-06-03macio: Convert to realize()Markus Armbruster1-33/+38
Convert device models "macio-oldworld" and "macio-newworld". Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-10macio: fix possible memory leakGonglei1-1/+2
If ret = macio_initfn_ide() is less than 0, the timer_memory will leak the memory it points to. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-03-09cuda.c: include adb_poll_timer in VMStateDescriptionMark Cave-Ayland1-2/+3
Make sure that we include the adb_poll_timer when saving the VM state for client OSs that use it, e.g. Darwin. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09macio.c: include parent PCIDevice state in VMStateDescriptionMark Cave-Ayland1-0/+24
This ensures that the macio PCI device is correctly configured when restoring from a VM snapshot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-01-26vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR*Paolo Bonzini1-1/+1
Old users of VMSTATE_TIMER* are mechanically changed to VMSTATE_TIMER_PTR variants. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-09-08PPC: Cuda: Use cuda timer to expose tbfreq to guestAlexander Graf2-3/+30
Mac OS X calibrates a number of frequencies on bootup based on reading tb values on bootup and comparing them to via cuda timer values. The only variable we can really steer well (thanks to KVM) is the cuda frequency. So let's use that one to fake Mac OS X into believing the bus frequency is tbfreq * 4. That way Mac OS X will automatically calculate the correct timebase frequency. With this patch and the patch set I posted earlier I can successfully run Mac OS X 10.2, 10.3 and 10.4 guests with -M mac99 on TCG and KVM. Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2014-09-08PPC: mac99: Fix core99 timer frequencyAlexander Graf1-2/+7
There is a special timer in the mac99 machine that we recently started to emulate. Unfortunately we emulated it in the wrong frequency. This patch adapts the frequency Mac OS X uses to evaluate results from this timer, making calculations it bases off of it work. Signed-off-by: Alexander Graf <agraf@suse.de>
2014-06-16macio: Fix timer endiannessAlexander Graf1-1/+1
The timer registers on our KeyLargo macio emulation are read as byte reversed from the big endian guest, so we better expose them endian reversed as well. This fixes initial hickups of booting Mac OS X with -M mac99 for me. Signed-off-by: Alexander Graf <agraf@suse.de> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2014-06-16macio ide: Do remainder access asynchronouslyAlexander Graf1-0/+6
The macio IDE controller has some pretty nasty magic in its implementation to allow for unaligned sector accesses. We used to handle these accesses synchronously inside the IO callback handler. However, the block infrastructure changed below our feet and now it's impossible to call a synchronous block read/write from the aio callback handler of a previous block access. Work around that limitation by making the unaligned handling bits also go through our asynchronous handler. This fixes booting Mac OS X for me. Reported-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2014-05-14savevm: Remove all the unneeded version_minimum_id_old (rest)Juan Quintela2-8/+4
After previous Peter patch, they are redundant. This way we don't assign them except when needed. Once there, there were lots of case where the ".fields" indentation was wrong: .fields = (VMStateField []) { and .fields = (VMStateField []) { Change all the combinations to: .fields = (VMStateField[]){ The biggest problem (appart from aesthetics) was that checkpatch complained when we copy&pasted the code from one place to another. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2013-08-30qom: Pass available size to object_initialize()Andreas Färber1-6/+7
To be passed on to object_initialize_with_type(). Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> (virtio-ccw) Signed-off-by: Andreas Färber <afaerber@suse.de>