]> git.proxmox.com Git - mirror_qemu.git/commitdiff
serial-isa: Use MAX_ISA_SERIAL_PORTS instead of MAX_SERIAL_PORTS
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 20 Apr 2018 14:52:46 +0000 (15:52 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 26 Apr 2018 12:57:00 +0000 (13:57 +0100)
The ISA serial port handling in serial-isa.c imposes a limit
of 4 serial ports. This is because we only know of 4 IO port
and IRQ settings for them, and is unrelated to the generic
MAX_SERIAL_PORTS limit, though they happen to both be set at
4 currently.

Use a new MAX_ISA_SERIAL_PORTS wherever that is the correct
limit to be checking against.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180420145249.32435-11-peter.maydell@linaro.org

hw/char/serial-isa.c
hw/i386/pc.c
hw/mips/mips_r4k.c
hw/ppc/pnv.c
hw/sparc64/sun4u.c
include/hw/char/serial.h

index eb5996159d3df699255671b3b8e5faf416e106a0..116b7b2e69d4cf75a3350e48da2a8c8f27a3ef2a 100644 (file)
@@ -39,10 +39,10 @@ typedef struct ISASerialState {
     SerialState state;
 } ISASerialState;
 
-static const int isa_serial_io[MAX_SERIAL_PORTS] = {
+static const int isa_serial_io[MAX_ISA_SERIAL_PORTS] = {
     0x3f8, 0x2f8, 0x3e8, 0x2e8
 };
-static const int isa_serial_irq[MAX_SERIAL_PORTS] = {
+static const int isa_serial_irq[MAX_ISA_SERIAL_PORTS] = {
     4, 3, 4, 3
 };
 
@@ -56,9 +56,9 @@ static void serial_isa_realizefn(DeviceState *dev, Error **errp)
     if (isa->index == -1) {
         isa->index = index;
     }
-    if (isa->index >= MAX_SERIAL_PORTS) {
+    if (isa->index >= MAX_ISA_SERIAL_PORTS) {
         error_setg(errp, "Max. supported number of ISA serial ports is %d.",
-                   MAX_SERIAL_PORTS);
+                   MAX_ISA_SERIAL_PORTS);
         return;
     }
     if (isa->iobase == -1) {
@@ -138,7 +138,7 @@ void serial_hds_isa_init(ISABus *bus, int from, int to)
     int i;
 
     assert(from >= 0);
-    assert(to <= MAX_SERIAL_PORTS);
+    assert(to <= MAX_ISA_SERIAL_PORTS);
 
     for (i = from; i < to; ++i) {
         if (serial_hd(i)) {
index d36bac8c896959296ac181a3316d0fd20228c18e..b297a5d63baf237f449ed2c8974f80456e2b8ee5 100644 (file)
@@ -1524,7 +1524,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
     qemu_irq *a20_line;
     ISADevice *i8042, *port92, *vmmouse;
 
-    serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
+    serial_hds_isa_init(isa_bus, 0, MAX_ISA_SERIAL_PORTS);
     parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS);
 
     for (i = 0; i < MAX_FD; i++) {
index aeadc4a34049697f5e978579174622bb4ec0359e..e04b49d3c5d8aae5468a1e03398dabe4d113bfa5 100644 (file)
@@ -274,7 +274,7 @@ void mips_r4k_init(MachineState *machine)
 
     pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 
-    serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
+    serial_hds_isa_init(isa_bus, 0, MAX_ISA_SERIAL_PORTS);
 
     isa_vga_init(isa_bus);
 
index 98ee3c607ae7b02c6abce9e83d6a9702abf66ddb..549cfccdcbf9e516d2d1b4461d996285d5cdd367 100644 (file)
@@ -648,7 +648,7 @@ static void pnv_init(MachineState *machine)
     pnv->isa_bus = pnv_isa_create(pnv->chips[0]);
 
     /* Create serial port */
-    serial_hds_isa_init(pnv->isa_bus, 0, MAX_SERIAL_PORTS);
+    serial_hds_isa_init(pnv->isa_bus, 0, MAX_ISA_SERIAL_PORTS);
 
     /* Create an RTC ISA device too */
     mc146818_rtc_init(pnv->isa_bus, 2000, NULL);
index 9b441f704bd362c3f290df6ff0c92514c1b2ce99..1bede853704044d2986bab2da1afb9578c8d106e 100644 (file)
@@ -298,7 +298,7 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
                        0, NULL, 115200, serial_hd(i), DEVICE_BIG_ENDIAN);
         i++;
     }
-    serial_hds_isa_init(s->isa_bus, i, MAX_SERIAL_PORTS);
+    serial_hds_isa_init(s->isa_bus, i, MAX_ISA_SERIAL_PORTS);
 
     /* Parallel ports */
     parallel_hds_isa_init(s->isa_bus, MAX_PARALLEL_PORTS);
index c4daf11a1467f5d59df6568069234cc9b945e4ab..0acfbbc382634953aa5ada2d064644b92c49ad66 100644 (file)
@@ -95,6 +95,9 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
                             Chardev *chr, enum device_endian end);
 
 /* serial-isa.c */
+
+#define MAX_ISA_SERIAL_PORTS 4
+
 #define TYPE_ISA_SERIAL "isa-serial"
 void serial_hds_isa_init(ISABus *bus, int from, int to);