Merge ^/head r277956 through r277974.

This commit is contained in:
Dimitry Andric 2015-01-31 14:31:12 +00:00
commit 6a0fc39710
35 changed files with 2117 additions and 1468 deletions

View File

@ -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 *origstatus)
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;

View File

@ -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;
}
}

View File

@ -153,9 +153,12 @@ proc_iter_objs(struct proc_handle *p, proc_map_f *func, void *cd)
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, proc_map_f *func, void *cd)
*/
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 *p, const char *object, int which,
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:

View File

@ -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 @@ a10_gpio_attach(device_t dev)
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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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 @@ rk30_gpio_attach(device_t dev)
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);
}

View File

@ -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

View File

@ -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);

View File

@ -258,6 +258,7 @@ ti_pruss_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr,
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);
}

View File

@ -175,7 +175,33 @@ __elfN(loadfile_raw)(char *filename, u_int64_t dest,
* 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_int64_t dest,
/* 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;

View File

@ -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)
{

View File

@ -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 *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 *req)
return;
}
port = &ct->ct_port;
// WAT
if (ct->ct_state == CFISCSI_TARGET_STATE_DYING)
goto done;

View File

@ -1521,6 +1521,7 @@ ipw_monitor.fw optional ipwmonitorfw | ipwfw \
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

View File

@ -6995,7 +6995,7 @@ static void ivb_pch_pwm_override(struct drm_device *dev)
*/
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)

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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;
};

1537
sys/dev/iscsi/icl_soft.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,116 @@
/*-
* 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$
*/
/*
* This file is used to provide the initiator and target with a prettier
* interface. It must not be included by ICL modules, such as icl_soft.c.
*/
#ifndef ICL_WRAPPERS_H
#define ICL_WRAPPERS_H
#include <sys/kobj.h>
#include <sys/condvar.h>
#include <dev/iscsi/icl.h>
#include <icl_conn_if.h>
static inline struct icl_pdu *
icl_pdu_new(struct icl_conn *ic, int flags)
{
return (ICL_CONN_NEW_PDU(ic, flags));
}
static inline size_t
icl_pdu_data_segment_length(const struct icl_pdu *ip)
{
return (ICL_CONN_PDU_DATA_SEGMENT_LENGTH(ip->ip_conn, ip));
}
static inline int
icl_pdu_append_data(struct icl_pdu *ip, const void *addr, size_t len, int flags)
{
return (ICL_CONN_PDU_APPEND_DATA(ip->ip_conn, ip, addr, len, flags));
}
static inline void
icl_pdu_get_data(struct icl_pdu *ip, size_t off, void *addr, size_t len)
{
ICL_CONN_PDU_GET_DATA(ip->ip_conn, ip, off, addr, len);
}
static inline void
icl_pdu_queue(struct icl_pdu *ip)
{
ICL_CONN_PDU_QUEUE(ip->ip_conn, ip);
}
static inline void
icl_pdu_free(struct icl_pdu *ip)
{
ICL_CONN_PDU_FREE(ip->ip_conn, ip);
}
static inline void
icl_conn_free(struct icl_conn *ic)
{
ICL_CONN_FREE(ic);
}
static inline int
icl_conn_handoff(struct icl_conn *ic, int fd)
{
return (ICL_CONN_HANDOFF(ic, fd));
}
static inline void
icl_conn_close(struct icl_conn *ic)
{
ICL_CONN_CLOSE(ic);
}
static inline bool
icl_conn_connected(struct icl_conn *ic)
{
return (ICL_CONN_CONNECTED(ic));
}
#endif /* !ICL_WRAPPERS_H */

View File

@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#include <cam/scsi/scsi_message.h>
#include <dev/iscsi/icl.h>
#include <dev/iscsi/icl_wrappers.h>
#include <dev/iscsi/iscsi_ioctl.h>
#include <dev/iscsi/iscsi_proto.h>
#include <dev/iscsi/iscsi.h>
@ -1730,7 +1731,7 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
return (EBUSY);
}
is->is_conn = icl_conn_new("iscsi", &is->is_lock);
is->is_conn = icl_new_conn(NULL, "iscsi", &is->is_lock);
is->is_conn->ic_receive = iscsi_receive_callback;
is->is_conn->ic_error = iscsi_error_callback;
is->is_conn->ic_prv0 = is;

View File

@ -734,7 +734,7 @@ uhid_attach(device_t dev)
if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE) {
sc->sc_repdesc_size = sizeof(uhid_graphire_report_descr);
sc->sc_repdesc_ptr = (void *)&uhid_graphire_report_descr;
sc->sc_repdesc_ptr = __DECONST(void *, &uhid_graphire_report_descr);
sc->sc_flags |= UHID_FLAG_STATIC_DESC;
} else if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE3_4X5) {
@ -755,7 +755,7 @@ uhid_attach(device_t dev)
usbd_errstr(error));
}
sc->sc_repdesc_size = sizeof(uhid_graphire3_4x5_report_descr);
sc->sc_repdesc_ptr = (void *)&uhid_graphire3_4x5_report_descr;
sc->sc_repdesc_ptr = __DECONST(void *, &uhid_graphire3_4x5_report_descr);
sc->sc_flags |= UHID_FLAG_STATIC_DESC;
}
} else if ((uaa->info.bInterfaceClass == UICLASS_VENDOR) &&
@ -775,7 +775,7 @@ uhid_attach(device_t dev)
}
/* the Xbox 360 gamepad has no report descriptor */
sc->sc_repdesc_size = sizeof(uhid_xb360gp_report_descr);
sc->sc_repdesc_ptr = (void *)&uhid_xb360gp_report_descr;
sc->sc_repdesc_ptr = __DECONST(void *, &uhid_xb360gp_report_descr);
sc->sc_flags |= UHID_FLAG_STATIC_DESC;
}
if (sc->sc_repdesc_ptr == NULL) {

View File

@ -1434,7 +1434,8 @@ tmpfs_check_mtime(struct vnode *vp)
if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) {
obj->flags &= ~OBJ_TMPFS_DIRTY;
node = VP_TO_TMPFS_NODE(vp);
node->tn_status |= TMPFS_NODE_MODIFIED;
node->tn_status |= TMPFS_NODE_MODIFIED |
TMPFS_NODE_CHANGED;
}
VM_OBJECT_WUNLOCK(obj);
}

View File

@ -453,7 +453,6 @@ tmpfs_write(struct vop_write_args *v)
struct tmpfs_node *node;
off_t oldsize;
int error, ioflag;
boolean_t extended;
vp = v->a_vp;
uio = v->a_uio;
@ -473,8 +472,7 @@ tmpfs_write(struct vop_write_args *v)
return (EFBIG);
if (vn_rlimit_fsize(vp, uio, uio->uio_td))
return (EFBIG);
extended = uio->uio_offset + uio->uio_resid > node->tn_size;
if (extended) {
if (uio->uio_offset + uio->uio_resid > node->tn_size) {
error = tmpfs_reg_resize(vp, uio->uio_offset + uio->uio_resid,
FALSE);
if (error != 0)
@ -483,7 +481,7 @@ tmpfs_write(struct vop_write_args *v)
error = uiomove_object(node->tn_reg.tn_aobj, node->tn_size, uio);
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
(extended ? TMPFS_NODE_CHANGED : 0);
TMPFS_NODE_CHANGED;
if (node->tn_mode & (S_ISUID | S_ISGID)) {
if (priv_check_cred(v->a_cred, PRIV_VFS_RETAINSUGID, 0))
node->tn_mode &= ~(S_ISUID | S_ISGID);

View File

@ -1302,6 +1302,47 @@ umtx_pi_adjust_thread(struct umtx_pi *pi, struct thread *td)
return (1);
}
static struct umtx_pi *
umtx_pi_next(struct umtx_pi *pi)
{
struct umtx_q *uq_owner;
if (pi->pi_owner == NULL)
return (NULL);
uq_owner = pi->pi_owner->td_umtxq;
if (uq_owner == NULL)
return (NULL);
return (uq_owner->uq_pi_blocked);
}
/*
* Floyd's Cycle-Finding Algorithm.
*/
static bool
umtx_pi_check_loop(struct umtx_pi *pi)
{
struct umtx_pi *pi1; /* fast iterator */
mtx_assert(&umtx_lock, MA_OWNED);
if (pi == NULL)
return (false);
pi1 = pi;
for (;;) {
pi = umtx_pi_next(pi);
if (pi == NULL)
break;
pi1 = umtx_pi_next(pi1);
if (pi1 == NULL)
break;
pi1 = umtx_pi_next(pi1);
if (pi1 == NULL)
break;
if (pi == pi1)
return (true);
}
return (false);
}
/*
* Propagate priority when a thread is blocked on POSIX
* PI mutex.
@ -1319,6 +1360,8 @@ umtx_propagate_priority(struct thread *td)
pi = uq->uq_pi_blocked;
if (pi == NULL)
return;
if (umtx_pi_check_loop(pi))
return;
for (;;) {
td = pi->pi_owner;
@ -1362,6 +1405,8 @@ umtx_repropagate_priority(struct umtx_pi *pi)
mtx_assert(&umtx_lock, MA_OWNED);
if (umtx_pi_check_loop(pi))
return;
while (pi != NULL && pi->pi_owner != NULL) {
pri = PRI_MAX;
uq_owner = pi->pi_owner->td_umtxq;
@ -1694,6 +1739,11 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags,
continue;
}
if ((owner & ~UMUTEX_CONTESTED) == id) {
error = EDEADLK;
break;
}
if (try != 0) {
error = EBUSY;
break;

View File

@ -341,7 +341,6 @@ static int
ar71xx_gpio_attach(device_t dev)
{
struct ar71xx_gpio_softc *sc = device_get_softc(dev);
int error = 0;
int i, j, maxpin;
int mask, pinon;
uint32_t oe;
@ -358,14 +357,14 @@ ar71xx_gpio_attach(device_t dev)
if (sc->gpio_mem_res == NULL) {
device_printf(dev, "couldn't map memory\n");
error = ENXIO;
ar71xx_gpio_detach(dev);
return(error);
return (ENXIO);
}
if ((sc->gpio_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
&sc->gpio_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) {
device_printf(dev, "unable to allocate IRQ resource\n");
ar71xx_gpio_detach(dev);
return (ENXIO);
}
@ -373,6 +372,7 @@ ar71xx_gpio_attach(device_t dev)
ar71xx_gpio_filter, ar71xx_gpio_intr, sc, &sc->gpio_ih))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
ar71xx_gpio_detach(dev);
return (ENXIO);
}
@ -447,12 +447,16 @@ ar71xx_gpio_detach(device_t dev)
KASSERT(mtx_initialized(&sc->gpio_mtx), ("gpio mutex not initialized"));
bus_generic_detach(dev);
if (sc->gpio_ih)
bus_teardown_intr(dev, sc->gpio_irq_res, sc->gpio_ih);
if (sc->gpio_irq_res)
bus_release_resource(dev, SYS_RES_IRQ, sc->gpio_irq_rid,
sc->gpio_irq_res);
if (sc->gpio_mem_res)
bus_release_resource(dev, SYS_RES_MEMORY, sc->gpio_mem_rid,
sc->gpio_mem_res);
free(sc->gpio_pins, M_DEVBUF);
if (sc->gpio_pins)
free(sc->gpio_pins, M_DEVBUF);
mtx_destroy(&sc->gpio_mtx);
return(0);

View File

@ -57,12 +57,12 @@
struct ar71xx_gpio_softc {
device_t dev;
struct mtx gpio_mtx;
struct resource *gpio_mem_res;
int gpio_mem_rid;
struct resource *gpio_irq_res;
int gpio_irq_rid;
void *gpio_ih;
struct mtx gpio_mtx;
struct resource *gpio_mem_res;
int gpio_mem_rid;
struct resource *gpio_irq_res;
int gpio_irq_rid;
void *gpio_ih;
int gpio_npins;
struct gpio_pin *gpio_pins;
};

View File

@ -383,6 +383,7 @@ octeon_gpio_attach(device_t dev)
OCTEON_IRQ_GPIO0 + i, OCTEON_IRQ_GPIO0 + i, 1,
RF_SHAREABLE | RF_ACTIVE)) == NULL) {
device_printf(dev, "unable to allocate IRQ resource\n");
octeon_gpio_detach(dev);
return (ENXIO);
}
@ -392,6 +393,7 @@ octeon_gpio_attach(device_t dev)
&(sc->gpio_intr_cookies[i]), &sc->gpio_ih[i]))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
octeon_gpio_detach(dev);
return (ENXIO);
}
}
@ -448,11 +450,14 @@ octeon_gpio_detach(device_t dev)
KASSERT(mtx_initialized(&sc->gpio_mtx), ("gpio mutex not initialized"));
for ( i = 0; i < OCTEON_GPIO_IRQS; i++) {
bus_release_resource(dev, SYS_RES_IRQ,
sc->gpio_irq_rid[i], sc->gpio_irq_res[i]);
if (sc->gpio_ih[i])
bus_teardown_intr(dev, sc->gpio_irq_res[i],
sc->gpio_ih[i]);
if (sc->gpio_irq_res[i])
bus_release_resource(dev, SYS_RES_IRQ,
sc->gpio_irq_rid[i], sc->gpio_irq_res[i]);
}
bus_generic_detach(dev);
mtx_destroy(&sc->gpio_mtx);
return(0);

View File

@ -43,11 +43,11 @@
struct octeon_gpio_softc {
device_t dev;
struct mtx gpio_mtx;
struct resource *gpio_irq_res[OCTEON_GPIO_IRQS];
int gpio_irq_rid[OCTEON_GPIO_IRQS];
void *gpio_ih[OCTEON_GPIO_IRQS];
void *gpio_intr_cookies[OCTEON_GPIO_IRQS];
struct mtx gpio_mtx;
struct resource *gpio_irq_res[OCTEON_GPIO_IRQS];
int gpio_irq_rid[OCTEON_GPIO_IRQS];
void *gpio_ih[OCTEON_GPIO_IRQS];
void *gpio_intr_cookies[OCTEON_GPIO_IRQS];
int gpio_npins;
struct gpio_pin gpio_pins[OCTEON_GPIO_PINS];
};

View File

@ -430,7 +430,7 @@ static int
rt305x_gpio_attach(device_t dev)
{
struct rt305x_gpio_softc *sc = device_get_softc(dev);
int error = 0, i;
int i;
uint64_t avlpins = 0;
sc->reset_gpio = DAP1350_RESET_GPIO;
@ -446,14 +446,14 @@ rt305x_gpio_attach(device_t dev)
if (sc->gpio_mem_res == NULL) {
device_printf(dev, "couldn't map memory\n");
error = ENXIO;
rt305x_gpio_detach(dev);
return(error);
return (ENXIO);
}
if ((sc->gpio_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
&sc->gpio_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) {
device_printf(dev, "unable to allocate IRQ resource\n");
rt305x_gpio_detach(dev);
return (ENXIO);
}
@ -462,6 +462,7 @@ rt305x_gpio_attach(device_t dev)
rt305x_gpio_intr, NULL, sc, &sc->gpio_ih))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
rt305x_gpio_detach(dev);
return (ENXIO);
}
@ -515,11 +516,14 @@ rt305x_gpio_detach(device_t dev)
KASSERT(mtx_initialized(&sc->gpio_mtx), ("gpio mutex not initialized"));
bus_generic_detach(dev);
if (sc->gpio_ih)
bus_teardown_intr(dev, sc->gpio_irq_res, sc->gpio_ih);
if (sc->gpio_irq_res)
bus_release_resource(dev, SYS_RES_IRQ, sc->gpio_irq_rid,
sc->gpio_irq_res);
if (sc->gpio_mem_res)
bus_release_resource(dev, SYS_RES_MEMORY, sc->gpio_mem_rid,
sc->gpio_mem_res);
mtx_destroy(&sc->gpio_mtx);
return(0);

View File

@ -30,12 +30,12 @@
struct rt305x_gpio_softc {
device_t dev;
struct mtx gpio_mtx;
struct resource *gpio_mem_res;
int gpio_mem_rid;
struct resource *gpio_irq_res;
int gpio_irq_rid;
void *gpio_ih;
struct mtx gpio_mtx;
struct resource *gpio_mem_res;
int gpio_mem_rid;
struct resource *gpio_irq_res;
int gpio_irq_rid;
void *gpio_ih;
int gpio_npins;
struct gpio_pin gpio_pins[NGPIO];
int reset_gpio;

View File

@ -22,8 +22,11 @@ SRCS+= scsi_ctl.c
SRCS+= bus_if.h
SRCS+= device_if.h
SRCS+= vnode_if.h
SRCS+= icl_conn_if.h
SRCS+= opt_cam.h
#CFLAGS+=-DICL_KERNEL_PROXY
MFILES= kern/bus_if.m kern/device_if.m dev/iscsi/icl_conn_if.m
.include <bsd.kmod.mk>

View File

@ -6,10 +6,15 @@ KMOD= iscsi
SRCS= iscsi.c
SRCS+= icl.c
SRCS+= icl_proxy.c
SRCS+= icl_soft.c
SRCS+= opt_cam.h
SRCS+= bus_if.h
SRCS+= device_if.h
SRCS+= icl_conn_if.c
SRCS+= icl_conn_if.h
#CFLAGS+=-DICL_KERNEL_PROXY
MFILES= kern/bus_if.m kern/device_if.m dev/iscsi/icl_conn_if.m
.include <bsd.kmod.mk>

View File

@ -752,6 +752,8 @@ extern pid_t pid_max;
#define STOPEVENT(p, e, v) do { \
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \
"checking stopevent %d", (e)); \
if ((p)->p_stops & (e)) { \
PROC_LOCK(p); \
stopevent((p), (e), (v)); \