fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _SYS_NSCTL_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _SYS_NSCTL_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if (defined(lint) || defined(OSDEBUG)) && defined(_KERNEL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define __NSC_GEN__
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ksynch.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/nsc_dev.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/nsc_gen.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/nsc_mem.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/nsc_rmspin.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * nsctl multi-terabyte volume support
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * To build a multi-terabyte stack, '#define NSC_MULTI_TERABYTE'.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef NSC_MULTI_TERABYTE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef uint64_t nsc_off_t; /* positions, offsets */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef uint64_t nsc_size_t; /* lengths, sizes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _LP64
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_SZFMT "lu"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_XSZFMT "lx"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_SZFMT "llu"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_XSZFMT "llx"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* max 1TB volume size */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef int nsc_off_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef int nsc_size_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_SZFMT "u"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_XSZFMT "x"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef sun
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsc_ddi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Generic parameter definition.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_def_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *name; /* Parameter name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t value; /* Parameter value */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int offset; /* Structure offset */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} nsc_def_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_inval(), nsc_ioerr();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_fatal(), nsc_null(), nsc_true();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_decode_param(nsc_def_t *, nsc_def_t *, long *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ID and Type flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ID 0x40000000 /* Module ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NULL 0x00000100 /* No I/O possible */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_DEVICE 0x00000200 /* Device interface */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_FILE 0x00000400 /* File vnode interface */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_CACHE 0x00000800 /* Cache interface */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ANON 0x00001000 /* Supports anonymous buffers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_VCHR 0x00002000 /* VCHR vnode device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NCALL 0x00004000 /* ncall-io interface */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_IDS 0x7ff00000 /* ID mask */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_TYPES 0x7fffff00 /* Type mask */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MKID(x) (NSC_ID | ((x) << 20))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RAW_ID NSC_MKID(39) /* Raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_FILE_ID NSC_MKID(40) /* File vnode device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_FREEZE_ID NSC_MKID(41) /* Frozen raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_VCHR_ID NSC_MKID(42) /* VCHR vnode device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NCALL_ID NSC_MKID(43) /* ncall-io */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_SDBC_ID NSC_MKID(80) /* Block based cache */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDCLR_ID NSC_MKID(94) /* RDC (low, raw) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDCL_ID NSC_MKID(95) /* RDC (low, cache) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_IIR_ID NSC_MKID(96) /* Instant Image (raw) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_II_ID NSC_MKID(98) /* Instant Image */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDCHR_ID NSC_MKID(99) /* RDC (high, raw) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDCH_ID NSC_MKID(100) /* RDC (high, cache) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum nsc_power_ops_e {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Power_Lost, /* Power Failing initial warning */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* with timeleft (rideout) minutes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Power_OK, /* Power OK or restored before death */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Power_Down /* that's all folks machine will */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* be shutdown, save any state */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} nsc_power_ops_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Module Flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_REFCNT 0x00000001 /* Counts references */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_FILTER 0x00000002 /* Uses lower level driver */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _NSC_DEV_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_io_s { int x; } nsc_io_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_path_s { int x; } nsc_path_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_io_t *nsc_register_io(char *, int, nsc_def_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_unregister_io(nsc_io_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_path_t *nsc_register_path(char *, int, nsc_io_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_unregister_path(nsc_path_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_cache_sizes(int *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_node_hints(unsigned int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_node_hints_set(unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern blind_t nsc_register_power(char *, nsc_def_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_unregister_power(blind_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Strategy function interface
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef DS_DDICT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef int (*strategy_fn_t)(struct buf *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern strategy_fn_t nsc_get_strategy(major_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void *nsc_get_devops(major_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Block sizes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FBA_SHFT 9
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FBA_MASK 0x1ff
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FBA_SIZE(x) ((x) << FBA_SHFT) /* fba to bytes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FBA_OFF(x) ((x) & FBA_MASK) /* byte offset */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FBA_LEN(x) FBA_NUM((x) + FBA_MASK) /* len to fba */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FBA_NUM(x) ((nsc_size_t)((uint64_t)(x) >> FBA_SHFT))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* bytes to fba */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Return values */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_DONE (0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_PENDING (-1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_HIT (-2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_KERNEL) || defined(_KMEMUSER)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * External file descriptor.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _NSC_DEV_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_fd_s { int x; } nsc_fd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL || _KMEMUSER */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_TRY (1<<24) /* Conditional operation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_PCATCH (1<<25) /* Catch signals */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_DEFER (1<<26) /* Defer if busy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MULTI (1<<27) /* Multiple reserves */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NOWAIT (1<<28) /* Don't wait if busy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_fd_t *nsc_open(char *, int, nsc_def_t *, blind_t, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_close(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *nsc_pathname(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_fdpathcmp(nsc_fd_t *, uint64_t, char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_shared(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_setval(nsc_fd_t *, char *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_getval(nsc_fd_t *, char *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_set_trksize(nsc_fd_t *, nsc_size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_discard_pinned(nsc_fd_t *, nsc_off_t, nsc_size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern kmutex_t *nsc_lock_addr(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_attach(nsc_fd_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_reserve(nsc_fd_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_reserve_lk(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_release(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_release_lk(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_detach(nsc_fd_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_avail(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_held(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_waiting(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_partsize(nsc_fd_t *, nsc_size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_maxfbas(nsc_fd_t *, int, nsc_size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_get_pinned(nsc_fd_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_max_devices(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_control(nsc_fd_t *, int, void *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_KERNEL) || defined(_KMEMUSER)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I/O device structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _NSC_DEV_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_iodev_s { int x; } nsc_iodev_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_set_owner(nsc_fd_t *, nsc_iodev_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_pinned_data(nsc_iodev_t *, nsc_off_t, nsc_size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_unpinned_data(nsc_iodev_t *, nsc_off_t, nsc_size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Data structures used by I/O interface.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_vec_s { /* Scatter gather element */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char *sv_addr; /* Virtual address of data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned long sv_vme; /* VME address of data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int sv_len; /* Data length in bytes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} nsc_vec_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_buf_s { /* Buffer structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_fd_t *sb_fd; /* File descriptor */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_off_t sb_pos; /* Block offset of data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_size_t sb_len; /* Length of data in blocks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile int sb_flag; /* Buffer flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int sb_error; /* Error code */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t sb_user; /* User definable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_vec_t *sb_vec; /* Scatter gather list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} nsc_buf_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL || _KMEMUSER */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Allocate flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDBUF 0x0001
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_WRBUF 0x0002
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_PINNABLE 0x0004
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NOBLOCK 0x0008
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_READ (NSC_RDBUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_WRITE (NSC_WRBUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDWR (NSC_RDBUF | NSC_WRBUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDWRBUF (NSC_RDBUF | NSC_WRBUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Other flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_CACHEBLK 0x0008 /* nsc_maxfbas: size of cache block in fbas */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_HALLOCATED 0x0010 /* handle allocated (IO provider internals) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_HACTIVE 0x0020 /* handle active (IO provider internals) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_BCOPY 0x0040 /* bcopy, don't DMA when moving data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_PAGEIO 0x0080 /* client will use handle for pageio */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ABUF 0x0100 /* anonymous buffer handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MIXED 0x0200 /* data from 2 devs is mixed in this buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NODATA 0x0400 /* allocate without data buffer (sb_vec) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_FLAGS 0xffff
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ANON_CD ((blind_t)(-1)) /* used for IO provider alloc buf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_alloc_buf(nsc_fd_t *, nsc_off_t, nsc_size_t, int, nsc_buf_t **);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_alloc_abuf(nsc_off_t, nsc_size_t, int, nsc_buf_t **);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_read(nsc_buf_t *, nsc_off_t, nsc_size_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_write(nsc_buf_t *, nsc_off_t, nsc_size_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_zero(nsc_buf_t *, nsc_off_t, nsc_size_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_copy(nsc_buf_t *, nsc_buf_t *, nsc_off_t, nsc_off_t, nsc_size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_copy_direct(nsc_buf_t *, nsc_buf_t *, nsc_off_t,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_off_t, nsc_size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_uncommit(nsc_buf_t *, nsc_off_t, nsc_size_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_free_buf(nsc_buf_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_buf_t *nsc_alloc_handle(nsc_fd_t *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void (*)(), void (*)(), void (*)());
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_free_handle(nsc_buf_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_uread(nsc_fd_t *, void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_uwrite(nsc_fd_t *, void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performance hints.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_WRTHRU 0x00010000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_FORCED_WRTHRU 0x00020000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NOCACHE 0x00040000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_QUEUE 0x00080000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_RDAHEAD 0x00100000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_NO_FORCED_WRTHRU 0x00200000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_METADATA 0x00400000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_SEQ_IO 0x00800000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_HINTS 0x00ff0000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * node hint actions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_GET_NODE_HINT 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_SET_NODE_HINT 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_CLEAR_NODE_HINT 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Reflective memory spinlocks.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _NSC_RMSPIN_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_rmlock_s { int x; } nsc_rmlock_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_rmlock_t *nsc_rm_lock_alloc(char *, int, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_rm_lock_dealloc(nsc_rmlock_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_rm_lock(nsc_rmlock_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_rm_unlock(nsc_rmlock_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Memory allocation routines.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MEM_LOCAL 0x1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MEM_GLOBAL 0x4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MEM_RESIZE 0x100
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MEM_NVDIRTY 0x400
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _NSC_MEM_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_mem_s { int x; } nsc_mem_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_mem_t *nsc_register_mem(char *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_unregister_mem(nsc_mem_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void *nsc_kmem_alloc(size_t, int, nsc_mem_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void *nsc_kmem_zalloc(size_t, int, nsc_mem_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_kmem_free(void *, size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_mem_sizes(nsc_mem_t *, size_t *, size_t *, size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern size_t nsc_mem_avail(nsc_mem_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* nvmem suppport */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef void (*nsc_mem_err_cb) (void *, void *, size_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_commit_mem(void *, void *, size_t, nsc_mem_err_cb);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_cm_errhdlr(void *, void *, size_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Max pathname
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: Currently defined both here and in nsc_dev.h
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(NSC_MAXPATH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_MAXPATH 64
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Inter-module function (callback) services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _NSC_GEN_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct nsc_svc_s { int x; } nsc_svc_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_svc_t *nsc_register_svc(char *, void (*)(intptr_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_unregister_svc(nsc_svc_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_call_svc(nsc_svc_t *, intptr_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * String manipulation functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef sun
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define sprintf nsc_sprintf
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* sun */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *nsc_strdup(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_strfree(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_strmatch(char *, char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_sprintf(char *, char *, ...);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern uint64_t nsc_strhash(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Macro definitions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_HIER 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NULL 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * External definitions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#undef HZ
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern clock_t HZ;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_max_nodeid, nsc_min_nodeid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_node_id(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *nsc_node_name(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_node_up(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern time_t nsc_time(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern clock_t nsc_lbolt(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_delay_sig(clock_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern clock_t nsc_usec(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_yield(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_membar_stld(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern uint8_t nsc_ldstub(uint8_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern caddr_t nsc_caller(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern caddr_t nsc_callee(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_create_process(void (*)(void *), void *, boolean_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_power_init(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_power_deinit(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_nodeid_data(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ALERT_INFO 0 /* Information alert */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ALERT_WARNING 1 /* Warning alert */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ALERT_ERROR 2 /* Error alert */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSC_ALERT_DOWN 3 /* System or Module down */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void nsc_do_sysevent(char *, char *, int, int, char *, dev_info_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Missing DDI/DKI definition.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_SYS_CONF_H)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef D_MP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define D_MP 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void *nsc_threadp(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common defines
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef TRUE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define TRUE 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef FALSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FALSE 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef NBBY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NBBY 8 /* number of bits per byte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * kstat definition
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define KSTAT_DATA_CHAR_LEN (sizeof (((kstat_named_t *)0)->value.c))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SYS_NSCTL_H */