Do not attach com at acpi when there's no address or irq present. Fixes
authoranton <anton@openbsd.org>
Tue, 21 Dec 2021 06:09:47 +0000 (06:09 +0000)
committeranton <anton@openbsd.org>
Tue, 21 Dec 2021 06:09:47 +0000 (06:09 +0000)
a regression caused by the recent change to start attaching com at acpi
as it turns out that Libreboot exposes console devices lacking crucial
data in their acpi tables. The same console attaches fine over isa,
therefore restore this behavior.

Problem reported by <cipher-hearts at riseup dot net> on bugs@

ok deraadt@ kettenis@

sys/dev/acpi/com_acpi.c

index 12e6128..0cddb4f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: com_acpi.c,v 1.3 2021/12/16 08:03:17 anton Exp $      */
+/*     $OpenBSD: com_acpi.c,v 1.4 2021/12/21 06:09:47 anton Exp $      */
 /*
  * Copyright (c) 2018 Mark Kettenis
  *
@@ -63,6 +63,8 @@ com_acpi_match(struct device *parent, void *match, void *aux)
        struct acpi_attach_args *aaa = aux;
        struct cfdata *cf = match;
 
+       if (aaa->aaa_naddr < 1 || aaa->aaa_nirq < 1)
+               return 0;
        return acpi_matchhids(aaa, com_hids, cf->cf_driver->cd_name);
 }
 
@@ -77,16 +79,6 @@ com_acpi_attach(struct device *parent, struct device *self, void *aux)
        sc->sc_node = aaa->aaa_node;
        printf(" %s", sc->sc_node->name);
 
-       if (aaa->aaa_naddr < 1) {
-               printf(": no registers\n");
-               return;
-       }
-
-       if (aaa->aaa_nirq < 1) {
-               printf(": no interrupt\n");
-               return;
-       }
-
        printf(" addr 0x%llx/0x%llx", aaa->aaa_addr[0], aaa->aaa_size[0]);
        printf(" irq %d", aaa->aaa_irq[0]);