mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
vl.c: new function serial_max_hds()
Create a new function serial_max_hds() which returns the number of serial ports defined by the user. This is needed only by spapr. This allows us to remove the MAX_SERIAL_PORTS define. 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-14-peter.maydell@linaro.org
This commit is contained in:
parent
6af2692e86
commit
b8846a4d63
3 changed files with 10 additions and 3 deletions
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
5
vl.c
5
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue