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>
This commit is contained in:
Gabe Black 2013-01-18 18:37:29 -08:00 committed by Ronald G. Minnich
parent d8d4d113f0
commit b7b57d9751
1 changed files with 10 additions and 6 deletions

View File

@ -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