Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/sys/dev/dmover Add standard names for 5-, 6-, 7-, and 8...



details:   https://anonhg.NetBSD.org/src/rev/32ccc4b8473a
branches:  nathanw_sa
changeset: 506113:32ccc4b8473a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Aug 04 02:17:07 2002 +0000

description:
Add standard names for 5-, 6-, 7-, and 8-way XOR.

diffstat:

 sys/dev/dmover/dmover_util.c |   85 ++++++++++++
 sys/dev/dmover/dmovervar.h   |  286 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 371 insertions(+), 0 deletions(-)

diffs (truncated from 379 to 300 lines):

diff -r 9c81f0fd0ea2 -r 32ccc4b8473a sys/dev/dmover/dmover_util.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/dmover/dmover_util.c      Sun Aug 04 02:17:07 2002 +0000
@@ -0,0 +1,85 @@
+/*     $NetBSD: dmover_util.c,v 1.3.2.2 2002/08/04 02:17:07 thorpej Exp $      */
+
+/*
+ * Copyright (c) 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed for the NetBSD Project by
+ *     Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * dmover_util.c: Utility functions for dmover-api.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: dmover_util.c,v 1.3.2.2 2002/08/04 02:17:07 thorpej Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <dev/dmover/dmovervar.h>
+
+/****************************************************************************
+ * Well-known data mover function names.
+ ****************************************************************************/
+
+const char dmover_funcname_zero[] = "zero";
+const char dmover_funcname_fill8[] = "fill8";
+const char dmover_funcname_copy[] = "copy";
+const char dmover_funcname_xor2[] = "xor2";
+const char dmover_funcname_xor3[] = "xor3";
+const char dmover_funcname_xor4[] = "xor4";
+const char dmover_funcname_xor5[] = "xor5";
+const char dmover_funcname_xor6[] = "xor6";
+const char dmover_funcname_xor7[] = "xor7";
+const char dmover_funcname_xor8[] = "xor8";
+
+/****************************************************************************
+ * Utility functions.
+ ****************************************************************************/
+
+/*
+ * dmover_algdesc_lookup:
+ *
+ *     Look up the algdesc in the provided array by name.
+ */
+const struct dmover_algdesc *
+dmover_algdesc_lookup(const struct dmover_algdesc *dad, int ndad,
+    const char *name)
+{
+
+       for (; ndad != 0; ndad--, dad++) {
+               if (name[0] == dad->dad_name[0] &&
+                   strcmp(name, dad->dad_name) == 0)
+                       return (dad);
+       }
+       return (NULL);
+}
diff -r 9c81f0fd0ea2 -r 32ccc4b8473a sys/dev/dmover/dmovervar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/dmover/dmovervar.h        Sun Aug 04 02:17:07 2002 +0000
@@ -0,0 +1,286 @@
+/*     $NetBSD: dmovervar.h,v 1.3.2.2 2002/08/04 02:17:07 thorpej Exp $        */
+
+/*
+ * Copyright (c) 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed for the NetBSD Project by
+ *     Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+#ifndef _DMOVER_DMOVERVAR_H_
+#define _DMOVER_DMOVERVAR_H_
+
+#include <sys/lock.h>
+#include <sys/queue.h>
+
+/*
+ * Types of buffers the dmover-api can handle.
+ */
+typedef enum {
+       DMOVER_BUF_LINEAR,
+       DMOVER_BUF_UIO
+} dmover_buffer_type;
+
+typedef struct {
+       void *l_addr;
+       size_t l_len;
+} dmover_buf_linear;
+
+typedef union {
+       dmover_buf_linear dmbuf_linear;
+       struct uio *dmbuf_uio;
+} dmover_buffer;
+
+/*
+ * dmover_algdesc:
+ *
+ *     This structure describes an dmover algorithm.
+ *
+ *     All members of this structure are public.
+ */
+struct dmover_algdesc {
+       const char *dad_name;           /* algorithm name */
+       void *dad_data;                 /* opaque algorithm description */
+       int dad_ninputs;                /* number of inputs */
+};
+
+/*
+ * dmover_assignment:
+ *
+ *     This structure contains the information necessary to assign
+ *     a request to a back-end.
+ *
+ *     All members of this structure are public.
+ */
+struct dmover_assignment {
+       struct dmover_backend *das_backend;
+       const struct dmover_algdesc *das_algdesc;
+};
+
+/*
+ * dmover_session:
+ *
+ *     State for a dmover session.
+ */
+struct dmover_session {
+       /*
+        * PUBLIC MEMBERS
+        */
+       void    *dses_cookie;           /* for client */
+       int     dses_ninputs;           /* number of inputs for function */
+
+       /*
+        * PRIVATE MEMBERS
+        */
+       LIST_ENTRY(dmover_session) __dses_list;
+
+       /*
+        * XXX Assignment is static when a session is
+        * XXX created, for now.
+        */
+       struct dmover_assignment __dses_assignment;
+
+       /* List of active requests on this session. */
+       TAILQ_HEAD(, dmover_request) __dses_pendreqs;
+       int     __dses_npendreqs;
+};
+
+#define        dmover_session_insque(dses, dreq)                               \
+do {                                                                   \
+       TAILQ_INSERT_TAIL(&(dses)->__dses_pendreqs, (dreq), dreq_sesq); \
+       (dses)->__dses_npendreqs++;                                     \
+} while (/*CONSTCOND*/0)
+
+#define        dmover_session_remque(dses, dreq)                               \
+do {                                                                   \
+       TAILQ_REMOVE(&(dses)->__dses_pendreqs, (dreq), dreq_sesq);      \
+       (dses)->__dses_npendreqs--;                                     \
+} while (/*CONSTCOND*/0)
+
+/*
+ * dmover_request:
+ *
+ *     A data dmover request.
+ */
+struct dmover_request {
+       /*
+        * PUBLIC MEMBERS
+        */
+
+       /* Links on session and back-end queues. */
+       TAILQ_ENTRY(dmover_request) dreq_sesq;
+       TAILQ_ENTRY(dmover_request) dreq_dmbq;
+
+       /* Pointer to our session. */
+       struct dmover_session *dreq_session;
+
+       /* Our current back-end assignment. */
+       struct dmover_assignment *dreq_assignment;
+
+       /* Function to call when processing is complete. */
+       void    (*dreq_callback)(struct dmover_request *);
+       void    *dreq_cookie;   /* for client */
+
+       __volatile int dreq_flags; /* flags; see below */
+       int     dreq_error;        /* valid if DMOVER_REQ_ERROR is set */
+
+       /* Output buffer. */
+       dmover_buffer_type dreq_outbuf_type;
+       dmover_buffer dreq_outbuf;
+
+       /* Input buffer. */
+       dmover_buffer_type dreq_inbuf_type;
+       union {
+               uint8_t _immediate[8];
+               dmover_buffer *_inbuf;
+       } _dreq_inbuf_un;
+
+#define        dreq_immediate          _dreq_inbuf_un._immediate
+#define        dreq_inbuf              _dreq_inbuf_un._inbuf
+};
+
+/* dreq_flags */
+#define        DMOVER_REQ_DONE         0x0001  /* request is completed */
+#define        DMOVER_REQ_ERROR        0x0002  /* error occurred */
+#define        DMOVER_REQ_RUNNING      0x0004  /* request is being executed */
+#define        DMOVER_REQ_WAIT         0x0008  /* wait for completion */
+
+#define        __DMOVER_REQ_INBUF_FREE 0x01000000 /* need to free input buffer */
+
+#define        __DMOVER_REQ_FLAGS_PRESERVE                                     \
+       (DMOVER_REQ_WAIT | __DMOVER_REQ_INBUF_FREE)
+
+/*
+ * dmover_backend:
+ *
+ *     Glue between the dmover-api middle layer and the dmover
+ *     backends.
+ *
+ *     All members of this structure are public.
+ */
+struct dmover_backend {
+       TAILQ_ENTRY(dmover_backend) dmb_list;
+
+       const char *dmb_name;           /* name of back-end */
+       u_int dmb_speed;                /* est. KB/s throughput */
+
+       void    *dmb_cookie;            /* for back-end */
+
+       /* List of algorithms this back-ends supports. */
+       const struct dmover_algdesc *dmb_algdescs;
+       int dmb_nalgdescs;
+
+       /* Back-end functions. */
+       void    (*dmb_process)(struct dmover_backend *);
+
+       /* List of sessions currently on this back-end. */
+       LIST_HEAD(, dmover_session) dmb_sessions;
+       int     dmb_nsessions;          /* current number of sessions */
+



Home | Main Index | Thread Index | Old Index