ldc.h revision bbfa0259e68b6b625e9e085053d41d620f185eee
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LDC_H
#define _LDC_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/processor.h>
/* Types */
/* LDC transport mode */
typedef enum {
LDC_MODE_RAW, /* Raw mode */
LDC_MODE_UNRELIABLE, /* Unreliable packet mode */
_LDC_MODE_RESERVED_, /* reserved */
LDC_MODE_RELIABLE /* Reliable packet mode */
} ldc_mode_t;
/* LDC message payload sizes */
#define LDC_PAYLOAD_SIZE_RAW (LDC_PACKET_SIZE)
/* LDC Channel Status */
typedef enum {
LDC_OPEN, /* Channel open */
LDC_READY, /* Channel peer opened (hw-link-up) */
LDC_UP /* Channel UP - ready for data xfer */
} ldc_status_t;
/* Callback return values */
#define LDC_SUCCESS 0
#define LDC_FAILURE 1
/* LDC callback mode */
typedef enum {
LDC_CB_ENABLE, /* Enable callbacks */
LDC_CB_DISABLE /* Disable callbacks */
/* Callback events */
/* LDC device classes */
typedef enum {
LDC_DEV_BLK, /* block device, eg. vdc */
LDC_DEV_BLK_SVC, /* block device service, eg. vds */
LDC_DEV_NT, /* network device, eg. vnet */
LDC_DEV_NT_SVC, /* network service eg. vsw */
LDC_DEV_SERIAL /* serial device eg. vldc, vcc */
} ldc_dev_t;
/* Channel nexus registration */
typedef struct ldc_cnex {
int (*reg_chan)(); /* interface for channel register */
int (*unreg_chan)(); /* interface for channel unregister */
int (*add_intr)(); /* interface for adding interrupts */
int (*rem_intr)(); /* interface for removing interrupts */
int (*clr_intr)(); /* interface for clearing interrupts */
} ldc_cnex_t;
/* LDC attribute structure */
typedef struct ldc_attr {
} ldc_attr_t;
/* LDC memory cookie */
typedef struct ldc_mem_cookie {
/*
* LDC Memory Map Type
* Specifies how shared memory being created is shared with its
*/
/* LDC Memory Access Permissions */
/* LDC Memory Copy Direction */
typedef enum {
LDC_UNBOUND, /* Memory handle is unbound */
LDC_BOUND, /* Memory handle is bound */
LDC_MAPPED /* Memory handle is mapped */
/* LDC [dring] memory info */
typedef struct ldc_mem_info {
/* API functions */
/*
* Shared Memory (Direct Map) Acquire and Release API
*
* LDC_MEM_BARRIER_OPEN and LDC_MEM_BARRIER_CLOSE provide on_trap
* protection for clients accessing imported LDC_DIRECT_MAP'd shared
* memory segments. Use of these macros is analogous to the
* ldc_mem_acquire/release and ldc_mem_dring_acquire/release interfaces
* for LDC_SHADOW_MAP'd segments. After LDC_MEM_BARRIER_OPEN is called,
* unless an error is returned, LDC_MEM_BARRIER_CLOSE must be called.
*
* LDC_MEM_BARRIER_OPEN returns zero on success and EACCES if a data
* access exception occurs after the OPEN call, but before the CLOSE
* call. If EACCES is returned, the caller must not call
* LDC_MEM_BARRIER_CLOSE. In order to handle the EACCES error return,
* callers should take the same precautions that apply when calling
* on_trap() when calling LDC_MEM_BARRIER_OPEN.
*
* LDC_MEM_BARRIER_OPEN is implemented as a macro so that on_trap
* protection can be enabled without first executing a save instruction
* and obtaining a new register window. Aside from LDC clients calling
* on_trap() directly, one alternative approach is to implement the
* OPEN function in assembly language without a save instruction and to
* then call on_trap() as a tail call.
*/
#define LDC_MEM_BARRIER_OPEN(otd) \
#define LDC_MEM_BARRIER_CLOSE() \
(no_trap(), 0)
#ifdef __cplusplus
}
#endif
#endif /* _LDC_H */