[coreboot-gerrit] New patch to review for coreboot: c1f8789 libpayload: Fix to properly disable serial console

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Tue May 13 12:05:53 CEST 2014


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5723

-gerrit

commit c1f878967264db9201a672a74a3069fc7cd41fc8
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Tue May 13 12:57:26 2014 +0300

    libpayload: Fix to properly disable serial console
    
    With coreboot builds with serial console disabled, there is no
    CB_TAG_SERIAL entry in coreboot tables. We ended up with
    lib_sysinfo.serial == NULL and serial_hardware_is_present == 1.
    
    Change-Id: I9a2fc0b55bf77769f2f2bfbb2b5476bee8083f7d
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 payloads/libpayload/drivers/serial.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/payloads/libpayload/drivers/serial.c b/payloads/libpayload/drivers/serial.c
index a4cd6d0..0d2964b 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);
 }
 



More information about the coreboot-gerrit mailing list