Changeset View
Changeset View
Standalone View
Standalone View
head/tools/tools/cxgbetool/cxgbetool.c
Show All 22 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <stdint.h> | #include <sys/param.h> | ||||
#include <stdlib.h> | |||||
#include <unistd.h> | |||||
#include <ctype.h> | |||||
#include <errno.h> | |||||
#include <err.h> | |||||
#include <fcntl.h> | |||||
#include <string.h> | |||||
#include <stdio.h> | |||||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||
#include <limits.h> | |||||
#include <sys/mman.h> | #include <sys/mman.h> | ||||
#include <sys/types.h> | |||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <net/ethernet.h> | |||||
#include <netinet/in.h> | |||||
#include <arpa/inet.h> | #include <arpa/inet.h> | ||||
#include <net/ethernet.h> | |||||
#include <net/sff8472.h> | #include <net/sff8472.h> | ||||
#include <netinet/in.h> | |||||
#include <ctype.h> | |||||
#include <err.h> | |||||
#include <errno.h> | |||||
#include <fcntl.h> | |||||
#include <limits.h> | |||||
#include <stdint.h> | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <unistd.h> | |||||
#include "t4_ioctl.h" | #include "t4_ioctl.h" | ||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) | |||||
#define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo)) | #define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo)) | ||||
#define max(x, y) ((x) > (y) ? (x) : (y)) | #define max(x, y) ((x) > (y) ? (x) : (y)) | ||||
static const char *progname, *nexus; | static const char *progname, *nexus; | ||||
static int chip_id; /* 4 for T4, 5 for T5 */ | static int chip_id; /* 4 for T4, 5 for T5 */ | ||||
struct reg_info { | struct reg_info { | ||||
const char *name; | const char *name; | ||||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | static struct mod_regs t4_mod[] = { | ||||
T4_MODREGS(pmu), | T4_MODREGS(pmu), | ||||
T4_MODREGS(sf), | T4_MODREGS(sf), | ||||
T4_MODREGS(pl), | T4_MODREGS(pl), | ||||
T4_MODREGS(le), | T4_MODREGS(le), | ||||
T4_MODREGS(ncsi), | T4_MODREGS(ncsi), | ||||
T4_MODREGS(xgmac) | T4_MODREGS(xgmac) | ||||
}; | }; | ||||
return dump_regs_table(argc, argv, regs, t4_mod, ARRAY_SIZE(t4_mod)); | return dump_regs_table(argc, argv, regs, t4_mod, nitems(t4_mod)); | ||||
} | } | ||||
#undef T4_MODREGS | #undef T4_MODREGS | ||||
static int | static int | ||||
dump_regs_t4vf(int argc, const char *argv[], const uint32_t *regs) | dump_regs_t4vf(int argc, const char *argv[], const uint32_t *regs) | ||||
{ | { | ||||
static struct mod_regs t4vf_mod[] = { | static struct mod_regs t4vf_mod[] = { | ||||
{ "sge", t4vf_sge_regs }, | { "sge", t4vf_sge_regs }, | ||||
{ "mps", t4vf_mps_regs }, | { "mps", t4vf_mps_regs }, | ||||
{ "pl", t4vf_pl_regs }, | { "pl", t4vf_pl_regs }, | ||||
{ "mbdata", t4vf_mbdata_regs }, | { "mbdata", t4vf_mbdata_regs }, | ||||
{ "cim", t4vf_cim_regs }, | { "cim", t4vf_cim_regs }, | ||||
}; | }; | ||||
return dump_regs_table(argc, argv, regs, t4vf_mod, | return dump_regs_table(argc, argv, regs, t4vf_mod, nitems(t4vf_mod)); | ||||
ARRAY_SIZE(t4vf_mod)); | |||||
} | } | ||||
#define T5_MODREGS(name) { #name, t5_##name##_regs } | #define T5_MODREGS(name) { #name, t5_##name##_regs } | ||||
static int | static int | ||||
dump_regs_t5(int argc, const char *argv[], const uint32_t *regs) | dump_regs_t5(int argc, const char *argv[], const uint32_t *regs) | ||||
{ | { | ||||
static struct mod_regs t5_mod[] = { | static struct mod_regs t5_mod[] = { | ||||
T5_MODREGS(sge), | T5_MODREGS(sge), | ||||
Show All 20 Lines | static struct mod_regs t5_mod[] = { | ||||
T5_MODREGS(sf), | T5_MODREGS(sf), | ||||
T5_MODREGS(pl), | T5_MODREGS(pl), | ||||
T5_MODREGS(le), | T5_MODREGS(le), | ||||
T5_MODREGS(ncsi), | T5_MODREGS(ncsi), | ||||
T5_MODREGS(mac), | T5_MODREGS(mac), | ||||
{ "hma", t5_hma_t5_regs } | { "hma", t5_hma_t5_regs } | ||||
}; | }; | ||||
return dump_regs_table(argc, argv, regs, t5_mod, ARRAY_SIZE(t5_mod)); | return dump_regs_table(argc, argv, regs, t5_mod, nitems(t5_mod)); | ||||
} | } | ||||
#undef T5_MODREGS | #undef T5_MODREGS | ||||
static int | static int | ||||
dump_regs(int argc, const char *argv[]) | dump_regs(int argc, const char *argv[]) | ||||
{ | { | ||||
int vers, revision, rc; | int vers, revision, rc; | ||||
struct t4_regdump regs; | struct t4_regdump regs; | ||||
▲ Show 20 Lines • Show All 2,194 Lines • Show Last 20 Lines |