summaryrefslogtreecommitdiff
path: root/hw/serial.c
AgeCommit message (Collapse)AuthorFilesLines
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
2009-01-18serial: open a null device if the CharDriverState argument is nullaurel321-5/+3
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6366 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-01Change MMIO callbacks to use offsets, not absolute addresses.pbrook1-8/+6
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5849 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-20Add a comment about masking of CTI interrupt in 16550A UART.balrog1-0/+3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5264 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-1716550A UART: RHR irq enable bit also masks the Rx timeout irq.balrog1-1/+1
The "Rx timeout" (aka. Character Timeout Indication) has no separate mask bit in the IER register and according to the specs reading RHR is the only way to reset the irq. However on the hardware (tested on OMAP2 UART which is an extended 16550A) the RHR_IT bit in IER disables the irc, too. Linux bluetooth serial dongle driver for N800 depends on this behavior. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5239 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-12serial: Always update iir, even when ier is empty (Samuel Thibault)aliguori1-5/+0
This fixes installation of Windows XP. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4995 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-11Upgrade emulated UART to 16550A (Stefano Stabellini)aliguori1-94/+392
This patch upgrades the emulated UART to 16550A, the code comes from xen-unstable. The main improvement was introduced with the following patch and subsequent email thread: http://lists.xensource.com/archives/html/xen-devel/2007-12/msg00129.html The changes compared to previous version are: - change clock_gettime to qemu_get_clock - no token bucket anymore; - fixed a small bug handling IRQs; this was the problem that prevented kgdb to work over the serial (thanks to Jason Wessel for the help spotting and reproducing this bug). - many many style fixes; - savevm version number increased; - not including termios.h and sys/ioctl.h anymore, declaring static constants in qemu-char.h instead; Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4993 c046a42c-6fe2-441c-8c8c-71466251a162
2008-05-048250: Customized base baudrateaurel321-5/+9
(Jan Kiszka) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4336 c046a42c-6fe2-441c-8c8c-71466251a162
2008-05-048250: throttle TX-completion IRQsaurel321-6/+49
(Jan Kiszka) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4335 c046a42c-6fe2-441c-8c8c-71466251a162
2008-02-10Add serial loopback mode (patch from Hervé Poussineau).balrog1-8/+39
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3973 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-25Add input buffer to mux chr (patch by Tristan Gingold).balrog1-0/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3735 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-17Break up vl.h.pbrook1-1/+4
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-17find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in ↵ths1-1/+1
the regex. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16find -type f | xargs sed -i 's/[\t ]$//g' # on most filesths1-7/+7
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2007-06-08 Fix incorrect target_ulong use in hw devicesblueswir11-2/+2
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2962 c046a42c-6fe2-441c-8c8c-71466251a162
2007-06-06Big endian byte swap for serial mmapped interface.ths1-4/+18
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2946 c046a42c-6fe2-441c-8c8c-71466251a162
2007-04-07Unify IRQ handling.pbrook1-14/+6
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2635 c046a42c-6fe2-441c-8c8c-71466251a162
2007-03-31Malta CBUS UART support.ths1-13/+16
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2557 c046a42c-6fe2-441c-8c8c-71466251a162
2007-01-27Rearrange char event handlers to fix CHR_EVENT_RESET.pbrook1-4/+4
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2361 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-2616 bit dividerbellard1-6/+9
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2138 c046a42c-6fe2-441c-8c8c-71466251a162
2006-04-12simulate a null modem cablebellard1-2/+3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1808 c046a42c-6fe2-441c-8c8c-71466251a162
2005-11-23more generic serial port (initial patch by Jocelyn Mayer)bellard1-3/+97
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1654 c046a42c-6fe2-441c-8c8c-71466251a162
2005-11-10char dev ioctlsbellard1-2/+9
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1610 c046a42c-6fe2-441c-8c8c-71466251a162
2005-11-08use host serial portbellard1-1/+39
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1609 c046a42c-6fe2-441c-8c8c-71466251a162
2005-11-06serial load/save VM support (Vincent Pelletier)bellard1-0/+37
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1602 c046a42c-6fe2-441c-8c8c-71466251a162
2004-08-24serial interrupt fix (Hampa Hug)bellard1-2/+5
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1049 c046a42c-6fe2-441c-8c8c-71466251a162
2004-07-14char device supportbellard1-24/+17
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1023 c046a42c-6fe2-441c-8c8c-71466251a162