Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/sociox try to DRT about config messages



details:   https://anonhg.NetBSD.org/src/rev/9db20857d9a8
branches:  trunk
changeset: 746249:9db20857d9a8
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Wed Mar 25 23:29:39 2020 +0000

description:
try to DRT about config messages

diffstat:

 sys/arch/arm/sociox/sni_exiu.c |  73 ++++++++++++++++++-----------------------
 sys/arch/arm/sociox/sni_gpio.c |  22 ++++++-----
 2 files changed, 45 insertions(+), 50 deletions(-)

diffs (226 lines):

diff -r f7e3be00c2f7 -r 9db20857d9a8 sys/arch/arm/sociox/sni_exiu.c
--- a/sys/arch/arm/sociox/sni_exiu.c    Wed Mar 25 23:20:38 2020 +0000
+++ b/sys/arch/arm/sociox/sni_exiu.c    Wed Mar 25 23:29:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sni_exiu.c,v 1.2 2020/03/19 22:17:45 nisimura Exp $    */
+/*     $NetBSD: sni_exiu.c,v 1.3 2020/03/25 23:29:39 nisimura Exp $    */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sni_exiu.c,v 1.2 2020/03/19 22:17:45 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_exiu.c,v 1.3 2020/03/25 23:29:39 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -60,8 +60,8 @@
        bus_space_handle_t      sc_ioh;
        bus_addr_t              sc_iob;
        bus_size_t              sc_ios;
+       void                    *sc_ih;
        kmutex_t                sc_lock;
-       void                    *sc_ih;
        int                     sc_phandle;
 };
 
@@ -98,7 +98,6 @@
        bus_size_t size;
        char intrstr[128];
        _Bool disable;
-       int error;
 
        prop_dictionary_get_bool(dict, "disable", &disable);
        if (disable) {
@@ -106,21 +105,24 @@
                aprint_normal(": disabled\n");
                return;
        }
-       error = fdtbus_get_reg(phandle, 0, &addr, &size);
-       if (error) {
-               aprint_error(": couldn't get registers\n");
-               return;
-       }
-       error = bus_space_map(faa->faa_bst, addr, size, 0, &ioh);
-       if (error) {
+       if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0
+           || bus_space_map(faa->faa_bst, addr, size, 0, &ioh) != 0) {
                aprint_error(": unable to map device\n");
                return;
        }
-       error = fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr));
-       if (error) {
+       if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
                aprint_error(": failed to decode interrupt\n");
-               return;
+               goto fail;
        }
+       sc->sc_ih = fdtbus_intr_establish(phandle,
+                       0, IPL_NET, 0, sniexiu_intr, sc);
+       if (sc->sc_ih == NULL) {
+               aprint_error_dev(self, "couldn't establish interrupt\n");
+               goto fail;
+       }
+
+       aprint_naive("\n");
+       aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 
        sc->sc_dev = self;
        sc->sc_phandle = phandle;
@@ -130,13 +132,6 @@
        sc->sc_ios = size;
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 
-       sc->sc_ih = fdtbus_intr_establish(phandle,
-                       0, IPL_NET, 0, sniexiu_intr, sc);
-       if (sc->sc_ih == NULL) {
-               aprint_error_dev(self, "couldn't establish interrupt\n");
-               goto fail;
-       }
-
        sniexiu_attach_i(sc);
        return;
   fail:
@@ -173,22 +168,26 @@
            &res, &acpi_resource_parse_ops_default);
        if (ACPI_FAILURE(rv))
                return;
-
        mem = acpi_res_mem(&res, 0);
        irq = acpi_res_irq(&res, 0);
-       if (mem == NULL || irq == NULL) {
+       if (mem == NULL || irq == NULL || mem->ar_length) {
                aprint_error(": incomplete resources\n");
                return;
        }
-       if (mem->ar_length == 0) {
-               aprint_error(": zero length memory resource\n");
-               return;
-       }
        if (bus_space_map(aa->aa_memt, mem->ar_base, mem->ar_length, 0,
            &ioh)) {
                aprint_error(": couldn't map registers\n");
                return;
        }
+       sc->sc_ih = acpi_intr_establish(self,
+           (uint64_t)(uintptr_t)aa->aa_node->ad_handle,
+           IPL_BIO, false, sniexiu_intr, sc, device_xname(self));
+       if (sc->sc_ih == NULL) {
+               aprint_error_dev(self, "couldn't establish interrupt\n");
+               goto fail;
+       }
+
+       aprint_naive("\n");
 
        sc->sc_dev = self;
        sc->sc_iot = aa->aa_memt;
@@ -197,28 +196,22 @@
        sc->sc_ios = mem->ar_length;
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 
-       sc->sc_ih = acpi_intr_establish(self,
-           (uint64_t)(uintptr_t)aa->aa_node->ad_handle,
-           IPL_BIO, false, sniexiu_intr, sc, device_xname(self));
-       if (sc->sc_ih == NULL) {
-               aprint_error_dev(self, "couldn't establish interrupt\n");
-               goto fail;
-       }
+       sniexiu_attach_i(sc);
 
-       sniexiu_attach_i(sc);
+       acpi_resource_cleanup(&res);
+       return;
  fail:
+       bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios);
        acpi_resource_cleanup(&res);
+       return;
 }
 
 static void
 sniexiu_attach_i(struct sniexiu_softc *sc)
 {
-
-       aprint_naive(": External IRQ controller\n");
-       aprint_normal(": External IRQ controller\n");
-
+       
+       aprint_normal_dev(sc->sc_dev, "Socionext External IRQ controller\n");
        /* AAA */
-
        return;
 }
 
diff -r f7e3be00c2f7 -r 9db20857d9a8 sys/arch/arm/sociox/sni_gpio.c
--- a/sys/arch/arm/sociox/sni_gpio.c    Wed Mar 25 23:20:38 2020 +0000
+++ b/sys/arch/arm/sociox/sni_gpio.c    Wed Mar 25 23:29:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sni_gpio.c,v 1.5 2020/03/25 19:03:44 nisimura Exp $    */
+/*     $NetBSD: sni_gpio.c,v 1.6 2020/03/25 23:29:39 nisimura Exp $    */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sni_gpio.c,v 1.5 2020/03/25 19:03:44 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_gpio.c,v 1.6 2020/03/25 23:29:39 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -125,6 +125,7 @@
        bus_addr_t addr;
        bus_size_t size;
        char intrstr[128];
+       const char *list;
        _Bool disable;
 
        prop_dictionary_get_bool(dict, "disable", &disable);
@@ -150,8 +151,11 @@
        }
 
        aprint_naive("\n");
-       aprint_normal(": GPIO controller\n");
+       aprint_normal_dev("Socionext GPIO controller\n");
        aprint_normal_dev(self, "interrupting on %s\n", intrstr);
+       list = fdtbus_get_string(phandle, "gpio-line-names");
+       if (list)
+               aprint_normal_dev(self, "%s\n", list);
 
        sc->sc_dev = self;
        sc->sc_phandle = phandle;
@@ -162,8 +166,6 @@
 
        snigpio_attach_i(sc);
 
-/* dig FDT description to show 32 of GPIO line usage */
-
        return;
  fail:
        bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios);
@@ -220,6 +222,11 @@
                goto fail;
        }
 
+       aprint_normal_dev(self, "Socionext GPIO controller\n");
+       rv = acpi_dsd_string(handle, "gpio-line-names", &list);
+       if (ACPI_SUCCESS(rv))
+               aprint_normal_dev(self, "%s\n", list);
+
        sc->sc_dev = self;
        sc->sc_iot = aa->aa_memt;
        sc->sc_ioh = ioh;
@@ -227,11 +234,6 @@
 
        snigpio_attach_i(sc);
 
-       /* dig _DSD property to show 32 of GPIO line usage */
-       rv = acpi_dsd_string(handle, "gpio-line-names", &list);
-       if (ACPI_SUCCESS(rv))
-               aprint_normal_dev(self, "%s\n", list);
-
        acpi_resource_cleanup(&res);
        return;
  fail:



Home | Main Index | Thread Index | Old Index