aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/ppc/spapr.c2
-rw-r--r--include/sysemu/sysemu.h6
-rw-r--r--vl.c5
3 files changed, 10 insertions, 3 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b0ecfac..92194a9 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2589,7 +2589,7 @@ static void spapr_machine_init(MachineState *machine)
/* Set up VIO bus */
spapr->vio_bus = spapr_vio_bus_init();
- for (i = 0; i < MAX_SERIAL_PORTS; i++) {
+ for (i = 0; i < serial_max_hds(); i++) {
if (serial_hd(i)) {
spapr_vty_create(spapr->vio_bus, serial_hd(i));
}
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 989cbc2..544ab77 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -159,10 +159,12 @@ void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
/* serial ports */
-#define MAX_SERIAL_PORTS 4
-
/* Return the Chardev for serial port i, or NULL if none */
Chardev *serial_hd(int i);
+/* return the number of serial ports defined by the user. serial_hd(i)
+ * will always return NULL for any i which is greater than or equal to this.
+ */
+int serial_max_hds(void);
/* parallel ports */
diff --git a/vl.c b/vl.c
index a8a98c5..616956a 100644
--- a/vl.c
+++ b/vl.c
@@ -2524,6 +2524,11 @@ Chardev *serial_hd(int i)
return NULL;
}
+int serial_max_hds(void)
+{
+ return num_serial_hds;
+}
+
static int parallel_parse(const char *devname)
{
static int index = 0;