Page MenuHomeFreeBSD

sys: Simplify enabling EARLY_PRINTF uarts
ClosedPublic

Authored by andrew on Jan 8 2024, 5:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 17, 1:12 PM
Unknown Object (File)
Sat, May 11, 1:25 AM
Unknown Object (File)
Fri, May 10, 5:15 AM
Unknown Object (File)
Thu, May 9, 10:39 PM
Unknown Object (File)
Thu, May 9, 10:38 PM
Unknown Object (File)
Thu, May 2, 2:05 AM
Unknown Object (File)
Apr 24 2024, 10:35 AM
Unknown Object (File)
Apr 7 2024, 6:23 AM
Subscribers

Details

Summary

Support selecting the early uart with "options EARLY_PRINTF=foo" in
the kernel configuration file. This allows us to not have to change
source files when enabling EARLY_PRINTF, simplifying enabling it.

New uart drivers can be enabled by defining a new early_printf_foo
value to be unique, then using "#if CHECK_EARLY_PRINTF(foo)" to decide
when to enable the uart.

While here add pl011 early printf support.

Sponsored by: Arm Ltd

Diff Detail

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

Event Timeline

andrew requested review of this revision.Jan 8 2024, 5:26 PM
andrew created this revision.

What do existing kernel configs do with the new system? Looks like a compile error from the pre-processor when early_printf_ isn't defined.
If so, that's fine. there's half a dozen ways to do this, and this one is more straight forward to diagnose problems with and to understand the code and if the old config file is the only issue, people using this option have the skills to debug the change. An UPDATING entry wouldn't be bad though to document the change.

sys/dev/uart/uart_dev_ns8250.c
88

Do you need quotes around the error message? We're about 50/50 in the kernel. I think they are only required syntactically when there's weird quotes etc. style(9) is silent on the issue and the #errors in the kernel are a mixed bag: 342 / 675 have quotes.

This revision is now accepted and ready to land.Jan 8 2024, 6:14 PM

Check for "options EARLY_PRINTF" and report why the build failed

This revision now requires review to proceed.Jan 9 2024, 11:54 AM

It checks for early_printf_1. I've added a check for this with a #error to tell the user what the issue is.

sys/dev/uart/uart_dev_ns8250.c
88

Given it's about 50/50 I'll leave as is.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 13 2024, 11:53 AM
This revision was automatically updated to reflect the committed changes.