diff options
author | Gabe Black <gabeblack@google.com> | 2013-01-18 18:37:29 -0800 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-03-13 23:05:06 +0100 |
commit | b7b57d97512f1a5fc9a102ae0374ff08242b6e0c (patch) | |
tree | 6d865e511f2b0fb7650c88d451d3dc3e822652f4 /payloads | |
parent | d8d4d113f005c28f3b8d9cc2c6b57627bdf35de1 (diff) | |
download | coreboot-b7b57d97512f1a5fc9a102ae0374ff08242b6e0c.tar.xz |
libpayload: If there's no IO address space, don't try to use it for serial
Change-Id: I01b1fa42139af925716cd5d57f96dc24da6df5a7
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2660
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'payloads')
-rw-r--r-- | payloads/libpayload/drivers/serial.c | 16 |
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 |