Page MenuHomeFreeBSD

sifive_uart: Fix input character dropping in ddb and at a mountroot prompt
ClosedPublic

Authored by jrtc27 on Jul 5 2021, 12:04 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 27 2024, 10:11 PM
Unknown Object (File)
Jan 27 2024, 10:11 PM
Unknown Object (File)
Jan 27 2024, 4:07 AM
Unknown Object (File)
Jan 27 2024, 3:55 AM
Unknown Object (File)
Jan 13 2024, 2:17 PM
Unknown Object (File)
Dec 25 2023, 4:21 AM
Unknown Object (File)
Dec 22 2023, 11:17 PM
Unknown Object (File)
Dec 10 2023, 7:07 PM
Subscribers

Details

Summary

These use the raw console interface and poll. Unfortunately, the SiFive
UART puts the FIFO empty bit inside the FIFO data register, which means
that the act of checking whether a character is available also dequeues
any character from the FIFO, requiring the user to press each key twice.
However, since we configure the watermark to be 0 and, when the UART has
been grabbed for the console, we have interrupts off, we can abuse the
interrupt pending register to act as a substitute for the FIFO empty
bit.

This perhaps suggests that the console interface should move from having
rxready and getc to having getc_nonblock and getc (or make getc take a
bool), as all the places that call rxready do so to avoid blocking on
getc when there is no character available.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jrtc27 created this revision.
philip added a subscriber: philip.

This changes looks good to me. Though I agree with your observation that we should consider moving away from rxready. I wonder why we never noticed this on the FU540. Did this change?

This revision is now accepted and ready to land.Jul 5 2021, 8:02 AM

This changes looks good to me. Though I agree with your observation that we should consider moving away from rxready. I wonder why we never noticed this on the FU540. Did this change?

It doesn't affect normal serial console use as that uses the uart methods, it's only for the low-level console, i.e. ddb, which includes mountroot, so I assume nobody ever tried to use it with those (or did and never bothered fixing it).

This changes looks good to me. Though I agree with your observation that we should consider moving away from rxready. I wonder why we never noticed this on the FU540. Did this change?

It doesn't affect normal serial console use as that uses the uart methods, it's only for the low-level console, i.e. ddb, which includes mountroot, so I assume nobody ever tried to use it with those (or did and never bothered fixing it).

Ah. That makes sense. I can't remember ever running into this. Thanks for fixing it. :)