Re: More serial ports in EFI bootstrap?

Robert Swindells <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
Emmanuel Dreyfus <[email protected]> wrote:
> On Tue, Jun 17, 2025 at 03:41:15PM +0100, Robert Swindells wrote:
>> You could look at what is in sys/dev/ic/com.c to handle a serial
>> console and add the equivalent to sys/dev/usb/ucom.c.
>> 
>> Start at the 'struct consdev comcons' declaration, that links to the
>> functions needed.
>
> I created a struct filled with functions that for now are no-ops, they
> just return.
> static struct consdev comcons = {
>        .cn_probe = ucomcnprobe,
>        .cn_init = ucomcninit,
>        .cn_getc = ucomcngetc,
>        .cn_putc = ucomcnputc,
>        .cn_pollc = ucomcnpollc,
>        .cn_bell = ucomcnbell,
>        .cn_halt = ucomcnhalt,
>        .cn_flush = ucomcnflush,
>        .cn_dev = NODEV,
>        .cn_pri = CN_NORMAL
> };
>
> At the end of ucom_attach, I try this if everything went fine:
>        comcons.cn_dev = makedev(66, 0);
>        cn_tab = &comcons;

> That is enough to crash during the boot, and since there is no
> console, there is no clue about what went wrong. Any idea?

I think the point would be to not make the functions no-ops so that
you do have a console.

Have done this with a non-standard serial port for a PowerPC SoC.

You don't need all the functions, maybe start with .cn_putc.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.