Date: Sat, 31 Jan 2015 20:49:31 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r277999 - in projects/clang360-import: . bin/ps contrib/tcpdump include sys/arm/allwinner sys/arm/altera/socfpga sys/arm/broadcom/bcm2835 sys/arm/freescale/imx sys/arm/freescale/vybrid ... Message-ID: <201501312049.t0VKnVvs088339@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Jan 31 20:49:30 2015 New Revision: 277999 URL: https://svnweb.freebsd.org/changeset/base/277999 Log: Merge ^/head r277975 through r277998. Modified: projects/clang360-import/UPDATING projects/clang360-import/bin/ps/ps.c projects/clang360-import/contrib/tcpdump/print-atm.c projects/clang360-import/contrib/tcpdump/print-llc.c projects/clang360-import/include/semaphore.h projects/clang360-import/sys/arm/allwinner/a10_gpio.c projects/clang360-import/sys/arm/altera/socfpga/socfpga_gpio.c projects/clang360-import/sys/arm/broadcom/bcm2835/bcm2835_gpio.c projects/clang360-import/sys/arm/freescale/imx/imx_gpio.c projects/clang360-import/sys/arm/freescale/vybrid/vf_gpio.c projects/clang360-import/sys/arm/include/profile.h projects/clang360-import/sys/arm/lpc/lpc_gpio.c projects/clang360-import/sys/arm/rockchip/rk30xx_gpio.c projects/clang360-import/sys/arm/samsung/exynos/exynos5_pad.c projects/clang360-import/sys/arm/ti/ti_gpio.c projects/clang360-import/sys/arm/ti/ti_gpio.h projects/clang360-import/sys/arm/xilinx/zy7_gpio.c projects/clang360-import/sys/arm/xscale/ixp425/avila_gpio.c projects/clang360-import/sys/arm/xscale/ixp425/cambria_gpio.c projects/clang360-import/sys/boot/common/load_elf.c projects/clang360-import/sys/boot/powerpc/kboot/conf.c projects/clang360-import/sys/boot/powerpc/kboot/kbootfdt.c projects/clang360-import/sys/boot/powerpc/kboot/kerneltramp.S projects/clang360-import/sys/boot/powerpc/kboot/main.c projects/clang360-import/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c projects/clang360-import/sys/conf/Makefile.powerpc projects/clang360-import/sys/conf/files projects/clang360-import/sys/dev/fdt/fdt_clock.c projects/clang360-import/sys/dev/gpio/gpio_if.m projects/clang360-import/sys/dev/gpio/gpiobus.c projects/clang360-import/sys/dev/gpio/gpiobusvar.h projects/clang360-import/sys/dev/iscsi/icl_soft.c projects/clang360-import/sys/dev/iscsi/icl_wrappers.h projects/clang360-import/sys/mips/atheros/ar71xx_gpio.c projects/clang360-import/sys/mips/atheros/ar71xx_gpiovar.h projects/clang360-import/sys/mips/cavium/octeon_gpio.c projects/clang360-import/sys/mips/cavium/octeon_gpiovar.h projects/clang360-import/sys/mips/rt305x/rt305x_gpio.c projects/clang360-import/sys/mips/rt305x/rt305x_gpiovar.h projects/clang360-import/sys/powerpc/ofw/ofw_machdep.c projects/clang360-import/sys/sys/param.h Directory Properties: projects/clang360-import/ (props changed) projects/clang360-import/contrib/tcpdump/ (props changed) projects/clang360-import/include/ (props changed) projects/clang360-import/sys/ (props changed) projects/clang360-import/sys/boot/ (props changed) projects/clang360-import/sys/boot/powerpc/kboot/ (props changed) projects/clang360-import/sys/conf/ (props changed) Modified: projects/clang360-import/UPDATING ============================================================================== --- projects/clang360-import/UPDATING Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/UPDATING Sat Jan 31 20:49:30 2015 (r277999) @@ -31,9 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -20150126: +2015mmdd: Clang and llvm have been upgraded to 3.6.0 release. +20150131: + The powerpc64 kernel has been changed to a position-independent + executable. This can only be booted with a new version of loader(8), + so make sure to update both world and kernel before rebooting. + 20150118: Clang and llvm have been upgraded to 3.5.1 release. This is a bugfix only release, no new features have been added. Please see the 20141231 Modified: projects/clang360-import/bin/ps/ps.c ============================================================================== --- projects/clang360-import/bin/ps/ps.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/bin/ps/ps.c Sat Jan 31 20:49:30 2015 (r277999) @@ -178,7 +178,7 @@ main(int argc, char *argv[]) KINFO *kinfo = NULL, *next_KINFO; KINFO_STR *ks; struct varent *vent; - struct winsize ws; + struct winsize ws = { .ws_row = 0 }; const char *nlistf, *memf, *fmtstr, *str; char *cols; int all, ch, elem, flag, _fmt, i, lineno, linelen, left; Modified: projects/clang360-import/contrib/tcpdump/print-atm.c ============================================================================== --- projects/clang360-import/contrib/tcpdump/print-atm.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/contrib/tcpdump/print-atm.c Sat Jan 31 20:49:30 2015 (r277999) @@ -167,7 +167,7 @@ atm_if_print(netdissect_options *ndo, uint32_t llchdr; u_int hdrlen = 0; - if (caplen < 8) { + if (caplen < 1 || length < 1) { ND_PRINT((ndo, "%s", tstr)); return (caplen); } @@ -181,6 +181,15 @@ atm_if_print(netdissect_options *ndo, } /* + * Must have at least a DSAP, an SSAP, and the first byte of the + * control field. + */ + if (caplen < 3 || length < 3) { + ND_PRINT((ndo, "%s", tstr)); + return (caplen); + } + + /* * Extract the presumed LLC header into a variable, for quick * testing. * Then check for a header that's neither a header for a SNAP @@ -207,6 +216,10 @@ atm_if_print(netdissect_options *ndo, * packets? If so, could it be changed to use a * new DLT_IEEE802_6 value if we added it? */ + if (caplen < 20 || length < 20) { + ND_PRINT((ndo, "%s", tstr)); + return (caplen); + } if (ndo->ndo_eflag) ND_PRINT((ndo, "%08x%08x %08x%08x ", EXTRACT_32BITS(p), Modified: projects/clang360-import/contrib/tcpdump/print-llc.c ============================================================================== --- projects/clang360-import/contrib/tcpdump/print-llc.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/contrib/tcpdump/print-llc.c Sat Jan 31 20:49:30 2015 (r277999) @@ -153,10 +153,10 @@ llc_print(netdissect_options *ndo, const *extracted_ethertype = 0; - if (caplen < 3) { + if (caplen < 3 || length < 3) { ND_PRINT((ndo, "[|llc]")); ND_DEFAULTPRINT((u_char *)p, caplen); - return(0); + return (1); } dsap_field = *p; @@ -179,10 +179,10 @@ llc_print(netdissect_options *ndo, const * The control field in I and S frames is * 2 bytes... */ - if (caplen < 4) { + if (caplen < 4 || length < 4) { ND_PRINT((ndo, "[|llc]")); ND_DEFAULTPRINT((u_char *)p, caplen); - return(0); + return (1); } /* @@ -242,6 +242,11 @@ llc_print(netdissect_options *ndo, const if (ssap == LLCSAP_IP && dsap == LLCSAP_IP && control == LLC_UI) { + if (caplen < 4 || length < 4) { + ND_PRINT((ndo, "[|llc]")); + ND_DEFAULTPRINT((u_char *)p, caplen); + return (1); + } ip_print(ndo, p+4, length-4); return (1); } @@ -370,6 +375,8 @@ snap_print(netdissect_options *ndo, cons register int ret; ND_TCHECK2(*p, 5); + if (caplen < 5 || length < 5) + goto trunc; orgcode = EXTRACT_24BITS(p); et = EXTRACT_16BITS(p + 3); Modified: projects/clang360-import/include/semaphore.h ============================================================================== --- projects/clang360-import/include/semaphore.h Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/include/semaphore.h Sat Jan 31 20:49:30 2015 (r277999) @@ -36,6 +36,8 @@ #include <sys/_types.h> #include <sys/_umtx.h> +#include <machine/_limits.h> + struct _sem { __uint32_t _magic; struct _usem2 _kern; Modified: projects/clang360-import/sys/arm/allwinner/a10_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/allwinner/a10_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/allwinner/a10_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #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 @@ __FBSDID("$FreeBSD$"); 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_pin_configure(struct a10_gpio_s 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) { @@ -458,13 +470,12 @@ a10_gpio_attach(device_t dev) 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) @@ -490,6 +501,7 @@ static device_method_t a10_gpio_methods[ 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), Modified: projects/clang360-import/sys/arm/altera/socfpga/socfpga_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/altera/socfpga/socfpga_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/altera/socfpga/socfpga_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #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 @@ enum port_no { /* * 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 @@ struct socfpga_gpio_softc { 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]; @@ -196,11 +199,24 @@ socfpga_gpio_attach(device_t dev) 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); +} - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); +static device_t +socfpga_gpio_get_bus(device_t dev) +{ + struct socfpga_gpio_softc *sc; + + sc = device_get_softc(dev); - return (bus_generic_attach(dev)); + return (sc->busdev); } static int @@ -415,6 +431,7 @@ static device_method_t socfpga_gpio_meth 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), Modified: projects/clang360-import/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #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> @@ -83,6 +84,7 @@ struct bcm_gpio_sysctl { struct bcm_gpio_softc { device_t sc_dev; + device_t sc_busdev; struct mtx sc_mtx; struct resource * sc_res[BCM_GPIO_IRQS + 1]; bus_space_tag_t sc_bst; @@ -317,6 +319,16 @@ bcm_gpio_pin_configure(struct bcm_gpio_s 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) { @@ -709,13 +721,12 @@ bcm_gpio_attach(device_t dev) 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 (bus_generic_attach(dev)); + return (0); fail: bus_release_resources(dev, bcm_gpio_res_spec, sc->sc_res); @@ -746,6 +757,7 @@ static device_method_t bcm_gpio_methods[ 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), Modified: projects/clang360-import/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/freescale/imx/imx_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/freescale/imx/imx_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #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 @@ __FBSDID("$FreeBSD$"); 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 @@ static int imx51_gpio_intr(void *); /* * 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 @@ imx51_gpio_pin_configure(struct imx51_gp 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) { @@ -427,11 +440,13 @@ imx51_gpio_attach(device_t dev) 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 @@ -444,7 +459,7 @@ imx51_gpio_detach(device_t dev) KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized")); - bus_generic_detach(dev); + 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]); @@ -462,6 +477,7 @@ static device_method_t imx51_gpio_method 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), Modified: projects/clang360-import/sys/arm/freescale/vybrid/vf_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/freescale/vybrid/vf_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/freescale/vybrid/vf_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #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 @@ __FBSDID("$FreeBSD$"); /* * 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 @@ struct vf_gpio_softc { 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]; @@ -147,10 +150,24 @@ vf_gpio_attach(device_t dev) "vf_gpio%d.%d", device_get_unit(dev), i); } - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) { + bus_release_resources(dev, vf_gpio_spec, sc->res); + mtx_destroy(&sc->sc_mtx); + return (ENXIO); + } + + return (0); +} + +static device_t +vf_gpio_get_bus(device_t dev) +{ + struct vf_gpio_softc *sc; + + sc = device_get_softc(dev); - return (bus_generic_attach(dev)); + return (sc->sc_busdev); } static int @@ -348,6 +365,7 @@ static device_method_t vf_gpio_methods[] DEVMETHOD(device_attach, vf_gpio_attach), /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, vf_gpio_get_bus), DEVMETHOD(gpio_pin_max, vf_gpio_pin_max), DEVMETHOD(gpio_pin_getname, vf_gpio_pin_getname), DEVMETHOD(gpio_pin_getcaps, vf_gpio_pin_getcaps), Modified: projects/clang360-import/sys/arm/include/profile.h ============================================================================== --- projects/clang360-import/sys/arm/include/profile.h Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/include/profile.h Sat Jan 31 20:49:30 2015 (r277999) @@ -86,7 +86,12 @@ typedef u_long fptrdiff_t; /* \ * Restore registers that were trashed during mcount \ */ \ - __asm__("ldmfd sp!, {r0-r3, lr, pc}"); + __asm__("ldmfd sp!, {r0-r3, lr}"); \ + /* \ + * Return to the caller. Loading lr and pc in one instruction \ + * is deprecated on ARMv7 so we need this on it's own. \ + */ \ + __asm__("ldmfd sp!, {pc}"); void bintr(void); void btrap(void); void eintr(void); Modified: projects/clang360-import/sys/arm/lpc/lpc_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/lpc/lpc_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/lpc/lpc_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include <machine/intr.h> #include <machine/fdt.h> +#include <dev/gpio/gpiobusvar.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> @@ -90,6 +91,7 @@ __FBSDID("$FreeBSD$"); struct lpc_gpio_softc { device_t lg_dev; + device_t lg_busdev; struct resource * lg_res; bus_space_tag_t lg_bst; bus_space_handle_t lg_bsh; @@ -135,6 +137,7 @@ static int lpc_gpio_probe(device_t); static int lpc_gpio_attach(device_t); static int lpc_gpio_detach(device_t); +static device_t lpc_gpio_get_bus(device_t); static int lpc_gpio_pin_max(device_t, int *); static int lpc_gpio_pin_getcaps(device_t, uint32_t, uint32_t *); static int lpc_gpio_pin_getflags(device_t, uint32_t, uint32_t *); @@ -192,10 +195,13 @@ lpc_gpio_attach(device_t dev) lpc_gpio_sc = sc; - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); + sc->lg_busdev = gpiobus_attach_bus(dev); + if (sc->lg_busdev == NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->lg_res); + return (ENXIO); + } - return (bus_generic_attach(dev)); + return (0); } static int @@ -204,6 +210,16 @@ lpc_gpio_detach(device_t dev) return (EBUSY); } +static device_t +lpc_gpio_get_bus(device_t dev) +{ + struct lpc_gpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->lg_busdev); +} + static int lpc_gpio_pin_max(device_t dev, int *npins) { @@ -527,6 +543,7 @@ static device_method_t lpc_gpio_methods[ DEVMETHOD(device_detach, lpc_gpio_detach), /* GPIO interface */ + DEVMETHOD(gpio_get_bus, lpc_gpio_get_bus), DEVMETHOD(gpio_pin_max, lpc_gpio_pin_max), DEVMETHOD(gpio_pin_getcaps, lpc_gpio_pin_getcaps), DEVMETHOD(gpio_pin_getflags, lpc_gpio_pin_getflags), Modified: projects/clang360-import/sys/arm/rockchip/rk30xx_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/rockchip/rk30xx_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/rockchip/rk30xx_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #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> @@ -73,6 +74,7 @@ __FBSDID("$FreeBSD$"); struct rk30_gpio_softc { device_t sc_dev; + device_t sc_busdev; struct mtx sc_mtx; struct resource * sc_mem_res; struct resource * sc_irq_res; @@ -210,6 +212,16 @@ rk30_gpio_pin_configure(struct rk30_gpio RK30_GPIO_UNLOCK(sc); } +static device_t +rk30_gpio_get_bus(device_t dev) +{ + struct rk30_gpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->sc_busdev); +} + static int rk30_gpio_pin_max(device_t dev, int *maxpin) { @@ -449,15 +461,13 @@ rk30_gpio_attach(device_t dev) sc->sc_gpio_pins[i].gp_flags = rk30_gpio_get_function(sc, i); } sc->sc_gpio_npins = i; - - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); - rk30_gpio_sc = sc; - rk30_gpio_init(); - - return (bus_generic_attach(dev)); + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) + goto fail; + + return (0); fail: if (sc->sc_irq_res) @@ -483,6 +493,7 @@ static device_method_t rk30_gpio_methods DEVMETHOD(device_detach, rk30_gpio_detach), /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, rk30_gpio_get_bus), DEVMETHOD(gpio_pin_max, rk30_gpio_pin_max), DEVMETHOD(gpio_pin_getname, rk30_gpio_pin_getname), DEVMETHOD(gpio_pin_getflags, rk30_gpio_pin_getflags), Modified: projects/clang360-import/sys/arm/samsung/exynos/exynos5_pad.c ============================================================================== --- projects/clang360-import/sys/arm/samsung/exynos/exynos5_pad.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/samsung/exynos/exynos5_pad.c Sat Jan 31 20:49:30 2015 (r277999) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mutex.h> #include <sys/gpio.h> +#include <dev/gpio/gpiobusvar.h> #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> @@ -82,6 +83,7 @@ __FBSDID("$FreeBSD$"); /* * GPIO interface */ +static device_t pad_get_bus(device_t); static int pad_pin_max(device_t, int *); static int pad_pin_getcaps(device_t, uint32_t, uint32_t *); static int pad_pin_getname(device_t, uint32_t, char *); @@ -111,6 +113,7 @@ struct pad_softc { struct gpio_pin gpio_pins[MAX_NGPIO]; void *gpio_ih[MAX_PORTS]; device_t dev; + device_t busdev; int model; struct resource_spec *pad_spec; struct gpio_bank *gpio_map; @@ -558,11 +561,11 @@ pad_attach(device_t dev) snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME, "pad%d.%d", device_get_unit(dev), i); } + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) + goto fail; - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); - - return (bus_generic_attach(dev)); + return (0); fail: for (i = 0; i < sc->nports; i++) { @@ -576,6 +579,16 @@ fail: return (ENXIO); } +static device_t +pad_get_bus(device_t dev) +{ + struct pad_softc *sc; + + sc = device_get_softc(dev); + + return (sc->busdev); +} + static int pad_pin_max(device_t dev, int *maxpin) { @@ -817,6 +830,7 @@ static device_method_t pad_methods[] = { DEVMETHOD(device_attach, pad_attach), /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, pad_get_bus), DEVMETHOD(gpio_pin_max, pad_pin_max), DEVMETHOD(gpio_pin_getname, pad_pin_getname), DEVMETHOD(gpio_pin_getcaps, pad_pin_getcaps), Modified: projects/clang360-import/sys/arm/ti/ti_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/ti/ti_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/ti/ti_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include <arm/ti/ti_prcm.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> @@ -309,6 +310,16 @@ ti_gpio_intr_status(struct ti_gpio_softc return (reg); } +static device_t +ti_gpio_get_bus(device_t dev) +{ + struct ti_gpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->sc_busdev); +} + /** * ti_gpio_pin_max - Returns the maximum number of GPIO pins * @dev: gpio device handle @@ -815,12 +826,13 @@ ti_gpio_attach(device_t dev) } } } + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) { + ti_gpio_detach(dev); + return (ENXIO); + } - /* Finish of the probe call */ - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); - - return (bus_generic_attach(dev)); + return (0); } /** @@ -849,7 +861,7 @@ ti_gpio_detach(device_t dev) if (sc->sc_mem_res[i] != NULL) ti_gpio_intr_clr(sc, i, 0xffffffff); } - bus_generic_detach(dev); + gpiobus_detach_bus(dev); if (sc->sc_events) free(sc->sc_events, M_DEVBUF); if (sc->sc_irq_polarity) @@ -1065,6 +1077,7 @@ static device_method_t ti_gpio_methods[] DEVMETHOD(device_detach, ti_gpio_detach), /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, ti_gpio_get_bus), DEVMETHOD(gpio_pin_max, ti_gpio_pin_max), DEVMETHOD(gpio_pin_getname, ti_gpio_pin_getname), DEVMETHOD(gpio_pin_getflags, ti_gpio_pin_getflags), Modified: projects/clang360-import/sys/arm/ti/ti_gpio.h ============================================================================== --- projects/clang360-import/sys/arm/ti/ti_gpio.h Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/ti/ti_gpio.h Sat Jan 31 20:49:30 2015 (r277999) @@ -46,6 +46,7 @@ */ struct ti_gpio_softc { device_t sc_dev; + device_t sc_busdev; /* Interrupt trigger type and level. */ enum intr_trigger *sc_irq_trigger; Modified: projects/clang360-import/sys/arm/xilinx/zy7_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/xilinx/zy7_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/xilinx/zy7_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include <machine/stdarg.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> @@ -88,6 +89,7 @@ __FBSDID("$FreeBSD$"); struct zy7_gpio_softc { device_t dev; + device_t busdev; struct mtx sc_mtx; struct resource *mem_res; /* Memory resource */ }; @@ -113,6 +115,15 @@ struct zy7_gpio_softc { #define ZY7_GPIO_INT_POLARITY(b) (0x0220+0x40*(b)) /* int polarity */ #define ZY7_GPIO_INT_ANY(b) (0x0224+0x40*(b)) /* any edge */ +static device_t +zy7_gpio_get_bus(device_t dev) +{ + struct zy7_gpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->busdev); +} static int zy7_gpio_pin_max(device_t dev, int *maxpin) @@ -329,10 +340,13 @@ zy7_gpio_attach(device_t dev) /* Completely reset. */ zy7_gpio_hw_reset(sc); - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) { + zy7_gpio_detach(dev); + return (ENOMEM); + } - return (bus_generic_attach(dev)); + return (0); } static int @@ -340,7 +354,7 @@ zy7_gpio_detach(device_t dev) { struct zy7_gpio_softc *sc = device_get_softc(dev); - bus_generic_detach(dev); + gpiobus_detach_bus(dev); if (sc->mem_res != NULL) { /* Release memory resource. */ @@ -360,6 +374,7 @@ static device_method_t zy7_gpio_methods[ DEVMETHOD(device_detach, zy7_gpio_detach), /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, zy7_gpio_get_bus), DEVMETHOD(gpio_pin_max, zy7_gpio_pin_max), DEVMETHOD(gpio_pin_getname, zy7_gpio_pin_getname), DEVMETHOD(gpio_pin_getflags, zy7_gpio_pin_getflags), Modified: projects/clang360-import/sys/arm/xscale/ixp425/avila_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/xscale/ixp425/avila_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/xscale/ixp425/avila_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <machine/resource.h> #include <arm/xscale/ixp425/ixp425reg.h> #include <arm/xscale/ixp425/ixp425var.h> +#include <dev/gpio/gpiobusvar.h> #include "gpio_if.h" @@ -60,6 +61,7 @@ __FBSDID("$FreeBSD$"); struct avila_gpio_softc { device_t sc_dev; + device_t sc_busdev; bus_space_tag_t sc_iot; bus_space_handle_t sc_gpio_ioh; uint32_t sc_valid; @@ -116,6 +118,7 @@ static int avila_gpio_detach(device_t de /* * GPIO interface */ +static device_t avila_gpio_get_bus(device_t); static int avila_gpio_pin_max(device_t dev, int *maxpin); static int avila_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps); static int avila_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t @@ -162,6 +165,16 @@ avila_gpio_pin_configure(struct avila_gp } } +static device_t +avila_gpio_get_bus(device_t dev) +{ + struct avila_gpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->sc_busdev); +} + static int avila_gpio_pin_max(device_t dev, int *maxpin) { @@ -310,10 +323,11 @@ avila_gpio_attach(device_t dev) sc->sc_valid |= 1 << p->pin; } - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) + return (ENXIO); - return (bus_generic_attach(dev)); + return (0); #undef N } @@ -321,7 +335,7 @@ static int avila_gpio_detach(device_t dev) { - bus_generic_detach(dev); + gpiobus_detach_bus(dev); return(0); } @@ -332,6 +346,7 @@ static device_method_t gpio_avila_method DEVMETHOD(device_detach, avila_gpio_detach), /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, avila_gpio_get_bus), DEVMETHOD(gpio_pin_max, avila_gpio_pin_max), DEVMETHOD(gpio_pin_getname, avila_gpio_pin_getname), DEVMETHOD(gpio_pin_getflags, avila_gpio_pin_getflags), Modified: projects/clang360-import/sys/arm/xscale/ixp425/cambria_gpio.c ============================================================================== --- projects/clang360-import/sys/arm/xscale/ixp425/cambria_gpio.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/arm/xscale/ixp425/cambria_gpio.c Sat Jan 31 20:49:30 2015 (r277999) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include <arm/xscale/ixp425/ixp425var.h> #include <arm/xscale/ixp425/ixdp425reg.h> +#include <dev/gpio/gpiobusvar.h> #include <dev/iicbus/iiconf.h> #include <dev/iicbus/iicbus.h> @@ -79,6 +80,7 @@ __FBSDID("$FreeBSD$"); #define GPIO_PINS 5 struct cambria_gpio_softc { device_t sc_dev; + device_t sc_busdev; bus_space_tag_t sc_iot; bus_space_handle_t sc_gpio_ioh; struct mtx sc_mtx; @@ -119,6 +121,7 @@ static int cambria_gpio_detach(device_t /* * GPIO interface */ +static device_t cambria_gpio_get_bus(device_t); static int cambria_gpio_pin_max(device_t dev, int *maxpin); static int cambria_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps); static int cambria_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t @@ -261,6 +264,16 @@ cambria_gpio_write(struct cambria_gpio_s return (0); } +static device_t +cambria_gpio_get_bus(device_t dev) +{ + struct cambria_gpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->sc_busdev); +} + static int cambria_gpio_pin_max(device_t dev, int *maxpin) { @@ -438,10 +451,13 @@ cambria_gpio_attach(device_t dev) cambria_gpio_pin_setflags(dev, pin, p->flags); } - device_add_child(dev, "gpioc", -1); - device_add_child(dev, "gpiobus", -1); + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) { + mtx_destroy(&sc->sc_mtx); + return (ENXIO); + } - return (bus_generic_attach(dev)); + return (0); } static int @@ -451,8 +467,7 @@ cambria_gpio_detach(device_t dev) KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized")); - bus_generic_detach(dev); - + gpiobus_detach_bus(dev); mtx_destroy(&sc->sc_mtx); return(0); @@ -464,6 +479,7 @@ static device_method_t cambria_gpio_meth DEVMETHOD(device_detach, cambria_gpio_detach), /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, cambria_gpio_get_bus), DEVMETHOD(gpio_pin_max, cambria_gpio_pin_max), DEVMETHOD(gpio_pin_getname, cambria_gpio_pin_getname), DEVMETHOD(gpio_pin_getflags, cambria_gpio_pin_getflags), Modified: projects/clang360-import/sys/boot/common/load_elf.c ============================================================================== --- projects/clang360-import/sys/boot/common/load_elf.c Sat Jan 31 19:55:12 2015 (r277998) +++ projects/clang360-import/sys/boot/common/load_elf.c Sat Jan 31 20:49:30 2015 (r277999) @@ -193,8 +193,9 @@ __elfN(loadfile_raw)(char *filename, u_i /* * Calculate destination address based on kernel entrypoint */ - dest = (ehdr->e_entry & ~PAGE_MASK); - if (dest == 0) { + if (ehdr->e_type == ET_EXEC) + dest = (ehdr->e_entry & ~PAGE_MASK); + if ((ehdr->e_entry & ~PAGE_MASK) == 0) { printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n"); err = EPERM; goto oerr; @@ -315,7 +316,7 @@ __elfN(loadimage)(struct preloaded_file ret = 0; firstaddr = lastaddr = 0; ehdr = ef->ehdr; - if (ef->kernel) { + if (ehdr->e_type == ET_EXEC) { #if defined(__i386__) || defined(__amd64__) #if __ELF_WORD_SIZE == 64 off = - (off & 0xffffffffff000000ull);/* x86_64 relocates after locore */ @@ -369,10 +370,12 @@ __elfN(loadimage)(struct preloaded_file #else off = 0; /* other archs use direct mapped kernels */ #endif - __elfN(relocation_offset) = off; } ef->off = off; + if (ef->kernel) + __elfN(relocation_offset) = off; + if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) { printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: program header not within first page\n"); goto out; @@ -729,7 +732,7 @@ __elfN(load_modmetadata)(struct preloade if (err != 0) goto out; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501312049.t0VKnVvs088339>