PERFORCE change 1205654 for review
John-Mark Gurney
jmg at FreeBSD.org
Tue Feb 3 00:22:01 UTC 2015
http://p4web.freebsd.org/@@1205654?ac=10
Change 1205654 by jmg at jmg_pciehp on 2015/02/03 00:21:58
IFC @ 1205652
Sponsored by: FreeBSD Foundation
Affected files ...
.. //depot/projects/pciehotplug/sys/amd64/amd64/machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/amd64/ia32/ia32_signal.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/allwinner/a10_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/altera/socfpga/socfpga_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/arm/busdma_machdep-v6.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/arm/intr.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/arm/machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/broadcom/bcm2835/bcm2835_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/freescale/imx/imx_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/freescale/vybrid/vf_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/include/pmc_mdep.h#2 integrate
.. //depot/projects/pciehotplug/sys/arm/include/profile.h#2 integrate
.. //depot/projects/pciehotplug/sys/arm/lpc/lpc_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/rockchip/rk30xx_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/samsung/exynos/exynos5_pad.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/ti/am335x/am335x_prcm.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/ti/files.ti#2 integrate
.. //depot/projects/pciehotplug/sys/arm/ti/ti_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/ti/ti_gpio.h#2 integrate
.. //depot/projects/pciehotplug/sys/arm/ti/ti_pruss.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/xilinx/zy7_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/xscale/ixp425/avila_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/arm/xscale/ixp425/cambria_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/common/load_elf.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/efi/libefi/efinet.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/fdt/fdt_loader_cmd.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/i386/libi386/libi386.h#2 integrate
.. //depot/projects/pciehotplug/sys/boot/i386/libi386/smbios.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/conf.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/host_syscall.S#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/host_syscall.h#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/hostdisk.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/kbootfdt.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/kerneltramp.S#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/main.c#2 integrate
.. //depot/projects/pciehotplug/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c#2 integrate
.. //depot/projects/pciehotplug/sys/cam/cam.h#2 integrate
.. //depot/projects/pciehotplug/sys/cam/cam_periph.c#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl.c#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl_frontend.c#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl_frontend.h#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl_frontend_iscsi.c#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl_frontend_iscsi.h#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl_ioctl.h#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl_private.h#2 integrate
.. //depot/projects/pciehotplug/sys/cam/ctl/ctl_tpc_local.c#2 integrate
.. //depot/projects/pciehotplug/sys/cam/scsi/scsi_all.h#2 integrate
.. //depot/projects/pciehotplug/sys/cam/scsi/scsi_cd.c#2 integrate
.. //depot/projects/pciehotplug/sys/cam/scsi/scsi_da.c#2 integrate
.. //depot/projects/pciehotplug/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c#2 integrate
.. //depot/projects/pciehotplug/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c#2 integrate
.. //depot/projects/pciehotplug/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c#2 integrate
.. //depot/projects/pciehotplug/sys/conf/Makefile.powerpc#2 integrate
.. //depot/projects/pciehotplug/sys/conf/files#3 integrate
.. //depot/projects/pciehotplug/sys/conf/files.amd64#2 integrate
.. //depot/projects/pciehotplug/sys/conf/files.arm#2 integrate
.. //depot/projects/pciehotplug/sys/conf/kern.mk#2 integrate
.. //depot/projects/pciehotplug/sys/conf/options#2 integrate
.. //depot/projects/pciehotplug/sys/dev/acpica/acpi.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/ahci/ahci.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/ahci/ahci_pci.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/alc/if_alc.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/ath/ath_hal/ah_internal.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/ath/ath_rate/sample/sample.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/ath/ath_rate/sample/sample.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/drm2/i915/intel_display.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/drm2/radeon/ni.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/drm2/radeon/si.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/fb/fbd.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/fdt/fdt_clock.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/gpio/gpio_if.m#2 integrate
.. //depot/projects/pciehotplug/sys/dev/gpio/gpiobus.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/gpio/gpiobusvar.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/gpio/ofw_gpiobus.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/hwpmc/hwpmc_arm.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/hwpmc/hwpmc_armv7.c#1 branch
.. //depot/projects/pciehotplug/sys/dev/hwpmc/hwpmc_armv7.h#1 branch
.. //depot/projects/pciehotplug/sys/dev/hwpmc/pmc_events.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/iscsi/icl.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/iscsi/icl.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/iscsi/icl_conn_if.m#1 branch
.. //depot/projects/pciehotplug/sys/dev/iscsi/icl_soft.c#1 branch
.. //depot/projects/pciehotplug/sys/dev/iscsi/icl_wrappers.h#1 branch
.. //depot/projects/pciehotplug/sys/dev/iscsi/iscsi.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/iscsi/iscsi_proto.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/ofw/openfirm.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/common/efsys.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/common/efx_ev.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/common/efx_tx.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge_dma.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge_ev.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge_intr.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge_port.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge_tx.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/sfxge/sfxge_tx.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/syscons/syscons.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/usb/controller/xhci.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/usb/input/uhid.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/usb/usb_core.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/usb/usb_msctest.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/usb/usb_transfer.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/virtio/block/virtio_blk.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/vt/hw/fb/vt_fb.c#2 integrate
.. //depot/projects/pciehotplug/sys/dev/vt/hw/fb/vt_fb.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/vt/vt.h#2 integrate
.. //depot/projects/pciehotplug/sys/dev/vt/vt_core.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/cd9660/cd9660_util.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/fdescfs/fdesc_vfsops.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/msdosfs/msdosfs_conv.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/smbfs/smbfs_subr.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/tmpfs/tmpfs.h#2 integrate
.. //depot/projects/pciehotplug/sys/fs/tmpfs/tmpfs_subr.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/tmpfs/tmpfs_vfsops.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/tmpfs/tmpfs_vnops.c#2 integrate
.. //depot/projects/pciehotplug/sys/fs/udf/udf_vnops.c#2 integrate
.. //depot/projects/pciehotplug/sys/i386/i386/machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/kern/kern_jail.c#2 integrate
.. //depot/projects/pciehotplug/sys/kern/kern_umtx.c#2 integrate
.. //depot/projects/pciehotplug/sys/libkern/strtol.c#2 integrate
.. //depot/projects/pciehotplug/sys/libkern/strtoq.c#2 integrate
.. //depot/projects/pciehotplug/sys/libkern/strtoul.c#2 integrate
.. //depot/projects/pciehotplug/sys/libkern/strtouq.c#2 integrate
.. //depot/projects/pciehotplug/sys/mips/atheros/ar71xx_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/mips/atheros/ar71xx_gpiovar.h#2 integrate
.. //depot/projects/pciehotplug/sys/mips/atheros/if_argevar.h#2 integrate
.. //depot/projects/pciehotplug/sys/mips/cavium/octeon_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/mips/cavium/octeon_gpiovar.h#2 integrate
.. //depot/projects/pciehotplug/sys/mips/mips/freebsd32_machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/mips/mips/pm_machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/mips/rt305x/rt305x_gpio.c#2 integrate
.. //depot/projects/pciehotplug/sys/mips/rt305x/rt305x_gpiovar.h#2 integrate
.. //depot/projects/pciehotplug/sys/modules/aesni/Makefile#2 integrate
.. //depot/projects/pciehotplug/sys/modules/ctl/Makefile#2 integrate
.. //depot/projects/pciehotplug/sys/modules/iscsi/Makefile#2 integrate
.. //depot/projects/pciehotplug/sys/netgraph/ng_parse.c#2 integrate
.. //depot/projects/pciehotplug/sys/netinet/ip_output.c#2 integrate
.. //depot/projects/pciehotplug/sys/netinet/sctp_input.c#2 integrate
.. //depot/projects/pciehotplug/sys/netinet/sctp_usrreq.c#2 integrate
.. //depot/projects/pciehotplug/sys/netinet/tcp_syncache.c#2 integrate
.. //depot/projects/pciehotplug/sys/netipsec/key.c#2 integrate
.. //depot/projects/pciehotplug/sys/ofed/include/linux/linux_idr.c#2 integrate
.. //depot/projects/pciehotplug/sys/powerpc/ofw/ofw_machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/powerpc/powerpc/exec_machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/powerpc/pseries/plpar_iommu.c#2 integrate
.. //depot/projects/pciehotplug/sys/rpc/svc_vc.c#2 integrate
.. //depot/projects/pciehotplug/sys/sparc64/sparc64/machdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/sys/cdefs.h#2 integrate
.. //depot/projects/pciehotplug/sys/sys/conf.h#2 integrate
.. //depot/projects/pciehotplug/sys/sys/eventhandler.h#2 integrate
.. //depot/projects/pciehotplug/sys/sys/jail.h#2 integrate
.. //depot/projects/pciehotplug/sys/sys/param.h#2 integrate
.. //depot/projects/pciehotplug/sys/sys/pmc.h#2 integrate
.. //depot/projects/pciehotplug/sys/sys/proc.h#2 integrate
.. //depot/projects/pciehotplug/sys/sys/ucontext.h#2 integrate
.. //depot/projects/pciehotplug/sys/ufs/ffs/ffs_softdep.c#2 integrate
.. //depot/projects/pciehotplug/sys/ufs/ffs/softdep.h#2 integrate
.. //depot/projects/pciehotplug/sys/ufs/ufs/ufs_quota.c#2 integrate
.. //depot/projects/pciehotplug/sys/ufs/ufs/ufs_vfsops.c#2 integrate
.. //depot/projects/pciehotplug/sys/vm/vm_fault.c#2 integrate
.. //depot/projects/pciehotplug/sys/vm/vm_object.c#2 integrate
.. //depot/projects/pciehotplug/sys/vm/vm_object.h#2 integrate
.. //depot/projects/pciehotplug/sys/x86/x86/tsc.c#2 integrate
Differences ...
==== //depot/projects/pciehotplug/sys/amd64/amd64/machdep.c#2 (text+ko) ====
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/amd64/machdep.c 277735 2015-01-26 08:42:47Z royger $");
+__FBSDID("$FreeBSD: head/sys/amd64/amd64/machdep.c 278001 2015-01-31 21:43:46Z kib $");
#include "opt_atpic.h"
#include "opt_compat.h"
@@ -157,7 +157,7 @@
static void cpu_startup(void *);
static void get_fpcontext(struct thread *td, mcontext_t *mcp,
char *xfpusave, size_t xfpusave_len);
-static int set_fpcontext(struct thread *td, const mcontext_t *mcp,
+static int set_fpcontext(struct thread *td, mcontext_t *mcp,
char *xfpustate, size_t xfpustate_len);
SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
@@ -2480,7 +2480,7 @@
* touch the cs selector.
*/
int
-set_mcontext(struct thread *td, const mcontext_t *mcp)
+set_mcontext(struct thread *td, mcontext_t *mcp)
{
struct pcb *pcb;
struct trapframe *tp;
@@ -2567,7 +2567,7 @@
}
static int
-set_fpcontext(struct thread *td, const mcontext_t *mcp, char *xfpustate,
+set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate,
size_t xfpustate_len)
{
struct savefpu *fpstate;
==== //depot/projects/pciehotplug/sys/amd64/ia32/ia32_signal.c#2 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/ia32/ia32_signal.c 258135 2013-11-14 15:37:20Z emaste $");
+__FBSDID("$FreeBSD: head/sys/amd64/ia32/ia32_signal.c 278001 2015-01-31 21:43:46Z kib $");
#include "opt_compat.h"
@@ -118,7 +118,7 @@
}
static int
-ia32_set_fpcontext(struct thread *td, const struct ia32_mcontext *mcp,
+ia32_set_fpcontext(struct thread *td, struct ia32_mcontext *mcp,
char *xfpustate, size_t xfpustate_len)
{
int error;
@@ -197,7 +197,7 @@
* touch the cs selector.
*/
static int
-ia32_set_mcontext(struct thread *td, const struct ia32_mcontext *mcp)
+ia32_set_mcontext(struct thread *td, struct ia32_mcontext *mcp)
{
struct trapframe *tp;
char *xfpustate;
==== //depot/projects/pciehotplug/sys/arm/allwinner/a10_gpio.c#2 (text+ko) ====
@@ -27,7 +27,7 @@
*
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/allwinner/a10_gpio.c 274670 2014-11-18 17:22:08Z loos $");
+__FBSDID("$FreeBSD: head/sys/arm/allwinner/a10_gpio.c 277996 2015-01-31 19:32:14Z loos $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -48,6 +48,7 @@
#include <machine/intr.h>
#include <dev/fdt/fdt_common.h>
+#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -75,6 +76,7 @@
struct a10_gpio_softc {
device_t sc_dev;
+ device_t sc_busdev;
struct mtx sc_mtx;
struct resource * sc_mem_res;
struct resource * sc_irq_res;
@@ -217,6 +219,16 @@
A10_GPIO_UNLOCK(sc);
}
+static device_t
+a10_gpio_get_bus(device_t dev)
+{
+ struct a10_gpio_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ return (sc->sc_busdev);
+}
+
static int
a10_gpio_pin_max(device_t dev, int *maxpin)
{
@@ -427,7 +439,7 @@
RF_ACTIVE);
if (!sc->sc_mem_res) {
device_printf(dev, "cannot allocate memory window\n");
- return (ENXIO);
+ goto fail;
}
sc->sc_bst = rman_get_bustag(sc->sc_mem_res);
@@ -437,9 +449,8 @@
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_ACTIVE);
if (!sc->sc_irq_res) {
- bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
device_printf(dev, "cannot allocate interrupt\n");
- return (ENXIO);
+ goto fail;
}
/* Find our node. */
@@ -459,19 +470,20 @@
sc->sc_gpio_pins[i].gp_flags = a10_gpio_func_flag(func);
}
sc->sc_gpio_npins = i;
-
- device_add_child(dev, "gpioc", -1);
- device_add_child(dev, "gpiobus", -1);
-
a10_gpio_sc = sc;
+ sc->sc_busdev = gpiobus_attach_bus(dev);
+ if (sc->sc_busdev == NULL)
+ goto fail;
- return (bus_generic_attach(dev));
+ return (0);
fail:
if (sc->sc_irq_res)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
if (sc->sc_mem_res)
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
+ mtx_destroy(&sc->sc_mtx);
+
return (ENXIO);
}
@@ -489,6 +501,7 @@
DEVMETHOD(device_detach, a10_gpio_detach),
/* GPIO protocol */
+ DEVMETHOD(gpio_get_bus, a10_gpio_get_bus),
DEVMETHOD(gpio_pin_max, a10_gpio_pin_max),
DEVMETHOD(gpio_pin_getname, a10_gpio_pin_getname),
DEVMETHOD(gpio_pin_getflags, a10_gpio_pin_getflags),
==== //depot/projects/pciehotplug/sys/arm/altera/socfpga/socfpga_gpio.c#2 (text+ko) ====
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/altera/socfpga/socfpga_gpio.c 276533 2015-01-02 13:15:36Z br $");
+__FBSDID("$FreeBSD: head/sys/arm/altera/socfpga/socfpga_gpio.c 277996 2015-01-31 19:32:14Z loos $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,6 +55,7 @@
#include <sys/gpio.h>
#include <dev/fdt/fdt_common.h>
+#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -107,6 +108,7 @@
/*
* GPIO interface
*/
+static device_t socfpga_gpio_get_bus(device_t);
static int socfpga_gpio_pin_max(device_t, int *);
static int socfpga_gpio_pin_getcaps(device_t, uint32_t, uint32_t *);
static int socfpga_gpio_pin_getname(device_t, uint32_t, char *);
@@ -122,6 +124,7 @@
bus_space_handle_t bsh;
device_t dev;
+ device_t busdev;
struct mtx sc_mtx;
int gpio_npins;
struct gpio_pin gpio_pins[NR_GPIO_MAX];
@@ -163,6 +166,7 @@
if (bus_alloc_resources(dev, socfpga_gpio_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
+ mtx_destroy(&sc->sc_mtx);
return (ENXIO);
}
@@ -195,11 +199,24 @@
snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME,
"socfpga_gpio%d.%d", device_get_unit(dev), i);
}
+ sc->busdev = gpiobus_attach_bus(dev);
+ if (sc->busdev == NULL) {
+ bus_release_resources(dev, socfpga_gpio_spec, sc->res);
+ mtx_destroy(&sc->sc_mtx);
+ return (ENXIO);
+ }
+
+ return (0);
+}
+
+static device_t
+socfpga_gpio_get_bus(device_t dev)
+{
+ struct socfpga_gpio_softc *sc;
- device_add_child(dev, "gpioc", -1);
- device_add_child(dev, "gpiobus", -1);
+ sc = device_get_softc(dev);
- return (bus_generic_attach(dev));
+ return (sc->busdev);
}
static int
@@ -414,6 +431,7 @@
DEVMETHOD(device_attach, socfpga_gpio_attach),
/* GPIO protocol */
+ DEVMETHOD(gpio_get_bus, socfpga_gpio_get_bus),
DEVMETHOD(gpio_pin_max, socfpga_gpio_pin_max),
DEVMETHOD(gpio_pin_getname, socfpga_gpio_pin_getname),
DEVMETHOD(gpio_pin_getcaps, socfpga_gpio_pin_getcaps),
==== //depot/projects/pciehotplug/sys/arm/arm/busdma_machdep-v6.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/arm/busdma_machdep-v6.c 274839 2014-11-22 03:03:11Z ian $");
+__FBSDID("$FreeBSD: head/sys/arm/arm/busdma_machdep-v6.c 278031 2015-02-01 17:19:57Z ian $");
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
@@ -858,8 +858,6 @@
else
ba = standard_allocator;
- /* Be careful not to access map from here on. */
-
bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize);
if (bufzone != NULL && dmat->alignment <= bufzone->size &&
==== //depot/projects/pciehotplug/sys/arm/arm/intr.c#2 (text+ko) ====
@@ -37,9 +37,10 @@
*/
#include "opt_platform.h"
+#include "opt_hwpmc_hooks.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/arm/intr.c 276032 2014-12-21 21:27:12Z andrew $");
+__FBSDID("$FreeBSD: head/sys/arm/arm/intr.c 277835 2015-01-28 16:08:07Z br $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,6 +51,8 @@
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/conf.h>
+#include <sys/pmc.h>
+#include <sys/pmckern.h>
#include <machine/atomic.h>
#include <machine/intr.h>
@@ -190,6 +193,10 @@
arm_mask_irq(i);
}
}
+#ifdef HWPMC_HOOKS
+ if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+ pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, frame);
+#endif
}
/*
==== //depot/projects/pciehotplug/sys/arm/arm/machdep.c#2 (text+ko) ====
@@ -49,7 +49,7 @@
#include "opt_timer.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/arm/machdep.c 276333 2014-12-28 18:12:56Z ian $");
+__FBSDID("$FreeBSD: head/sys/arm/arm/machdep.c 278001 2015-01-31 21:43:46Z kib $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -700,7 +700,7 @@
* touch the cs selector.
*/
int
-set_mcontext(struct thread *td, const mcontext_t *mcp)
+set_mcontext(struct thread *td, mcontext_t *mcp)
{
struct trapframe *tf = td->td_frame;
const __greg_t *gr = mcp->__gregs;
==== //depot/projects/pciehotplug/sys/arm/broadcom/bcm2835/bcm2835_gpio.c#2 (text+ko) ====
@@ -26,7 +26,7 @@
*
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 274670 2014-11-18 17:22:08Z loos $");
+__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 277996 2015-01-31 19:32:14Z loos $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -48,6 +48,7 @@
#include <machine/intr.h>
#include <dev/fdt/fdt_common.h>
+#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -62,10 +63,20 @@
#define dprintf(fmt, args...)
#endif
+#define BCM_GPIO_IRQS 4
#define BCM_GPIO_PINS 54
#define BCM_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \
GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
+static struct resource_spec bcm_gpio_res_spec[] = {
+ { SYS_RES_MEMORY, 0, RF_ACTIVE },
+ { SYS_RES_IRQ, 0, RF_ACTIVE },
+ { SYS_RES_IRQ, 1, RF_ACTIVE },
+ { SYS_RES_IRQ, 2, RF_ACTIVE },
+ { SYS_RES_IRQ, 3, RF_ACTIVE },
+ { -1, 0, 0 }
+};
+
struct bcm_gpio_sysctl {
struct bcm_gpio_softc *sc;
uint32_t pin;
@@ -73,9 +84,9 @@
struct bcm_gpio_softc {
device_t sc_dev;
+ device_t sc_busdev;
struct mtx sc_mtx;
- struct resource * sc_mem_res;
- struct resource * sc_irq_res;
+ struct resource * sc_res[BCM_GPIO_IRQS + 1];
bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh;
void * sc_intrhand;
@@ -308,6 +319,16 @@
BCM_GPIO_UNLOCK(sc);
}
+static device_t
+bcm_gpio_get_bus(device_t dev)
+{
+ struct bcm_gpio_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ return (sc->sc_busdev);
+}
+
static int
bcm_gpio_pin_max(device_t dev, int *maxpin)
{
@@ -494,39 +515,6 @@
}
static int
-bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc)
-{
- int i, len;
- pcell_t pins[BCM_GPIO_PINS];
- phandle_t gpio;
-
- /* Find the gpio node to start. */
- gpio = ofw_bus_get_node(sc->sc_dev);
-
- len = OF_getproplen(gpio, "broadcom,read-only");
- if (len < 0 || len > sizeof(pins))
- return (-1);
-
- if (OF_getprop(gpio, "broadcom,read-only", &pins, len) < 0)
- return (-1);
-
- sc->sc_ro_npins = len / sizeof(pcell_t);
-
- device_printf(sc->sc_dev, "read-only pins: ");
- for (i = 0; i < sc->sc_ro_npins; i++) {
- sc->sc_ro_pins[i] = fdt32_to_cpu(pins[i]);
- if (i > 0)
- printf(",");
- printf("%d", sc->sc_ro_pins[i]);
- }
- if (i > 0)
- printf(".");
- printf("\n");
-
- return (0);
-}
-
-static int
bcm_gpio_func_proc(SYSCTL_HANDLER_ARGS)
{
char buf[16];
@@ -545,7 +533,9 @@
error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
if (error != 0 || req->newptr == NULL)
return (error);
-
+ /* Ignore changes on read-only pins. */
+ if (bcm_gpio_pin_is_ro(sc, sc_sysctl->pin))
+ return (0);
/* Parse the user supplied string and check for a valid pin function. */
if (bcm_gpio_str_func(buf, &nfunc) != 0)
return (EINVAL);
@@ -595,63 +585,82 @@
}
static int
+bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc, phandle_t node,
+ const char *propname, const char *label)
+{
+ int i, need_comma, npins, range_start, range_stop;
+ pcell_t *pins;
+
+ /* Get the property data. */
+ npins = OF_getencprop_alloc(node, propname, sizeof(*pins),
+ (void **)&pins);
+ if (npins < 0)
+ return (-1);
+ if (npins == 0) {
+ free(pins, M_OFWPROP);
+ return (0);
+ }
+ for (i = 0; i < npins; i++)
+ sc->sc_ro_pins[i + sc->sc_ro_npins] = pins[i];
+ sc->sc_ro_npins += npins;
+ need_comma = 0;
+ device_printf(sc->sc_dev, "%s pins: ", label);
+ range_start = range_stop = pins[0];
+ for (i = 1; i < npins; i++) {
+ if (pins[i] != range_stop + 1) {
+ if (need_comma)
+ printf(",");
+ if (range_start != range_stop)
+ printf("%d-%d", range_start, range_stop);
+ else
+ printf("%d", range_start);
+ range_start = range_stop = pins[i];
+ need_comma = 1;
+ } else
+ range_stop++;
+ }
+ if (need_comma)
+ printf(",");
+ if (range_start != range_stop)
+ printf("%d-%d.\n", range_start, range_stop);
+ else
+ printf("%d.\n", range_start);
+ free(pins, M_OFWPROP);
+
+ return (0);
+}
+
+static int
bcm_gpio_get_reserved_pins(struct bcm_gpio_softc *sc)
{
- int i, j, len, npins;
- pcell_t pins[BCM_GPIO_PINS];
+ char *name;
phandle_t gpio, node, reserved;
- char name[32];
+ ssize_t len;
/* Get read-only pins. */
- if (bcm_gpio_get_ro_pins(sc) != 0)
+ gpio = ofw_bus_get_node(sc->sc_dev);
+ if (bcm_gpio_get_ro_pins(sc, gpio, "broadcom,read-only",
+ "read-only") != 0)
return (-1);
-
- /* Find the gpio/reserved pins node to start. */
- gpio = ofw_bus_get_node(sc->sc_dev);
+ /* Traverse the GPIO subnodes to find the reserved pins node. */
+ reserved = 0;
node = OF_child(gpio);
-
- /*
- * Find reserved node
- */
- reserved = 0;
while ((node != 0) && (reserved == 0)) {
- len = OF_getprop(node, "name", name,
- sizeof(name) - 1);
- name[len] = 0;
+ len = OF_getprop_alloc(node, "name", 1, (void **)&name);
+ if (len == -1)
+ return (-1);
if (strcmp(name, "reserved") == 0)
reserved = node;
+ free(name, M_OFWPROP);
node = OF_peer(node);
}
-
if (reserved == 0)
return (-1);
-
/* Get the reserved pins. */
- len = OF_getproplen(reserved, "broadcom,pins");
- if (len < 0 || len > sizeof(pins))
- return (-1);
-
- if (OF_getprop(reserved, "broadcom,pins", &pins, len) < 0)
+ if (bcm_gpio_get_ro_pins(sc, reserved, "broadcom,pins",
+ "reserved") != 0)
return (-1);
- npins = len / sizeof(pcell_t);
-
- j = 0;
- device_printf(sc->sc_dev, "reserved pins: ");
- for (i = 0; i < npins; i++) {
- if (i > 0)
- printf(",");
- printf("%d", fdt32_to_cpu(pins[i]));
- /* Some pins maybe already on the list of read-only pins. */
- if (bcm_gpio_pin_is_ro(sc, fdt32_to_cpu(pins[i])))
- continue;
- sc->sc_ro_pins[j++ + sc->sc_ro_npins] = fdt32_to_cpu(pins[i]);
- }
- sc->sc_ro_npins += j;
- if (i > 0)
- printf(".");
- printf("\n");
-
return (0);
}
@@ -672,35 +681,21 @@
static int
bcm_gpio_attach(device_t dev)
{
- struct bcm_gpio_softc *sc = device_get_softc(dev);
+ int i, j;
+ phandle_t gpio;
+ struct bcm_gpio_softc *sc;
uint32_t func;
- int i, j, rid;
- phandle_t gpio;
+ sc = device_get_softc(dev);
sc->sc_dev = dev;
-
mtx_init(&sc->sc_mtx, "bcm gpio", "gpio", MTX_DEF);
-
- rid = 0;
- sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
- RF_ACTIVE);
- if (!sc->sc_mem_res) {
- device_printf(dev, "cannot allocate memory window\n");
- return (ENXIO);
+ if (bus_alloc_resources(dev, bcm_gpio_res_spec, sc->sc_res) != 0) {
+ device_printf(dev, "cannot allocate resources\n");
+ goto fail;
}
-
- sc->sc_bst = rman_get_bustag(sc->sc_mem_res);
- sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res);
+ sc->sc_bst = rman_get_bustag(sc->sc_res[0]);
+ sc->sc_bsh = rman_get_bushandle(sc->sc_res[0]);
- rid = 0;
- sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_ACTIVE);
- if (!sc->sc_irq_res) {
- bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
- device_printf(dev, "cannot allocate interrupt\n");
- return (ENXIO);
- }
-
/* Find our node. */
gpio = ofw_bus_get_node(sc->sc_dev);
@@ -717,8 +712,6 @@
/* Initialize the software controlled pins. */
for (i = 0, j = 0; j < BCM_GPIO_PINS; j++) {
- if (bcm_gpio_pin_is_ro(sc, j))
- continue;
snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME,
"pin %d", j);
func = bcm_gpio_get_function(sc, j);
@@ -728,19 +721,17 @@
i++;
}
sc->sc_gpio_npins = i;
-
bcm_gpio_sysctl_init(sc);
+ sc->sc_busdev = gpiobus_attach_bus(dev);
+ if (sc->sc_busdev == NULL)
+ goto fail;
- device_add_child(dev, "gpioc", -1);
- device_add_child(dev, "gpiobus", -1);
+ return (0);
- return (bus_generic_attach(dev));
+fail:
+ bus_release_resources(dev, bcm_gpio_res_spec, sc->sc_res);
+ mtx_destroy(&sc->sc_mtx);
-fail:
- if (sc->sc_irq_res)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
- if (sc->sc_mem_res)
- bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
return (ENXIO);
}
@@ -766,6 +757,7 @@
DEVMETHOD(device_detach, bcm_gpio_detach),
/* GPIO protocol */
+ DEVMETHOD(gpio_get_bus, bcm_gpio_get_bus),
DEVMETHOD(gpio_pin_max, bcm_gpio_pin_max),
DEVMETHOD(gpio_pin_getname, bcm_gpio_pin_getname),
DEVMETHOD(gpio_pin_getflags, bcm_gpio_pin_getflags),
==== //depot/projects/pciehotplug/sys/arm/freescale/imx/imx_gpio.c#2 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/freescale/imx/imx_gpio.c 274670 2014-11-18 17:22:08Z loos $");
+__FBSDID("$FreeBSD: head/sys/arm/freescale/imx/imx_gpio.c 277996 2015-01-31 19:32:14Z loos $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,6 +49,7 @@
#include <machine/resource.h>
#include <dev/fdt/fdt_common.h>
+#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -92,6 +93,7 @@
struct imx51_gpio_softc {
device_t dev;
+ device_t sc_busdev;
struct mtx sc_mtx;
struct resource *sc_res[11]; /* 1 x mem, 2 x IRQ, 8 x IRQ */
void *gpio_ih[11]; /* 1 ptr is not a big waste */
@@ -145,6 +147,7 @@
/*
* GPIO interface
*/
+static device_t imx51_gpio_get_bus(device_t);
static int imx51_gpio_pin_max(device_t, int *);
static int imx51_gpio_pin_getcaps(device_t, uint32_t, uint32_t *);
static int imx51_gpio_pin_getflags(device_t, uint32_t, uint32_t *);
@@ -179,6 +182,16 @@
GPIO_UNLOCK(sc);
}
+static device_t
+imx51_gpio_get_bus(device_t dev)
+{
+ struct imx51_gpio_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ return (sc->sc_busdev);
+}
+
static int
imx51_gpio_pin_max(device_t dev, int *maxpin)
{
@@ -389,6 +402,8 @@
if (bus_alloc_resources(dev, imx_gpio_spec, sc->sc_res)) {
device_printf(dev, "could not allocate resources\n");
+ bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
+ mtx_destroy(&sc->sc_mtx);
return (ENXIO);
}
@@ -411,6 +426,7 @@
imx51_gpio_intr, NULL, sc, &sc->gpio_ih[irq]))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
+ imx51_gpio_detach(dev);
return (ENXIO);
}
}
@@ -424,30 +440,32 @@
snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME,
"imx_gpio%d.%d", device_get_unit(dev), i);
}
+ sc->sc_busdev = gpiobus_attach_bus(dev);
+ if (sc->sc_busdev == NULL) {
+ imx51_gpio_detach(dev);
+ return (ENXIO);
+ }
- device_add_child(dev, "gpioc", -1);
- device_add_child(dev, "gpiobus", -1);
-
- return (bus_generic_attach(dev));
+ return (0);
}
static int
imx51_gpio_detach(device_t dev)
{
+ int irq;
struct imx51_gpio_softc *sc;
sc = device_get_softc(dev);
KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized"));
- bus_generic_detach(dev);
-
- if (sc->sc_res[3])
- bus_release_resources(dev, imx_gpio0irq_spec, &sc->sc_res[3]);
-
- if (sc->sc_res[0])
- bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
-
+ gpiobus_detach_bus(dev);
+ for (irq = 1; irq <= sc->sc_l_irq; irq ++) {
+ if (sc->gpio_ih[irq])
+ bus_teardown_intr(dev, sc->sc_res[irq], sc->gpio_ih[irq]);
+ }
+ bus_release_resources(dev, imx_gpio0irq_spec, &sc->sc_res[3]);
+ bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
mtx_destroy(&sc->sc_mtx);
return(0);
@@ -459,6 +477,7 @@
DEVMETHOD(device_detach, imx51_gpio_detach),
/* GPIO protocol */
+ DEVMETHOD(gpio_get_bus, imx51_gpio_get_bus),
DEVMETHOD(gpio_pin_max, imx51_gpio_pin_max),
DEVMETHOD(gpio_pin_getname, imx51_gpio_pin_getname),
DEVMETHOD(gpio_pin_getflags, imx51_gpio_pin_getflags),
==== //depot/projects/pciehotplug/sys/arm/freescale/vybrid/vf_gpio.c#2 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/freescale/vybrid/vf_gpio.c 274670 2014-11-18 17:22:08Z loos $");
+__FBSDID("$FreeBSD: head/sys/arm/freescale/vybrid/vf_gpio.c 277996 2015-01-31 19:32:14Z loos $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -46,6 +46,7 @@
#include <sys/gpio.h>
#include <dev/fdt/fdt_common.h>
+#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -74,6 +75,7 @@
/*
* GPIO interface
*/
+static device_t vf_gpio_get_bus(device_t);
static int vf_gpio_pin_max(device_t, int *);
static int vf_gpio_pin_getcaps(device_t, uint32_t, uint32_t *);
static int vf_gpio_pin_getname(device_t, uint32_t, char *);
@@ -88,6 +90,7 @@
bus_space_tag_t bst;
bus_space_handle_t bsh;
+ device_t sc_busdev;
struct mtx sc_mtx;
int gpio_npins;
struct gpio_pin gpio_pins[NGPIO];
@@ -125,6 +128,7 @@
if (bus_alloc_resources(dev, vf_gpio_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
+ mtx_destroy(&sc->sc_mtx);
return (ENXIO);
}
@@ -146,10 +150,24 @@
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list