qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [4336] 8250: Customized base baudrate


From: Aurelien Jarno
Subject: [Qemu-devel] [4336] 8250: Customized base baudrate
Date: Sun, 04 May 2008 21:42:11 +0000

Revision: 4336
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4336
Author:   aurel32
Date:     2008-05-04 21:42:11 +0000 (Sun, 04 May 2008)

Log Message:
-----------
8250: Customized base baudrate

(Jan Kiszka)

Modified Paths:
--------------
    trunk/hw/mips_jazz.c
    trunk/hw/mips_malta.c
    trunk/hw/mips_mipssim.c
    trunk/hw/mips_r4k.c
    trunk/hw/musicpal.c
    trunk/hw/omap1.c
    trunk/hw/pc.c
    trunk/hw/pc.h
    trunk/hw/ppc405_uc.c
    trunk/hw/ppc_chrp.c
    trunk/hw/ppc_oldworld.c
    trunk/hw/ppc_prep.c
    trunk/hw/pxa2xx.c
    trunk/hw/serial.c

Modified: trunk/hw/mips_jazz.c
===================================================================
--- trunk/hw/mips_jazz.c        2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/mips_jazz.c        2008-05-04 21:42:11 UTC (rev 4336)
@@ -234,9 +234,9 @@
 
     /* Serial ports */
     if (serial_hds[0])
-        serial_mm_init(0x80006000, 0, rc4030[8], serial_hds[0], 1);
+        serial_mm_init(0x80006000, 0, rc4030[8], 8000000/16, serial_hds[0], 1);
     if (serial_hds[1])
-        serial_mm_init(0x80007000, 0, rc4030[9], serial_hds[1], 1);
+        serial_mm_init(0x80007000, 0, rc4030[9], 8000000/16, serial_hds[1], 1);
 
     /* Parallel port */
     if (parallel_hds[0])

Modified: trunk/hw/mips_malta.c
===================================================================
--- trunk/hw/mips_malta.c       2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/mips_malta.c       2008-05-04 21:42:11 UTC (rev 4336)
@@ -449,7 +449,8 @@
 
     uart_chr = qemu_chr_open("vc:80Cx24C");
     qemu_chr_printf(uart_chr, "CBUS UART\r\n");
-    s->uart = serial_mm_init(base + 0x900, 3, env->irq[2], uart_chr, 1);
+    s->uart =
+        serial_mm_init(base + 0x900, 3, env->irq[2], 230400, uart_chr, 1);
 
     malta_fpga_reset(s);
     qemu_register_reset(malta_fpga_reset, s);
@@ -918,9 +919,9 @@
     i8042_init(i8259[1], i8259[12], 0x60);
     rtc_state = rtc_init(0x70, i8259[8]);
     if (serial_hds[0])
-        serial_init(0x3f8, i8259[4], serial_hds[0]);
+        serial_init(0x3f8, i8259[4], 115200, serial_hds[0]);
     if (serial_hds[1])
-        serial_init(0x2f8, i8259[3], serial_hds[1]);
+        serial_init(0x2f8, i8259[3], 115200, serial_hds[1]);
     if (parallel_hds[0])
         parallel_init(0x378, i8259[7], parallel_hds[0]);
     for(i = 0; i < MAX_FD; i++) {

Modified: trunk/hw/mips_mipssim.c
===================================================================
--- trunk/hw/mips_mipssim.c     2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/mips_mipssim.c     2008-05-04 21:42:11 UTC (rev 4336)
@@ -174,7 +174,7 @@
     /* A single 16450 sits at offset 0x3f8. It is attached to
        MIPS CPU INT2, which is interrupt 4. */
     if (serial_hds[0])
-        serial_init(0x3f8, env->irq[4], serial_hds[0]);
+        serial_init(0x3f8, env->irq[4], 115200, serial_hds[0]);
 
     if (nd_table[0].vlan) {
         if (nd_table[0].model == NULL

Modified: trunk/hw/mips_r4k.c
===================================================================
--- trunk/hw/mips_r4k.c 2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/mips_r4k.c 2008-05-04 21:42:11 UTC (rev 4336)
@@ -241,7 +241,8 @@
 
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         if (serial_hds[i]) {
-            serial_init(serial_io[i], i8259[serial_irq[i]], serial_hds[i]);
+            serial_init(serial_io[i], i8259[serial_irq[i]], 115200,
+                        serial_hds[i]);
         }
     }
 

Modified: trunk/hw/musicpal.c
===================================================================
--- trunk/hw/musicpal.c 2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/musicpal.c 2008-05-04 21:42:11 UTC (rev 4336)
@@ -1448,10 +1448,10 @@
     mv88w8618_pit_init(MP_PIT_BASE, pic, MP_TIMER1_IRQ);
 
     if (serial_hds[0])
-        serial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], /*1825000,*/
+        serial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], 1825000,
                    serial_hds[0], 1);
     if (serial_hds[1])
-        serial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], /*1825000,*/
+        serial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], 1825000,
                    serial_hds[1], 1);
 
     /* Register flash */

Modified: trunk/hw/omap1.c
===================================================================
--- trunk/hw/omap1.c    2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/omap1.c    2008-05-04 21:42:11 UTC (rev 4336)
@@ -2006,7 +2006,8 @@
     struct omap_uart_s *s = (struct omap_uart_s *)
             qemu_mallocz(sizeof(struct omap_uart_s));
 
-    s->serial = serial_mm_init(base, 2, irq, chr ?: qemu_chr_open("null"), 1);
+    s->serial = serial_mm_init(base, 2, irq, omap_clk_getrate(fclk)/16,
+                               chr ?: qemu_chr_open("null"), 1);
 
     return s;
 }

Modified: trunk/hw/pc.c
===================================================================
--- trunk/hw/pc.c       2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/pc.c       2008-05-04 21:42:11 UTC (rev 4336)
@@ -930,7 +930,8 @@
 
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         if (serial_hds[i]) {
-            serial_init(serial_io[i], i8259[serial_irq[i]], serial_hds[i]);
+            serial_init(serial_io[i], i8259[serial_irq[i]], 115200,
+                        serial_hds[i]);
         }
     }
 

Modified: trunk/hw/pc.h
===================================================================
--- trunk/hw/pc.h       2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/pc.h       2008-05-04 21:42:11 UTC (rev 4336)
@@ -4,10 +4,11 @@
 
 /* serial.c */
 
-SerialState *serial_init(int base, qemu_irq irq, CharDriverState *chr);
+SerialState *serial_init(int base, qemu_irq irq, int baudbase,
+                         CharDriverState *chr);
 SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
-                             qemu_irq irq, CharDriverState *chr,
-                             int ioregister);
+                             qemu_irq irq, int baudbase,
+                             CharDriverState *chr, int ioregister);
 uint32_t serial_mm_readb (void *opaque, target_phys_addr_t addr);
 void serial_mm_writeb (void *opaque, target_phys_addr_t addr, uint32_t value);
 uint32_t serial_mm_readw (void *opaque, target_phys_addr_t addr);

Modified: trunk/hw/ppc405_uc.c
===================================================================
--- trunk/hw/ppc405_uc.c        2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/ppc405_uc.c        2008-05-04 21:42:11 UTC (rev 4336)
@@ -1223,7 +1223,7 @@
 #ifdef DEBUG_SERIAL
     printf("%s: offset " PADDRX "\n", __func__, offset);
 #endif
-    serial = serial_mm_init(offset, 0, irq, chr, 0);
+    serial = serial_mm_init(offset, 0, irq, 399193, chr, 0);
     ppc4xx_mmio_register(env, mmio, offset, 0x008,
                          serial_mm_read, serial_mm_write, serial);
 }

Modified: trunk/hw/ppc_chrp.c
===================================================================
--- trunk/hw/ppc_chrp.c 2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/ppc_chrp.c 2008-05-04 21:42:11 UTC (rev 4336)
@@ -264,7 +264,7 @@
     dummy_irq = i8259_init(NULL);
 
     /* XXX: use Mac Serial port */
-    serial_init(0x3f8, dummy_irq[4], serial_hds[0]);
+    serial_init(0x3f8, dummy_irq[4], 115200, serial_hds[0]);
     for(i = 0; i < nb_nics; i++) {
         if (!nd_table[i].model)
             nd_table[i].model = "ne2k_pci";

Modified: trunk/hw/ppc_oldworld.c
===================================================================
--- trunk/hw/ppc_oldworld.c     2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/ppc_oldworld.c     2008-05-04 21:42:11 UTC (rev 4336)
@@ -287,7 +287,7 @@
     dummy_irq = i8259_init(NULL);
 
     /* XXX: use Mac Serial port */
-    serial_init(0x3f8, dummy_irq[4], serial_hds[0]);
+    serial_init(0x3f8, dummy_irq[4], 115200, serial_hds[0]);
 
     for(i = 0; i < nb_nics; i++) {
         if (!nd_table[i].model)

Modified: trunk/hw/ppc_prep.c
===================================================================
--- trunk/hw/ppc_prep.c 2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/ppc_prep.c 2008-05-04 21:42:11 UTC (rev 4336)
@@ -667,7 +667,7 @@
     //    pit = pit_init(0x40, i8259[0]);
     rtc_init(0x70, i8259[8]);
 
-    serial_init(0x3f8, i8259[4], serial_hds[0]);
+    serial_init(0x3f8, i8259[4], 115200, serial_hds[0]);
     nb_nics1 = nb_nics;
     if (nb_nics1 > NE2000_NB_MAX)
         nb_nics1 = NE2000_NB_MAX;

Modified: trunk/hw/pxa2xx.c
===================================================================
--- trunk/hw/pxa2xx.c   2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/pxa2xx.c   2008-05-04 21:42:11 UTC (rev 4336)
@@ -2077,7 +2077,8 @@
     for (i = 0; pxa270_serial[i].io_base; i ++)
         if (serial_hds[i])
             serial_mm_init(pxa270_serial[i].io_base, 2,
-                            s->pic[pxa270_serial[i].irqn], serial_hds[i], 1);
+                           s->pic[pxa270_serial[i].irqn], 14857000/16,
+                           serial_hds[i], 1);
         else
             break;
     if (serial_hds[i])
@@ -2202,7 +2203,8 @@
     for (i = 0; pxa255_serial[i].io_base; i ++)
         if (serial_hds[i])
             serial_mm_init(pxa255_serial[i].io_base, 2,
-                            s->pic[pxa255_serial[i].irqn], serial_hds[i], 1);
+                           s->pic[pxa255_serial[i].irqn], 14745600/16,
+                           serial_hds[i], 1);
         else
             break;
     if (serial_hds[i])

Modified: trunk/hw/serial.c
===================================================================
--- trunk/hw/serial.c   2008-05-04 21:42:00 UTC (rev 4335)
+++ trunk/hw/serial.c   2008-05-04 21:42:11 UTC (rev 4336)
@@ -99,6 +99,7 @@
     int last_break_enable;
     target_phys_addr_t base;
     int it_shift;
+    int baudbase;
     QEMUTimer *tx_timer;
     int tx_burst;
 };
@@ -135,7 +136,7 @@
 
         /* We assume 10 bits/char, OK for this purpose. */
         s->tx_burst = THROTTLE_TX_INTERVAL * 1000 /
-            (1000000 * 10 / (115200 / divider));
+            (1000000 * 10 / (s->baudbase / divider));
     }
     s->thr_ipending = 1;
     s->lsr |= UART_LSR_THRE;
@@ -163,7 +164,7 @@
     data_bits = (s->lcr & 0x03) + 5;
     if (s->divider == 0)
         return;
-    speed = 115200 / s->divider;
+    speed = s->baudbase / s->divider;
     ssp.speed = speed;
     ssp.parity = parity;
     ssp.data_bits = data_bits;
@@ -413,7 +414,8 @@
 }
 
 /* If fd is zero, it means that the serial device uses the console */
-SerialState *serial_init(int base, qemu_irq irq, CharDriverState *chr)
+SerialState *serial_init(int base, qemu_irq irq, int baudbase,
+                         CharDriverState *chr)
 {
     SerialState *s;
 
@@ -421,6 +423,7 @@
     if (!s)
         return NULL;
     s->irq = irq;
+    s->baudbase = baudbase;
 
     s->tx_timer = qemu_new_timer(vm_clock, serial_tx_done, s);
     if (!s->tx_timer)
@@ -512,8 +515,8 @@
 };
 
 SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
-                             qemu_irq irq, CharDriverState *chr,
-                             int ioregister)
+                             qemu_irq irq, int baudbase,
+                             CharDriverState *chr, int ioregister)
 {
     SerialState *s;
     int s_io_memory;
@@ -524,6 +527,7 @@
     s->irq = irq;
     s->base = base;
     s->it_shift = it_shift;
+    s->baudbase= baudbase;
 
     s->tx_timer = qemu_new_timer(vm_clock, serial_tx_done, s);
     if (!s->tx_timer)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]