Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pRJr9-0006Io-Mx for mharc-grub-devel@gnu.org; Sun, 12 Feb 2023 16:25:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRJr6-0006Ie-Q4 for grub-devel@gnu.org; Sun, 12 Feb 2023 16:25:53 -0500 Received: from gate.crashing.org ([63.228.1.57]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRJr4-0008L0-6g for grub-devel@gnu.org; Sun, 12 Feb 2023 16:25:52 -0500 Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 31CLNdKO008533; Sun, 12 Feb 2023 15:23:40 -0600 Message-ID: <9fa9b340cbbe7fdd4911e994068f104cdaa7bf6a.camel@kernel.crashing.org> Subject: Re: [PATCH v2 2/3] term/serial: Add support for PCI serial devices From: Benjamin Herrenschmidt To: Daniel Kiper , Peter Zijlstra Cc: grub-devel@gnu.org, development@efficientek.com Date: Mon, 13 Feb 2023 08:23:39 +1100 In-Reply-To: <20230209145220.55gktnrf7oqxvewj@tomti.i.net-space.pl> References: <20220826110142.966628595@alderlake.programming.kicks-ass.net> <20220826111358.334758397@alderlake.programming.kicks-ass.net> <20221221125902.jw5kjwmxupeozt3b@tomti.i.net-space.pl> <20230209145220.55gktnrf7oqxvewj@tomti.i.net-space.pl> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 Received-SPF: pass client-ip=63.228.1.57; envelope-from=benh@kernel.crashing.org; helo=gate.crashing.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2023 21:25:53 -0000 On Thu, 2023-02-09 at 15:52 +0100, Daniel Kiper wrote: > Adding another Ben's address... Ah ! I saw the previous one before breakfast the other day, and forgot to reply once properly caffeinated :-) > > Ben, you've lived a very long time in !x86 land, can you elucidate us o= n > > this? My thinking is that if someone sticks a 16550 on a PCI board, thi= s > > driver should work on any PCI enabled platform, not just x86, rite? >=20 > Ben, here ^^^ is the question for you... It's ... complicated :-) On most non-x86 platforms you don't have a 1:1 mapping between PCI BAR value and the corresponding CPU address. Now I think with ACPI and UEFI there are ways to convert but I don't remember them off the top of my mind, there are similar ways with Open Firmware or flat device-trees. But grub doesn't have the infrastructure for that. Also non-x86 don't have "IO ports" per se, they are mapped somewhere in the MMIO address space, and how that is done is very platform specific. So at this point it makes sense to leave that x86 only. Once can add support for other archs/platforms later with the appopriate address conversion trickery. Another issue is that grub doesn't have any form of MMIO abstraction layer providing things like ordering enforcement (memory barriers) etc... so doing any kind of direct device access in grub on most non- x86 is chancy at best. Cheers, Ben. >=20 > Daniel >=20 > > > > > +static int > > > > > +find_pciserial (grub_pci_device_t dev, grub_pci_id_t pciid, void= *data) > > > >=20 > > > > grub_pci_id_t pciid __attribute__ ((unused)) > > > >=20 > > > > > +{ > > > > > +=C2=A0 grub_pci_address_t cmd_addr, class_addr, bar_addr; > > > > > +=C2=A0 struct grub_serial_port *port; > > > > > +=C2=A0 grub_uint32_t class, bar; > > > > > +=C2=A0 grub_uint16_t cmdreg; > > > > > +=C2=A0 int *port_num =3D data; > > > > > +=C2=A0 grub_err_t err; > > > > > + > > > > > +=C2=A0 (void)pciid; > > > >=20 > > > > ... and please drop this... > > > >=20 > > >=20 > > > > > +error: > > > >=20 > > > > s/error/fail/ > > > >=20 > > > > And please add a space before label... > > >=20 > > > All done, except the Makefile thing, find the updated version below. > > > I'll attempt to git-send-email both patches once we agree on the > > > Makefile hunk. > > >=20 > > >=20 > > > --- > > > Subject: term/serial: Add support for PCI serial devices > > >=20 > > > Loosely based on early_pci_serial_init() from Linux, allow GRUB to ma= ke > > > use of PCI serial devices. > > >=20 > > > Specifically, my Alderlake NUC exposes the Intel AMT SoL UART as a PC= I > > > enumerated device but doesn't include it in the EFI tables. > > >=20 > > > Tested and confirmed working on a "Lenovo P360 Tiny" with Intel AMT > > > enabled. This specific machine has (from lspci -vv): > > >=20 > > > 00:16.3 Serial controller: Intel Corporation Device 7aeb (rev 11) (pr= og-if 02 [16550]) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DeviceName: Onboard - Othe= r > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Subsystem: Lenovo Device 3= 30e > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Control: I/O+ Mem+ BusMast= er- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Status: Cap+ 66MHz+ UDF- F= astB2B+ ParErr- DEVSEL=3Dfast >TAbort- SERR- > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Interrupt: pin D routed to= IRQ 19 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Region 0: I/O ports at 40a= 0 [size=3D8] > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Region 1: Memory at b42240= 00 (32-bit, non-prefetchable) [size=3D4K] > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Capabilities: [40] MSI: En= able- Count=3D1/1 Maskable- 64bit+ > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 Address: 0000000000000000=C2=A0 Data: 0000 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Capabilities: [50] Power M= anagement version 3 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=3D0mA PME(D0-,= D1-,D2-,D3hot-,D3cold-) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 Status: D0 NoSoftRst+ PME-Enable- DSel=3D0 DScale=3D0= PME- > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Kernel driver in use: seri= al > > >=20 > > > From which the following config (/etc/default/grub) gets a working > > > serial setup: > > >=20 > > > GRUB_CMDLINE_LINUX=3D"console=3Dtty0 earlyprintk=3Dpciserial,00:16.3,= 115200 console=3DttyS0,115200" > > > GRUB_SERIAL_COMMAND=3D"serial --speed=3D115200 pci_00:16.3" > > > GRUB_TERMINAL=3D"serial console" > > >=20 > > > Signed-off-by: Peter Zijlstra (Intel) > > > Tested-by: Glenn Washburn > > > Reviewed-by: Glenn Washburn > > > --- > > >=20 > > > Index: grub/grub-core/Makefile.core.def > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > --- grub.orig/grub-core/Makefile.core.def > > > +++ grub/grub-core/Makefile.core.def > > > @@ -2057,6 +2057,7 @@ module =3D { > > > =C2=A0=C2=A0 ieee1275 =3D term/ieee1275/serial.c; > > > =C2=A0=C2=A0 mips_arc =3D term/arc/serial.c; > > > =C2=A0=C2=A0 efi =3D term/efi/serial.c; > > > +=C2=A0 pci =3D term/pci/serial.c; > > >=20 > > > =C2=A0=C2=A0 enable =3D terminfomodule; > > > =C2=A0=C2=A0 enable =3D ieee1275; > > > Index: grub/grub-core/term/pci/serial.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > --- /dev/null > > > +++ grub/grub-core/term/pci/serial.c > > > @@ -0,0 +1,93 @@ > > > +/* > > > + *=C2=A0 GRUB=C2=A0 --=C2=A0 GRand Unified Bootloader > > > + *=C2=A0 Copyright (C) 2022=C2=A0 Free Software Foundation, Inc. > > > + * > > > + *=C2=A0 GRUB is free software: you can redistribute it and/or modif= y > > > + *=C2=A0 it under the terms of the GNU General Public License as pub= lished by > > > + *=C2=A0 the Free Software Foundation, either version 3 of the Licen= se, or > > > + *=C2=A0 (at your option) any later version. > > > + * > > > + *=C2=A0 GRUB is distributed in the hope that it will be useful, > > > + *=C2=A0 but WITHOUT ANY WARRANTY; without even the implied warranty= of > > > + *=C2=A0 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.=C2=A0 = See the > > > + *=C2=A0 GNU General Public License for more details. > > > + * > > > + *=C2=A0 You should have received a copy of the GNU General Public L= icense > > > + *=C2=A0 along with GRUB.=C2=A0 If not, see . > > > + */ > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +static int > > > +find_pciserial (grub_pci_device_t dev, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0grub_pci_id_t pciid __attribute__ ((unused)), > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0void *data __attribute__ ((unused))) > > > +{ > > > +=C2=A0 grub_pci_address_t cmd_addr, class_addr, bar_addr; > > > +=C2=A0 struct grub_serial_port *port; > > > +=C2=A0 grub_uint32_t class, bar; > > > +=C2=A0 grub_uint16_t cmdreg; > > > +=C2=A0 grub_err_t err; > > > + > > > +=C2=A0 cmd_addr =3D grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND= ); > > > +=C2=A0 cmdreg =3D grub_pci_read (cmd_addr); > > > + > > > +=C2=A0 class_addr =3D grub_pci_make_address (dev, GRUB_PCI_REG_REVIS= ION); > > > +=C2=A0 class =3D grub_pci_read (class_addr); > > > + > > > +=C2=A0 bar_addr =3D grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS= _REG0); > > > +=C2=A0 bar =3D grub_pci_read (bar_addr); > > > + > > > +=C2=A0 /* 16550 compatible MODEM or SERIAL */ > > > +=C2=A0 if (((class >> 16) !=3D GRUB_PCI_CLASS_COMMUNICATION_MODEM && > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (class >> 16) !=3D GRUB_PCI_CLA= SS_COMMUNICATION_SERIAL) || > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((class >> 8) & 0xff) !=3D GRUB_PCI_S= ERIAL_16550_COMPATIBLE) > > > +=C2=A0=C2=A0=C2=A0 return 0; > > > + > > > +=C2=A0 if ((bar & GRUB_PCI_ADDR_SPACE_MASK) !=3D GRUB_PCI_ADDR_SPACE= _IO) > > > +=C2=A0=C2=A0=C2=A0 return 0; > > > + > > > +=C2=A0 port =3D grub_zalloc (sizeof (*port)); > > > +=C2=A0 if (port =3D=3D NULL) > > > +=C2=A0=C2=A0=C2=A0 return 0; > > > + > > > +=C2=A0 port->name =3D grub_xasprintf ("pci_%02x:%02x.%x", > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 grub_pci_get_bus (dev), > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 grub_pci_get_device (dev), > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 grub_pci_get_function (dev)); > > > +=C2=A0 if (port->name =3D=3D NULL) > > > +=C2=A0=C2=A0=C2=A0 goto fail; > > > + > > > +=C2=A0 grub_pci_write (cmd_addr, cmdreg | GRUB_PCI_COMMAND_IO_ENABLE= D); > > > + > > > +=C2=A0 port->driver =3D &grub_ns8250_driver; > > > +=C2=A0 port->port =3D bar & GRUB_PCI_ADDR_IO_MASK; > > > +=C2=A0 err =3D grub_serial_config_defaults (port); > > > +=C2=A0 if (err !=3D GRUB_ERR_NONE) > > > +=C2=A0=C2=A0=C2=A0 { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 grub_print_error (); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto fail; > > > +=C2=A0=C2=A0=C2=A0 } > > > + > > > +=C2=A0 err =3D grub_serial_register (port); > > > +=C2=A0 if (err !=3D GRUB_ERR_NONE) > > > +=C2=A0=C2=A0=C2=A0 goto fail; > > > + > > > +=C2=A0 return 0; > > > + > > > + fail: > > > +=C2=A0 grub_free (port->name); > > > +=C2=A0 grub_free (port); > > > +=C2=A0 return 0; > > > +} > > > + > > > +void > > > +grub_pciserial_init (void) > > > +{ > > > +=C2=A0 grub_pci_iterate (find_pciserial, NULL); > > > +} > > > Index: grub/grub-core/term/serial.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > --- grub.orig/grub-core/term/serial.c > > > +++ grub/grub-core/term/serial.c > > > @@ -505,6 +505,9 @@ GRUB_MOD_INIT(serial) > > > =C2=A0#ifdef GRUB_MACHINE_ARC > > > =C2=A0=C2=A0 grub_arcserial_init (); > > > =C2=A0#endif > > > +#ifdef GRUB_HAS_PCI > > > +=C2=A0 grub_pciserial_init (); > > > +#endif > > > =C2=A0} > > >=20 > > > =C2=A0GRUB_MOD_FINI(serial) > > > Index: grub/include/grub/pci.h > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > --- grub.orig/include/grub/pci.h > > > +++ grub/include/grub/pci.h > > > @@ -80,8 +80,13 @@ > > >=20 > > > =C2=A0#define=C2=A0 GRUB_PCI_STATUS_DEVSEL_TIMING_SHIFT 9 > > > =C2=A0#define=C2=A0 GRUB_PCI_STATUS_DEVSEL_TIMING_MASK 0x0600 > > > + > > > =C2=A0#define=C2=A0 GRUB_PCI_CLASS_SUBCLASS_VGA=C2=A0 0x0300 > > > =C2=A0#define=C2=A0 GRUB_PCI_CLASS_SUBCLASS_USB=C2=A0 0x0c03 > > > +#define=C2=A0 GRUB_PCI_CLASS_COMMUNICATION_SERIAL=C2=A0 0x0700 > > > +#define=C2=A0 GRUB_PCI_CLASS_COMMUNICATION_MODEM=C2=A0=C2=A0 0x0703 > > > + > > > +#define=C2=A0 GRUB_PCI_SERIAL_16550_COMPATIBLE 0x02 > > >=20 > > > =C2=A0#ifndef ASM_FILE > > >=20 > > > Index: grub/include/grub/serial.h > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > --- grub.orig/include/grub/serial.h > > > +++ grub/include/grub/serial.h > > > @@ -210,6 +210,10 @@ grub_arcserial_init (void); > > > =C2=A0struct grub_serial_port *grub_arcserial_add_port (const char *p= ath); > > > =C2=A0#endif > > >=20 > > > +#ifdef GRUB_HAS_PCI > > > +void grub_pciserial_init (void); > > > +#endif > > > + > > > =C2=A0struct grub_serial_port *grub_serial_find (const char *name); > > > =C2=A0extern struct grub_serial_driver grub_ns8250_driver; > > > =C2=A0void EXPORT_FUNC(grub_serial_unregister_driver) (struct grub_se= rial_driver *driver); > > > Index: grub/docs/grub.texi > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > --- grub.orig/docs/grub.texi > > > +++ grub/docs/grub.texi > > > @@ -1386,6 +1386,7 @@ separated by spaces. > > > =C2=A0Valid terminal input names depend on the platform, but may incl= ude > > > =C2=A0@samp{console} (native platform console), @samp{serial} (serial= terminal), > > > =C2=A0@samp{serial_} (serial terminal with explicit port select= ion), > > > +@samp{pci_:.} (PCI serial with explicit locat= ion), > > > =C2=A0@samp{at_keyboard} (PC AT keyboard), or @samp{usb_keyboard} (US= B keyboard > > > =C2=A0using the HID Boot Protocol, for cases where the firmware does = not handle > > > =C2=A0this). > > > @@ -1399,6 +1400,7 @@ separated by spaces. > > > =C2=A0Valid terminal output names depend on the platform, but may inc= lude > > > =C2=A0@samp{console} (native platform console), @samp{serial} (serial= terminal), > > > =C2=A0@samp{serial_} (serial terminal with explicit port select= ion), > > > +@samp{pci_:.} (PCI serial with explicit locat= ion), > > > =C2=A0@samp{gfxterm} (graphics-mode output), @samp{vga_text} (VGA tex= t output), > > > =C2=A0@samp{mda_text} (MDA text output), @samp{morse} (Morse-coding u= sing system > > > =C2=A0beeper) or @samp{spkmodem} (simple data protocol using system s= peaker). > > > @@ -4165,7 +4167,7 @@ Commands usable anywhere in the menu and > > > =C2=A0@node serial > > > =C2=A0@subsection serial > > >=20 > > > -@deffn Command serial [@option{--unit=3Dunit}] [@option{--port=3Dpor= t}] [@option{--speed=3Dspeed}] [@option{--word=3Dword}] [@option{--parity= =3Dparity}] [@option{--stop=3Dstop}] > > > +@deffn Command serial [@option{--unit=3Dunit}] [@option{--port=3Dpor= t}] [@option{--speed=3Dspeed}] [@option{--word=3Dword}] [@option{--parity= =3Dparity}] [@option{--stop=3Dstop}] [@option{name}] > > > =C2=A0Initialize a serial device. @var{unit} is a number in the range= 0-3 > > > =C2=A0specifying which serial port to use; default is 0, which corres= ponds to > > > =C2=A0the port often called COM1. > > > @@ -4197,6 +4199,19 @@ If passed no @var{unit} nor @var{port}, > > > =C2=A0the system default serial port and its configuration. If this i= nformation > > > =C2=A0is not available, it will default to @var{unit} 0. > > >=20 > > > +If used @var{name}, a machine and driver specific name given during = probing, > > > +will be used to indicate which serial port to use. Possible forms in= clude: > > > +@itemize @bullet > > > +@item > > > +@samp{serial_} as an alternative to --port > > > +@item > > > +@samp{usbN} the N'th USB serial detected > > > +@item > > > +@samp{efiN} the N'th EFI serial detected > > > +@item > > > +@samp{pci_:.} PCI serial at the specified locatio= n > > > +@end itemize > > > + > > > =C2=A0The serial port is not used as a communication channel unless t= he > > > =C2=A0@command{terminal_input} or @command{terminal_output} command i= s used > > > =C2=A0(@pxref{terminal_input}, @pxref{terminal_output}). > > > @@ -4205,6 +4220,7 @@ Examples: > > > =C2=A0@example > > > =C2=A0serial --port=3D3f8 --speed=3D9600 > > > =C2=A0serial --port=3Dmmio,fefb0000.l --speed=3D115200 > > > +serial --speed=3D115200 pci_00:16.3 > > > =C2=A0@end example > > >=20 > > > =C2=A0See also @ref{Serial terminal}.