Kernel configuration ==================== Add the following two lines to your kernel configuration file: device puc device uart Also be sure to remove or comment out the "device sio" line in your kernel configuration, otherwise sio(4) will get used! /boot/loader.conf configuration =============================== Add the following lines to /boot/loader.conf, which will enable uart(4) for two serial ports (COM1 and COM2), and disable COM3 and COM4: # For use with uart(4) hint.uart.0.at="isa" hint.uart.0.port="0x3F8" hint.uart.0.flags="0x10" hint.uart.0.irq="4" hint.uart.1.at="isa" hint.uart.1.port="0x2F8" hint.uart.1.irq="3" hint.uart.2.disabled="1" hint.uart.3.disabled="1" NOTE #1: I'm not even sure these hints are needed. I would need to look at the actual driver to determine that. It may be that some features are determined based on /boot.config or other loader.conf settings (such as set console="comconsole", etc.). NOTE #2: Some people have recommended you add these to /boot/device.hints, but I recommend otherwise. You can add hints to loader.conf which is a "local" configuration file; device.hints(5) is supposed to be updated by the FreeBSD driver development folks as needed, and in my opinion should only be updated via mergemaster(8). /etc/ttys configuration ======================= The uart(4) driver uses a different naming convention for the serial ports (both callin and callout). With sio(4), the callin ports are ttydX while with uart(4) they are ttyuX. So, add some entries to /etc/ttys: # Serial terminals (for uart(4)) ttyu0 "/usr/libexec/getty std.9600" dialup off secure ttyu1 "/usr/libexec/getty std.9600" dialup off secure ttyu2 "/usr/libexec/getty std.9600" dialup off secure ttyu3 "/usr/libexec/getty std.9600" dialup off secure Make appropriate changes the above as you see fit (such as enabling ttyu0, setting a different port speed, etc.) Rebuild the kernel ================== Now rebuild your kernel and reboot. cd /usr/src make buildkernel make installkernel reboot That's it! ========== You should see a line similar to the following in your dmesg on bootup (usually right after the keyboard/system console section): uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0 Caveats/Issues ============== One issue I've encountered with uart(4) is characters on the serial port being either lost, or entire lines/paragraphs duplicated, even when hardware RTS/CTS flow control is used. I've also seen this happen with the sio(4) driver, but not as often. Example (induced by hitting a few times): login: FreeBSD/i386 (medusa.parodius.com) (ttyu0) login: login: ) (medusa.parodius.com) (ttyu0) login: login: (medusa.parodius.com) (ttyu0) login: FreeBSD/i386 (medusa.parodius.com) (ttyu0) This only happens at the console login prompt (e.g. getty + login), and does not happen once the user has logged in and spawned a shell. Thus, stty(1) must be doing something to the tty that makes it behave properly. Making a gettytab entry which included the "hw" gettytab(5) entry did not fix the problem, nor did using XON/XOFF flow control. I reported this issue to Marcus Moolenaar, who had the following to say: > Oddly enough, this is normal behaviour. What happens is that login(1) > terminates when you hit enter. getty(8) re-initializes the line and > starts up a login(1) again. This causes the TTY buffers to prune and > data to be lost. This all happens in layers above uart(4). It's not > (necessarily) an indication of a flow-control problem.