svn commit: r277975 - in projects/clang360-import: bin/sh lib/libproc sys/arm/allwinner sys/arm/altera/socfpga sys/arm/freescale/imx sys/arm/freescale/vybrid sys/arm/rockchip sys/arm/samsung/exynos...

Dimitry Andric dim at FreeBSD.org
Sat Jan 31 14:31:19 UTC 2015


Author: dim
Date: Sat Jan 31 14:31:12 2015
New Revision: 277975
URL: https://svnweb.freebsd.org/changeset/base/277975

Log:
  Merge ^/head r277956 through r277974.

Added:
  projects/clang360-import/sys/dev/iscsi/icl_conn_if.m
     - copied unchanged from r277974, head/sys/dev/iscsi/icl_conn_if.m
  projects/clang360-import/sys/dev/iscsi/icl_soft.c
     - copied unchanged from r277974, head/sys/dev/iscsi/icl_soft.c
  projects/clang360-import/sys/dev/iscsi/icl_wrappers.h
     - copied unchanged from r277974, head/sys/dev/iscsi/icl_wrappers.h
Replaced:
  projects/clang360-import/sys/dev/iscsi/icl.c
     - copied unchanged from r277974, head/sys/dev/iscsi/icl.c
Modified:
  projects/clang360-import/bin/sh/jobs.c
  projects/clang360-import/bin/sh/trap.c
  projects/clang360-import/lib/libproc/proc_sym.c
  projects/clang360-import/sys/arm/allwinner/a10_gpio.c
  projects/clang360-import/sys/arm/altera/socfpga/socfpga_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/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_pruss.c
  projects/clang360-import/sys/boot/common/load_elf.c
  projects/clang360-import/sys/boot/i386/libi386/smbios.c
  projects/clang360-import/sys/cam/ctl/ctl_frontend_iscsi.c
  projects/clang360-import/sys/conf/files
  projects/clang360-import/sys/dev/drm2/i915/intel_display.c
  projects/clang360-import/sys/dev/iscsi/icl.h
  projects/clang360-import/sys/dev/iscsi/iscsi.c
  projects/clang360-import/sys/dev/usb/input/uhid.c
  projects/clang360-import/sys/fs/tmpfs/tmpfs_subr.c
  projects/clang360-import/sys/fs/tmpfs/tmpfs_vnops.c
  projects/clang360-import/sys/kern/kern_umtx.c
  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/modules/ctl/Makefile
  projects/clang360-import/sys/modules/iscsi/Makefile
  projects/clang360-import/sys/sys/proc.h
Directory Properties:
  projects/clang360-import/   (props changed)
  projects/clang360-import/sys/   (props changed)
  projects/clang360-import/sys/boot/   (props changed)
  projects/clang360-import/sys/conf/   (props changed)

Modified: projects/clang360-import/bin/sh/jobs.c
==============================================================================
--- projects/clang360-import/bin/sh/jobs.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/bin/sh/jobs.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -87,8 +87,8 @@ static int ttyfd = -1;
 
 /* mode flags for dowait */
 #define DOWAIT_BLOCK	0x1 /* wait until a child exits */
-#define DOWAIT_SIG	0x2 /* if DOWAIT_BLOCK, abort on SIGINT/SIGQUIT */
-#define DOWAIT_SIG_ANY	0x4 /* if DOWAIT_SIG, abort on any signal */
+#define DOWAIT_SIG	0x2 /* if DOWAIT_BLOCK, abort on signal */
+#define DOWAIT_SIG_TRAP	0x4 /* if DOWAIT_SIG, abort on trapped signal only */
 
 #if JOBS
 static void restartjob(struct job *);
@@ -1028,7 +1028,7 @@ waitforjob(struct job *jp, int *origstat
 	TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
 	while (jp->state == 0)
 		if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG |
-		    DOWAIT_SIG_ANY : 0), jp) == -1)
+		    DOWAIT_SIG_TRAP : 0), jp) == -1)
 			dotrap();
 #if JOBS
 	if (jp->jobctl) {
@@ -1120,7 +1120,7 @@ dowait(int mode, struct job *job)
 		TRACE(("wait returns %d, status=%d\n", (int)pid, status));
 		if (pid == 0 && (mode & DOWAIT_SIG) != 0) {
 			pid = -1;
-			if (((mode & DOWAIT_SIG_ANY) != 0 ?
+			if (((mode & DOWAIT_SIG_TRAP) != 0 ?
 			    pendingsig : pendingsig_waitcmd) != 0) {
 				errno = EINTR;
 				break;

Modified: projects/clang360-import/bin/sh/trap.c
==============================================================================
--- projects/clang360-import/bin/sh/trap.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/bin/sh/trap.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
 
 static char sigmode[NSIG];	/* current value of signal */
 volatile sig_atomic_t pendingsig;	/* indicates some signal received */
-volatile sig_atomic_t pendingsig_waitcmd;	/* indicates SIGINT/SIGQUIT received */
+volatile sig_atomic_t pendingsig_waitcmd;	/* indicates wait builtin should be interrupted */
 static int in_dotrap;			/* do we execute in a trap handler? */
 static char *volatile trap[NSIG];	/* trap handler commands */
 static volatile sig_atomic_t gotsig[NSIG];
@@ -400,6 +400,7 @@ onsig(int signo)
 	    (signo != SIGCHLD || !ignore_sigchld)) {
 		gotsig[signo] = 1;
 		pendingsig = signo;
+		pendingsig_waitcmd = signo;
 	}
 }
 

Modified: projects/clang360-import/lib/libproc/proc_sym.c
==============================================================================
--- projects/clang360-import/lib/libproc/proc_sym.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/lib/libproc/proc_sym.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -153,9 +153,12 @@ proc_iter_objs(struct proc_handle *p, pr
 	prmap_t map;
 	char path[MAXPATHLEN];
 	char last[MAXPATHLEN];
+	int error;
 
 	if (p->nobjs == 0)
 		return (-1);
+
+	error = 0;
 	memset(last, 0, sizeof(last));
 	for (i = 0; i < p->nobjs; i++) {
 		rdl = &p->rdobjs[i];
@@ -169,11 +172,11 @@ proc_iter_objs(struct proc_handle *p, pr
 		 */
 		if (strcmp(path, last) == 0)
 			continue;
-		(*func)(cd, &map, path);
+		if ((error = (*func)(cd, &map, path)) != 0)
+			break;
 		strlcpy(last, path, sizeof(last));
 	}
-
-	return (0);
+	return (error);
 }
 
 prmap_t *
@@ -599,7 +602,8 @@ proc_iter_symbyaddr(struct proc_handle *
 		s = elf_strptr(e, stridx, sym.st_name);
 		if (ehdr.e_type != ET_EXEC)
 			sym.st_value += map->pr_vaddr;
-		(*func)(cd, &sym, s);
+		if ((error = (*func)(cd, &sym, s)) != 0)
+			goto err2;
 	}
 	error = 0;
 err2:

Modified: projects/clang360-import/sys/arm/allwinner/a10_gpio.c
==============================================================================
--- projects/clang360-import/sys/arm/allwinner/a10_gpio.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/allwinner/a10_gpio.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -427,7 +427,7 @@ a10_gpio_attach(device_t dev)
 	    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 +437,8 @@ a10_gpio_attach(device_t dev)
 	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. */
@@ -472,6 +471,8 @@ fail:
 		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);
 }
 

Modified: projects/clang360-import/sys/arm/altera/socfpga/socfpga_gpio.c
==============================================================================
--- projects/clang360-import/sys/arm/altera/socfpga/socfpga_gpio.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/altera/socfpga/socfpga_gpio.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -163,6 +163,7 @@ socfpga_gpio_attach(device_t dev)
 
 	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);
 	}
 

Modified: projects/clang360-import/sys/arm/freescale/imx/imx_gpio.c
==============================================================================
--- projects/clang360-import/sys/arm/freescale/imx/imx_gpio.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/freescale/imx/imx_gpio.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -389,6 +389,8 @@ imx51_gpio_attach(device_t dev)
 
 	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 +413,7 @@ imx51_gpio_attach(device_t dev)
 		    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);
 		}
 	}
@@ -434,6 +437,7 @@ imx51_gpio_attach(device_t dev)
 static int
 imx51_gpio_detach(device_t dev)
 {
+	int irq;
 	struct imx51_gpio_softc *sc;
 
 	sc = device_get_softc(dev);
@@ -441,13 +445,12 @@ imx51_gpio_detach(device_t 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);
-
+	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);

Modified: projects/clang360-import/sys/arm/freescale/vybrid/vf_gpio.c
==============================================================================
--- projects/clang360-import/sys/arm/freescale/vybrid/vf_gpio.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/freescale/vybrid/vf_gpio.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -125,6 +125,7 @@ vf_gpio_attach(device_t dev)
 
 	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);
 	}
 

Modified: projects/clang360-import/sys/arm/rockchip/rk30xx_gpio.c
==============================================================================
--- projects/clang360-import/sys/arm/rockchip/rk30xx_gpio.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/rockchip/rk30xx_gpio.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -399,13 +399,14 @@ rk30_gpio_attach(device_t dev)
 	if (rk30_gpio_sc)
 		return (ENXIO);
 	sc->sc_dev = dev;
+	mtx_init(&sc->sc_mtx, "rk30 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);
+		goto fail;
 	}
 	sc->sc_bst = rman_get_bustag(sc->sc_mem_res);
 	sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res);
@@ -421,17 +422,15 @@ rk30_gpio_attach(device_t dev)
 	if (sc->sc_bank == -1) {
 		device_printf(dev,
 		    "unsupported device unit (only GPIO0..3 are supported)\n");
-		bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
-		return (ENXIO);
+		goto fail;
 	}
 
 	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);
+		goto fail;
 	}
 
 	/* Find our node. */
@@ -441,8 +440,6 @@ rk30_gpio_attach(device_t dev)
 		/* Node is not a GPIO controller. */
 		goto fail;
 
-	mtx_init(&sc->sc_mtx, "rk30 gpio", "gpio", MTX_DEF);
-
 	/* Initialize the software controlled pins. */
 	for (i = 0; i < RK30_GPIO_PINS; i++) {
 		snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME,
@@ -467,6 +464,8 @@ fail:
 		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);
 }
 

Modified: projects/clang360-import/sys/arm/samsung/exynos/exynos5_pad.c
==============================================================================
--- projects/clang360-import/sys/arm/samsung/exynos/exynos5_pad.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/samsung/exynos/exynos5_pad.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -509,12 +509,12 @@ pad_attach(device_t dev)
 		sc->nports = 5;
 		break;
 	default:
-		return (-1);
+		goto fail;
 	};
 
 	if (bus_alloc_resources(dev, sc->pad_spec, sc->res)) {
 		device_printf(dev, "could not allocate resources\n");
-		return (ENXIO);
+		goto fail;
 	}
 
 	/* Memory interface */
@@ -534,9 +534,9 @@ pad_attach(device_t dev)
 			    NULL, sc, &sc->gpio_ih[i]))) {
 			device_printf(dev,
 			    "ERROR: Unable to register interrupt handler\n");
-			return (ENXIO);
+			goto fail;
 		}
-	};
+	}
 
 	for (i = 0; i < sc->gpio_npins; i++) {
 		sc->gpio_pins[i].gp_pin = i;
@@ -563,6 +563,17 @@ pad_attach(device_t dev)
 	device_add_child(dev, "gpiobus", -1);
 
 	return (bus_generic_attach(dev));
+
+fail:
+	for (i = 0; i < sc->nports; i++) {
+		if (sc->gpio_ih[i])
+			bus_teardown_intr(dev, sc->res[sc->nports + i],
+			    sc->gpio_ih[i]);
+	}
+	bus_release_resources(dev, sc->pad_spec, sc->res);
+	mtx_destroy(&sc->sc_mtx);
+
+	return (ENXIO);
 }
 
 static int

Modified: projects/clang360-import/sys/arm/ti/ti_gpio.c
==============================================================================
--- projects/clang360-import/sys/arm/ti/ti_gpio.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/ti/ti_gpio.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$");
 #define	TI_GPIO_MASK(p)			(1U << ((p) % PINS_PER_BANK))
 
 static struct ti_gpio_softc *ti_gpio_sc = NULL;
+static int ti_gpio_detach(device_t);
 
 static u_int
 ti_max_gpio_banks(void)
@@ -763,21 +764,21 @@ ti_gpio_attach(device_t dev)
 	 */
 	if (bus_alloc_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res) != 0) {
 		device_printf(dev, "Error: could not allocate mem resources\n");
+		ti_gpio_detach(dev);
 		return (ENXIO);
 	}
 
 	/* Request the IRQ resources */
 	if (bus_alloc_resources(dev, ti_gpio_irq_spec, sc->sc_irq_res) != 0) {
-		bus_release_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res);
 		device_printf(dev, "Error: could not allocate irq resources\n");
+		ti_gpio_detach(dev);
 		return (ENXIO);
 	}
 
 	/* Setup the IRQ resources */
 	if (ti_gpio_attach_intr(dev) != 0) {
-		ti_gpio_detach_intr(dev);
-		bus_release_resources(dev, ti_gpio_irq_spec, sc->sc_irq_res);
-		bus_release_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res);
+		device_printf(dev, "Error: could not setup irq handlers\n");
+		ti_gpio_detach(dev);
 		return (ENXIO);
 	}
 
@@ -809,11 +810,7 @@ ti_gpio_attach(device_t dev)
 			/* Initialize the GPIO module. */
 			err = ti_gpio_bank_init(dev, i);
 			if (err != 0) {
-				ti_gpio_detach_intr(dev);
-				bus_release_resources(dev, ti_gpio_irq_spec,
-				    sc->sc_irq_res);
-				bus_release_resources(dev, ti_gpio_mem_spec,
-				    sc->sc_mem_res);
+				ti_gpio_detach(dev);
 				return (err);
 			}
 		}
@@ -852,18 +849,17 @@ ti_gpio_detach(device_t dev)
 		if (sc->sc_mem_res[i] != NULL)
 			ti_gpio_intr_clr(sc, i, 0xffffffff);
 	}
-
 	bus_generic_detach(dev);
-
-	free(sc->sc_events, M_DEVBUF);
-	free(sc->sc_irq_polarity, M_DEVBUF);
-	free(sc->sc_irq_trigger, M_DEVBUF);
-
+	if (sc->sc_events)
+		free(sc->sc_events, M_DEVBUF);
+	if (sc->sc_irq_polarity)
+		free(sc->sc_irq_polarity, M_DEVBUF);
+	if (sc->sc_irq_trigger)
+		free(sc->sc_irq_trigger, M_DEVBUF);
 	/* Release the memory and IRQ resources. */
 	ti_gpio_detach_intr(dev);
 	bus_release_resources(dev, ti_gpio_irq_spec, sc->sc_irq_res);
 	bus_release_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res);
-
 	TI_GPIO_LOCK_DESTROY(sc);
 
 	return (0);

Modified: projects/clang360-import/sys/arm/ti/ti_pruss.c
==============================================================================
--- projects/clang360-import/sys/arm/ti/ti_pruss.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/arm/ti/ti_pruss.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -258,6 +258,7 @@ ti_pruss_mmap(struct cdev *cdev, vm_ooff
 	if (offset > rman_get_size(sc->sc_mem_res))
 		return (-1);
 	*paddr = rman_get_start(sc->sc_mem_res) + offset;
+	*memattr = VM_MEMATTR_UNCACHEABLE;
 
 	return (0);
 }

Modified: projects/clang360-import/sys/boot/common/load_elf.c
==============================================================================
--- projects/clang360-import/sys/boot/common/load_elf.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/boot/common/load_elf.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -175,7 +175,33 @@ __elfN(loadfile_raw)(char *filename, u_i
      * Check to see what sort of module we are.
      */
     kfp = file_findfile(NULL, __elfN(kerneltype));
-    if (ehdr->e_type == ET_DYN) {
+#ifdef __powerpc__
+    /*
+     * Kernels can be ET_DYN, so just assume the first loaded object is the
+     * kernel. This assumption will be checked later.
+     */
+    if (kfp == NULL)
+        ef.kernel = 1;
+#endif
+    if (ef.kernel || ehdr->e_type == ET_EXEC) {
+	/* Looks like a kernel */
+	if (kfp != NULL) {
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n");
+	    err = EPERM;
+	    goto oerr;
+	}
+	/* 
+	 * Calculate destination address based on kernel entrypoint 	
+	 */
+	dest = (ehdr->e_entry & ~PAGE_MASK);
+	if (dest == 0) {
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n");
+	    err = EPERM;
+	    goto oerr;
+	}
+	ef.kernel = 1;
+
+    } else if (ehdr->e_type == ET_DYN) {
 	/* Looks like a kld module */
 	if (multiboot != 0) {
 		printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module as multiboot\n");
@@ -195,24 +221,6 @@ __elfN(loadfile_raw)(char *filename, u_i
 	/* Looks OK, got ahead */
 	ef.kernel = 0;
 
-    } else if (ehdr->e_type == ET_EXEC) {
-	/* Looks like a kernel */
-	if (kfp != NULL) {
-	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n");
-	    err = EPERM;
-	    goto oerr;
-	}
-	/* 
-	 * Calculate destination address based on kernel entrypoint 	
-	 */
-	dest = (ehdr->e_entry & ~PAGE_MASK);
-	if (dest == 0) {
-	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n");
-	    err = EPERM;
-	    goto oerr;
-	}
-	ef.kernel = 1;
-
     } else {
 	err = EFTYPE;
 	goto oerr;

Modified: projects/clang360-import/sys/boot/i386/libi386/smbios.c
==============================================================================
--- projects/clang360-import/sys/boot/i386/libi386/smbios.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/boot/i386/libi386/smbios.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -323,6 +323,29 @@ smbios_parse_table(const caddr_t addr)
 	return (cp + 2);
 }
 
+static caddr_t
+smbios_find_struct(int type)
+{
+	caddr_t		dmi;
+	int		i;
+
+	if (smbios.addr == NULL)
+		return (NULL);
+
+	for (dmi = smbios.addr, i = 0;
+	     dmi < smbios.addr + smbios.length && i < smbios.count; i++) {
+		if (SMBIOS_GET8(dmi, 0) == type)
+			return dmi;
+		/* Find structure terminator. */
+		dmi = SMBIOS_GETSTR(dmi);
+		while (SMBIOS_GET16(dmi, 0) != 0)
+			dmi++;
+		dmi += 2;
+	}
+
+	return (NULL);
+}
+
 static void
 smbios_probe(void)
 {
@@ -368,29 +391,6 @@ smbios_probe(void)
 	}
 }
 
-static caddr_t
-smbios_find_struct(int type)
-{
-	caddr_t		dmi;
-	int		i;
-
-	if (smbios.addr == NULL)
-		return (NULL);
-
-	for (dmi = smbios.addr, i = 0;
-	     dmi < smbios.addr + smbios.length && i < smbios.count; i++) {
-		if (SMBIOS_GET8(dmi, 0) == type)
-			return dmi;
-		/* Find structure terminator. */
-		dmi = SMBIOS_GETSTR(dmi);
-		while (SMBIOS_GET16(dmi, 0) != 0)
-			dmi++;
-		dmi += 2;
-	}
-
-	return (NULL);
-}
-
 void
 smbios_detect(void)
 {

Modified: projects/clang360-import/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- projects/clang360-import/sys/cam/ctl/ctl_frontend_iscsi.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/cam/ctl/ctl_frontend_iscsi.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
 #include <cam/ctl/ctl_private.h>
 
 #include <dev/iscsi/icl.h>
+#include <dev/iscsi/icl_wrappers.h>
 #include <dev/iscsi/iscsi_proto.h>
 #include <cam/ctl/ctl_frontend_iscsi.h>
 
@@ -1241,7 +1242,7 @@ cfiscsi_session_new(struct cfiscsi_softc
 	cv_init(&cs->cs_login_cv, "cfiscsi_login");
 #endif
 
-	cs->cs_conn = icl_conn_new("cfiscsi", &cs->cs_lock);
+	cs->cs_conn = icl_new_conn(NULL, "cfiscsi", &cs->cs_lock);
 	cs->cs_conn->ic_receive = cfiscsi_receive_callback;
 	cs->cs_conn->ic_error = cfiscsi_error_callback;
 	cs->cs_conn->ic_prv0 = cs;
@@ -2013,6 +2014,7 @@ cfiscsi_ioctl_port_create(struct ctl_req
 		return;
 	}
 	port = &ct->ct_port;
+	// WAT
 	if (ct->ct_state == CFISCSI_TARGET_STATE_DYING)
 		goto done;
 

Modified: projects/clang360-import/sys/conf/files
==============================================================================
--- projects/clang360-import/sys/conf/files	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/conf/files	Sat Jan 31 14:31:12 2015	(r277975)
@@ -1521,6 +1521,7 @@ ipw_monitor.fw			optional ipwmonitorfw |
 	clean		"ipw_monitor.fw"
 dev/iscsi/icl.c			optional iscsi | ctl 
 dev/iscsi/icl_proxy.c		optional iscsi | ctl
+dev/iscsi/icl_soft.c		optional iscsi | ctl 
 dev/iscsi/iscsi.c		optional iscsi scbus
 dev/iscsi_initiator/iscsi.c	optional iscsi_initiator scbus
 dev/iscsi_initiator/iscsi_subr.c	optional iscsi_initiator scbus

Modified: projects/clang360-import/sys/dev/drm2/i915/intel_display.c
==============================================================================
--- projects/clang360-import/sys/dev/drm2/i915/intel_display.c	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/dev/drm2/i915/intel_display.c	Sat Jan 31 14:31:12 2015	(r277975)
@@ -6995,7 +6995,7 @@ static void ivb_pch_pwm_override(struct 
 	 */
 	I915_WRITE(BLC_PWM_CPU_CTL2, PWM_ENABLE);
 	I915_WRITE(BLC_PWM_CPU_CTL, 0);
-	I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE | (1<<30));
+	I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE);
 }
 
 void intel_modeset_init_hw(struct drm_device *dev)

Copied: projects/clang360-import/sys/dev/iscsi/icl.c (from r277974, head/sys/dev/iscsi/icl.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang360-import/sys/dev/iscsi/icl.c	Sat Jan 31 14:31:12 2015	(r277975, copy of r277974, head/sys/dev/iscsi/icl.c)
@@ -0,0 +1,247 @@
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * iSCSI Common Layer.  It's used by both the initiator and target to send
+ * and receive iSCSI PDUs.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
+#include <sys/lock.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mutex.h>
+#include <sys/module.h>
+#include <sys/queue.h>
+#include <sys/sysctl.h>
+#include <sys/systm.h>
+#include <sys/sx.h>
+
+#include <dev/iscsi/icl.h>
+#include <icl_conn_if.h>
+
+struct icl_module {
+	TAILQ_ENTRY(icl_module)		im_next;
+	char				*im_name;
+	int				im_priority;
+	int				(*im_limits)(size_t *limitp);
+	struct icl_conn			*(*im_new_conn)(const char *name,
+					    struct mtx *lock);
+};
+
+struct icl_softc {
+	struct sx			sc_lock;
+	TAILQ_HEAD(, icl_module)	sc_modules;
+};
+
+SYSCTL_NODE(_kern, OID_AUTO, icl, CTLFLAG_RD, 0, "iSCSI Common Layer");
+int icl_debug = 1;
+SYSCTL_INT(_kern_icl, OID_AUTO, debug, CTLFLAG_RWTUN,
+    &icl_debug, 0, "Enable debug messages");
+
+static MALLOC_DEFINE(M_ICL, "icl", "iSCSI Common Layer");
+static struct icl_softc	*sc;
+
+static struct icl_module *
+icl_find(const char *name)
+{
+	struct icl_module *im, *im_max;
+
+	sx_assert(&sc->sc_lock, SA_LOCKED);
+
+	/*
+	 * If the name was not specified, pick a module with highest
+	 * priority.
+	 */
+	if (name == NULL || name[0] == '\0') {
+		im_max = TAILQ_FIRST(&sc->sc_modules);
+		TAILQ_FOREACH(im, &sc->sc_modules, im_next) {
+			if (im->im_priority > im_max->im_priority)
+				im_max = im;
+		}
+
+		return (im_max);
+	}
+
+	TAILQ_FOREACH(im, &sc->sc_modules, im_next) {
+		if (strcmp(im->im_name, name) == 0)
+			return (im);
+	}
+
+	return (NULL);
+}
+
+struct icl_conn *
+icl_new_conn(const char *offload, const char *name, struct mtx *lock)
+{
+	struct icl_module *im;
+	struct icl_conn *ic;
+
+	sx_slock(&sc->sc_lock);
+	im = icl_find(offload);
+
+	if (im == NULL) {
+		ICL_WARN("offload \"%s\" not found", offload);
+		sx_sunlock(&sc->sc_lock);
+		return (NULL);
+	}
+
+	ic = im->im_new_conn(name, lock);
+	sx_sunlock(&sc->sc_lock);
+
+	return (ic);
+}
+
+int
+icl_limits(const char *offload, size_t *limitp)
+{
+	struct icl_module *im;
+	int error;
+
+	sx_slock(&sc->sc_lock);
+	im = icl_find(offload);
+
+	if (im == NULL) {
+		ICL_WARN("offload \"%s\" not found", offload);
+		sx_sunlock(&sc->sc_lock);
+		return (ENXIO);
+	}
+
+	error = im->im_limits(limitp);
+	sx_sunlock(&sc->sc_lock);
+
+	return (error);
+}
+
+
+int
+icl_register(const char *offload, int priority, int (*limits)(size_t *),
+    struct icl_conn *(*new_conn)(const char *, struct mtx *))
+{
+	struct icl_module *im;
+
+	sx_xlock(&sc->sc_lock);
+	im = icl_find(offload);
+
+	if (im != NULL) {
+		ICL_WARN("offload \"%s\" already registered", offload);
+		sx_xunlock(&sc->sc_lock);
+		return (EBUSY);
+	}
+
+	im = malloc(sizeof(*im), M_ICL, M_ZERO | M_WAITOK);
+	im->im_name = strdup(offload, M_ICL);
+	im->im_priority = priority;
+	im->im_limits = limits;
+	im->im_new_conn = new_conn;
+
+	TAILQ_INSERT_HEAD(&sc->sc_modules, im, im_next);
+	sx_xunlock(&sc->sc_lock);
+
+	ICL_DEBUG("offload \"%s\" registered", offload);
+	return (0);
+}
+
+int
+icl_unregister(const char *offload)
+{
+	struct icl_module *im;
+
+	sx_xlock(&sc->sc_lock);
+	im = icl_find(offload);
+
+	if (im == NULL) {
+		ICL_WARN("offload \"%s\" not registered", offload);
+		sx_xunlock(&sc->sc_lock);
+		return (ENXIO);
+	}
+
+	TAILQ_REMOVE(&sc->sc_modules, im, im_next);
+	sx_xunlock(&sc->sc_lock);
+
+	free(im->im_name, M_ICL);
+	free(im, M_ICL);
+
+	ICL_DEBUG("offload \"%s\" unregistered", offload);
+	return (0);
+}
+
+static int
+icl_load(void)
+{
+
+	sc = malloc(sizeof(*sc), M_ICL, M_ZERO | M_WAITOK);
+	sx_init(&sc->sc_lock, "icl");
+	TAILQ_INIT(&sc->sc_modules);
+
+	return (0);
+}
+
+static int
+icl_unload(void)
+{
+
+	sx_slock(&sc->sc_lock);
+	KASSERT(TAILQ_EMPTY(&sc->sc_modules), ("still have modules"));
+	sx_sunlock(&sc->sc_lock);
+
+	sx_destroy(&sc->sc_lock);
+	free(sc, M_ICL);
+
+	return (0);
+}
+
+static int
+icl_modevent(module_t mod, int what, void *arg)
+{
+
+	switch (what) {
+	case MOD_LOAD:
+		return (icl_load());
+	case MOD_UNLOAD:
+		return (icl_unload());
+	default:
+		return (EINVAL);
+	}
+}
+
+moduledata_t icl_data = {
+	"icl",
+	icl_modevent,
+	0
+};
+
+DECLARE_MODULE(icl, icl_data, SI_SUB_DRIVERS, SI_ORDER_FIRST);
+MODULE_VERSION(icl, 1);

Modified: projects/clang360-import/sys/dev/iscsi/icl.h
==============================================================================
--- projects/clang360-import/sys/dev/iscsi/icl.h	Sat Jan 31 14:18:46 2015	(r277974)
+++ projects/clang360-import/sys/dev/iscsi/icl.h	Sat Jan 31 14:31:12 2015	(r277975)
@@ -37,7 +37,32 @@
  * and receive iSCSI PDUs.
  */
 
+#include <sys/types.h>
+#include <sys/kobj.h>
+#include <sys/condvar.h>
+#include <sys/sysctl.h>
+
+SYSCTL_DECL(_kern_icl);
+
+extern int icl_debug;
+
+#define	ICL_DEBUG(X, ...)						\
+	do {								\
+		if (icl_debug > 1)					\
+			printf("%s: " X "\n", __func__, ## __VA_ARGS__);\
+	} while (0)
+
+#define	ICL_WARN(X, ...)						\
+	do {								\
+		if (icl_debug > 0) {					\
+			printf("WARNING: %s: " X "\n",			\
+			    __func__, ## __VA_ARGS__);			\
+		}							\
+	} while (0)
+
 struct icl_conn;
+struct ccb_scsiio;
+union ctl_io;
 
 struct icl_pdu {
 	STAILQ_ENTRY(icl_pdu)	ip_next;
@@ -57,13 +82,6 @@ struct icl_pdu {
 	uint32_t		ip_prv2;
 };
 
-struct icl_pdu		*icl_pdu_new(struct icl_conn *ic, int flags);
-size_t			icl_pdu_data_segment_length(const struct icl_pdu *ip);
-int			icl_pdu_append_data(struct icl_pdu *ip, const void *addr, size_t len, int flags);
-void			icl_pdu_get_data(struct icl_pdu *ip, size_t off, void *addr, size_t len);
-void			icl_pdu_queue(struct icl_pdu *ip);
-void			icl_pdu_free(struct icl_pdu *ip);
-
 #define ICL_CONN_STATE_INVALID		0
 #define ICL_CONN_STATE_BHS		1
 #define ICL_CONN_STATE_AHS		2
@@ -74,6 +92,7 @@ void			icl_pdu_free(struct icl_pdu *ip);
 #define	ICL_MAX_DATA_SEGMENT_LENGTH	(128 * 1024)
 
 struct icl_conn {
+	KOBJ_FIELDS;
 	struct mtx		*ic_lock;
 	struct socket		*ic_socket;
 #ifdef DIAGNOSTIC
@@ -104,11 +123,14 @@ struct icl_conn {
 	void			*ic_prv0;
 };
 
-struct icl_conn		*icl_conn_new(const char *name, struct mtx *lock);
-void			icl_conn_free(struct icl_conn *ic);
-int			icl_conn_handoff(struct icl_conn *ic, int fd);
-void			icl_conn_close(struct icl_conn *ic);
-bool			icl_conn_connected(struct icl_conn *ic);
+struct icl_conn	*icl_new_conn(const char *offload, const char *name,
+		    struct mtx *lock);
+int		icl_limits(const char *offload, size_t *limitp);
+
+int		icl_register(const char *offload, int priority,
+		    int (*limits)(size_t *),
+		    struct icl_conn *(*new_conn)(const char *, struct mtx *));
+int		icl_unregister(const char *offload);
 
 #ifdef ICL_KERNEL_PROXY
 

Copied: projects/clang360-import/sys/dev/iscsi/icl_conn_if.m (from r277974, head/sys/dev/iscsi/icl_conn_if.m)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang360-import/sys/dev/iscsi/icl_conn_if.m	Sat Jan 31 14:31:12 2015	(r277975, copy of r277974, head/sys/dev/iscsi/icl_conn_if.m)
@@ -0,0 +1,87 @@
+#-
+# Copyright (c) 2014 The FreeBSD Foundation
+# All rights reserved.
+#
+# This software was developed by Edward Tomasz Napierala under sponsorship
+# from the FreeBSD Foundation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+#include <dev/iscsi/icl.h>
+
+INTERFACE icl_conn;
+
+METHOD size_t pdu_data_segment_length {
+	struct icl_conn *_ic;
+	const struct icl_pdu *_ip;
+};
+
+METHOD int pdu_append_data {
+	struct icl_conn *_ic;
+	struct icl_pdu *_ip;
+	const void *_addr;
+	size_t _len;
+	int _flags;
+};
+
+METHOD void pdu_get_data {
+	struct icl_conn *_ic;
+	struct icl_pdu *_ip;
+	size_t _off;
+	void *_addr;
+	size_t _len;
+};
+
+METHOD void pdu_queue {
+	struct icl_conn *_ic;
+	struct icl_pdu *_ip;
+};
+
+METHOD void pdu_free {
+	struct icl_conn *_ic;
+	struct icl_pdu *_ip;
+};
+
+METHOD struct icl_pdu * new_pdu {
+	struct icl_conn *_ic;
+	int _flags;
+};
+
+METHOD void free {
+	struct icl_conn *_ic;
+};
+
+METHOD int handoff {
+	struct icl_conn *_ic;
+	int _fd;
+};
+
+METHOD void close {
+	struct icl_conn *_ic;
+};
+
+METHOD bool connected {
+	struct icl_conn *_ic;
+};

Copied: projects/clang360-import/sys/dev/iscsi/icl_soft.c (from r277974, head/sys/dev/iscsi/icl_soft.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang360-import/sys/dev/iscsi/icl_soft.c	Sat Jan 31 14:31:12 2015	(r277975, copy of r277974, head/sys/dev/iscsi/icl_soft.c)
@@ -0,0 +1,1537 @@
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * iSCSI Common Layer.  It's used by both the initiator and target to send
+ * and receive iSCSI PDUs.

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list