[Midnightbsd-cvs] src [9903] trunk/sys/sys: sync with freebsd 10-stable
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu May 24 18:43:30 EDT 2018
Revision: 9903
http://svnweb.midnightbsd.org/src/?rev=9903
Author: laffer1
Date: 2018-05-24 18:43:29 -0400 (Thu, 24 May 2018)
Log Message:
-----------
sync with freebsd 10-stable
Added Paths:
-----------
trunk/sys/sys/memdesc.h
trunk/sys/sys/seq.h
trunk/sys/sys/slicer.h
trunk/sys/sys/terminal.h
trunk/sys/sys/timeffc.h
trunk/sys/sys/vmem.h
Added: trunk/sys/sys/memdesc.h
===================================================================
--- trunk/sys/sys/memdesc.h (rev 0)
+++ trunk/sys/sys/memdesc.h 2018-05-24 22:43:29 UTC (rev 9903)
@@ -0,0 +1,157 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 EMC Corp.
+ * All rights reserved.
+ *
+ * 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: stable/10/sys/sys/memdesc.h 246713 2013-02-12 16:57:20Z kib $
+ */
+
+#ifndef _SYS_MEMDESC_H_
+#define _SYS_MEMDESC_H_
+
+struct bio;
+struct bus_dma_segment;
+struct uio;
+struct mbuf;
+union ccb;
+
+/*
+ * struct memdesc encapsulates various memory descriptors and provides
+ * abstract access to them.
+ */
+struct memdesc {
+ union {
+ void *md_vaddr;
+ vm_paddr_t md_paddr;
+ struct bus_dma_segment *md_list;
+ struct bio *md_bio;
+ struct uio *md_uio;
+ struct mbuf *md_mbuf;
+ union ccb *md_ccb;
+ } u;
+ size_t md_opaque; /* type specific data. */
+ uint32_t md_type; /* Type of memory. */
+};
+
+#define MEMDESC_VADDR 1 /* Contiguous virtual address. */
+#define MEMDESC_PADDR 2 /* Contiguous physical address. */
+#define MEMDESC_VLIST 3 /* scatter/gather list of kva addresses. */
+#define MEMDESC_PLIST 4 /* scatter/gather list of physical addresses. */
+#define MEMDESC_BIO 5 /* Pointer to a bio (block io). */
+#define MEMDESC_UIO 6 /* Pointer to a uio (any io). */
+#define MEMDESC_MBUF 7 /* Pointer to a mbuf (network io). */
+#define MEMDESC_CCB 8 /* Cam control block. (scsi/ata io). */
+
+static inline struct memdesc
+memdesc_vaddr(void *vaddr, size_t len)
+{
+ struct memdesc mem;
+
+ mem.u.md_vaddr = vaddr;
+ mem.md_opaque = len;
+ mem.md_type = MEMDESC_VADDR;
+
+ return (mem);
+}
+
+static inline struct memdesc
+memdesc_paddr(vm_paddr_t paddr, size_t len)
+{
+ struct memdesc mem;
+
+ mem.u.md_paddr = paddr;
+ mem.md_opaque = len;
+ mem.md_type = MEMDESC_PADDR;
+
+ return (mem);
+}
+
+static inline struct memdesc
+memdesc_vlist(struct bus_dma_segment *vlist, int sglist_cnt)
+{
+ struct memdesc mem;
+
+ mem.u.md_list = vlist;
+ mem.md_opaque = sglist_cnt;
+ mem.md_type = MEMDESC_VLIST;
+
+ return (mem);
+}
+
+static inline struct memdesc
+memdesc_plist(struct bus_dma_segment *plist, int sglist_cnt)
+{
+ struct memdesc mem;
+
+ mem.u.md_list = plist;
+ mem.md_opaque = sglist_cnt;
+ mem.md_type = MEMDESC_PLIST;
+
+ return (mem);
+}
+
+static inline struct memdesc
+memdesc_bio(struct bio *bio)
+{
+ struct memdesc mem;
+
+ mem.u.md_bio = bio;
+ mem.md_type = MEMDESC_BIO;
+
+ return (mem);
+}
+
+static inline struct memdesc
+memdesc_uio(struct uio *uio)
+{
+ struct memdesc mem;
+
+ mem.u.md_uio = uio;
+ mem.md_type = MEMDESC_UIO;
+
+ return (mem);
+}
+
+static inline struct memdesc
+memdesc_mbuf(struct mbuf *mbuf)
+{
+ struct memdesc mem;
+
+ mem.u.md_mbuf = mbuf;
+ mem.md_type = MEMDESC_MBUF;
+
+ return (mem);
+}
+
+static inline struct memdesc
+memdesc_ccb(union ccb *ccb)
+{
+ struct memdesc mem;
+
+ mem.u.md_ccb = ccb;
+ mem.md_type = MEMDESC_CCB;
+
+ return (mem);
+}
+#endif /* _SYS_MEMDESC_H_ */
Property changes on: trunk/sys/sys/memdesc.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/seq.h
===================================================================
--- trunk/sys/sys/seq.h (rev 0)
+++ trunk/sys/sys/seq.h 2018-05-24 22:43:29 UTC (rev 9903)
@@ -0,0 +1,147 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2014 Mateusz Guzik <mjg at FreeBSD.org>
+ *
+ * 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: stable/10/sys/sys/seq.h 273109 2014-10-14 21:19:23Z mjg $
+ */
+
+#ifndef _SYS_SEQ_H_
+#define _SYS_SEQ_H_
+
+#ifdef _KERNEL
+#include <sys/systm.h>
+#endif
+#include <sys/types.h>
+
+/*
+ * seq_t may be included in structs visible to userspace
+ */
+typedef uint32_t seq_t;
+
+#ifdef _KERNEL
+
+/*
+ * Typical usage:
+ *
+ * writers:
+ * lock_exclusive(&obj->lock);
+ * seq_write_begin(&obj->seq);
+ * .....
+ * seq_write_end(&obj->seq);
+ * unlock_exclusive(&obj->unlock);
+ *
+ * readers:
+ * obj_t lobj;
+ * seq_t seq;
+ *
+ * for (;;) {
+ * seq = seq_read(&gobj->seq);
+ * lobj = gobj;
+ * if (seq_consistent(&gobj->seq, seq))
+ * break;
+ * cpu_spinwait();
+ * }
+ * foo(lobj);
+ */
+
+/* A hack to get MPASS macro */
+#include <sys/lock.h>
+
+#include <machine/cpu.h>
+
+/*
+ * This is a temporary hack until memory barriers are cleaned up.
+ *
+ * atomic_load_acq_int at least on amd64 provides a full memory barrier,
+ * in a way which affects perforance.
+ *
+ * Hack below covers all architectures and avoids most of the penalty at least
+ * on amd64.
+ */
+static __inline int
+atomic_load_acq_rmb_int(volatile u_int *p)
+{
+ volatile u_int v;
+
+ v = *p;
+ atomic_load_acq_int(&v);
+ return (v);
+}
+
+static __inline bool
+seq_in_modify(seq_t seqp)
+{
+
+ return (seqp & 1);
+}
+
+static __inline void
+seq_write_begin(seq_t *seqp)
+{
+
+ MPASS(!seq_in_modify(*seqp));
+ atomic_add_acq_int(seqp, 1);
+}
+
+static __inline void
+seq_write_end(seq_t *seqp)
+{
+
+ atomic_add_rel_int(seqp, 1);
+ MPASS(!seq_in_modify(*seqp));
+}
+
+static __inline seq_t
+seq_read(seq_t *seqp)
+{
+ seq_t ret;
+
+ for (;;) {
+ ret = atomic_load_acq_rmb_int(seqp);
+ if (seq_in_modify(ret)) {
+ cpu_spinwait();
+ continue;
+ }
+ break;
+ }
+
+ return (ret);
+}
+
+static __inline seq_t
+seq_consistent(seq_t *seqp, seq_t oldseq)
+{
+
+ return (atomic_load_acq_rmb_int(seqp) == oldseq);
+}
+
+static __inline seq_t
+seq_consistent_nomb(seq_t *seqp, seq_t oldseq)
+{
+
+ return (*seqp == oldseq);
+}
+
+#endif /* _KERNEL */
+#endif /* _SYS_SEQ_H_ */
Property changes on: trunk/sys/sys/seq.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/slicer.h
===================================================================
--- trunk/sys/sys/slicer.h (rev 0)
+++ trunk/sys/sys/slicer.h 2018-05-24 22:43:29 UTC (rev 9903)
@@ -0,0 +1,65 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Semihalf.
+ * All rights reserved.
+ *
+ * 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: stable/10/sys/sys/slicer.h 318159 2017-05-10 21:42:16Z marius $
+ */
+
+#ifndef _FLASH_SLICER_H_
+#define _FLASH_SLICER_H_
+
+#include <sys/types.h>
+
+#define FLASH_SLICES_MAX_NUM 8
+#define FLASH_SLICES_MAX_NAME_LEN (32 + 1)
+
+#define FLASH_SLICES_FLAG_NONE 0
+#define FLASH_SLICES_FLAG_RO 1 /* Read only */
+
+#define FLASH_SLICES_FMT "%ss.%s"
+
+struct flash_slice {
+ off_t base;
+ off_t size;
+ const char *label;
+ unsigned int flags;
+};
+
+#ifdef _KERNEL
+
+typedef int (*flash_slicer_t)(device_t dev, const char *provider,
+ struct flash_slice *slices, int *slices_num);
+
+#define FLASH_SLICES_TYPE_NAND 0
+#define FLASH_SLICES_TYPE_CFI 1
+#define FLASH_SLICES_TYPE_SPI 2
+#define FLASH_SLICES_TYPE_MMC 3
+
+/* Use NULL for deregistering a slicer */
+void flash_register_slicer(flash_slicer_t slicer, u_int type, bool force);
+
+#endif /* _KERNEL */
+
+#endif /* _FLASH_SLICER_H_ */
Property changes on: trunk/sys/sys/slicer.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/terminal.h
===================================================================
--- trunk/sys/sys/terminal.h (rev 0)
+++ trunk/sys/sys/terminal.h 2018-05-24 22:43:29 UTC (rev 9903)
@@ -0,0 +1,235 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2009 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Ed Schouten 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: stable/10/sys/sys/terminal.h 274860 2014-11-22 16:55:55Z dumbbell $
+ */
+
+#ifndef _SYS_TERMINAL_H_
+#define _SYS_TERMINAL_H_
+
+#include <sys/param.h>
+#include <sys/_lock.h>
+#include <sys/_mutex.h>
+#include <sys/cons.h>
+#include <sys/linker_set.h>
+#include <sys/ttycom.h>
+
+#include <teken/teken.h>
+
+#include "opt_syscons.h"
+#include "opt_teken.h"
+
+struct terminal;
+struct thread;
+struct tty;
+
+/*
+ * The terminal layer is an abstraction on top of the TTY layer and the
+ * console interface. It can be used by system console drivers to
+ * easily interact with the kernel console and TTYs.
+ *
+ * Terminals contain terminal emulators, which means console drivers
+ * don't need to implement their own terminal emulator. The terminal
+ * emulator deals with UTF-8 exclusively. This means that term_char_t,
+ * the data type used to store input/output characters will always
+ * contain Unicode codepoints.
+ *
+ * To save memory usage, the top bits of term_char_t will contain other
+ * attributes, like colors. Right now term_char_t is composed as
+ * follows:
+ *
+ * Bits Meaning
+ * 0-20: Character value
+ * 21-25: Bold, underline, blink, reverse, right part of CJK fullwidth character
+ * 26-28: Foreground color
+ * 29-31: Background color
+ */
+
+typedef uint32_t term_char_t;
+#define TCHAR_CHARACTER(c) ((c) & 0x1fffff)
+#define TCHAR_FORMAT(c) (((c) >> 21) & 0x1f)
+#define TCHAR_FGCOLOR(c) (((c) >> 26) & 0x7)
+#define TCHAR_BGCOLOR(c) (((c) >> 29) & 0x7)
+
+typedef teken_attr_t term_attr_t;
+
+typedef teken_color_t term_color_t;
+#define TCOLOR_FG(c) (((c) & 0x7) << 26)
+#define TCOLOR_BG(c) (((c) & 0x7) << 29)
+#define TCOLOR_LIGHT(c) ((c) | 0x8)
+#define TCOLOR_DARK(c) ((c) & ~0x8)
+
+#define TFORMAT(c) (((c) & 0x1f) << 21)
+
+/* syscons(4) compatible color attributes for foreground text */
+#define FG_BLACK TCOLOR_FG(TC_BLACK)
+#define FG_BLUE TCOLOR_FG(TC_BLUE)
+#define FG_GREEN TCOLOR_FG(TC_GREEN)
+#define FG_CYAN TCOLOR_FG(TC_CYAN)
+#define FG_RED TCOLOR_FG(TC_RED)
+#define FG_MAGENTA TCOLOR_FG(TC_MAGENTA)
+#define FG_BROWN TCOLOR_FG(TC_BROWN)
+#define FG_LIGHTGREY TCOLOR_FG(TC_WHITE)
+#define FG_DARKGREY (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_BLACK))
+#define FG_LIGHTBLUE (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_BLUE))
+#define FG_LIGHTGREEN (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_GREEN))
+#define FG_LIGHTCYAN (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_CYAN))
+#define FG_LIGHTRED (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_RED))
+#define FG_LIGHTMAGENTA (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_MAGENTA))
+#define FG_YELLOW (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_BROWN))
+#define FG_WHITE (TFORMAT(TF_BOLD) | TCOLOR_FG(TC_WHITE))
+#define FG_BLINK TFORMAT(TF_BLINK)
+
+/* syscons(4) compatible color attributes for text background */
+#define BG_BLACK TCOLOR_BG(TC_BLACK)
+#define BG_BLUE TCOLOR_BG(TC_BLUE)
+#define BG_GREEN TCOLOR_BG(TC_GREEN)
+#define BG_CYAN TCOLOR_BG(TC_CYAN)
+#define BG_RED TCOLOR_BG(TC_RED)
+#define BG_MAGENTA TCOLOR_BG(TC_MAGENTA)
+#define BG_BROWN TCOLOR_BG(TC_BROWN)
+#define BG_LIGHTGREY TCOLOR_BG(TC_WHITE)
+#define BG_DARKGREY (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_BLACK))
+#define BG_LIGHTBLUE (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_BLUE))
+#define BG_LIGHTGREEN (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_GREEN))
+#define BG_LIGHTCYAN (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_CYAN))
+#define BG_LIGHTRED (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_RED))
+#define BG_LIGHTMAGENTA (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_MAGENTA))
+#define BG_YELLOW (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_BROWN))
+#define BG_WHITE (TFORMAT(TF_BOLD) | TCOLOR_BG(TC_WHITE))
+
+#ifndef TERMINAL_NORM_ATTR
+#ifdef SC_NORM_ATTR
+#define TERMINAL_NORM_ATTR SC_NORM_ATTR
+#else
+#define TERMINAL_NORM_ATTR (FG_LIGHTGREY | BG_BLACK)
+#endif
+#endif
+
+#ifndef TERMINAL_KERN_ATTR
+#ifdef SC_KERNEL_CONS_ATTR
+#define TERMINAL_KERN_ATTR SC_KERNEL_CONS_ATTR
+#else
+#define TERMINAL_KERN_ATTR (FG_WHITE | BG_BLACK)
+#endif
+#endif
+
+typedef teken_pos_t term_pos_t;
+typedef teken_rect_t term_rect_t;
+
+typedef void tc_cursor_t(struct terminal *tm, const term_pos_t *p);
+typedef void tc_putchar_t(struct terminal *tm, const term_pos_t *p,
+ term_char_t c);
+typedef void tc_fill_t(struct terminal *tm, const term_rect_t *r,
+ term_char_t c);
+typedef void tc_copy_t(struct terminal *tm, const term_rect_t *r,
+ const term_pos_t *p);
+typedef void tc_param_t(struct terminal *tm, int cmd, unsigned int arg);
+typedef void tc_done_t(struct terminal *tm);
+
+typedef void tc_cnprobe_t(struct terminal *tm, struct consdev *cd);
+typedef int tc_cngetc_t(struct terminal *tm);
+
+typedef void tc_cngrab_t(struct terminal *tm);
+typedef void tc_cnungrab_t(struct terminal *tm);
+
+typedef void tc_opened_t(struct terminal *tm, int opened);
+typedef int tc_ioctl_t(struct terminal *tm, u_long cmd, caddr_t data,
+ struct thread *td);
+typedef int tc_mmap_t(struct terminal *tm, vm_ooffset_t offset,
+ vm_paddr_t * paddr, int nprot, vm_memattr_t *memattr);
+typedef void tc_bell_t(struct terminal *tm);
+
+struct terminal_class {
+ /* Terminal emulator. */
+ tc_cursor_t *tc_cursor;
+ tc_putchar_t *tc_putchar;
+ tc_fill_t *tc_fill;
+ tc_copy_t *tc_copy;
+ tc_param_t *tc_param;
+ tc_done_t *tc_done;
+
+ /* Low-level console interface. */
+ tc_cnprobe_t *tc_cnprobe;
+ tc_cngetc_t *tc_cngetc;
+
+ /* DDB & panic handling. */
+ tc_cngrab_t *tc_cngrab;
+ tc_cnungrab_t *tc_cnungrab;
+
+ /* Misc. */
+ tc_opened_t *tc_opened;
+ tc_ioctl_t *tc_ioctl;
+ tc_mmap_t *tc_mmap;
+ tc_bell_t *tc_bell;
+};
+
+struct terminal {
+ const struct terminal_class *tm_class;
+ void *tm_softc;
+ struct mtx tm_mtx;
+ struct tty *tm_tty;
+ teken_t tm_emulator;
+ struct winsize tm_winsize;
+ unsigned int tm_flags;
+#define TF_MUTE 0x1 /* Drop incoming data. */
+#define TF_BELL 0x2 /* Bell needs to be sent. */
+#define TF_CONS 0x4 /* Console device (needs spinlock). */
+ struct consdev *consdev;
+};
+
+#ifdef _KERNEL
+
+struct terminal *terminal_alloc(const struct terminal_class *tc, void *softc);
+void terminal_maketty(struct terminal *tm, const char *fmt, ...);
+void terminal_set_cursor(struct terminal *tm, const term_pos_t *pos);
+void terminal_set_winsize_blank(struct terminal *tm,
+ const struct winsize *size, int blank, const term_attr_t *attr);
+void terminal_set_winsize(struct terminal *tm, const struct winsize *size);
+void terminal_mute(struct terminal *tm, int yes);
+void terminal_input_char(struct terminal *tm, term_char_t c);
+void terminal_input_raw(struct terminal *tm, char c);
+void terminal_input_special(struct terminal *tm, unsigned int k);
+
+void termcn_cnregister(struct terminal *tm);
+
+/* Kernel console helper interface. */
+extern const struct consdev_ops termcn_cnops;
+
+#define TERMINAL_DECLARE_EARLY(name, class, softc) \
+ static struct terminal name = { \
+ .tm_class = &class, \
+ .tm_softc = softc, \
+ .tm_flags = TF_CONS, \
+ }; \
+ CONSOLE_DEVICE(name ## _consdev, termcn_cnops, &name)
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_TERMINAL_H_ */
Property changes on: trunk/sys/sys/terminal.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/timeffc.h
===================================================================
--- trunk/sys/sys/timeffc.h (rev 0)
+++ trunk/sys/sys/timeffc.h 2018-05-24 22:43:29 UTC (rev 9903)
@@ -0,0 +1,390 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2011 The University of Melbourne
+ * All rights reserved.
+ *
+ * This software was developed by Julien Ridoux at the University of Melbourne
+ * 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: stable/10/sys/sys/timeffc.h 228856 2011-12-24 01:32:01Z lstewart $
+ */
+
+#ifndef _SYS_TIMEFF_H_
+#define _SYS_TIMEFF_H_
+
+#include <sys/_ffcounter.h>
+
+/*
+ * Feed-forward clock estimate
+ * Holds time mark as a ffcounter and conversion to bintime based on current
+ * timecounter period and offset estimate passed by the synchronization daemon.
+ * Provides time of last daemon update, clock status and bound on error.
+ */
+struct ffclock_estimate {
+ struct bintime update_time; /* Time of last estimates update. */
+ ffcounter update_ffcount; /* Counter value at last update. */
+ ffcounter leapsec_next; /* Counter value of next leap second. */
+ uint64_t period; /* Estimate of counter period. */
+ uint32_t errb_abs; /* Bound on absolute clock error [ns]. */
+ uint32_t errb_rate; /* Bound on counter rate error [ps/s]. */
+ uint32_t status; /* Clock status. */
+ int16_t leapsec_total; /* All leap seconds seen so far. */
+ int8_t leapsec; /* Next leap second (in {-1,0,1}). */
+};
+
+#if __BSD_VISIBLE
+#ifdef _KERNEL
+
+/* Define the kern.sysclock sysctl tree. */
+SYSCTL_DECL(_kern_sysclock);
+
+/* Define the kern.sysclock.ffclock sysctl tree. */
+SYSCTL_DECL(_kern_sysclock_ffclock);
+
+/*
+ * Index into the sysclocks array for obtaining the ASCII name of a particular
+ * sysclock.
+ */
+#define SYSCLOCK_FBCK 0
+#define SYSCLOCK_FFWD 1
+extern int sysclock_active;
+
+/*
+ * Parameters of counter characterisation required by feed-forward algorithms.
+ */
+#define FFCLOCK_SKM_SCALE 1024
+
+/*
+ * Feed-forward clock status
+ */
+#define FFCLOCK_STA_UNSYNC 1
+#define FFCLOCK_STA_WARMUP 2
+
+/*
+ * Flags for use by sysclock_snap2bintime() and various ffclock_ functions to
+ * control how the timecounter hardware is read and how the hardware snapshot is
+ * converted into absolute time.
+ * {FB|FF}CLOCK_FAST: Do not read the hardware counter, instead using the
+ * value at last tick. The time returned has a resolution
+ * of the kernel tick timer (1/hz [s]).
+ * FFCLOCK_LERP: Linear interpolation of ffclock time to guarantee
+ * monotonic time.
+ * FFCLOCK_LEAPSEC: Include leap seconds.
+ * {FB|FF}CLOCK_UPTIME: Time stamp should be relative to system boot, not epoch.
+ */
+#define FFCLOCK_FAST 0x00000001
+#define FFCLOCK_LERP 0x00000002
+#define FFCLOCK_LEAPSEC 0x00000004
+#define FFCLOCK_UPTIME 0x00000008
+#define FFCLOCK_MASK 0x0000ffff
+
+#define FBCLOCK_FAST 0x00010000 /* Currently unused. */
+#define FBCLOCK_UPTIME 0x00020000
+#define FBCLOCK_MASK 0xffff0000
+
+/*
+ * Feedback clock specific info structure. The feedback clock's estimation of
+ * clock error is an absolute figure determined by the NTP algorithm. The status
+ * is determined by the userland daemon.
+ */
+struct fbclock_info {
+ struct bintime error;
+ struct bintime tick_time;
+ uint64_t th_scale;
+ int status;
+};
+
+/*
+ * Feed-forward clock specific info structure. The feed-forward clock's
+ * estimation of clock error is an upper bound, which although potentially
+ * looser than the feedback clock equivalent, is much more reliable. The status
+ * is determined by the userland daemon.
+ */
+struct ffclock_info {
+ struct bintime error;
+ struct bintime tick_time;
+ struct bintime tick_time_lerp;
+ uint64_t period;
+ uint64_t period_lerp;
+ int leapsec_adjustment;
+ int status;
+};
+
+/*
+ * Snapshot of system clocks and related information. Holds time read from each
+ * clock based on a single read of the active hardware timecounter, as well as
+ * respective clock information such as error estimates and the ffcounter value
+ * at the time of the read.
+ */
+struct sysclock_snap {
+ struct fbclock_info fb_info;
+ struct ffclock_info ff_info;
+ ffcounter ffcount;
+ unsigned int delta;
+ int sysclock_active;
+};
+
+/* Take a snapshot of the system clocks and related information. */
+void sysclock_getsnapshot(struct sysclock_snap *clock_snap, int fast);
+
+/* Convert a timestamp from the selected system clock into bintime. */
+int sysclock_snap2bintime(struct sysclock_snap *cs, struct bintime *bt,
+ int whichclock, uint32_t flags);
+
+/* Resets feed-forward clock from RTC */
+void ffclock_reset_clock(struct timespec *ts);
+
+/*
+ * Return the current value of the feed-forward clock counter. Essential to
+ * measure time interval in counter units. If a fast timecounter is used by the
+ * system, may also allow fast but accurate timestamping.
+ */
+void ffclock_read_counter(ffcounter *ffcount);
+
+/*
+ * Retrieve feed-forward counter value and time of last kernel tick. This
+ * accepts the FFCLOCK_LERP flag.
+ */
+void ffclock_last_tick(ffcounter *ffcount, struct bintime *bt, uint32_t flags);
+
+/*
+ * Low level routines to convert a counter timestamp into absolute time and a
+ * counter timestamp interval into an interval in seconds. The absolute time
+ * conversion accepts the FFCLOCK_LERP flag.
+ */
+void ffclock_convert_abs(ffcounter ffcount, struct bintime *bt, uint32_t flags);
+void ffclock_convert_diff(ffcounter ffdelta, struct bintime *bt);
+
+/*
+ * Feed-forward clock routines.
+ *
+ * These functions rely on the timecounters and ffclock_estimates stored in
+ * fftimehands. Note that the error_bound parameter is not the error of the
+ * clock but an upper bound on the error of the absolute time or time interval
+ * returned.
+ *
+ * ffclock_abstime(): retrieves current time as counter value and convert this
+ * timestamp in seconds. The value (in seconds) of the converted timestamp
+ * depends on the flags passed: for a given counter value, different
+ * conversions are possible. Different clock models can be selected by
+ * combining flags (for example (FFCLOCK_LERP|FFCLOCK_UPTIME) produces
+ * linearly interpolated uptime).
+ * ffclock_difftime(): computes a time interval in seconds based on an interval
+ * measured in ffcounter units. This should be the preferred way to measure
+ * small time intervals very accurately.
+ */
+void ffclock_abstime(ffcounter *ffcount, struct bintime *bt,
+ struct bintime *error_bound, uint32_t flags);
+void ffclock_difftime(ffcounter ffdelta, struct bintime *bt,
+ struct bintime *error_bound);
+
+/*
+ * Wrapper routines to return current absolute time using the feed-forward
+ * clock. These functions are named after those defined in <sys/time.h>, which
+ * contains a description of the original ones.
+ */
+void ffclock_bintime(struct bintime *bt);
+void ffclock_nanotime(struct timespec *tsp);
+void ffclock_microtime(struct timeval *tvp);
+
+void ffclock_getbintime(struct bintime *bt);
+void ffclock_getnanotime(struct timespec *tsp);
+void ffclock_getmicrotime(struct timeval *tvp);
+
+void ffclock_binuptime(struct bintime *bt);
+void ffclock_nanouptime(struct timespec *tsp);
+void ffclock_microuptime(struct timeval *tvp);
+
+void ffclock_getbinuptime(struct bintime *bt);
+void ffclock_getnanouptime(struct timespec *tsp);
+void ffclock_getmicrouptime(struct timeval *tvp);
+
+/*
+ * Wrapper routines to convert a time interval specified in ffcounter units into
+ * seconds using the current feed-forward clock estimates.
+ */
+void ffclock_bindifftime(ffcounter ffdelta, struct bintime *bt);
+void ffclock_nanodifftime(ffcounter ffdelta, struct timespec *tsp);
+void ffclock_microdifftime(ffcounter ffdelta, struct timeval *tvp);
+
+/*
+ * When FFCLOCK is enabled in the kernel, [get]{bin,nano,micro}[up]time() become
+ * wrappers around equivalent feedback or feed-forward functions. Provide access
+ * outside of kern_tc.c to the feedback clock equivalent functions for
+ * specialised use i.e. these are not for general consumption.
+ */
+void fbclock_bintime(struct bintime *bt);
+void fbclock_nanotime(struct timespec *tsp);
+void fbclock_microtime(struct timeval *tvp);
+
+void fbclock_getbintime(struct bintime *bt);
+void fbclock_getnanotime(struct timespec *tsp);
+void fbclock_getmicrotime(struct timeval *tvp);
+
+void fbclock_binuptime(struct bintime *bt);
+void fbclock_nanouptime(struct timespec *tsp);
+void fbclock_microuptime(struct timeval *tvp);
+
+void fbclock_getbinuptime(struct bintime *bt);
+void fbclock_getnanouptime(struct timespec *tsp);
+void fbclock_getmicrouptime(struct timeval *tvp);
+
+/*
+ * Public system clock wrapper API which allows consumers to select which clock
+ * to obtain time from, independent of the current default system clock. These
+ * wrappers should be used instead of directly calling the underlying fbclock_
+ * or ffclock_ functions.
+ */
+static inline void
+bintime_fromclock(struct bintime *bt, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_bintime(bt);
+ else
+ fbclock_bintime(bt);
+}
+
+static inline void
+nanotime_fromclock(struct timespec *tsp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_nanotime(tsp);
+ else
+ fbclock_nanotime(tsp);
+}
+
+static inline void
+microtime_fromclock(struct timeval *tvp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_microtime(tvp);
+ else
+ fbclock_microtime(tvp);
+}
+
+static inline void
+getbintime_fromclock(struct bintime *bt, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_getbintime(bt);
+ else
+ fbclock_getbintime(bt);
+}
+
+static inline void
+getnanotime_fromclock(struct timespec *tsp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_getnanotime(tsp);
+ else
+ fbclock_getnanotime(tsp);
+}
+
+static inline void
+getmicrotime_fromclock(struct timeval *tvp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_getmicrotime(tvp);
+ else
+ fbclock_getmicrotime(tvp);
+}
+
+static inline void
+binuptime_fromclock(struct bintime *bt, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_binuptime(bt);
+ else
+ fbclock_binuptime(bt);
+}
+
+static inline void
+nanouptime_fromclock(struct timespec *tsp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_nanouptime(tsp);
+ else
+ fbclock_nanouptime(tsp);
+}
+
+static inline void
+microuptime_fromclock(struct timeval *tvp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_microuptime(tvp);
+ else
+ fbclock_microuptime(tvp);
+}
+
+static inline void
+getbinuptime_fromclock(struct bintime *bt, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_getbinuptime(bt);
+ else
+ fbclock_getbinuptime(bt);
+}
+
+static inline void
+getnanouptime_fromclock(struct timespec *tsp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_getnanouptime(tsp);
+ else
+ fbclock_getnanouptime(tsp);
+}
+
+static inline void
+getmicrouptime_fromclock(struct timeval *tvp, int whichclock)
+{
+
+ if (whichclock == SYSCLOCK_FFWD)
+ ffclock_getmicrouptime(tvp);
+ else
+ fbclock_getmicrouptime(tvp);
+}
+
+#else /* !_KERNEL */
+
+/* Feed-Forward Clock system calls. */
+__BEGIN_DECLS
+int ffclock_getcounter(ffcounter *ffcount);
+int ffclock_getestimate(struct ffclock_estimate *cest);
+int ffclock_setestimate(struct ffclock_estimate *cest);
+__END_DECLS
+
+#endif /* _KERNEL */
+#endif /* __BSD_VISIBLE */
+#endif /* _SYS_TIMEFF_H_ */
Property changes on: trunk/sys/sys/timeffc.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/vmem.h
===================================================================
--- trunk/sys/sys/vmem.h (rev 0)
+++ trunk/sys/sys/vmem.h 2018-05-24 22:43:29 UTC (rev 9903)
@@ -0,0 +1,137 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c)2006 YAMAMOTO Takashi,
+ * All rights reserved.
+ *
+ * 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.
+ */
+/* From $NetBSD: vmem.h,v 1.20 2013/01/29 21:26:24 para Exp $ */
+
+/* $FreeBSD: stable/10/sys/sys/vmem.h 282361 2015-05-03 07:13:14Z mav $ */
+
+#ifndef _SYS_VMEM_H_
+#define _SYS_VMEM_H_
+
+#include <sys/types.h>
+
+#ifdef _KERNEL
+
+typedef struct vmem vmem_t;
+
+typedef uintptr_t vmem_addr_t;
+typedef size_t vmem_size_t;
+
+#define VMEM_ADDR_MIN 0
+#define VMEM_ADDR_MAX (~(vmem_addr_t)0)
+
+typedef int (vmem_import_t)(void *, vmem_size_t, int, vmem_addr_t *);
+typedef void (vmem_release_t)(void *, vmem_addr_t, vmem_size_t);
+typedef void (vmem_reclaim_t)(vmem_t *, int);
+
+/*
+ * Create a vmem:
+ * name - Name of the region
+ * base - Initial span start (optional)
+ * size - Initial span size
+ * quantum - Natural unit of allocation (ie PAGE_SIZE, 1, etc)
+ * qcache_max - Maximum size to quantum cache. This creates a UMA
+ * cache for each multiple of quantum up to qcache_max.
+ * flags - M_* flags
+ */
+vmem_t *vmem_create(const char *name, vmem_addr_t base,
+ vmem_size_t size, vmem_size_t quantum, vmem_size_t qcache_max, int flags);
+vmem_t *vmem_init(vmem_t *vm, const char *name, vmem_addr_t base,
+ vmem_size_t size, vmem_size_t quantum, vmem_size_t qcache_max, int flags);
+void vmem_destroy(vmem_t *);
+
+/*
+ * Set callbacks for bringing in dynamic regions:
+ * importfn - Backing store import routine.
+ * releasefn - Backing store release routine.
+ * arg - Backing store argument
+ * import_quantum - Size to import from backing store
+ */
+
+void vmem_set_import(vmem_t *vm, vmem_import_t *importfn,
+ vmem_release_t *releasefn, void *arg, vmem_size_t import_quantum);
+
+/*
+ * Set a callback for reclaiming memory when space is exhausted:
+ */
+void vmem_set_reclaim(vmem_t *vm, vmem_reclaim_t *reclaimfn);
+
+/*
+ * Allocate and free linear regions from a vmem. Must specify
+ * BESTFIT or FIRSTFIT. Free is non-blocking. These routines
+ * respect the quantum caches.
+ */
+int vmem_alloc(vmem_t *vm, vmem_size_t size, int flags, vmem_addr_t *addrp);
+void vmem_free(vmem_t *vm, vmem_addr_t addr, vmem_size_t size);
+
+/*
+ * Constrained allocate and free routines. These bypass the quantum cache.
+ * size - Size in units of 1, not quantum.
+ * align - Required alignment of the start of region
+ * phase - Offset from alignment
+ * nocross - Illegal boundary
+ * minaddr - Minimum allowed address for last byte
+ * maxaddr - Maximum allowed address for first byte
+ * flags - M_* flags
+ * addrp - result
+ */
+int vmem_xalloc(vmem_t *vm, vmem_size_t size, vmem_size_t align,
+ vmem_size_t phase, vmem_size_t nocross, vmem_addr_t minaddr,
+ vmem_addr_t maxaddr, int flags, vmem_addr_t *addrp);
+void vmem_xfree(vmem_t *vm, vmem_addr_t addr, vmem_size_t size);
+
+/*
+ * Add a static region to a vmem after create. This won't be freed
+ * until the vmem is destroyed.
+ */
+int vmem_add(vmem_t *vm, vmem_addr_t addr, vmem_size_t size, int flags);
+
+/*
+ * Given roundup size to the vmem's native quantum size.
+ */
+vmem_size_t vmem_roundup_size(vmem_t *vm, vmem_size_t size);
+
+/*
+ * Report vmem utilization according to the requested type.
+ */
+vmem_size_t vmem_size(vmem_t *vm, int typemask);
+
+void vmem_whatis(vmem_addr_t addr, int (*fn)(const char *, ...)
+ __printflike(1, 2));
+void vmem_print(vmem_addr_t addr, const char *, int (*fn)(const char *, ...)
+ __printflike(1, 2));
+void vmem_printall(const char *, int (*fn)(const char *, ...)
+ __printflike(1, 2));
+void vmem_startup(void);
+
+/* vmem_size typemask */
+#define VMEM_ALLOC 0x01
+#define VMEM_FREE 0x02
+#define VMEM_MAXFREE 0x10
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_VMEM_H_ */
Property changes on: trunk/sys/sys/vmem.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list