]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Fix magic numbers in 8250 support
authorPekka Enberg <penberg@kernel.org>
Sat, 8 Jan 2011 20:51:10 +0000 (22:51 +0200)
committerPekka Enberg <penberg@kernel.org>
Sat, 8 Jan 2011 20:52:21 +0000 (22:52 +0200)
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/early_printk.c

index ffc405fa86c6ecfd22dd4de13491503eae0430fc..a10d35846309cbf665973630666c984abe2b20e1 100644 (file)
 /* Interrupt identification register */
 #define IIR            2
 
+#define UART_IIR_NO_INT                0x01
+
 /* 16550 FIFO Control Register */
 #define FCR            2
 
 /* Line control register */
 #define LCR            3
-enum {
-       DLAB            = 1 << 7,               /* Divisor latch access bit (DLAB) */
-       /* bit 7 - set break enable */
-       PM2             = 1 << 5,
-       PM1             = 1 << 4,
-       PM0             = 1 << 3,
-       STB             = 1 << 2,
-       WLS1            = 1 << 1,
-       WLS0            = 1 << 0,
-};
+
+#define UART_LCR_DLAB          0x80
 
 /* Modem control register */
 #define MCR            4
@@ -45,9 +39,13 @@ enum {
 /* Line status register */
 #define LSR            5
 
+#define UART_LSR_THRE          0x20
+
 /* Modem status register */
 #define MSR            6
 
+#define UART_MSR_CTS           0x10
+
 /* Scratch register */
 #define SCR            7
 
@@ -70,7 +68,7 @@ static bool serial8250_out(struct kvm *self, uint16_t port, void *data, int size
 {
        uint16_t offset = port - device.iobase;
 
-       if (device.lcr & DLAB) {
+       if (device.lcr & UART_LCR_DLAB) {
                switch (offset) {
                case DLL:
                        device.dll              = ioport__read8(data);
@@ -127,7 +125,7 @@ static bool serial8250_in(struct kvm *self, uint16_t port, void *data, int size,
 {
        uint16_t offset = port - device.iobase;
 
-       if (device.lcr & DLAB)
+       if (device.lcr & UART_LCR_DLAB)
                return false;
 
        switch (offset) {
@@ -138,7 +136,7 @@ static bool serial8250_in(struct kvm *self, uint16_t port, void *data, int size,
                ioport__write8(data, device.ier);
                break;
        case IIR:
-               ioport__write8(data, 0x01); /* no interrupt pending */
+               ioport__write8(data, UART_IIR_NO_INT);
                break;
        case LCR:
                ioport__write8(data, device.lcr);
@@ -147,10 +145,10 @@ static bool serial8250_in(struct kvm *self, uint16_t port, void *data, int size,
                ioport__write8(data, device.mcr);
                break;
        case LSR:
-               ioport__write8(data, 0x20); /* XMTRDY */
+               ioport__write8(data, UART_LSR_THRE);
                break;
        case MSR:
-               ioport__write8(data, 0x01); /* clear to send */
+               ioport__write8(data, UART_MSR_CTS);
                break;
        case SCR:
                ioport__write8(data, device.scr);