From 9e855eb9afc15b3312011c9526879b2d669b3ab4 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sun, 11 Apr 2010 21:05:36 +0300 Subject: [PATCH] kvm: Clean up early serial code Use similar constants and variable names as in arch/x86/kernel/early_printk.c in the Linux kernel. Signed-off-by: Pekka Enberg --- tools/kvm/early_printk.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/kvm/early_printk.c b/tools/kvm/early_printk.c index 026ab7895209..49e58d452e87 100644 --- a/tools/kvm/early_printk.c +++ b/tools/kvm/early_printk.c @@ -4,6 +4,13 @@ #include +static int early_serial_base = 0x3f8; /* ttyS0 */ + +#define XMTRDY 0x20 + +#define TXR 0 /* Transmit register (WRITE) */ +#define LSR 5 /* Line Status */ + static bool early_serial_txr_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count) { char *p = data; @@ -21,7 +28,7 @@ static bool early_serial_lsr_in(struct kvm *self, uint16_t port, void *data, int { uint8_t *p = data; - *p = 0x20; /* xmtrdy */ + *p = XMTRDY; return true; } @@ -32,6 +39,6 @@ static struct ioport_operations early_serial_lsr_ops = { void early_printk__init(void) { - ioport__register(0x03F8, &early_serial_txr_ops); - ioport__register(0x03FD, &early_serial_lsr_ops); + ioport__register(early_serial_base + TXR, &early_serial_txr_ops); + ioport__register(early_serial_base + LSR, &early_serial_lsr_ops); } -- 2.39.5