On Wed, Nov 27, 2024 at 3:48 AM Daniel Braniss <da...@cs.huji.ac.il> wrote:

>
>
> On 27 Nov 2024, at 11:42, Warner Losh <i...@bsdimp.com> wrote:
>
>
>
> On Wed, Nov 27, 2024, 2:12 AM Daniel Braniss <da...@cs.huji.ac.il> wrote:
>
>>
>>
>> > On 27 Nov 2024, at 10:45, Kurt Jaeger <p...@freebsd.org> wrote:
>> >
>> > Hi!
>> >
>> >> when the console is not uart0, init’s output, which I assume uses
>> /dev/console
>> >> is lost. Boot, kernel and login work ok, also debugger.
>> >>
>> >> so, is there a way to configure /dev/console to uart1?
>> >
>> > I made some notes, and they point, among other things, to:
>> >
>> > https://reviews.freebsd.org/D36286
>> >
>> > kenv | grep cons
>> > boot_multicons="YES"
>> > comconsole_pcidev=""
>> > comconsole_port="1016"
>> > comconsole_speed="115200"
>> > console="comconsole"
>> > hw.uart.console="io:1016,br:115200"
>> >
>> > So probably it can be configured, but I've never tried it.
>>
>> done that, that’s how I get most of the messages - forgot to mention
>> i’m using SOL/ipmi to get the console,
>> it’s the annoying init’s output that is missing, so I have to guess
>> why it’s not going multiuser :-(
>>
>
> BIOS or UEFI?
>
> UEFI.
> the hosts in question are Dell 7xx, and bios/pxeboot no longer works
>

Hmmm, it should still work. I cleaned out the extra junk in the BIOS boot
loader
so it should fit again and my simple tests worked....

But, the tl;dr is likely just adding 'boot_serial=YES' and the
"hw.uart.console"
line above to /loader.conf and deleting all the comconsole lines (since they
will result in doubled output if the console really is redirected at the
UEFI
level, see below for more details on all this :_

The too long to read is:

So, if you have UEFI, then comconsole won't do anything. Ignore all the
advice
that says to set it. That won't help. That's really only for BIOS and UEFI
that
does *NOT* have console redirection. Also, ignore the advice about setting
the flags. That's ignored when you have hw.uart.console set anyway. It's the
old SIO way of doing things that uart only ever partially emulated.

You need to set "hw.uart.console" to select the proper console. If it
really is
COM1, then
hw.uart.console="io:1016,br:115200"
will work (it is also the default). Sadly, we do not have an ACPI parser in
the loader, so we can't set this automatically by default. But, if by
some chance you're wrong about the port, the following is what I
recommend (if you are right, you'll have ttyu0 below).

After the system boots, you'll have a login banner:

FreeBSD/amd64 (dune.bsdimp.com) (ttyu1)
login:

The 'uX' is the part you're interested in. That says which port is really
connected to the redirect. Once you see that, you can find its resources
with devinfo -r:
...
    uart1
        Interrupt request lines:
            0x3
        I/O ports:
            0x2f8-0x2ff
...

So for my case, you'd need to add
hw.uart.console="io:0x2f8,br:115200"
in your /boot/loader.conf.

If you can't easily get to the console, for whatever reason (usually it's a
bad
baud rate that's been set, but not always), you can find the right thing to
use
another way:

% sudo efivar --device-path 8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOut
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOut
:
PciRoot(0x2)/Pci(0x1,0x2)/Pci(0x0,0x0)/Pci(0x0,0x0)/AcpiAdr(0x80010100),/PciRoot(0x0)/Pci(0x14,0x3)/Serial(0x2)/Uart(115200,8,N,1)/UartFlowCtrl(Hardware)/VenVt100Plus()

Here you see that I have a setup where I have video and serial for the
mulit-cons (when the redirect
is active, we automatically pick that up, so boot_mulit isn't really needed)

The serial port is "Serial(0x2)" which means that the _UID of the serial
port is 2. You'd
then find that with devinfo -v:

 devinfo -v | grep uart
    uart0 pnpinfo _HID=PNP0501 _UID=1 _CID=none at
handle=\_SB_.PCI0.SBRG.UAR1
    uart1 pnpinfo _HID=PNP0501 _UID=2 _CID=none at
handle=\_SB_.PCI0.SBRG.UAR2

And again you'd see that it's uart1. The _UID is just an arbitrary number
(technically it could
be a string, but other standards only have room for a number so I've only
ever seen numbers
here). I have other systems that number UID from 0 and have seen one super
weird one
that has the UID numbers 42 and 2112 for its two serial ports (Must have
been a Douglas
Adams and Rush fan).

If you get only the kernel messages on the serial port, but not the results
of
/etc/rc and then see a login prompt, you'll likely find something like:
    Dual Console: Video Primary, Serial Secondary
in your dmesg. We currently don't support two physical devices connected
to /dev/console, so the primary one wins. You can make the serial console
primary by adding "boot_serial=YES" to /boot/loader.conf. That still gives
you both serial and video, but makes the serial port primary so you see
all the /etc/rc boot messages there. dmesg will contain:
    Dual Console: Serial Primary, Video Secondary
after you do this.

conscontrol(8) will list what's configured and what's available, though has
it's
own quirks that likely need to be documented better. For example 'uart' is
would be the console here, and it would obey hw.uart.console tuneable. The
primary is also listed first here.

Warner


>
> Warner
>
> thanks,
>>         danny
>>
>>
>>
>> >
>> > --
>> > p...@freebsd.org         +49 171 3101372                  Now what ?
>
>
>

Reply via email to