]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Clean up early serial code
authorPekka Enberg <penberg@cs.helsinki.fi>
Sun, 11 Apr 2010 18:05:36 +0000 (21:05 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Sun, 11 Apr 2010 18:05:36 +0000 (21:05 +0300)
Use similar constants and variable names as in arch/x86/kernel/early_printk.c
in the Linux kernel.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
tools/kvm/early_printk.c

index 026ab789520931b77e224f5054ba5efd1f8070b5..49e58d452e870717a5f8e139dd63e4aa9582458f 100644 (file)
@@ -4,6 +4,13 @@
 
 #include <stdio.h>
 
+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);
 }