summaryrefslogtreecommitdiffstats
path: root/sys/dev/nxge/include/xge-defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/nxge/include/xge-defs.h')
-rw-r--r--sys/dev/nxge/include/xge-defs.h118
1 files changed, 55 insertions, 63 deletions
diff --git a/sys/dev/nxge/include/xge-defs.h b/sys/dev/nxge/include/xge-defs.h
index 744a6b9..17bc907 100644
--- a/sys/dev/nxge/include/xge-defs.h
+++ b/sys/dev/nxge/include/xge-defs.h
@@ -26,35 +26,27 @@
* $FreeBSD$
*/
-/*
- * FileName : xge-defs.h
- *
- * Description: global definitions
- *
- * Created: 13 May 2004
- */
-
#ifndef XGE_DEFS_H
#define XGE_DEFS_H
-#define XGE_PCI_VENDOR_ID 0x17D5
-#define XGE_PCI_DEVICE_ID_XENA_1 0x5731
-#define XGE_PCI_DEVICE_ID_XENA_2 0x5831
-#define XGE_PCI_DEVICE_ID_HERC_1 0x5732
-#define XGE_PCI_DEVICE_ID_HERC_2 0x5832
-#define XGE_PCI_DEVICE_ID_TITAN_1 0x5733
-#define XGE_PCI_DEVICE_ID_TITAN_2 0x5833
+#define XGE_PCI_VENDOR_ID 0x17D5
+#define XGE_PCI_DEVICE_ID_XENA_1 0x5731
+#define XGE_PCI_DEVICE_ID_XENA_2 0x5831
+#define XGE_PCI_DEVICE_ID_HERC_1 0x5732
+#define XGE_PCI_DEVICE_ID_HERC_2 0x5832
+#define XGE_PCI_DEVICE_ID_TITAN_1 0x5733
+#define XGE_PCI_DEVICE_ID_TITAN_2 0x5833
-#define XGE_DRIVER_NAME "Xge driver"
-#define XGE_DRIVER_VENDOR "Neterion, Inc"
-#define XGE_CHIP_FAMILY "Xframe"
-#define XGE_SUPPORTED_MEDIA_0 "Fiber"
+#define XGE_DRIVER_NAME "Xge driver"
+#define XGE_DRIVER_VENDOR "Neterion, Inc"
+#define XGE_CHIP_FAMILY "Xframe"
+#define XGE_SUPPORTED_MEDIA_0 "Fiber"
#include <dev/nxge/include/version.h>
#if defined(__cplusplus)
-#define __EXTERN_BEGIN_DECLS extern "C" {
-#define __EXTERN_END_DECLS }
+#define __EXTERN_BEGIN_DECLS extern "C" {
+#define __EXTERN_END_DECLS }
#else
#define __EXTERN_BEGIN_DECLS
#define __EXTERN_END_DECLS
@@ -67,7 +59,7 @@ __EXTERN_BEGIN_DECLS
/*---------------------------- DMA attributes ------------------------------*/
/* XGE_OS_DMA_REQUIRES_SYNC - should be defined or
- NOT defined in the Makefile */
+ NOT defined in the Makefile */
#define XGE_OS_DMA_CACHELINE_ALIGNED 0x1
/* Either STREAMING or CONSISTENT should be used.
The combination of both or none is invalid */
@@ -77,7 +69,7 @@ __EXTERN_BEGIN_DECLS
/*---------------------------- common stuffs -------------------------------*/
-#define XGE_OS_LLXFMT "%llx"
+#define XGE_OS_LLXFMT "%llx"
#define XGE_OS_NEWLINE "\n"
#ifdef XGE_OS_MEMORY_CHECK
typedef struct {
@@ -87,56 +79,56 @@ typedef struct {
int line;
} xge_os_malloc_t;
-#define XGE_OS_MALLOC_CNT_MAX 64*1024
+#define XGE_OS_MALLOC_CNT_MAX 64*1024
extern xge_os_malloc_t g_malloc_arr[XGE_OS_MALLOC_CNT_MAX];
extern int g_malloc_cnt;
#define XGE_OS_MEMORY_CHECK_MALLOC(_vaddr, _size, _file, _line) { \
if (_vaddr) { \
- int i; \
- for (i=0; i<g_malloc_cnt; i++) { \
- if (g_malloc_arr[i].ptr == NULL) { \
- break; \
- } \
- } \
- if (i == g_malloc_cnt) { \
- g_malloc_cnt++; \
- if (g_malloc_cnt >= XGE_OS_MALLOC_CNT_MAX) { \
- xge_os_bug("g_malloc_cnt exceed %d", \
- XGE_OS_MALLOC_CNT_MAX); \
- } \
- } \
- g_malloc_arr[i].ptr = _vaddr; \
- g_malloc_arr[i].size = _size; \
- g_malloc_arr[i].file = _file; \
- g_malloc_arr[i].line = _line; \
- for (i=0; i<_size; i++) { \
- *((char *)_vaddr+i) = 0x5a; \
- } \
+ int index_mem_chk; \
+ for (index_mem_chk=0; index_mem_chk < g_malloc_cnt; index_mem_chk++) { \
+ if (g_malloc_arr[index_mem_chk].ptr == NULL) { \
+ break; \
+ } \
+ } \
+ if (index_mem_chk == g_malloc_cnt) { \
+ g_malloc_cnt++; \
+ if (g_malloc_cnt >= XGE_OS_MALLOC_CNT_MAX) { \
+ xge_os_bug("g_malloc_cnt exceed %d", \
+ XGE_OS_MALLOC_CNT_MAX); \
+ } \
+ } \
+ g_malloc_arr[index_mem_chk].ptr = _vaddr; \
+ g_malloc_arr[index_mem_chk].size = _size; \
+ g_malloc_arr[index_mem_chk].file = _file; \
+ g_malloc_arr[index_mem_chk].line = _line; \
+ for (index_mem_chk=0; index_mem_chk<_size; index_mem_chk++) { \
+ *((char *)_vaddr+index_mem_chk) = 0x5a; \
+ } \
} \
}
#define XGE_OS_MEMORY_CHECK_FREE(_vaddr, _check_size) { \
- int i; \
- for (i=0; i<XGE_OS_MALLOC_CNT_MAX; i++) { \
- if (g_malloc_arr[i].ptr == _vaddr) { \
- g_malloc_arr[i].ptr = NULL; \
- if(_check_size && g_malloc_arr[i].size!=_check_size) { \
- xge_os_printf("OSPAL: freeing with wrong " \
- "size %d! allocated at %s:%d:"XGE_OS_LLXFMT":%d", \
- (int)_check_size, \
- g_malloc_arr[i].file, \
- g_malloc_arr[i].line, \
- (unsigned long long)(ulong_t) \
- g_malloc_arr[i].ptr, \
- g_malloc_arr[i].size); \
- } \
- break; \
- } \
+ int index_mem_chk; \
+ for (index_mem_chk=0; index_mem_chk < XGE_OS_MALLOC_CNT_MAX; index_mem_chk++) { \
+ if (g_malloc_arr[index_mem_chk].ptr == _vaddr) { \
+ g_malloc_arr[index_mem_chk].ptr = NULL; \
+ if(_check_size && g_malloc_arr[index_mem_chk].size!=_check_size) { \
+ xge_os_printf("OSPAL: freeing with wrong " \
+ "size %d! allocated at %s:%d:"XGE_OS_LLXFMT":%d", \
+ (int)_check_size, \
+ g_malloc_arr[index_mem_chk].file, \
+ g_malloc_arr[index_mem_chk].line, \
+ (unsigned long long)(ulong_t) \
+ g_malloc_arr[index_mem_chk].ptr, \
+ g_malloc_arr[index_mem_chk].size); \
+ } \
+ break; \
+ } \
} \
- if (i == XGE_OS_MALLOC_CNT_MAX) { \
- xge_os_printf("OSPAL: ptr "XGE_OS_LLXFMT" not found!", \
- (unsigned long long)(ulong_t)_vaddr); \
+ if (index_mem_chk == XGE_OS_MALLOC_CNT_MAX) { \
+ xge_os_printf("OSPAL: ptr "XGE_OS_LLXFMT" not found!", \
+ (unsigned long long)(ulong_t)_vaddr); \
} \
}
#else
OpenPOWER on IntegriCloud