summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/bus_if.m11
-rw-r--r--sys/kern/kern_event.c22
-rw-r--r--sys/kern/kern_physio.c2
-rw-r--r--sys/kern/subr_bus.c35
-rw-r--r--sys/kern/subr_intr.c4
-rw-r--r--sys/kern/vfs_subr.c3
6 files changed, 61 insertions, 16 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index e55b1ce..8acadd7 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -637,6 +637,17 @@ METHOD bus_dma_tag_t get_dma_tag {
} DEFAULT bus_generic_get_dma_tag;
/**
+ * @brief Returns bus_space_tag_t for use w/ devices on the bus.
+ *
+ * @param _dev the parent device of @p _child
+ * @param _child the device to which the tag will belong
+ */
+METHOD bus_space_tag_t get_bus_tag {
+ device_t _dev;
+ device_t _child;
+} DEFAULT bus_generic_get_bus_tag;
+
+/**
* @brief Allow the bus to determine the unit number of a device.
*
* @param _dev the parent device of @p _child
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 805b6b5..0b6f7da 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1116,6 +1116,9 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td, int wa
int error, filt, event;
int haskqglobal, filedesc_unlock;
+ if ((kev->flags & (EV_ENABLE | EV_DISABLE)) == (EV_ENABLE | EV_DISABLE))
+ return (EINVAL);
+
fp = NULL;
kn = NULL;
error = 0;
@@ -1320,27 +1323,24 @@ findkn:
* kn_knlist.
*/
done_ev_add:
- if ((kev->flags & EV_DISABLE) &&
- ((kn->kn_status & KN_DISABLED) == 0)) {
+ if ((kev->flags & EV_ENABLE) != 0)
+ kn->kn_status &= ~KN_DISABLED;
+ else if ((kev->flags & EV_DISABLE) != 0)
kn->kn_status |= KN_DISABLED;
- }
if ((kn->kn_status & KN_DISABLED) == 0)
event = kn->kn_fop->f_event(kn, 0);
else
event = 0;
+
KQ_LOCK(kq);
if (event)
- KNOTE_ACTIVATE(kn, 1);
+ kn->kn_status |= KN_ACTIVE;
+ if ((kn->kn_status & (KN_ACTIVE | KN_DISABLED | KN_QUEUED)) ==
+ KN_ACTIVE)
+ knote_enqueue(kn);
kn->kn_status &= ~(KN_INFLUX | KN_SCAN);
KN_LIST_UNLOCK(kn);
-
- if ((kev->flags & EV_ENABLE) && (kn->kn_status & KN_DISABLED)) {
- kn->kn_status &= ~KN_DISABLED;
- if ((kn->kn_status & KN_ACTIVE) &&
- ((kn->kn_status & KN_QUEUED) == 0))
- knote_enqueue(kn);
- }
KQ_UNLOCK_FLUX(kq);
done:
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index 5d75304..a148386 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -110,7 +110,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
error = 0;
for (i = 0; i < uio->uio_iovcnt; i++) {
while (uio->uio_iov[i].iov_len) {
- bzero(bp, sizeof(*bp));
+ g_reset_bio(bp);
if (uio->uio_rw == UIO_READ) {
bp->bio_cmd = BIO_READ;
curthread->td_ru.ru_inblock++;
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 6aca991..a144031 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3311,7 +3311,7 @@ resource_list_alloc(struct resource_list *rl, device_t bus, device_t child,
{
struct resource_list_entry *rle = NULL;
int passthrough = (device_get_parent(child) != bus);
- int isdefault = (start == 0UL && end == ~0UL);
+ int isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
if (passthrough) {
return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child,
@@ -4095,6 +4095,22 @@ bus_generic_get_dma_tag(device_t dev, device_t child)
}
/**
+ * @brief Helper function for implementing BUS_GET_BUS_TAG().
+ *
+ * This simple implementation of BUS_GET_BUS_TAG() simply calls the
+ * BUS_GET_BUS_TAG() method of the parent of @p dev.
+ */
+bus_space_tag_t
+bus_generic_get_bus_tag(device_t dev, device_t child)
+{
+
+ /* Propagate up the bus hierarchy until someone handles it. */
+ if (dev->parent != NULL)
+ return (BUS_GET_BUS_TAG(dev->parent, child));
+ return ((bus_space_tag_t)0);
+}
+
+/**
* @brief Helper function for implementing BUS_GET_RESOURCE().
*
* This implementation of BUS_GET_RESOURCE() uses the
@@ -4576,6 +4592,23 @@ bus_get_dma_tag(device_t dev)
}
/**
+ * @brief Wrapper function for BUS_GET_BUS_TAG().
+ *
+ * This function simply calls the BUS_GET_BUS_TAG() method of the
+ * parent of @p dev.
+ */
+bus_space_tag_t
+bus_get_bus_tag(device_t dev)
+{
+ device_t parent;
+
+ parent = device_get_parent(dev);
+ if (parent == NULL)
+ return ((bus_space_tag_t)0);
+ return (BUS_GET_BUS_TAG(parent, dev));
+}
+
+/**
* @brief Wrapper function for BUS_GET_DOMAIN().
*
* This function simply calls the BUS_GET_DOMAIN() method of the
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c
index 813f9ec..7b5b77d 100644
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -60,11 +60,11 @@ __FBSDID("$FreeBSD$");
#include <machine/smp.h>
#include <machine/stdarg.h>
+#ifdef FDT
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
-
-#include <dev/fdt/fdt_common.h>
+#endif
#ifdef DDB
#include <ddb/ddb.h>
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index b420c84..eaa4980 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1673,7 +1673,8 @@ bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn, daddr_t endn)
for (lblkno = startn;;) {
again:
bp = BUF_PCTRIE_LOOKUP_GE(&bufv->bv_root, lblkno);
- if (bp == NULL || bp->b_lblkno >= endn)
+ if (bp == NULL || bp->b_lblkno >= endn ||
+ bp->b_lblkno < startn)
break;
error = BUF_TIMELOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL |
LK_INTERLOCK, BO_LOCKPTR(bo), "brlsfl", 0, 0);
OpenPOWER on IntegriCloud