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 retire sni_exiu.c in favour of ACPI0013 ...



details:   https://anonhg.NetBSD.org/src/rev/8d80a6008715
branches:  trunk
changeset: 1026608:8d80a6008715
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Fri Dec 03 05:28:32 2021 +0000

description:
retire sni_exiu.c in favour of ACPI0013 generic event divice to
respond power button press.

diffstat:

 sys/arch/arm/sociox/sni_exiu.c |  218 -----------------------------------------
 1 files changed, 0 insertions(+), 218 deletions(-)

diffs (222 lines):

diff -r 62774948a244 -r 8d80a6008715 sys/arch/arm/sociox/sni_exiu.c
--- a/sys/arch/arm/sociox/sni_exiu.c    Fri Dec 03 05:21:52 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*     $NetBSD: sni_exiu.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $     */
-
-/*-
- * Copyright (c) 2020 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Tohru Nishimura.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Socionext SC2A11 SynQuacer EXIU external interrupt controller driver
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sni_exiu.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $");
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/intr.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <dev/fdt/fdtvar.h>
-#include <dev/acpi/acpireg.h>
-#include <dev/acpi/acpivar.h>
-#include <dev/acpi/acpi_intr.h>
-
-static int sniexiu_fdt_match(device_t, struct cfdata *, void *);
-static void sniexiu_fdt_attach(device_t, device_t, void *);
-static int sniexiu_acpi_match(device_t, struct cfdata *, void *);
-static void sniexiu_acpi_attach(device_t, device_t, void *);
-
-struct sniexiu_softc {
-       device_t                sc_dev;
-       bus_space_tag_t         sc_iot;
-       bus_space_handle_t      sc_ioh;
-       bus_addr_t              sc_iob;
-       bus_size_t              sc_ios;
-       void                    *sc_ih;
-       kmutex_t                sc_lock;
-       int                     sc_phandle;
-};
-
-CFATTACH_DECL_NEW(sniexiu_fdt, sizeof(struct sniexiu_softc),
-    sniexiu_fdt_match, sniexiu_fdt_attach, NULL, NULL);
-
-CFATTACH_DECL_NEW(sniexiu_acpi, sizeof(struct sniexiu_softc),
-    sniexiu_acpi_match, sniexiu_acpi_attach, NULL, NULL);
-
-static void sniexiu_attach_i(struct sniexiu_softc *);
-static int sniexiu_intr(void *);
-
-static const struct device_compatible_entry compat_data[] = {
-       { .compat = "socionext,synquacer-exiu" },
-       DEVICE_COMPAT_EOL
-};
-
-static int
-sniexiu_fdt_match(device_t parent, struct cfdata *match, void *aux)
-{
-       struct fdt_attach_args * const faa = aux;
-
-       return of_compatible_match(faa->faa_phandle, compat_data);
-}
-
-static void
-sniexiu_fdt_attach(device_t parent, device_t self, void *aux)
-{
-       struct sniexiu_softc * const sc = device_private(self);
-       struct fdt_attach_args * const faa = aux;
-       const int phandle = faa->faa_phandle;
-       bus_space_handle_t ioh;
-       bus_addr_t addr;
-       bus_size_t size;
-       char intrstr[128];
-
-       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;
-       }
-       if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
-               aprint_error(": failed to decode interrupt\n");
-               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;
-       sc->sc_iot = faa->faa_bst;
-       sc->sc_ioh = ioh;
-       sc->sc_iob = addr;
-       sc->sc_ios = size;
-       mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
-
-       sniexiu_attach_i(sc);
-       return;
-  fail:
-       bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios);
-       return;
-}
-
-static int
-sniexiu_acpi_match(device_t parent, struct cfdata *match, void *aux)
-{
-       static const char * compatible[] = {
-               "SCX0008",
-               NULL
-       };
-       struct acpi_attach_args *aa = aux;
-
-       if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
-               return 0;
-       return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
-}
-
-static void
-sniexiu_acpi_attach(device_t parent, device_t self, void *aux)
-{
-       struct sniexiu_softc * const sc = device_private(self);
-       struct acpi_attach_args *aa = aux;
-       bus_space_handle_t ioh;
-       struct acpi_resources res;
-       struct acpi_mem *mem;
-       struct acpi_irq *irq;
-       ACPI_STATUS rv;
-
-       rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
-           &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 || mem->ar_length) {
-               aprint_error(": incomplete resources\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;
-       sc->sc_ioh = ioh;
-       sc->sc_iob = mem->ar_base;
-       sc->sc_ios = mem->ar_length;
-       mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
-
-       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_normal_dev(sc->sc_dev, "Socionext External IRQ controller\n");
-       /* AAA */
-       return;
-}
-
-static int
-sniexiu_intr(void *arg)
-{
-       struct sniexiu_softc *sc = arg;
-
-       (void)sc;
-       return 1;
-}



Home | Main Index | Thread Index | Old Index