Page MenuHomeFreeBSD

[RFC} Use 115200 bps by default for serial ports
ClosedPublic

Authored by emaste on Aug 22 2022, 4:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 11, 2:29 PM
Unknown Object (File)
Mon, Nov 11, 2:22 AM
Unknown Object (File)
Thu, Nov 7, 10:01 PM
Unknown Object (File)
Thu, Nov 7, 5:02 PM
Unknown Object (File)
Thu, Nov 7, 5:00 PM
Unknown Object (File)
Thu, Nov 7, 3:56 PM
Unknown Object (File)
Thu, Nov 7, 3:34 PM
Unknown Object (File)
Apr 13 2024, 10:40 AM

Details

Summary

For decades 9600 was the standard baud rate, but for many years now most equipment has defaulted to 115200.

Posted for discussion, including deployment questions. We would not MFC.

Diff Detail

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

Event Timeline

All for it. Too many places to touch though it seems (and the i386 exception to deal with still). I wonder if there could be some de-dup done for a default value?

emaste added inline comments.
share/examples/etc/make.conf
170

Not sure if we want similar text, maybe just something like "9600 is also common in some environments."

stand/i386/boot0/Makefile
51 ↗(On Diff #109670)

boot0 doesn't support above 9600?

tools/tools/nanobsd/rescue/Files/etc/ttys
46–47

Curious that this one already set ttyu0 to 115200

usr.bin/fortune/datfiles/freebsd-tips
835 ↗(On Diff #109670)
usr.sbin/bhyve/uart_emul.c
71 ↗(On Diff #109670)

My guess is this doesn't matter much, I suspect either UEFI fw or the guest will set it in most cases.

I wonder if there could be some de-dup done for a default value?

I guess we could include ../Makefile.inc from all of the i386 loaders (boot0, boot2, gptboot etc.) for a fairly easy cleanup, although I'm not sure there won't be some conflicts LDSCRIPT etc.

Thanks for jumping on this...

stand/i386/boot0/Makefile
51 ↗(On Diff #109670)

It does. I've done 115200 with boot0.... But it's weird...
9600 is the fastest we can go with BIOS INT 0x14 routines.
and we do all our boot0 stuff using int 14 routines.
However, the system often initializes the serial port to 115200, and if you define BOOT_BOOT0_COMCONSOLE_SPEED=0, then it works because then your boot blocks won't touch the speed register.
And boot0 is little used anymore since it's MBR based.
And we have like 5 or 6 bytes left in the boot blocks, so rewriting to bang the hardware directly likely would overflow. We currently use ~20ish bytes for all serial interaction so 25 bytes would be hard to do read, write, poll and configure in...
Plus we're hard coded to COM1.
sio.o in boot2 is 90 bytes, so yea, we're stuck with this.
We don't document either one of these boot loaders currently (boot0 or boot0sio)

sys/dev/uart/uart_dev_quicc.c
300 ↗(On Diff #109670)

don't change this one, not even the comment. IT's legacy powerpc for booke which is somewhat on the obsolete end of the spectrum.

sys/dev/uart/uart_dev_z8530.c
337 ↗(On Diff #109670)

Ditto. Different variant of the same part used, I think, in old G3/G4/G5 macs.

sys/dev/usb/serial/umcs.c
516 ↗(On Diff #109670)

Unsure why it does this...

tools/tools/nanobsd/rescue/Files/etc/ttys
49

These all likely need to be merged from /etc/ttys that we use for the whole system.
These are all off and 9600 due to the long, dead past... off is more important though.

51

This doesn't matter. dcons has no baud rate.

usr.bin/fortune/datfiles/freebsd-tips
835 ↗(On Diff #109670)

I've needed this forever :) But maybe we should keep this as 9600 to show how to get the old value :)

usr.sbin/boot0cfg/boot0cfg.8
169 ↗(On Diff #109670)

Yea, due to using int $0x14, we can't go faster than 9600.

In D36295#824156, @bz wrote:

All for it. Too many places to touch though it seems (and the i386 exception to deal with still). I wonder if there could be some de-dup done for a default value?

I think we can de-dup most of the BIOS build. There's a lot of accumulated technical debt remaining there still (despite many improvements).

It's interesting that we don't define a baud rate that's default for the tty layer...

I wonder if there could be some de-dup done for a default value?

I guess we could include ../Makefile.inc from all of the i386 loaders (boot0, boot2, gptboot etc.) for a fairly easy cleanup, although I'm not sure there won't be some conflicts LDSCRIPT etc.

There's a mechanism to do this already, and I can help move things to the common places (creating those if they aren't there already)

sys/dev/uart/uart_dev_quicc.c
300 ↗(On Diff #109670)

Yeah, I just looked at all instances of 9600 and marked some of them to come back later for a second look.

tools/tools/nanobsd/rescue/Files/etc/ttys
51

IMO it's still better to have 115200 as a consistent value, even if not used.

usr.bin/fortune/datfiles/freebsd-tips
835 ↗(On Diff #109670)

It should be just as easy for someone to look at my updated example and understand what's needed to get 9600, as it is for someone to took at the old example and figure out how to get 115200 instead.

drop powerpc bits as suggested by @imp

Should we consider getting this in for 14?

stand/efi/loader/efiserialio.c
44 ↗(On Diff #114204)

This file has moved.

stand/i386/boot0/Makefile
51 ↗(On Diff #109670)

So this should be ?= 9600 # No way to set baud rate 115200 via BIOS interfaces

Should we consider getting this in for 14?

We have this in 14.0 planning. Do we still have chance?

Even though late, I support this in 14

This revision is now accepted and ready to land.Aug 15 2023, 9:35 PM

There's one or two XXX to be resolved but apart from that, yes please.

There should probably be an UPDATING entry for those who use boot0 to revert back to 9600 in that case.

I'm all for this, and yes, in 14 please.