Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/vchiq Split vchiq into separate fdt and acp...
details: https://anonhg.NetBSD.org/src/rev/80560e890c44
branches: trunk
changeset: 967994:80560e890c44
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Dec 31 01:00:22 2019 +0000
description:
Split vchiq into separate fdt and acpi attachments.
diffstat:
sys/external/bsd/vchiq/conf/files.vchiq | 11 +-
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c | 110 +-------
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd.h | 14 +-
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c | 142 ++++++++++
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c | 141 +++++++++
5 files changed, 312 insertions(+), 106 deletions(-)
diffs (truncated from 507 to 300 lines):
diff -r fb61e520ff63 -r 80560e890c44 sys/external/bsd/vchiq/conf/files.vchiq
--- a/sys/external/bsd/vchiq/conf/files.vchiq Tue Dec 31 00:59:26 2019 +0000
+++ b/sys/external/bsd/vchiq/conf/files.vchiq Tue Dec 31 01:00:22 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.vchiq,v 1.3 2017/12/10 21:38:27 skrll Exp $
+# $NetBSD: files.vchiq,v 1.4 2019/12/31 01:00:22 jmcneill Exp $
#
# Broadcom VideoCore IV
#
@@ -6,7 +6,6 @@
define vchiqbus { }
device vchiq: vchiqbus
-attach vchiq at fdt
file external/bsd/vchiq/dist/interface/compat/vchi_bsd.c vchiq
file external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c vchiq
file external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c vchiq
@@ -17,4 +16,12 @@
file external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c vchiq
file external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c vchiq
+attach vchiq at fdt with vchiq_fdt
+file external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c vchiq_fdt
+
+ifdef acpinodebus
+attach vchiq at acpinodebus with vchiq_acpi
+file external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c vchiq_acpi
+endif
+
makeoptions vchiq CPPFLAGS+="-I$S/external/bsd/vchiq/dist -I$S/external/bsd/common/include -DVCOS_VERIFY_BKPTS=1 -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -DVCHIQ_ENABLE_DEBUG=1
-DVCHIQ_LOG_DEFAULT=5"
diff -r fb61e520ff63 -r 80560e890c44 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Tue Dec 31 00:59:26 2019 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Tue Dec 31 01:00:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vchiq_kmod_netbsd.c,v 1.10 2017/12/10 21:38:27 skrll Exp $ */
+/* $NetBSD: vchiq_kmod_netbsd.c,v 1.11 2019/12/31 01:00:23 jmcneill Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.10 2017/12/10 21:38:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.11 2019/12/31 01:00:23 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -42,122 +42,26 @@
#include <arm/broadcom/bcm2835reg.h>
#include <arm/broadcom/bcm2835_intr.h>
-#include <dev/fdt/fdtvar.h>
-
#include "vchiq_arm.h"
#include "vchiq_2835.h"
#include "vchiq_netbsd.h"
extern VCHIQ_STATE_T g_state;
-struct vchiq_softc {
- device_t sc_dev;
- device_t sc_audiodev;
-
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- void *sc_ih;
-
- int sc_intr;
- int sc_phandle;
-};
-
static struct vchiq_softc *vchiq_softc = NULL;
-static int vchiq_match(device_t, cfdata_t, void *);
-static void vchiq_attach(device_t, device_t, void *);
-
-static int vchiq_intr(void *);
-static int vchiq_print(void *, const char *);
-static void vchiq_defer(device_t);
-
-/* External functions */
-int vchiq_init(void);
-
-
#define VCHIQ_DOORBELL0 0x0
#define VCHIQ_DOORBELL1 0x4
#define VCHIQ_DOORBELL2 0x8
#define VCHIQ_DOORBELL3 0xC
-
-CFATTACH_DECL_NEW(vchiq, sizeof(struct vchiq_softc),
- vchiq_match, vchiq_attach, NULL, NULL);
-
-static int
-vchiq_match(device_t parent, cfdata_t match, void *aux)
+void
+vchiq_set_softc(struct vchiq_softc *sc)
{
- const char * const compatible[] = { "brcm,bcm2835-vchiq", NULL };
- struct fdt_attach_args * const faa = aux;
-
- return of_match_compatible(faa->faa_phandle, compatible);
+ vchiq_softc = sc;
}
-static void
-vchiq_attach(device_t parent, device_t self, void *aux)
-{
- struct vchiq_softc *sc = device_private(self);
- struct fdt_attach_args * const faa = aux;
- const int phandle = faa->faa_phandle;
-
- aprint_naive("\n");
- aprint_normal(": BCM2835 VCHIQ\n");
-
- sc->sc_dev = self;
- sc->sc_iot = faa->faa_bst;
- sc->sc_phandle = phandle;
-
- bus_addr_t addr;
- bus_size_t size;
-
- if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
- aprint_error(": couldn't get register address\n");
- return;
- }
-
- if (bus_space_map(faa->faa_bst, addr, size, 0, &sc->sc_ioh) != 0) {
- aprint_error_dev(sc->sc_dev, "unable to map device\n");
- return;
- }
-
- vchiq_platform_attach(faa->faa_dmat);
-
- vchiq_softc = sc;
-
- config_mountroot(self, vchiq_defer);
-}
-
-static void
-vchiq_defer(device_t self)
-{
- struct vchiq_attach_args vaa;
- struct vchiq_softc *sc = device_private(self);
- const int phandle = sc->sc_phandle;
-
- vchiq_core_initialize();
-
- char intrstr[128];
- if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
- aprint_error(": failed to decode interrupt\n");
- return;
- }
-
- sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_VM, FDT_INTR_MPSAFE,
- vchiq_intr, sc);
- if (sc->sc_ih == NULL) {
- aprint_error_dev(self, "failed to establish interrupt %s\n",
- intrstr);
- return;
- }
- aprint_normal_dev(self, "interrupting on %s\n", intrstr);
-
- vchiq_init();
-
- vaa.vaa_name = "AUDS";
- config_found_ia(self, "vchiqbus", &vaa, vchiq_print);
-}
-
-static int
+int
vchiq_intr(void *priv)
{
struct vchiq_softc *sc = priv;
@@ -176,7 +80,7 @@
return 0;
}
-static int
+int
vchiq_print(void *aux, const char *pnp)
{
struct vchiq_attach_args *vaa = aux;
diff -r fb61e520ff63 -r 80560e890c44 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd.h
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd.h Tue Dec 31 00:59:26 2019 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd.h Tue Dec 31 01:00:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vchiq_netbsd.h,v 1.2 2017/12/10 21:38:27 skrll Exp $ */
+/* $NetBSD: vchiq_netbsd.h,v 1.3 2019/12/31 01:00:23 jmcneill Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,10 +32,22 @@
#ifndef _VCHIQ_NETBSD_H
#define _VCHIQ_NETBSD_H
+struct vchiq_softc {
+ device_t sc_dev;
+ device_t sc_audiodev;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_ioh;
+ void *sc_ih;
+};
+
struct vchiq_attach_args {
const char *vaa_name;
};
+int vchiq_intr(void *);
+int vchiq_print(void *, const char *);
+void vchiq_set_softc(struct vchiq_softc *);
void vchiq_platform_attach(bus_dma_tag_t tag);
#endif /* !_VCHIQ_NETBSD_H */
diff -r fb61e520ff63 -r 80560e890c44 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c Tue Dec 31 01:00:22 2019 +0000
@@ -0,0 +1,142 @@
+/* $NetBSD: vchiq_netbsd_acpi.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jared D. McNeill
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_acpi.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/bus.h>
+#include <sys/sysctl.h>
+
+#include <arm/broadcom/bcm2835reg.h>
+#include <arm/broadcom/bcm2835_intr.h>
+
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
+
+#include "vchiq_arm.h"
+#include "vchiq_2835.h"
+#include "vchiq_netbsd.h"
+
+struct vchiq_acpi_softc {
+ struct vchiq_softc sc_vchiq;
+ ACPI_HANDLE sc_handle;
+};
+
+static int vchiq_acpi_match(device_t, cfdata_t, void *);
+static void vchiq_acpi_attach(device_t, device_t, void *);
+
+static void vchiq_acpi_defer(device_t);
+
+/* External functions */
+int vchiq_init(void);
+
+
+CFATTACH_DECL_NEW(vchiq_acpi, sizeof(struct vchiq_acpi_softc),
+ vchiq_acpi_match, vchiq_acpi_attach, NULL, NULL);
+
+static int
+vchiq_acpi_match(device_t parent, cfdata_t match, void *aux)
+{
+ const char * const compatible[] = { "BCM2835", NULL };
+ struct acpi_attach_args * const aa = aux;
+
+ if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
+ return 0;
+
+ return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+}
+
Home |
Main Index |
Thread Index |
Old Index