Skip to content

Commit c052d0d

Browse files
committed
Support console over USB-to-serial
This require up-to-date UEFI bootstrap. Example usage from boot.cfg: consdev=com4,115200 menu=NetBSD ucom0:kconsdev ucom0,115200;boot netbsd
1 parent b06d947 commit c052d0d

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

sys/arch/x86/x86/consinit.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: consinit.c,v 1.41 2025/04/30 05:15:08 imil Exp $ */
1+
/* $NetBSD: consinit.c,v 1.42 2025/10/10 13:18:18 manu Exp $ */
22

33
/*
44
* Copyright (c) 1998
@@ -27,7 +27,7 @@
2727
*/
2828

2929
#include <sys/cdefs.h>
30-
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.41 2025/04/30 05:15:08 imil Exp $");
30+
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.42 2025/10/10 13:18:18 manu Exp $");
3131

3232
#include "opt_kgdb.h"
3333
#include "opt_puc.h"
@@ -87,6 +87,11 @@ __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.41 2025/04/30 05:15:08 imil Exp $");
8787
#include <dev/pci/puccn.h>
8888
#endif
8989

90+
#include "ucom.h"
91+
#if (NUCOM > 0)
92+
#include <dev/usb/ucomvar.h>
93+
#endif
94+
9095
#include "ukbd.h"
9196
#if (NUKBD > 0)
9297
#include <dev/usb/ukbdvar.h>
@@ -284,6 +289,18 @@ consinit(void)
284289
COM_FREQ, COM_TYPE_NORMAL, comcnmode);
285290
if (rv != 0)
286291
panic("can't init serial console @%x", consinfo->addr);
292+
293+
return;
294+
}
295+
#endif
296+
#if (NUCOM > 0)
297+
if (!strcmp(console_devname, "ucom")) {
298+
int unit = consinfo->addr;
299+
int speed = consinfo->speed;
300+
301+
if (ucom_cnattach(unit, speed) != 0)
302+
panic("can't init console %s", console_devname);
303+
287304
return;
288305
}
289306
#endif

0 commit comments

Comments
 (0)