summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--payloads/libpayload/drivers/serial.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/payloads/libpayload/drivers/serial.c b/payloads/libpayload/drivers/serial.c
index 4ae3e26dbe..df0f2e3438 100644
--- a/payloads/libpayload/drivers/serial.c
+++ b/payloads/libpayload/drivers/serial.c
@@ -39,18 +39,22 @@ static int serial_is_mem_mapped = 0;
static uint8_t serial_read_reg(int offset)
{
- if (serial_is_mem_mapped)
- return readb(MEMBASE + offset);
- else
+#ifdef CONFIG_IO_ADDRESS_SPACE
+ if (!serial_is_mem_mapped)
return inb(IOBASE + offset);
+ else
+#endif
+ return readb(MEMBASE + offset);
}
static void serial_write_reg(uint8_t val, int offset)
{
- if (serial_is_mem_mapped)
- writeb(val, MEMBASE + offset);
- else
+#ifdef CONFIG_IO_ADDRESS_SPACE
+ if (!serial_is_mem_mapped)
outb(val, IOBASE + offset);
+ else
+#endif
+ writeb(val, MEMBASE + offset);
}
#ifdef CONFIG_SERIAL_SET_SPEED