> From: "Theo de Raadt" <[email protected]> > Date: Mon, 06 Dec 2021 13:17:37 -0700 > > What comN does this attach as? > > The isa ones are are hard-wired: > > com0 at isa? port 0x3f8 irq 4 # standard PC serial ports > com1 at isa? port 0x2f8 irq 3 > com2 at isa? port 0x3e8 irq 5 > com3 at isa? disable port 0x2e8 irq 9 # (conflicts with some video cards) > > So they will consume com0, com1, com2, com3. > > This means the first dynamic ones will be com4, etc etc etc. > > When you add com* at acpi, acpi is processed earlier, so the devices on > these busses will move. > > com* at cardbus? > com* at pci? > com* at pcmcia? # PCMCIA modems/serial ports > com* at puc? > > There will be people affected by their puc device numbers moving, in > particular people who have built console servers, which will be very > specific to the machine. > > Anyone want to comment on that?
So anton@ is working on a diff as well (and obviously made the mistake of not involving more developers). He ran into a related issue. What we really want is that these "com* at acpi?" ports replace the "com* at isa?" ports. These are the "standard" COM1-4 ports after all. So the solution we came up with was to add: com0 at acpi? com1 at acpi? com2 at acpi? com3 at acpi? com* at acpi? Now this may still reorder the com0-3 devices among themselves. But there may be ways to address that issue by looking at additional properties and by using an additional locator. This would avoid renumbering the com(4) ports provided by puc(4). > Patrick Wildt <[email protected]> wrote: > > > Hi, > > > > On one machine I had the pleasure of having to try and use the > > Serial-over-LAN feature which shows up as just another com(4) > > device. Instead of having to manually add a com(4) at isa(4) > > I figured it would be nicer to have them attach via ACPI. At > > least on that machine, the SOL definitely shows up in the DSDT. > > > > Since I don't want to break any legacy machines, I figured I'd > > keep ignoring the isa(4) addresses specified in amd64's GENERIC. > > > > Right now this diff is more about putting it out there, not about > > asking for OKs, as amd64 isn't really my strong suit. If people > > are interested, I can definitely put in all the feedback there is. > > > > Patrick > > > > diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC > > index ecccd1323d9..edb0131d823 100644 > > --- a/sys/arch/amd64/conf/GENERIC > > +++ b/sys/arch/amd64/conf/GENERIC > > @@ -76,6 +76,7 @@ tpm* at acpi? > > acpihve* at acpi? > > acpisurface* at acpi? > > acpihid* at acpi? > > +com* at acpi? > > ipmi0 at acpi? disable > > ccpmic* at iic? > > tipmic* at iic? > > diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c > > index 7577424e8a2..e89869aedbd 100644 > > --- a/sys/dev/acpi/acpi.c > > +++ b/sys/dev/acpi/acpi.c > > @@ -3140,7 +3140,6 @@ const char *acpi_isa_hids[] = { > > "PNP0303", /* IBM Enhanced Keyboard (101/102-key, PS/2 Mouse) */ > > "PNP0400", /* Standard LPT Parallel Port */ > > "PNP0401", /* ECP Parallel Port */ > > - "PNP0501", /* 16550A-compatible COM Serial Port */ > > "PNP0700", /* PC-class Floppy Disk Controller */ > > "PNP0F03", /* Microsoft PS/2-style Mouse */ > > "PNP0F13", /* PS/2 Mouse */ > > diff --git a/sys/dev/acpi/com_acpi.c b/sys/dev/acpi/com_acpi.c > > index 852be6c71b3..9251b973372 100644 > > --- a/sys/dev/acpi/com_acpi.c > > +++ b/sys/dev/acpi/com_acpi.c > > @@ -49,6 +49,7 @@ struct cfattach com_acpi_ca = { > > > > const char *com_hids[] = { > > "HISI0031", > > + "PNP0501", > > NULL > > }; > > > > @@ -61,6 +62,13 @@ com_acpi_match(struct device *parent, void *match, void > > *aux) > > struct acpi_attach_args *aaa = aux; > > struct cfdata *cf = match; > > > > +#ifdef __amd64__ > > + /* Ignore com(4) at isa(4) */ > > + if (aaa->aaa_addr[0] == 0x3f8 || aaa->aaa_addr[0] == 0x2f8 || > > + aaa->aaa_addr[0] == 0x3e8 || aaa->aaa_addr[0] == 0x2e8) > > + return 0; > > +#endif > > + > > return acpi_matchhids(aaa, com_hids, cf->cf_driver->cd_name); > > } > > > > @@ -95,8 +103,10 @@ com_acpi_attach(struct device *parent, struct device > > *self, void *aux) > > sc->sc.sc_uarttype = COM_UART_16550; > > sc->sc.sc_frequency = freq ? freq : COM_FREQ; > > > > +#ifndef __amd64__ > > sc->sc.sc_reg_width = acpi_getpropint(sc->sc_node, "reg-io-width", 4); > > sc->sc.sc_reg_shift = acpi_getpropint(sc->sc_node, "reg-shift", 2); > > +#endif > > > > if (com_acpi_is_console(sc)) { > > SET(sc->sc.sc_hwflags, COM_HW_CONSOLE); > > @@ -105,7 +115,9 @@ com_acpi_attach(struct device *parent, struct device > > *self, void *aux) > > comconsrate = B115200; > > } > > > > - if (bus_space_map(sc->sc.sc_iot, aaa->aaa_addr[0], aaa->aaa_size[0], > > + if (sc->sc.sc_iobase == comconsaddr) > > + sc->sc.sc_ioh = comconsioh; > > + else if (bus_space_map(sc->sc.sc_iot, aaa->aaa_addr[0], > > aaa->aaa_size[0], > > 0, &sc->sc.sc_ioh)) { > > printf(": can't map registers\n"); > > return; > > > >
