aboutsummaryrefslogtreecommitdiffstats
path: root/hw/serial.c
AgeCommit message (Collapse)AuthorFilesLines
2012-02-24suspend: make serial ports wakeup the guest.Gerd Hoffmann1-0/+6
Add a 'wakeup' property to the serial port. It is off by default. When enabled any incoming character on the serial line will wake up the guest. Useful for guests which have a serial console configured. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-15qom: Unify type registrationAndreas Färber1-2/+2
Replace device_init() with generalized type_init(). While at it, unify naming convention: type_init([$prefix_]register_types) Also, type_init() is a function, so add preceding blank line where necessary and don't put a semicolon after the closing brace. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws> Cc: malc <av1474@comtv.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-03qdev: register all types natively through QEMU Object ModelAnthony Liguori1-13/+17
This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27isa: pic: convert to QEMU Object ModelAnthony Liguori1-6/+12
This converts two devices at once because PIC subclasses ISA and converting subclasses independently is extremely hard. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-02serial: Add MemoryRegion parameter to serial_mm_initRichard Henderson1-5/+5
Remove the get_system_memory() call from serial_mm_init, pushing it back into the callers. In many cases we already have the system memory region available. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02serial: Remove ioregister parameter from serial_mm_initRichard Henderson1-5/+3
All callers passed 1. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02serial: Use enum device_endian in serial_mm_init parameterRichard Henderson1-3/+1
The use of DEVICE_NATIVE_ENDIAN cleans up lots of ifdefs in many of the callers. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02serial: Convert serial_mm_init to MemoryRegionRichard Henderson1-114/+31
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25serial: Convert serial_isa_initfn to MemoryRegionRichard Henderson1-3/+12
The serial_mm_init path is as yet unconverted. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-08-22char: qemu_chr_ioctl() -> qemu_chr_fe_ioctl()Anthony Liguori1-5/+5
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22char: rename qemu_chr_write() -> qemu_chr_fe_write()Anthony Liguori1-1/+1
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-2/+2
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-21change all other clock references to use nanosecond resolution accessorsPaolo Bonzini1-10/+10
This was done with: sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. There was exactly one false positive in qemu_run_timers: - current_time = qemu_get_clock (clock); + current_time = qemu_get_clock_ns (clock); which is of course not in this patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-02-20serial: refactor device creationBlue Swirl1-12/+0
Turn serial_init into an inline function. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11Keep track of ISA ports ISA device is using in qdev.Gleb Natapov1-0/+1
Store all io ports used by device in ISADevice structure. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11Add endianness as io mem parameterAlexander Graf1-2/+4
As stated before, devices can be little, big or native endian. The target endianness is not of their concern, so we need to push things down a level. This patch adds a parameter to cpu_register_io_memory that allows a device to choose its endianness. For now, all devices simply choose native endian, because that's the same behavior as before. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-15serial: Update parameters after loadMichal Novotny1-0/+1
This is the patch to update serial port parameters after guest is already loaded. Signed-off-by: Michal Novotny <minovotn@redhat.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-14Remove wrong semicolon in macro definitionStefan Weil1-2/+2
Macros normally should not end with a semicolon, otherwise their usage results in two statements where only one statement was expected. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-13serial: Wrap debug prints around a DPRINTF macroMichal Novotny1-12/+13
Signed-off-by: Michal Novotny <minovotn@redhat.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-06savevm: Add DeviceState paramAlex Williamson1-2/+2
When available, we'd like to be able to access the DeviceState when registering a savevm. For buses with a get_dev_path() function, this will allow us to create more unique savevm id strings. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-06-04blockdev: Collect block device code in new blockdev.cMarkus Armbruster1-0/+1
Anything that moves hundreds of lines out of vl.c can't be all bad. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-15serial: Register vmstate via qdevJan Kiszka1-1/+12
At least for isa-serial, we can already let qdev do the vmstate registration for us. It just takes wrapping vmstate for the encapsulating ISASerialState and defining the proper instance ID aliases. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-21Compile serial only onceBlue Swirl1-23/+69
Push TARGET_WORDS_BIGENDIAN dependency to board level. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-06hw/serial.c: fix THRE interrupt clearingAurelien Jarno1-1/+1
UART_IIR_THRI is not a mask, but a possible value for the IIR ID. Use UART_IIR_ID to extract this value. Broken by commit 71e605f80313a632cc6714cde7bd240042dbdd95. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-06hw/serial.c: fix indentationAurelien Jarno1-8/+8
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-02-22Fix lost serial TX interrupts. Report receive overruns.Justin T. Gibbs1-8/+20
o Implement receive overrun status. The FreeBSD uart driver relies on this status in it's probe routine to determine the size of the FIFO supported. o As per the 16550 spec, do not overwrite the RX FIFO on an RX overrun. o Do not allow TX or RX FIFO overruns to increment the data valid count beyond the size of the FIFO. o For reads of the IIR register, only clear the "TX holding register emtpy interrupt" if the read reports this interrupt. This is required by the specification and avoids losing TX interrupts when other, higher priority interrupts (usually RX) are reported first. Signed-off-by: Justin T. Gibbs <gibbs@FreeBSD.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-02Fix qdev property type definition for isa serial/parallel devicesGerd Hoffmann1-1/+1
Use the correct qdev property type for these devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-12serial: Add interface to set reference oscillator frequencyStefan Weil1-0/+7
Many (most?) serial interfaces have a programmable clock which provides the reference frequency ("baudbase"). So a fixed baudbase which is only set once can be wrong. omap1.c is an example which could use the new interface to change baudbase when the programmable clock changes. ar7 system emulation (still not part of standard QEMU) is similar to omap and already uses serial_set_frequency. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-07v3: don't call reset functions on cpu initializationGlauber Costa1-1/+0
There is absolutely no need to call reset functions when initializing devices. Since we are already registering them, calling qemu_system_reset() should suffice. Actually, it is what happens when we reboot the machine, and using the same process instead of a special case semantics will even allow us to find bugs easier. Furthermore, the fact that we initialize things like the cpu quite early, leads to the need to introduce synchronization stuff like qemu_system_cond. This patch removes it entirely. All we need to do is call qemu_system_reset() only when we're already sure the system is up and running I tested it with qemu (with and without io-thread) and qemu-kvm, and it seems to be doing okay - although qemu-kvm uses a slightly different patch. [ v2: user mode still needs cpu_reset, so put it in ifdef. ] [ v3: leave qemu_system_cond for now. ] Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-30serial: Add missing bitStefan Weil1-3/+5
Serial frames always start with a start bit. This bit was missing in frame size calculation. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27serial: use post_load version_id field and remove pre_load functionJuan Quintela1-8/+3
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27isa: configure serial+parallel by index.Gerd Hoffmann1-7/+19
This patch adds a 'index' property to the isa-parallel and isa-serial devices. This can be used to create devices with the default isa irqs and ioports by simply specifying the index, i.e. -device isa-serial,index=1 instead of -device isa-serial,iobase=0x2f8,irq=3 for ttyS1 aka com2. Likewise for parallel ports. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-07Clean up test for qdev_init() failureMarkus Armbruster1-1/+1
Some callers test for != 0, some for < 0. Normalize to < 0. Patchworks-ID: 35171 Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05serial: convert isa to qdevGerd Hoffmann1-10/+67
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-05vmstate: remove const from pre_save() functionsJuan Quintela1-2/+2
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05vmstate: add version_id argument to post_loadJuan Quintela1-1/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01Revert "Get rid of _t suffix"Anthony Liguori1-7/+7
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 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01Get rid of _t suffixmalc1-7/+7
Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
2009-09-25Use proper typedef syntaxJuan Quintela1-2/+2
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-16qemu serial: lost tx irqs (affecting FreeBSD's new uart(4) driver)Juergen Lock1-6/+4
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-15hw/serial: don't create a char device if none is specifiedAurelien Jarno1-1/+6
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-11vmstate: port serial deviceJuan Quintela1-36/+37
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11Unexport ticks_per_sec variable. Create get_ticks_per_sec() functionJuan Quintela1-3/+3
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25Make CPURead/WriteFunc structure 'const'Blue Swirl1-2/+2
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-08-15PPC: clean up ppc405Blue Swirl1-9/+9
Rely on the subpage system instead of the local version. Make most functions "static". Fix wrong parameter passed to ppc4xx_pob_reset. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-29Revert "Introduce reset notifier order"Jan Kiszka1-1/+1
This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (and updates later added users of qemu_register_reset), we solved the problem it originally addressed less invasively. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16Remove io_index argument from cpu_register_io_memory()Avi Kivity1-1/+1
The parameter is always zero except when registering the three internal io regions (ROM, unassigned, notdirty). Remove the parameter to reduce the API's power, thus facilitating future change. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-22serial: fix lost character after sysrqJason Wessel1-0/+2
After creating an automated regression test to test the sysrq responses while running a linux image in qemu, I found that the simulated uart was eating the character right after the sysrq about 75% of the time. The problem is that the qemu sets the LSR_DR (data ready) bit on a serial break. The automated tests can send a break and the sysrq character quickly enough that the qemu serial fifo has a real character available. When there is valid character in the fifo, it gets consumed by the serial driver in the guest OS. The real hardware also appears to set the LSR_DR but always appears to have a null byte in this condition. This patch changes the qemu behavior to match the tested characteristics of a real 16550 chip. Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
2009-05-22Introduce reset notifier orderJan Kiszka1-1/+1
Add the parameter 'order' to qemu_register_reset and sort callbacks on registration. On system reset, callbacks with lower order will be invoked before those with higher order. Update all existing users to the standard order 0. Note: At least for x86, the existing users seem to assume that handlers are called in their registration order. Therefore, the patch preserves this property. If someone feels bored, (s)he could try to identify this dependency and express it properly on callback registration. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-02-05hw: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori1-4/+0
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6529 c046a42c-6fe2-441c-8c8c-71466251a162