libpayload: Fix the logic for hardware-less serial consoles
This fixes the configuration where serial console output is being sent to non-existant hardware to be captured with I/O trapping. In this configuration where there isn't serial hardware present we still want to init the consoles. We just never want to read non-existant hardware. Change-Id: Ic51dc574b9c0df3f6ed071086b0fb2119afedc44 Signed-off-by: Dave Frodin <dave.frodin@se-eng.com> Reviewed-on: http://review.coreboot.org/3249 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
4bd7b0cbad
commit
adc300d88b
|
@ -34,7 +34,7 @@
|
||||||
#define IOBASE lib_sysinfo.serial->baseaddr
|
#define IOBASE lib_sysinfo.serial->baseaddr
|
||||||
#define MEMBASE (phys_to_virt(IOBASE))
|
#define MEMBASE (phys_to_virt(IOBASE))
|
||||||
|
|
||||||
static int serial_hardware_is_present = 0;
|
static int serial_hardware_is_present = 1;
|
||||||
static int serial_is_mem_mapped = 0;
|
static int serial_is_mem_mapped = 0;
|
||||||
|
|
||||||
static uint8_t serial_read_reg(int offset)
|
static uint8_t serial_read_reg(int offset)
|
||||||
|
@ -105,7 +105,7 @@ void serial_init(void)
|
||||||
#ifdef CONFIG_IO_ADDRESS_SPACE
|
#ifdef CONFIG_IO_ADDRESS_SPACE
|
||||||
if ((inb(IOBASE + 0x05) == 0xFF) &&
|
if ((inb(IOBASE + 0x05) == 0xFF) &&
|
||||||
(inb(IOBASE + 0x06) == 0xFF)) {
|
(inb(IOBASE + 0x06) == 0xFF)) {
|
||||||
return;
|
serial_hardware_is_present = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
printf("IO space mapped serial not supported.");
|
printf("IO space mapped serial not supported.");
|
||||||
|
@ -113,9 +113,6 @@ void serial_init(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
serial_hardware_is_present = 1;
|
|
||||||
|
|
||||||
#ifdef CONFIG_SERIAL_SET_SPEED
|
#ifdef CONFIG_SERIAL_SET_SPEED
|
||||||
serial_hardware_init(CONFIG_SERIAL_BAUD_RATE, 8, 0, 1);
|
serial_hardware_init(CONFIG_SERIAL_BAUD_RATE, 8, 0, 1);
|
||||||
#endif
|
#endif
|
||||||
|
@ -125,8 +122,7 @@ void serial_init(void)
|
||||||
|
|
||||||
void serial_putchar(unsigned int c)
|
void serial_putchar(unsigned int c)
|
||||||
{
|
{
|
||||||
if (!serial_hardware_is_present)
|
if (serial_hardware_is_present)
|
||||||
return;
|
|
||||||
while ((serial_read_reg(0x05) & 0x20) == 0) ;
|
while ((serial_read_reg(0x05) & 0x20) == 0) ;
|
||||||
serial_write_reg(c, 0x00);
|
serial_write_reg(c, 0x00);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue