> Date: Mon, 6 Dec 2021 21:08:04 +0100
> From: Patrick Wildt <[email protected]>
> 
> 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

anton@ has a better diff he's working on

> 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;
> 
> 

Reply via email to