CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Fri Jan 15 22:58:49 UTC 2021 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_netbsd_fdt.c Log Message: use fdtbus_intr_establish_xname To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.3 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.4 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.3 Tue Dec 1 04:19:04 2020 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c Fri Jan 15 22:58:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_netbsd_fdt.c,v 1.3 2020/12/01 04:19:04 rin Exp $ */ +/* $NetBSD: vchiq_netbsd_fdt.c,v 1.4 2021/01/15 22:58:49 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_fdt.c,v 1.3 2020/12/01 04:19:04 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_fdt.c,v 1.4 2021/01/15 22:58:49 jmcneill Exp $"); #include #include @@ -130,8 +130,8 @@ vchiq_fdt_defer(device_t self) return; } - sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_VM, FDT_INTR_MPSAFE, - vchiq_intr, sc); + sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_VM, + FDT_INTR_MPSAFE, vchiq_intr, sc, device_xname(self)); if (sc->sc_ih == NULL) { aprint_error_dev(self, "failed to establish interrupt %s\n", intrstr);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: rin Date: Tue Dec 1 04:19:04 UTC 2020 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_netbsd_acpi.c vchiq_netbsd_fdt.c Log Message: Do not attach vchiq(4) in big-endian mode. For big-endian mode, all data written to and read from DMA buffer must be byte-swapped. This requires heavy modifications to third party codes. Also, we will switch to vc4 drm driver, hopefully soon. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.2 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.3 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.2 Sat Feb 22 19:37:31 2020 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c Tue Dec 1 04:19:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_netbsd_acpi.c,v 1.2 2020/02/22 19:37:31 jmcneill Exp $ */ +/* $NetBSD: vchiq_netbsd_acpi.c,v 1.3 2020/12/01 04:19:04 rin Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_acpi.c,v 1.2 2020/02/22 19:37:31 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_acpi.c,v 1.3 2020/12/01 04:19:04 rin Exp $"); #include #include @@ -93,6 +93,11 @@ vchiq_acpi_attach(device_t parent, devic sc->sc_iot = aa->aa_memt; asc->sc_handle = aa->aa_node->ad_handle; +#if BYTE_ORDER == BIG_ENDIAN + aprint_error_dev(sc->sc_dev, "not supported yet in big-endian mode\n"); + return; +#endif + rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS", &res, &acpi_resource_parse_ops_default); if (ACPI_FAILURE(rv)) Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.2 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.3 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.2 Tue Dec 1 03:28:08 2020 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c Tue Dec 1 04:19:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_netbsd_fdt.c,v 1.2 2020/12/01 03:28:08 rin Exp $ */ +/* $NetBSD: vchiq_netbsd_fdt.c,v 1.3 2020/12/01 04:19:04 rin Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_fdt.c,v 1.2 2020/12/01 03:28:08 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_fdt.c,v 1.3 2020/12/01 04:19:04 rin Exp $"); #include #include @@ -89,6 +89,11 @@ vchiq_fdt_attach(device_t parent, device sc->sc_iot = faa->faa_bst; fsc->sc_phandle = phandle; +#if BYTE_ORDER == BIG_ENDIAN + aprint_error_dev(sc->sc_dev, "not supported yet in big-endian mode\n"); + return; +#endif + bus_addr_t addr; bus_size_t size;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: rin Date: Tue Dec 1 03:28:08 UTC 2020 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_netbsd_fdt.c Log Message: Fix style of error message. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c:1.1 Tue Dec 31 01:00:23 2019 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_fdt.c Tue Dec 1 03:28:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_netbsd_fdt.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $ */ +/* $NetBSD: vchiq_netbsd_fdt.c,v 1.2 2020/12/01 03:28:08 rin Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_fdt.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_fdt.c,v 1.2 2020/12/01 03:28:08 rin Exp $"); #include #include @@ -93,7 +93,7 @@ vchiq_fdt_attach(device_t parent, device bus_size_t size; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { - aprint_error(": couldn't get register address\n"); + aprint_error_dev(sc->sc_dev, "couldn't get register address\n"); return; }
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: mlelstv Date: Tue Nov 3 12:04:56 UTC 2020 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.h Log Message: state struct should use fixed size types. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h:1.7 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h:1.8 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h:1.7 Tue Nov 3 08:41:30 2020 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h Tue Nov 3 12:04:56 2020 @@ -371,7 +371,7 @@ typedef struct vchiq_shared_state_struct REMOTE_EVENT_T recycle; /* The slot_queue index where the next recycled slot will be written. */ - int slot_queue_recycle; + int32_t slot_queue_recycle; /* This event should be signalled when a synchronous message is sent. */ REMOTE_EVENT_T sync_trigger;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Tue Nov 3 08:41:30 UTC 2020 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c vchiq_core.h Log Message: Fix build on aa64 To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.22 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.23 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.22 Sat Sep 26 12:58:23 2020 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Tue Nov 3 08:41:30 2020 @@ -42,6 +42,8 @@ #include +#include + #include #include Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h:1.6 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h:1.7 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h:1.6 Sat Sep 26 12:58:23 2020 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h Tue Nov 3 08:41:30 2020 @@ -37,6 +37,8 @@ #include #include +#include + #include "vchiq_cfg.h" #include "vchiq.h"
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Sat Feb 22 19:37:31 UTC 2020 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_netbsd_acpi.c Log Message: build fix To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.1 Tue Dec 31 01:00:23 2019 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c Sat Feb 22 19:37:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_netbsd_acpi.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $ */ +/* $NetBSD: vchiq_netbsd_acpi.c,v 1.2 2020/02/22 19:37:31 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_acpi.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_acpi.c,v 1.2 2020/02/22 19:37:31 jmcneill Exp $"); #include #include @@ -105,7 +105,7 @@ vchiq_acpi_attach(device_t parent, devic return; } - if (bus_space_map(sc->sc_iot, mem->ar_base, mem->ar_size, 0, + if (bus_space_map(sc->sc_iot, mem->ar_base, mem->ar_length, 0, &sc->sc_ioh) != 0) { aprint_error_dev(sc->sc_dev, "unable to map device\n"); return;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: mlelstv Date: Wed Jan 22 19:15:49 UTC 2020 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c vchiq_arm.c vchiq_core.c vchiq_core.h vchiq_kern_lib.c vchiq_shim.c Log Message: align with upstream for 64bit compatibility. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.20 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.21 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.20 Sun Dec 10 21:38:27 2017 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Wed Jan 22 19:15:49 2020 @@ -57,6 +57,9 @@ #include "vchiq_netbsd.h" #include "vchiq_connected.h" +#define VCPAGE_OFFSET 0x0fff +#define VCPAGE_SHIFT 12 + #define MAX_FRAGMENTS (VCHIQ_NUM_CURRENT_BULKS * 2) typedef struct vchiq_2835_state_struct { @@ -146,7 +149,7 @@ vchiq_platform_init(VCHIQ_STATE_T *state vchiq_log_info(vchiq_arm_log_level, "%s: slot_phys = %lx\n", __func__, slot_phys); - WARN_ON(((int)slot_mem & (PAGE_SIZE - 1)) != 0); + WARN_ON(((uintptr_t)slot_mem & (PAGE_SIZE - 1)) != 0); vchiq_slot_zero = vchiq_init_slots(slot_mem, slot_mem_size); if (!vchiq_slot_zero) { @@ -187,12 +190,12 @@ vchiq_platform_init(VCHIQ_STATE_T *state BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); vchiq_log_info(vchiq_arm_log_level, - "vchiq_init - done (slots %x, phys %x)", - (unsigned int)vchiq_slot_zero, (unsigned int)slot_phys); + "vchiq_init - done (slots %p, phys %x)", + vchiq_slot_zero, (unsigned int)slot_phys); vchiq_call_connected_callbacks(); - return 0; + return 0; failed_vchiq_init: failed_init_slots: @@ -355,7 +358,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu pagelist->type = (dir == VCHIQ_BULK_RECEIVE) ? PAGELIST_READ : PAGELIST_WRITE; pagelist->length = size; - pagelist->offset = va & L2_S_OFFSET; + pagelist->offset = va & VCPAGE_OFFSET; /* * busdma already coalesces contiguous pages for us @@ -363,10 +366,10 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu for (int i = 0; i < bi->dmamap->dm_nsegs; i++) { bus_addr_t addr = bi->dmamap->dm_segs[i].ds_addr; bus_size_t len = bi->dmamap->dm_segs[i].ds_len; - bus_size_t off = addr & L2_S_OFFSET; - int npgs = ((off + len + L2_S_OFFSET) >> L2_S_SHIFT); + bus_size_t off = addr & VCPAGE_OFFSET; + int npgs = ((off + len + VCPAGE_OFFSET) >> VCPAGE_SHIFT); - pagelist->addrs[i] = addr & ~L2_S_OFFSET; + pagelist->addrs[i] = addr & ~VCPAGE_OFFSET; pagelist->addrs[i] |= npgs - 1; } @@ -443,7 +446,7 @@ vchiq_complete_bulk(VCHIQ_BULK_T *bulk) PAGELIST_T *pagelist = bi->pagelist; vchiq_log_trace(vchiq_arm_log_level, - "free_pagelist - %x, %d", (unsigned int)pagelist, actual); + "free_pagelist - %p, %d", pagelist, actual); bus_dmamap_sync(dma_tag, bi->pagelist_map, 0, bi->pagelist_size, BUS_DMASYNC_POSTWRITE); Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.20 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.21 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.20 Tue Aug 7 09:01:52 2018 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Wed Jan 22 19:15:49 2020 @@ -461,8 +461,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, #define _IOC_TYPE(x) IOCGROUP(x) vchiq_log_trace(vchiq_arm_log_level, - "vchiq_ioctl - instance %x, cmd %s, arg %p", - (unsigned int)instance, + "vchiq_ioctl - instance %p, cmd %s, arg %p", + instance, ((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) && (_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ? ioctl_names[_IOC_NR(cmd)] : "", arg); @@ -755,8 +755,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, break; } vchiq_log_info(vchiq_arm_log_level, -"found bulk_waiter %x for pid %d", -(unsigned int)waiter, current->l_proc->p_pid); +"found bulk_waiter %p for pid %d", +waiter, current->l_proc->p_pid); args.userdata = &waiter->bulk_waiter; } status = vchiq_bulk_transfer @@ -786,8 +786,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, list_add(&
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: gson Date: Thu Aug 9 06:29:08 UTC 2018 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: One newline is enough. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.12 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.13 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.12 Sun Feb 5 16:05:20 2017 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Thu Aug 9 06:29:08 2018 @@ -3123,7 +3123,7 @@ vchiq_pause_internal(VCHIQ_STATE_T *stat break; default: vchiq_log_error(vchiq_core_log_level, - "vchiq_pause_internal in state %s\n", + "vchiq_pause_internal in state %s", conn_state_names[state->conn_state]); status = VCHIQ_ERROR; VCHIQ_STATS_INC(state, error_count);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: gson Date: Tue Aug 7 09:01:52 UTC 2018 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c vchiq_kern_lib.c Log Message: One newline is enough. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.19 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.20 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.19 Thu Nov 30 20:25:55 2017 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Tue Aug 7 09:01:52 2018 @@ -1489,7 +1489,7 @@ dump_phys_mem(void *virt_addr, uint32_t pages = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL); if (pages == NULL) { vchiq_log_error(vchiq_arm_log_level, - "Unable to allocation memory for %d pages\n", + "Unable to allocation memory for %d pages", num_pages); return; } Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.6 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.7 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.6 Wed Jan 28 09:41:04 2015 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Tue Aug 7 09:01:52 2018 @@ -84,17 +84,17 @@ VCHIQ_STATUS_T vchiq_initialise(VCHIQ_IN } if (i==VCHIQ_INIT_RETRIES) { vchiq_log_error(vchiq_core_log_level, - "%s: videocore not initialized\n", __func__); + "%s: videocore not initialized", __func__); goto failed; } else if (i>0) { vchiq_log_warning(vchiq_core_log_level, - "%s: videocore initialized after %d retries\n", __func__, i); + "%s: videocore initialized after %d retries", __func__, i); } instance = kzalloc(sizeof(*instance), GFP_KERNEL); if (!instance) { vchiq_log_error(vchiq_core_log_level, - "%s: error allocating vchiq instance\n", __func__); + "%s: error allocating vchiq instance", __func__); goto failed; }
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Sep 21 19:29:35 UTC 2017 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_kmod_netbsd.c Log Message: Spaces to TAB To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.7 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.8 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.7 Thu Jan 12 05:35:45 2017 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Thu Sep 21 19:29:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_kmod_netbsd.c,v 1.7 2017/01/12 05:35:45 skrll Exp $ */ +/* $NetBSD: vchiq_kmod_netbsd.c,v 1.8 2017/09/21 19:29:35 skrll Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.7 2017/01/12 05:35:45 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.8 2017/09/21 19:29:35 skrll Exp $"); #include #include @@ -96,7 +96,7 @@ vchiq_match(device_t parent, cfdata_t ma static void vchiq_attach(device_t parent, device_t self, void *aux) { -struct vchiq_softc *sc = device_private(self); + struct vchiq_softc *sc = device_private(self); struct amba_attach_args *aaa = aux; aprint_naive("\n"); @@ -181,8 +181,8 @@ remote_event_signal(REMOTE_EVENT_T *even if (event->armed) { bus_space_write_4(vchiq_softc->sc_iot, vchiq_softc->sc_ioh, VCHIQ_DOORBELL2, 0); -bus_space_barrier(vchiq_softc->sc_iot, vchiq_softc->sc_ioh, -VCHIQ_DOORBELL2, 4, BUS_SPACE_BARRIER_WRITE); + bus_space_barrier(vchiq_softc->sc_iot, vchiq_softc->sc_ioh, + VCHIQ_DOORBELL2, 4, BUS_SPACE_BARRIER_WRITE); } }
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sun Feb 5 16:05:20 UTC 2017 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: Don't call _sema_init twice on various objects... remote_event_create will initialise them Found by LOCKDEBUG To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.11 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.12 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.11 Thu Jan 12 05:41:25 2017 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Sun Feb 5 16:05:20 2017 @@ -2443,10 +2443,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, V _sema_init(&state->connect, 0); lmutex_init(&state->mutex); - _sema_init(&state->trigger_event, 0); - _sema_init(&state->recycle_event, 0); - _sema_init(&state->sync_trigger_event, 0); - _sema_init(&state->sync_release_event, 0); lmutex_init(&state->slot_mutex); lmutex_init(&state->recycle_mutex);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Jan 12 05:35:45 UTC 2017 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_kmod_netbsd.c Log Message: Use some macros for magic numbers and correct return value. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.6 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.7 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.6 Fri Jan 15 07:49:41 2016 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Thu Jan 12 05:35:45 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_kmod_netbsd.c,v 1.6 2016/01/15 07:49:41 mlelstv Exp $ */ +/* $NetBSD: vchiq_kmod_netbsd.c,v 1.7 2017/01/12 05:35:45 skrll Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.6 2016/01/15 07:49:41 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.7 2017/01/12 05:35:45 skrll Exp $"); #include #include @@ -72,6 +72,13 @@ static void vchiq_defer(device_t); /* External functions */ int vchiq_init(void); + +#define VCHIQ_DOORBELL0 0x40 +#define VCHIQ_DOORBELL1 0x44 +#define VCHIQ_DOORBELL2 0x48 +#define VCHIQ_DOORBELL3 0x4C + + CFATTACH_DECL_NEW(vchiq, sizeof(struct vchiq_softc), vchiq_match, vchiq_attach, NULL, NULL); @@ -138,14 +145,17 @@ vchiq_intr(void *priv) struct vchiq_softc *sc = priv; uint32_t status; - status = bus_space_read_4(sc->sc_iot, sc->sc_ioh, 0x40); - if (status & 0x4) - remote_event_pollall(&g_state); + bus_space_barrier(sc->sc_iot, sc->sc_ioh, + VCHIQ_DOORBELL0, 4, BUS_SPACE_BARRIER_READ); - bus_space_barrier(vchiq_softc->sc_iot, vchiq_softc->sc_ioh, - 0x40, 4, BUS_SPACE_BARRIER_READ); + rmb(); + status = bus_space_read_4(sc->sc_iot, sc->sc_ioh, VCHIQ_DOORBELL0); + if (status & 0x4) { + remote_event_pollall(&g_state); + return 1; + } - return 1; + return 0; } static int @@ -169,10 +179,10 @@ remote_event_signal(REMOTE_EVENT_T *even dsb(); /* data barrier operation */ if (event->armed) { - bus_space_barrier(vchiq_softc->sc_iot, vchiq_softc->sc_ioh, - 0x48, 4, BUS_SPACE_BARRIER_WRITE); bus_space_write_4(vchiq_softc->sc_iot, vchiq_softc->sc_ioh, - 0x48, 0); + VCHIQ_DOORBELL2, 0); +bus_space_barrier(vchiq_softc->sc_iot, vchiq_softc->sc_ioh, +VCHIQ_DOORBELL2, 4, BUS_SPACE_BARRIER_WRITE); } }
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: christos Date: Sun Jan 8 05:20:51 UTC 2017 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: xxx: gcc avoid bogus ssp warning To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.16 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.17 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.16 Wed Jan 28 04:41:04 2015 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sun Jan 8 00:20:51 2017 @@ -2513,7 +2513,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); int i, j = 0; /* Only dump 64 services */ - static const int local_max_services = 64; +#define local_max_services 64 /* If there's more than 64 services, only dump ones with * non-zero counts */ int only_nonzero = 0;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: mlelstv Date: Fri Jan 15 07:49:41 UTC 2016 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_kmod_netbsd.c Log Message: add sysctl nodes to configure vchiq log levels. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.5 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.6 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.5 Wed Jul 29 14:22:49 2015 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Fri Jan 15 07:49:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_kmod_netbsd.c,v 1.5 2015/07/29 14:22:49 skrll Exp $ */ +/* $NetBSD: vchiq_kmod_netbsd.c,v 1.6 2016/01/15 07:49:41 mlelstv Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,13 +30,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.5 2015/07/29 14:22:49 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.6 2016/01/15 07:49:41 mlelstv Exp $"); #include #include #include #include #include +#include #include #include @@ -174,3 +175,32 @@ remote_event_signal(REMOTE_EVENT_T *even 0x48, 0); } } + +SYSCTL_SETUP(sysctl_hw_vchiq_setup, "sysctl hw.vchiq setup") +{ + const struct sysctlnode *rnode = NULL; + const struct sysctlnode *cnode = NULL; + + sysctl_createv(clog, 0, NULL, &rnode, + CTLFLAG_PERMANENT, CTLTYPE_NODE, "vchiq", NULL, + NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &rnode, &cnode, + CTLFLAG_PERMANENT, CTLTYPE_NODE, "loglevel", NULL, + NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &cnode, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "core", "VChiq Core Loglevel", NULL, 0, + &vchiq_core_log_level, 0, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &cnode, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "coremsg", "VChiq Core Message Loglevel", NULL, 0, + &vchiq_core_msg_log_level, 0, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &cnode, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "sync", "VChiq Sync Loglevel", NULL, 0, + &vchiq_sync_log_level, 0, CTL_CREATE, CTL_EOL); +}
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Wed Jan 28 09:41:04 UTC 2015 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c vchiq_kern_lib.c Log Message: It turns out we needed to track pid all along, so revert the lwp tracking I did ages ago. quake has a chance of working now. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.5 -r1.6 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.15 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.16 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.15 Fri Jan 23 10:19:22 2015 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Wed Jan 28 09:41:04 2015 @@ -120,7 +120,7 @@ typedef struct user_service_struct { struct bulk_waiter_node { struct bulk_waiter bulk_waiter; - struct lwp *l; + int pid; struct list_head list; }; @@ -135,7 +135,7 @@ struct vchiq_instance_struct { int connected; int closing; - struct lwp *l; + int pid; int mark; struct list_head bulk_waiter_list; @@ -527,7 +527,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (pargs->is_open) { status = vchiq_open_service_internal - (service, (uintptr_t)instance->l); + (service, instance->pid); if (status != VCHIQ_SUCCESS) { vchiq_remove_service(service->handle); service = NULL; @@ -660,7 +660,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, lmutex_lock(&instance->bulk_waiter_list_mutex); list_for_each(pos, &instance->bulk_waiter_list) { if (list_entry(pos, struct bulk_waiter_node, - list)->l == current) { + list)->pid == current->l_proc->p_pid) { waiter = list_entry(pos, struct bulk_waiter_node, list); @@ -672,14 +672,14 @@ vchiq_ioctl(struct file *fp, u_long cmd, lmutex_unlock(&instance->bulk_waiter_list_mutex); if (!waiter) { vchiq_log_error(vchiq_arm_log_level, - "no bulk_waiter found for lwp %p", - current); + "no bulk_waiter found for pid %d", + current->l_proc->p_pid); ret = -ESRCH; break; } vchiq_log_info(vchiq_arm_log_level, -"found bulk_waiter %x for lwp %p", -(unsigned int)waiter, current); +"found bulk_waiter %x for pid %d", +(unsigned int)waiter, current->l_proc->p_pid); pargs->userdata = &waiter->bulk_waiter; } status = vchiq_bulk_transfer @@ -704,13 +704,13 @@ vchiq_ioctl(struct file *fp, u_long cmd, } else { const VCHIQ_BULK_MODE_T mode_waiting = VCHIQ_BULK_MODE_WAITING; - waiter->l = current; + waiter->pid = current->l_proc->p_pid; lmutex_lock(&instance->bulk_waiter_list_mutex); list_add(&waiter->list, &instance->bulk_waiter_list); lmutex_unlock(&instance->bulk_waiter_list_mutex); vchiq_log_info(vchiq_arm_log_level, -"saved bulk_waiter %x for lwp %p", -(unsigned int)waiter, current); +"saved bulk_waiter %x for pid %d", +(unsigned int)waiter, current->l_proc->p_pid); pargs->mode = mode_waiting; } @@ -1064,7 +1064,7 @@ vchiq_open(dev_t dev, int flags, int mod } instance->state = state; - instance->l = l; + instance->pid = current->l_proc->p_pid; #ifdef notyet ret = vchiq_proc_add_instance(instance); @@ -1205,8 +1205,8 @@ vchiq_close(struct file *fp) list_del(pos); vchiq_log_info(vchiq_arm_log_level, "bulk_waiter - cleaned up %x " - "for lwp %p", - (unsigned int)waiter, waiter->l); + "for pid %d", + (unsigned int)waiter, waiter->pid); _sema_destroy(&waiter->bulk_waiter.event); kfree(waiter); } @@ -1297,9 +1297,9 @@ vchiq_dump_platform_instances(void *dump instance = service->instance; if (instance && !instance->mark) { len = snprintf(buf, sizeof(buf), - "Instance %x: lwp %p,%s completions " + "Instance %x: pid %d,%s completions " "%d/%d", - (unsigned int)instance, instance->l, + (unsigned int)instance, instance->pid, instance->connected ? " connected, " : "", instance->completion_insert - Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.5 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.6 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.5 Wed Jul 16 23:59:58 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Wed Jan 28 09:41:04 2015 @@ -42,7 +42,7 @@ struct bulk_waiter_node { struct bulk_waiter bulk_waiter; - struct lwp *l; + int pid; struct list_head lis
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Fri Jan 23 10:19:22 UTC 2015 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: More count vs ret confusion. Need to send notification if count != 0. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.14 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.15 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.14 Sat Dec 20 19:40:49 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Fri Jan 23 10:19:22 2015 @@ -718,6 +718,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, case VCHIQ_IOC_AWAIT_COMPLETION: { VCHIQ_AWAIT_COMPLETION_T *pargs = arg; + int count = 0; DEBUG_TRACE(AWAIT_COMPLETION_LINE); if (!instance->connected) { @@ -752,9 +753,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (ret == 0) { int msgbufcount = pargs->msgbufcount; - int count; - for (count = 0; count < pargs->count; count++) { + for (; count < pargs->count; count++) { VCHIQ_COMPLETION_DATA_T *completion; VCHIQ_SERVICE_T *service1; USER_SERVICE_T *user_service; @@ -847,7 +847,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, pargs->count = count; } - if (ret != 0) + if (count != 0) up(&instance->remove_event); lmutex_unlock(&instance->completion_mutex); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: nat Date: Sat Dec 20 19:49:27 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: Allow more space for temp string buffer in service stats display. Fixes corrupted display when rx and tx count become large. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.10 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9 Thu Mar 27 23:03:07 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Sat Dec 20 19:49:27 2014 @@ -3648,7 +3648,7 @@ vchiq_dump_state(void *dump_context, VCH void vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service) { - char buf[80]; + char buf[120]; int len; len = snprintf(buf, sizeof(buf), "Service %d: %s (ref %u)",
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: nat Date: Sat Dec 20 19:40:49 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: Enable state/stats information on vchiq device read. This commit was approved by skrll@ To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.14 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13 Fri Jul 25 08:10:40 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sat Dec 20 19:40:49 2014 @@ -36,6 +36,7 @@ #include #include #include +#include #include "vchiq_core.h" #include "vchiq_ioctl.h" @@ -196,9 +197,10 @@ extern struct cfdriver vchiq_cd; static int vchiq_ioctl(struct file *, u_long, void *); static int vchiq_close(struct file *); +static int vchiq_read(struct file *, off_t *, struct uio *, kauth_cred_t, int); static const struct fileops vchiq_fileops = { - .fo_read = fbadop_read, + .fo_read = vchiq_read, .fo_write = fbadop_write, .fo_ioctl = vchiq_ioctl, .fo_fcntl = fnullop_fcntl, @@ -1245,9 +1247,7 @@ vchiq_dump(void *dump_context, const cha copy_bytes = min(len, (int)(context->space - context->actual)); if (copy_bytes == 0) return; - if (copy_to_user(context->buf + context->actual, str, - copy_bytes)) - context->actual = -EFAULT; + memcpy(context->buf + context->actual, str, copy_bytes); context->actual += copy_bytes; len -= copy_bytes; @@ -1256,9 +1256,7 @@ vchiq_dump(void *dump_context, const cha ** carriage return. */ if ((len == 0) && (str[copy_bytes - 1] == '\0')) { char cr = '\n'; - if (copy_to_user(context->buf + context->actual - 1, -&cr, 1)) -context->actual = -EFAULT; + memcpy(context->buf + context->actual - 1, &cr, 1); } } } @@ -1432,6 +1430,7 @@ dump_phys_mem(void *virt_addr, uint32_t kfree(pages); } +#endif / * @@ -1439,23 +1438,29 @@ dump_phys_mem(void *virt_addr, uint32_t * ***/ -static ssize_t -vchiq_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) +static int +vchiq_read(struct file *file, off_t *ppos, struct uio *uio, kauth_cred_t cred, +int flags) { + int result; + + char *buf = kmem_zalloc(PAGE_SIZE, KM_SLEEP); + DUMP_CONTEXT_T context; context.buf = buf; context.actual = 0; - context.space = count; + context.space = PAGE_SIZE; context.offset = *ppos; vchiq_dump_state(&context, &g_state); *ppos += context.actual; - return context.actual; + result = uiomove(buf, context.actual, uio); + kmem_free(buf, PAGE_SIZE); + + return result; } -#endif VCHIQ_STATE_T * vchiq_get_state(void)
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Tue Sep 2 21:38:28 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_shim.c Log Message: expose vchi_get_peer_version To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.4 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.5 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.4 Wed Jul 16 23:59:58 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c Tue Sep 2 21:38:28 2014 @@ -725,7 +725,6 @@ int32_t vchi_service_destroy(const VCHI_ } EXPORT_SYMBOL(vchi_service_destroy); -#ifdef notyet int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle, short *peer_version ) { int32_t ret = -1; @@ -739,6 +738,7 @@ int32_t vchi_get_peer_version( const VCH } EXPORT_SYMBOL(vchi_get_peer_version); +#if notyet /* -- * read a uint32_t from buffer. * network format is defined to be little endian
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Wed Jul 16 23:59:58 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_kern_lib.c vchiq_shim.c Log Message: >From >https://github.com/raspberrypi/linux/commit/517d5c1c9ceb7bf94c4e56e4fb97758e13f24b3b > Fix for ALSA driver crash > Avoids an issue when closing and opening vchiq where a message can arrive > before service handle has been written To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.4 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.5 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.4 Thu Mar 27 23:03:07 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Wed Jul 16 23:59:58 2014 @@ -288,12 +288,13 @@ VCHIQ_STATUS_T vchiq_open_service( NULL); if (service) { + *phandle = service->handle; status = vchiq_open_service_internal(service, (uintptr_t)current); - if (status == VCHIQ_SUCCESS) - *phandle = service->handle; - else + if (status != VCHIQ_SUCCESS) { vchiq_remove_service(service->handle); + *phandle = VCHIQ_SERVICE_HANDLE_INVALID; + } } failed: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.3 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.4 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.3 Thu Mar 27 23:03:07 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c Wed Jul 16 23:59:58 2014 @@ -632,6 +632,9 @@ int32_t vchi_service_open(VCHI_INSTANCE_ { VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; SHIM_SERVICE_T *service = service_alloc(instance, setup); + + *handle = (VCHI_SERVICE_HANDLE_T)service; + if (service) { VCHIQ_SERVICE_PARAMS_T params; VCHIQ_STATUS_T status; @@ -648,11 +651,10 @@ int32_t vchi_service_open(VCHI_INSTANCE_ if (status != VCHIQ_SUCCESS) { service_free(service); service = NULL; + *handle = NULL; } } - *handle = (VCHI_SERVICE_HANDLE_T)service; - return (service != NULL) ? 0 : -1; } EXPORT_SYMBOL(vchi_service_open); @@ -663,6 +665,9 @@ int32_t vchi_service_create(VCHI_INSTANC { VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; SHIM_SERVICE_T *service = service_alloc(instance, setup); + + *handle = (VCHI_SERVICE_HANDLE_T)service; + if (service) { VCHIQ_SERVICE_PARAMS_T params; VCHIQ_STATUS_T status; @@ -678,11 +683,10 @@ int32_t vchi_service_create(VCHI_INSTANC if (status != VCHIQ_SUCCESS) { service_free(service); service = NULL; + *handle = NULL; } } - *handle = (VCHI_SERVICE_HANDLE_T)service; - return (service != NULL) ? 0 : -1; } EXPORT_SYMBOL(vchi_service_create);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: joerg Date: Thu May 1 03:07:50 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: First argument of vchiq_log_info is the log level, not a boolean. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.16 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.17 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.16 Sat Apr 19 07:28:18 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Thu May 1 03:07:50 2014 @@ -553,7 +553,7 @@ vchiq_platform_use_suspend_timer(void) void vchiq_dump_platform_use_state(VCHIQ_STATE_T *state) { - vchiq_log_info((vchiq_arm_log_level>=VCHIQ_LOG_INFO),"Suspend timer not in use"); + vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use"); } void vchiq_platform_handle_timeout(VCHIQ_STATE_T *state)
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sat Apr 19 07:28:18 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Deal in 4KB pages for vchiq regardless of ARM page size. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.15 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.16 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.15 Sat Apr 19 07:17:21 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Sat Apr 19 07:28:18 2014 @@ -338,14 +338,19 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu pagelist->type = (dir == VCHIQ_BULK_RECEIVE) ? PAGELIST_READ : PAGELIST_WRITE; pagelist->length = size; - pagelist->offset = va & PAGE_MASK; + pagelist->offset = va & L2_S_OFFSET; /* * busdma already coalesces contiguous pages for us */ for (int i = 0; i < bi->dmamap->dm_nsegs; i++) { - pagelist->addrs[i] = bi->dmamap->dm_segs[i].ds_addr & ~PAGE_MASK; - pagelist->addrs[i] |= atop(round_page(bi->dmamap->dm_segs[i].ds_len)) - 1; + bus_addr_t addr = bi->dmamap->dm_segs[i].ds_addr; + bus_size_t len = bi->dmamap->dm_segs[i].ds_len; + bus_size_t off = addr & L2_S_OFFSET; + int npgs = ((off + len + L2_S_OFFSET) >> L2_S_SHIFT); + + pagelist->addrs[i] = addr & ~L2_S_OFFSET; + pagelist->addrs[i] |= npgs - 1; } /* Partial cache lines (fragments) require special measures */
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sat Apr 19 07:17:21 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Wrap a long line. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.14 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.15 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.14 Sat Apr 19 07:10:31 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Sat Apr 19 07:17:21 2014 @@ -335,7 +335,8 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu bulk->handle = memhandle; - pagelist->type = (dir == VCHIQ_BULK_RECEIVE) ? PAGELIST_READ : PAGELIST_WRITE; + pagelist->type = (dir == VCHIQ_BULK_RECEIVE) ? + PAGELIST_READ : PAGELIST_WRITE; pagelist->length = size; pagelist->offset = va & PAGE_MASK;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sat Apr 19 07:10:31 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Comment KNF To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.13 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.14 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.13 Sat Apr 12 13:28:41 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Sat Apr 19 07:10:31 2014 @@ -307,7 +307,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu /* * We've now got the bus_addr_t for the pagelist we want the transfer * to use. - * */ + */ bulk->data = (void *)bi->pagelist_map->dm_segs[0].ds_addr; /*
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Apr 17 13:48:02 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: Fix count vs ret confusion. ret is only set on error when count == 0 - make sure this is the case. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.11 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.12 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.11 Thu Mar 27 23:03:07 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Thu Apr 17 13:48:02 2014 @@ -715,7 +715,6 @@ vchiq_ioctl(struct file *fp, u_long cmd, case VCHIQ_IOC_AWAIT_COMPLETION: { VCHIQ_AWAIT_COMPLETION_T *pargs = arg; - int count = 0; DEBUG_TRACE(AWAIT_COMPLETION_LINE); if (!instance->connected) { @@ -750,6 +749,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (ret == 0) { int msgbufcount = pargs->msgbufcount; + int count; + for (count = 0; count < pargs->count; count++) { VCHIQ_COMPLETION_DATA_T *completion; VCHIQ_SERVICE_T *service1; @@ -831,7 +832,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, count * sizeof(VCHIQ_COMPLETION_DATA_T)), completion, sizeof(VCHIQ_COMPLETION_DATA_T)) != 0) { - if (ret == 0) + if (count == 0) ret = -EFAULT; break; } @@ -843,7 +844,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, pargs->count = count; } - if ((ret == 0 && count > 0) || ret != 0) + if (ret != 0) up(&instance->remove_event); lmutex_unlock(&instance->completion_mutex); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Mar 27 10:42:47 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: More #if 0'ed removal To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.11 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.12 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.11 Thu Mar 27 10:11:04 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Thu Mar 27 10:42:47 2014 @@ -72,15 +72,6 @@ struct semaphore g_free_fragments_sema; static DEFINE_SEMAPHORE(g_free_fragments_mutex); -#if 0 -static int -create_pagelist(char __user *buf, size_t count, unsigned short type, -lwp_t *l, PAGELIST_T ** ppagelist); - -static void -free_pagelist(PAGELIST_T *pagelist, int actual); -#endif - int __init vchiq_platform_init(VCHIQ_STATE_T *state) {
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Mar 27 10:11:04 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Remove #if 0'ed code. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.10 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.11 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.10 Wed Mar 26 16:07:15 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Thu Mar 27 10:11:04 2014 @@ -251,6 +251,13 @@ typedef struct bulkinfo_struct { int size; } BULKINFO_T; +/* There is a potential problem with partial cache lines (pages?) +** at the ends of the block when reading. If the CPU accessed anything in +** the same line (page?) then it may have pulled old data into the cache, +** obscuring the new data underneath. We can solve this by transferring the +** partial cache lines separately, and allowing the ARM to copy into the +** cached area. +*/ VCHIQ_STATUS_T vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, VCHI_MEM_HANDLE_T memhandle, void *buf, int size, int dir) @@ -554,195 +561,3 @@ vchiq_platform_handle_timeout(VCHIQ_STAT { (void)state; } -/* - * Local functions - */ - -/* There is a potential problem with partial cache lines (pages?) -** at the ends of the block when reading. If the CPU accessed anything in -** the same line (page?) then it may have pulled old data into the cache, -** obscuring the new data underneath. We can solve this by transferring the -** partial cache lines separately, and allowing the ARM to copy into the -** cached area. - -** N.B. This implementation plays slightly fast and loose with the Linux -** driver programming rules, e.g. its use of __virt_to_bus instead of -** dma_map_single, but it isn't a multi-platform driver and it benefits -** from increased speed as a result. -*/ - -#if 0 -static int -create_pagelist(char __user *buf, size_t count, unsigned short type, - struct task_struct *task, PAGELIST_T ** ppagelist) -{ - PAGELIST_T *pagelist; - struct page **pages; - struct page *page; - unsigned long *addrs; - unsigned int num_pages, offset, i; - char *addr, *base_addr, *next_addr; - int run, addridx, actual_pages; - - offset = (unsigned int)buf & (PAGE_SIZE - 1); - num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE; - - *ppagelist = NULL; - - /* Allocate enough storage to hold the page pointers and the page - ** list - */ - pagelist = kmalloc(sizeof(PAGELIST_T) + - (num_pages * sizeof(unsigned long)) + - (num_pages * sizeof(pages[0])), - GFP_KERNEL); - - vchiq_log_trace(vchiq_arm_log_level, - "create_pagelist - %x", (unsigned int)pagelist); - if (!pagelist) - return -ENOMEM; - - addrs = pagelist->addrs; - pages = (struct page **)(addrs + num_pages); - - down_read(&task->mm->mmap_sem); - actual_pages = get_user_pages(task, task->mm, - (unsigned long)buf & ~(PAGE_SIZE - 1), num_pages, - (type == PAGELIST_READ) /*Write */ , 0 /*Force */ , - pages, NULL /*vmas */); - up_read(&task->mm->mmap_sem); - - if (actual_pages != num_pages) - { - /* This is probably due to the process being killed */ - while (actual_pages > 0) - { - actual_pages--; - page_cache_release(pages[actual_pages]); - } - kfree(pagelist); - if (actual_pages == 0) - actual_pages = -ENOMEM; - return actual_pages; - } - - pagelist->length = count; - pagelist->type = type; - pagelist->offset = offset; - - /* Group the pages into runs of contiguous pages */ - - base_addr = VCHIQ_ARM_ADDRESS(page_address(pages[0])); - next_addr = base_addr + PAGE_SIZE; - addridx = 0; - run = 0; - - for (i = 1; i < num_pages; i++) { - addr = VCHIQ_ARM_ADDRESS(page_address(pages[i])); - if ((addr == next_addr) && (run < (PAGE_SIZE - 1))) { - next_addr += PAGE_SIZE; - run++; - } else { - addrs[addridx] = (unsigned long)base_addr + run; - addridx++; - base_addr = addr; - next_addr = addr + PAGE_SIZE; - run = 0; - } - } - - addrs[addridx] = (unsigned long)base_addr + run; - addridx++; - - /* Partial cache lines (fragments) require special measures */ - if ((type == PAGELIST_READ) && - ((pagelist->offset & (CACHE_LINE_SIZE - 1)) || - ((pagelist->offset + pagelist->length) & - (CACHE_LINE_SIZE - 1 { - FRAGMENTS_T *fragments; - - if (down_interruptible(&g_free_fragments_sema) != 0) { - kfree(pagelist); - return -EINTR; - } - - WARN_ON(g_free_fragments == NULL); - - down(&g_free_fragments_mutex); - fragments = (FRAGMENTS_T *) g_free_fragments; - WARN_ON(fragments == NULL); - g_free_fragments = *(FRAGM
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Wed Mar 26 16:07:15 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Correct some bus_dma operations. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.9 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.10 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.9 Sun Apr 28 20:57:26 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Wed Mar 26 16:07:15 2014 @@ -100,7 +100,7 @@ vchiq_platform_init(VCHIQ_STATE_T *state dma_nsegs = __arraycount(dma_segs); err = bus_dmamem_alloc(&bcm2835_bus_dma_tag, g_slot_mem_size + frag_mem_size, PAGE_SIZE, 0, - dma_segs, dma_nsegs, &dma_nsegs, BUS_DMA_COHERENT | BUS_DMA_WAITOK); + dma_segs, dma_nsegs, &dma_nsegs, BUS_DMA_WAITOK); if (err) { vchiq_log_error(vchiq_core_log_level, "Unable to allocate channel memory"); err = -ENOMEM; @@ -289,7 +289,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu goto fail1; ret = bus_dmamem_map(&bcm2835_bus_dma_tag, bi->pagelist_sgs, nsegs, - bi->pagelist_size, &bi->pagelist, BUS_DMA_WAITOK); + bi->pagelist_size, &bi->pagelist, BUS_DMA_COHERENT | BUS_DMA_WAITOK); if (ret != 0) goto fail2; @@ -378,7 +378,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu bulk->remote_data = bi; bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->pagelist_map, 0, - bi->pagelist_size, BUS_DMASYNC_PREREAD); + bi->pagelist_size, BUS_DMASYNC_PREWRITE); bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->dmamap, 0, bi->size, pagelist->type == PAGELIST_WRITE ? @@ -420,6 +420,13 @@ vchiq_complete_bulk(VCHIQ_BULK_T *bulk) BULKINFO_T *bi = bulk->remote_data; PAGELIST_T *pagelist = bi->pagelist; + bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->pagelist_map, 0, + bi->pagelist_size, BUS_DMASYNC_POSTWRITE); + + bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->dmamap, 0, bi->size, + pagelist->type == PAGELIST_WRITE ? + BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); + /* Deal with any partial cache lines (fragments) */ if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { FRAGMENTS_T *fragments = g_fragments_base + @@ -469,13 +476,6 @@ vchiq_complete_bulk(VCHIQ_BULK_T *bulk) up(&g_free_fragments_mutex); up(&g_free_fragments_sema); } - bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->pagelist_map, 0, - bi->pagelist_size, BUS_DMASYNC_POSTREAD); - - bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->dmamap, 0, bi->size, - pagelist->type == PAGELIST_WRITE ? - BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(&bcm2835_bus_dma_tag, bi->dmamap); bus_dmamap_destroy(&bcm2835_bus_dma_tag, bi->dmamap); if (IS_USER_ADDRESS(bi->buf))
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sat Dec 14 10:00:42 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: Comment out unsed variable. Left for reference. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.7 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.8 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.7 Sun Dec 1 02:57:43 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Sat Dec 14 10:00:42 2013 @@ -1462,12 +1462,11 @@ parse_open(VCHIQ_STATE_T *state, VCHIQ_H { VCHIQ_SERVICE_T *service = NULL; int msgid, size; - int type; unsigned int localport, remoteport; msgid = header->msgid; size = header->size; - type = VCHIQ_MSG_TYPE(msgid); + //int type = VCHIQ_MSG_TYPE(msgid); localport = VCHIQ_MSG_DSTPORT(msgid); remoteport = VCHIQ_MSG_SRCPORT(msgid); if (size >= sizeof(struct vchiq_open_payload)) {
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sat Dec 14 09:58:43 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: Remove unused variables. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.7 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.8 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.7 Sun Oct 13 07:46:26 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sat Dec 14 09:58:43 2013 @@ -2358,7 +2358,6 @@ vchiq_release_internal(VCHIQ_STATE_T *st VCHIQ_STATUS_T ret = VCHIQ_SUCCESS; char entity[16]; int *entity_uc; - int local_uc, local_entity_uc; if (!arm_state) goto out; @@ -2383,8 +2382,8 @@ vchiq_release_internal(VCHIQ_STATE_T *st ret = VCHIQ_ERROR; goto unlock; } - local_uc = --arm_state->videocore_use_count; - local_entity_uc = --(*entity_uc); + --arm_state->videocore_use_count; + --(*entity_uc); if (!vchiq_videocore_wanted(state)) { if (vchiq_platform_use_suspend_timer() &&
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: joerg Date: Sun Dec 1 02:57:43 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: remote_event_destroy is unused, mark it so. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.6 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.7 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.6 Sun Oct 13 07:46:26 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Sun Dec 1 02:57:43 2013 @@ -387,7 +387,7 @@ remote_event_create(REMOTE_EVENT_T *even _sema_init(event->event, 0); } -static inline void +__unused static inline void remote_event_destroy(REMOTE_EVENT_T *event) { (void)event;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sun Oct 13 07:46:26 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c vchiq_core.c Log Message: Print the client_id (lwp address) as hex and avoid stack overflow. Use snprintf while here. Fixes PR/48287 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.5 -r1.6 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.6 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.7 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.6 Thu Sep 19 15:13:43 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sun Oct 13 07:46:26 2013 @@ -577,7 +577,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (status != VCHIQ_SUCCESS) { vchiq_log_error(vchiq_susp_log_level, "%s: cmd %s returned error %d for " - "service %c%c%c%c:%03d", + "service %c%c%c%c:%8x", __func__, (cmd == VCHIQ_IOC_USE_SERVICE) ? "VCHIQ_IOC_USE_SERVICE" : @@ -1942,7 +1942,7 @@ output_timeout_error(VCHIQ_STATE_T *stat VCHIQ_SERVICE_T *service_ptr = state->services[i]; if (service_ptr && service_ptr->service_use_count && (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) { - snprintf(service_err, 50, " %c%c%c%c(%d) service has " + snprintf(service_err, 50, " %c%c%c%c(%8x) service has " "use count %d%s", VCHIQ_FOURCC_AS_4CHARS( service_ptr->base.fourcc), service_ptr->client_id, @@ -2237,7 +2237,7 @@ vchiq_use_internal(VCHIQ_STATE_T *state, sprintf(entity, "VCHIQ: "); entity_uc = &arm_state->peer_use_count; } else if (service) { - sprintf(entity, "%c%c%c%c:%03d", + snprintf(entity, sizeof(entity), "%c%c%c%c:%8x", VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id); entity_uc = &service->service_use_count; @@ -2366,7 +2366,7 @@ vchiq_release_internal(VCHIQ_STATE_T *st vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); if (service) { - sprintf(entity, "%c%c%c%c:%03d", + snprintf(entity, sizeof(entity), "%c%c%c%c:%8x", VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id); entity_uc = &service->service_use_count; @@ -2596,7 +2596,7 @@ vchiq_check_service(VCHIQ_SERVICE_T *ser if (ret == VCHIQ_ERROR) { vchiq_log_error(vchiq_susp_log_level, - "%s ERROR - %c%c%c%c:%d service count %d, " + "%s ERROR - %c%c%c%c:%8x service count %d, " "state count %d, videocore suspend state %s", __func__, VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id, service->service_use_count, Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.5 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.6 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.5 Fri Sep 20 09:05:53 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Sun Oct 13 07:46:26 2013 @@ -3664,7 +3664,7 @@ vchiq_dump_service_state(void *dump_cont if (service->public_fourcc != VCHIQ_FOURCC_INVALID) snprintf(remoteport + len2, sizeof(remoteport) - len2, - " (client %x)", service->client_id); + " (client %8x)", service->client_id); } else strcpy(remoteport, "n/a");
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Fri Sep 20 09:05:53 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: Clean up semaphore initialisation. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.4 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.5 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.4 Thu Sep 19 13:51:44 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Fri Sep 20 09:05:53 2013 @@ -384,7 +384,7 @@ remote_event_create(REMOTE_EVENT_T *even event->armed = 0; /* Don't clear the 'fired' flag because it may already have been set ** by the other side. */ - event->event->value = 0; + _sema_init(event->event, 0); } static inline void @@ -2377,10 +2377,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, V _sema_init(&state->connect, 0); lmutex_init(&state->mutex); - _sema_init(&state->trigger_event, 0); - _sema_init(&state->recycle_event, 0); - _sema_init(&state->sync_trigger_event, 0); - _sema_init(&state->sync_release_event, 0); lmutex_init(&state->slot_mutex); lmutex_init(&state->recycle_mutex);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Sep 19 15:13:43 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c vchiq_kern_lib.c Log Message: Track waiters/clients via lwp pointer and not pid. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.5 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.6 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.5 Thu Sep 19 13:51:44 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Thu Sep 19 15:13:43 2013 @@ -119,7 +119,7 @@ typedef struct user_service_struct { struct bulk_waiter_node { struct bulk_waiter bulk_waiter; - int pid; + struct lwp *l; struct list_head list; }; @@ -134,7 +134,7 @@ struct vchiq_instance_struct { int connected; int closing; - int pid; + struct lwp *l; int mark; struct list_head bulk_waiter_list; @@ -508,7 +508,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (pargs->is_open) { status = vchiq_open_service_internal - (service, instance->pid); + (service, (uintptr_t)instance->l); if (status != VCHIQ_SUCCESS) { vchiq_remove_service(service->handle); service = NULL; @@ -643,7 +643,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, lmutex_lock(&instance->bulk_waiter_list_mutex); list_for_each(pos, &instance->bulk_waiter_list) { if (list_entry(pos, struct bulk_waiter_node, - list)->pid == current->l_proc->p_pid) { + list)->l == current) { waiter = list_entry(pos, struct bulk_waiter_node, list); @@ -687,7 +687,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, } else { const VCHIQ_BULK_MODE_T mode_waiting = VCHIQ_BULK_MODE_WAITING; - waiter->pid = current->l_proc->p_pid; + waiter->l = current; lmutex_lock(&instance->bulk_waiter_list_mutex); list_add(&waiter->list, &instance->bulk_waiter_list); lmutex_unlock(&instance->bulk_waiter_list_mutex); @@ -1050,8 +1050,7 @@ vchiq_open(dev_t dev, int flags, int mod } instance->state = state; - /* XXXBSD: PID or thread ID? */ - instance->pid = l->l_proc->p_pid; + instance->l = l; #ifdef notyet ret = vchiq_proc_add_instance(instance); @@ -1195,8 +1194,8 @@ vchiq_close(struct file *fp) list_del(pos); vchiq_log_info(vchiq_arm_log_level, "bulk_waiter - cleaned up %x " - "for pid %d", - (unsigned int)waiter, waiter->pid); + "for lwp %p", + (unsigned int)waiter, waiter->l); _sema_destroy(&waiter->bulk_waiter.event); kfree(waiter); } @@ -1291,9 +1290,9 @@ vchiq_dump_platform_instances(void *dump instance = service->instance; if (instance && !instance->mark) { len = snprintf(buf, sizeof(buf), - "Instance %x: pid %d,%s completions " + "Instance %x: lwp %p,%s completions " "%d/%d", - (unsigned int)instance, instance->pid, + (unsigned int)instance, instance->l, instance->connected ? " connected, " : "", instance->completion_insert - Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.2 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.3 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.2 Thu Sep 19 13:51:44 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Thu Sep 19 15:13:43 2013 @@ -42,7 +42,7 @@ struct bulk_waiter_node { struct bulk_waiter bulk_waiter; - int pid; + struct lwp *l; struct list_head list; }; @@ -151,8 +151,8 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INST list_del(pos); vchiq_log_info(vchiq_arm_log_level, "bulk_waiter - cleaned up %x " - "for pid %d", - (unsigned int)waiter, waiter->pid); + "for lwp %p", + (unsigned int)waiter, waiter->l); _sema_destroy(&waiter->bulk_waiter.event); kfree(waiter); @@ -287,7 +287,7 @@ VCHIQ_STATUS_T vchiq_open_service( if (service) { status = vchiq_open_service_internal(service, - current->l_proc->p_pid); + (uintptr_t)current); if (status == VCHIQ_SUCCESS) *phandle = service->handle; else @@ -393,7 +393,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVI lmutex_lock(&instance->bulk_waiter_list_mutex); list_for_each(pos, &instance->bulk_waiter_list) { if (list_entry(pos, struct bulk_waiter_node, -list)->pid == current->l_proc->p_pid) { +list)->l == current) { waiter = list_entry(pos, struct
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Sep 19 13:51:45 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c vchiq_core.c vchiq_kern_lib.c Log Message: Call {lmutex,_sema)_destroy appropriately To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.4 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.5 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.4 Sat Aug 3 13:23:10 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Thu Sep 19 13:51:44 2013 @@ -682,6 +682,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, waiter->bulk_waiter.bulk->userdata = NULL; spin_unlock(&bulk_waiter_spinlock); } + _sema_destroy(&waiter->bulk_waiter.event); kfree(waiter); } else { const VCHIQ_BULK_MODE_T mode_waiting = @@ -810,6 +811,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (completion->reason == VCHIQ_SERVICE_CLOSED) { unlock_service(service1); + _sema_destroy(&user_service->insert_event); + _sema_destroy(&user_service->remove_event); kfree(user_service); } @@ -1159,6 +1162,8 @@ vchiq_close(struct file *fp) spin_unlock(&msg_queue_spinlock); unlock_service(service); + _sema_destroy(&user_service->insert_event); + _sema_destroy(&user_service->remove_event); kfree(user_service); } @@ -1192,6 +1197,7 @@ vchiq_close(struct file *fp) "bulk_waiter - cleaned up %x " "for pid %d", (unsigned int)waiter, waiter->pid); + _sema_destroy(&waiter->bulk_waiter.event); kfree(waiter); } } Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.3 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.4 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.3 Mon Mar 25 22:58:42 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Thu Sep 19 13:51:44 2013 @@ -276,6 +276,10 @@ unlock_service(VCHIQ_SERVICE_T *service) if (!service->ref_count) { BUG_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); state->services[service->localport] = NULL; + + _sema_destroy(&service->remove_event); + _sema_destroy(&service->bulk_remove_event); + lmutex_destroy(&service->bulk_mutex); } else service = NULL; } @@ -2588,6 +2592,10 @@ vchiq_add_service_internal(VCHIQ_STATE_T lmutex_unlock(&state->mutex); if (!pservice) { + _sema_destroy(&service->remove_event); + _sema_destroy(&service->bulk_remove_event); + lmutex_destroy(&service->bulk_mutex); + kfree(service); service = NULL; } Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.1 Fri Mar 8 12:32:31 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Thu Sep 19 13:51:44 2013 @@ -153,8 +153,13 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INST "bulk_waiter - cleaned up %x " "for pid %d", (unsigned int)waiter, waiter->pid); + _sema_destroy(&waiter->bulk_waiter.event); + kfree(waiter); } + + lmutex_destroy(&instance->bulk_waiter_list_mutex); + kfree(instance); } @@ -436,6 +441,8 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVI bulk->userdata = NULL; spin_unlock(&bulk_waiter_spinlock); } + _sema_destroy(&waiter->bulk_waiter.event); + kfree(waiter); } else { waiter->pid = current->l_proc->p_pid;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Tue Aug 6 07:57:49 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_shim.c Log Message: Make a comment match the code. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c:1.1 Fri Mar 8 12:32:31 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c Tue Aug 6 07:57:49 2013 @@ -248,7 +248,7 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive); * Name: vchi_bulk_queue_transmit * * Arguments: VCHI_BULK_HANDLE_T handle, - * const void *data_src, + * void *data_src, * uint32_t data_size, * VCHI_FLAGS_T flags, * void *bulk_handle
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sat Aug 3 13:23:10 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: Whitespace. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.3 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.4 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.3 Sun Apr 28 20:58:51 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sat Aug 3 13:23:10 2013 @@ -1064,7 +1064,7 @@ vchiq_open(dev_t dev, int flags, int mod lmutex_init(&instance->bulk_waiter_list_mutex); INIT_LIST_HEAD(&instance->bulk_waiter_list); - } + } else { vchiq_log_error(vchiq_arm_log_level, "Unknown minor device");
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sun Apr 28 20:58:52 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: Spello To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.2 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.3 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.2 Mon Mar 25 22:40:12 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sun Apr 28 20:58:51 2013 @@ -58,7 +58,7 @@ #define KEEPALIVE_VER 1 #define KEEPALIVE_VER_MIN KEEPALIVE_VER -MALLOC_DEFINE(M_VCHIQ, "vchiq_cdev", "VideoCore cdev memroy"); +MALLOC_DEFINE(M_VCHIQ, "vchiq_cdev", "VideoCore cdev memory"); /* Run time control of log level, based on KERN_XXX level. */ int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT;
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Sun Apr 28 20:57:26 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: G/C M_VCPAGELIST To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.8 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.9 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.8 Fri Apr 26 16:56:42 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Sun Apr 28 20:57:26 2013 @@ -43,8 +43,6 @@ #include #include -MALLOC_DEFINE(M_VCPAGELIST, "vcpagelist", "VideoCore pagelist memory"); - #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) #define VCHIQ_DOORBELL_IRQ IRQ_ARM_DOORBELL_0
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Fri Apr 26 16:56:42 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Actually handle any fragments in vchiq_complete_bulk To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.7 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.8 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.7 Thu Apr 25 04:45:33 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Fri Apr 26 16:56:42 2013 @@ -248,7 +248,7 @@ typedef struct bulkinfo_struct { bus_size_t pagelist_size; bus_dmamap_t pagelist_map; bus_dmamap_t dmamap; - struct vmspace *vmspace; + struct proc *proc; void *buf; int size; } BULKINFO_T; @@ -281,7 +281,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu bi->size = size; bi->pagelist_size = sizeof(PAGELIST_T) + (maxsegs * sizeof(unsigned long)); - bi->vmspace = curproc->p_vmspace; + bi->proc = curproc; ret = bus_dmamem_alloc(&bcm2835_bus_dma_tag, bi->pagelist_size, 0 /*CACHE_LINE_SIZE*/, 0, bi->pagelist_sgs, @@ -316,7 +316,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu * Need to wire the buffer pages in. */ if (IS_USER_ADDRESS(buf)) { - ret = uvm_vslock(curproc->p_vmspace, buf, size, uvmflags); + ret = uvm_vslock(bi->proc->p_vmspace, buf, size, uvmflags); if (ret != 0) { printf("%s: uvm_vslock failed (%d)\n", __func__, ret); goto fail5; @@ -368,6 +368,9 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu up(&g_free_fragments_mutex); pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + (fragments - g_fragments_base); + bus_dmamap_sync(&bcm2835_bus_dma_tag, dma_map, + (char *)fragments - g_slot_mem, sizeof(*fragments), + BUS_DMASYNC_PREREAD); } /* @@ -417,11 +420,68 @@ vchiq_complete_bulk(VCHIQ_BULK_T *bulk) { if (bulk && bulk->remote_data && bulk->actual) { BULKINFO_T *bi = bulk->remote_data; + PAGELIST_T *pagelist = bi->pagelist; + + /* Deal with any partial cache lines (fragments) */ + if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { + FRAGMENTS_T *fragments = g_fragments_base + +(pagelist->type - PAGELIST_READ_WITH_FRAGMENTS); + int head_bytes, tail_bytes; + int actual = bulk->actual; + + bus_dmamap_sync(&bcm2835_bus_dma_tag, dma_map, + (char *)fragments - g_slot_mem, sizeof(*fragments), + BUS_DMASYNC_POSTREAD); + + head_bytes = (arm_dcache_align - pagelist->offset) & +(arm_dcache_align - 1); + tail_bytes = (pagelist->offset + actual) & +(arm_dcache_align - 1); + + if ((actual >= 0) && (head_bytes != 0)) { +if (head_bytes > actual) + head_bytes = actual; + +if (IS_USER_ADDRESS(bi->buf)) { + copyout_proc(bi->proc, + fragments->headbuf, bi->buf, + head_bytes); +} else { + kcopy(fragments->headbuf, bi->buf, + head_bytes); +} + } + if ((actual >= 0) && (head_bytes < actual) && + (tail_bytes != 0)) { +void *t = (char *)bi->buf + bi->size - +tail_bytes; + + if (IS_USER_ADDRESS(bi->buf)) { + copyout_proc(bi->proc, + fragments->tailbuf, t, tail_bytes); +} else { + kcopy(fragments->tailbuf, t, + tail_bytes); +} + } + + down(&g_free_fragments_mutex); + *(FRAGMENTS_T **) fragments = g_free_fragments; + g_free_fragments = fragments; + up(&g_free_fragments_mutex); + up(&g_free_fragments_sema); + } + bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->pagelist_map, 0, + bi->pagelist_size, BUS_DMASYNC_POSTREAD); + + bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->dmamap, 0, bi->size, + pagelist->type == PAGELIST_WRITE ? + BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); bus_dmamap_unload(&bcm2835_bus_dma_tag, bi->dmamap); bus_dmamap_destroy(&bcm2835_bus_dma_tag, bi->dmamap); if (IS_USER_ADDRESS(bi->buf)) - uvm_vsunlock(bi->vmspace, bi->buf, bi->size); + uvm_vsunlock(bi->proc->p_vmspace, bi->buf, bi->size); bus_dmamap_unload(&bcm2835_bus_dma_tag, bi->pagelist_map); bus_dmamap_destroy(&bcm2835_bus_dma_tag, bi->pagelist_map);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Apr 25 04:45:33 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Style nit. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.6 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.7 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.6 Thu Apr 25 04:31:41 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Thu Apr 25 04:45:33 2013 @@ -379,7 +379,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->pagelist_map, 0, bi->pagelist_size, BUS_DMASYNC_PREREAD); - bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->dmamap, 0, size, + bus_dmamap_sync(&bcm2835_bus_dma_tag, bi->dmamap, 0, bi->size, pagelist->type == PAGELIST_WRITE ? BUS_DMASYNC_PREWRITE : BUS_DMASYNC_PREREAD);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Thu Apr 25 04:31:41 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.5 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.6 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.5 Mon Mar 25 22:01:49 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Thu Apr 25 04:31:41 2013 @@ -279,7 +279,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu bi->buf = buf; bi->size = size; - bi->pagelist_size = sizeof(PAGELIST_T) + + bi->pagelist_size = sizeof(PAGELIST_T) + (maxsegs * sizeof(unsigned long)); bi->vmspace = curproc->p_vmspace; @@ -322,10 +322,10 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu goto fail5; } } - + ret = bus_dmamap_create(&bcm2835_bus_dma_tag, size, maxsegs, size, 0, BUS_DMA_WAITOK, &bi->dmamap); - + if (ret != 0) goto fail6; @@ -369,7 +369,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + (fragments - g_fragments_base); } - + /* * Store the BULKINFO_T address in remote_data, which isn't used by the * slave. @@ -394,7 +394,7 @@ fail6: fail5: bus_dmamap_unload(&bcm2835_bus_dma_tag, bi->pagelist_map); - + fail4: bus_dmamap_destroy(&bcm2835_bus_dma_tag, bi->pagelist_map); @@ -404,7 +404,7 @@ fail3: fail2: bus_dmamem_free(&bcm2835_bus_dma_tag, bi->pagelist_sgs, __arraycount(bi->pagelist_sgs)); - + fail1: kmem_free(bi, sizeof(*bi));
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Wed Apr 3 20:21:38 UTC 2013 Removed Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_kmod_freebsd.c Log Message: Remove unnecessary freebsd code. To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_freebsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Mon Mar 25 22:59:25 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_kmod_netbsd.c Log Message: defer vchiq initialization with config_mountroot, works around a timing issue that caused problems during sdhc init on some boards To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c:1.1 Fri Mar 8 12:32:31 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kmod_netbsd.c Mon Mar 25 22:59:25 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vchiq_kmod_netbsd.c,v 1.1 2013/03/08 12:32:31 jmcneill Exp $ */ +/* $NetBSD: vchiq_kmod_netbsd.c,v 1.2 2013/03/25 22:59:25 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.1 2013/03/08 12:32:31 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vchiq_kmod_netbsd.c,v 1.2 2013/03/25 22:59:25 jmcneill Exp $"); #include #include @@ -104,10 +104,19 @@ vchiq_attach(device_t parent, device_t s return; } - vchiq_core_initialize(); - 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); + + vchiq_core_initialize(); + sc->sc_ih = bcm2835_intr_establish(sc->sc_intr, IPL_VM, vchiq_intr, sc); if (sc->sc_ih == NULL) { @@ -118,14 +127,6 @@ vchiq_attach(device_t parent, device_t s vchiq_init(); - config_mountroot(self, vchiq_defer); -} - -static void -vchiq_defer(device_t self) -{ - struct vchiq_attach_args vaa; - vaa.vaa_name = "AUDS"; config_found_ia(self, "vchiqbus", &vaa, vchiq_print); }
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Mon Mar 25 22:58:42 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: remove unnecessary newline and function name from log message that reports vchiq local and remote versions To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.2 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.3 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.2 Sun Mar 24 22:54:21 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Mon Mar 25 22:58:42 2013 @@ -2275,8 +2275,8 @@ vchiq_init_state(VCHIQ_STATE_T *state, V } vchiq_log_warning(vchiq_core_log_level, - "%s: local ver %d (min %d), remote ver %d\n", - __func__, VCHIQ_VERSION, VCHIQ_VERSION_MIN, + "local ver %d (min %d), remote ver %d.", + VCHIQ_VERSION, VCHIQ_VERSION_MIN, slot_zero->version); if (slot_zero->version < VCHIQ_VERSION_MIN) {
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Mon Mar 25 22:40:12 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c Log Message: hide some debug printfs under VCHIQ_IOCTL_DEBUG To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.1 Fri Mar 8 12:32:30 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Mon Mar 25 22:40:12 2013 @@ -520,7 +520,9 @@ vchiq_ioctl(struct file *fp, u_long cmd, } } +#ifdef VCHIQ_IOCTL_DEBUG printf("%s: [CREATE SERVICE] handle = %08x\n", __func__, service->handle); +#endif pargs->handle = service->handle; service = NULL; @@ -533,7 +535,9 @@ vchiq_ioctl(struct file *fp, u_long cmd, case VCHIQ_IOC_CLOSE_SERVICE: { VCHIQ_SERVICE_HANDLE_T handle = *(VCHIQ_SERVICE_HANDLE_T *)arg; +#ifdef VCHIQ_IOCTL_DEBUG printf("%s: [CLOSE SERVICE] handle = %08x\n", __func__, handle); +#endif service = find_service_for_instance(instance, handle); if (service != NULL) @@ -545,7 +549,9 @@ vchiq_ioctl(struct file *fp, u_long cmd, case VCHIQ_IOC_REMOVE_SERVICE: { VCHIQ_SERVICE_HANDLE_T handle = *(VCHIQ_SERVICE_HANDLE_T *)arg; +#ifdef VCHIQ_IOCTL_DEBUG printf("%s: [REMOVE SERVICE] handle = %08x\n", __func__, handle); +#endif service = find_service_for_instance(instance, handle); if (service != NULL) @@ -558,8 +564,10 @@ vchiq_ioctl(struct file *fp, u_long cmd, case VCHIQ_IOC_RELEASE_SERVICE: { VCHIQ_SERVICE_HANDLE_T handle = *(VCHIQ_SERVICE_HANDLE_T *)arg; +#ifdef VCHIQ_IOCTL_DEBUG printf("%s: [%s SERVICE] handle = %08x\n", __func__, cmd == VCHIQ_IOC_USE_SERVICE ? "USE" : "RELEASE", handle); +#endif service = find_service_for_instance(instance, handle); if (service != NULL) { @@ -587,7 +595,9 @@ vchiq_ioctl(struct file *fp, u_long cmd, case VCHIQ_IOC_QUEUE_MESSAGE: { VCHIQ_QUEUE_MESSAGE_T *pargs = arg; +#ifdef VCHIQ_IOCTL_DEBUG printf("%s: [QUEUE MESSAGE] handle = %08x\n", __func__, pargs->handle); +#endif service = find_service_for_instance(instance, pargs->handle);
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Mon Mar 25 22:01:50 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Remove vchiq_doorbell_irq. We have our own version in vchiq_intr. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.4 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.5 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.4 Mon Mar 25 21:58:24 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Mon Mar 25 22:01:49 2013 @@ -500,26 +500,6 @@ vchiq_platform_handle_timeout(VCHIQ_STAT * Local functions */ -#ifdef notyet -static irqreturn_t -vchiq_doorbell_irq(int irq, void *dev_id) -{ - VCHIQ_STATE_T *state = dev_id; - irqreturn_t ret = IRQ_NONE; - unsigned int status; - - /* Read (and clear) the doorbell */ - status = readl(__io_address(ARM_0_BELL0)); - - if (status & 0x4) { /* Was the doorbell rung? */ - remote_event_pollall(state); - ret = IRQ_HANDLED; - } - - return ret; -} -#endif - /* There is a potential problem with partial cache lines (pages?) ** at the ends of the block when reading. If the CPU accessed anything in ** the same line (page?) then it may have pulled old data into the cache,
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Mon Mar 25 21:58:24 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Wrap a long line To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.3 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.4 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.3 Mon Mar 25 21:58:00 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Mon Mar 25 21:58:24 2013 @@ -263,7 +263,8 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu int ret; vchiq_log_info(vchiq_arm_log_level, - "%s: buf %p size %08x dir %s\n", __func__, buf, size, dir == VCHIQ_BULK_RECEIVE ? "read" : "write"); + "%s: buf %p size %08x dir %s\n", __func__, buf, size, + dir == VCHIQ_BULK_RECEIVE ? "read" : "write"); vaddr_t va = (vaddr_t)buf; const size_t maxsegs = atop(round_page(va + size) - trunc_page(va));
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Mon Mar 25 21:58:00 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Remove a bogus KASSERT and improve a comment while I'm nearby. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.2 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.3 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.2 Mon Mar 25 21:55:11 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Mon Mar 25 21:58:00 2013 @@ -341,11 +341,9 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bu pagelist->offset = va & PAGE_MASK; /* - * busdma coalesce contiguous pages for us + * busdma already coalesces contiguous pages for us */ for (int i = 0; i < bi->dmamap->dm_nsegs; i++) { - KASSERT(bi->dmamap->dm_segs[i].ds_len / PAGE_SIZE < PAGE_SIZE); - pagelist->addrs[i] = bi->dmamap->dm_segs[i].ds_addr & ~PAGE_MASK; pagelist->addrs[i] |= atop(round_page(bi->dmamap->dm_segs[i].ds_len)) - 1; }
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: skrll Date: Mon Mar 25 21:55:12 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Revert commented out create_pagelist/free_pagelist to the original version and not the broken FreeBSD version. Should really be deleted someday soon. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.1 Fri Mar 8 12:32:30 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Mon Mar 25 21:55:11 2013 @@ -537,15 +537,15 @@ vchiq_doorbell_irq(int irq, void *dev_id #if 0 static int create_pagelist(char __user *buf, size_t count, unsigned short type, - lwp_t *l, PAGELIST_T ** ppagelist) + struct task_struct *task, PAGELIST_T ** ppagelist) { PAGELIST_T *pagelist; - paddr_t *pages; + struct page **pages; + struct page *page; unsigned long *addrs; unsigned int num_pages, offset, i; - int pagelist_size; char *addr, *base_addr, *next_addr; - int run, addridx, err; + int run, addridx, actual_pages; offset = (unsigned int)buf & (PAGE_SIZE - 1); num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE; @@ -555,10 +555,10 @@ create_pagelist(char __user *buf, size_t /* Allocate enough storage to hold the page pointers and the page ** list */ - pagelist_size = sizeof(PAGELIST_T) + + pagelist = kmalloc(sizeof(PAGELIST_T) + (num_pages * sizeof(unsigned long)) + - (num_pages * sizeof(paddr_t)); - pagelist = malloc(pagelist_size, M_VCPAGELIST, M_WAITOK | M_ZERO); + (num_pages * sizeof(pages[0])), + GFP_KERNEL); vchiq_log_trace(vchiq_arm_log_level, "create_pagelist - %x", (unsigned int)pagelist); @@ -566,28 +566,27 @@ create_pagelist(char __user *buf, size_t return -ENOMEM; addrs = pagelist->addrs; - pages = (paddr_t *)(addrs + num_pages); + pages = (struct page **)(addrs + num_pages); - err = uvm_map_pageable(&l->l_proc->p_vmspace->vm_map, - (vaddr_t)buf, (vaddr_t)buf + count, false, 0); - if (err == 0) { - err = uvm_map_protect(&l->l_proc->p_vmspace->vm_map, - (vaddr_t)buf, (vaddr_t)buf + count, - (type == PAGELIST_READ ? VM_PROT_WRITE : 0) | VM_PROT_READ, - false); - } - if (err == 0) { - for (i = 0; i < num_pages; i++) { - pmap_extract(vm_map_pmap(&l->l_proc->p_vmspace->vm_map), - (vaddr_t)buf + (i * PAGE_SIZE), &pages[i]); - } - } - - if (err != 0) { - uvm_map_pageable(&l->l_proc->p_vmspace->vm_map, - (vaddr_t)buf, (vaddr_t)buf + count, true, 0); - free(pagelist, M_VCPAGELIST); - return (-ENOMEM); + down_read(&task->mm->mmap_sem); + actual_pages = get_user_pages(task, task->mm, + (unsigned long)buf & ~(PAGE_SIZE - 1), num_pages, + (type == PAGELIST_READ) /*Write */ , 0 /*Force */ , + pages, NULL /*vmas */); + up_read(&task->mm->mmap_sem); + + if (actual_pages != num_pages) + { + /* This is probably due to the process being killed */ + while (actual_pages > 0) + { + actual_pages--; + page_cache_release(pages[actual_pages]); + } + kfree(pagelist); + if (actual_pages == 0) + actual_pages = -ENOMEM; + return actual_pages; } pagelist->length = count; @@ -596,13 +595,13 @@ create_pagelist(char __user *buf, size_t /* Group the pages into runs of contiguous pages */ - base_addr = (void *)PHYS_TO_VCBUS(pages[0]); + base_addr = VCHIQ_ARM_ADDRESS(page_address(pages[0])); next_addr = base_addr + PAGE_SIZE; addridx = 0; run = 0; for (i = 1; i < num_pages; i++) { - addr = (void *)PHYS_TO_VCBUS(pages[i]); + addr = VCHIQ_ARM_ADDRESS(page_address(pages[i])); if ((addr == next_addr) && (run < (PAGE_SIZE - 1))) { next_addr += PAGE_SIZE; run++; @@ -626,7 +625,7 @@ create_pagelist(char __user *buf, size_t FRAGMENTS_T *fragments; if (down_interruptible(&g_free_fragments_sema) != 0) { - free(pagelist, M_VCPAGELIST); + kfree(pagelist); return -EINTR; } @@ -642,7 +641,11 @@ create_pagelist(char __user *buf, size_t g_fragments_base); } - cpu_dcache_wbinv_range((vm_offset_t)pagelist, pagelist_size); + for (page = virt_to_page(pagelist); + page <= virt_to_page(addrs + num_pages - 1); page++) { + flush_dcache_page(page); + } + *ppagelist = pagelist; return 0; @@ -651,9 +654,8 @@ create_pagelist(char __user *buf, size_t static void free_pagelist(PAGELIST_T *pagelist, int actual) { - paddr_t *pages; - unsigned int num_pages; - void *page_address; + struct page **pages; + unsigned int num_page
CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: jmcneill Date: Sun Mar 24 22:54:22 UTC 2013 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_core.c Log Message: print the local and remote vchiq versions To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.1 Fri Mar 8 12:32:31 2013 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Sun Mar 24 22:54:21 2013 @@ -2263,10 +2263,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, V static int id; int i; - vchiq_log_warning(vchiq_core_log_level, - "%s: slot_zero = 0x%08lx, is_master = %d", - __func__, (unsigned long)slot_zero, is_master); - /* Check the input configuration */ if (slot_zero->magic != VCHIQ_MAGIC) { @@ -2278,6 +2274,11 @@ vchiq_init_state(VCHIQ_STATE_T *state, V return VCHIQ_ERROR; } + vchiq_log_warning(vchiq_core_log_level, + "%s: local ver %d (min %d), remote ver %d\n", + __func__, VCHIQ_VERSION, VCHIQ_VERSION_MIN, + slot_zero->version); + if (slot_zero->version < VCHIQ_VERSION_MIN) { vchiq_loud_error_header(); vchiq_loud_error("Incompatible VCHIQ versions found.");