Skip to contentSkip to conversation

kvm tools: unify all serials' registers with the first serial

PATCH New Liming Wang 1 participant 1 message Aug 12, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm tools: unify all serials' registers with the first serial

To make all serials work well, unify value of the last three serials' registers with the first serial. Otherwise, using ttyS1, ttyS2, ttyS3 as console will slow the output.

---
 tools/kvm/hw/serial.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
tools/kvm/hw/serial.c +10 -7
index 1199264..f817a4e 100644
@@ -31,6 +31,12 @@ struct serial8250_device {
 	u8			scr;
 };
 
+#define SERIAL_REGS_SETTING \
+	.iir			= UART_IIR_NO_INT, \
+	.lsr			= UART_LSR_TEMT | UART_LSR_THRE, \
+	.msr			= UART_MSR_DCD | UART_MSR_DSR | UART_MSR_CTS, \
+	.mcr			= UART_MCR_OUT2,
+
 static struct serial8250_device devices[] = {
 	/* ttyS0 */
 	[0]	= {
@@ -39,10 +45,7 @@ static struct serial8250_device devices[] = {
 		.iobase			= 0x3f8,
 		.irq			= 4,
 
-		.iir			= UART_IIR_NO_INT,
-		.lsr			= UART_LSR_TEMT | UART_LSR_THRE,
-		.msr			= UART_MSR_DCD | UART_MSR_DSR | UART_MSR_CTS,
-		.mcr			= UART_MCR_OUT2,
+		SERIAL_REGS_SETTING
 	},
 	/* ttyS1 */
 	[1]	= {
@@ -51,7 +54,7 @@ static struct serial8250_device devices[] = {
 		.iobase			= 0x2f8,
 		.irq			= 3,
 
-		.iir			= UART_IIR_NO_INT,
+		SERIAL_REGS_SETTING
 	},
 	/* ttyS2 */
 	[2]	= {
@@ -60,7 +63,7 @@ static struct serial8250_device devices[] = {
 		.iobase			= 0x3e8,
 		.irq			= 4,
 
-		.iir			= UART_IIR_NO_INT,
+		SERIAL_REGS_SETTING
 	},
 	/* ttyS3 */
 	[3]	= {
@@ -69,7 +72,7 @@ static struct serial8250_device devices[] = {
 		.iobase			= 0x2e8,
 		.irq			= 3,
 
-		.iir			= UART_IIR_NO_INT,
+		SERIAL_REGS_SETTING
 	},
 };
 
Signature · 1 line
1.7.0.4