summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/drivers/serial.c')
-rw-r--r--payloads/libpayload/drivers/serial.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/payloads/libpayload/drivers/serial.c b/payloads/libpayload/drivers/serial.c
index a4cd6d013a..0d2964b771 100644
--- a/payloads/libpayload/drivers/serial.c
+++ b/payloads/libpayload/drivers/serial.c
@@ -34,7 +34,7 @@
#define IOBASE lib_sysinfo.serial->baseaddr
#define MEMBASE (phys_to_virt(IOBASE))
-static int serial_hardware_is_present = 1;
+static int serial_hardware_is_present = 0;
static int serial_is_mem_mapped = 0;
static uint8_t serial_read_reg(int offset)
@@ -105,7 +105,8 @@ void serial_init(void)
#ifdef CONFIG_IO_ADDRESS_SPACE
if ((inb(IOBASE + 0x05) == 0xFF) &&
(inb(IOBASE + 0x06) == 0xFF)) {
- serial_hardware_is_present = 0;
+ printf("IO space mapped serial not present.");
+ return;
}
#else
printf("IO space mapped serial not supported.");
@@ -118,12 +119,14 @@ void serial_init(void)
#endif
console_add_input_driver(&consin);
console_add_output_driver(&consout);
+ serial_hardware_is_present = 1;
}
void serial_putchar(unsigned int c)
{
- if (serial_hardware_is_present)
- while ((serial_read_reg(0x05) & 0x20) == 0) ;
+ if (!serial_hardware_is_present)
+ return;
+ while ((serial_read_reg(0x05) & 0x20) == 0) ;
serial_write_reg(c, 0x00);
}