xge_info.h revision 171095
1171095Ssam/*-
2171095Ssam * Copyright (c) 2002-2007 Neterion, Inc.
3171095Ssam * All rights reserved.
4171095Ssam *
5171095Ssam * Redistribution and use in source and binary forms, with or without
6171095Ssam * modification, are permitted provided that the following conditions
7171095Ssam * are met:
8171095Ssam * 1. Redistributions of source code must retain the above copyright
9171095Ssam *    notice, this list of conditions and the following disclaimer.
10171095Ssam * 2. Redistributions in binary form must reproduce the above copyright
11171095Ssam *    notice, this list of conditions and the following disclaimer in the
12171095Ssam *    documentation and/or other materials provided with the distribution.
13171095Ssam *
14171095Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15171095Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16171095Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17171095Ssam * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18171095Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19171095Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20171095Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21171095Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22171095Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23171095Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24171095Ssam * SUCH DAMAGE.
25171095Ssam *
26171095Ssam * $FreeBSD: head/tools/tools/nxge/xge_info.h 171095 2007-06-29 22:47:18Z sam $
27171095Ssam */
28171095Ssam/******************************************
29171095Ssam *  getinfo.h
30171095Ssam *
31171095Ssam *  To get the Tx, Rx, PCI, Interrupt statistics,
32171095Ssam *  PCI configuration space,device configuration
33171095Ssam *  and bar0 register values
34171095Ssam ******************************************/
35171095Ssam#ifndef XGE_CMN_H
36171095Ssam#include "xge_cmn.h"
37171095Ssam#endif
38171095Ssam
39171095Ssam#define XGE_QUERY_STATS       1
40171095Ssam#define XGE_QUERY_PCICONF     2
41171095Ssam#define XGE_QUERY_INTRSTATS   3
42171095Ssam#define XGE_QUERY_DEVCONF     4
43171095Ssam#define XGE_READ_VERSION      5
44171095Ssam#define XGE_QUERY_TCODE       6
45171095Ssam#define XGE_SET_BUFFER_MODE_1 7
46171095Ssam#define XGE_SET_BUFFER_MODE_2 8
47171095Ssam#define XGE_SET_BUFFER_MODE_3 9
48171095Ssam#define XGE_SET_BUFFER_MODE_5 10
49171095Ssam#define XGE_QUERY_BUFFER_MODE 11
50171095Ssam
51171095Ssam
52171095Ssam/* Function declerations */
53171095Ssamint getPciConf();
54171095Ssamint getDevConf();
55171095Ssamint getStats();
56171095Ssamint getRegInfo();
57171095Ssamint getIntrStats();
58171095Ssamint getTcodeStats();
59171095Ssamint getReadReg(char *,char *);
60171095Ssamint getWriteReg(char *,char *,char *);
61171095Ssamint getDriverVersion();
62171095Ssamint getBufMode();
63171095Ssamint changeBufMode(char *);
64171095Ssam
65171095Ssamvoid logStats(void *,unsigned short);
66171095Ssamvoid logPciConf(void *);
67171095Ssamvoid logDevConf(void *);
68171095Ssamvoid logRegInfo(void *);
69171095Ssamvoid logReadReg(u64,u64);
70171095Ssamvoid logIntrStats(void *);
71171095Ssamvoid logTcodeStats(void *);
72171095Ssamvoid logDriverInfo(char *);
73171095Ssam
74171095Ssamextern xge_pci_bar0_t         regInfo[];
75171095Ssamextern xge_pci_config_t       pciconfInfo[];
76171095Ssamextern xge_stats_hw_info_t    statsInfo[];
77171095Ssamextern xge_device_config_t    devconfInfo[];
78171095Ssamextern xge_stats_intr_info_t  intrInfo[];
79171095Ssamextern xge_stats_tcode_info_t tcodeInfo[];
80171095Ssamstruct ifreq   ifreqp;
81171095Ssamint            sockfd, indexer, bufferSize = 0;
82171095Ssamchar          *pAccess;
83171095Ssam
84