xge_osdep.h revision 8347601bcb0a439f6e50fc36b4039a73d08700e1
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2002-2005 Neterion, Inc.
* All right Reserved.
*
* FileName : xge_osdep.h
*
* Description: OSPAL - Solaris
*
*/
#ifndef _SYS_XGE_OSDEP_H
#define _SYS_XGE_OSDEP_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/int_fmtio.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef DEBUG
#define XGE_DEBUG_ASSERT
#endif
/* ------------------------- includes and defines ------------------------- */
#define XGE_HAL_TX_MULTI_POST_IRQ 1
#define XGE_HAL_TX_MULTI_RESERVE_IRQ 1
#define XGE_HAL_TX_MULTI_FREE_IRQ 1
#define XGE_HAL_DMA_DTR_CONSISTENT 1
#define XGE_HAL_DMA_STATS_STREAMING 1
#if defined(__sparc)
#define XGE_OS_DMA_REQUIRES_SYNC 1
#endif
#define XGE_HAL_ALIGN_XMIT 1
#ifdef _BIG_ENDIAN
#define XGE_OS_HOST_BIG_ENDIAN 1
#else
#define XGE_OS_HOST_LITTLE_ENDIAN 1
#endif
#if defined(_LP64)
#define XGE_OS_PLATFORM_64BIT 1
#else
#define XGE_OS_PLATFORM_32BIT 1
#endif
#define XGE_OS_HAS_SNPRINTF 1
/* LRO defines */
#define XGE_HAL_CONFIG_LRO 0
/* ---------------------- fixed size primitive types ----------------------- */
typedef u64 dma_addr_t;
typedef kmutex_t spinlock_t;
typedef dev_info_t *pci_dev_h;
typedef ddi_acc_handle_t pci_reg_h;
typedef ddi_acc_handle_t pci_cfg_h;
typedef ddi_iblock_cookie_t pci_irq_h;
typedef ddi_dma_handle_t pci_dma_h;
typedef ddi_acc_handle_t pci_dma_acc_h;
/* LRO types */
#define OS_NETSTACK_BUF mblk_t *
#define OS_LL_HEADER uint8_t *
#define OS_IP_HEADER uint8_t *
#define OS_TL_HEADER uint8_t *
/* -------------------------- "libc" functionality ------------------------- */
#define xge_os_strcpy (void) strcpy
#define xge_os_strlen strlen
#define xge_os_snprintf snprintf
#define xge_os_ntohl ntohl
#define xge_os_htons htons
#define xge_os_ntohs ntohs
#ifdef __GNUC__
#else
#define xge_os_vaprintf(fmt) { \
}
static inline void xge_os_printf(char *fmt, ...) {
}
}
}
#endif
#define xge_os_timestamp(buf) { \
}
#define xge_os_println xge_os_printf
/* -------------------- synchronization primitives ------------------------- */
/* x86 arch will never re-order writes, Sparc can */
#define xge_os_wmb() membar_producer()
sizeof (*(targetp)) == 4 ? \
/* ------------------------- misc primitives ------------------------------- */
#define xge_os_unlikely(x) (x)
#define xge_os_prefetch(a) (a = a)
#define xge_os_prefetchw
#ifdef __GNUC__
#else
static inline void xge_os_bug(char *fmt, ...) {
}
#endif
/* -------------------------- compiler stuffs ------------------------------ */
#if defined(__i386)
#else
#endif
#ifdef __GNUC__
#define __xge_os_attr_cacheline_aligned \
#else
#define __xge_os_attr_cacheline_aligned
#endif
/* ---------------------- memory primitives -------------------------------- */
{
return (vaddr);
}
unsigned long size)
{
}
int line)
{
void *vaddr;
int ret;
extern ddi_device_acc_attr_t *p_xge_dev_attr;
extern struct ddi_dma_attr *p_hal_dma_attr;
extern struct ddi_dma_attr *p_hal_dma_attr_aligned;
DDI_DMA_DONTWAIT, 0, p_dmah);
if (ret != DDI_SUCCESS) {
return (NULL);
}
if (ret != DDI_SUCCESS) {
return (NULL);
}
return (NULL);
}
return (vaddr);
}
{
}
/* --------------------------- pci primitives ------------------------------ */
/* --------------------------- io primitives ------------------------------- */
/* --------------------------- dma primitives ----------------------------- */
#define XGE_OS_DMA_DIR_BIDIRECTIONAL -1
#if defined(__x86)
#define XGE_OS_DMA_USES_IOMMU 0
#else
#define XGE_OS_DMA_USES_IOMMU 1
#endif
#define XGE_OS_INVALID_DMA_ADDR ((dma_addr_t)0)
int ret;
switch (dir) {
case XGE_OS_DMA_DIR_TODEVICE:
break;
break;
break;
default:
return (0);
}
if (ret != DDI_SUCCESS) {
return (0);
}
(void) ddi_dma_unbind_handle(dmah);
return (0);
}
return (dma_cookie.dmac_laddress);
}
{
(void) ddi_dma_unbind_handle(dmah);
}
{
}
#ifdef __cplusplus
}
#endif
#endif /* _SYS_XGE_OSDEP_H */