From 33dfda973ac3e937afa23c948e62dd90ec3abd94 Mon Sep 17 00:00:00 2001 From: hpa Date: Mon, 29 Aug 2005 20:24:29 +0000 Subject: [PATCH] Enable the 16550A FIFO when doing serial console --- NEWS | 2 ++ parseconfig.inc | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e23fbd9..ccec82a 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ Changes in 3.11: problems on some network cards. * MEMDISK: Try work around a bug on some BIOSes when no physical floppy disk is present in the system. + * Enable the 16550A FIFOs, if present, when doing serial + console. Changes in 3.10: * gcc 4.0.1 compilation fixes. diff --git a/parseconfig.inc b/parseconfig.inc index 30fd544..09712b9 100644 --- a/parseconfig.inc +++ b/parseconfig.inc @@ -197,18 +197,26 @@ pc_serial: call getint mov di,[di+serial_base] ; Get the I/O port from the BIOS .port_is_io: mov [SerialPort],di + + ; + ; Begin code to actually set up the serial port + ; lea dx,[di+3] ; DX -> LCR mov al,83h ; Enable DLAB call slow_out + pop ax ; Divisor mov dx,di ; DX -> LS call slow_out + inc dx ; DX -> MS mov al,ah call slow_out + mov al,03h ; Disable DLAB add dx,byte 2 ; DX -> LCR call slow_out + in al,dx ; Read back LCR (detect missing hw) cmp al,03h ; If nothing here we'll read 00 or FF jne .serial_port_bad ; Assume serial port busted @@ -216,7 +224,20 @@ pc_serial: call getint xor al,al ; IRQ disable call slow_out - add dx,byte 3 ; DX -> MCR + inc dx + inc dx ; DX -> FCR + mov al,01h + call slow_out ; Enable FIFOs if present + dec dx ; DX -> IIR + in al,dx + inc dx ; DX -> FCR + cmp al,0C0h ; FIFOs enabled and usable? + jae .fifo_ok + xor ax,ax ; Disable FIFO if unusable + call slow_out +.fifo_ok: + + inc dx ; DX -> MCR in al,dx or al,[FlowOutput] ; Assert bits call slow_out -- 2.7.4