Skip to contentSkip to conversation

net/ntnic: Add registers for NapaTech SmartNiC

PATCH Superseded Serhii Iliushyk 6 participants 238 messages May 30, 2024 – Jul 23, 2024 3 messages not in the archive Page 2 of 6

Subsystems (2)
lore
Share & tools
lore
#20 lore raw

PATCH v2 4/17 net/ntnic: add FPGA model implementation

In reply to Serhii Iliushyk

Add ntnic query FPGA functionality.

---
 .../net/ntnic/nthw/model/nthw_fpga_model.c    | 1218 +++++++++++++++++
 .../net/ntnic/nthw/model/nthw_fpga_model.h    |  247 ++++
 2 files changed, 1465 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/model/nthw_fpga_model.c
 create mode 100644 drivers/net/ntnic/nthw/model/nthw_fpga_model.h
drivers/net/ntnic/nthw/model/nthw_fpga_model.c new file +1218 -0
new file mode 100644
index 0000000000..36a7dfcf7a
@@ -0,0 +1,1218 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <time.h>	/* ctime */
+
+#include "nthw_drv.h"	/* fpga_info_s */
+#include "nthw_register.h"
+#include "nthw_fpga_model.h"
+#include "nthw_rac.h"
+#include "ntlog.h"
+
+/*
+ * NOTE: this needs to be (manually) synced with enum nthw_fpga_bus_type
+ */
+static const char *const sa_nthw_fpga_bus_type_str[] = {
+	"ERR",	/* NTHW_FPGA_BUS_TYPE_UNKNOWN, */
+	"BAR",	/* NTHW_FPGA_BUS_TYPE_BAR, */
+	"PCI",	/* NTHW_FPGA_BUS_TYPE_PCI, */
+	"CCIP",	/* NTHW_FPGA_BUS_TYPE_CCIP, */
+	"RAB0",	/* NTHW_FPGA_BUS_TYPE_RAB0, */
+	"RAB1",	/* NTHW_FPGA_BUS_TYPE_RAB1, */
+	"RAB2",	/* NTHW_FPGA_BUS_TYPE_RAB2, */
+	"NMB",	/* NTHW_FPGA_BUS_TYPE_NMB, */
+	"NDM",	/* NTHW_FPGA_BUS_TYPE_NDM, */
+};
+
+static const char *get_bus_name(int n_bus_type_id)
+{
+	if (n_bus_type_id >= 1 && n_bus_type_id <= (int)ARRAY_SIZE(sa_nthw_fpga_bus_type_str))
+		return sa_nthw_fpga_bus_type_str[n_bus_type_id];
+
+	else
+		return "ERR";
+}
+
+/*
+ * module name lookup by id from array
+ * Uses naive linear search as performance is not an issue here...
+ */
+
+static const struct {
+	const nthw_id_t a;
+	const char *b;
+} *sa_nthw_fpga_mod_str_map;
+
+static const char *nthw_fpga_mod_id_to_str(nthw_id_t n_fpga_mod_id)
+{
+	int i;
+
+	if (sa_nthw_fpga_mod_str_map) {
+		for (i = 0; sa_nthw_fpga_mod_str_map[i].a && sa_nthw_fpga_mod_str_map[i].b; i++)
+			if ((nthw_id_t)sa_nthw_fpga_mod_str_map[i].a == n_fpga_mod_id)
+				return sa_nthw_fpga_mod_str_map[i].b;
+	}
+
+	return "unknown";
+}
+
+static int nthw_read_data(struct fpga_info_s *p_fpga_info, bool trc, int n_bus_type_id,
+	uint32_t addr, uint32_t len, uint32_t *p_data)
+{
+	int rc = -1;
+
+	assert(p_fpga_info);
+	assert(p_data);
+	assert(len >= 1);
+
+	switch (n_bus_type_id) {
+	case NTHW_FPGA_BUS_TYPE_BAR:
+	case NTHW_FPGA_BUS_TYPE_PCI:
+		nthw_rac_bar0_read32(p_fpga_info, addr, len, p_data);
+		rc = 0;
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB0:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_read32(p_fpga_info->mp_nthw_rac, trc, 0, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB1:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_read32(p_fpga_info->mp_nthw_rac, trc, 1, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB2:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_read32(p_fpga_info->mp_nthw_rac, trc, 2, addr, len, p_data);
+		break;
+
+	default:
+		assert(false);
+		return -1;
+	}
+
+	return rc;
+}
+
+static int nthw_write_data(struct fpga_info_s *p_fpga_info, bool trc, int n_bus_type_id,
+	uint32_t addr, uint32_t len, const uint32_t *p_data)
+{
+	int rc = -1;
+
+	assert(p_fpga_info);
+	assert(p_data);
+	assert(len >= 1);
+
+	switch (n_bus_type_id) {
+	case NTHW_FPGA_BUS_TYPE_BAR:
+	case NTHW_FPGA_BUS_TYPE_PCI:
+		nthw_rac_bar0_write32(p_fpga_info, addr, len, p_data);
+		rc = 0;
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB0:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_write32(p_fpga_info->mp_nthw_rac, trc, 0, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB1:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_write32(p_fpga_info->mp_nthw_rac, trc, 1, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB2:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_write32(p_fpga_info->mp_nthw_rac, trc, 2, addr, len, p_data);
+		break;
+
+	default:
+		assert(false);
+		return -1;
+	}
+
+	return rc;
+}
+
+uint64_t nthw_fpga_read_ident(struct fpga_info_s *p_fpga_info)
+{
+	uint64_t n_fpga_ident;
+	uint32_t n_fpga_ident_lo, n_fpga_ident_hi;
+	nthw_rac_bar0_read32(p_fpga_info, 0x0, 1, &n_fpga_ident_lo);
+	nthw_rac_bar0_read32(p_fpga_info, 0x8, 1, &n_fpga_ident_hi);
+	n_fpga_ident = (((uint64_t)n_fpga_ident_hi << 32) | n_fpga_ident_lo);
+	return n_fpga_ident;
+}
+
+uint32_t nthw_fpga_read_buildtime(struct fpga_info_s *p_fpga_info)
+{
+	uint32_t n_fpga_build_time;
+	nthw_rac_bar0_read32(p_fpga_info, 0x10, 1, &n_fpga_build_time);
+	return n_fpga_build_time;
+}
+
+int nthw_fpga_extract_type_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)(n_fpga_ident >> 32) & 0xFF;
+}
+
+int nthw_fpga_extract_prod_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)(n_fpga_ident >> 16) & 0xFFFF;
+}
+
+int nthw_fpga_extract_ver_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)((n_fpga_ident >> 8) & 0xFF);
+}
+
+int nthw_fpga_extract_rev_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)(n_fpga_ident & 0xFF);
+}
+
+/*
+ * FpgaMgr
+ */
+nthw_fpga_mgr_t *nthw_fpga_mgr_new(void)
+{
+	nthw_fpga_mgr_t *p = malloc(sizeof(nthw_fpga_mgr_t));
+	return p;
+}
+
+void nthw_fpga_mgr_delete(nthw_fpga_mgr_t *p)
+{
+	memset(p, 0, sizeof(nthw_fpga_mgr_t));
+	free(p);
+}
+
+void nthw_fpga_mgr_init(nthw_fpga_mgr_t *p, struct nthw_fpga_prod_init **pa_nthw_fpga_instances,
+	const void *pa_mod_str_map)
+{
+	size_t i = 0;
+
+	p->mpa_fpga_prod_init = pa_nthw_fpga_instances;
+	sa_nthw_fpga_mod_str_map = pa_mod_str_map;
+
+	/* Count fpga instance in array */
+	if (pa_nthw_fpga_instances) {
+		for (i = 0;; i++)
+			if (p->mpa_fpga_prod_init[i] == NULL)
+				break;
+	}
+
+	p->mn_fpgas = (int)i;
+}
+
+static nthw_fpga_t *nthw_fpga_mgr_lookup_fpga(nthw_fpga_mgr_t *p, uint64_t n_fpga_id,
+	struct fpga_info_s *p_fpga_info)
+{
+	const int n_fpga_prod_id = nthw_fpga_extract_prod_id(n_fpga_id);
+	const int n_fpga_ver = nthw_fpga_extract_ver_id(n_fpga_id);
+	const int n_fpga_rev = nthw_fpga_extract_rev_id(n_fpga_id);
+	int i;
+
+	for (i = 0; i < p->mn_fpgas; i++) {
+		nthw_fpga_prod_init_s *p_init = p->mpa_fpga_prod_init[i];
+
+		if (p_init->fpga_product_id == n_fpga_prod_id &&
+			p_init->fpga_version == n_fpga_ver && p_init->fpga_revision == n_fpga_rev) {
+			nthw_fpga_t *p_fpga = nthw_fpga_model_new();
+			nthw_fpga_model_init(p_fpga, p_init, p_fpga_info);
+			return p_fpga;
+		}
+	}
+
+	return NULL;
+}
+
+nthw_fpga_t *nthw_fpga_mgr_query_fpga(nthw_fpga_mgr_t *p_fpga_mgr, uint64_t n_fpga_id,
+	struct fpga_info_s *p_fpga_info)
+{
+	const int n_fpga_prod_id = nthw_fpga_extract_prod_id(n_fpga_id);
+	const int n_fpga_ver = nthw_fpga_extract_ver_id(n_fpga_id);
+	const int n_fpga_rev = nthw_fpga_extract_rev_id(n_fpga_id);
+
+	nthw_fpga_t *p_fpga = nthw_fpga_mgr_lookup_fpga(p_fpga_mgr, n_fpga_id, p_fpga_info);
+
+	if (p_fpga) {
+	} else {
+		NT_LOG(ERR, NTHW, "FPGA Id 0x%" PRIX64 ": %04d: %d.%d: no match found\n",
+			n_fpga_id, n_fpga_prod_id, n_fpga_ver, n_fpga_rev);
+	}
+
+	return p_fpga;
+}
+
+void nthw_fpga_mgr_show(nthw_fpga_mgr_t *p, FILE *fh_out, int detail_level)
+{
+	int i;
+
+	fprintf(fh_out, "\n");	/* start of records */
+
+	for (i = 0; i < p->mn_fpgas; i++) {
+		nthw_fpga_prod_init_s *p_init = p->mpa_fpga_prod_init[i];
+
+		if (detail_level == 0) {
+			fprintf(fh_out, "%04d-%02d-%02d\n", p_init->fpga_product_id,
+				p_init->fpga_version, p_init->fpga_revision);
+
+		} else {
+			time_t fpga_build_time = p_init->fpga_build_time;
+			fprintf(fh_out, "%04d-%02d-%02d: 0x%08lX: %s\n", p_init->fpga_product_id,
+				p_init->fpga_version, p_init->fpga_revision, fpga_build_time,
+				(fpga_build_time ? ctime(&fpga_build_time) : "NA\n"));
+		}
+	}
+
+	fprintf(fh_out, "\n");	/* end of records */
+	fflush(fh_out);
+}
+
+void nthw_fpga_mgr_log_dump(nthw_fpga_mgr_t *p)
+{
+	int i;
+
+	NT_LOG(DBG, NTHW, "%s: fpgas=%d\n", __func__, p->mn_fpgas);
+
+	for (i = 0; i < p->mn_fpgas; i++) {
+		nthw_fpga_prod_init_s *p_init = p->mpa_fpga_prod_init[i];
+		(void)p_init;
+		NT_LOG(DBG, NTHW, "%s: fpga=%d/%d: %04d-%02d-%02d\n", __func__, i, p->mn_fpgas,
+			p_init->fpga_product_id, p_init->fpga_version, p_init->fpga_revision);
+	}
+}
+
+/*
+ * Fpga
+ */
+nthw_fpga_t *nthw_fpga_model_new(void)
+{
+	nthw_fpga_t *p = malloc(sizeof(nthw_fpga_t));
+
+	if (p)
+		memset(p, 0, sizeof(nthw_fpga_t));
+
+	return p;
+}
+
+void nthw_fpga_model_init(nthw_fpga_t *p, nthw_fpga_prod_init_s *p_init,
+	struct fpga_info_s *p_fpga_info)
+{
+	int i;
+
+	p->p_fpga_info = p_fpga_info;
+	p->mp_init = p_init;
+
+	p->mn_item_id = p_init->fpga_item_id;
+	p->mn_product_id = p_init->fpga_product_id;
+	p->mn_fpga_version = p_init->fpga_version;
+	p->mn_fpga_revision = p_init->fpga_revision;
+	p->mn_fpga_patch_no = p_init->fpga_patch_no;
+	p->mn_fpga_build_no = p_init->fpga_build_no;
+	p->mn_fpga_build_time = p_init->fpga_build_time;
+
+	p->mn_params = p_init->nb_prod_params;
+
+	if (p->mn_params) {
+		p->mpa_params = malloc(p->mn_params * sizeof(nthw_param_t *));
+
+		if (p->mpa_params) {
+			memset(p->mpa_params, 0, (p->mn_params * sizeof(nthw_param_t *)));
+
+			for (i = 0; i < p->mn_params; i++) {
+				nthw_param_t *p_param = nthw_param_new();
+
+				nthw_param_init(p_param, p, &p_init->product_params[i]);
+				p->mpa_params[i] = p_param;
+			}
+		}
+	}
+
+	p->mn_modules = p_init->nb_modules;
+
+	if (p->mn_modules) {
+		p->mpa_modules = malloc(p_init->nb_modules * sizeof(nthw_module_t *));
+
+		if (p->mpa_modules) {
+			memset(p->mpa_modules, 0, (p->mn_modules * sizeof(nthw_module_t *)));
+
+			for (i = 0; i < p->mn_modules; i++) {
+				nthw_module_t *p_mod = nthw_module_new();
+
+				nthw_module_init(p_mod, p, &p_init->modules[i]);
+				p->mpa_modules[i] = p_mod;
+			}
+		}
+	}
+}
+
+void nthw_fpga_set_debug_mode(nthw_fpga_t *p, int debug_mode)
+{
+	int i;
+
+	p->m_debug_mode = debug_mode;
+
+	for (i = 0; i < p->mn_modules; i++) {
+		nthw_module_t *p_mod = p->mpa_modules[i];
+
+		if (p_mod)
+			nthw_module_set_debug_mode(p_mod, debug_mode);
+	}
+}
+
+static nthw_module_t *nthw_fpga_lookup_module(const nthw_fpga_t *p, nthw_id_t id, int instance)
+{
+	int i;
+
+	for (i = 0; i < p->mn_modules; i++) {
+		nthw_module_t *p_mod = p->mpa_modules[i];
+
+		if (p_mod->mn_mod_id == id && p_mod->mn_instance == instance)
+			return p_mod;
+	}
+
+	return NULL;
+}
+
+nthw_module_t *nthw_fpga_query_module(const nthw_fpga_t *p, nthw_id_t id, int instance)
+{
+	return nthw_fpga_lookup_module(p, id, instance);
+}
+
+int nthw_fpga_get_product_param(const nthw_fpga_t *p, const nthw_id_t n_param_id,
+	const int n_default_value)
+{
+	int i;
+
+	for (i = 0; i < p->mn_params; i++) {
+		nthw_param_t *p_param = p->mpa_params[i];
+
+		if (p_param->mn_param_id == n_param_id)
+			return p_param->mn_param_value;
+	}
+
+	return n_default_value;
+}
+
+int nthw_fpga_get_product_id(const nthw_fpga_t *p)
+{
+	return p->mn_product_id;
+}
+
+/*
+ * Param
+ */
+nthw_param_t *nthw_param_new(void)
+{
+	nthw_param_t *p = malloc(sizeof(nthw_param_t));
+
+	return p;
+}
+
+void nthw_param_init(nthw_param_t *p, nthw_fpga_t *p_fpga, nthw_fpga_prod_param_s *p_init)
+{
+	p->mp_owner = p_fpga;
+	p->mp_init = p_init;
+
+	p->mn_param_id = p_init->id;
+	p->mn_param_value = p_init->value;
+}
+
+/*
+ * Module
+ */
+nthw_module_t *nthw_module_new(void)
+{
+	nthw_module_t *p = malloc(sizeof(nthw_module_t));
+
+	return p;
+}
+
+void nthw_module_init(nthw_module_t *p, nthw_fpga_t *p_fpga, nthw_fpga_module_init_s *p_init)
+{
+	int i;
+
+	p->mp_owner = p_fpga;
+	p->mp_init = p_init;
+
+	p->mn_mod_id = p_init->id;
+	p->mn_instance = p_init->instance;
+
+	/* Copy debug mode from owner */
+	if (p->mp_owner)
+		p->mn_debug_mode = p->mp_owner->m_debug_mode;
+
+	else
+		p->mn_debug_mode = 0;
+
+	p->mn_mod_def_id = p_init->def_id;
+	p->mn_major_version = p_init->major_version;
+	p->mn_minor_version = p_init->minor_version;
+	p->mn_bus = p_init->bus_id;
+	p->mn_addr_base = p_init->addr_base;
+
+	p->mn_registers = p_init->nb_registers;
+
+	if (p->mn_registers) {
+		p->mpa_registers = malloc(p->mn_registers * sizeof(nthw_register_t *));
+
+		if (p->mpa_registers) {
+			memset(p->mpa_registers, 0, (p->mn_registers * sizeof(nthw_register_t *)));
+
+			for (i = 0; i < p->mn_registers; i++) {
+				nthw_register_t *p_reg = nthw_register_new();
+
+				nthw_register_init(p_reg, p, &p_init->registers[i]);
+				p->mpa_registers[i] = p_reg;
+			}
+		}
+	}
+}
+
+int nthw_module_get_major_version(const nthw_module_t *p)
+{
+	return p->mn_major_version;
+}
+
+int nthw_module_get_minor_version(const nthw_module_t *p)
+{
+	return p->mn_minor_version;
+}
+
+uint64_t nthw_module_get_version_packed64(const nthw_module_t *p)
+{
+	return (((uint64_t)p->mn_major_version & 0xFFFFFFFF) << 32) |
+		(p->mn_minor_version & 0xFFFFFFFF);
+}
+
+bool nthw_module_is_version_newer(const nthw_module_t *p, int major_version, int minor_version)
+{
+	if (major_version == p->mn_major_version)
+		return p->mn_minor_version >= minor_version;
+
+	return p->mn_major_version >= major_version;
+}
+
+static nthw_register_t *nthw_module_lookup_register(nthw_module_t *p, nthw_id_t id)
+{
+	int i;
+	nthw_register_t *p_register = NULL;
+
+	for (i = 0; i < p->mn_registers; i++) {
+		if (p->mpa_registers[i]->mn_id == id) {
+			p_register = p->mpa_registers[i];
+			break;
+		}
+	}
+
+	return p_register;
+}
+
+nthw_register_t *nthw_module_query_register(nthw_module_t *p, nthw_id_t id)
+{
+	return nthw_module_lookup_register(p, id);
+}
+
+nthw_register_t *nthw_module_get_register(nthw_module_t *p, nthw_id_t id)
+{
+	nthw_register_t *p_register;
+
+	if (p == NULL) {
+		NT_LOG(ERR, NTHW, "Illegal module context for register %u\n", id);
+		return NULL;
+	}
+
+	p_register = nthw_module_lookup_register(p, id);
+
+	if (!p_register) {
+		NT_LOG(ERR, NTHW, "Register %u not found in module: %s (%u)\n", id,
+			nthw_fpga_mod_id_to_str(p->mn_mod_id), p->mn_mod_id);
+	}
+
+	return p_register;
+}
+
+int nthw_module_get_debug_mode(const nthw_module_t *p)
+{
+	return p->mn_debug_mode;
+}
+
+void nthw_module_set_debug_mode(nthw_module_t *p, unsigned int debug_mode)
+{
+	int i;
+
+	p->mn_debug_mode = debug_mode;
+
+	for (i = 0; i < p->mn_registers; i++) {
+		nthw_register_t *p_register = p->mpa_registers[i];
+
+		if (p_register)
+			nthw_register_set_debug_mode(p_register, debug_mode);
+	}
+}
+
+int nthw_module_get_bus(const nthw_module_t *p)
+{
+	return p->mn_bus;
+}
+
+/*
+ * Register
+ */
+nthw_register_t *nthw_register_new(void)
+{
+	nthw_register_t *p = malloc(sizeof(nthw_register_t));
+
+	return p;
+}
+
+void nthw_register_init(nthw_register_t *p, nthw_module_t *p_module,
+	nthw_fpga_register_init_s *p_init)
+{
+	int i;
+
+	p->mp_owner = p_module;
+
+	p->mn_id = p_init->id;
+	p->mn_bit_width = p_init->bw;
+	p->mn_addr_rel = p_init->addr_rel;
+	p->mn_addr = p_module->mn_addr_base + p_init->addr_rel;
+	p->mn_type = p_init->type;
+	/* Old P200 registers have no bw at register level - default to BW=-1 */
+	p->mn_len = ((p_init->bw != (uint16_t)-1) ? ((p_init->bw + 31) >> 5) : 1);
+	p->mn_debug_mode = p_module->mn_debug_mode;
+
+	p->mn_fields = p_init->nb_fields;
+
+	if (p->mn_fields) {
+		p->mpa_fields = malloc(p->mn_fields * sizeof(nthw_field_t *));
+
+		if (p->mpa_fields) {
+			memset(p->mpa_fields, 0, (p->mn_fields * sizeof(nthw_field_t *)));
+
+			for (i = 0; i < p->mn_fields; i++) {
+				nthw_field_t *p_field = nthw_field_new();
+
+				nthw_field_init(p_field, p, &p_init->fields[i]);
+				p->mpa_fields[i] = p_field;
+			}
+
+			p->mp_shadow = malloc(p->mn_len * sizeof(uint32_t));
+
+			if (p->mp_shadow)
+				memset(p->mp_shadow, 0x00, (p->mn_len * sizeof(uint32_t)));
+
+			p->mp_dirty = malloc(p->mn_len * sizeof(bool));
+
+			if (p->mp_dirty)
+				memset(p->mp_dirty, 0x00, (p->mn_len * sizeof(bool)));
+		}
+	}
+}
+
+uint32_t nthw_register_get_address(const nthw_register_t *p)
+{
+	return p->mn_addr;
+}
+
+void nthw_register_reset(const nthw_register_t *p)
+{
+	int i;
+	nthw_field_t *p_field = NULL;
+
+	for (i = 0; i < p->mn_fields; i++) {
+		p_field = p->mpa_fields[i];
+
+		if (p_field)
+			nthw_field_reset(p_field);
+	}
+}
+
+static nthw_field_t *nthw_register_lookup_field(const nthw_register_t *p, nthw_id_t id)
+{
+	int i;
+	nthw_field_t *p_field = NULL;
+
+	if (!p)
+		return NULL;
+
+	for (i = 0; i < p->mn_fields; i++) {
+		if (p->mpa_fields[i]->mn_id == id) {
+			p_field = p->mpa_fields[i];
+			break;
+		}
+	}
+
+	return p_field;
+}
+
+nthw_field_t *nthw_register_query_field(const nthw_register_t *p, nthw_id_t id)
+{
+	return nthw_register_lookup_field(p, id);
+}
+
+nthw_field_t *nthw_register_get_field(const nthw_register_t *p, nthw_id_t id)
+{
+	nthw_field_t *p_field;
+
+	if (p == NULL) {
+		NT_LOG(ERR, NTHW, "Illegal register context for field %u\n", id);
+		return NULL;
+	}
+
+	p_field = nthw_register_lookup_field(p, id);
+
+	if (!p_field) {
+		NT_LOG(ERR, NTHW, "Field %u not found in module: %s (%u)\n", id,
+			nthw_fpga_mod_id_to_str(p->mp_owner->mn_mod_id), p->mp_owner->mn_mod_id);
+	}
+
+	return p_field;
+}
+
+int nthw_register_get_bit_width(const nthw_register_t *p)
+{
+	return p->mn_bit_width;
+}
+
+int nthw_register_get_debug_mode(const nthw_register_t *p)
+{
+	return p->mn_debug_mode;
+}
+
+/*
+ * NOTE: do not set debug on fields - as register operation dumps typically are enough
+ */
+void nthw_register_set_debug_mode(nthw_register_t *p, unsigned int debug_mode)
+{
+	int i;
+
+	p->mn_debug_mode = debug_mode;
+
+	for (i = 0; i < p->mn_fields; i++) {
+		nthw_field_t *p_field = p->mpa_fields[i];
+
+		if (p_field)
+			nthw_field_set_debug_mode(p_field, debug_mode);
+	}
+}
+
+static int nthw_register_read_data(const nthw_register_t *p)
+{
+	int rc = -1;
+
+	const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+	const uint32_t addr = p->mn_addr;
+	const uint32_t len = p->mn_len;
+	uint32_t *const p_data = p->mp_shadow;
+	const bool trc = (p->mn_debug_mode & NTHW_REG_TRACE_ON_READ);
+
+	struct fpga_info_s *p_fpga_info = NULL;
+
+	if (p && p->mp_owner && p->mp_owner->mp_owner)
+		p_fpga_info = p->mp_owner->mp_owner->p_fpga_info;
+
+	assert(p_fpga_info);
+	assert(p_data);
+
+	rc = nthw_read_data(p_fpga_info, trc, n_bus_type_id, addr, len, p_data);
+	return rc;
+}
+
+static int nthw_register_write_data(const nthw_register_t *p, uint32_t cnt)
+{
+	int rc = -1;
+
+	const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+	const uint32_t addr = p->mn_addr;
+	const uint32_t len = p->mn_len;
+	uint32_t *const p_data = p->mp_shadow;
+	const bool trc = (p->mn_debug_mode & NTHW_REG_TRACE_ON_WRITE);
+
+	struct fpga_info_s *p_fpga_info = NULL;
+
+	if (p && p->mp_owner && p->mp_owner->mp_owner)
+		p_fpga_info = p->mp_owner->mp_owner->p_fpga_info;
+
+	assert(p_fpga_info);
+	assert(p_data);
+
+	rc = nthw_write_data(p_fpga_info, trc, n_bus_type_id, addr, (len * cnt), p_data);
+
+	return rc;
+}
+
+void nthw_register_get_val(const nthw_register_t *p, uint32_t *p_data, uint32_t len)
+{
+	uint32_t i;
+
+	if (len == (uint32_t)-1 || len > p->mn_len)
+		len = p->mn_len;
+
+	assert(len <= p->mn_len);
+	assert(p_data);
+
+	for (i = 0; i < len; i++)
+		p_data[i] = p->mp_shadow[i];
+}
+
+uint32_t nthw_register_get_val32(const nthw_register_t *p)
+{
+	uint32_t val = 0;
+
+	nthw_register_get_val(p, &val, 1);
+	return val;
+}
+
+void nthw_register_update(const nthw_register_t *p)
+{
+	if (p && p->mn_type != NTHW_FPGA_REG_TYPE_WO) {
+		const char *const p_dev_name = "NA";
+		(void)p_dev_name;
+		const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+		const char *const p_bus_name = get_bus_name(n_bus_type_id);
+		(void)p_bus_name;
+		const uint32_t addr = p->mn_addr;
+		(void)addr;
+		const uint32_t len = p->mn_len;
+		uint32_t *const p_data = p->mp_shadow;
+
+		nthw_register_read_data(p);
+
+		if (p->mn_debug_mode & NTHW_REG_DEBUG_ON_READ) {
+			uint32_t i = len;
+			uint32_t *ptr = p_data;
+			(void)ptr;
+			char *tmp_string = ntlog_helper_str_alloc("Register::read");
+			ntlog_helper_str_add(tmp_string,
+				"(Dev: %s, Bus: %s, Addr: 0x%08X, Cnt: %d, Data:",
+				p_dev_name, p_bus_name, addr, len);
+
+			while (i--)
+				ntlog_helper_str_add(tmp_string, " 0x%08X", *ptr++);
+
+			ntlog_helper_str_add(tmp_string, ")");
+			NT_LOG(DBG, NTHW, "%s", tmp_string);
+			ntlog_helper_str_free(tmp_string);
+		}
+	}
+}
+
+uint32_t nthw_register_get_val_updated32(const nthw_register_t *p)
+{
+	uint32_t val = 0;
+
+	nthw_register_update(p);
+	nthw_register_get_val(p, &val, 1);
+	return val;
+}
+
+void nthw_register_make_dirty(nthw_register_t *p)
+{
+	uint32_t i;
+
+	for (i = 0; i < p->mn_len; i++)
+		p->mp_dirty[i] = true;
+}
+
+void nthw_register_set_val(nthw_register_t *p, const uint32_t *p_data, uint32_t len)
+{
+	assert(len <= p->mn_len);
+	assert(p_data);
+
+	if (len == (uint32_t)-1 || len > p->mn_len)
+		len = p->mn_len;
+
+	if (p->mp_shadow != p_data)
+		memcpy(p->mp_shadow, p_data, (len * sizeof(uint32_t)));
+}
+
+void nthw_register_flush(const nthw_register_t *p, uint32_t cnt)
+{
+	int rc;
+
+	if (p->mn_type != NTHW_FPGA_REG_TYPE_RO) {
+		const char *const p_dev_name = "NA";
+		const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+		const char *p_bus_name = get_bus_name(n_bus_type_id);
+		const uint32_t addr = p->mn_addr;
+		const uint32_t len = p->mn_len;
+		uint32_t *const p_data = p->mp_shadow;
+		uint32_t i;
+
+		assert(len * cnt <= 256);
+
+		if (p->mn_debug_mode & NTHW_REG_DEBUG_ON_WRITE) {
+			uint32_t i = len * cnt;
+			uint32_t *ptr = p_data;
+			char *tmp_string = ntlog_helper_str_alloc("Register::write");
+
+			ntlog_helper_str_add(tmp_string,
+				"(Dev: %s, Bus: %s, Addr: 0x%08X, Cnt: %d, Data:",
+				p_dev_name, p_bus_name, addr, i);
+
+			while (i--)
+				ntlog_helper_str_add(tmp_string, " 0x%08X", *ptr++);
+
+			ntlog_helper_str_add(tmp_string, ")");
+			NT_LOG(DBG, NTHW, "%s", tmp_string);
+			ntlog_helper_str_free(tmp_string);
+		}
+
+		rc = nthw_register_write_data(p, cnt);
+
+		if (rc)
+			NT_LOG(ERR, NTHW, "Register write error %d\n", rc);
+
+		for (i = 0; i < cnt; i++)
+			p->mp_dirty[i] = false;
+	}
+}
+
+void nthw_register_clr(nthw_register_t *p)
+{
+	memset(p->mp_shadow, 0, p->mn_len * sizeof(uint32_t));
+	nthw_register_make_dirty(p);
+}
+
+/*
+ * Field
+ */
+nthw_field_t *nthw_field_new(void)
+{
+	nthw_field_t *p = malloc(sizeof(nthw_field_t));
+
+	return p;
+}
+
+void nthw_field_init(nthw_field_t *p, nthw_register_t *p_reg, const nthw_fpga_field_init_s *p_init)
+{
+	p->mp_owner = p_reg;
+
+	p->mn_debug_mode = p_reg->mn_debug_mode;
+
+	p->mn_id = p_init->id;
+	p->mn_bit_width = p_init->bw;
+	p->mn_bit_pos_low = p_init->low;
+	p->mn_reset_val = (uint32_t)p_init->reset_val;
+	p->mn_first_word = p_init->low / 32;
+	p->mn_first_bit = p_init->low % 32;
+	p->mn_front_mask = 0;
+	p->mn_body_length = 0;
+	p->mn_words = (p_init->bw + 0x1f) / 0x20;
+	p->mn_tail_mask = 0;
+
+	{
+		int bits_remaining = p_init->bw;
+		int front_mask_length = 32 - p->mn_first_bit;
+
+		if (front_mask_length > bits_remaining)
+			front_mask_length = bits_remaining;
+
+		bits_remaining -= front_mask_length;
+
+		p->mn_front_mask =
+			(uint32_t)(((1ULL << front_mask_length) - 1) << p->mn_first_bit);
+
+		p->mn_body_length = bits_remaining / 32;
+		bits_remaining -= p->mn_body_length * 32;
+		p->mn_tail_mask = (1 << bits_remaining) - 1;
+
+		if (p->mn_debug_mode >= 0x100) {
+			NT_LOG(DBG, NTHW,
+				"%s: fldid=%08d: [%08d:%08d] %08d/%08d: (%08d,%08d) (0x%08X,%08d,0x%08X)\n",
+				__func__, p_init->id, p_init->low, (p_init->low + p_init->bw),
+				p_init->bw, ((p_init->bw + 31) / 32), p->mn_first_word,
+				p->mn_first_bit, p->mn_front_mask, p->mn_body_length,
+				p->mn_tail_mask);
+		}
+	}
+}
+
+int nthw_field_get_debug_mode(const nthw_field_t *p)
+{
+	return p->mn_debug_mode;
+}
+
+void nthw_field_set_debug_mode(nthw_field_t *p, unsigned int debug_mode)
+{
+	p->mn_debug_mode = debug_mode;
+}
+
+int nthw_field_get_bit_width(const nthw_field_t *p)
+{
+	return p->mn_bit_width;
+}
+
+int nthw_field_get_bit_pos_low(const nthw_field_t *p)
+{
+	return p->mn_bit_pos_low;
+}
+
+int nthw_field_get_bit_pos_high(const nthw_field_t *p)
+{
+	return p->mn_bit_pos_low + p->mn_bit_width - 1;
+}
+
+uint32_t nthw_field_get_mask(const nthw_field_t *p)
+{
+	return p->mn_front_mask;
+}
+
+void nthw_field_reset(const nthw_field_t *p)
+{
+	nthw_field_set_val32(p, (uint32_t)p->mn_reset_val);
+}
+
+void nthw_field_get_val(const nthw_field_t *p, uint32_t *p_data, uint32_t len)
+{
+	uint32_t i;
+	uint32_t data_index = 0;
+	uint32_t shadow_index = p->mn_first_word;
+
+	union {
+		uint32_t w32[2];
+		uint64_t w64;
+	} buf;
+
+	(void)len;
+	assert(len <= p->mn_words);
+
+	/* handle front */
+	buf.w32[0] = p->mp_owner->mp_shadow[shadow_index++] & p->mn_front_mask;
+
+	/* handle body */
+	for (i = 0; i < p->mn_body_length; i++) {
+		buf.w32[1] = p->mp_owner->mp_shadow[shadow_index++];
+		buf.w64 = buf.w64 >> (p->mn_first_bit);
+		assert(data_index < len);
+		p_data[data_index++] = buf.w32[0];
+		buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+	}
+
+	/* handle tail */
+	if (p->mn_tail_mask)
+		buf.w32[1] = p->mp_owner->mp_shadow[shadow_index++] & p->mn_tail_mask;
+
+	else
+		buf.w32[1] = 0;
+
+	buf.w64 = buf.w64 >> (p->mn_first_bit);
+	p_data[data_index++] = buf.w32[0];
+
+	if (data_index < p->mn_words)
+		p_data[data_index++] = buf.w32[1];
+}
+
+void nthw_field_set_val(const nthw_field_t *p, const uint32_t *p_data, uint32_t len)
+{
+	uint32_t i;
+	uint32_t data_index = 0;
+	uint32_t shadow_index = p->mn_first_word;
+
+	union {
+		uint32_t w32[2];
+		uint64_t w64;
+	} buf;
+
+	(void)len;
+	assert(len == p->mn_words);
+
+	/* handle front */
+	buf.w32[0] = 0;
+	buf.w32[1] = p_data[data_index++];
+	buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+	p->mp_owner->mp_shadow[shadow_index] =
+		(p->mp_owner->mp_shadow[shadow_index] & ~p->mn_front_mask) |
+		(buf.w32[0] & p->mn_front_mask);
+	shadow_index++;
+
+	/* handle body */
+	for (i = 0; i < p->mn_body_length; i++) {
+		buf.w64 = buf.w64 >> (p->mn_first_bit);
+		assert(data_index < len);
+		buf.w32[1] = p_data[data_index++];
+		buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+		p->mp_owner->mp_shadow[shadow_index++] = buf.w32[0];
+	}
+
+	/* handle tail */
+	if (p->mn_tail_mask) {
+		buf.w64 = buf.w64 >> (p->mn_first_bit);
+
+		if (data_index < len)
+			buf.w32[1] = p_data[data_index];
+
+		buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+		p->mp_owner->mp_shadow[shadow_index] =
+			(p->mp_owner->mp_shadow[shadow_index] & ~p->mn_tail_mask) |
+			(buf.w32[0] & p->mn_tail_mask);
+	}
+
+	nthw_register_make_dirty(p->mp_owner);
+}
+
+void nthw_field_set_val_flush(const nthw_field_t *p, const uint32_t *p_data, uint32_t len)
+{
+	nthw_field_set_val(p, p_data, len);
+	nthw_field_flush_register(p);
+}
+
+uint32_t nthw_field_get_val32(const nthw_field_t *p)
+{
+	uint32_t val;
+
+	nthw_field_get_val(p, &val, 1);
+	return val;
+}
+
+uint32_t nthw_field_get_updated(const nthw_field_t *p)
+{
+	uint32_t val;
+
+	nthw_register_update(p->mp_owner);
+	nthw_field_get_val(p, &val, 1);
+
+	return val;
+}
+
+void nthw_field_update_register(const nthw_field_t *p)
+{
+	nthw_register_update(p->mp_owner);
+}
+
+void nthw_field_flush_register(const nthw_field_t *p)
+{
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+void nthw_field_set_val32(const nthw_field_t *p, uint32_t val)
+{
+	nthw_field_set_val(p, &val, 1);
+}
+
+void nthw_field_set_val_flush32(const nthw_field_t *p, uint32_t val)
+{
+	nthw_field_set_val(p, &val, 1);
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+void nthw_field_clr_all(const nthw_field_t *p)
+{
+	assert(p->mn_body_length == 0);
+	nthw_field_set_val32(p, 0);
+}
+
+void nthw_field_clr_flush(const nthw_field_t *p)
+{
+	nthw_field_clr_all(p);
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+void nthw_field_set_all(const nthw_field_t *p)
+{
+	assert(p->mn_body_length == 0);
+	nthw_field_set_val32(p, ~0);
+}
+
+void nthw_field_set_flush(const nthw_field_t *p)
+{
+	nthw_field_set_all(p);
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+enum nthw_field_match {
+	NTHW_FIELD_MATCH_CLR_ALL,
+	NTHW_FIELD_MATCH_SET_ALL,
+	NTHW_FIELD_MATCH_CLR_ANY,
+	NTHW_FIELD_MATCH_SET_ANY,
+};
+
+static int nthw_field_wait_cond32(const nthw_field_t *p, enum nthw_field_match e_match,
+	int n_poll_iterations, int n_poll_interval)
+{
+	const uint32_t n_mask = (1 << p->mn_bit_width) - 1;
+
+	if (n_poll_iterations == -1)
+		n_poll_iterations = 10000;
+
+	if (n_poll_interval == -1)
+		n_poll_interval = 100;	/* usec */
+
+	if (p->mn_debug_mode) {
+		const char *const p_cond_name =
+			((e_match == NTHW_FIELD_MATCH_SET_ALL)
+				? "SetAll"
+				: ((e_match == NTHW_FIELD_MATCH_CLR_ALL)
+					? "ClrAll"
+					: ((e_match == NTHW_FIELD_MATCH_CLR_ANY) ? "ClrAny"
+						: "SetAny")));
+		(void)p_cond_name;
+		const char *const p_dev_name = "NA";
+		(void)p_dev_name;
+		const char *const p_bus_name =
+			get_bus_name(nthw_module_get_bus(p->mp_owner->mp_owner));
+		(void)p_bus_name;
+		uint32_t n_reg_addr = nthw_register_get_address(p->mp_owner);
+		(void)n_reg_addr;
+		uint32_t n_reg_mask = (((1 << p->mn_bit_width) - 1) << p->mn_bit_pos_low);
+		(void)n_reg_mask;
+
+		NT_LOG(DBG, NTHW,
+			"Register::Field::wait%s32(Dev: %s, Bus: %s, Addr: 0x%08X, Mask: 0x%08X, Iterations: %d, Interval: %d)\n",
+			p_cond_name, p_dev_name, p_bus_name, n_reg_addr, n_reg_mask,
+			n_poll_iterations, n_poll_interval);
+	}
+
+	while (true) {
+		uint32_t val = nthw_field_get_updated(p);
+
+		if (e_match == NTHW_FIELD_MATCH_SET_ANY && val != 0) {
+			return 0;
+
+		} else if (e_match == NTHW_FIELD_MATCH_SET_ALL && val == n_mask) {
+			return 0;
+
+		} else if (e_match == NTHW_FIELD_MATCH_CLR_ALL && val == 0) {
+			return 0;
+
+		} else if (e_match == NTHW_FIELD_MATCH_CLR_ANY) {
+			uint32_t mask = nthw_field_get_mask(p);
+
+			if (val != mask)
+				return 0;
+		}
+
+		n_poll_iterations--;
+
+		if (n_poll_iterations <= 0)
+			return -1;
+
+		nt_os_wait_usec(n_poll_interval);
+	}
+
+	return 0;
+}
+
+int nthw_field_wait_set_all32(const nthw_field_t *p, int n_poll_iterations, int n_poll_interval)
+{
+	return nthw_field_wait_cond32(p, NTHW_FIELD_MATCH_SET_ALL, n_poll_iterations,
+			n_poll_interval);
+}
+
+int nthw_field_wait_clr_all32(const nthw_field_t *p, int n_poll_iterations, int n_poll_interval)
+{
+	return nthw_field_wait_cond32(p, NTHW_FIELD_MATCH_CLR_ALL, n_poll_iterations,
+			n_poll_interval);
+}
+
+int nthw_field_wait_set_any32(const nthw_field_t *p, int n_poll_iterations, int n_poll_interval)
+{
+	return nthw_field_wait_cond32(p, NTHW_FIELD_MATCH_SET_ANY, n_poll_iterations,
+			n_poll_interval);
+}
+
+/* EOF */
drivers/net/ntnic/nthw/model/nthw_fpga_model.h new file +247 -0

247 lines not on this page · raw message

Signature · 1 line
2.44.0
#21 lore raw

PATCH v2 5/17 net/ntnic: add NTNIC adapter interfaces

In reply to Serhii Iliushyk

Add ntnic adapter interfaces structures.

---
v2:
* Fixed unused header.

---
 .../ntnic/include/clock_profiles_structs.h    |  69 +++++++
 .../net/ntnic/include/common_adapter_defs.h   |  15 ++
 drivers/net/ntnic/include/fpga_model.h        | 153 +++++++++++++++
 drivers/net/ntnic/include/nt4ga_adapter.h     | 105 ++++++++++
 drivers/net/ntnic/include/nt4ga_pci_ta_tg.h   |  42 ++++
 drivers/net/ntnic/include/nt4ga_tfg.h         |  18 ++
 drivers/net/ntnic/include/ntdrv_4ga.h         |  33 ++++
 drivers/net/ntnic/include/nthw_bus.h          |  20 ++
 drivers/net/ntnic/include/ntos_drv.h          | 179 ++++++++++++++++++
 drivers/net/ntnic/include/ntos_system.h       |  25 +++
 drivers/net/ntnic/include/ntoss_virt_queue.h  | 163 ++++++++++++++++
 11 files changed, 822 insertions(+)
 create mode 100644 drivers/net/ntnic/include/clock_profiles_structs.h
 create mode 100644 drivers/net/ntnic/include/common_adapter_defs.h
 create mode 100644 drivers/net/ntnic/include/fpga_model.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_adapter.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_pci_ta_tg.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_tfg.h
 create mode 100644 drivers/net/ntnic/include/ntdrv_4ga.h
 create mode 100644 drivers/net/ntnic/include/nthw_bus.h
 create mode 100644 drivers/net/ntnic/include/ntos_drv.h
 create mode 100644 drivers/net/ntnic/include/ntos_system.h
 create mode 100644 drivers/net/ntnic/include/ntoss_virt_queue.h
drivers/net/ntnic/include/clock_profiles_structs.h new file +69 -0
new file mode 100644
index 0000000000..0f967453aa
@@ -0,0 +1,69 @@
+/* */
+/* clock_profiles_structs.h */
+/* */
+
+/*
+ * %NT_SOFTWARE_LICENSE%
+ */
+
+#ifndef _NT_CLOCK_PROFILES_STRUCTS_H_
+#define _NT_CLOCK_PROFILES_STRUCTS_H_
+
+/* */
+/* */
+/* */
+#include <stdint.h>
+
+/* */
+/* */
+/* */
+#define GET_VAR_NAME(var) #var
+
+#define clk_profile_size_error_msg "Size test failed"
+
+/* */
+/* */
+/* */
+struct clk_profile_data_fmt0_s {
+	unsigned char reg_addr;
+	unsigned char reg_val;
+	unsigned char reg_mask;
+};
+
+struct clk_profile_data_fmt1_s {
+	uint16_t reg_addr;
+	uint8_t reg_val;
+};
+
+struct clk_profile_data_fmt2_s {
+	unsigned int reg_addr;
+	unsigned char reg_val;
+};
+
+struct clk_profile_data_fmt3_s {
+	unsigned int address;
+	unsigned int data;
+};
+
+typedef struct clk_profile_data_fmt0_s clk_profile_data_fmt0_t;
+typedef struct clk_profile_data_fmt1_s clk_profile_data_fmt1_t;
+typedef struct clk_profile_data_fmt2_s clk_profile_data_fmt2_t;
+typedef struct clk_profile_data_fmt3_s clk_profile_data_fmt3_t;
+
+enum clk_profile_data_fmt_e {
+	clk_profile_data_fmt_0,
+	clk_profile_data_fmt_1,
+	clk_profile_data_fmt_2,
+	clk_profile_data_fmt_3,
+};
+
+typedef enum clk_profile_data_fmt_e clk_profile_data_fmt_t;
+
+/* */
+/* */
+/* */
+#endif	/* _NT_CLOCK_PROFILES_STRUCTS_H_ */
+
+/* */
+/* EOF */
+/* */
drivers/net/ntnic/include/common_adapter_defs.h new file +15 -0
new file mode 100644
index 0000000000..6ed9121f0f
@@ -0,0 +1,15 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _COMMON_ADAPTER_DEFS_H_
+#define _COMMON_ADAPTER_DEFS_H_
+
+/*
+ * Declarations shared by NT adapter types.
+ */
+#define NUM_ADAPTER_MAX (8)
+#define NUM_ADAPTER_PORTS_MAX (128)
+
+#endif	/* _COMMON_ADAPTER_DEFS_H_ */
drivers/net/ntnic/include/fpga_model.h new file +153 -0

153 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_adapter.h new file +105 -0

105 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_pci_ta_tg.h new file +42 -0

42 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_tfg.h new file +18 -0
new file mode 100644
index 0000000000..9797403dec
@@ -0,0 +1,18 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_TFG_H_
+#define NT4GA_TFG_H_
+
+typedef struct nt4ga_tfg_s {
+	nthw_mac_tfg_t *mp_nthw_mac_tfg;
+} nt4ga_tfg_t;
+
+int nt4ga_tfg_init(struct adapter_info_s *p_adapter_info);
+int nt4ga_tfg_setup(struct adapter_info_s *p_adapter_info, const int n_intf_no,
+	const int n_cmd_start_stop, const int n_frame_count, const int n_frame_size,
+	const int n_frame_fill_mode, const int n_frame_stream_id);
+
+#endif	/* NT4GA_TFG_H_ */
drivers/net/ntnic/include/ntdrv_4ga.h new file +33 -0
new file mode 100644
index 0000000000..cae25ecfa6
@@ -0,0 +1,33 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTDRV_4GA_H__
+#define __NTDRV_4GA_H__
+
+#include <rte_version.h>
+#include <rte_thread.h>
+#include "nthw_drv.h"
+#include "nt4ga_adapter.h"
+#include "nthw_platform_drv.h"
+
+typedef struct ntdrv_4ga_s {
+	uint32_t pciident;
+	struct adapter_info_s adapter_info;
+	char *p_drv_name;
+
+	volatile bool b_shutdown;
+	pthread_mutex_t stat_lck;
+#if RTE_VERSION_NUM(23, 11, 0, 0) < RTE_VERSION
+	rte_thread_t stat_thread;
+	rte_thread_t flm_thread;
+	rte_thread_t port_event_thread;
+#else
+	pthread_t stat_thread;
+	pthread_t flm_thread;
+	pthread_t port_event_thread;
+#endif
+} ntdrv_4ga_t;
+
+#endif	/* __NTDRV_4GA_H__ */
drivers/net/ntnic/include/nthw_bus.h new file +20 -0
new file mode 100644
index 0000000000..9d1532335b
@@ -0,0 +1,20 @@
+/* */
+/* nthw_bus.h */
+/* */
+
+/* */
+/* */
+/* */
+#ifndef __NTHW_BUS_H__
+#define __NTHW_BUS_H__
+
+/* */
+/* */
+/* */
+typedef uint8_t nthw_rab_bus_id_t;
+
+#endif	/* __NTHW_BUS_H__ */
+
+/* */
+/* EOF */
+/* */
drivers/net/ntnic/include/ntos_drv.h new file +179 -0

179 lines not on this page · raw message

drivers/net/ntnic/include/ntos_system.h new file +25 -0
new file mode 100644
index 0000000000..cf4768799d
@@ -0,0 +1,25 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTOS_SYSTEM_H__
+#define __NTOS_SYSTEM_H__
+
+#include "include/ntdrv_4ga.h"
+
+/*
+ * struct drv_s for DPDK (clone of kernel struct)
+ * keep it as close as possible to original kernel struct
+ */
+struct drv_s {
+	int adapter_no;
+	struct rte_pci_device *p_dev;
+	struct ntdrv_4ga_s ntdrv;
+
+	int n_eth_dev_init_count;
+	int probe_finished;
+	int setup_finished;
+};
+
+#endif	/* __NTOS_SYSTEM_H__ */
drivers/net/ntnic/include/ntoss_virt_queue.h new file +163 -0

163 lines not on this page · raw message

Signature · 1 line
2.44.0
#22 lore raw

PATCH v2 6/17 net/ntnic: add interfaces for PMD driver modules

In reply to Serhii Iliushyk

Add ntnic base interfaces for: link, NIM, sensors, statistics.

---
 drivers/net/ntnic/include/nt4ga_link.h        | 132 +++++
 drivers/net/ntnic/include/ntnic_dbs.h         | 356 ++++++++++++
 drivers/net/ntnic/include/ntnic_nim.h         | 160 ++++++
 .../include/ntnic_nthw_fpga_rst_nt200a0x.h    |  82 +++
 drivers/net/ntnic/include/ntnic_sensor.h      | 515 ++++++++++++++++++
 drivers/net/ntnic/include/ntnic_stat.h        | 291 ++++++++++
 6 files changed, 1536 insertions(+)
 create mode 100644 drivers/net/ntnic/include/nt4ga_link.h
 create mode 100644 drivers/net/ntnic/include/ntnic_dbs.h
 create mode 100644 drivers/net/ntnic/include/ntnic_nim.h
 create mode 100644 drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt200a0x.h
 create mode 100644 drivers/net/ntnic/include/ntnic_sensor.h
 create mode 100644 drivers/net/ntnic/include/ntnic_stat.h
drivers/net/ntnic/include/nt4ga_link.h new file +132 -0
new file mode 100644
index 0000000000..49e1c5d672
@@ -0,0 +1,132 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_LINK_H_
+#define NT4GA_LINK_H_
+
+#include "common_adapter_defs.h"
+#include "nthw_drv.h"
+#include "ntnic_nim.h"
+#include "ntnic_nthw_fpga_rst_nt200a0x.h"
+
+/*
+ * Link state.\n
+ * Just after start of ntservice the link state might be unknown since the
+ * monitoring routine is busy reading NIM state and NIM data. This might also
+ * be the case after a NIM is plugged into an interface.
+ * The error state indicates a HW reading error.
+ */
+enum nt_link_state_e {
+	NT_LINK_STATE_UNKNOWN = 0,	/* The link state has not been read yet */
+	NT_LINK_STATE_DOWN = 1,	/* The link state is DOWN */
+	NT_LINK_STATE_UP = 2,	/* The link state is UP */
+	NT_LINK_STATE_ERROR = 3	/* The link state could not be read */
+};
+
+typedef enum nt_link_state_e nt_link_state_t, *nt_link_state_p;
+
+/*
+ * Link duplex mode
+ */
+enum nt_link_duplex_e {
+	NT_LINK_DUPLEX_UNKNOWN = 0,
+	NT_LINK_DUPLEX_HALF = 0x01,	/* Half duplex */
+	NT_LINK_DUPLEX_FULL = 0x02,	/* Full duplex */
+};
+
+typedef enum nt_link_duplex_e nt_link_duplex_t;
+
+/*
+ * Link loopback mode
+ */
+enum nt_link_loopback_e {
+	NT_LINK_LOOPBACK_OFF = 0,
+	NT_LINK_LOOPBACK_HOST = 0x01,	/* Host loopback mode */
+	NT_LINK_LOOPBACK_LINE = 0x02,	/* Line loopback mode */
+};
+
+/*
+ * Link MDI mode
+ */
+enum nt_link_mdi_e {
+	NT_LINK_MDI_NA = 0,
+	NT_LINK_MDI_AUTO = 0x01,/* MDI auto */
+	NT_LINK_MDI_MDI = 0x02,	/* MDI mode */
+	NT_LINK_MDI_MDIX = 0x04,/* MDIX mode */
+};
+
+typedef enum nt_link_mdi_e nt_link_mdi_t;
+
+/*
+ * Link Auto/Manual mode
+ */
+enum nt_link_auto_neg_e {
+	NT_LINK_AUTONEG_NA = 0,
+	NT_LINK_AUTONEG_MANUAL = 0x01,
+	NT_LINK_AUTONEG_OFF = NT_LINK_AUTONEG_MANUAL,	/* Auto negotiation OFF */
+	NT_LINK_AUTONEG_AUTO = 0x02,
+	NT_LINK_AUTONEG_ON = NT_LINK_AUTONEG_AUTO,	/* Auto negotiation ON */
+};
+
+typedef enum nt_link_auto_neg_e nt_link_auto_neg_t;
+
+/*
+ * Callback functions to setup mac, pcs and phy
+ */
+typedef struct link_state_s {
+	bool link_disabled;
+	bool nim_present;
+	bool lh_nim_absent;
+	bool link_up;
+	enum nt_link_state_e link_state;
+	enum nt_link_state_e link_state_latched;
+} link_state_t;
+
+/*
+ * Link speed.
+ * Note this is a bitmask.
+ */
+enum nt_link_speed_e {
+	NT_LINK_SPEED_UNKNOWN = 0,
+	NT_LINK_SPEED_10M = 0x01,	/* 10 Mbps */
+	NT_LINK_SPEED_100M = 0x02,	/* 100 Mbps */
+	NT_LINK_SPEED_1G = 0x04,/* 1 Gbps  (Autoneg only) */
+	NT_LINK_SPEED_10G = 0x08,	/* 10 Gbps (Autoneg only) */
+	NT_LINK_SPEED_40G = 0x10,	/* 40 Gbps (Autoneg only) */
+	NT_LINK_SPEED_100G = 0x20,	/* 100 Gbps (Autoneg only) */
+	NT_LINK_SPEED_50G = 0x40,	/* 50 Gbps (Autoneg only) */
+	NT_LINK_SPEED_25G = 0x80,	/* 25 Gbps (Autoneg only) */
+	NT_LINK_SPEED_END	/* always keep this entry as the last in enum */
+};
+typedef enum nt_link_speed_e nt_link_speed_t;
+
+typedef struct link_info_s {
+	enum nt_link_speed_e link_speed;
+	enum nt_link_duplex_e link_duplex;
+	enum nt_link_auto_neg_e link_auto_neg;
+} link_info_t;
+
+typedef struct port_action_s {
+	bool port_disable;
+	enum nt_link_speed_e port_speed;
+	enum nt_link_duplex_e port_duplex;
+	uint32_t port_lpbk_mode;
+} port_action_t;
+
+typedef union adapter_var_s {
+	nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX];	/* First field in all the adaptors type */
+} adapter_var_u;
+
+typedef struct nt4ga_link_s {
+	link_state_t link_state[NUM_ADAPTER_PORTS_MAX];
+	link_info_t link_info[NUM_ADAPTER_PORTS_MAX];
+	port_action_t port_action[NUM_ADAPTER_PORTS_MAX];
+	uint32_t speed_capa;
+	/* */
+	bool variables_initialized;
+	adapter_var_u u;
+} nt4ga_link_t;
+
+#endif	/* NT4GA_LINK_H_ */
drivers/net/ntnic/include/ntnic_dbs.h new file +356 -0

356 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_nim.h new file +160 -0

160 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt200a0x.h new file +82 -0

82 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_sensor.h new file +515 -0

515 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_stat.h new file +291 -0

291 lines not on this page · raw message

Signature · 1 line
2.44.0
#23 lore raw

PATCH v2 7/17 net/ntnic: add API for PMD driver modules

In reply to Serhii Iliushyk

Add API for ntnic PMD driver modules,
thus allow modules to be enabled/disabled.

---
v2:
* Fixed WARNING:TYPO_SPELLING

---
 drivers/net/ntnic/dpdk_mod_reg.c  |  64 ++++
 drivers/net/ntnic/dpdk_mod_reg.h  | 167 ++++++++++
 drivers/net/ntnic/ntnic_mod_reg.c | 382 ++++++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h | 512 ++++++++++++++++++++++++++++++
 4 files changed, 1125 insertions(+)
 create mode 100644 drivers/net/ntnic/dpdk_mod_reg.c
 create mode 100644 drivers/net/ntnic/dpdk_mod_reg.h
 create mode 100644 drivers/net/ntnic/ntnic_mod_reg.c
 create mode 100644 drivers/net/ntnic/ntnic_mod_reg.h
drivers/net/ntnic/dpdk_mod_reg.c new file +64 -0
new file mode 100644
index 0000000000..dec3e54dc0
@@ -0,0 +1,64 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <rte_flow_driver.h>
+#include "dpdk_mod_reg.h"
+
+static struct sg_ops_s *sg_ops;
+
+void register_sg_ops(struct sg_ops_s *ops)
+{
+	sg_ops = ops;
+}
+
+const struct sg_ops_s *get_sg_ops(void)
+{
+	return sg_ops;
+}
+
+/*
+ *
+ */
+static struct meter_ops_s *meter_ops;
+
+void register_meter_ops(struct meter_ops_s *ops)
+{
+	meter_ops = ops;
+}
+
+const struct meter_ops_s *get_meter_ops(void)
+{
+	return meter_ops;
+}
+
+/*
+ *
+ */
+static const struct ntnic_filter_ops *ntnic_filter_ops;
+
+void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops)
+{
+	ntnic_filter_ops = ops;
+}
+
+const struct ntnic_filter_ops *get_ntnic_filter_ops(void)
+{
+	return ntnic_filter_ops;
+}
+
+/*
+ *
+ */
+static struct ntnic_xstats_ops *ntnic_xstats_ops;
+
+void register_ntnic_xstats_ops(struct ntnic_xstats_ops *ops)
+{
+	ntnic_xstats_ops = ops;
+}
+
+struct ntnic_xstats_ops *get_ntnic_xstats_ops(void)
+{
+	return ntnic_xstats_ops;
+}
drivers/net/ntnic/dpdk_mod_reg.h new file +167 -0

167 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.c new file +382 -0

382 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h new file +512 -0

512 lines not on this page · raw message

Signature · 1 line
2.44.0
#24 lore raw

PATCH v2 8/17 net/ntnic: add interfaces for flow API engine

In reply to Serhii Iliushyk

Add ntnic basic flow filter functionality.

---
 drivers/net/ntnic/include/flow_api.h          |  89 ++
 drivers/net/ntnic/include/flow_api_actions.h  |  13 +
 drivers/net/ntnic/include/flow_api_engine.h   |  46 +
 drivers/net/ntnic/include/flow_filter.h       |  15 +
 drivers/net/ntnic/include/hw_mod_backend.h    |  70 ++
 drivers/net/ntnic/include/nt4ga_filter.h      |  16 +
 .../ntnic/include/stream_binary_flow_api.h    | 946 ++++++++++++++++++
 7 files changed, 1195 insertions(+)
 create mode 100644 drivers/net/ntnic/include/flow_api.h
 create mode 100644 drivers/net/ntnic/include/flow_api_actions.h
 create mode 100644 drivers/net/ntnic/include/flow_api_engine.h
 create mode 100644 drivers/net/ntnic/include/flow_filter.h
 create mode 100644 drivers/net/ntnic/include/hw_mod_backend.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_filter.h
 create mode 100644 drivers/net/ntnic/include/stream_binary_flow_api.h
drivers/net/ntnic/include/flow_api.h new file +89 -0
new file mode 100644
index 0000000000..4ccdbcde14
@@ -0,0 +1,89 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_API_H_
+#define _FLOW_API_H_
+
+#include <pthread.h>
+#include <stdint.h>
+#include <assert.h>
+
+#include "ntlog.h"
+
+#include "flow_api_actions.h"
+#include "flow_api_engine.h"
+#include "hw_mod_backend.h"
+#include "stream_binary_flow_api.h"
+
+/*
+ * Flow NIC and Eth port device management
+ */
+
+struct hw_mod_resource_s {
+	uint8_t *alloc_bm;	/* allocation bitmap */
+	uint32_t *ref;	/* reference counter for each resource element */
+	uint32_t resource_count;/* number of total available entries */
+};
+
+struct flow_eth_dev {
+	struct flow_nic_dev *ndev;	/* NIC that owns this port device */
+	uint8_t port;	/* NIC port id */
+	uint32_t port_id;	/* App assigned port_id - may be DPDK port_id */
+
+	struct flow_queue_id_s rx_queue[FLOW_MAX_QUEUES + 1];	/* 0th for exception */
+	int num_queues;	/* VSWITCH has exceptions sent on queue 0 per design */
+
+	int rss_target_id;	/* QSL_HSH index if RSS needed QSL v6+ */
+	struct flow_eth_dev *next;
+};
+
+enum flow_nic_hash_e {
+	HASH_ALGO_ROUND_ROBIN = 0,
+	HASH_ALGO_5TUPLE,
+};
+
+/* registered NIC backends */
+struct flow_nic_dev {
+	uint8_t adapter_no;	/* physical adapter no in the host system */
+	uint16_t ports;	/* number of in-ports addressable on this NIC */
+	enum flow_eth_dev_profile
+	flow_profile;	/* flow profile this NIC is initially prepared for */
+	int flow_mgnt_prepared;
+
+	struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */
+	void *km_res_handle;
+	void *kcc_res_handle;
+
+	void *flm_mtr_handle;
+	void *group_handle;
+	void *hw_db_handle;
+	void *id_table_handle;
+
+	/* statistics */
+	uint32_t flow_stat_id_map[MAX_COLOR_FLOW_STATS];
+
+	uint32_t flow_unique_id_counter;
+	/* linked list of all flows created on this NIC */
+	struct flow_handle *flow_base;
+	/* linked list of all FLM flows created on this NIC */
+	struct flow_handle *flow_base_flm;
+	pthread_mutex_t flow_mtx;
+
+	/* NIC backend API */
+	struct flow_api_backend_s be;
+	/* linked list of created eth-port devices on this NIC */
+	struct flow_eth_dev *eth_base;
+	pthread_mutex_t mtx;
+
+	/* pre allocated default QSL Drop */
+	int default_qsl_drop_index;
+	/* pre allocated default QSL Discard */
+	int default_qsl_discard_index;
+
+	/* next NIC linked list */
+	struct flow_nic_dev *next;
+};
+
+#endif
drivers/net/ntnic/include/flow_api_actions.h new file +13 -0
new file mode 100644
index 0000000000..f62cda5dc5
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_ACTIONS_H_
+#define _FLOW_ACTIONS_H_
+
+#include <stdint.h>
+
+#define MAX_COLOR_FLOW_STATS 0x400
+
+#endif	/* _FLOW_ACTIONS_H_ */
drivers/net/ntnic/include/flow_api_engine.h new file +46 -0

46 lines not on this page · raw message

drivers/net/ntnic/include/flow_filter.h new file +15 -0
new file mode 100644
index 0000000000..53f77a9b60
@@ -0,0 +1,15 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __FLOW_FILTER_HPP__
+#define __FLOW_FILTER_HPP__
+
+#include "flow_api.h"
+#include "nthw_fpga_model.h"
+
+int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no);
+int flow_filter_done(struct flow_nic_dev *dev);
+
+#endif	/* __FLOW_FILTER_HPP__ */
drivers/net/ntnic/include/hw_mod_backend.h new file +70 -0

70 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_filter.h new file +16 -0
new file mode 100644
index 0000000000..8d1abbd2ee
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_FILTER_H_
+#define NT4GA_FILTER_H_
+
+typedef struct nt4ga_filter_s {
+	int n_intf_cnt;
+	int n_queues_per_intf_cnt;
+
+	struct flow_nic_dev *mp_flow_device;
+} nt4ga_filter_t;
+
+#endif	/* NT4GA_FILTER_H_ */
drivers/net/ntnic/include/stream_binary_flow_api.h new file +946 -0

946 lines not on this page · raw message

Signature · 1 line
2.44.0
#25 lore raw

PATCH v2 9/17 net/ntnic: add VFIO module

In reply to Serhii Iliushyk

Add ntnic VFIO functionality.

---
 drivers/net/ntnic/ntnic_vfio.c | 232 +++++++++++++++++++++++++++++++++
 drivers/net/ntnic/ntnic_vfio.h |  21 +++
 2 files changed, 253 insertions(+)
 create mode 100644 drivers/net/ntnic/ntnic_vfio.c
 create mode 100644 drivers/net/ntnic/ntnic_vfio.h
drivers/net/ntnic/ntnic_vfio.c new file +232 -0
new file mode 100644
index 0000000000..116c238be6
@@ -0,0 +1,232 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <sys/ioctl.h>
+
+#include <rte_malloc.h>
+#include <rte_memory.h>
+#include <rte_vfio.h>
+#include <rte_dev.h>
+#include <rte_bus_pci.h>
+#include <rte_spinlock.h>
+
+#include <ntlog.h>
+#include <nt_util.h>
+#include "ntnic_vfio.h"
+
+#define ONE_G_SIZE 0x40000000
+#define ONE_G_MASK (ONE_G_SIZE - 1)
+#define START_VF_IOVA 0x220000000000
+
+int nt_vfio_vf_num(const struct rte_pci_device *pdev)
+{
+	return ((pdev->addr.devid & 0x1f) << 3) + ((pdev->addr.function) & 0x7);
+}
+
+/* Internal API */
+struct vfio_dev {
+	int container_fd;
+	int group_fd;
+	int dev_fd;
+	uint64_t iova_addr;
+};
+
+static struct vfio_dev vfio_list[256];
+
+static struct vfio_dev *vfio_get(int vf_num)
+{
+	if (vf_num < 0 || vf_num > 255)
+		return NULL;
+
+	return &vfio_list[vf_num];
+}
+
+/* External API */
+int nt_vfio_setup(struct rte_pci_device *dev)
+{
+	char devname[RTE_DEV_NAME_MAX_LEN] = { 0 };
+	int iommu_group_num;
+	int vf_num;
+	struct vfio_dev *vfio;
+
+	NT_LOG(INF, ETHDEV, "NT VFIO device setup %s\n", dev->name);
+
+	vf_num = nt_vfio_vf_num(dev);
+
+	vfio = vfio_get(vf_num);
+
+	if (vfio == NULL) {
+		NT_LOG(ERR, ETHDEV, "VFIO device setup failed. Illegal device id\n");
+		return -1;
+	}
+
+	vfio->dev_fd = -1;
+	vfio->group_fd = -1;
+	vfio->container_fd = -1;
+	vfio->iova_addr = START_VF_IOVA;
+
+	rte_pci_device_name(&dev->addr, devname, RTE_DEV_NAME_MAX_LEN);
+	rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname, &iommu_group_num);
+
+	if (vf_num == 0) {
+		/* use default container for pf0 */
+		vfio->container_fd = RTE_VFIO_DEFAULT_CONTAINER_FD;
+
+	} else {
+		vfio->container_fd = rte_vfio_container_create();
+
+		if (vfio->container_fd < 0) {
+			NT_LOG(ERR, ETHDEV,
+				"VFIO device setup failed. VFIO container creation failed.\n");
+			return -1;
+		}
+	}
+
+	vfio->group_fd = rte_vfio_container_group_bind(vfio->container_fd, iommu_group_num);
+
+	if (vfio->group_fd < 0) {
+		NT_LOG(ERR, ETHDEV,
+			"VFIO device setup failed. VFIO container group bind failed.\n");
+		goto err;
+	}
+
+	if (vf_num > 0) {
+		if (rte_pci_map_device(dev)) {
+			NT_LOG(ERR, ETHDEV,
+				"Map VFIO device failed. is the vfio-pci driver loaded?\n");
+			goto err;
+		}
+	}
+
+	vfio->dev_fd = rte_intr_dev_fd_get(dev->intr_handle);
+
+	NT_LOG(DBG, ETHDEV,
+		"%s: VFIO id=%d, dev_fd=%d, container_fd=%d, group_fd=%d, iommu_group_num=%d\n",
+		dev->name, vf_num, vfio->dev_fd, vfio->container_fd, vfio->group_fd,
+		iommu_group_num);
+
+	return vf_num;
+
+err:
+
+	if (vfio->container_fd != RTE_VFIO_DEFAULT_CONTAINER_FD)
+		rte_vfio_container_destroy(vfio->container_fd);
+
+	return -1;
+}
+
+int nt_vfio_remove(int vf_num)
+{
+	struct vfio_dev *vfio;
+
+	NT_LOG(DBG, ETHDEV, "NT VFIO device remove VF=%d\n", vf_num);
+
+	vfio = vfio_get(vf_num);
+
+	if (!vfio) {
+		NT_LOG(ERR, ETHDEV, "VFIO device remove failed. Illegal device id\n");
+		return -1;
+	}
+
+	rte_vfio_container_destroy(vfio->container_fd);
+	return 0;
+}
+
+int nt_vfio_dma_map(int vf_num, void *virt_addr, uint64_t *iova_addr, uint64_t size)
+{
+	uint64_t gp_virt_base;
+	uint64_t gp_offset;
+
+	if (size == ONE_G_SIZE) {
+		gp_virt_base = (uint64_t)virt_addr & ~ONE_G_MASK;
+		gp_offset = (uint64_t)virt_addr & ONE_G_MASK;
+
+	} else {
+		gp_virt_base = (uint64_t)virt_addr;
+		gp_offset = 0;
+	}
+
+	struct vfio_dev *vfio;
+
+	vfio = vfio_get(vf_num);
+
+	if (vfio == NULL) {
+		NT_LOG(ERR, ETHDEV, "VFIO MAP: VF number %d invalid\n", vf_num);
+		return -1;
+	}
+
+	NT_LOG(DBG, ETHDEV,
+		"VFIO MMAP VF=%d VirtAddr=%" PRIX64 " HPA=%" PRIX64 " VirtBase=%" PRIX64
+		" IOVA Addr=%" PRIX64 " size=%d\n",
+		vf_num, virt_addr, rte_malloc_virt2iova(virt_addr), gp_virt_base, vfio->iova_addr,
+		size);
+
+	int res = rte_vfio_container_dma_map(vfio->container_fd, gp_virt_base, vfio->iova_addr,
+			size);
+
+	NT_LOG(DBG, ETHDEV, "VFIO MMAP res %i, container_fd %i, vf_num %i\n", res,
+		vfio->container_fd, vf_num);
+
+	if (res) {
+		NT_LOG(ERR, ETHDEV, "rte_vfio_container_dma_map failed: res %d\n", res);
+		return -1;
+	}
+
+	*iova_addr = vfio->iova_addr + gp_offset;
+
+	vfio->iova_addr += ONE_G_SIZE;
+
+	return 0;
+}
+
+int nt_vfio_dma_unmap(int vf_num, void *virt_addr, uint64_t iova_addr, uint64_t size)
+{
+	uint64_t gp_virt_base;
+	struct vfio_dev *vfio;
+
+	if (size == ONE_G_SIZE) {
+		uint64_t gp_offset;
+		gp_virt_base = (uint64_t)virt_addr & ~ONE_G_MASK;
+		gp_offset = (uint64_t)virt_addr & ONE_G_MASK;
+		iova_addr -= gp_offset;
+
+	} else {
+		gp_virt_base = (uint64_t)virt_addr;
+	}
+
+	vfio = vfio_get(vf_num);
+
+	if (vfio == NULL) {
+		NT_LOG(ERR, ETHDEV, "VFIO UNMAP: VF number %d invalid\n", vf_num);
+		return -1;
+	}
+
+	if (vfio->container_fd == -1)
+		return 0;
+
+	int res = rte_vfio_container_dma_unmap(vfio->container_fd, gp_virt_base, iova_addr, size);
+
+	if (res != 0) {
+		NT_LOG(ERR, ETHDEV,
+			"VFIO UNMMAP FAILED! res %i, container_fd %i, vf_num %i, virt_base=%" PRIX64
+			", IOVA=%" PRIX64 ", size=%llu\n",
+			res, vfio->container_fd, vf_num, gp_virt_base, iova_addr, size);
+		return -1;
+	}
+
+	return 0;
+}
+
+/* Internal init */
+
+RTE_INIT(nt_vfio_init);
+
+static void nt_vfio_init(void)
+{
+	struct nt_util_vfio_impl s = { .vfio_dma_map = nt_vfio_dma_map,
+		       .vfio_dma_unmap = nt_vfio_dma_unmap
+	};
+	nt_util_vfio_init(&s);
+}
drivers/net/ntnic/ntnic_vfio.h new file +21 -0
new file mode 100644
index 0000000000..0e3b12f847
@@ -0,0 +1,21 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _NTNIC_VFIO_H_
+#define _NTNIC_VFIO_H_
+
+#include <rte_dev.h>
+#include <rte_bus_pci.h>
+#include <ethdev_pci.h>
+
+int nt_vfio_setup(struct rte_pci_device *dev);
+int nt_vfio_remove(int vf_num);
+
+int nt_vfio_dma_map(int vf_num, void *virt_addr, uint64_t *iova_addr, uint64_t size);
+int nt_vfio_dma_unmap(int vf_num, void *virt_addr, uint64_t iova_addr, uint64_t size);
+
+/* Find device (PF/VF) number from device address */
+int nt_vfio_vf_num(const struct rte_pci_device *dev);
+#endif	/* _NTNIC_VFIO_H_ */
Signature · 1 line
2.44.0
#26 lore raw

PATCH v2 10/17 net/ntnic: add Logs and utilities implementation

In reply to Serhii Iliushyk

Add ntnic logging API and utilities.

---
v2:
* Fixed unused header
* Fixed error on -Wformat-nonliteral

---
 drivers/net/ntnic/ntlog/include/ntlog.h    | 162 +++++++++++++++++++++
 drivers/net/ntnic/ntlog/ntlog.c            | 111 ++++++++++++++
 drivers/net/ntnic/ntutil/include/nt_util.h |  51 +++++++
 drivers/net/ntnic/ntutil/nt_util.c         |  97 ++++++++++++
 4 files changed, 421 insertions(+)
 create mode 100644 drivers/net/ntnic/ntlog/include/ntlog.h
 create mode 100644 drivers/net/ntnic/ntlog/ntlog.c
 create mode 100644 drivers/net/ntnic/ntutil/include/nt_util.h
 create mode 100644 drivers/net/ntnic/ntutil/nt_util.c
drivers/net/ntnic/ntlog/include/ntlog.h new file +162 -0
new file mode 100644
index 0000000000..75fc08d4e1
@@ -0,0 +1,162 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NTOSS_SYSTEM_NTLOG_H
+#define NTOSS_SYSTEM_NTLOG_H
+
+#include <stdarg.h>
+#include <stdint.h>
+
+#ifndef NT_LOG_MODULE_PREFIX
+
+/* DPDK modules */
+#define NT_LOG_MODULE_EAL 0
+#define NT_LOG_MODULE_MALLOC 1
+#define NT_LOG_MODULE_RING 2
+#define NT_LOG_MODULE_MEMPOOL 3
+#define NT_LOG_MODULE_TIMER 4
+#define NT_LOG_MODULE_PMD 5
+#define NT_LOG_MODULE_HASH 6
+#define NT_LOG_MODULE_LPM 7
+#define NT_LOG_MODULE_KNI 8
+#define NT_LOG_MODULE_ACL 9
+#define NT_LOG_MODULE_POWER 10
+#define NT_LOG_MODULE_METER 11
+#define NT_LOG_MODULE_SCHED 12
+#define NT_LOG_MODULE_PORT 13
+#define NT_LOG_MODULE_TABLE 14
+#define NT_LOG_MODULE_PIPELINE 15
+#define NT_LOG_MODULE_MBUF 16
+#define NT_LOG_MODULE_CRYPTODEV 17
+#define NT_LOG_MODULE_EFD 18
+#define NT_LOG_MODULE_EVENTDEV 19
+#define NT_LOG_MODULE_GSO 20
+#define NT_LOG_MODULE_USER1 24
+#define NT_LOG_MODULE_USER2 25
+#define NT_LOG_MODULE_USER3 26
+#define NT_LOG_MODULE_USER4 27
+#define NT_LOG_MODULE_USER5 28
+#define NT_LOG_MODULE_USER6 29
+#define NT_LOG_MODULE_USER7 30
+#define NT_LOG_MODULE_USER8 31
+
+/* NT modules */
+#define NT_LOG_MODULE_GENERAL 10000	/* Should always be a first (smallest) */
+#define NT_LOG_MODULE_NTHW 10001
+#define NT_LOG_MODULE_FILTER 10002
+#define NT_LOG_MODULE_DRV 10003
+#define NT_LOG_MODULE_VDPA 10004
+#define NT_LOG_MODULE_FPGA 10005
+#define NT_LOG_MODULE_NTCONNECT 10006
+#define NT_LOG_MODULE_ETHDEV 10007
+#define NT_LOG_MODULE_SENSOR 10008
+#define NT_LOG_MODULE_END 10009	/* Mark for the range end of NT_LOG */
+
+#define NT_LOG_MODULE_COUNT (NT_LOG_MODULE_END - NT_LOG_MODULE_GENERAL)
+#define NT_LOG_MODULE_INDEX(module) ((module) - (NT_LOG_MODULE_GENERAL))
+#define NT_LOG_MODULE_PREFIX(type) NT_LOG_MODULE_##type
+
+#endif
+
+#ifndef NT_LOG_ENABLE
+#define NT_LOG_ENABLE 1
+#endif
+
+#if defined NT_LOG_ENABLE && NT_LOG_ENABLE > 0
+#ifndef NT_LOG_ENABLE_ERR
+#define NT_LOG_ENABLE_ERR 1
+#endif
+#ifndef NT_LOG_ENABLE_WRN
+#define NT_LOG_ENABLE_WRN 1
+#endif
+#ifndef NT_LOG_ENABLE_INF
+#define NT_LOG_ENABLE_INF 1
+#endif
+#ifndef NT_LOG_ENABLE_DBG
+#define NT_LOG_ENABLE_DBG 1
+#endif
+#ifndef NT_LOG_ENABLE_DB1
+#define NT_LOG_ENABLE_DB1 0
+#endif
+#ifndef NT_LOG_ENABLE_DB2
+#define NT_LOG_ENABLE_DB2 0
+#endif
+#endif
+
+#if defined NT_LOG_ENABLE_ERR && NT_LOG_ENABLE_ERR > 0
+#define NT_LOG_NT_LOG_ERR(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_ERR(...)
+#endif
+
+#if defined NT_LOG_ENABLE_WRN && NT_LOG_ENABLE_WRN > 0
+#define NT_LOG_NT_LOG_WRN(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_WRN(...)
+#endif
+
+#if defined NT_LOG_ENABLE_INF && NT_LOG_ENABLE_INF > 0
+#define NT_LOG_NT_LOG_INF(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_INF(...)
+#endif
+
+#if defined NT_LOG_ENABLE_DBG && NT_LOG_ENABLE_DBG > 0
+#define NT_LOG_NT_LOG_DBG(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_DBG(...)
+#endif
+
+#if defined NT_LOG_ENABLE_DB1 && NT_LOG_ENABLE_DB1 > 0
+#define NT_LOG_NT_LOG_DB1(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_DB1(...)
+#endif
+
+#if defined NT_LOG_ENABLE_DB2 && NT_LOG_ENABLE_DB2 > 0
+#define NT_LOG_NT_LOG_DB2(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_DB2(...)
+#endif
+
+#define NT_LOG(level, module, ...)                                                                \
+	NT_LOG_NT_LOG_##level(NT_LOG_##level, NT_LOG_MODULE_PREFIX(module),                       \
+			      #module ": " #level ": " __VA_ARGS__)
+
+enum nt_log_level {
+	NT_LOG_ERR = 0x001,
+	NT_LOG_WRN = 0x002,
+	NT_LOG_INF = 0x004,
+	NT_LOG_DBG = 0x008,
+	NT_LOG_DB1 = 0x010,
+	NT_LOG_DB2 = 0x020,
+};
+
+struct nt_log_impl {
+	int (*init)(void);
+	int (*log)(enum nt_log_level level, uint32_t module, const char *format, va_list args);
+	int (*is_debug)(uint32_t module);
+};
+
+int nt_log_init(struct nt_log_impl *impl);
+
+int nt_log(enum nt_log_level level, uint32_t module, const char *format, ...);
+
+/* Returns 1 if RTE_DEBUG, 0 if lower log level, -1 if incorrect module */
+int nt_log_is_debug(uint32_t module);
+
+/*
+ * nt log helper functions
+ * to create a string for NT_LOG usage to output a one-liner log
+ * to use when one single function call to NT_LOG is not optimal - that is
+ * you do not know the number of parameters at programming time or it is variable
+ */
+char *ntlog_helper_str_alloc(const char *sinit);
+
+void ntlog_helper_str_add(char *s, const char *format, ...);
+
+void ntlog_helper_str_free(char *s);
+
+#endif	/* NTOSS_SYSTEM_NTLOG_H */
drivers/net/ntnic/ntlog/ntlog.c new file +111 -0

111 lines not on this page · raw message

drivers/net/ntnic/ntutil/include/nt_util.h new file +51 -0

51 lines not on this page · raw message

drivers/net/ntnic/ntutil/nt_util.c new file +97 -0

97 lines not on this page · raw message

Signature · 1 line
2.44.0
#27 lore raw

PATCH v2 11/17 net/ntnic: add ethdev and makes PMD available

In reply to Serhii Iliushyk

Add ethdev to ntnic.

---
v2:
* Fixed error on -Wformat-nonliteral
* Fixed WARNING:TYPO_SPELLING
* Fixed commented lines in meson file
* Fixed unused functions

---
 .mailmap                           |    1 +
 MAINTAINERS                        |    6 +
 doc/guides/nics/features/ntnic.ini |    9 +
 doc/guides/nics/index.rst          |    1 +
 doc/guides/nics/ntnic.rst          |  115 +++
 drivers/net/meson.build            |    1 +
 drivers/net/ntnic/meson.build      |   94 ++
 drivers/net/ntnic/ntnic_ethdev.c   | 1538 ++++++++++++++++++++++++++++
 drivers/net/ntnic/ntnic_ethdev.h   |   32 +
 drivers/net/ntnic/rte_pmd_ntnic.h  |   43 +
 10 files changed, 1840 insertions(+)
 create mode 100644 doc/guides/nics/features/ntnic.ini
 create mode 100644 doc/guides/nics/ntnic.rst
 create mode 100644 drivers/net/ntnic/meson.build
 create mode 100644 drivers/net/ntnic/ntnic_ethdev.c
 create mode 100644 drivers/net/ntnic/ntnic_ethdev.h
 create mode 100644 drivers/net/ntnic/rte_pmd_ntnic.h
.mailmap +1 -0
index 87fa24714e..99719b74a1 100644
@@ -1288,6 +1288,7 @@ Sergey Madaminov <[email protected]>
 Sergey Mironov <[email protected]>
 Sergey Temerkhanov <[email protected]>
 Sergio Gonzalez Monroy <[email protected]>
+Serhii Iliushyk <[email protected]>
 Seth Arnold <[email protected]>
 Seth Howell <[email protected]>
 Shachar Beiser <[email protected]>
MAINTAINERS +6 -0
index c9adff9846..27e818d050 100644
@@ -1063,6 +1063,12 @@ F: drivers/net/memif/
 F: doc/guides/nics/memif.rst
 F: doc/guides/nics/features/memif.ini
 
+NTNIC PMD
+M: Christian Koue Muf <[email protected]>
+M: Serhii Iliushyk <[email protected]>
+F: drivers/net/ntnic/
+F: doc/guides/nics/ntnic.rst
+F: doc/guides/nics/features/ntnic.ini
 
 Crypto Drivers
 --------------
doc/guides/nics/features/ntnic.ini new file +9 -0
new file mode 100644
index 0000000000..25abc6df89
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'ntnic' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Link status          = Y
+Linux                = Y
+x86-64               = Y
doc/guides/nics/index.rst +1 -0
index 7bfcac880f..c14bc7988a 100644
@@ -53,6 +53,7 @@ Network Interface Controller Drivers
     nfb
     nfp
     ngbe
+    ntnic
     null
     octeon_ep
     octeontx
doc/guides/nics/ntnic.rst new file +115 -0

115 lines not on this page · raw message

drivers/net/meson.build +1 -0
index bd38b533c5..fb6d34b782 100644
@@ -45,6 +45,7 @@ drivers = [
         'nfb',
         'nfp',
         'ngbe',
+        'ntnic',
         'null',
         'octeontx',
         'octeon_ep',
drivers/net/ntnic/meson.build new file +94 -0

94 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c new file +1538 -0

1,538 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.h new file +32 -0
new file mode 100644
index 0000000000..c82070e9de
@@ -0,0 +1,32 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTNIC_ETHDEV_H__
+#define __NTNIC_ETHDEV_H__
+
+#include <rte_ether.h>
+#include <rte_version.h>/* RTE_VERSION, RTE_VERSION_NUM */
+#include <rte_mbuf.h>
+#include <rte_pci.h>
+#include <ethdev_pci.h>
+
+#include "ntos_drv.h"
+#include "ntos_system.h"
+#include "ntoss_virt_queue.h"
+#include "ntnic_stat.h"
+#include "nt_util.h"
+#include "stream_binary_flow_api.h"
+
+/* Total max ports per NT NFV NIC */
+#define MAX_NTNIC_PORTS 2
+
+/* Functions: */
+struct drv_s *get_pdrv(uint8_t adapter_no);
+
+extern uint64_t rte_tsc_freq;
+extern rte_spinlock_t hwlock;
+
+
+#endif	/* __NTNIC_ETHDEV_H__ */
drivers/net/ntnic/rte_pmd_ntnic.h new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.44.0
#28 lore raw

PATCH v2 12/17 net/ntnic: add support of the NT200A0X smartNIC

In reply to Serhii Iliushyk

Add ntnic support for NT200A0X NIC

* Reset

* Clock profiles

* FPGA Registers

* API for FPGA registers

---
 .../NT200A02_U23_Si5340_adr0_v5-Registers.h   |  752 +++++++++++
 drivers/net/ntnic/meson.build                 |   16 +
 .../clock_profiles/nthw_fpga_clk9563.c        |   51 +
 .../clock_profiles/nthw_fpga_clk9563.h        |    9 +
 .../nthw/core/nt200a0x/nthw_fpga_nt200a0x.c   |  107 ++
 .../nthw/core/nt200a0x/nthw_fpga_nt200a0x.h   |    9 +
 .../core/nt200a0x/reset/nthw_fpga_rst9563.c   |  258 ++++
 .../core/nt200a0x/reset/nthw_fpga_rst9563.h   |    9 +
 .../nt200a0x/reset/nthw_fpga_rst_nt200a0x.c   |  729 ++++++++++
 .../nt200a0x/reset/nthw_fpga_rst_nt200a0x.h   |    9 +
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |  888 +++++++++++++
 drivers/net/ntnic/nthw/core/nthw_fpga_rst.c   |   10 +
 drivers/net/ntnic/nthw/core/nthw_hif.c        |  312 +++++
 drivers/net/ntnic/nthw/core/nthw_iic.c        |  529 ++++++++
 .../net/ntnic/nthw/core/nthw_mac_pcs_xxv.c    | 1169 +++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_pcie3.c      |  270 ++++
 drivers/net/ntnic/nthw/core/nthw_sdc.c        |  176 +++
 drivers/net/ntnic/nthw/core/nthw_si5340.c     |  205 +++
 drivers/net/ntnic/nthw/core/nthw_spi_v3.c     |  356 +++++
 drivers/net/ntnic/nthw/core/nthw_spim.c       |  121 ++
 drivers/net/ntnic/nthw/core/nthw_spis.c       |  129 ++
 drivers/net/ntnic/nthw/core/nthw_tsm.c        |  167 +++
 22 files changed, 6281 insertions(+)
 create mode 100644 drivers/net/ntnic/include/NT200A02_U23_Si5340_adr0_v5-Registers.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_fpga.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_fpga_rst.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_hif.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_iic.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_mac_pcs_xxv.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcie3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_sdc.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5340.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spi_v3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spim.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spis.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_tsm.c
drivers/net/ntnic/include/NT200A02_U23_Si5340_adr0_v5-Registers.h new file +752 -0
new file mode 100644
index 0000000000..c4185c77ff
@@ -0,0 +1,752 @@
+/*
+ * Si5340 Rev D Configuration Register Export Header File
+ *
+ * This file represents a series of Silicon Labs Si5340 Rev D
+ * register writes that can be performed to load a single configuration
+ * on a device. It was created by a Silicon Labs ClockBuilder Pro
+ * export tool.
+ *
+ * Part:		                                       Si5340 Rev D
+ * Design ID:                                          05
+ * Includes Pre/Post Download Control Register Writes: Yes
+ * Created By:                                         ClockBuilder Pro v2.28.1 [2018-09-24]
+ * Timestamp:                                          2018-11-14 16:20:29 GMT+01:00
+ *
+ * A complete design report corresponding to this export is included at the end
+ * of this header file.
+ *
+ */
+
+#ifndef SI5340_REVD_REG_CONFIG_HEADER
+#define SI5340_REVD_REG_CONFIG_HEADER
+
+#define SI5340_REVD_REG_CONFIG_NUM_REGS 326
+
+typedef struct {
+	unsigned int address;	/* 16-bit register address */
+	unsigned char value;	/* 8-bit register data */
+
+} si5340_revd_register_t;
+
+static const si5340_revd_register_t si5340_revd_registers[SI5340_REVD_REG_CONFIG_NUM_REGS] = {
+	/* Start configuration preamble */
+	{ 0x0B24, 0xC0 },
+	{ 0x0B25, 0x00 },
+	/* Rev D stuck divider fix */
+	{ 0x0502, 0x01 },
+	{ 0x0505, 0x03 },
+	{ 0x0957, 0x17 },
+	{ 0x0B4E, 0x1A },
+	/* End configuration preamble */
+
+	/* Delay 300 msec */
+	/*    Delay is worst case time for device to complete any calibration */
+	/*    that is running due to device state change previous to this script */
+	/*    being processed. */
+
+	/* Start configuration registers */
+	{ 0x0006, 0x00 },
+	{ 0x0007, 0x00 },
+	{ 0x0008, 0x00 },
+	{ 0x000B, 0x74 },
+	{ 0x0017, 0xF0 },
+	{ 0x0018, 0xFF },
+	{ 0x0021, 0x0F },
+	{ 0x0022, 0x00 },
+	{ 0x002B, 0x0A },
+	{ 0x002C, 0x20 },
+	{ 0x002D, 0x00 },
+	{ 0x002E, 0x00 },
+	{ 0x002F, 0x00 },
+	{ 0x0030, 0x00 },
+	{ 0x0031, 0x00 },
+	{ 0x0032, 0x00 },
+	{ 0x0033, 0x00 },
+	{ 0x0034, 0x00 },
+	{ 0x0035, 0x00 },
+	{ 0x0036, 0x00 },
+	{ 0x0037, 0x00 },
+	{ 0x0038, 0x00 },
+	{ 0x0039, 0x00 },
+	{ 0x003A, 0x00 },
+	{ 0x003B, 0x00 },
+	{ 0x003C, 0x00 },
+	{ 0x003D, 0x00 },
+	{ 0x0041, 0x00 },
+	{ 0x0042, 0x00 },
+	{ 0x0043, 0x00 },
+	{ 0x0044, 0x00 },
+	{ 0x009E, 0x00 },
+	{ 0x0102, 0x01 },
+	{ 0x0112, 0x02 },
+	{ 0x0113, 0x09 },
+	{ 0x0114, 0x3E },
+	{ 0x0115, 0x19 },
+	{ 0x0117, 0x06 },
+	{ 0x0118, 0x09 },
+	{ 0x0119, 0x3E },
+	{ 0x011A, 0x18 },
+	{ 0x0126, 0x06 },
+	{ 0x0127, 0x09 },
+	{ 0x0128, 0x3E },
+	{ 0x0129, 0x18 },
+	{ 0x012B, 0x06 },
+	{ 0x012C, 0x09 },
+	{ 0x012D, 0x3E },
+	{ 0x012E, 0x1A },
+	{ 0x013F, 0x00 },
+	{ 0x0140, 0x00 },
+	{ 0x0141, 0x40 },
+	{ 0x0206, 0x00 },
+	{ 0x0208, 0x00 },
+	{ 0x0209, 0x00 },
+	{ 0x020A, 0x00 },
+	{ 0x020B, 0x00 },
+	{ 0x020C, 0x00 },
+	{ 0x020D, 0x00 },
+	{ 0x020E, 0x00 },
+	{ 0x020F, 0x00 },
+	{ 0x0210, 0x00 },
+	{ 0x0211, 0x00 },
+	{ 0x0212, 0x00 },
+	{ 0x0213, 0x00 },
+	{ 0x0214, 0x00 },
+	{ 0x0215, 0x00 },
+	{ 0x0216, 0x00 },
+	{ 0x0217, 0x00 },
+	{ 0x0218, 0x00 },
+	{ 0x0219, 0x00 },
+	{ 0x021A, 0x00 },
+	{ 0x021B, 0x00 },
+	{ 0x021C, 0x00 },
+	{ 0x021D, 0x00 },
+	{ 0x021E, 0x00 },
+	{ 0x021F, 0x00 },
+	{ 0x0220, 0x00 },
+	{ 0x0221, 0x00 },
+	{ 0x0222, 0x00 },
+	{ 0x0223, 0x00 },
+	{ 0x0224, 0x00 },
+	{ 0x0225, 0x00 },
+	{ 0x0226, 0x00 },
+	{ 0x0227, 0x00 },
+	{ 0x0228, 0x00 },
+	{ 0x0229, 0x00 },
+	{ 0x022A, 0x00 },
+	{ 0x022B, 0x00 },
+	{ 0x022C, 0x00 },
+	{ 0x022D, 0x00 },
+	{ 0x022E, 0x00 },
+	{ 0x022F, 0x00 },
+	{ 0x0235, 0x00 },
+	{ 0x0236, 0x00 },
+	{ 0x0237, 0x00 },
+	{ 0x0238, 0xA6 },
+	{ 0x0239, 0x8B },
+	{ 0x023A, 0x00 },
+	{ 0x023B, 0x00 },
+	{ 0x023C, 0x00 },
+	{ 0x023D, 0x00 },
+	{ 0x023E, 0x80 },
+	{ 0x0250, 0x03 },
+	{ 0x0251, 0x00 },
+	{ 0x0252, 0x00 },
+	{ 0x0253, 0x00 },
+	{ 0x0254, 0x00 },
+	{ 0x0255, 0x00 },
+	{ 0x025C, 0x00 },
+	{ 0x025D, 0x00 },
+	{ 0x025E, 0x00 },
+	{ 0x025F, 0x00 },
+	{ 0x0260, 0x00 },
+	{ 0x0261, 0x00 },
+	{ 0x026B, 0x30 },
+	{ 0x026C, 0x35 },
+	{ 0x026D, 0x00 },
+	{ 0x026E, 0x00 },
+	{ 0x026F, 0x00 },
+	{ 0x0270, 0x00 },
+	{ 0x0271, 0x00 },
+	{ 0x0272, 0x00 },
+	{ 0x0302, 0x00 },
+	{ 0x0303, 0x00 },
+	{ 0x0304, 0x00 },
+	{ 0x0305, 0x00 },
+	{ 0x0306, 0x0D },
+	{ 0x0307, 0x00 },
+	{ 0x0308, 0x00 },
+	{ 0x0309, 0x00 },
+	{ 0x030A, 0x00 },
+	{ 0x030B, 0x80 },
+	{ 0x030C, 0x00 },
+	{ 0x030D, 0x00 },
+	{ 0x030E, 0x00 },
+	{ 0x030F, 0x00 },
+	{ 0x0310, 0x61 },
+	{ 0x0311, 0x08 },
+	{ 0x0312, 0x00 },
+	{ 0x0313, 0x00 },
+	{ 0x0314, 0x00 },
+	{ 0x0315, 0x00 },
+	{ 0x0316, 0x80 },
+	{ 0x0317, 0x00 },
+	{ 0x0318, 0x00 },
+	{ 0x0319, 0x00 },
+	{ 0x031A, 0x00 },
+	{ 0x031B, 0xD0 },
+	{ 0x031C, 0x1A },
+	{ 0x031D, 0x00 },
+	{ 0x031E, 0x00 },
+	{ 0x031F, 0x00 },
+	{ 0x0320, 0x00 },
+	{ 0x0321, 0xA0 },
+	{ 0x0322, 0x00 },
+	{ 0x0323, 0x00 },
+	{ 0x0324, 0x00 },
+	{ 0x0325, 0x00 },
+	{ 0x0326, 0x00 },
+	{ 0x0327, 0x00 },
+	{ 0x0328, 0x00 },
+	{ 0x0329, 0x00 },
+	{ 0x032A, 0x00 },
+	{ 0x032B, 0x00 },
+	{ 0x032C, 0x00 },
+	{ 0x032D, 0x00 },
+	{ 0x0338, 0x00 },
+	{ 0x0339, 0x1F },
+	{ 0x033B, 0x00 },
+	{ 0x033C, 0x00 },
+	{ 0x033D, 0x00 },
+	{ 0x033E, 0x00 },
+	{ 0x033F, 0x00 },
+	{ 0x0340, 0x00 },
+	{ 0x0341, 0x00 },
+	{ 0x0342, 0x00 },
+	{ 0x0343, 0x00 },
+	{ 0x0344, 0x00 },
+	{ 0x0345, 0x00 },
+	{ 0x0346, 0x00 },
+	{ 0x0347, 0x00 },
+	{ 0x0348, 0x00 },
+	{ 0x0349, 0x00 },
+	{ 0x034A, 0x00 },
+	{ 0x034B, 0x00 },
+	{ 0x034C, 0x00 },
+	{ 0x034D, 0x00 },
+	{ 0x034E, 0x00 },
+	{ 0x034F, 0x00 },
+	{ 0x0350, 0x00 },
+	{ 0x0351, 0x00 },
+	{ 0x0352, 0x00 },
+	{ 0x0359, 0x00 },
+	{ 0x035A, 0x00 },
+	{ 0x035B, 0x00 },
+	{ 0x035C, 0x00 },
+	{ 0x035D, 0x00 },
+	{ 0x035E, 0x00 },
+	{ 0x035F, 0x00 },
+	{ 0x0360, 0x00 },
+	{ 0x0802, 0x00 },
+	{ 0x0803, 0x00 },
+	{ 0x0804, 0x00 },
+	{ 0x0805, 0x00 },
+	{ 0x0806, 0x00 },
+	{ 0x0807, 0x00 },
+	{ 0x0808, 0x00 },
+	{ 0x0809, 0x00 },
+	{ 0x080A, 0x00 },
+	{ 0x080B, 0x00 },
+	{ 0x080C, 0x00 },
+	{ 0x080D, 0x00 },
+	{ 0x080E, 0x00 },
+	{ 0x080F, 0x00 },
+	{ 0x0810, 0x00 },
+	{ 0x0811, 0x00 },
+	{ 0x0812, 0x00 },
+	{ 0x0813, 0x00 },
+	{ 0x0814, 0x00 },
+	{ 0x0815, 0x00 },
+	{ 0x0816, 0x00 },
+	{ 0x0817, 0x00 },
+	{ 0x0818, 0x00 },
+	{ 0x0819, 0x00 },
+	{ 0x081A, 0x00 },
+	{ 0x081B, 0x00 },
+	{ 0x081C, 0x00 },
+	{ 0x081D, 0x00 },
+	{ 0x081E, 0x00 },
+	{ 0x081F, 0x00 },
+	{ 0x0820, 0x00 },
+	{ 0x0821, 0x00 },
+	{ 0x0822, 0x00 },
+	{ 0x0823, 0x00 },
+	{ 0x0824, 0x00 },
+	{ 0x0825, 0x00 },
+	{ 0x0826, 0x00 },
+	{ 0x0827, 0x00 },
+	{ 0x0828, 0x00 },
+	{ 0x0829, 0x00 },
+	{ 0x082A, 0x00 },
+	{ 0x082B, 0x00 },
+	{ 0x082C, 0x00 },
+	{ 0x082D, 0x00 },
+	{ 0x082E, 0x00 },
+	{ 0x082F, 0x00 },
+	{ 0x0830, 0x00 },
+	{ 0x0831, 0x00 },
+	{ 0x0832, 0x00 },
+	{ 0x0833, 0x00 },
+	{ 0x0834, 0x00 },
+	{ 0x0835, 0x00 },
+	{ 0x0836, 0x00 },
+	{ 0x0837, 0x00 },
+	{ 0x0838, 0x00 },
+	{ 0x0839, 0x00 },
+	{ 0x083A, 0x00 },
+	{ 0x083B, 0x00 },
+	{ 0x083C, 0x00 },
+	{ 0x083D, 0x00 },
+	{ 0x083E, 0x00 },
+	{ 0x083F, 0x00 },
+	{ 0x0840, 0x00 },
+	{ 0x0841, 0x00 },
+	{ 0x0842, 0x00 },
+	{ 0x0843, 0x00 },
+	{ 0x0844, 0x00 },
+	{ 0x0845, 0x00 },
+	{ 0x0846, 0x00 },
+	{ 0x0847, 0x00 },
+	{ 0x0848, 0x00 },
+	{ 0x0849, 0x00 },
+	{ 0x084A, 0x00 },
+	{ 0x084B, 0x00 },
+	{ 0x084C, 0x00 },
+	{ 0x084D, 0x00 },
+	{ 0x084E, 0x00 },
+	{ 0x084F, 0x00 },
+	{ 0x0850, 0x00 },
+	{ 0x0851, 0x00 },
+	{ 0x0852, 0x00 },
+	{ 0x0853, 0x00 },
+	{ 0x0854, 0x00 },
+	{ 0x0855, 0x00 },
+	{ 0x0856, 0x00 },
+	{ 0x0857, 0x00 },
+	{ 0x0858, 0x00 },
+	{ 0x0859, 0x00 },
+	{ 0x085A, 0x00 },
+	{ 0x085B, 0x00 },
+	{ 0x085C, 0x00 },
+	{ 0x085D, 0x00 },
+	{ 0x085E, 0x00 },
+	{ 0x085F, 0x00 },
+	{ 0x0860, 0x00 },
+	{ 0x0861, 0x00 },
+	{ 0x090E, 0x02 },
+	{ 0x091C, 0x04 },
+	{ 0x0943, 0x00 },
+	{ 0x0949, 0x00 },
+	{ 0x094A, 0x00 },
+	{ 0x094E, 0x49 },
+	{ 0x094F, 0x02 },
+	{ 0x095E, 0x00 },
+	{ 0x0A02, 0x00 },
+	{ 0x0A03, 0x07 },
+	{ 0x0A04, 0x01 },
+	{ 0x0A05, 0x07 },
+	{ 0x0A14, 0x00 },
+	{ 0x0A1A, 0x00 },
+	{ 0x0A20, 0x00 },
+	{ 0x0A26, 0x00 },
+	{ 0x0B44, 0x0F },
+	{ 0x0B4A, 0x08 },
+	{ 0x0B57, 0x0E },
+	{ 0x0B58, 0x01 },
+	/* End configuration registers */
+
+	/* Start configuration postamble */
+	{ 0x001C, 0x01 },
+	{ 0x0B24, 0xC3 },
+	{ 0x0B25, 0x02 },
+	/* End configuration postamble */
+};
+
+/*
+ * Design Report
+ *
+ * Overview
+ * ========
+ * Part:               Si5340AB Rev D
+ * Project File:       P:\Hardware\NT
+ * Adapters\NT200A02\design\Clock_syn_design\NT200A02_U23_Si5340_adr0_v5.slabtimeproj Design ID: 05
+ * Created By:         ClockBuilder Pro v2.28.1 [2018-09-24]
+ * Timestamp:          2018-11-14 16:20:29 GMT+01:00
+ *
+ * Design Rule Check
+ * =================
+ * Errors:
+ * - No errors
+ *
+ * Warnings:
+ * - No warnings
+ *
+ * Device Grade
+ * ============
+ * Maximum Output Frequency: 257.8125 MHz
+ * Frequency Synthesis Mode: Fractional
+ * Frequency Plan Grade:     B
+ * Minimum Base OPN:         Si5340B*
+ *
+ * Base       Output Clock         Supported Frequency Synthesis Modes
+ * OPN Grade  Frequency Range      (Typical Jitter)
+ * ---------  -------------------  --------------------------------------------
+ * Si5340A    100 Hz to 1.028 GHz  Integer (< 100 fs) and fractional (< 150 fs)
+ * Si5340B*   100 Hz to 350 MHz    "
+ * Si5340C    100 Hz to 1.028 GHz  Integer only (< 100 fs)
+ * Si5340D    100 Hz to 350 MHz    "
+ *
+ * * Based on your calculated frequency plan, a Si5340B grade device is
+ * sufficient for your design. For more in-system configuration flexibility
+ * (higher frequencies and/or to enable fractional synthesis), consider
+ * selecting device grade Si5340A when specifying an ordering part number (OPN)
+ * for your application. See the datasheet Ordering Guide for more information.
+ *
+ * Design
+ * ======
+ * Host Interface:
+ *    I/O Power Supply: VDD (Core)
+ *    SPI Mode: 3-Wire
+ *    I2C Address Range: 116d to 119d / 0x74 to 0x77 (selected via A0/A1 pins)
+ *
+ * Inputs:
+ *    XAXB: 48 MHz
+ *          Crystal Mode
+ *     IN0: Unused
+ *     IN1: Unused
+ *     IN2: Unused
+ *   FB_IN: Unused
+ *
+ * Outputs:
+ *    OUT0: 100 MHz
+ *          Enabled, LVDS 1.8 V
+ *    OUT1: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *          Enabled, LVDS 1.8 V
+ *    OUT2: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *          Enabled, LVDS 1.8 V
+ *    OUT3: 156.25 MHz [ 156 + 1/4 MHz ]
+ *          Enabled, LVDS 1.8 V
+ *
+ * Frequency Plan
+ * ==============
+ * Priority: OUT1 is lowest jitter output
+ *
+ * Fpfd = 48 MHz
+ * Fvco = 13.40625 GHz [ 13 + 13/32 GHz ]
+ * Fms0 = 515.625 MHz [ 515 + 5/8 MHz ]
+ * Fms1 = 800 MHz
+ * Fms2 = 312.5 MHz [ 312 + 1/2 MHz ]
+ *
+ * P dividers:
+ *    P0  = Unused
+ *    P1  = Unused
+ *    P2  = Unused
+ *    P3  = Unused
+ *    Pxaxb = 1
+ *
+ * M = 279.296875 [ 279 + 19/64 ]
+ * N dividers:
+ *    N0:
+ *       Value: 26
+ *       Skew:  0.000 s
+ *       OUT1: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *       OUT2: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *    N1:
+ *       Value: 16.7578125 [ 16 + 97/128 ]
+ *       Skew:  0.000 s
+ *       OUT0: 100 MHz
+ *    N2:
+ *       Value: 42.9 [ 42 + 9/10 ]
+ *       Skew:  0.000 s
+ *       OUT3: 156.25 MHz [ 156 + 1/4 MHz ]
+ *    N3:
+ *       Unused
+ *
+ * R dividers:
+ *    R0 = 8
+ *    R1 = 2
+ *    R2 = 2
+ *    R3 = 2
+ *
+ * Dividers listed above show effective values. These values are translated to register settings by
+ * ClockBuilder Pro. For the actual register values, see below. Refer to the Family Reference
+ * Manual for information on registers related to frequency plan.
+ *
+ * Digitally Controlled Oscillator (DCO)
+ * =====================================
+ * Mode: FINC/FDEC
+ *
+ * N0: DCO Disabled
+ *
+ * N1: DCO Disabled
+ *
+ * N2: DCO Disabled
+ *
+ * N3: DCO Disabled
+ *
+ * Estimated Power & Junction Temperature
+ * ======================================
+ * Assumptions:
+ *
+ * Revision: D
+ * VDD:      1.8 V
+ * Ta:       70 °C
+ * Airflow:  None
+ *
+ * Total Power: 767 mW, On Chip Power: 743 mW, Tj: 87 °C
+ *
+ *            Frequency  Format   Voltage   Current     Power
+ *         ------------  ------  --------  --------  --------
+ * VDD                              1.8 V  146.3 mA    263 mW
+ * VDDA                             3.3 V  117.4 mA    387 mW
+ * VDDO0        100 MHz  LVDS       1.8 V   15.6 mA     28 mW
+ * VDDO1   257.8125 MHz  LVDS       1.8 V   16.6 mA     30 mW
+ * VDDO2   257.8125 MHz  LVDS       1.8 V   16.6 mA     30 mW
+ * VDDO3     156.25 MHz  LVDS       1.8 V   15.9 mA     29 mW
+ *                                         --------  --------
+ *                                  Total  328.4 mA    767 mW
+ *
+ * Note:
+ *
+ * -Total power includes on- and off-chip power. This is a typical value and estimate only.
+ * -Use an EVB for a more exact power measurement
+ * -On-chip power excludes power dissipated in external terminations.
+ * -Tj is junction temperature. Tj must be less than 125 °C (on Si5340 Revision D) for device to
+ * comply with datasheet specifications.
+ *
+ * Settings
+ * ========
+ *
+ * Location      Setting Name         Decimal Value      Hex Value
+ * ------------  -------------------  -----------------  -----------------
+ * 0x0006[23:0]  TOOL_VERSION         0                  0x000000
+ * 0x000B[6:0]   I2C_ADDR             116                0x74
+ * 0x0017[0]     SYSINCAL_INTR_MSK    0                  0x0
+ * 0x0017[1]     LOSXAXB_INTR_MSK     0                  0x0
+ * 0x0017[2]     LOSREF_INTR_MSK      0                  0x0
+ * 0x0017[3]     LOL_INTR_MSK         0                  0x0
+ * 0x0017[5]     SMB_TMOUT_INTR_MSK   1                  0x1
+ * 0x0018[3:0]   LOSIN_INTR_MSK       15                 0xF
+ * 0x0021[0]     IN_SEL_REGCTRL       1                  0x1
+ * 0x0021[2:1]   IN_SEL               3                  0x3
+ * 0x0022[1]     OE                   0                  0x0
+ * 0x002B[3]     SPI_3WIRE            1                  0x1
+ * 0x002B[5]     AUTO_NDIV_UPDATE     0                  0x0
+ * 0x002C[3:0]   LOS_EN               0                  0x0
+ * 0x002C[4]     LOSXAXB_DIS          0                  0x0
+ * 0x002D[1:0]   LOS0_VAL_TIME        0                  0x0
+ * 0x002D[3:2]   LOS1_VAL_TIME        0                  0x0
+ * 0x002D[5:4]   LOS2_VAL_TIME        0                  0x0
+ * 0x002D[7:6]   LOS3_VAL_TIME        0                  0x0
+ * 0x002E[15:0]  LOS0_TRG_THR         0                  0x0000
+ * 0x0030[15:0]  LOS1_TRG_THR         0                  0x0000
+ * 0x0032[15:0]  LOS2_TRG_THR         0                  0x0000
+ * 0x0034[15:0]  LOS3_TRG_THR         0                  0x0000
+ * 0x0036[15:0]  LOS0_CLR_THR         0                  0x0000
+ * 0x0038[15:0]  LOS1_CLR_THR         0                  0x0000
+ * 0x003A[15:0]  LOS2_CLR_THR         0                  0x0000
+ * 0x003C[15:0]  LOS3_CLR_THR         0                  0x0000
+ * 0x0041[4:0]   LOS0_DIV_SEL         0                  0x00
+ * 0x0042[4:0]   LOS1_DIV_SEL         0                  0x00
+ * 0x0043[4:0]   LOS2_DIV_SEL         0                  0x00
+ * 0x0044[4:0]   LOS3_DIV_SEL         0                  0x00
+ * 0x009E[7:4]   LOL_SET_THR          0                  0x0
+ * 0x0102[0]     OUTALL_DISABLE_LOW   1                  0x1
+ * 0x0112[0]     OUT0_PDN             0                  0x0
+ * 0x0112[1]     OUT0_OE              1                  0x1
+ * 0x0112[2]     OUT0_RDIV_FORCE2     0                  0x0
+ * 0x0113[2:0]   OUT0_FORMAT          1                  0x1
+ * 0x0113[3]     OUT0_SYNC_EN         1                  0x1
+ * 0x0113[5:4]   OUT0_DIS_STATE       0                  0x0
+ * 0x0113[7:6]   OUT0_CMOS_DRV        0                  0x0
+ * 0x0114[3:0]   OUT0_CM              14                 0xE
+ * 0x0114[6:4]   OUT0_AMPL            3                  0x3
+ * 0x0115[2:0]   OUT0_MUX_SEL         1                  0x1
+ * 0x0115[5:4]   OUT0_VDD_SEL         1                  0x1
+ * 0x0115[3]     OUT0_VDD_SEL_EN      1                  0x1
+ * 0x0115[7:6]   OUT0_INV             0                  0x0
+ * 0x0117[0]     OUT1_PDN             0                  0x0
+ * 0x0117[1]     OUT1_OE              1                  0x1
+ * 0x0117[2]     OUT1_RDIV_FORCE2     1                  0x1
+ * 0x0118[2:0]   OUT1_FORMAT          1                  0x1
+ * 0x0118[3]     OUT1_SYNC_EN         1                  0x1
+ * 0x0118[5:4]   OUT1_DIS_STATE       0                  0x0
+ * 0x0118[7:6]   OUT1_CMOS_DRV        0                  0x0
+ * 0x0119[3:0]   OUT1_CM              14                 0xE
+ * 0x0119[6:4]   OUT1_AMPL            3                  0x3
+ * 0x011A[2:0]   OUT1_MUX_SEL         0                  0x0
+ * 0x011A[5:4]   OUT1_VDD_SEL         1                  0x1
+ * 0x011A[3]     OUT1_VDD_SEL_EN      1                  0x1
+ * 0x011A[7:6]   OUT1_INV             0                  0x0
+ * 0x0126[0]     OUT2_PDN             0                  0x0
+ * 0x0126[1]     OUT2_OE              1                  0x1
+ * 0x0126[2]     OUT2_RDIV_FORCE2     1                  0x1
+ * 0x0127[2:0]   OUT2_FORMAT          1                  0x1
+ * 0x0127[3]     OUT2_SYNC_EN         1                  0x1
+ * 0x0127[5:4]   OUT2_DIS_STATE       0                  0x0
+ * 0x0127[7:6]   OUT2_CMOS_DRV        0                  0x0
+ * 0x0128[3:0]   OUT2_CM              14                 0xE
+ * 0x0128[6:4]   OUT2_AMPL            3                  0x3
+ * 0x0129[2:0]   OUT2_MUX_SEL         0                  0x0
+ * 0x0129[5:4]   OUT2_VDD_SEL         1                  0x1
+ * 0x0129[3]     OUT2_VDD_SEL_EN      1                  0x1
+ * 0x0129[7:6]   OUT2_INV             0                  0x0
+ * 0x012B[0]     OUT3_PDN             0                  0x0
+ * 0x012B[1]     OUT3_OE              1                  0x1
+ * 0x012B[2]     OUT3_RDIV_FORCE2     1                  0x1
+ * 0x012C[2:0]   OUT3_FORMAT          1                  0x1
+ * 0x012C[3]     OUT3_SYNC_EN         1                  0x1
+ * 0x012C[5:4]   OUT3_DIS_STATE       0                  0x0
+ * 0x012C[7:6]   OUT3_CMOS_DRV        0                  0x0
+ * 0x012D[3:0]   OUT3_CM              14                 0xE
+ * 0x012D[6:4]   OUT3_AMPL            3                  0x3
+ * 0x012E[2:0]   OUT3_MUX_SEL         2                  0x2
+ * 0x012E[5:4]   OUT3_VDD_SEL         1                  0x1
+ * 0x012E[3]     OUT3_VDD_SEL_EN      1                  0x1
+ * 0x012E[7:6]   OUT3_INV             0                  0x0
+ * 0x013F[11:0]  OUTX_ALWAYS_ON       0                  0x000
+ * 0x0141[5]     OUT_DIS_LOL_MSK      0                  0x0
+ * 0x0141[7]     OUT_DIS_MSK_LOS_PFD  0                  0x0
+ * 0x0206[1:0]   PXAXB                0                  0x0
+ * 0x0208[47:0]  P0                   0                  0x000000000000
+ * 0x020E[31:0]  P0_SET               0                  0x00000000
+ * 0x0212[47:0]  P1                   0                  0x000000000000
+ * 0x0218[31:0]  P1_SET               0                  0x00000000
+ * 0x021C[47:0]  P2                   0                  0x000000000000
+ * 0x0222[31:0]  P2_SET               0                  0x00000000
+ * 0x0226[47:0]  P3                   0                  0x000000000000
+ * 0x022C[31:0]  P3_SET               0                  0x00000000
+ * 0x0235[43:0]  M_NUM                599785472000       0x08BA6000000
+ * 0x023B[31:0]  M_DEN                2147483648         0x80000000
+ * 0x0250[23:0]  R0_REG               3                  0x000003
+ * 0x0253[23:0]  R1_REG               0                  0x000000
+ * 0x025C[23:0]  R2_REG               0                  0x000000
+ * 0x025F[23:0]  R3_REG               0                  0x000000
+ * 0x026B[7:0]   DESIGN_ID0           48                 0x30
+ * 0x026C[7:0]   DESIGN_ID1           53                 0x35
+ * 0x026D[7:0]   DESIGN_ID2           0                  0x00
+ * 0x026E[7:0]   DESIGN_ID3           0                  0x00
+ * 0x026F[7:0]   DESIGN_ID4           0                  0x00
+ * 0x0270[7:0]   DESIGN_ID5           0                  0x00
+ * 0x0271[7:0]   DESIGN_ID6           0                  0x00
+ * 0x0272[7:0]   DESIGN_ID7           0                  0x00
+ * 0x0302[43:0]  N0_NUM               55834574848        0x00D00000000
+ * 0x0308[31:0]  N0_DEN               2147483648         0x80000000
+ * 0x030C[0]     N0_UPDATE            0                  0x0
+ * 0x030D[43:0]  N1_NUM               35987128320        0x00861000000
+ * 0x0313[31:0]  N1_DEN               2147483648         0x80000000
+ * 0x0317[0]     N1_UPDATE            0                  0x0
+ * 0x0318[43:0]  N2_NUM               115158810624       0x01AD0000000
+ * 0x031E[31:0]  N2_DEN               2684354560         0xA0000000
+ * 0x0322[0]     N2_UPDATE            0                  0x0
+ * 0x0323[43:0]  N3_NUM               0                  0x00000000000
+ * 0x0329[31:0]  N3_DEN               0                  0x00000000
+ * 0x032D[0]     N3_UPDATE            0                  0x0
+ * 0x0338[1]     N_UPDATE             0                  0x0
+ * 0x0339[4:0]   N_FSTEP_MSK          31                 0x1F
+ * 0x033B[43:0]  N0_FSTEPW            0                  0x00000000000
+ * 0x0341[43:0]  N1_FSTEPW            0                  0x00000000000
+ * 0x0347[43:0]  N2_FSTEPW            0                  0x00000000000
+ * 0x034D[43:0]  N3_FSTEPW            0                  0x00000000000
+ * 0x0359[15:0]  N0_DELAY             0                  0x0000
+ * 0x035B[15:0]  N1_DELAY             0                  0x0000
+ * 0x035D[15:0]  N2_DELAY             0                  0x0000
+ * 0x035F[15:0]  N3_DELAY             0                  0x0000
+ * 0x0802[15:0]  FIXREGSA0            0                  0x0000
+ * 0x0804[7:0]   FIXREGSD0            0                  0x00
+ * 0x0805[15:0]  FIXREGSA1            0                  0x0000
+ * 0x0807[7:0]   FIXREGSD1            0                  0x00
+ * 0x0808[15:0]  FIXREGSA2            0                  0x0000
+ * 0x080A[7:0]   FIXREGSD2            0                  0x00
+ * 0x080B[15:0]  FIXREGSA3            0                  0x0000
+ * 0x080D[7:0]   FIXREGSD3            0                  0x00
+ * 0x080E[15:0]  FIXREGSA4            0                  0x0000
+ * 0x0810[7:0]   FIXREGSD4            0                  0x00
+ * 0x0811[15:0]  FIXREGSA5            0                  0x0000
+ * 0x0813[7:0]   FIXREGSD5            0                  0x00
+ * 0x0814[15:0]  FIXREGSA6            0                  0x0000
+ * 0x0816[7:0]   FIXREGSD6            0                  0x00
+ * 0x0817[15:0]  FIXREGSA7            0                  0x0000
+ * 0x0819[7:0]   FIXREGSD7            0                  0x00
+ * 0x081A[15:0]  FIXREGSA8            0                  0x0000
+ * 0x081C[7:0]   FIXREGSD8            0                  0x00
+ * 0x081D[15:0]  FIXREGSA9            0                  0x0000
+ * 0x081F[7:0]   FIXREGSD9            0                  0x00
+ * 0x0820[15:0]  FIXREGSA10           0                  0x0000
+ * 0x0822[7:0]   FIXREGSD10           0                  0x00
+ * 0x0823[15:0]  FIXREGSA11           0                  0x0000
+ * 0x0825[7:0]   FIXREGSD11           0                  0x00
+ * 0x0826[15:0]  FIXREGSA12           0                  0x0000
+ * 0x0828[7:0]   FIXREGSD12           0                  0x00
+ * 0x0829[15:0]  FIXREGSA13           0                  0x0000
+ * 0x082B[7:0]   FIXREGSD13           0                  0x00
+ * 0x082C[15:0]  FIXREGSA14           0                  0x0000
+ * 0x082E[7:0]   FIXREGSD14           0                  0x00
+ * 0x082F[15:0]  FIXREGSA15           0                  0x0000
+ * 0x0831[7:0]   FIXREGSD15           0                  0x00
+ * 0x0832[15:0]  FIXREGSA16           0                  0x0000
+ * 0x0834[7:0]   FIXREGSD16           0                  0x00
+ * 0x0835[15:0]  FIXREGSA17           0                  0x0000
+ * 0x0837[7:0]   FIXREGSD17           0                  0x00
+ * 0x0838[15:0]  FIXREGSA18           0                  0x0000
+ * 0x083A[7:0]   FIXREGSD18           0                  0x00
+ * 0x083B[15:0]  FIXREGSA19           0                  0x0000
+ * 0x083D[7:0]   FIXREGSD19           0                  0x00
+ * 0x083E[15:0]  FIXREGSA20           0                  0x0000
+ * 0x0840[7:0]   FIXREGSD20           0                  0x00
+ * 0x0841[15:0]  FIXREGSA21           0                  0x0000
+ * 0x0843[7:0]   FIXREGSD21           0                  0x00
+ * 0x0844[15:0]  FIXREGSA22           0                  0x0000
+ * 0x0846[7:0]   FIXREGSD22           0                  0x00
+ * 0x0847[15:0]  FIXREGSA23           0                  0x0000
+ * 0x0849[7:0]   FIXREGSD23           0                  0x00
+ * 0x084A[15:0]  FIXREGSA24           0                  0x0000
+ * 0x084C[7:0]   FIXREGSD24           0                  0x00
+ * 0x084D[15:0]  FIXREGSA25           0                  0x0000
+ * 0x084F[7:0]   FIXREGSD25           0                  0x00
+ * 0x0850[15:0]  FIXREGSA26           0                  0x0000
+ * 0x0852[7:0]   FIXREGSD26           0                  0x00
+ * 0x0853[15:0]  FIXREGSA27           0                  0x0000
+ * 0x0855[7:0]   FIXREGSD27           0                  0x00
+ * 0x0856[15:0]  FIXREGSA28           0                  0x0000
+ * 0x0858[7:0]   FIXREGSD28           0                  0x00
+ * 0x0859[15:0]  FIXREGSA29           0                  0x0000
+ * 0x085B[7:0]   FIXREGSD29           0                  0x00
+ * 0x085C[15:0]  FIXREGSA30           0                  0x0000
+ * 0x085E[7:0]   FIXREGSD30           0                  0x00
+ * 0x085F[15:0]  FIXREGSA31           0                  0x0000
+ * 0x0861[7:0]   FIXREGSD31           0                  0x00
+ * 0x090E[0]     XAXB_EXTCLK_EN       0                  0x0
+ * 0x090E[1]     XAXB_PDNB            1                  0x1
+ * 0x091C[2:0]   ZDM_EN               4                  0x4
+ * 0x0943[0]     IO_VDD_SEL           0                  0x0
+ * 0x0949[3:0]   IN_EN                0                  0x0
+ * 0x0949[7:4]   IN_PULSED_CMOS_EN    0                  0x0
+ * 0x094A[7:4]   INX_TO_PFD_EN        0                  0x0
+ * 0x094E[11:0]  REFCLK_HYS_SEL       585                0x249
+ * 0x095E[0]     M_INTEGER            0                  0x0
+ * 0x0A02[4:0]   N_ADD_0P5            0                  0x00
+ * 0x0A03[4:0]   N_CLK_TO_OUTX_EN     7                  0x07
+ * 0x0A04[4:0]   N_PIBYP              1                  0x01
+ * 0x0A05[4:0]   N_PDNB               7                  0x07
+ * 0x0A14[3]     N0_HIGH_FREQ         0                  0x0
+ * 0x0A1A[3]     N1_HIGH_FREQ         0                  0x0
+ * 0x0A20[3]     N2_HIGH_FREQ         0                  0x0
+ * 0x0A26[3]     N3_HIGH_FREQ         0                  0x0
+ * 0x0B44[3:0]   PDIV_ENB             15                 0xF
+ * 0x0B4A[4:0]   N_CLK_DIS            8                  0x08
+ * 0x0B57[11:0]  VCO_RESET_CALCODE    270                0x10E
+ *
+ *
+ */
+
+#endif
drivers/net/ntnic/meson.build +16 -0
index d8cd83db25..0205d7de8e 100644
@@ -80,6 +80,22 @@ sources = files(
     'nthw/supported/nthw_fpga_9563_055_039_0000.c',
     'nthw/supported/nthw_fpga_instances.c',
     'nthw/supported/nthw_fpga_mod_str_map.c',
+    'nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c',
+    'nthw/core/nt200a0x/nthw_fpga_nt200a0x.c',
+    'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c',
+    'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
+    'nthw/core/nthw_fpga.c',
+    'nthw/core/nthw_fpga_rst.c',
+    'nthw/core/nthw_hif.c',
+    'nthw/core/nthw_iic.c',
+    'nthw/core/nthw_mac_pcs_xxv.c',
+    'nthw/core/nthw_pcie3.c',
+    'nthw/core/nthw_sdc.c',
+    'nthw/core/nthw_si5340.c',
+    'nthw/core/nthw_spim.c',
+    'nthw/core/nthw_spis.c',
+    'nthw/core/nthw_spi_v3.c',
+    'nthw/core/nthw_tsm.c',
     'nthw/model/nthw_fpga_model.c',
     'nthw/nthw_epp.c',
     'nthw/nthw_platform.c',
drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c new file +51 -0

51 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.h new file +9 -0
new file mode 100644
index 0000000000..88d72cd334
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _NTHW_FPGA_CLK_9563_H_
+#define _NTHW_FPGA_CLK_9563_H_
+
+#endif	/* _NTHW_FPGA_CLK_9563_H_ */
drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c new file +107 -0

107 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.h new file +9 -0
new file mode 100644
index 0000000000..26efe27e0f
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef __NTHW_FPGA_NT200A0X_H__
+#define __NTHW_FPGA_NT200A0X_H__
+
+#endif	/* __NTHW_FPGA_NT200A0X_H__ */
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c new file +258 -0

258 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.h new file +9 -0
new file mode 100644
index 0000000000..e61cd32954
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_FPGA_RST9563_H__
+#define __NTHW_FPGA_RST9563_H__
+
+#endif	/* __NTHW_FPGA_RST9563_H__ */
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c new file +729 -0

729 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.h new file +9 -0
new file mode 100644
index 0000000000..af508bd2bd
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_FPGA_RST_NT200A0X_H__
+#define __NTHW_FPGA_RST_NT200A0X_H__
+
+#endif	/* __NTHW_FPGA_RST_NT200A0X_H__ */
drivers/net/ntnic/nthw/core/nthw_fpga.c new file +888 -0

888 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_fpga_rst.c new file +10 -0
new file mode 100644
index 0000000000..e0fb0ec3d8
@@ -0,0 +1,10 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include "ntlog.h"
+
+#include "nthw_fpga.h"
+
+#include "nthw_fpga_rst.h"
drivers/net/ntnic/nthw/core/nthw_hif.c new file +312 -0

147 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_iic.c new file +529 -0

529 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_mac_pcs_xxv.c new file +1169 -0

1,169 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pcie3.c new file +270 -0

270 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_sdc.c new file +176 -0

176 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_si5340.c new file +205 -0

205 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spi_v3.c new file +356 -0

356 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spim.c new file +121 -0

121 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spis.c new file +129 -0

129 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_tsm.c new file +167 -0

167 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.44.0

Part of the diff is not shown here. View the raw message.

#29 lore raw

PATCH v2 13/17 net/ntnic: add adapter initialization

In reply to Serhii Iliushyk

Add ntnic HW interfaces (PCIe, I2C) API.

---
v2:
* Fixed WARNING:TYPO_SPELLING

---
 drivers/net/ntnic/adapter/nt4ga_pci_ta_tg.c   | 550 ++++++++++++++++++
 drivers/net/ntnic/adapter/nt4ga_tfg.c         |  69 +++
 drivers/net/ntnic/include/nt4ga_tfg.h         |   2 +
 drivers/net/ntnic/include/ntnic_nim.h         |   1 +
 drivers/net/ntnic/meson.build                 |   8 +
 .../net/ntnic/nthw/core/include/nthw_core.h   |   6 +
 .../net/ntnic/nthw/core/include/nthw_gfg.h    |  40 ++
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |  75 +++
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |  51 ++
 .../ntnic/nthw/core/include/nthw_pci_rd_tg.h  |  50 ++
 .../net/ntnic/nthw/core/include/nthw_pci_ta.h |  40 ++
 .../ntnic/nthw/core/include/nthw_pci_wr_tg.h  |  55 ++
 drivers/net/ntnic/nthw/core/nthw_gfg.c        | 365 ++++++++++++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        | 176 ++++++
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       | 197 +++++++
 drivers/net/ntnic/nthw/core/nthw_pci_rd_tg.c  | 115 ++++
 drivers/net/ntnic/nthw/core/nthw_pci_ta.c     |  94 +++
 drivers/net/ntnic/nthw/core/nthw_pci_wr_tg.c  | 122 ++++
 18 files changed, 2016 insertions(+)
 create mode 100644 drivers/net/ntnic/adapter/nt4ga_pci_ta_tg.c
 create mode 100644 drivers/net/ntnic/adapter/nt4ga_tfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gfg.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gmf.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_i2cm.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pci_rd_tg.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pci_ta.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pci_wr_tg.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gmf.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_i2cm.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pci_rd_tg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pci_ta.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pci_wr_tg.c
drivers/net/ntnic/adapter/nt4ga_pci_ta_tg.c new file +550 -0
new file mode 100644
index 0000000000..b7a9ca2fbe
@@ -0,0 +1,550 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include "ntlog.h"
+#include "nt_util.h"
+#include "nthw_drv.h"
+#include "nt4ga_adapter.h"
+#include "nt4ga_pci_ta_tg.h"
+#include "nthw_pci_ta.h"
+#include "nthw_pci_rd_tg.h"
+#include "nthw_pci_wr_tg.h"
+
+int nt4ga_pci_ta_tg_init(struct adapter_info_s *p_adapter_info)
+{
+	const char *const p_adapter_id_str = p_adapter_info->mp_adapter_id_str;
+	fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
+	nthw_fpga_t *p_fpga = fpga_info->mp_fpga;
+	nt4ga_pci_ta_tg_t *p = &p_adapter_info->nt4ga_pci_ta_tg;
+	int res;
+	int n_err_cnt = 0;
+
+	if (p) {
+		memset(p, 0, sizeof(nt4ga_pci_ta_tg_t));
+
+	} else {
+		NT_LOG(ERR, NTHW, "%s: %s: null ptr\n", p_adapter_id_str, __func__);
+		return -1;
+	}
+
+	assert(p_fpga);
+
+	p->mp_nthw_pci_rd_tg = nthw_pci_rd_tg_new();
+	assert(p->mp_nthw_pci_rd_tg);
+	res = nthw_pci_rd_tg_init(p->mp_nthw_pci_rd_tg, p_fpga, 0);
+
+	if (res) {
+		n_err_cnt++;
+		NT_LOG(WRN, NTHW, "%s: module PCI_RD_TG not found\n", p_adapter_id_str);
+	}
+
+	p->mp_nthw_pci_wr_tg = nthw_pci_wr_tg_new();
+	assert(p->mp_nthw_pci_wr_tg);
+	res = nthw_pci_wr_tg_init(p->mp_nthw_pci_wr_tg, p_fpga, 0);
+
+	if (res) {
+		n_err_cnt++;
+		NT_LOG(WRN, NTHW, "%s: module PCI_WR_TG not found\n", p_adapter_id_str);
+	}
+
+	p->mp_nthw_pci_ta = nthw_pci_ta_new();
+	assert(p->mp_nthw_pci_ta);
+	res = nthw_pci_ta_init(p->mp_nthw_pci_ta, p_fpga, 0);
+
+	if (res) {
+		n_err_cnt++;
+		NT_LOG(WRN, NTHW, "%s: module PCI_TA not found\n", p_adapter_id_str);
+	}
+
+	return n_err_cnt;
+}
+
+static int nt4ga_pci_ta_tg_ta_write_control_enable(nt4ga_pci_ta_tg_t *p, uint32_t enable)
+{
+	nthw_pci_ta_set_control_enable(p->mp_nthw_pci_ta, enable);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_length_error(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_length_error(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_packet_bad(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_packet_bad(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_packet_good(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_packet_good(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_payload_error(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_payload_error(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_rd_tg_setup(nt4ga_pci_ta_tg_t *p, uint64_t iova, int slot_addr,
+	uint32_t req_size, bool wait, bool wrap)
+{
+	const uint64_t n_phys_addr = (iova + (unsigned long)(slot_addr * req_size));
+	nthw_pci_rd_tg_set_ram_addr(p->mp_nthw_pci_rd_tg, slot_addr);
+	nthw_pci_rd_tg_set_phys_addr(p->mp_nthw_pci_rd_tg, n_phys_addr);
+	nthw_pci_rd_tg_set_ram_data(p->mp_nthw_pci_rd_tg, req_size, wait, wrap);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_rd_tg_run(nt4ga_pci_ta_tg_t *p, uint32_t num_iterations)
+{
+	nthw_pci_rd_tg_set_run(p->mp_nthw_pci_rd_tg, num_iterations);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_rd_tg_wait_ready(nt4ga_pci_ta_tg_t *p)
+{
+	int poll = 0;
+	uint32_t data = 0;
+
+	while (data == 0) {
+		/* NOTE: Deliberately start with a sleep - ensures that the FPGA pipe is empty */
+		nt_os_wait_usec(1000);
+		data = nthw_pci_rd_tg_get_ctrl_rdy(p->mp_nthw_pci_rd_tg);
+		poll++;
+
+		if (poll >= 1000) {
+			NT_LOG(ERR, NTHW, "%s: FAILED waiting PCI RD TG ready: poll=%d\n",
+				__func__, poll);
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_wr_tg_setup(nt4ga_pci_ta_tg_t *p, uint64_t iova, int slot_addr,
+	uint32_t req_size, bool wait, bool wrap, bool inc)
+{
+	const uint64_t n_phys_addr = (iova + (unsigned long)(slot_addr * req_size));
+
+	nthw_pci_wr_tg_set_ram_addr(p->mp_nthw_pci_wr_tg, slot_addr);
+	nthw_pci_wr_tg_set_phys_addr(p->mp_nthw_pci_wr_tg, n_phys_addr);
+	nthw_pci_wr_tg_set_ram_data(p->mp_nthw_pci_wr_tg, req_size, wait, wrap, inc);
+
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_wr_tg_run(nt4ga_pci_ta_tg_t *p, uint32_t num_iterations)
+{
+	nthw_pci_wr_tg_set_run(p->mp_nthw_pci_wr_tg, num_iterations);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_wr_tg_wait_ready(nt4ga_pci_ta_tg_t *p)
+{
+	int poll = 0;
+	uint32_t data = 0;
+
+	while (data == 0) {
+		/* NOTE: Deliberately start with a sleep - ensures that the FPGA pipe is empty */
+		nt_os_wait_usec(1000);
+		data = nthw_pci_wr_tg_get_ctrl_rdy(p->mp_nthw_pci_wr_tg);
+		poll++;
+
+		if (poll >= 1000) {
+			NT_LOG(ERR, NTHW, "%s: FAILED waiting PCI WR TG ready: poll=%d\n",
+				__func__, poll);
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
+int nt4ga_pci_ta_tg_measure_throughput_run(struct adapter_info_s *p_adapter_info,
+	struct nthw_hif_end_point_counters *pri,
+	struct nthw_hif_end_point_counters *sla)
+{
+	nt4ga_pci_ta_tg_t *p = &p_adapter_info->nt4ga_pci_ta_tg;
+
+	const int delay = pri->n_tg_delay;
+	const int pkt_size = pri->n_tg_pkt_size;
+	const int num_pkts = pri->n_tg_num_pkts;
+	const int n_direction = pri->n_tg_direction;
+	const uint8_t n_numa_node = (uint8_t)pri->n_numa_node;
+	const int dma_buf_size = (4 * 1024 * 1024);
+
+	const size_t align_size = nt_util_align_size(dma_buf_size);
+	uint32_t *mem_addr;
+	uint64_t iova;
+
+	int bo_error = 0;
+
+	nthw_hif *p_primary_instance = p_adapter_info->fpga_info.mp_nthw_hif;
+	nthw_hif *p_secondary_instance = NULL;
+
+	nthw_pcie3 *p_pci_primary = p_adapter_info->fpga_info.mp_nthw_pcie3;
+	nthw_pcie3 *p_pci_secondary = NULL;
+
+	assert(p_primary_instance || p_pci_primary);
+
+	struct nt_dma_s *p_dma;
+	/* FPGA needs a Page alignment (4K on Intel) */
+	p_dma = nt_dma_alloc(align_size, 0x1000, n_numa_node);
+
+	if (p_dma == NULL) {
+		NT_LOG(DBG, ETHDEV, "%s: vfio_dma_alloc failed\n", __func__);
+		return 0;
+	}
+
+	mem_addr = (uint32_t *)p_dma->addr;
+	iova = p_dma->iova;
+
+	NT_LOG(DBG, NTHW, "%s: Running HIF bandwidth measurements on NUMA node %d\n", __func__,
+		n_numa_node);
+
+	bo_error = 0;
+	{
+		int wrap;
+
+		/* Stop any existing running test */
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 0);
+
+		/* Prepare the HIF Traffic generator */
+		bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 1);
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		/*
+		 * Ensure that the hostbuffer memory contain data that can be read -
+		 * For this we will ask the FPGA to write data to it. The last wrap packet
+		 * does not generate any data it only wraps (unlike the PCIe2 TG)
+		 */
+		{
+			int pkt;
+
+			for (pkt = 0; pkt < num_pkts; pkt++) {
+				if (pkt >= (num_pkts - 1))
+					wrap = 1;
+
+				else
+					wrap = 0;
+
+				bo_error |= nt4ga_pci_ta_tg_wr_tg_setup(p, iova, pkt, pkt_size, 0,
+						wrap, 1);
+				bo_error |= nt4ga_pci_ta_tg_rd_tg_setup(p, iova, pkt, pkt_size, 0,
+						wrap);
+			}
+		}
+
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 1);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		/* Start WR TG Write once */
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 1);
+		/* Wait until WR TG ready */
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		/* Verify that we have a packet */
+		{
+			int pkt;
+
+			for (pkt = 0; pkt < num_pkts; pkt++) {
+				uint32_t value = 0;
+				int poll;
+
+				for (poll = 8; poll < pkt_size; poll += 4, value++) {
+					if (*(uint32_t *)((uint8_t *)mem_addr + (pkt * pkt_size) +
+							poll) != value) {
+						NT_LOG(ERR, NTHW,
+							"HIF TG: Prepare failed. Data write failed: #%d.%d:  %016X:%08X\n",
+							pkt, poll,
+							*(uint32_t *)((uint8_t *)mem_addr +
+								(pkt * pkt_size) + poll),
+							value);
+
+						/*
+						 * Break out of the verification loop on first
+						 * compare error
+						 */
+						bo_error |= 1;
+						break;
+					}
+				}
+			}
+		}
+
+		switch (n_direction) {
+		case 1:	/* Read only test */
+			nt4ga_pci_ta_tg_wr_tg_run(p, 0xffff);
+			break;
+
+		case 2:	/* Write only test */
+			nt4ga_pci_ta_tg_rd_tg_run(p, 0xffff);
+			break;
+
+		case 3:	/* Combined read/write test */
+			nt4ga_pci_ta_tg_wr_tg_run(p, 0xffff);
+			nt4ga_pci_ta_tg_rd_tg_run(p, 0xffff);
+			break;
+
+		default:/* stop tests */
+			nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+			nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+			break;
+		}
+
+		do {
+			/* prep */
+			if (p_pci_primary)
+				nthw_pcie3_end_point_counters_sample_pre(p_pci_primary, pri);
+
+			if (p_pci_secondary)
+				nthw_pcie3_end_point_counters_sample_pre(p_pci_secondary, sla);
+
+			/* start measure */
+			if (p_primary_instance)
+				nthw_hif_stat_req_enable(p_primary_instance);
+
+			if (p_pci_primary)
+				nthw_pcie3_stat_req_enable(p_pci_primary);
+
+			if (p_secondary_instance)
+				nthw_hif_stat_req_enable(p_secondary_instance);
+
+			if (p_pci_secondary)
+				nthw_pcie3_stat_req_enable(p_pci_secondary);
+
+			/* Wait */
+			nt_os_wait_usec(delay);
+
+			/* Stop measure */
+			if (p_primary_instance)
+				nthw_hif_stat_req_disable(p_primary_instance);
+
+			if (p_pci_primary)
+				nthw_pcie3_stat_req_disable(p_pci_primary);
+
+			if (p_secondary_instance)
+				nthw_hif_stat_req_disable(p_secondary_instance);
+
+			if (p_pci_secondary)
+				nthw_pcie3_stat_req_disable(p_pci_secondary);
+
+			/* Post process primary */
+			if (p_primary_instance)
+				nthw_hif_end_point_counters_sample(p_primary_instance, pri);
+
+			if (p_pci_primary)
+				nthw_pcie3_end_point_counters_sample_post(p_pci_primary, pri);
+
+			/* Post process secondary */
+			if (p_secondary_instance)
+				nthw_hif_end_point_counters_sample(p_secondary_instance, sla);
+
+			if (p_pci_secondary)
+				nthw_pcie3_end_point_counters_sample_post(p_pci_secondary, sla);
+
+			{
+				/* Check for TA transmit errors */
+				uint32_t dw_good_pkts, dw_bad_pkts, dw_bad_length, dw_bad_payload;
+				nt4ga_pci_ta_tg_ta_read_packet_good(p, &dw_good_pkts);
+				nt4ga_pci_ta_tg_ta_read_packet_bad(p, &dw_bad_pkts);
+				nt4ga_pci_ta_tg_ta_read_length_error(p, &dw_bad_length);
+				nt4ga_pci_ta_tg_ta_read_payload_error(p, &dw_bad_payload);
+
+				NT_LOG(DBG, NTHW,
+					"%s: NUMA node %u: HIF: TA: Good pkts, Bad pkts, Bad length, Bad payload\n",
+					__func__, n_numa_node);
+				NT_LOG(DBG, NTHW,
+					"%s: NUMA node %u: HIF: TA: 0x%08x 0x%08x 0x%08x 0x%08x\n",
+					__func__, n_numa_node, dw_good_pkts, dw_bad_pkts,
+					dw_bad_length, dw_bad_payload);
+
+				if (dw_bad_pkts | dw_bad_length | dw_bad_payload) {
+					bo_error |= 1;
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: error detected\n",
+						__func__, n_numa_node);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Good packets received: %u\n",
+						__func__, n_numa_node, dw_good_pkts);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Bad packets received : %u\n",
+						__func__, n_numa_node, dw_bad_pkts);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Bad length received  : %u\n",
+						__func__, n_numa_node, dw_bad_length);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Bad payload received : %u\n",
+						__func__, n_numa_node, dw_bad_payload);
+				}
+			}
+
+			if (bo_error != 0)
+				break;
+
+			break;	/* for now only loop once */
+
+			/*
+			 * Only do "signalstop" looping if a specific numa node and direction is to
+			 * be tested.
+			 */
+		} while ((bo_error == 0) && (n_numa_node != UINT8_MAX) && (n_direction != -1));
+
+		/* Stop the test */
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 0);
+
+		/* PCIe3 sanity checks */
+		{
+#if defined(DEBUG)
+			int do_loop = 1;
+#else
+			int do_loop = 0;
+#endif
+
+			while (do_loop) {
+				do_loop = 0;
+
+				if (p_primary_instance) {
+					nthw_hif_stat_req_enable(p_primary_instance);
+					nt_os_wait_usec(100);
+					nthw_hif_stat_req_disable(p_primary_instance);
+				}
+
+				if (do_loop == 0)
+					break;
+
+				NT_LOG(DBG, NTHW, "%s: WARNING this is wrong - wait again\n",
+					__func__);
+				nt_os_wait_usec(200 * 1000);
+			}
+		}
+	}
+
+	/* Stop the test */
+
+	bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+	bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+	bo_error |= nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+	bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+
+	bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 0);
+
+	nt_dma_free(p_dma);
+
+	return bo_error;
+}
+
+int nt4ga_pci_ta_tg_measure_throughput_main(struct adapter_info_s *p_adapter_info,
+	const uint8_t numa_node, const int direction,
+	const int n_pkt_size, const int n_batch_count,
+	const int n_delay)
+{
+	/* All numa nodes is indicated by UINT8_MAX */
+	const uint8_t numa_begin = (numa_node == UINT8_MAX ? 0 : numa_node);
+	const uint8_t numa_end = numa_begin;
+
+	/* sanity check direction param */
+	const int dir_begin = (direction <= 0 ? 1 : direction);
+	const int dir_end = (direction <= 0 ? 3 : direction);
+
+	int bo_error = 0;
+	struct nthw_hif_end_points eps;
+
+	if (n_delay == 0)
+		return -1;
+
+	NT_LOG(DBG, NTHW, "HIF adapter throughput:\n");
+
+	/* Only do "signalstop"-looping if a specific numa node is to be tested. */
+	{
+		uint8_t numa;
+
+		for (numa = numa_begin; numa <= numa_end; numa++) {
+			int by_loop;
+
+			for (by_loop = dir_begin; by_loop <= dir_end; by_loop++) {
+				struct nthw_hif_end_point_counters *pri = &eps.pri;
+				struct nthw_hif_end_point_counters *sla = &eps.sla;
+
+				pri->n_numa_node = numa;
+				pri->n_tg_direction = by_loop;
+				pri->n_tg_pkt_size = (n_pkt_size > 0 ? n_pkt_size : TG_PKT_SIZE);
+				pri->n_tg_num_pkts =
+					(n_batch_count > 0 ? n_batch_count : TG_NUM_PACKETS);
+				pri->n_tg_delay = (n_delay > 0 ? n_delay : TG_DELAY);
+				pri->cur_rx = 0;
+				pri->cur_tx = 0;
+				pri->n_ref_clk_cnt = -1;
+				pri->bo_error = 0;
+
+				sla->n_numa_node = numa;
+				sla->n_tg_direction = by_loop;
+				sla->n_tg_pkt_size = (n_pkt_size > 0 ? n_pkt_size : TG_PKT_SIZE);
+				sla->n_tg_num_pkts =
+					(n_batch_count > 0 ? n_batch_count : TG_NUM_PACKETS);
+				sla->n_tg_delay = (n_delay > 0 ? n_delay : TG_DELAY);
+				sla->cur_rx = 0;
+				sla->cur_tx = 0;
+				pri->n_ref_clk_cnt = -1;
+				sla->bo_error = 0;
+
+				bo_error += nt4ga_pci_ta_tg_measure_throughput_run(p_adapter_info,
+						pri, sla);
+#if defined(DEBUG) && (1)
+				{
+					NT_LOG(DBG, NTHW,
+						"%s: @ %d: %d %d %d %d: %016lX %016lX : %6ld Mbps %6ld Mbps\n",
+						__func__, pri->n_numa_node, pri->n_tg_direction,
+						pri->n_tg_num_pkts, pri->n_tg_pkt_size,
+						pri->n_tg_delay, pri->cur_rx, pri->cur_tx,
+						(pri->cur_rx * 8UL / 1000000UL),
+						(pri->cur_tx * 8UL / 1000000UL));
+				}
+				{
+					NT_LOG(DBG, NTHW,
+						"%s: @ %d: %d %d %d %d: %016lX %016lX : %6ld Mbps %6ld Mbps\n",
+						__func__, sla->n_numa_node, sla->n_tg_direction,
+						sla->n_tg_num_pkts, sla->n_tg_pkt_size,
+						sla->n_tg_delay, sla->cur_rx, sla->cur_tx,
+						(sla->cur_rx * 8UL / 1000000UL),
+						(sla->cur_tx * 8UL / 1000000UL));
+				}
+#endif
+
+				if (pri->bo_error != 0 || sla->bo_error != 0)
+					bo_error++;
+
+				if (bo_error)
+					break;
+			}
+		}
+	}
+
+	if (bo_error != 0)
+		NT_LOG(ERR, NTHW, "%s: error during bandwidth measurement\n", __func__);
+
+	NT_LOG(DBG, NTHW, "HIF adapter throughput: done %s\n", __func__);
+
+	return 0;
+}
drivers/net/ntnic/adapter/nt4ga_tfg.c new file +69 -0

69 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_tfg.h +2 -0
index 9797403dec..db2f42b215 100644
@@ -7,6 +7,8 @@
 #define NT4GA_TFG_H_
 
 typedef struct nt4ga_tfg_s {
+	nthw_gfg_t *mp_nthw_gfg;
+	nthw_gmf_t *mp_nthw_gmf;
 	nthw_mac_tfg_t *mp_nthw_mac_tfg;
 } nt4ga_tfg_t;
 
drivers/net/ntnic/include/ntnic_nim.h +1 -0
index 41457b7a07..fc9b2a2b23 100644
@@ -93,6 +93,7 @@ typedef struct nim_i2c_ctx {
 	union {
 		nthw_iic_t hwiic;	/* depends on *Fpga_t, instance number, and cycle time */
 		struct {
+			nthw_i2cm_t *p_nt_i2cm;
 			int mux_channel;
 		} hwagx;
 	};
drivers/net/ntnic/meson.build +8 -0
index 0205d7de8e..1a56a0f6c4 100644
@@ -77,6 +77,8 @@ headers = files('rte_pmd_ntnic.h')
 # all sources
 sources = files(
     'dpdk_mod_reg.c',
+    'drivers/net/ntnic/driver/modules/adapter/nt4ga_pci_ta_tg.c',
+    'drivers/net/ntnic/driver/modules/adapter/nt4ga_tfg.c',
     'nthw/supported/nthw_fpga_9563_055_039_0000.c',
     'nthw/supported/nthw_fpga_instances.c',
     'nthw/supported/nthw_fpga_mod_str_map.c',
@@ -86,10 +88,16 @@ sources = files(
     'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
     'nthw/core/nthw_fpga.c',
     'nthw/core/nthw_fpga_rst.c',
+    'nthw/core/nthw_gfg.c',
+    'nthw/core/nthw_gmf.c',
     'nthw/core/nthw_hif.c',
+    'nthw/core/nthw_i2cm.c',
     'nthw/core/nthw_iic.c',
     'nthw/core/nthw_mac_pcs_xxv.c',
     'nthw/core/nthw_pcie3.c',
+    'nthw/core/nthw_pci_rd_tg.c',
+    'nthw/core/nthw_pci_ta.c',
+    'nthw/core/nthw_pci_wr_tg.c',
     'nthw/core/nthw_sdc.c',
     'nthw/core/nthw_si5340.c',
     'nthw/core/nthw_spim.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +6 -0
index f2d56a41f9..b72766cc5c 100644
@@ -13,8 +13,14 @@
 #include "nthw_fpga_model.h"
 #include "nthw_hif.h"
 #include "nthw_pcie3.h"
+#include "nthw_pci_rd_tg.h"
+#include "nthw_pci_wr_tg.h"
+#include "nthw_pci_ta.h"
 #include "nthw_iic.h"
+#include "nthw_i2cm.h"
 
+#include "nthw_gfg.h"
+#include "nthw_gmf.h"
 #include "nthw_mac_pcs_xxv.h"
 #include "nthw_mac_tfg.h"
 #include "nthw_sdc.h"
drivers/net/ntnic/nthw/core/include/nthw_gfg.h new file +40 -0
new file mode 100644
index 0000000000..fd477775d5
@@ -0,0 +1,40 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NTHW_GFG_H_
+#define NTHW_GFG_H_
+
+struct nthw_gfg {
+	nthw_fpga_t *mp_fpga;
+	nthw_module_t *mp_mod_gfg;
+	int mn_instance;
+
+	int mn_param_gfg_present;
+
+	nthw_field_t *mpa_fld_ctrl_enable[8];
+	nthw_field_t *mpa_fld_ctrl_mode[8];
+	nthw_field_t *mpa_fld_ctrl_prbs_en[8];
+	nthw_field_t *mpa_fld_ctrl_size[8];
+	nthw_field_t *mpa_fld_stream_id_val[8];
+	nthw_field_t *mpa_fld_run_run[8];
+	nthw_field_t *mpa_fld_size_mask[8];
+	nthw_field_t *mpa_fld_burst_size_val[8];
+};
+
+typedef struct nthw_gfg nthw_gfg_t;
+typedef struct nthw_gfg nthw_gfg;
+
+nthw_gfg_t *nthw_gfg_new(void);
+int nthw_gfg_init(nthw_gfg_t *p, nthw_fpga_t *p_fpga, int n_instance);
+
+int nthw_gfg_start(nthw_gfg_t *p, const int n_intf_no, const int n_frame_count,
+	const int n_frame_size, const int n_frame_fill_mode,
+	const int n_frame_stream_id);
+int nthw_gfg_stop(nthw_gfg_t *p, const int n_intf_no);
+int nthw_gfg_setup(nthw_gfg_t *p, const size_t n_intf_no, const int n_enable,
+	const int n_frame_count, const int n_frame_size, const int n_frame_fill_mode,
+	const int n_frame_stream_id);
+
+#endif	/* NTHW_GFG_H_ */
drivers/net/ntnic/nthw/core/include/nthw_gmf.h new file +75 -0

75 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_i2cm.h new file +51 -0

51 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_pci_rd_tg.h new file +50 -0

50 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_pci_ta.h new file +40 -0
new file mode 100644
index 0000000000..56892d25d2
@@ -0,0 +1,40 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_PCI_TA_H__
+#define __NTHW_PCI_TA_H__
+
+struct nthw_pci_ta {
+	nthw_fpga_t *mp_fpga;
+	nthw_module_t *mp_mod_pci_ta;
+	int mn_instance;
+
+	int mn_param_pci_ta_tg_present;
+
+	nthw_register_t *mp_reg_pci_ta_ctrl;
+	nthw_field_t *mp_fld_pci_ta_ctrl_enable;
+	nthw_register_t *mp_reg_pci_ta_packet_good;
+	nthw_field_t *mp_fld_pci_ta_packet_good_amount;
+	nthw_register_t *mp_reg_pci_ta_packet_bad;
+	nthw_field_t *mp_fld_pci_ta_packet_bad_amount;
+	nthw_register_t *mp_reg_pci_ta_length_error;
+	nthw_field_t *mp_fld_pci_ta_length_error_amount;
+	nthw_register_t *mp_reg_pci_ta_payload_error;
+	nthw_field_t *mp_fld_pci_ta_payload_error_amount;
+};
+
+typedef struct nthw_pci_ta nthw_pci_ta_t;
+typedef struct nthw_pci_ta nthw_pci_ta;
+
+nthw_pci_ta_t *nthw_pci_ta_new(void);
+int nthw_pci_ta_init(nthw_pci_ta_t *p, nthw_fpga_t *p_fpga, int n_instance);
+
+void nthw_pci_ta_set_control_enable(nthw_pci_ta_t *p, uint32_t val);
+void nthw_pci_ta_get_packet_good(nthw_pci_ta_t *p, uint32_t *val);
+void nthw_pci_ta_get_packet_bad(nthw_pci_ta_t *p, uint32_t *val);
+void nthw_pci_ta_get_length_error(nthw_pci_ta_t *p, uint32_t *val);
+void nthw_pci_ta_get_payload_error(nthw_pci_ta_t *p, uint32_t *val);
+
+#endif	/* __NTHW_PCI_TA_H__ */
drivers/net/ntnic/nthw/core/include/nthw_pci_wr_tg.h new file +55 -0

55 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_gfg.c new file +365 -0

365 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_gmf.c new file +176 -0

176 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_i2cm.c new file +197 -0

197 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pci_rd_tg.c new file +115 -0

115 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pci_ta.c new file +94 -0

94 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pci_wr_tg.c new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.44.0
#30 lore raw

PATCH v2 14/17 net/ntnic: add adapter initialization API

In reply to Serhii Iliushyk

Add ntnic adapter initialization API.

---
 drivers/net/ntnic/adapter/nt4ga_adapter.c | 496 ++++++++++++++++++++++
 drivers/net/ntnic/meson.build             |   1 +
 2 files changed, 497 insertions(+)
 create mode 100644 drivers/net/ntnic/adapter/nt4ga_adapter.c
drivers/net/ntnic/adapter/nt4ga_adapter.c new file +496 -0
new file mode 100644
index 0000000000..6147481f3a
@@ -0,0 +1,496 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include "ntlog.h"
+
+#include "nthw_drv.h"
+#include "nthw_fpga.h"
+#include "nthw_register.h"
+#include "nt4ga_adapter.h"
+#include "nt4ga_pci_ta_tg.h"
+#include "ntnic_mod_reg.h"
+
+#include "flow_filter.h"
+
+static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info);
+static int nt4ga_adapter_deinit(struct adapter_info_s *p_adapter_info);
+
+static int nt4ga_adapter_show_info(struct adapter_info_s *p_adapter_info, FILE *pfh);
+
+/*
+ * Global variables shared by NT adapter types
+ */
+pthread_t monitor_tasks[NUM_ADAPTER_MAX];
+volatile int monitor_task_is_running[NUM_ADAPTER_MAX];
+
+/*
+ * Signal-handler to stop all monitor threads
+ */
+static void stop_monitor_tasks(int signum)
+{
+	const size_t N = ARRAY_SIZE(monitor_task_is_running);
+	size_t i;
+
+	/* Stop all monitor tasks */
+	for (i = 0; i < N; i++) {
+		const int is_running = monitor_task_is_running[i];
+		monitor_task_is_running[i] = 0;
+
+		if (signum == -1 && is_running != 0) {
+			void *ret_val = NULL;
+			pthread_join(monitor_tasks[i], &ret_val);
+			memset(&monitor_tasks[i], 0, sizeof(monitor_tasks[0]));
+		}
+	}
+}
+
+static int nt4ga_adapter_show_info(struct adapter_info_s *p_adapter_info, FILE *pfh)
+{
+	const char *const p_dev_name = p_adapter_info->p_dev_name;
+	const char *const p_adapter_id_str = p_adapter_info->mp_adapter_id_str;
+	fpga_info_t *p_fpga_info = &p_adapter_info->fpga_info;
+	hw_info_t *p_hw_info = &p_adapter_info->hw_info;
+	mcu_info_t *mcu_info = &p_adapter_info->fpga_info.mcu_info;
+	char a_pci_ident_str[32];
+	const struct nt4ga_stat_ops *nt4ga_stat_ops = get_nt4ga_stat_ops();
+
+	if (nt4ga_stat_ops != NULL)
+		nt4ga_stat_ops->nt4ga_stat_dump(p_adapter_info, pfh);
+
+	snprintf(a_pci_ident_str, sizeof(a_pci_ident_str), "" PCIIDENT_PRINT_STR "",
+		PCIIDENT_TO_DOMAIN(p_fpga_info->pciident),
+		PCIIDENT_TO_BUSNR(p_fpga_info->pciident),
+		PCIIDENT_TO_DEVNR(p_fpga_info->pciident),
+		PCIIDENT_TO_FUNCNR(p_fpga_info->pciident));
+
+	fprintf(pfh, "%s: DeviceName: %s\n", p_adapter_id_str, (p_dev_name ? p_dev_name : "NA"));
+	fprintf(pfh, "%s: PCI Details:\n", p_adapter_id_str);
+	fprintf(pfh, "%s: %s: %08X: %04X:%04X %04X:%04X\n", p_adapter_id_str, a_pci_ident_str,
+		p_fpga_info->pciident, p_hw_info->pci_vendor_id, p_hw_info->pci_device_id,
+		p_hw_info->pci_sub_vendor_id, p_hw_info->pci_sub_device_id);
+	fprintf(pfh, "%s: FPGA Details:\n", p_adapter_id_str);
+	fprintf(pfh, "%s: %03d-%04d-%02d-%02d [%016" PRIX64 "] (%08X)\n", p_adapter_id_str,
+		p_fpga_info->n_fpga_type_id, p_fpga_info->n_fpga_prod_id,
+		p_fpga_info->n_fpga_ver_id, p_fpga_info->n_fpga_rev_id, p_fpga_info->n_fpga_ident,
+		p_fpga_info->n_fpga_build_time);
+	fprintf(pfh, "%s: FpgaDebugMode=0x%x\n", p_adapter_id_str, p_fpga_info->n_fpga_debug_mode);
+	fprintf(pfh, "%s: Nims=%d PhyPorts=%d PhyQuads=%d RxPorts=%d TxPorts=%d\n",
+		p_adapter_id_str, p_fpga_info->n_nims, p_fpga_info->n_phy_ports,
+		p_fpga_info->n_phy_quads, p_fpga_info->n_rx_ports, p_fpga_info->n_tx_ports);
+	fprintf(pfh, "%s: Hw=0x%02X_rev%d: %s\n", p_adapter_id_str, p_hw_info->hw_platform_id,
+		p_fpga_info->nthw_hw_info.hw_id, p_fpga_info->nthw_hw_info.hw_plat_id_str);
+	fprintf(pfh, "%s: MCU Details:\n", p_adapter_id_str);
+	fprintf(pfh, "%s: HasMcu=%d McuType=%d McuDramSize=%d\n", p_adapter_id_str,
+		mcu_info->mb_has_mcu, mcu_info->mn_mcu_type, mcu_info->mn_mcu_dram_size);
+
+	if (nt4ga_stat_ops != NULL)
+		nt4ga_stat_ops->nt4ga_stat_dump(p_adapter_info, pfh);
+
+	return 0;
+}
+
+/*
+ * SPI for sensors reading
+ */
+nthw_spis_t *new_sensors_t_spi(struct nthw_fpga_s *p_fpga)
+{
+	nthw_spis_t *sensors_t_spi = nthw_spis_new();
+
+	/* init SPI for sensor initialization process */
+	if (sensors_t_spi == NULL) {
+		NT_LOG(ERR, ETHDEV, "%s: SPI allocation error\n", __func__);
+		return NULL;
+	}
+
+	if (nthw_spis_init(sensors_t_spi, p_fpga, 0)) {
+		NT_LOG(ERR, ETHDEV, "%s: SPI initialization error\n", __func__);
+		nthw_spis_delete(sensors_t_spi);
+		return NULL;
+	}
+
+	return sensors_t_spi;
+}
+
+static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL)
+		NT_LOG(ERR, ETHDEV, "%s: flow_filter module uninitialized\n", __func__);
+
+	char *const p_dev_name = malloc(24);
+	char *const p_adapter_id_str = malloc(24);
+	fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
+	hw_info_t *p_hw_info = &p_adapter_info->hw_info;
+
+	/*
+	 * IMPORTANT: Most variables cannot be determined before nthw fpga model is instantiated
+	 * (nthw_fpga_init())
+	 */
+	bool b_has_mcu = false;
+	int n_phy_ports = -1;
+	int n_nim_ports = -1;
+	int res = -1;
+	nthw_fpga_t *p_fpga = NULL;
+
+	(void)b_has_mcu;/* currently UNUSED - prevent warning */
+	(void)n_nim_ports;	/* currently UNUSED - prevent warning */
+
+	p_hw_info->n_nthw_adapter_id = nthw_platform_get_nthw_adapter_id(p_hw_info->pci_device_id);
+
+	fpga_info->n_nthw_adapter_id = p_hw_info->n_nthw_adapter_id;
+	/* ref: DN-0060 section 9 */
+	p_hw_info->hw_product_type = p_hw_info->pci_device_id & 0x000f;
+	/* ref: DN-0060 section 9 */
+	p_hw_info->hw_platform_id = (p_hw_info->pci_device_id >> 4) & 0x00ff;
+	/* ref: DN-0060 section 9 */
+	p_hw_info->hw_reserved1 = (p_hw_info->pci_device_id >> 12) & 0x000f;
+
+	/* mp_dev_name */
+	p_adapter_info->p_dev_name = p_dev_name;
+
+	if (p_dev_name) {
+		snprintf(p_dev_name, 24, "" PCIIDENT_PRINT_STR "",
+			PCIIDENT_TO_DOMAIN(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_BUSNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_DEVNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_FUNCNR(p_adapter_info->fpga_info.pciident));
+		NT_LOG(DBG, ETHDEV, "%s: (0x%08X)\n", p_dev_name,
+			p_adapter_info->fpga_info.pciident);
+	}
+
+	/* mp_adapter_id_str */
+	p_adapter_info->mp_adapter_id_str = p_adapter_id_str;
+
+	p_adapter_info->fpga_info.mp_adapter_id_str = p_adapter_id_str;
+
+	if (p_adapter_id_str) {
+		snprintf(p_adapter_id_str, 24, "PCI:" PCIIDENT_PRINT_STR "",
+			PCIIDENT_TO_DOMAIN(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_BUSNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_DEVNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_FUNCNR(p_adapter_info->fpga_info.pciident));
+		NT_LOG(DBG, ETHDEV, "%s: %s\n", p_adapter_id_str, p_dev_name);
+	}
+
+	{
+		int i;
+
+		for (i = 0; i < (int)ARRAY_SIZE(p_adapter_info->mp_port_id_str); i++) {
+			char *p = malloc(32);
+
+			if (p) {
+				snprintf(p, 32, "%s:intf_%d",
+					(p_adapter_id_str ? p_adapter_id_str : "NA"), i);
+			}
+
+			p_adapter_info->mp_port_id_str[i] = p;
+		}
+	}
+
+	res = nthw_fpga_init(&p_adapter_info->fpga_info);
+
+	if (res) {
+		NT_LOG(ERR, ETHDEV, "%s: %s: FPGA=%04d res=x%08X [%s:%u]\n", p_adapter_id_str,
+			p_dev_name, fpga_info->n_fpga_prod_id, res, __func__, __LINE__);
+		return res;
+	}
+
+	assert(fpga_info);
+	p_fpga = fpga_info->mp_fpga;
+	assert(p_fpga);
+	n_phy_ports = fpga_info->n_phy_ports;
+	assert(n_phy_ports >= 1);
+	n_nim_ports = fpga_info->n_nims;
+	assert(n_nim_ports >= 1);
+	b_has_mcu = fpga_info->mcu_info.mb_has_mcu;
+
+	/* NOTE: RX and TX queues for VFs shall be considered too */
+	int max_rx_queues = nthw_fpga_get_product_param(p_fpga, NT_DBS_RX_QUEUES, -1);
+	int max_tx_queues = nthw_fpga_get_product_param(p_fpga, NT_DBS_TX_QUEUES, -1);
+
+	if (max_rx_queues < 0 || max_tx_queues < 0 ||
+		n_phy_ports * p_adapter_info->n_rx_host_buffers > max_rx_queues ||
+		n_phy_ports * p_adapter_info->n_tx_host_buffers > max_tx_queues) {
+		NT_LOG(ERR, ETHDEV,
+			"%s: Too many queues requested: phy_ports=%d, rxqs=%d, txqs=%d, rx_queues_avail=%d, tx_queues_avail=%d\n",
+			p_adapter_info->mp_adapter_id_str, n_phy_ports,
+			p_adapter_info->n_rx_host_buffers, p_adapter_info->n_tx_host_buffers,
+			max_rx_queues, max_tx_queues);
+		nthw_fpga_shutdown(&p_adapter_info->fpga_info);
+		return -1;
+	}
+
+	/* Nt4ga Init Filter */
+	nt4ga_filter_t *p_filter = &p_adapter_info->nt4ga_filter;
+
+	if (flow_filter_ops != NULL) {
+		res = flow_filter_ops->flow_filter_init(p_fpga, &p_filter->mp_flow_device,
+				p_adapter_info->adapter_no);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot initialize filter\n", p_adapter_id_str);
+			return res;
+		}
+	}
+
+	/*
+	 * HIF/PCI TA/TG
+	 */
+	{
+		res = nt4ga_pci_ta_tg_init(p_adapter_info);
+
+		if (res == 0) {
+			nt4ga_pci_ta_tg_measure_throughput_main(p_adapter_info, 0, 0, TG_PKT_SIZE,
+				TG_NUM_PACKETS, TG_DELAY);
+
+		} else {
+			NT_LOG(WRN, ETHDEV, "%s: PCI TA/TG is not available - skipping\n",
+				p_adapter_id_str);
+		}
+	}
+
+	{
+		int i;
+		const struct link_ops_s *link_ops = NULL;
+		assert(fpga_info->n_fpga_prod_id > 0);
+
+		for (i = 0; i < NUM_ADAPTER_PORTS_MAX; i++) {
+			/* Disable all ports. Must be enabled later */
+			p_adapter_info->nt4ga_link.port_action[i].port_disable = true;
+		}
+
+		switch (fpga_info->n_fpga_prod_id) {
+		/* NT200A01: 2x100G (Xilinx) */
+		case 9563:	/* NT200A02 (Cap) */
+			link_ops = get_100g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV,
+					"%s: NT200A02 100G link module uninitialized\n", __func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		/* NT200A0x: 2x10G/2x25G (Xilinx) */
+		case 9530:	/* NT200A02 (NFV) */
+		case 9544:	/* NT200A02 (NFV Lenovo) */
+			link_ops = get_25g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV, "%s: NT200A02 25G link module uninitialized\n",
+					__func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		/* NT50b0x: 2x10G/2x25G (Xilinx) */
+		case 9542:	/* NT50B01 (NFV) */
+		case 9547:	/* NT50B01 (NFV Lenovo) */
+			link_ops = get_25g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV, "%s: NT50B01 25G link module uninitialized\n",
+					__func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		case 9569:	/* NT400D11 (Intel Agilex FPGA) */
+			link_ops = get_agx_100g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV,
+					"%s: NT400D11 100G link module uninitialized\n", __func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		case 9572:
+			/* NT200A0x: 8x10G (Xilinx) */
+			link_ops = get_8x10g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV,
+					"%s: NT200A0x 8x10G link module uninitialized\n", __func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		default:
+			NT_LOG(ERR, ETHDEV, "%s: Unsupported FPGA product: %04d\n", __func__,
+				fpga_info->n_fpga_prod_id);
+			res = -1;
+			break;
+		}
+
+		if (res) {
+			NT_LOG(ERR, ETHDEV, "%s: %s: %s: %u: FPGA=%04d res=x%08X\n",
+				p_adapter_id_str, p_dev_name, __func__, __LINE__,
+				fpga_info->n_fpga_prod_id, res);
+			return res;
+		}
+	}
+
+	/*
+	 * HostBuffer Systems
+	 */
+	p_adapter_info->n_rx_host_buffers = 0;
+	p_adapter_info->n_tx_host_buffers = 0;
+
+	p_adapter_info->fpga_info.mp_nthw_epp = NULL;
+
+	if (nthw_epp_present(p_adapter_info->fpga_info.mp_fpga, 0)) {
+		p_adapter_info->fpga_info.mp_nthw_epp = nthw_epp_new();
+
+		if (p_adapter_info->fpga_info.mp_nthw_epp == NULL) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot create EPP\n", p_adapter_id_str);
+			return -1;
+		}
+
+		res = nthw_epp_init(p_adapter_info->fpga_info.mp_nthw_epp,
+				p_adapter_info->fpga_info.mp_fpga, 0);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot initialize EPP\n", p_adapter_id_str);
+			return res;
+
+		} else {
+			NT_LOG(DBG, ETHDEV, "%s: Initialized EPP\n", p_adapter_id_str);
+		}
+
+		res = nthw_epp_setup(p_adapter_info->fpga_info.mp_nthw_epp);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot setup EPP\n", p_adapter_id_str);
+			return res;
+		}
+	}
+
+	const struct nt4ga_stat_ops *nt4ga_stat_ops = get_nt4ga_stat_ops();
+
+	if (nt4ga_stat_ops != NULL) {
+		/* Nt4ga Stat init/setup */
+		res = nt4ga_stat_ops->nt4ga_stat_init(p_adapter_info);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot initialize the statistics module\n",
+				p_adapter_id_str);
+			return res;
+		}
+
+		res = nt4ga_stat_ops->nt4ga_stat_setup(p_adapter_info);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot setup the statistics module\n",
+				p_adapter_id_str);
+			return res;
+		}
+	}
+
+	/*
+	 * MCU testing
+	 */
+
+	return 0;
+}
+
+static int nt4ga_adapter_deinit(struct adapter_info_s *p_adapter_info)
+{
+	const struct sensor_ops *sensor_ops = get_sensor_ops();
+	fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
+	int i;
+	int res;
+	struct nt_sensor_group *cur_adapter_sensor = NULL;
+	struct nt_sensor_group *next_adapter_sensor = NULL;
+	struct nim_sensor_group *cur_nim_sensor = NULL;
+	struct nim_sensor_group *next_nim_sensor = NULL;
+
+	stop_monitor_tasks(-1);
+
+	const struct nt4ga_stat_ops *nt4ga_stat_ops = get_nt4ga_stat_ops();
+
+	if (nt4ga_stat_ops != NULL)
+		nt4ga_stat_ops->nt4ga_stat_stop(p_adapter_info);
+
+	nthw_fpga_shutdown(&p_adapter_info->fpga_info);
+
+	/* Rac rab reset flip flop */
+	res = nthw_rac_rab_reset(fpga_info->mp_nthw_rac);
+
+	/* Free adapter port ident strings */
+	for (i = 0; i < fpga_info->n_phy_ports; i++) {
+		if (p_adapter_info->mp_port_id_str[i]) {
+			free(p_adapter_info->mp_port_id_str[i]);
+			p_adapter_info->mp_port_id_str[i] = NULL;
+		}
+	}
+
+	/* Free adapter ident string */
+	if (p_adapter_info->mp_adapter_id_str) {
+		free(p_adapter_info->mp_adapter_id_str);
+		p_adapter_info->mp_adapter_id_str = NULL;
+	}
+
+	/* Free devname ident string */
+	if (p_adapter_info->p_dev_name) {
+		free(p_adapter_info->p_dev_name);
+		p_adapter_info->p_dev_name = NULL;
+	}
+
+	/* Free adapter sensors */
+	if (p_adapter_info->adapter_sensors != NULL) {
+		do {
+			cur_adapter_sensor = p_adapter_info->adapter_sensors;
+			next_adapter_sensor = p_adapter_info->adapter_sensors->next;
+			p_adapter_info->adapter_sensors = next_adapter_sensor;
+
+			if (sensor_ops != NULL)
+				sensor_ops->sensor_deinit(cur_adapter_sensor);
+		} while (next_adapter_sensor != NULL);
+	}
+
+	/* Free NIM sensors */
+	for (i = 0; i < fpga_info->n_phy_ports; i++) {
+		if (p_adapter_info->nim_sensors[i] != NULL) {
+			do {
+				cur_nim_sensor = p_adapter_info->nim_sensors[i];
+				next_nim_sensor = p_adapter_info->nim_sensors[i]->next;
+				p_adapter_info->nim_sensors[i] = next_nim_sensor;
+				free(cur_nim_sensor->sensor);
+				free(cur_nim_sensor);
+			} while (next_nim_sensor != NULL);
+		}
+	}
+
+	return res;
+}
+
+static const struct adapter_ops ops = {
+	.init = nt4ga_adapter_init,
+	.deinit = nt4ga_adapter_deinit,
+
+	.show_info = nt4ga_adapter_show_info,
+};
+
+static void __attribute__((constructor(65535))) adapter_init(void)
+{
+	register_adapter_ops(&ops);
+}
drivers/net/ntnic/meson.build +1 -0
index 1a56a0f6c4..c6e4a9fd5b 100644
@@ -77,6 +77,7 @@ headers = files('rte_pmd_ntnic.h')
 # all sources
 sources = files(
     'dpdk_mod_reg.c',
+    'drivers/net/ntnic/driver/modules/adapter/nt4ga_adapter.c',
     'drivers/net/ntnic/driver/modules/adapter/nt4ga_pci_ta_tg.c',
     'drivers/net/ntnic/driver/modules/adapter/nt4ga_tfg.c',
     'nthw/supported/nthw_fpga_9563_055_039_0000.c',
Signature · 1 line
2.44.0
#31 lore raw

PATCH v2 15/17 net/ntnic: add link management module

In reply to Serhii Iliushyk

Add ntnic link control.

---
v2:
* Fixed unused header

---
 drivers/net/ntnic/link_mgmt/nt4ga_link.c | 263 +++++++++++++++++++++++
 1 file changed, 263 insertions(+)
 create mode 100644 drivers/net/ntnic/link_mgmt/nt4ga_link.c
drivers/net/ntnic/link_mgmt/nt4ga_link.c new file +263 -0
new file mode 100644
index 0000000000..765029bcd5
@@ -0,0 +1,263 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+#include "ntlog.h"
+#include "nthw_drv.h"
+#include "nt4ga_adapter.h"
+#include "ntnic_mod_reg.h"
+
+#include "nt4ga_link.h"
+#include "nt_util.h"
+#include "i2c_nim.h"
+
+static bool nt4ga_port_get_nim_present(struct adapter_info_s *p, int port);
+
+/*
+ * port:s link mode
+ */
+static void nt4ga_port_set_adm_state(struct adapter_info_s *p, int port, bool adm_state);
+static bool nt4ga_port_get_adm_state(struct adapter_info_s *p, int port);
+
+/*
+ * port:s link status
+ */
+static void nt4ga_port_set_link_status(struct adapter_info_s *p, int port, bool status);
+static bool nt4ga_port_get_link_status(struct adapter_info_s *p, int port);
+
+/*
+ * port: link autoneg
+ */
+static void nt4ga_port_set_link_autoneg(struct adapter_info_s *p, int port, bool autoneg);
+static bool nt4ga_port_get_link_autoneg(struct adapter_info_s *p, int port);
+
+/*
+ * port: link speed
+ */
+static void nt4ga_port_set_link_speed(struct adapter_info_s *p, int port, nt_link_speed_t speed);
+static nt_link_speed_t nt4ga_port_get_link_speed(struct adapter_info_s *p, int port);
+
+/*
+ * port: link duplex
+ */
+static void
+nt4ga_port_set_link_duplex(struct adapter_info_s *p, int port, nt_link_duplex_t duplex);
+static nt_link_duplex_t nt4ga_port_get_link_duplex(struct adapter_info_s *p, int port);
+
+/*
+ * port: loopback mode
+ */
+static void nt4ga_port_set_loopback_mode(struct adapter_info_s *p, int port, uint32_t mode);
+static uint32_t nt4ga_port_get_loopback_mode(struct adapter_info_s *p, int port);
+
+static uint32_t nt4ga_port_get_link_speed_capabilities(struct adapter_info_s *p, int port);
+
+/*
+ * port: tx power
+ */
+static int nt4ga_port_tx_power(struct adapter_info_s *p, int port, bool disable);
+
+/*
+ * port: speed capabilitoes
+ * This is actually an adapter capability mapped onto every port
+ */
+static uint32_t nt4ga_port_get_link_speed_capabilities(struct adapter_info_s *p, int port)
+{
+	(void)p;
+	(void)port;
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	const uint32_t nt_link_speed_capa = p_link->speed_capa;
+	return nt_link_speed_capa;
+}
+
+/*
+ * port: nim present
+ */
+static bool nt4ga_port_get_nim_present(struct adapter_info_s *p, int port)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	const bool nim_present = p_link->link_state[port].nim_present;
+	return nim_present;
+}
+
+/*
+ * port: link mode
+ */
+static void nt4ga_port_set_adm_state(struct adapter_info_s *p, int port, bool adm_state)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	p_link->port_action[port].port_disable = !adm_state;
+}
+
+static bool nt4ga_port_get_adm_state(struct adapter_info_s *p, int port)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	const bool adm_state = !p_link->port_action[port].port_disable;
+	return adm_state;
+}
+
+/*
+ * port: link status
+ */
+static void nt4ga_port_set_link_status(struct adapter_info_s *p, int port, bool link_status)
+{
+	/* Setting link state/status is (currently) the same as controlling the port adm state */
+	nt4ga_port_set_adm_state(p, port, link_status);
+}
+
+static bool nt4ga_port_get_link_status(struct adapter_info_s *p, int port)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	bool status = p_link->link_state[port].link_up;
+	return status;
+}
+
+/*
+ * port: link speed
+ */
+static void nt4ga_port_set_link_speed(struct adapter_info_s *p, int port, nt_link_speed_t speed)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	p_link->port_action[port].port_speed = speed;
+	p_link->link_info[port].link_speed = speed;
+}
+
+static nt_link_speed_t nt4ga_port_get_link_speed(struct adapter_info_s *p, int port)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	nt_link_speed_t speed = p_link->link_info[port].link_speed;
+	return speed;
+}
+
+/*
+ * port: link autoneg
+ * Currently not fully supported by link code
+ */
+static void nt4ga_port_set_link_autoneg(struct adapter_info_s *p, int port, bool autoneg)
+{
+	(void)p;
+	(void)port;
+	(void)autoneg;
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	(void)p_link;
+}
+
+static bool nt4ga_port_get_link_autoneg(struct adapter_info_s *p, int port)
+{
+	(void)p;
+	(void)port;
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	(void)p_link;
+	return true;
+}
+
+/*
+ * port: link duplex
+ * Currently not fully supported by link code
+ */
+static void nt4ga_port_set_link_duplex(struct adapter_info_s *p, int port, nt_link_duplex_t duplex)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	p_link->port_action[port].port_duplex = duplex;
+}
+
+static nt_link_duplex_t nt4ga_port_get_link_duplex(struct adapter_info_s *p, int port)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	nt_link_duplex_t duplex = p_link->link_info[port].link_duplex;
+	return duplex;
+}
+
+/*
+ * port: loopback mode
+ */
+static void nt4ga_port_set_loopback_mode(struct adapter_info_s *p, int port, uint32_t mode)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	p_link->port_action[port].port_lpbk_mode = mode;
+}
+
+static uint32_t nt4ga_port_get_loopback_mode(struct adapter_info_s *p, int port)
+{
+	nt4ga_link_t *const p_link = &p->nt4ga_link;
+	return p_link->port_action[port].port_lpbk_mode;
+}
+
+/*
+ * port: tx power
+ */
+static int nt4ga_port_tx_power(struct adapter_info_s *p, int port, bool disable)
+{
+	nt4ga_link_t *link_info = &p->nt4ga_link;
+
+	if (link_info->u.nim_ctx[port].port_type == NT_PORT_TYPE_QSFP28_SR4 ||
+		link_info->u.nim_ctx[port].port_type == NT_PORT_TYPE_QSFP28 ||
+		link_info->u.nim_ctx[port].port_type == NT_PORT_TYPE_QSFP28_LR4) {
+		nim_i2c_ctx_t *nim_ctx = &link_info->u.var100g.nim_ctx[port];
+
+		if (!nim_ctx->specific_u.qsfp.rx_only) {
+			if (nim_qsfp_plus_nim_set_tx_laser_disable(nim_ctx, disable, -1) != 0)
+				return 1;
+		}
+	}
+
+	return 0;
+}
+
+static const struct port_ops ops = {
+	.get_nim_present = nt4ga_port_get_nim_present,
+
+	/*
+	 * port:s link mode
+	 */
+	.set_adm_state = nt4ga_port_set_adm_state,
+	.get_adm_state = nt4ga_port_get_adm_state,
+
+	/*
+	 * port:s link status
+	 */
+	.set_link_status = nt4ga_port_set_link_status,
+	.get_link_status = nt4ga_port_get_link_status,
+
+	/*
+	 * port: link autoneg
+	 */
+	.set_link_autoneg = nt4ga_port_set_link_autoneg,
+	.get_link_autoneg = nt4ga_port_get_link_autoneg,
+
+	/*
+	 * port: link speed
+	 */
+	.set_link_speed = nt4ga_port_set_link_speed,
+	.get_link_speed = nt4ga_port_get_link_speed,
+
+	/*
+	 * port: link duplex
+	 */
+	.set_link_duplex = nt4ga_port_set_link_duplex,
+	.get_link_duplex = nt4ga_port_get_link_duplex,
+
+	/*
+	 * port: loopback mode
+	 */
+	.set_loopback_mode = nt4ga_port_set_loopback_mode,
+	.get_loopback_mode = nt4ga_port_get_loopback_mode,
+
+	.get_link_speed_capabilities = nt4ga_port_get_link_speed_capabilities,
+
+	/*
+	 * port: tx power
+	 */
+	.tx_power = nt4ga_port_tx_power,
+};
+
+static void __attribute__((constructor(65535))) port_init(void)
+{
+	register_port_ops(&ops);
+}
Signature · 1 line
2.44.0
#32 lore raw

PATCH v2 16/17 net/ntnic: add link 100G module

In reply to Serhii Iliushyk

Add ntnic 100G link support.

---
v2:
* Fixed WARNING:REPEATED_WORD

---
 drivers/net/ntnic/include/nt4ga_link.h        |   8 +
 .../link_mgmt/link_100g/nt4ga_link_100g.c     | 840 ++++++++++++++++
 .../link_mgmt/link_100g/nt4ga_link_100g.h     |  11 +
 .../net/ntnic/nthw/core/include/nthw_core.h   |   2 +
 .../ntnic/nthw/core/include/nthw_gpio_phy.h   |  50 +
 .../ntnic/nthw/core/include/nthw_mac_pcs.h    | 263 +++++
 drivers/net/ntnic/nthw/core/nthw_gpio_phy.c   | 144 +++
 drivers/net/ntnic/nthw/core/nthw_mac_pcs.c    | 950 ++++++++++++++++++
 8 files changed, 2268 insertions(+)
 create mode 100644 drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c
 create mode 100644 drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gpio_phy.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_mac_pcs.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gpio_phy.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_mac_pcs.c
drivers/net/ntnic/include/nt4ga_link.h +8 -0
index 49e1c5d672..1d7565f614 100644
@@ -115,8 +115,16 @@ typedef struct port_action_s {
 	uint32_t port_lpbk_mode;
 } port_action_t;
 
+typedef struct adapter_100g_s {
+	nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX];	/* Should be the first field */
+	nthw_mac_pcs_t mac_pcs100g[NUM_ADAPTER_PORTS_MAX];
+	nthw_gfg_t gfg[NUM_ADAPTER_PORTS_MAX];
+	nthw_gpio_phy_t gpio_phy[NUM_ADAPTER_PORTS_MAX];
+} adapter_100g_t;
+
 typedef union adapter_var_s {
 	nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX];	/* First field in all the adaptors type */
+	adapter_100g_t var100g;
 } adapter_var_u;
 
 typedef struct nt4ga_link_s {
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c new file +840 -0

840 lines not on this page · raw message

drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.h new file +11 -0
new file mode 100644
index 0000000000..0e6103d9a0
@@ -0,0 +1,11 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_LINK_100G_H_
+#define NT4GA_LINK_100G_H_
+
+#include "nthw_drv.h"
+
+#endif	/* NT4GA_LINK_100G_H_ */
drivers/net/ntnic/nthw/core/include/nthw_core.h +2 -0
index b72766cc5c..ba7d85b92a 100644
@@ -21,6 +21,8 @@
 
 #include "nthw_gfg.h"
 #include "nthw_gmf.h"
+#include "nthw_gpio_phy.h"
+#include "nthw_mac_pcs.h"
 #include "nthw_mac_pcs_xxv.h"
 #include "nthw_mac_tfg.h"
 #include "nthw_sdc.h"
drivers/net/ntnic/nthw/core/include/nthw_gpio_phy.h new file +50 -0

50 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_mac_pcs.h new file +263 -0

263 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_gpio_phy.c new file +144 -0

144 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_mac_pcs.c new file +950 -0

950 lines not on this page · raw message

Signature · 1 line
2.44.0
#33 lore raw

PATCH v2 17/17 net/ntnic: add NIM module

In reply to Serhii Iliushyk

Includes support for NIM QSFP and QSFP+.

---
 drivers/net/ntnic/meson.build                 |   16 +-
 drivers/net/ntnic/nim/i2c_nim.c               | 1359 +++++++++++++++++
 drivers/net/ntnic/nim/i2c_nim.h               |   77 +
 .../net/ntnic/nim/include/qsfp_registers.h    |   58 +
 drivers/net/ntnic/nim/nim_defines.h           |   69 +
 drivers/net/ntnic/nim/nt_link_speed.c         |  115 ++
 drivers/net/ntnic/nim/nt_link_speed.h         |   16 +
 7 files changed, 1707 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/ntnic/nim/i2c_nim.c
 create mode 100644 drivers/net/ntnic/nim/i2c_nim.h
 create mode 100644 drivers/net/ntnic/nim/include/qsfp_registers.h
 create mode 100644 drivers/net/ntnic/nim/nim_defines.h
 create mode 100644 drivers/net/ntnic/nim/nt_link_speed.c
 create mode 100644 drivers/net/ntnic/nim/nt_link_speed.h
drivers/net/ntnic/meson.build +13 -3
index c6e4a9fd5b..a622fa7ed5 100644
@@ -42,6 +42,7 @@ includes = [
     include_directories('nthw'),
     include_directories('nthw/supported'),
     include_directories('nthw/model'),
+    include_directories('nim/include'),
 ]
 
 # ntnic_core
@@ -61,6 +62,9 @@ if fs.is_dir('nthw/core/nt400dxx')
     includes += include_directories('nthw/core/nt400dxx')
     includes += include_directories('nthw/core/nt400dxx/reset')
 endif
+includes += include_directories('adapter')
+includes += include_directories('link_mgmt')
+includes += include_directories('nim')
 if fs.is_dir('nim/sfp_sensors')
     includes += include_directories('nim/sfp_sensors')
 endif
@@ -76,10 +80,14 @@ headers = files('rte_pmd_ntnic.h')
 
 # all sources
 sources = files(
+    'adapter/nt4ga_adapter.c',
+    'adapter/nt4ga_pci_ta_tg.c',
+    'adapter/nt4ga_tfg.c',
     'dpdk_mod_reg.c',
-    'drivers/net/ntnic/driver/modules/adapter/nt4ga_adapter.c',
-    'drivers/net/ntnic/driver/modules/adapter/nt4ga_pci_ta_tg.c',
-    'drivers/net/ntnic/driver/modules/adapter/nt4ga_tfg.c',
+    'link_mgmt/link_100g/nt4ga_link_100g.c',
+    'link_mgmt/nt4ga_link.c',
+    'nim/i2c_nim.c',
+    'nim/nt_link_speed.c',
     'nthw/supported/nthw_fpga_9563_055_039_0000.c',
     'nthw/supported/nthw_fpga_instances.c',
     'nthw/supported/nthw_fpga_mod_str_map.c',
@@ -91,9 +99,11 @@ sources = files(
     'nthw/core/nthw_fpga_rst.c',
     'nthw/core/nthw_gfg.c',
     'nthw/core/nthw_gmf.c',
+    'nthw/core/nthw_gpio_phy.c',
     'nthw/core/nthw_hif.c',
     'nthw/core/nthw_i2cm.c',
     'nthw/core/nthw_iic.c',
+    'nthw/core/nthw_mac_pcs.c',
     'nthw/core/nthw_mac_pcs_xxv.c',
     'nthw/core/nthw_pcie3.c',
     'nthw/core/nthw_pci_rd_tg.c',
drivers/net/ntnic/nim/i2c_nim.c new file +1359 -0

1,359 lines not on this page · raw message

drivers/net/ntnic/nim/i2c_nim.h new file +77 -0

77 lines not on this page · raw message

drivers/net/ntnic/nim/include/qsfp_registers.h new file +58 -0

58 lines not on this page · raw message

drivers/net/ntnic/nim/nim_defines.h new file +69 -0

69 lines not on this page · raw message

drivers/net/ntnic/nim/nt_link_speed.c new file +115 -0

115 lines not on this page · raw message

drivers/net/ntnic/nim/nt_link_speed.h new file +16 -0
new file mode 100644
index 0000000000..6e1b682fe8
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT_LINK_SPEED_H_
+#define NT_LINK_SPEED_H_
+
+#include <stdint.h>
+#include "nt4ga_link.h"
+
+const char *nt_translate_link_speed(nt_link_speed_t link_speed);
+uint64_t nt_get_link_speed(nt_link_speed_t e_link_speed);
+uint64_t nt_get_max_link_speed(uint32_t link_speed_mask);
+
+#endif	/* NT_LINK_SPEED_H_ */
Signature · 1 line
2.44.0
#34 lore raw

PATCH v3 1/17 net/ntnic: Add registers for NapaTech SmartNiC

In reply to Serhii Iliushyk

The NTNIC PMD does not rely on a kernel space Napatech driver, thus all defines related to the register layout is part of the PMD code, which will be added in later commits.

---
 .../supported/nthw_fpga_9563_055_039_0000.c   | 3488 +++++++++++++++++
 .../nthw/supported/nthw_fpga_instances.c      |    6 +
 .../nthw/supported/nthw_fpga_instances.h      |    7 +
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   93 +
 .../nthw/supported/nthw_fpga_mod_str_map.c    |   78 +
 .../nthw/supported/nthw_fpga_mod_str_map.h    |   11 +
 .../nthw/supported/nthw_fpga_param_defs.h     |  232 ++
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   94 +
 .../nthw/supported/nthw_fpga_reg_defs_cat.h   |  237 ++
 .../nthw/supported/nthw_fpga_reg_defs_cb.h    |   73 +
 .../nthw/supported/nthw_fpga_reg_defs_cor.h   |   81 +
 .../nthw/supported/nthw_fpga_reg_defs_cpy.h   |  112 +
 .../nthw/supported/nthw_fpga_reg_defs_csu.h   |   30 +
 .../nthw/supported/nthw_fpga_reg_defs_dbs.h   |  144 +
 .../nthw/supported/nthw_fpga_reg_defs_ddp.h   |   34 +
 .../nthw/supported/nthw_fpga_reg_defs_epp.h   |   64 +
 .../nthw/supported/nthw_fpga_reg_defs_eqm.h   |   45 +
 .../nthw/supported/nthw_fpga_reg_defs_fhm.h   |   48 +
 .../nthw/supported/nthw_fpga_reg_defs_flm.h   |  237 ++
 .../nthw/supported/nthw_fpga_reg_defs_gfg.h   |  126 +
 .../nthw/supported/nthw_fpga_reg_defs_gmf.h   |   68 +
 .../supported/nthw_fpga_reg_defs_gpio_phy.h   |   48 +
 .../nthw_fpga_reg_defs_gpio_phy_ports.h       |   72 +
 .../supported/nthw_fpga_reg_defs_gpio_sfpp.h  |   34 +
 .../nthw/supported/nthw_fpga_reg_defs_hfu.h   |   48 +
 .../nthw/supported/nthw_fpga_reg_defs_hif.h   |   79 +
 .../nthw/supported/nthw_fpga_reg_defs_hsh.h   |   49 +
 .../nthw/supported/nthw_fpga_reg_defs_i2cm.h  |   38 +
 .../nthw/supported/nthw_fpga_reg_defs_ifr.h   |   41 +
 .../nthw/supported/nthw_fpga_reg_defs_igam.h  |   28 +
 .../nthw/supported/nthw_fpga_reg_defs_iic.h   |   96 +
 .../nthw/supported/nthw_fpga_reg_defs_ins.h   |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_ioa.h   |   44 +
 .../nthw/supported/nthw_fpga_reg_defs_ipf.h   |   84 +
 .../nthw/supported/nthw_fpga_reg_defs_km.h    |  125 +
 .../nthw/supported/nthw_fpga_reg_defs_mac.h   |  177 +
 .../supported/nthw_fpga_reg_defs_mac_pcs.h    |  298 ++
 .../nthw_fpga_reg_defs_mac_pcs_xxv.h          | 1092 ++++++
 .../supported/nthw_fpga_reg_defs_mac_rx.h     |   90 +
 .../supported/nthw_fpga_reg_defs_mac_tfg.h    |   42 +
 .../supported/nthw_fpga_reg_defs_mac_tx.h     |   70 +
 .../nthw/supported/nthw_fpga_reg_defs_msk.h   |   42 +
 .../supported/nthw_fpga_reg_defs_pci_rd_tg.h  |   37 +
 .../supported/nthw_fpga_reg_defs_pci_ta.h     |   32 +
 .../supported/nthw_fpga_reg_defs_pci_wr_tg.h  |   40 +
 .../nthw/supported/nthw_fpga_reg_defs_pcie3.h |  281 ++
 .../nthw_fpga_reg_defs_pcm_nt400dxx.h         |   19 +
 .../nthw_fpga_reg_defs_pcm_nt50b01_01.h       |   19 +
 .../nthw/supported/nthw_fpga_reg_defs_pcs.h   |   92 +
 .../supported/nthw_fpga_reg_defs_pcs100.h     |   90 +
 .../nthw/supported/nthw_fpga_reg_defs_pdb.h   |   47 +
 .../nthw/supported/nthw_fpga_reg_defs_pdi.h   |   48 +
 .../supported/nthw_fpga_reg_defs_phy_tile.h   |  196 +
 .../nthw_fpga_reg_defs_prm_nt400dxx.h         |   19 +
 .../nthw_fpga_reg_defs_prm_nt50b01_01.h       |   19 +
 .../nthw/supported/nthw_fpga_reg_defs_qsl.h   |   65 +
 .../nthw/supported/nthw_fpga_reg_defs_qspi.h  |   89 +
 .../nthw/supported/nthw_fpga_reg_defs_r2drp.h |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_rac.h   |   72 +
 .../nthw/supported/nthw_fpga_reg_defs_rfd.h   |   37 +
 .../nthw/supported/nthw_fpga_reg_defs_rmc.h   |   35 +
 .../nthw/supported/nthw_fpga_reg_defs_roa.h   |   67 +
 .../nthw/supported/nthw_fpga_reg_defs_rpf.h   |   30 +
 .../nthw/supported/nthw_fpga_reg_defs_rpl.h   |   42 +
 .../supported/nthw_fpga_reg_defs_rpp_lr.h     |   36 +
 .../supported/nthw_fpga_reg_defs_rst9563.h    |   59 +
 .../nthw/supported/nthw_fpga_reg_defs_sdc.h   |   44 +
 .../nthw/supported/nthw_fpga_reg_defs_slc.h   |   33 +
 .../supported/nthw_fpga_reg_defs_slc_lr.h     |   22 +
 .../nthw/supported/nthw_fpga_reg_defs_spim.h  |   75 +
 .../nthw/supported/nthw_fpga_reg_defs_spis.h  |   50 +
 .../nthw/supported/nthw_fpga_reg_defs_sta.h   |   59 +
 .../supported/nthw_fpga_reg_defs_tempmon.h    |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_tint.h  |   27 +
 .../nthw/supported/nthw_fpga_reg_defs_tsm.h   |  294 ++
 .../supported/nthw_fpga_reg_defs_tx_cpy.h     |   22 +
 .../supported/nthw_fpga_reg_defs_tx_csi.h     |   22 +
 .../supported/nthw_fpga_reg_defs_tx_cso.h     |   22 +
 .../supported/nthw_fpga_reg_defs_tx_ins.h     |   22 +
 .../supported/nthw_fpga_reg_defs_tx_rpl.h     |   22 +
 80 files changed, 10177 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_039_0000.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_param_defs.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cat.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cb.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cor.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cpy.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_csu.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ddp.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_epp.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_eqm.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_fhm.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_flm.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gfg.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gmf.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_phy.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_phy_ports.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_sfpp.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hfu.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hif.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hsh.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_i2cm.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ifr.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_iic.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ins.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ioa.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ipf.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_km.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_pcs.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_pcs_xxv.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tfg.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_msk.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_rd_tg.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_wr_tg.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcie3.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt50b01_01.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcs.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcs100.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdb.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt50b01_01.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_qsl.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_qspi.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_r2drp.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rac.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rmc.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_roa.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpl.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpp_lr.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9563.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sdc.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc_lr.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tempmon.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cpy.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_csi.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cso.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_ins.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_rpl.h
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_039_0000.c new file +3488 -0
new file mode 100644
index 0000000000..a7ee892007
@@ -0,0 +1,3488 @@
+/*
+ * Auto-generated file - do *NOT* edit
+ */
+
+#include "nthw_register.h"
+
+static nthw_fpga_field_init_s cat_cct_ctrl_fields[] = {
+	{ CAT_CCT_CTRL_ADR, 8, 0, 0x0000 },
+	{ CAT_CCT_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cct_data_fields[] = {
+	{ CAT_CCT_DATA_COLOR, 32, 0, 0x0000 },
+	{ CAT_CCT_DATA_KM, 4, 32, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cfn_ctrl_fields[] = {
+	{ CAT_CFN_CTRL_ADR, 6, 0, 0x0000 },
+	{ CAT_CFN_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cfn_data_fields[] = {
+	{ CAT_CFN_DATA_ENABLE, 1, 0, 0x0000 },
+	{ CAT_CFN_DATA_ERR_CV, 2, 99, 0x0000 },
+	{ CAT_CFN_DATA_ERR_FCS, 2, 101, 0x0000 },
+	{ CAT_CFN_DATA_ERR_INV, 1, 98, 0x0000 },
+	{ CAT_CFN_DATA_ERR_L3_CS, 2, 105, 0x0000 },
+	{ CAT_CFN_DATA_ERR_L4_CS, 2, 107, 0x0000 },
+	{ CAT_CFN_DATA_ERR_TNL_L3_CS, 2, 109, 0x0000 },
+	{ CAT_CFN_DATA_ERR_TNL_L4_CS, 2, 111, 0x0000 },
+	{ CAT_CFN_DATA_ERR_TNL_TTL_EXP, 2, 115, 0x0000 },
+	{ CAT_CFN_DATA_ERR_TRUNC, 2, 103, 0x0000 },
+	{ CAT_CFN_DATA_ERR_TTL_EXP, 2, 113, 0x0000 },
+	{ CAT_CFN_DATA_INV, 1, 1, 0x0000 },
+	{ CAT_CFN_DATA_KM0_OR, 3, 173, 0x0000 },
+	{ CAT_CFN_DATA_KM1_OR, 3, 176, 0x0000 },
+	{ CAT_CFN_DATA_LC, 8, 164, 0x0000 },
+	{ CAT_CFN_DATA_LC_INV, 1, 172, 0x0000 },
+	{ CAT_CFN_DATA_MAC_PORT, 2, 117, 0x0000 },
+	{ CAT_CFN_DATA_PM_AND_INV, 1, 161, 0x0000 },
+	{ CAT_CFN_DATA_PM_CMB, 4, 157, 0x0000 },
+	{ CAT_CFN_DATA_PM_CMP, 32, 119, 0x0000 },
+	{ CAT_CFN_DATA_PM_DCT, 2, 151, 0x0000 },
+	{ CAT_CFN_DATA_PM_EXT_INV, 4, 153, 0x0000 },
+	{ CAT_CFN_DATA_PM_INV, 1, 163, 0x0000 },
+	{ CAT_CFN_DATA_PM_OR_INV, 1, 162, 0x0000 },
+	{ CAT_CFN_DATA_PTC_CFP, 2, 5, 0x0000 },
+	{ CAT_CFN_DATA_PTC_FRAG, 4, 36, 0x0000 },
+	{ CAT_CFN_DATA_PTC_INV, 1, 2, 0x0000 },
+	{ CAT_CFN_DATA_PTC_IP_PROT, 8, 40, 0x0000 },
+	{ CAT_CFN_DATA_PTC_ISL, 2, 3, 0x0000 },
+	{ CAT_CFN_DATA_PTC_L2, 7, 12, 0x0000 },
+	{ CAT_CFN_DATA_PTC_L3, 3, 33, 0x0000 },
+	{ CAT_CFN_DATA_PTC_L4, 5, 48, 0x0000 },
+	{ CAT_CFN_DATA_PTC_MAC, 5, 7, 0x0000 },
+	{ CAT_CFN_DATA_PTC_MPLS, 8, 25, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TNL_FRAG, 4, 81, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TNL_IP_PROT, 8, 85, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TNL_L2, 2, 64, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TNL_L3, 3, 78, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TNL_L4, 5, 93, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TNL_MPLS, 8, 70, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TNL_VLAN, 4, 66, 0x0000 },
+	{ CAT_CFN_DATA_PTC_TUNNEL, 11, 53, 0x0000 },
+	{ CAT_CFN_DATA_PTC_VLAN, 4, 21, 0x0000 },
+	{ CAT_CFN_DATA_PTC_VNTAG, 2, 19, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cot_ctrl_fields[] = {
+	{ CAT_COT_CTRL_ADR, 6, 0, 0x0000 },
+	{ CAT_COT_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cot_data_fields[] = {
+	{ CAT_COT_DATA_COLOR, 32, 0, 0x0000 },
+	{ CAT_COT_DATA_KM, 4, 32, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cte_ctrl_fields[] = {
+	{ CAT_CTE_CTRL_ADR, 6, 0, 0x0000 },
+	{ CAT_CTE_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cte_data_fields[] = {
+	{ CAT_CTE_DATA_COL_ENABLE, 1, 0, 0x0000 }, { CAT_CTE_DATA_COR_ENABLE, 1, 1, 0x0000 },
+	{ CAT_CTE_DATA_EPP_ENABLE, 1, 9, 0x0000 }, { CAT_CTE_DATA_HSH_ENABLE, 1, 2, 0x0000 },
+	{ CAT_CTE_DATA_HST_ENABLE, 1, 8, 0x0000 }, { CAT_CTE_DATA_IPF_ENABLE, 1, 4, 0x0000 },
+	{ CAT_CTE_DATA_MSK_ENABLE, 1, 7, 0x0000 }, { CAT_CTE_DATA_PDB_ENABLE, 1, 6, 0x0000 },
+	{ CAT_CTE_DATA_QSL_ENABLE, 1, 3, 0x0000 }, { CAT_CTE_DATA_SLC_ENABLE, 1, 5, 0x0000 },
+	{ CAT_CTE_DATA_TPE_ENABLE, 1, 10, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cts_ctrl_fields[] = {
+	{ CAT_CTS_CTRL_ADR, 9, 0, 0x0000 },
+	{ CAT_CTS_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_cts_data_fields[] = {
+	{ CAT_CTS_DATA_CAT_A, 6, 0, 0x0000 },
+	{ CAT_CTS_DATA_CAT_B, 6, 6, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_dct_ctrl_fields[] = {
+	{ CAT_DCT_CTRL_ADR, 13, 0, 0x0000 },
+	{ CAT_DCT_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_dct_data_fields[] = {
+	{ CAT_DCT_DATA_RES, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_dct_sel_fields[] = {
+	{ CAT_DCT_SEL_LU, 2, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_exo_ctrl_fields[] = {
+	{ CAT_EXO_CTRL_ADR, 2, 0, 0x0000 },
+	{ CAT_EXO_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_exo_data_fields[] = {
+	{ CAT_EXO_DATA_DYN, 5, 0, 0x0000 },
+	{ CAT_EXO_DATA_OFS, 11, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_fte0_ctrl_fields[] = {
+	{ CAT_FTE0_CTRL_ADR, 9, 0, 0x0000 },
+	{ CAT_FTE0_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_fte0_data_fields[] = {
+	{ CAT_FTE0_DATA_ENABLE, 8, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_fte1_ctrl_fields[] = {
+	{ CAT_FTE1_CTRL_ADR, 9, 0, 0x0000 },
+	{ CAT_FTE1_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_fte1_data_fields[] = {
+	{ CAT_FTE1_DATA_ENABLE, 8, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_join_fields[] = {
+	{ CAT_JOIN_J1, 2, 0, 0x0000 },
+	{ CAT_JOIN_J2, 1, 8, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kcc_ctrl_fields[] = {
+	{ CAT_KCC_CTRL_ADR, 11, 0, 0x0000 },
+	{ CAT_KCC_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kcc_data_fields[] = {
+	{ CAT_KCC_DATA_CATEGORY, 8, 64, 0x0000 },
+	{ CAT_KCC_DATA_ID, 12, 72, 0x0000 },
+	{ CAT_KCC_DATA_KEY, 64, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kce0_ctrl_fields[] = {
+	{ CAT_KCE0_CTRL_ADR, 3, 0, 0x0000 },
+	{ CAT_KCE0_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kce0_data_fields[] = {
+	{ CAT_KCE0_DATA_ENABLE, 8, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kce1_ctrl_fields[] = {
+	{ CAT_KCE1_CTRL_ADR, 3, 0, 0x0000 },
+	{ CAT_KCE1_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kce1_data_fields[] = {
+	{ CAT_KCE1_DATA_ENABLE, 8, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kcs0_ctrl_fields[] = {
+	{ CAT_KCS0_CTRL_ADR, 6, 0, 0x0000 },
+	{ CAT_KCS0_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kcs0_data_fields[] = {
+	{ CAT_KCS0_DATA_CATEGORY, 6, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kcs1_ctrl_fields[] = {
+	{ CAT_KCS1_CTRL_ADR, 6, 0, 0x0000 },
+	{ CAT_KCS1_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_kcs1_data_fields[] = {
+	{ CAT_KCS1_DATA_CATEGORY, 6, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_len_ctrl_fields[] = {
+	{ CAT_LEN_CTRL_ADR, 3, 0, 0x0000 },
+	{ CAT_LEN_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_len_data_fields[] = {
+	{ CAT_LEN_DATA_DYN1, 5, 28, 0x0000 }, { CAT_LEN_DATA_DYN2, 5, 33, 0x0000 },
+	{ CAT_LEN_DATA_INV, 1, 38, 0x0000 }, { CAT_LEN_DATA_LOWER, 14, 0, 0x0000 },
+	{ CAT_LEN_DATA_UPPER, 14, 14, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_rck_ctrl_fields[] = {
+	{ CAT_RCK_CTRL_ADR, 8, 0, 0x0000 },
+	{ CAT_RCK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cat_rck_data_fields[] = {
+	{ CAT_RCK_DATA_CM0U, 1, 1, 0x0000 }, { CAT_RCK_DATA_CM1U, 1, 5, 0x0000 },
+	{ CAT_RCK_DATA_CM2U, 1, 9, 0x0000 }, { CAT_RCK_DATA_CM3U, 1, 13, 0x0000 },
+	{ CAT_RCK_DATA_CM4U, 1, 17, 0x0000 }, { CAT_RCK_DATA_CM5U, 1, 21, 0x0000 },
+	{ CAT_RCK_DATA_CM6U, 1, 25, 0x0000 }, { CAT_RCK_DATA_CM7U, 1, 29, 0x0000 },
+	{ CAT_RCK_DATA_CML0, 1, 0, 0x0000 }, { CAT_RCK_DATA_CML1, 1, 4, 0x0000 },
+	{ CAT_RCK_DATA_CML2, 1, 8, 0x0000 }, { CAT_RCK_DATA_CML3, 1, 12, 0x0000 },
+	{ CAT_RCK_DATA_CML4, 1, 16, 0x0000 }, { CAT_RCK_DATA_CML5, 1, 20, 0x0000 },
+	{ CAT_RCK_DATA_CML6, 1, 24, 0x0000 }, { CAT_RCK_DATA_CML7, 1, 28, 0x0000 },
+	{ CAT_RCK_DATA_SEL0, 1, 2, 0x0000 }, { CAT_RCK_DATA_SEL1, 1, 6, 0x0000 },
+	{ CAT_RCK_DATA_SEL2, 1, 10, 0x0000 }, { CAT_RCK_DATA_SEL3, 1, 14, 0x0000 },
+	{ CAT_RCK_DATA_SEL4, 1, 18, 0x0000 }, { CAT_RCK_DATA_SEL5, 1, 22, 0x0000 },
+	{ CAT_RCK_DATA_SEL6, 1, 26, 0x0000 }, { CAT_RCK_DATA_SEL7, 1, 30, 0x0000 },
+	{ CAT_RCK_DATA_SEU0, 1, 3, 0x0000 }, { CAT_RCK_DATA_SEU1, 1, 7, 0x0000 },
+	{ CAT_RCK_DATA_SEU2, 1, 11, 0x0000 }, { CAT_RCK_DATA_SEU3, 1, 15, 0x0000 },
+	{ CAT_RCK_DATA_SEU4, 1, 19, 0x0000 }, { CAT_RCK_DATA_SEU5, 1, 23, 0x0000 },
+	{ CAT_RCK_DATA_SEU6, 1, 27, 0x0000 }, { CAT_RCK_DATA_SEU7, 1, 31, 0x0000 },
+};
+
+static nthw_fpga_register_init_s cat_registers[] = {
+	{ CAT_CCT_CTRL, 30, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cct_ctrl_fields },
+	{ CAT_CCT_DATA, 31, 36, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cct_data_fields },
+	{ CAT_CFN_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cfn_ctrl_fields },
+	{ CAT_CFN_DATA, 11, 179, NTHW_FPGA_REG_TYPE_WO, 0, 44, cat_cfn_data_fields },
+	{ CAT_COT_CTRL, 28, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cot_ctrl_fields },
+	{ CAT_COT_DATA, 29, 36, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cot_data_fields },
+	{ CAT_CTE_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cte_ctrl_fields },
+	{ CAT_CTE_DATA, 25, 11, NTHW_FPGA_REG_TYPE_WO, 0, 11, cat_cte_data_fields },
+	{ CAT_CTS_CTRL, 26, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cts_ctrl_fields },
+	{ CAT_CTS_DATA, 27, 12, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cts_data_fields },
+	{ CAT_DCT_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_dct_ctrl_fields },
+	{ CAT_DCT_DATA, 7, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_dct_data_fields },
+	{ CAT_DCT_SEL, 4, 2, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_dct_sel_fields },
+	{ CAT_EXO_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_exo_ctrl_fields },
+	{ CAT_EXO_DATA, 1, 27, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_exo_data_fields },
+	{ CAT_FTE0_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_fte0_ctrl_fields },
+	{ CAT_FTE0_DATA, 17, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_fte0_data_fields },
+	{ CAT_FTE1_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_fte1_ctrl_fields },
+	{ CAT_FTE1_DATA, 23, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_fte1_data_fields },
+	{ CAT_JOIN, 5, 9, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_join_fields },
+	{ CAT_KCC_CTRL, 32, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kcc_ctrl_fields },
+	{ CAT_KCC_DATA, 33, 84, NTHW_FPGA_REG_TYPE_WO, 0, 3, cat_kcc_data_fields },
+	{ CAT_KCE0_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kce0_ctrl_fields },
+	{ CAT_KCE0_DATA, 13, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kce0_data_fields },
+	{ CAT_KCE1_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kce1_ctrl_fields },
+	{ CAT_KCE1_DATA, 19, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kce1_data_fields },
+	{ CAT_KCS0_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kcs0_ctrl_fields },
+	{ CAT_KCS0_DATA, 15, 6, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kcs0_data_fields },
+	{ CAT_KCS1_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kcs1_ctrl_fields },
+	{ CAT_KCS1_DATA, 21, 6, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kcs1_data_fields },
+	{ CAT_LEN_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_len_ctrl_fields },
+	{ CAT_LEN_DATA, 9, 39, NTHW_FPGA_REG_TYPE_WO, 0, 5, cat_len_data_fields },
+	{ CAT_RCK_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_rck_ctrl_fields },
+	{ CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields },
+};
+
+static nthw_fpga_field_init_s cpy_packet_reader0_ctrl_fields[] = {
+	{ CPY_PACKET_READER0_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_PACKET_READER0_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_packet_reader0_data_fields[] = {
+	{ CPY_PACKET_READER0_DATA_DYN, 5, 10, 0x0000 },
+	{ CPY_PACKET_READER0_DATA_OFS, 10, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_ctrl_fields[] = {
+	{ CPY_WRITER0_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER0_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_data_fields[] = {
+	{ CPY_WRITER0_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER0_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER0_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER0_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER0_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_mask_ctrl_fields[] = {
+	{ CPY_WRITER0_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER0_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_mask_data_fields[] = {
+	{ CPY_WRITER0_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_ctrl_fields[] = {
+	{ CPY_WRITER1_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER1_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_data_fields[] = {
+	{ CPY_WRITER1_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER1_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER1_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER1_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER1_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_mask_ctrl_fields[] = {
+	{ CPY_WRITER1_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER1_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_mask_data_fields[] = {
+	{ CPY_WRITER1_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_ctrl_fields[] = {
+	{ CPY_WRITER2_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER2_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_data_fields[] = {
+	{ CPY_WRITER2_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER2_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER2_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER2_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER2_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_mask_ctrl_fields[] = {
+	{ CPY_WRITER2_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER2_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_mask_data_fields[] = {
+	{ CPY_WRITER2_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_ctrl_fields[] = {
+	{ CPY_WRITER3_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER3_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_data_fields[] = {
+	{ CPY_WRITER3_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER3_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER3_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER3_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER3_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_mask_ctrl_fields[] = {
+	{ CPY_WRITER3_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER3_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_mask_data_fields[] = {
+	{ CPY_WRITER3_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_ctrl_fields[] = {
+	{ CPY_WRITER4_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER4_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_data_fields[] = {
+	{ CPY_WRITER4_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER4_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER4_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER4_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER4_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_mask_ctrl_fields[] = {
+	{ CPY_WRITER4_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER4_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_mask_data_fields[] = {
+	{ CPY_WRITER4_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_ctrl_fields[] = {
+	{ CPY_WRITER5_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER5_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_data_fields[] = {
+	{ CPY_WRITER5_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER5_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER5_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER5_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER5_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_mask_ctrl_fields[] = {
+	{ CPY_WRITER5_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER5_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_mask_data_fields[] = {
+	{ CPY_WRITER5_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s cpy_registers[] = {
+	{
+		CPY_PACKET_READER0_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_packet_reader0_ctrl_fields
+	},
+	{
+		CPY_PACKET_READER0_DATA, 25, 15, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_packet_reader0_data_fields
+	},
+	{ CPY_WRITER0_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer0_ctrl_fields },
+	{ CPY_WRITER0_DATA, 1, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer0_data_fields },
+	{
+		CPY_WRITER0_MASK_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer0_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER0_MASK_DATA, 3, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer0_mask_data_fields
+	},
+	{ CPY_WRITER1_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer1_ctrl_fields },
+	{ CPY_WRITER1_DATA, 5, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer1_data_fields },
+	{
+		CPY_WRITER1_MASK_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer1_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER1_MASK_DATA, 7, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer1_mask_data_fields
+	},
+	{ CPY_WRITER2_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer2_ctrl_fields },
+	{ CPY_WRITER2_DATA, 9, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer2_data_fields },
+	{
+		CPY_WRITER2_MASK_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer2_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER2_MASK_DATA, 11, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer2_mask_data_fields
+	},
+	{ CPY_WRITER3_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer3_ctrl_fields },
+	{ CPY_WRITER3_DATA, 13, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer3_data_fields },
+	{
+		CPY_WRITER3_MASK_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer3_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER3_MASK_DATA, 15, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer3_mask_data_fields
+	},
+	{ CPY_WRITER4_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer4_ctrl_fields },
+	{ CPY_WRITER4_DATA, 17, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer4_data_fields },
+	{
+		CPY_WRITER4_MASK_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer4_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER4_MASK_DATA, 19, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer4_mask_data_fields
+	},
+	{ CPY_WRITER5_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer5_ctrl_fields },
+	{ CPY_WRITER5_DATA, 21, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer5_data_fields },
+	{
+		CPY_WRITER5_MASK_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer5_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER5_MASK_DATA, 23, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer5_mask_data_fields
+	},
+};
+
+static nthw_fpga_field_init_s csu_rcp_ctrl_fields[] = {
+	{ CSU_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ CSU_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s csu_rcp_data_fields[] = {
+	{ CSU_RCP_DATA_IL3_CMD, 2, 5, 0x0000 },
+	{ CSU_RCP_DATA_IL4_CMD, 3, 7, 0x0000 },
+	{ CSU_RCP_DATA_OL3_CMD, 2, 0, 0x0000 },
+	{ CSU_RCP_DATA_OL4_CMD, 3, 2, 0x0000 },
+};
+
+static nthw_fpga_register_init_s csu_registers[] = {
+	{ CSU_RCP_CTRL, 1, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, csu_rcp_ctrl_fields },
+	{ CSU_RCP_DATA, 2, 10, NTHW_FPGA_REG_TYPE_WO, 0, 4, csu_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = {
+	{ DBS_RX_AM_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_RX_AM_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_am_data_fields[] = {
+	{ DBS_RX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_RX_AM_DATA_GPA, 64, 0, 0x0000 },
+	{ DBS_RX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_AM_DATA_INT, 1, 74, 0x0000 },
+	{ DBS_RX_AM_DATA_PCKED, 1, 73, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_control_fields[] = {
+	{ DBS_RX_CONTROL_AME, 1, 7, 0 }, { DBS_RX_CONTROL_AMS, 4, 8, 8 },
+	{ DBS_RX_CONTROL_LQ, 7, 0, 0 }, { DBS_RX_CONTROL_QE, 1, 17, 0 },
+	{ DBS_RX_CONTROL_UWE, 1, 12, 0 }, { DBS_RX_CONTROL_UWS, 4, 13, 5 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_dr_ctrl_fields[] = {
+	{ DBS_RX_DR_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_RX_DR_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_dr_data_fields[] = {
+	{ DBS_RX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_DR_DATA_HDR, 1, 88, 0x0000 },
+	{ DBS_RX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_DR_DATA_PCKED, 1, 87, 0x0000 },
+	{ DBS_RX_DR_DATA_QS, 15, 72, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_idle_fields[] = {
+	{ DBS_RX_IDLE_BUSY, 1, 8, 0 },
+	{ DBS_RX_IDLE_IDLE, 1, 0, 0x0000 },
+	{ DBS_RX_IDLE_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_init_fields[] = {
+	{ DBS_RX_INIT_BUSY, 1, 8, 0 },
+	{ DBS_RX_INIT_INIT, 1, 0, 0x0000 },
+	{ DBS_RX_INIT_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_init_val_fields[] = {
+	{ DBS_RX_INIT_VAL_IDX, 16, 0, 0x0000 },
+	{ DBS_RX_INIT_VAL_PTR, 15, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_ptr_fields[] = {
+	{ DBS_RX_PTR_PTR, 16, 0, 0x0000 },
+	{ DBS_RX_PTR_QUEUE, 7, 16, 0x0000 },
+	{ DBS_RX_PTR_VALID, 1, 23, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_uw_ctrl_fields[] = {
+	{ DBS_RX_UW_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_RX_UW_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_uw_data_fields[] = {
+	{ DBS_RX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_UW_DATA_HID, 8, 64, 0x0000 },
+	{ DBS_RX_UW_DATA_INT, 1, 88, 0x0000 }, { DBS_RX_UW_DATA_ISTK, 1, 92, 0x0000 },
+	{ DBS_RX_UW_DATA_PCKED, 1, 87, 0x0000 }, { DBS_RX_UW_DATA_QS, 15, 72, 0x0000 },
+	{ DBS_RX_UW_DATA_VEC, 3, 89, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_am_ctrl_fields[] = {
+	{ DBS_TX_AM_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_AM_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_am_data_fields[] = {
+	{ DBS_TX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_TX_AM_DATA_GPA, 64, 0, 0x0000 },
+	{ DBS_TX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_AM_DATA_INT, 1, 74, 0x0000 },
+	{ DBS_TX_AM_DATA_PCKED, 1, 73, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_control_fields[] = {
+	{ DBS_TX_CONTROL_AME, 1, 7, 0 }, { DBS_TX_CONTROL_AMS, 4, 8, 5 },
+	{ DBS_TX_CONTROL_LQ, 7, 0, 0 }, { DBS_TX_CONTROL_QE, 1, 17, 0 },
+	{ DBS_TX_CONTROL_UWE, 1, 12, 0 }, { DBS_TX_CONTROL_UWS, 4, 13, 8 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_dr_ctrl_fields[] = {
+	{ DBS_TX_DR_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_DR_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_dr_data_fields[] = {
+	{ DBS_TX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_DR_DATA_HDR, 1, 88, 0x0000 },
+	{ DBS_TX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_DR_DATA_PCKED, 1, 87, 0x0000 },
+	{ DBS_TX_DR_DATA_PORT, 1, 89, 0x0000 }, { DBS_TX_DR_DATA_QS, 15, 72, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_idle_fields[] = {
+	{ DBS_TX_IDLE_BUSY, 1, 8, 0 },
+	{ DBS_TX_IDLE_IDLE, 1, 0, 0x0000 },
+	{ DBS_TX_IDLE_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_init_fields[] = {
+	{ DBS_TX_INIT_BUSY, 1, 8, 0 },
+	{ DBS_TX_INIT_INIT, 1, 0, 0x0000 },
+	{ DBS_TX_INIT_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_init_val_fields[] = {
+	{ DBS_TX_INIT_VAL_IDX, 16, 0, 0x0000 },
+	{ DBS_TX_INIT_VAL_PTR, 15, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_ptr_fields[] = {
+	{ DBS_TX_PTR_PTR, 16, 0, 0x0000 },
+	{ DBS_TX_PTR_QUEUE, 7, 16, 0x0000 },
+	{ DBS_TX_PTR_VALID, 1, 23, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qos_ctrl_fields[] = {
+	{ DBS_TX_QOS_CTRL_ADR, 1, 0, 0x0000 },
+	{ DBS_TX_QOS_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qos_data_fields[] = {
+	{ DBS_TX_QOS_DATA_BS, 27, 17, 0x0000 },
+	{ DBS_TX_QOS_DATA_EN, 1, 0, 0x0000 },
+	{ DBS_TX_QOS_DATA_IR, 16, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qos_rate_fields[] = {
+	{ DBS_TX_QOS_RATE_DIV, 19, 16, 2 },
+	{ DBS_TX_QOS_RATE_MUL, 16, 0, 1 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qp_ctrl_fields[] = {
+	{ DBS_TX_QP_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_QP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qp_data_fields[] = {
+	{ DBS_TX_QP_DATA_VPORT, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_uw_ctrl_fields[] = {
+	{ DBS_TX_UW_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_UW_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_uw_data_fields[] = {
+	{ DBS_TX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_UW_DATA_HID, 8, 64, 0x0000 },
+	{ DBS_TX_UW_DATA_INO, 1, 93, 0x0000 }, { DBS_TX_UW_DATA_INT, 1, 88, 0x0000 },
+	{ DBS_TX_UW_DATA_ISTK, 1, 92, 0x0000 }, { DBS_TX_UW_DATA_PCKED, 1, 87, 0x0000 },
+	{ DBS_TX_UW_DATA_QS, 15, 72, 0x0000 }, { DBS_TX_UW_DATA_VEC, 3, 89, 0x0000 },
+};
+
+static nthw_fpga_register_init_s dbs_registers[] = {
+	{ DBS_RX_AM_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_am_ctrl_fields },
+	{ DBS_RX_AM_DATA, 11, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_am_data_fields },
+	{ DBS_RX_CONTROL, 0, 18, NTHW_FPGA_REG_TYPE_RW, 43008, 6, dbs_rx_control_fields },
+	{ DBS_RX_DR_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_dr_ctrl_fields },
+	{ DBS_RX_DR_DATA, 19, 89, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_dr_data_fields },
+	{ DBS_RX_IDLE, 8, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_idle_fields },
+	{ DBS_RX_INIT, 2, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_init_fields },
+	{ DBS_RX_INIT_VAL, 3, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_init_val_fields },
+	{ DBS_RX_PTR, 4, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_ptr_fields },
+	{ DBS_RX_UW_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_uw_ctrl_fields },
+	{ DBS_RX_UW_DATA, 15, 93, NTHW_FPGA_REG_TYPE_WO, 0, 7, dbs_rx_uw_data_fields },
+	{ DBS_TX_AM_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_am_ctrl_fields },
+	{ DBS_TX_AM_DATA, 13, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_tx_am_data_fields },
+	{ DBS_TX_CONTROL, 1, 18, NTHW_FPGA_REG_TYPE_RW, 66816, 6, dbs_tx_control_fields },
+	{ DBS_TX_DR_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_dr_ctrl_fields },
+	{ DBS_TX_DR_DATA, 21, 90, NTHW_FPGA_REG_TYPE_WO, 0, 6, dbs_tx_dr_data_fields },
+	{ DBS_TX_IDLE, 9, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_idle_fields },
+	{ DBS_TX_INIT, 5, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_init_fields },
+	{ DBS_TX_INIT_VAL, 6, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_init_val_fields },
+	{ DBS_TX_PTR, 7, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_ptr_fields },
+	{ DBS_TX_QOS_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qos_ctrl_fields },
+	{ DBS_TX_QOS_DATA, 25, 44, NTHW_FPGA_REG_TYPE_WO, 0, 3, dbs_tx_qos_data_fields },
+	{ DBS_TX_QOS_RATE, 26, 35, NTHW_FPGA_REG_TYPE_RW, 131073, 2, dbs_tx_qos_rate_fields },
+	{ DBS_TX_QP_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qp_ctrl_fields },
+	{ DBS_TX_QP_DATA, 23, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, dbs_tx_qp_data_fields },
+	{ DBS_TX_UW_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_uw_ctrl_fields },
+	{ DBS_TX_UW_DATA, 17, 94, NTHW_FPGA_REG_TYPE_WO, 0, 8, dbs_tx_uw_data_fields },
+};
+
+static nthw_fpga_field_init_s flm_buf_ctrl_fields[] = {
+	{ FLM_BUF_CTRL_INF_AVAIL, 16, 16, 0x0000 },
+	{ FLM_BUF_CTRL_LRN_FREE, 16, 0, 0x0000 },
+	{ FLM_BUF_CTRL_STA_AVAIL, 16, 32, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_control_fields[] = {
+	{ FLM_CONTROL_CRCRD, 1, 12, 0x0000 }, { FLM_CONTROL_CRCWR, 1, 11, 0x0000 },
+	{ FLM_CONTROL_EAB, 5, 18, 0 }, { FLM_CONTROL_ENABLE, 1, 0, 0 },
+	{ FLM_CONTROL_INIT, 1, 1, 0x0000 }, { FLM_CONTROL_LDS, 1, 2, 0x0000 },
+	{ FLM_CONTROL_LFS, 1, 3, 0x0000 }, { FLM_CONTROL_LIS, 1, 4, 0x0000 },
+	{ FLM_CONTROL_PDS, 1, 9, 0x0000 }, { FLM_CONTROL_PIS, 1, 10, 0x0000 },
+	{ FLM_CONTROL_RBL, 4, 13, 0 }, { FLM_CONTROL_RDS, 1, 7, 0x0000 },
+	{ FLM_CONTROL_RIS, 1, 8, 0x0000 }, { FLM_CONTROL_SPLIT_SDRAM_USAGE, 5, 23, 16 },
+	{ FLM_CONTROL_UDS, 1, 5, 0x0000 }, { FLM_CONTROL_UIS, 1, 6, 0x0000 },
+	{ FLM_CONTROL_WPD, 1, 17, 0 },
+};
+
+static nthw_fpga_field_init_s flm_inf_data_fields[] = {
+	{ FLM_INF_DATA_BYTES, 64, 0, 0x0000 }, { FLM_INF_DATA_CAUSE, 3, 264, 0x0000 },
+	{ FLM_INF_DATA_EOR, 1, 287, 0x0000 }, { FLM_INF_DATA_ID, 72, 192, 0x0000 },
+	{ FLM_INF_DATA_PACKETS, 64, 64, 0x0000 }, { FLM_INF_DATA_TS, 64, 128, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_load_aps_fields[] = {
+	{ FLM_LOAD_APS_APS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_load_bin_fields[] = {
+	{ FLM_LOAD_BIN_BIN, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_load_lps_fields[] = {
+	{ FLM_LOAD_LPS_LPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_lrn_data_fields[] = {
+	{ FLM_LRN_DATA_ADJ, 32, 480, 0x0000 }, { FLM_LRN_DATA_COLOR, 32, 448, 0x0000 },
+	{ FLM_LRN_DATA_DSCP, 6, 734, 0x0000 }, { FLM_LRN_DATA_ENT, 1, 729, 0x0000 },
+	{ FLM_LRN_DATA_EOR, 1, 767, 0x0000 }, { FLM_LRN_DATA_FILL, 12, 584, 0x0000 },
+	{ FLM_LRN_DATA_FT, 4, 596, 0x0000 }, { FLM_LRN_DATA_FT_MBR, 4, 600, 0x0000 },
+	{ FLM_LRN_DATA_FT_MISS, 4, 604, 0x0000 }, { FLM_LRN_DATA_ID, 72, 512, 0x0000 },
+	{ FLM_LRN_DATA_KID, 8, 328, 0x0000 }, { FLM_LRN_DATA_MBR_ID1, 28, 608, 0x0000 },
+	{ FLM_LRN_DATA_MBR_ID2, 28, 636, 0x0000 }, { FLM_LRN_DATA_MBR_ID3, 28, 664, 0x0000 },
+	{ FLM_LRN_DATA_MBR_ID4, 28, 692, 0x0000 }, { FLM_LRN_DATA_NAT_EN, 1, 747, 0x0000 },
+	{ FLM_LRN_DATA_NAT_IP, 32, 336, 0x0000 }, { FLM_LRN_DATA_NAT_PORT, 16, 400, 0x0000 },
+	{ FLM_LRN_DATA_NOFI, 1, 752, 0x0000 }, { FLM_LRN_DATA_OP, 4, 730, 0x0000 },
+	{ FLM_LRN_DATA_PRIO, 2, 727, 0x0000 }, { FLM_LRN_DATA_PROT, 8, 320, 0x0000 },
+	{ FLM_LRN_DATA_QFI, 6, 740, 0x0000 }, { FLM_LRN_DATA_QW0, 128, 192, 0x0000 },
+	{ FLM_LRN_DATA_QW4, 128, 64, 0x0000 }, { FLM_LRN_DATA_RATE, 16, 416, 0x0000 },
+	{ FLM_LRN_DATA_RQI, 1, 746, 0x0000 }, { FLM_LRN_DATA_SCRUB_PROF, 4, 748, 0x0000 },
+	{ FLM_LRN_DATA_SIZE, 16, 432, 0x0000 }, { FLM_LRN_DATA_STAT_PROF, 4, 723, 0x0000 },
+	{ FLM_LRN_DATA_SW8, 32, 32, 0x0000 }, { FLM_LRN_DATA_SW9, 32, 0, 0x0000 },
+	{ FLM_LRN_DATA_TEID, 32, 368, 0x0000 }, { FLM_LRN_DATA_VOL_IDX, 3, 720, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_prio_fields[] = {
+	{ FLM_PRIO_FT0, 4, 4, 1 }, { FLM_PRIO_FT1, 4, 12, 1 }, { FLM_PRIO_FT2, 4, 20, 1 },
+	{ FLM_PRIO_FT3, 4, 28, 1 }, { FLM_PRIO_LIMIT0, 4, 0, 0 }, { FLM_PRIO_LIMIT1, 4, 8, 0 },
+	{ FLM_PRIO_LIMIT2, 4, 16, 0 }, { FLM_PRIO_LIMIT3, 4, 24, 0 },
+};
+
+static nthw_fpga_field_init_s flm_pst_ctrl_fields[] = {
+	{ FLM_PST_CTRL_ADR, 4, 0, 0x0000 },
+	{ FLM_PST_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_pst_data_fields[] = {
+	{ FLM_PST_DATA_BP, 5, 0, 0x0000 },
+	{ FLM_PST_DATA_PP, 5, 5, 0x0000 },
+	{ FLM_PST_DATA_TP, 5, 10, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_rcp_ctrl_fields[] = {
+	{ FLM_RCP_CTRL_ADR, 5, 0, 0x0000 },
+	{ FLM_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_rcp_data_fields[] = {
+	{ FLM_RCP_DATA_AUTO_IPV4_MASK, 1, 402, 0x0000 },
+	{ FLM_RCP_DATA_BYT_DYN, 5, 387, 0x0000 },
+	{ FLM_RCP_DATA_BYT_OFS, 8, 392, 0x0000 },
+	{ FLM_RCP_DATA_IPN, 1, 386, 0x0000 },
+	{ FLM_RCP_DATA_KID, 8, 377, 0x0000 },
+	{ FLM_RCP_DATA_LOOKUP, 1, 0, 0x0000 },
+	{ FLM_RCP_DATA_MASK, 320, 57, 0x0000 },
+	{ FLM_RCP_DATA_OPN, 1, 385, 0x0000 },
+	{ FLM_RCP_DATA_QW0_DYN, 5, 1, 0x0000 },
+	{ FLM_RCP_DATA_QW0_OFS, 8, 6, 0x0000 },
+	{ FLM_RCP_DATA_QW0_SEL, 2, 14, 0x0000 },
+	{ FLM_RCP_DATA_QW4_DYN, 5, 16, 0x0000 },
+	{ FLM_RCP_DATA_QW4_OFS, 8, 21, 0x0000 },
+	{ FLM_RCP_DATA_SW8_DYN, 5, 29, 0x0000 },
+	{ FLM_RCP_DATA_SW8_OFS, 8, 34, 0x0000 },
+	{ FLM_RCP_DATA_SW8_SEL, 2, 42, 0x0000 },
+	{ FLM_RCP_DATA_SW9_DYN, 5, 44, 0x0000 },
+	{ FLM_RCP_DATA_SW9_OFS, 8, 49, 0x0000 },
+	{ FLM_RCP_DATA_TXPLM, 2, 400, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_scan_fields[] = {
+	{ FLM_SCAN_I, 16, 0, 0 },
+};
+
+static nthw_fpga_field_init_s flm_scrub_ctrl_fields[] = {
+	{ FLM_SCRUB_CTRL_ADR, 4, 0, 0x0000 },
+	{ FLM_SCRUB_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_scrub_data_fields[] = {
+	{ FLM_SCRUB_DATA_T, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s flm_status_fields[] = {
+	{ FLM_STATUS_CALIBDONE, 1, 0, 0x0000 }, { FLM_STATUS_CRCERR, 1, 5, 0x0000 },
+	{ FLM_STATUS_CRITICAL, 1, 3, 0x0000 }, { FLM_STATUS_EFT_BP, 1, 6, 0x0000 },
+	{ FLM_STATUS_IDLE, 1, 2, 0x0000 }, { FLM_STATUS_INITDONE, 1, 1, 0x0000 },
+	{ FLM_STATUS_PANIC, 1, 4, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_aul_done_fields[] = {
+	{ FLM_STAT_AUL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_aul_fail_fields[] = {
+	{ FLM_STAT_AUL_FAIL_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_aul_ignore_fields[] = {
+	{ FLM_STAT_AUL_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_csh_hit_fields[] = {
+	{ FLM_STAT_CSH_HIT_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_csh_miss_fields[] = {
+	{ FLM_STAT_CSH_MISS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_csh_unh_fields[] = {
+	{ FLM_STAT_CSH_UNH_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_cuc_move_fields[] = {
+	{ FLM_STAT_CUC_MOVE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_cuc_start_fields[] = {
+	{ FLM_STAT_CUC_START_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_flows_fields[] = {
+	{ FLM_STAT_FLOWS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_inf_done_fields[] = {
+	{ FLM_STAT_INF_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_inf_skip_fields[] = {
+	{ FLM_STAT_INF_SKIP_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_lrn_done_fields[] = {
+	{ FLM_STAT_LRN_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_lrn_fail_fields[] = {
+	{ FLM_STAT_LRN_FAIL_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_lrn_ignore_fields[] = {
+	{ FLM_STAT_LRN_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_dis_fields[] = {
+	{ FLM_STAT_PCK_DIS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_hit_fields[] = {
+	{ FLM_STAT_PCK_HIT_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_miss_fields[] = {
+	{ FLM_STAT_PCK_MISS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_unh_fields[] = {
+	{ FLM_STAT_PCK_UNH_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_prb_done_fields[] = {
+	{ FLM_STAT_PRB_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_prb_ignore_fields[] = {
+	{ FLM_STAT_PRB_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_rel_done_fields[] = {
+	{ FLM_STAT_REL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_rel_ignore_fields[] = {
+	{ FLM_STAT_REL_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_sta_done_fields[] = {
+	{ FLM_STAT_STA_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_tul_done_fields[] = {
+	{ FLM_STAT_TUL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_unl_done_fields[] = {
+	{ FLM_STAT_UNL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_unl_ignore_fields[] = {
+	{ FLM_STAT_UNL_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_sta_data_fields[] = {
+	{ FLM_STA_DATA_EOR, 1, 95, 0x0000 }, { FLM_STA_DATA_ID, 72, 0, 0x0000 },
+	{ FLM_STA_DATA_LDS, 1, 72, 0x0000 }, { FLM_STA_DATA_LFS, 1, 73, 0x0000 },
+	{ FLM_STA_DATA_LIS, 1, 74, 0x0000 }, { FLM_STA_DATA_PDS, 1, 79, 0x0000 },
+	{ FLM_STA_DATA_PIS, 1, 80, 0x0000 }, { FLM_STA_DATA_RDS, 1, 77, 0x0000 },
+	{ FLM_STA_DATA_RIS, 1, 78, 0x0000 }, { FLM_STA_DATA_UDS, 1, 75, 0x0000 },
+	{ FLM_STA_DATA_UIS, 1, 76, 0x0000 },
+};
+
+static nthw_fpga_register_init_s flm_registers[] = {
+	{ FLM_BUF_CTRL, 14, 48, NTHW_FPGA_REG_TYPE_RW, 0, 3, flm_buf_ctrl_fields },
+	{ FLM_CONTROL, 0, 28, NTHW_FPGA_REG_TYPE_MIXED, 134217728, 17, flm_control_fields },
+	{ FLM_INF_DATA, 16, 288, NTHW_FPGA_REG_TYPE_RO, 0, 6, flm_inf_data_fields },
+	{ FLM_LOAD_APS, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_load_aps_fields },
+	{ FLM_LOAD_BIN, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, flm_load_bin_fields },
+	{ FLM_LOAD_LPS, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_load_lps_fields },
+	{ FLM_LRN_DATA, 15, 768, NTHW_FPGA_REG_TYPE_WO, 0, 34, flm_lrn_data_fields },
+	{ FLM_PRIO, 6, 32, NTHW_FPGA_REG_TYPE_WO, 269488144, 8, flm_prio_fields },
+	{ FLM_PST_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_pst_ctrl_fields },
+	{ FLM_PST_DATA, 13, 15, NTHW_FPGA_REG_TYPE_WO, 0, 3, flm_pst_data_fields },
+	{ FLM_RCP_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_rcp_ctrl_fields },
+	{ FLM_RCP_DATA, 9, 403, NTHW_FPGA_REG_TYPE_WO, 0, 19, flm_rcp_data_fields },
+	{ FLM_SCAN, 2, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, flm_scan_fields },
+	{ FLM_SCRUB_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_scrub_ctrl_fields },
+	{ FLM_SCRUB_DATA, 11, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, flm_scrub_data_fields },
+	{ FLM_STATUS, 1, 12, NTHW_FPGA_REG_TYPE_MIXED, 0, 7, flm_status_fields },
+	{ FLM_STAT_AUL_DONE, 41, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_done_fields },
+	{ FLM_STAT_AUL_FAIL, 43, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_fail_fields },
+	{ FLM_STAT_AUL_IGNORE, 42, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_ignore_fields },
+	{ FLM_STAT_CSH_HIT, 52, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_csh_hit_fields },
+	{ FLM_STAT_CSH_MISS, 53, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_csh_miss_fields },
+	{ FLM_STAT_CSH_UNH, 54, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_csh_unh_fields },
+	{ FLM_STAT_CUC_MOVE, 56, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_cuc_move_fields },
+	{ FLM_STAT_CUC_START, 55, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_cuc_start_fields },
+	{ FLM_STAT_FLOWS, 18, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_flows_fields },
+	{ FLM_STAT_INF_DONE, 46, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_inf_done_fields },
+	{ FLM_STAT_INF_SKIP, 47, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_inf_skip_fields },
+	{ FLM_STAT_LRN_DONE, 32, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_lrn_done_fields },
+	{ FLM_STAT_LRN_FAIL, 34, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_lrn_fail_fields },
+	{ FLM_STAT_LRN_IGNORE, 33, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_lrn_ignore_fields },
+	{ FLM_STAT_PCK_DIS, 51, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_dis_fields },
+	{ FLM_STAT_PCK_HIT, 48, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_hit_fields },
+	{ FLM_STAT_PCK_MISS, 49, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_miss_fields },
+	{ FLM_STAT_PCK_UNH, 50, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_unh_fields },
+	{ FLM_STAT_PRB_DONE, 39, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_prb_done_fields },
+	{ FLM_STAT_PRB_IGNORE, 40, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_prb_ignore_fields },
+	{ FLM_STAT_REL_DONE, 37, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_rel_done_fields },
+	{ FLM_STAT_REL_IGNORE, 38, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_rel_ignore_fields },
+	{ FLM_STAT_STA_DONE, 45, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_sta_done_fields },
+	{ FLM_STAT_TUL_DONE, 44, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_tul_done_fields },
+	{ FLM_STAT_UNL_DONE, 35, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_unl_done_fields },
+	{ FLM_STAT_UNL_IGNORE, 36, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_unl_ignore_fields },
+	{ FLM_STA_DATA, 17, 96, NTHW_FPGA_REG_TYPE_RO, 0, 11, flm_sta_data_fields },
+};
+
+static nthw_fpga_field_init_s gfg_burstsize0_fields[] = {
+	{ GFG_BURSTSIZE0_VAL, 24, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gfg_burstsize1_fields[] = {
+	{ GFG_BURSTSIZE1_VAL, 24, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gfg_ctrl0_fields[] = {
+	{ GFG_CTRL0_ENABLE, 1, 0, 0 },
+	{ GFG_CTRL0_MODE, 3, 1, 0 },
+	{ GFG_CTRL0_PRBS_EN, 1, 4, 0 },
+	{ GFG_CTRL0_SIZE, 14, 16, 64 },
+};
+
+static nthw_fpga_field_init_s gfg_ctrl1_fields[] = {
+	{ GFG_CTRL1_ENABLE, 1, 0, 0 },
+	{ GFG_CTRL1_MODE, 3, 1, 0 },
+	{ GFG_CTRL1_PRBS_EN, 1, 4, 0 },
+	{ GFG_CTRL1_SIZE, 14, 16, 64 },
+};
+
+static nthw_fpga_field_init_s gfg_run0_fields[] = {
+	{ GFG_RUN0_RUN, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gfg_run1_fields[] = {
+	{ GFG_RUN1_RUN, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gfg_sizemask0_fields[] = {
+	{ GFG_SIZEMASK0_VAL, 14, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gfg_sizemask1_fields[] = {
+	{ GFG_SIZEMASK1_VAL, 14, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gfg_streamid0_fields[] = {
+	{ GFG_STREAMID0_VAL, 8, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gfg_streamid1_fields[] = {
+	{ GFG_STREAMID1_VAL, 8, 0, 1 },
+};
+
+static nthw_fpga_register_init_s gfg_registers[] = {
+	{ GFG_BURSTSIZE0, 3, 24, NTHW_FPGA_REG_TYPE_WO, 0, 1, gfg_burstsize0_fields },
+	{ GFG_BURSTSIZE1, 8, 24, NTHW_FPGA_REG_TYPE_WO, 0, 1, gfg_burstsize1_fields },
+	{ GFG_CTRL0, 0, 30, NTHW_FPGA_REG_TYPE_WO, 4194304, 4, gfg_ctrl0_fields },
+	{ GFG_CTRL1, 5, 30, NTHW_FPGA_REG_TYPE_WO, 4194304, 4, gfg_ctrl1_fields },
+	{ GFG_RUN0, 1, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, gfg_run0_fields },
+	{ GFG_RUN1, 6, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, gfg_run1_fields },
+	{ GFG_SIZEMASK0, 4, 14, NTHW_FPGA_REG_TYPE_WO, 0, 1, gfg_sizemask0_fields },
+	{ GFG_SIZEMASK1, 9, 14, NTHW_FPGA_REG_TYPE_WO, 0, 1, gfg_sizemask1_fields },
+	{ GFG_STREAMID0, 2, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, gfg_streamid0_fields },
+	{ GFG_STREAMID1, 7, 8, NTHW_FPGA_REG_TYPE_WO, 1, 1, gfg_streamid1_fields },
+};
+
+static nthw_fpga_field_init_s gmf_ctrl_fields[] = {
+	{ GMF_CTRL_ENABLE, 1, 0, 0 },
+	{ GMF_CTRL_FCS_ALWAYS, 1, 1, 0 },
+	{ GMF_CTRL_IFG_AUTO_ADJUST_ENABLE, 1, 7, 0 },
+	{ GMF_CTRL_IFG_ENABLE, 1, 2, 0 },
+	{ GMF_CTRL_IFG_TX_NOW_ALWAYS, 1, 3, 0 },
+	{ GMF_CTRL_IFG_TX_NOW_ON_TS_ENABLE, 1, 5, 0 },
+	{ GMF_CTRL_IFG_TX_ON_TS_ADJUST_ON_SET_CLOCK, 1, 6, 0 },
+	{ GMF_CTRL_IFG_TX_ON_TS_ALWAYS, 1, 4, 0 },
+	{ GMF_CTRL_TS_INJECT_ALWAYS, 1, 8, 0 },
+	{ GMF_CTRL_TS_INJECT_DUAL_STEP, 1, 9, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_debug_lane_marker_fields[] = {
+	{ GMF_DEBUG_LANE_MARKER_COMPENSATION, 16, 0, 16384 },
+};
+
+static nthw_fpga_field_init_s gmf_ifg_max_adjust_slack_fields[] = {
+	{ GMF_IFG_MAX_ADJUST_SLACK_SLACK, 64, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_ifg_set_clock_delta_fields[] = {
+	{ GMF_IFG_SET_CLOCK_DELTA_DELTA, 64, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_ifg_set_clock_delta_adjust_fields[] = {
+	{ GMF_IFG_SET_CLOCK_DELTA_ADJUST_DELTA, 64, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_ifg_tx_now_on_ts_fields[] = {
+	{ GMF_IFG_TX_NOW_ON_TS_TS, 64, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_speed_fields[] = {
+	{ GMF_SPEED_IFG_SPEED, 64, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_stat_data_buffer_fields[] = {
+	{ GMF_STAT_DATA_BUFFER_USED, 15, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s gmf_stat_max_delayed_pkt_fields[] = {
+	{ GMF_STAT_MAX_DELAYED_PKT_NS, 64, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_stat_next_pkt_fields[] = {
+	{ GMF_STAT_NEXT_PKT_NS, 64, 0, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_stat_sticky_fields[] = {
+	{ GMF_STAT_STICKY_DATA_UNDERFLOWED, 1, 0, 0 },
+	{ GMF_STAT_STICKY_IFG_ADJUSTED, 1, 1, 0 },
+};
+
+static nthw_fpga_field_init_s gmf_ts_inject_fields[] = {
+	{ GMF_TS_INJECT_OFFSET, 14, 0, 0 },
+	{ GMF_TS_INJECT_POS, 2, 14, 0 },
+};
+
+static nthw_fpga_register_init_s gmf_registers[] = {
+	{ GMF_CTRL, 0, 10, NTHW_FPGA_REG_TYPE_WO, 0, 10, gmf_ctrl_fields },
+	{
+		GMF_DEBUG_LANE_MARKER, 7, 16, NTHW_FPGA_REG_TYPE_WO, 16384, 1,
+		gmf_debug_lane_marker_fields
+	},
+	{
+		GMF_IFG_MAX_ADJUST_SLACK, 4, 64, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		gmf_ifg_max_adjust_slack_fields
+	},
+	{
+		GMF_IFG_SET_CLOCK_DELTA, 2, 64, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		gmf_ifg_set_clock_delta_fields
+	},
+	{
+		GMF_IFG_SET_CLOCK_DELTA_ADJUST, 3, 64, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		gmf_ifg_set_clock_delta_adjust_fields
+	},
+	{ GMF_IFG_TX_NOW_ON_TS, 5, 64, NTHW_FPGA_REG_TYPE_WO, 0, 1, gmf_ifg_tx_now_on_ts_fields },
+	{ GMF_SPEED, 1, 64, NTHW_FPGA_REG_TYPE_WO, 0, 1, gmf_speed_fields },
+	{ GMF_STAT_DATA_BUFFER, 9, 15, NTHW_FPGA_REG_TYPE_RO, 0, 1, gmf_stat_data_buffer_fields },
+	{
+		GMF_STAT_MAX_DELAYED_PKT, 11, 64, NTHW_FPGA_REG_TYPE_RC1, 0, 1,
+		gmf_stat_max_delayed_pkt_fields
+	},
+	{ GMF_STAT_NEXT_PKT, 10, 64, NTHW_FPGA_REG_TYPE_RO, 0, 1, gmf_stat_next_pkt_fields },
+	{ GMF_STAT_STICKY, 8, 2, NTHW_FPGA_REG_TYPE_RC1, 0, 2, gmf_stat_sticky_fields },
+	{ GMF_TS_INJECT, 6, 16, NTHW_FPGA_REG_TYPE_WO, 0, 2, gmf_ts_inject_fields },
+};
+
+static nthw_fpga_field_init_s gpio_phy_cfg_fields[] = {
+	{ GPIO_PHY_CFG_E_PORT0_RXLOS, 1, 8, 0 }, { GPIO_PHY_CFG_E_PORT1_RXLOS, 1, 9, 0 },
+	{ GPIO_PHY_CFG_PORT0_INT_B, 1, 1, 1 }, { GPIO_PHY_CFG_PORT0_LPMODE, 1, 0, 0 },
+	{ GPIO_PHY_CFG_PORT0_MODPRS_B, 1, 3, 1 }, { GPIO_PHY_CFG_PORT0_RESET_B, 1, 2, 0 },
+	{ GPIO_PHY_CFG_PORT1_INT_B, 1, 5, 1 }, { GPIO_PHY_CFG_PORT1_LPMODE, 1, 4, 0 },
+	{ GPIO_PHY_CFG_PORT1_MODPRS_B, 1, 7, 1 }, { GPIO_PHY_CFG_PORT1_RESET_B, 1, 6, 0 },
+};
+
+static nthw_fpga_field_init_s gpio_phy_gpio_fields[] = {
+	{ GPIO_PHY_GPIO_E_PORT0_RXLOS, 1, 8, 0 }, { GPIO_PHY_GPIO_E_PORT1_RXLOS, 1, 9, 0 },
+	{ GPIO_PHY_GPIO_PORT0_INT_B, 1, 1, 0x0000 }, { GPIO_PHY_GPIO_PORT0_LPMODE, 1, 0, 1 },
+	{ GPIO_PHY_GPIO_PORT0_MODPRS_B, 1, 3, 0x0000 }, { GPIO_PHY_GPIO_PORT0_RESET_B, 1, 2, 0 },
+	{ GPIO_PHY_GPIO_PORT1_INT_B, 1, 5, 0x0000 }, { GPIO_PHY_GPIO_PORT1_LPMODE, 1, 4, 1 },
+	{ GPIO_PHY_GPIO_PORT1_MODPRS_B, 1, 7, 0x0000 }, { GPIO_PHY_GPIO_PORT1_RESET_B, 1, 6, 0 },
+};
+
+static nthw_fpga_register_init_s gpio_phy_registers[] = {
+	{ GPIO_PHY_CFG, 0, 10, NTHW_FPGA_REG_TYPE_RW, 170, 10, gpio_phy_cfg_fields },
+	{ GPIO_PHY_GPIO, 1, 10, NTHW_FPGA_REG_TYPE_RW, 17, 10, gpio_phy_gpio_fields },
+};
+
+static nthw_fpga_field_init_s hfu_rcp_ctrl_fields[] = {
+	{ HFU_RCP_CTRL_ADR, 6, 0, 0x0000 },
+	{ HFU_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s hfu_rcp_data_fields[] = {
+	{ HFU_RCP_DATA_LEN_A_ADD_DYN, 5, 15, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_ADD_OFS, 8, 20, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_OL4LEN, 1, 1, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_POS_DYN, 5, 2, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_POS_OFS, 8, 7, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_SUB_DYN, 5, 28, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_WR, 1, 0, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_ADD_DYN, 5, 47, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_ADD_OFS, 8, 52, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_POS_DYN, 5, 34, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_POS_OFS, 8, 39, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_SUB_DYN, 5, 60, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_WR, 1, 33, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_ADD_DYN, 5, 79, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_ADD_OFS, 8, 84, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_POS_DYN, 5, 66, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_POS_OFS, 8, 71, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_SUB_DYN, 5, 92, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_WR, 1, 65, 0x0000 },
+	{ HFU_RCP_DATA_TTL_POS_DYN, 5, 98, 0x0000 },
+	{ HFU_RCP_DATA_TTL_POS_OFS, 8, 103, 0x0000 },
+	{ HFU_RCP_DATA_TTL_WR, 1, 97, 0x0000 },
+};
+
+static nthw_fpga_register_init_s hfu_registers[] = {
+	{ HFU_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, hfu_rcp_ctrl_fields },
+	{ HFU_RCP_DATA, 1, 111, NTHW_FPGA_REG_TYPE_WO, 0, 22, hfu_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s hif_build_time_fields[] = {
+	{ HIF_BUILD_TIME_TIME, 32, 0, 1713859545 },
+};
+
+static nthw_fpga_field_init_s hif_config_fields[] = {
+	{ HIF_CONFIG_EXT_TAG, 1, 6, 0x0000 },
+	{ HIF_CONFIG_MAX_READ, 3, 3, 0x0000 },
+	{ HIF_CONFIG_MAX_TLP, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s hif_control_fields[] = {
+	{ HIF_CONTROL_BLESSED, 8, 4, 0 },
+	{ HIF_CONTROL_FSR, 1, 12, 1 },
+	{ HIF_CONTROL_WRAW, 4, 0, 1 },
+};
+
+static nthw_fpga_field_init_s hif_prod_id_ex_fields[] = {
+	{ HIF_PROD_ID_EX_LAYOUT, 1, 31, 0 },
+	{ HIF_PROD_ID_EX_LAYOUT_VERSION, 8, 0, 1 },
+	{ HIF_PROD_ID_EX_RESERVED, 23, 8, 0 },
+};
+
+static nthw_fpga_field_init_s hif_prod_id_lsb_fields[] = {
+	{ HIF_PROD_ID_LSB_GROUP_ID, 16, 16, 9563 },
+	{ HIF_PROD_ID_LSB_REV_ID, 8, 0, 39 },
+	{ HIF_PROD_ID_LSB_VER_ID, 8, 8, 55 },
+};
+
+static nthw_fpga_field_init_s hif_prod_id_msb_fields[] = {
+	{ HIF_PROD_ID_MSB_BUILD_NO, 10, 12, 0 },
+	{ HIF_PROD_ID_MSB_TYPE_ID, 12, 0, 200 },
+};
+
+static nthw_fpga_field_init_s hif_sample_time_fields[] = {
+	{ HIF_SAMPLE_TIME_SAMPLE_TIME, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s hif_status_fields[] = {
+	{ HIF_STATUS_RD_ERR, 1, 9, 0 },
+	{ HIF_STATUS_TAGS_IN_USE, 8, 0, 0 },
+	{ HIF_STATUS_WR_ERR, 1, 8, 0 },
+};
+
+static nthw_fpga_field_init_s hif_stat_ctrl_fields[] = {
+	{ HIF_STAT_CTRL_STAT_ENA, 1, 1, 0 },
+	{ HIF_STAT_CTRL_STAT_REQ, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s hif_stat_refclk_fields[] = {
+	{ HIF_STAT_REFCLK_REFCLK250, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s hif_stat_rx_fields[] = {
+	{ HIF_STAT_RX_COUNTER, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s hif_stat_tx_fields[] = {
+	{ HIF_STAT_TX_COUNTER, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s hif_test0_fields[] = {
+	{ HIF_TEST0_DATA, 32, 0, 287454020 },
+};
+
+static nthw_fpga_field_init_s hif_test1_fields[] = {
+	{ HIF_TEST1_DATA, 32, 0, 2864434397 },
+};
+
+static nthw_fpga_field_init_s hif_uuid0_fields[] = {
+	{ HIF_UUID0_UUID0, 32, 0, 1237800326 },
+};
+
+static nthw_fpga_field_init_s hif_uuid1_fields[] = {
+	{ HIF_UUID1_UUID1, 32, 0, 3057550372 },
+};
+
+static nthw_fpga_field_init_s hif_uuid2_fields[] = {
+	{ HIF_UUID2_UUID2, 32, 0, 2445752330 },
+};
+
+static nthw_fpga_field_init_s hif_uuid3_fields[] = {
+	{ HIF_UUID3_UUID3, 32, 0, 1864147557 },
+};
+
+static nthw_fpga_register_init_s hif_registers[] = {
+	{ HIF_BUILD_TIME, 16, 32, NTHW_FPGA_REG_TYPE_RO, 1713859545, 1, hif_build_time_fields },
+	{ HIF_CONFIG, 24, 7, NTHW_FPGA_REG_TYPE_RW, 0, 3, hif_config_fields },
+	{ HIF_CONTROL, 40, 13, NTHW_FPGA_REG_TYPE_MIXED, 4097, 3, hif_control_fields },
+	{ HIF_PROD_ID_EX, 112, 32, NTHW_FPGA_REG_TYPE_RO, 1, 3, hif_prod_id_ex_fields },
+	{ HIF_PROD_ID_LSB, 0, 32, NTHW_FPGA_REG_TYPE_RO, 626734887, 3, hif_prod_id_lsb_fields },
+	{ HIF_PROD_ID_MSB, 8, 22, NTHW_FPGA_REG_TYPE_RO, 200, 2, hif_prod_id_msb_fields },
+	{ HIF_SAMPLE_TIME, 96, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, hif_sample_time_fields },
+	{ HIF_STATUS, 32, 10, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, hif_status_fields },
+	{ HIF_STAT_CTRL, 64, 2, NTHW_FPGA_REG_TYPE_WO, 0, 2, hif_stat_ctrl_fields },
+	{ HIF_STAT_REFCLK, 72, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, hif_stat_refclk_fields },
+	{ HIF_STAT_RX, 88, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, hif_stat_rx_fields },
+	{ HIF_STAT_TX, 80, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, hif_stat_tx_fields },
+	{ HIF_TEST0, 48, 32, NTHW_FPGA_REG_TYPE_RW, 287454020, 1, hif_test0_fields },
+	{ HIF_TEST1, 56, 32, NTHW_FPGA_REG_TYPE_RW, 2864434397, 1, hif_test1_fields },
+	{ HIF_UUID0, 128, 32, NTHW_FPGA_REG_TYPE_RO, 1237800326, 1, hif_uuid0_fields },
+	{ HIF_UUID1, 144, 32, NTHW_FPGA_REG_TYPE_RO, 3057550372, 1, hif_uuid1_fields },
+	{ HIF_UUID2, 160, 32, NTHW_FPGA_REG_TYPE_RO, 2445752330, 1, hif_uuid2_fields },
+	{ HIF_UUID3, 176, 32, NTHW_FPGA_REG_TYPE_RO, 1864147557, 1, hif_uuid3_fields },
+};
+
+static nthw_fpga_field_init_s hsh_rcp_ctrl_fields[] = {
+	{ HSH_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ HSH_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s hsh_rcp_data_fields[] = {
+	{ HSH_RCP_DATA_AUTO_IPV4_MASK, 1, 742, 0x0000 },
+	{ HSH_RCP_DATA_HSH_TYPE, 5, 416, 0x0000 },
+	{ HSH_RCP_DATA_HSH_VALID, 1, 415, 0x0000 },
+	{ HSH_RCP_DATA_K, 320, 422, 0x0000 },
+	{ HSH_RCP_DATA_LOAD_DIST_TYPE, 2, 0, 0x0000 },
+	{ HSH_RCP_DATA_MAC_PORT_MASK, 2, 2, 0x0000 },
+	{ HSH_RCP_DATA_P_MASK, 1, 61, 0x0000 },
+	{ HSH_RCP_DATA_QW0_OFS, 8, 11, 0x0000 },
+	{ HSH_RCP_DATA_QW0_PE, 5, 6, 0x0000 },
+	{ HSH_RCP_DATA_QW4_OFS, 8, 24, 0x0000 },
+	{ HSH_RCP_DATA_QW4_PE, 5, 19, 0x0000 },
+	{ HSH_RCP_DATA_SEED, 32, 382, 0x0000 },
+	{ HSH_RCP_DATA_SORT, 2, 4, 0x0000 },
+	{ HSH_RCP_DATA_TNL_P, 1, 414, 0x0000 },
+	{ HSH_RCP_DATA_TOEPLITZ, 1, 421, 0x0000 },
+	{ HSH_RCP_DATA_W8_OFS, 8, 37, 0x0000 },
+	{ HSH_RCP_DATA_W8_PE, 5, 32, 0x0000 },
+	{ HSH_RCP_DATA_W8_SORT, 1, 45, 0x0000 },
+	{ HSH_RCP_DATA_W9_OFS, 8, 51, 0x0000 },
+	{ HSH_RCP_DATA_W9_P, 1, 60, 0x0000 },
+	{ HSH_RCP_DATA_W9_PE, 5, 46, 0x0000 },
+	{ HSH_RCP_DATA_W9_SORT, 1, 59, 0x0000 },
+	{ HSH_RCP_DATA_WORD_MASK, 320, 62, 0x0000 },
+};
+
+static nthw_fpga_register_init_s hsh_registers[] = {
+	{ HSH_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, hsh_rcp_ctrl_fields },
+	{ HSH_RCP_DATA, 1, 743, NTHW_FPGA_REG_TYPE_WO, 0, 23, hsh_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s ifr_counters_ctrl_fields[] = {
+	{ IFR_COUNTERS_CTRL_ADR, 4, 0, 0x0000 },
+	{ IFR_COUNTERS_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_counters_data_fields[] = {
+	{ IFR_COUNTERS_DATA_DROP, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_df_buf_ctrl_fields[] = {
+	{ IFR_DF_BUF_CTRL_AVAILABLE, 11, 0, 0x0000 },
+	{ IFR_DF_BUF_CTRL_MTU_PROFILE, 16, 11, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_df_buf_data_fields[] = {
+	{ IFR_DF_BUF_DATA_FIFO_DAT, 128, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_rcp_ctrl_fields[] = {
+	{ IFR_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ IFR_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_rcp_data_fields[] = {
+	{ IFR_RCP_DATA_IPV4_DF_DROP, 1, 17, 0x0000 }, { IFR_RCP_DATA_IPV4_EN, 1, 0, 0x0000 },
+	{ IFR_RCP_DATA_IPV6_DROP, 1, 16, 0x0000 }, { IFR_RCP_DATA_IPV6_EN, 1, 1, 0x0000 },
+	{ IFR_RCP_DATA_MTU, 14, 2, 0x0000 },
+};
+
+static nthw_fpga_register_init_s ifr_registers[] = {
+	{ IFR_COUNTERS_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, ifr_counters_ctrl_fields },
+	{ IFR_COUNTERS_DATA, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, ifr_counters_data_fields },
+	{ IFR_DF_BUF_CTRL, 2, 27, NTHW_FPGA_REG_TYPE_RO, 0, 2, ifr_df_buf_ctrl_fields },
+	{ IFR_DF_BUF_DATA, 3, 128, NTHW_FPGA_REG_TYPE_RO, 0, 1, ifr_df_buf_data_fields },
+	{ IFR_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, ifr_rcp_ctrl_fields },
+	{ IFR_RCP_DATA, 1, 18, NTHW_FPGA_REG_TYPE_WO, 0, 5, ifr_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s iic_adr_fields[] = {
+	{ IIC_ADR_SLV_ADR, 7, 1, 0 },
+};
+
+static nthw_fpga_field_init_s iic_cr_fields[] = {
+	{ IIC_CR_EN, 1, 0, 0 }, { IIC_CR_GC_EN, 1, 6, 0 }, { IIC_CR_MSMS, 1, 2, 0 },
+	{ IIC_CR_RST, 1, 7, 0 }, { IIC_CR_RSTA, 1, 5, 0 }, { IIC_CR_TX, 1, 3, 0 },
+	{ IIC_CR_TXAK, 1, 4, 0 }, { IIC_CR_TXFIFO_RESET, 1, 1, 0 },
+};
+
+static nthw_fpga_field_init_s iic_dgie_fields[] = {
+	{ IIC_DGIE_GIE, 1, 31, 0 },
+};
+
+static nthw_fpga_field_init_s iic_gpo_fields[] = {
+	{ IIC_GPO_GPO_VAL, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_ier_fields[] = {
+	{ IIC_IER_INT0, 1, 0, 0 }, { IIC_IER_INT1, 1, 1, 0 }, { IIC_IER_INT2, 1, 2, 0 },
+	{ IIC_IER_INT3, 1, 3, 0 }, { IIC_IER_INT4, 1, 4, 0 }, { IIC_IER_INT5, 1, 5, 0 },
+	{ IIC_IER_INT6, 1, 6, 0 }, { IIC_IER_INT7, 1, 7, 0 },
+};
+
+static nthw_fpga_field_init_s iic_isr_fields[] = {
+	{ IIC_ISR_INT0, 1, 0, 0 }, { IIC_ISR_INT1, 1, 1, 0 }, { IIC_ISR_INT2, 1, 2, 0 },
+	{ IIC_ISR_INT3, 1, 3, 0 }, { IIC_ISR_INT4, 1, 4, 0 }, { IIC_ISR_INT5, 1, 5, 0 },
+	{ IIC_ISR_INT6, 1, 6, 0 }, { IIC_ISR_INT7, 1, 7, 0 },
+};
+
+static nthw_fpga_field_init_s iic_rx_fifo_fields[] = {
+	{ IIC_RX_FIFO_RXDATA, 8, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_rx_fifo_ocy_fields[] = {
+	{ IIC_RX_FIFO_OCY_OCY_VAL, 4, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_rx_fifo_pirq_fields[] = {
+	{ IIC_RX_FIFO_PIRQ_CMP_VAL, 4, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_softr_fields[] = {
+	{ IIC_SOFTR_RKEY, 4, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s iic_sr_fields[] = {
+	{ IIC_SR_AAS, 1, 1, 0 }, { IIC_SR_ABGC, 1, 0, 0 }, { IIC_SR_BB, 1, 2, 0 },
+	{ IIC_SR_RXFIFO_EMPTY, 1, 6, 1 }, { IIC_SR_RXFIFO_FULL, 1, 5, 0 }, { IIC_SR_SRW, 1, 3, 0 },
+	{ IIC_SR_TXFIFO_EMPTY, 1, 7, 1 }, { IIC_SR_TXFIFO_FULL, 1, 4, 0 },
+};
+
+static nthw_fpga_field_init_s iic_tbuf_fields[] = {
+	{ IIC_TBUF_TBUF_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_ten_adr_fields[] = {
+	{ IIC_TEN_ADR_MSB_SLV_ADR, 3, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_thddat_fields[] = {
+	{ IIC_THDDAT_THDDAT_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_thdsta_fields[] = {
+	{ IIC_THDSTA_THDSTA_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_thigh_fields[] = {
+	{ IIC_THIGH_THIGH_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_tlow_fields[] = {
+	{ IIC_TLOW_TLOW_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_tsudat_fields[] = {
+	{ IIC_TSUDAT_TSUDAT_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_tsusta_fields[] = {
+	{ IIC_TSUSTA_TSUSTA_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_tsusto_fields[] = {
+	{ IIC_TSUSTO_TSUSTO_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_tx_fifo_fields[] = {
+	{ IIC_TX_FIFO_START, 1, 8, 0 },
+	{ IIC_TX_FIFO_STOP, 1, 9, 0 },
+	{ IIC_TX_FIFO_TXDATA, 8, 0, 0 },
+};
+
+static nthw_fpga_field_init_s iic_tx_fifo_ocy_fields[] = {
+	{ IIC_TX_FIFO_OCY_OCY_VAL, 4, 0, 0 },
+};
+
+static nthw_fpga_register_init_s iic_registers[] = {
+	{ IIC_ADR, 68, 8, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_adr_fields },
+	{ IIC_CR, 64, 8, NTHW_FPGA_REG_TYPE_RW, 0, 8, iic_cr_fields },
+	{ IIC_DGIE, 7, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_dgie_fields },
+	{ IIC_GPO, 73, 1, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_gpo_fields },
+	{ IIC_IER, 10, 8, NTHW_FPGA_REG_TYPE_RW, 0, 8, iic_ier_fields },
+	{ IIC_ISR, 8, 8, NTHW_FPGA_REG_TYPE_RW, 0, 8, iic_isr_fields },
+	{ IIC_RX_FIFO, 67, 8, NTHW_FPGA_REG_TYPE_RO, 0, 1, iic_rx_fifo_fields },
+	{ IIC_RX_FIFO_OCY, 70, 4, NTHW_FPGA_REG_TYPE_RO, 0, 1, iic_rx_fifo_ocy_fields },
+	{ IIC_RX_FIFO_PIRQ, 72, 4, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_rx_fifo_pirq_fields },
+	{ IIC_SOFTR, 16, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, iic_softr_fields },
+	{ IIC_SR, 65, 8, NTHW_FPGA_REG_TYPE_RO, 192, 8, iic_sr_fields },
+	{ IIC_TBUF, 78, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_tbuf_fields },
+	{ IIC_TEN_ADR, 71, 3, NTHW_FPGA_REG_TYPE_RO, 0, 1, iic_ten_adr_fields },
+	{ IIC_THDDAT, 81, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_thddat_fields },
+	{ IIC_THDSTA, 76, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_thdsta_fields },
+	{ IIC_THIGH, 79, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_thigh_fields },
+	{ IIC_TLOW, 80, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_tlow_fields },
+	{ IIC_TSUDAT, 77, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_tsudat_fields },
+	{ IIC_TSUSTA, 74, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_tsusta_fields },
+	{ IIC_TSUSTO, 75, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, iic_tsusto_fields },
+	{ IIC_TX_FIFO, 66, 10, NTHW_FPGA_REG_TYPE_WO, 0, 3, iic_tx_fifo_fields },
+	{ IIC_TX_FIFO_OCY, 69, 4, NTHW_FPGA_REG_TYPE_RO, 0, 1, iic_tx_fifo_ocy_fields },
+};
+
+static nthw_fpga_field_init_s ins_rcp_ctrl_fields[] = {
+	{ INS_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ INS_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ins_rcp_data_fields[] = {
+	{ INS_RCP_DATA_DYN, 5, 0, 0x0000 },
+	{ INS_RCP_DATA_LEN, 8, 15, 0x0000 },
+	{ INS_RCP_DATA_OFS, 10, 5, 0x0000 },
+};
+
+static nthw_fpga_register_init_s ins_registers[] = {
+	{ INS_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, ins_rcp_ctrl_fields },
+	{ INS_RCP_DATA, 1, 23, NTHW_FPGA_REG_TYPE_WO, 0, 3, ins_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s km_cam_ctrl_fields[] = {
+	{ KM_CAM_CTRL_ADR, 13, 0, 0x0000 },
+	{ KM_CAM_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_cam_data_fields[] = {
+	{ KM_CAM_DATA_FT0, 4, 192, 0x0000 }, { KM_CAM_DATA_FT1, 4, 196, 0x0000 },
+	{ KM_CAM_DATA_FT2, 4, 200, 0x0000 }, { KM_CAM_DATA_FT3, 4, 204, 0x0000 },
+	{ KM_CAM_DATA_FT4, 4, 208, 0x0000 }, { KM_CAM_DATA_FT5, 4, 212, 0x0000 },
+	{ KM_CAM_DATA_W0, 32, 0, 0x0000 }, { KM_CAM_DATA_W1, 32, 32, 0x0000 },
+	{ KM_CAM_DATA_W2, 32, 64, 0x0000 }, { KM_CAM_DATA_W3, 32, 96, 0x0000 },
+	{ KM_CAM_DATA_W4, 32, 128, 0x0000 }, { KM_CAM_DATA_W5, 32, 160, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_rcp_ctrl_fields[] = {
+	{ KM_RCP_CTRL_ADR, 5, 0, 0x0000 },
+	{ KM_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_rcp_data_fields[] = {
+	{ KM_RCP_DATA_BANK_A, 12, 694, 0x0000 }, { KM_RCP_DATA_BANK_B, 12, 706, 0x0000 },
+	{ KM_RCP_DATA_DUAL, 1, 651, 0x0000 }, { KM_RCP_DATA_DW0_B_DYN, 5, 729, 0x0000 },
+	{ KM_RCP_DATA_DW0_B_OFS, 8, 734, 0x0000 }, { KM_RCP_DATA_DW10_DYN, 5, 55, 0x0000 },
+	{ KM_RCP_DATA_DW10_OFS, 8, 60, 0x0000 }, { KM_RCP_DATA_DW10_SEL_A, 2, 68, 0x0000 },
+	{ KM_RCP_DATA_DW10_SEL_B, 2, 70, 0x0000 }, { KM_RCP_DATA_DW2_B_DYN, 5, 742, 0x0000 },
+	{ KM_RCP_DATA_DW2_B_OFS, 8, 747, 0x0000 }, { KM_RCP_DATA_DW8_DYN, 5, 36, 0x0000 },
+	{ KM_RCP_DATA_DW8_OFS, 8, 41, 0x0000 }, { KM_RCP_DATA_DW8_SEL_A, 3, 49, 0x0000 },
+	{ KM_RCP_DATA_DW8_SEL_B, 3, 52, 0x0000 }, { KM_RCP_DATA_EL_A, 4, 653, 0x0000 },
+	{ KM_RCP_DATA_EL_B, 3, 657, 0x0000 }, { KM_RCP_DATA_FTM_A, 16, 662, 0x0000 },
+	{ KM_RCP_DATA_FTM_B, 16, 678, 0x0000 }, { KM_RCP_DATA_INFO_A, 1, 660, 0x0000 },
+	{ KM_RCP_DATA_INFO_B, 1, 661, 0x0000 }, { KM_RCP_DATA_KEYWAY_A, 1, 725, 0x0000 },
+	{ KM_RCP_DATA_KEYWAY_B, 1, 726, 0x0000 }, { KM_RCP_DATA_KL_A, 4, 718, 0x0000 },
+	{ KM_RCP_DATA_KL_B, 3, 722, 0x0000 }, { KM_RCP_DATA_MASK_A, 384, 75, 0x0000 },
+	{ KM_RCP_DATA_MASK_B, 192, 459, 0x0000 }, { KM_RCP_DATA_PAIRED, 1, 652, 0x0000 },
+	{ KM_RCP_DATA_QW0_DYN, 5, 0, 0x0000 }, { KM_RCP_DATA_QW0_OFS, 8, 5, 0x0000 },
+	{ KM_RCP_DATA_QW0_SEL_A, 3, 13, 0x0000 }, { KM_RCP_DATA_QW0_SEL_B, 3, 16, 0x0000 },
+	{ KM_RCP_DATA_QW4_DYN, 5, 19, 0x0000 }, { KM_RCP_DATA_QW4_OFS, 8, 24, 0x0000 },
+	{ KM_RCP_DATA_QW4_SEL_A, 2, 32, 0x0000 }, { KM_RCP_DATA_QW4_SEL_B, 2, 34, 0x0000 },
+	{ KM_RCP_DATA_SW4_B_DYN, 5, 755, 0x0000 }, { KM_RCP_DATA_SW4_B_OFS, 8, 760, 0x0000 },
+	{ KM_RCP_DATA_SW5_B_DYN, 5, 768, 0x0000 }, { KM_RCP_DATA_SW5_B_OFS, 8, 773, 0x0000 },
+	{ KM_RCP_DATA_SWX_CCH, 1, 72, 0x0000 }, { KM_RCP_DATA_SWX_SEL_A, 1, 73, 0x0000 },
+	{ KM_RCP_DATA_SWX_SEL_B, 1, 74, 0x0000 }, { KM_RCP_DATA_SYNERGY_MODE, 2, 727, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_status_fields[] = {
+	{ KM_STATUS_TCQ_RDY, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_tcam_ctrl_fields[] = {
+	{ KM_TCAM_CTRL_ADR, 14, 0, 0x0000 },
+	{ KM_TCAM_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_tcam_data_fields[] = {
+	{ KM_TCAM_DATA_T, 72, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_tci_ctrl_fields[] = {
+	{ KM_TCI_CTRL_ADR, 10, 0, 0x0000 },
+	{ KM_TCI_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_tci_data_fields[] = {
+	{ KM_TCI_DATA_COLOR, 32, 0, 0x0000 },
+	{ KM_TCI_DATA_FT, 4, 32, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_tcq_ctrl_fields[] = {
+	{ KM_TCQ_CTRL_ADR, 7, 0, 0x0000 },
+	{ KM_TCQ_CTRL_CNT, 5, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s km_tcq_data_fields[] = {
+	{ KM_TCQ_DATA_BANK_MASK, 12, 0, 0x0000 },
+	{ KM_TCQ_DATA_QUAL, 3, 12, 0x0000 },
+};
+
+static nthw_fpga_register_init_s km_registers[] = {
+	{ KM_CAM_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_cam_ctrl_fields },
+	{ KM_CAM_DATA, 3, 216, NTHW_FPGA_REG_TYPE_WO, 0, 12, km_cam_data_fields },
+	{ KM_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_rcp_ctrl_fields },
+	{ KM_RCP_DATA, 1, 781, NTHW_FPGA_REG_TYPE_WO, 0, 44, km_rcp_data_fields },
+	{ KM_STATUS, 10, 1, NTHW_FPGA_REG_TYPE_RO, 0, 1, km_status_fields },
+	{ KM_TCAM_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tcam_ctrl_fields },
+	{ KM_TCAM_DATA, 5, 72, NTHW_FPGA_REG_TYPE_WO, 0, 1, km_tcam_data_fields },
+	{ KM_TCI_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tci_ctrl_fields },
+	{ KM_TCI_DATA, 7, 36, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tci_data_fields },
+	{ KM_TCQ_CTRL, 8, 21, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tcq_ctrl_fields },
+	{ KM_TCQ_DATA, 9, 15, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tcq_data_fields },
+};
+
+static nthw_fpga_field_init_s mac_pcs_bad_code_fields[] = {
+	{ MAC_PCS_BAD_CODE_CODE_ERR, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_bip_err_fields[] = {
+	{ MAC_PCS_BIP_ERR_BIP_ERR, 640, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_block_lock_fields[] = {
+	{ MAC_PCS_BLOCK_LOCK_LOCK, 20, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_block_lock_chg_fields[] = {
+	{ MAC_PCS_BLOCK_LOCK_CHG_LOCK_CHG, 20, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_debounce_ctrl_fields[] = {
+	{ MAC_PCS_DEBOUNCE_CTRL_NT_DEBOUNCE_LATENCY, 8, 8, 10 },
+	{ MAC_PCS_DEBOUNCE_CTRL_NT_FORCE_LINK_DOWN, 1, 16, 0 },
+	{ MAC_PCS_DEBOUNCE_CTRL_NT_LINKUP_LATENCY, 8, 0, 10 },
+	{ MAC_PCS_DEBOUNCE_CTRL_NT_PORT_CTRL, 2, 17, 2 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_drp_ctrl_fields[] = {
+	{ MAC_PCS_DRP_CTRL_ADR, 10, 16, 0 }, { MAC_PCS_DRP_CTRL_DATA, 16, 0, 0 },
+	{ MAC_PCS_DRP_CTRL_DBG_BUSY, 1, 30, 0x0000 }, { MAC_PCS_DRP_CTRL_DONE, 1, 31, 0x0000 },
+	{ MAC_PCS_DRP_CTRL_MOD_ADR, 3, 26, 0 }, { MAC_PCS_DRP_CTRL_WREN, 1, 29, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_ctrl_fields[] = {
+	{ MAC_PCS_FEC_CTRL_RS_FEC_CTRL_IN, 5, 0, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_cw_cnt_fields[] = {
+	{ MAC_PCS_FEC_CW_CNT_CW_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_err_cnt_0_fields[] = {
+	{ MAC_PCS_FEC_ERR_CNT_0_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_err_cnt_1_fields[] = {
+	{ MAC_PCS_FEC_ERR_CNT_1_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_err_cnt_2_fields[] = {
+	{ MAC_PCS_FEC_ERR_CNT_2_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_err_cnt_3_fields[] = {
+	{ MAC_PCS_FEC_ERR_CNT_3_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_lane_dly_0_fields[] = {
+	{ MAC_PCS_FEC_LANE_DLY_0_DLY, 14, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_lane_dly_1_fields[] = {
+	{ MAC_PCS_FEC_LANE_DLY_1_DLY, 14, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_lane_dly_2_fields[] = {
+	{ MAC_PCS_FEC_LANE_DLY_2_DLY, 14, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_lane_dly_3_fields[] = {
+	{ MAC_PCS_FEC_LANE_DLY_3_DLY, 14, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_lane_map_fields[] = {
+	{ MAC_PCS_FEC_LANE_MAP_MAPPING, 8, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_stat_fields[] = {
+	{ MAC_PCS_FEC_STAT_AM_LOCK, 1, 10, 0x0000 },
+	{ MAC_PCS_FEC_STAT_AM_LOCK_0, 1, 3, 0x0000 },
+	{ MAC_PCS_FEC_STAT_AM_LOCK_1, 1, 4, 0x0000 },
+	{ MAC_PCS_FEC_STAT_AM_LOCK_2, 1, 5, 0x0000 },
+	{ MAC_PCS_FEC_STAT_AM_LOCK_3, 1, 6, 0x0000 },
+	{ MAC_PCS_FEC_STAT_BLOCK_LOCK, 1, 9, 0x0000 },
+	{ MAC_PCS_FEC_STAT_BYPASS, 1, 0, 0x0000 },
+	{ MAC_PCS_FEC_STAT_FEC_LANE_ALGN, 1, 7, 0x0000 },
+	{ MAC_PCS_FEC_STAT_HI_SER, 1, 2, 0x0000 },
+	{ MAC_PCS_FEC_STAT_PCS_LANE_ALGN, 1, 8, 0x0000 },
+	{ MAC_PCS_FEC_STAT_VALID, 1, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_fec_ucw_cnt_fields[] = {
+	{ MAC_PCS_FEC_UCW_CNT_UCW_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_ctl_rx_fields[] = {
+	{ MAC_PCS_GTY_CTL_RX_CDR_HOLD_0, 1, 24, 0 }, { MAC_PCS_GTY_CTL_RX_CDR_HOLD_1, 1, 25, 0 },
+	{ MAC_PCS_GTY_CTL_RX_CDR_HOLD_2, 1, 26, 0 }, { MAC_PCS_GTY_CTL_RX_CDR_HOLD_3, 1, 27, 0 },
+	{ MAC_PCS_GTY_CTL_RX_EQUA_RST_0, 1, 20, 0 }, { MAC_PCS_GTY_CTL_RX_EQUA_RST_1, 1, 21, 0 },
+	{ MAC_PCS_GTY_CTL_RX_EQUA_RST_2, 1, 22, 0 }, { MAC_PCS_GTY_CTL_RX_EQUA_RST_3, 1, 23, 0 },
+	{ MAC_PCS_GTY_CTL_RX_LPM_EN_0, 1, 16, 0 }, { MAC_PCS_GTY_CTL_RX_LPM_EN_1, 1, 17, 0 },
+	{ MAC_PCS_GTY_CTL_RX_LPM_EN_2, 1, 18, 0 }, { MAC_PCS_GTY_CTL_RX_LPM_EN_3, 1, 19, 0 },
+	{ MAC_PCS_GTY_CTL_RX_POLARITY_0, 1, 0, 0 }, { MAC_PCS_GTY_CTL_RX_POLARITY_1, 1, 1, 0 },
+	{ MAC_PCS_GTY_CTL_RX_POLARITY_2, 1, 2, 0 }, { MAC_PCS_GTY_CTL_RX_POLARITY_3, 1, 3, 0 },
+	{ MAC_PCS_GTY_CTL_RX_RATE_0, 3, 4, 0 }, { MAC_PCS_GTY_CTL_RX_RATE_1, 3, 7, 0 },
+	{ MAC_PCS_GTY_CTL_RX_RATE_2, 3, 10, 0 }, { MAC_PCS_GTY_CTL_RX_RATE_3, 3, 13, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_ctl_tx_fields[] = {
+	{ MAC_PCS_GTY_CTL_TX_INHIBIT_0, 1, 4, 0 }, { MAC_PCS_GTY_CTL_TX_INHIBIT_1, 1, 5, 0 },
+	{ MAC_PCS_GTY_CTL_TX_INHIBIT_2, 1, 6, 0 }, { MAC_PCS_GTY_CTL_TX_INHIBIT_3, 1, 7, 0 },
+	{ MAC_PCS_GTY_CTL_TX_POLARITY_0, 1, 0, 0 }, { MAC_PCS_GTY_CTL_TX_POLARITY_1, 1, 1, 0 },
+	{ MAC_PCS_GTY_CTL_TX_POLARITY_2, 1, 2, 0 }, { MAC_PCS_GTY_CTL_TX_POLARITY_3, 1, 3, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_diff_ctl_fields[] = {
+	{ MAC_PCS_GTY_DIFF_CTL_TX_DIFF_CTL_0, 5, 0, 24 },
+	{ MAC_PCS_GTY_DIFF_CTL_TX_DIFF_CTL_1, 5, 5, 24 },
+	{ MAC_PCS_GTY_DIFF_CTL_TX_DIFF_CTL_2, 5, 10, 24 },
+	{ MAC_PCS_GTY_DIFF_CTL_TX_DIFF_CTL_3, 5, 15, 24 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_loop_fields[] = {
+	{ MAC_PCS_GTY_LOOP_GT_LOOP_0, 3, 0, 0 },
+	{ MAC_PCS_GTY_LOOP_GT_LOOP_1, 3, 3, 0 },
+	{ MAC_PCS_GTY_LOOP_GT_LOOP_2, 3, 6, 0 },
+	{ MAC_PCS_GTY_LOOP_GT_LOOP_3, 3, 9, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_post_cursor_fields[] = {
+	{ MAC_PCS_GTY_POST_CURSOR_TX_POST_CSR_0, 5, 0, 20 },
+	{ MAC_PCS_GTY_POST_CURSOR_TX_POST_CSR_1, 5, 5, 20 },
+	{ MAC_PCS_GTY_POST_CURSOR_TX_POST_CSR_2, 5, 10, 20 },
+	{ MAC_PCS_GTY_POST_CURSOR_TX_POST_CSR_3, 5, 15, 20 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_prbs_sel_fields[] = {
+	{ MAC_PCS_GTY_PRBS_SEL_RX_PRBS_SEL_0, 4, 16, 0 },
+	{ MAC_PCS_GTY_PRBS_SEL_RX_PRBS_SEL_1, 4, 20, 0 },
+	{ MAC_PCS_GTY_PRBS_SEL_RX_PRBS_SEL_2, 4, 24, 0 },
+	{ MAC_PCS_GTY_PRBS_SEL_RX_PRBS_SEL_3, 4, 28, 0 },
+	{ MAC_PCS_GTY_PRBS_SEL_TX_PRBS_SEL_0, 4, 0, 0 },
+	{ MAC_PCS_GTY_PRBS_SEL_TX_PRBS_SEL_1, 4, 4, 0 },
+	{ MAC_PCS_GTY_PRBS_SEL_TX_PRBS_SEL_2, 4, 8, 0 },
+	{ MAC_PCS_GTY_PRBS_SEL_TX_PRBS_SEL_3, 4, 12, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_pre_cursor_fields[] = {
+	{ MAC_PCS_GTY_PRE_CURSOR_TX_PRE_CSR_0, 5, 0, 0 },
+	{ MAC_PCS_GTY_PRE_CURSOR_TX_PRE_CSR_1, 5, 5, 0 },
+	{ MAC_PCS_GTY_PRE_CURSOR_TX_PRE_CSR_2, 5, 10, 0 },
+	{ MAC_PCS_GTY_PRE_CURSOR_TX_PRE_CSR_3, 5, 15, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_rx_buf_stat_fields[] = {
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_0, 3, 0, 0x0000 },
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_1, 3, 3, 0x0000 },
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_2, 3, 6, 0x0000 },
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_3, 3, 9, 0x0000 },
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_CHANGED_0, 3, 12, 0x0000 },
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_CHANGED_1, 3, 15, 0x0000 },
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_CHANGED_2, 3, 18, 0x0000 },
+	{ MAC_PCS_GTY_RX_BUF_STAT_RX_BUF_STAT_CHANGED_3, 3, 21, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_scan_ctl_fields[] = {
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_RST_0, 1, 0, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_RST_1, 1, 1, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_RST_2, 1, 2, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_RST_3, 1, 3, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_TRG_0, 1, 4, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_TRG_1, 1, 5, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_TRG_2, 1, 6, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_EYE_SCAN_TRG_3, 1, 7, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_ERR_INS_0, 1, 12, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_ERR_INS_1, 1, 13, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_ERR_INS_2, 1, 14, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_ERR_INS_3, 1, 15, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_RST_0, 1, 8, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_RST_1, 1, 9, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_RST_2, 1, 10, 0 },
+	{ MAC_PCS_GTY_SCAN_CTL_PRBS_RST_3, 1, 11, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_scan_stat_fields[] = {
+	{ MAC_PCS_GTY_SCAN_STAT_EYE_SCAN_ERR_0, 1, 0, 0x0000 },
+	{ MAC_PCS_GTY_SCAN_STAT_EYE_SCAN_ERR_1, 1, 1, 0x0000 },
+	{ MAC_PCS_GTY_SCAN_STAT_EYE_SCAN_ERR_2, 1, 2, 0x0000 },
+	{ MAC_PCS_GTY_SCAN_STAT_EYE_SCAN_ERR_3, 1, 3, 0x0000 },
+	{ MAC_PCS_GTY_SCAN_STAT_PRBS_ERR_0, 1, 4, 0x0000 },
+	{ MAC_PCS_GTY_SCAN_STAT_PRBS_ERR_1, 1, 5, 0x0000 },
+	{ MAC_PCS_GTY_SCAN_STAT_PRBS_ERR_2, 1, 6, 0x0000 },
+	{ MAC_PCS_GTY_SCAN_STAT_PRBS_ERR_3, 1, 7, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_gty_stat_fields[] = {
+	{ MAC_PCS_GTY_STAT_RX_RST_DONE_0, 1, 4, 0x0000 },
+	{ MAC_PCS_GTY_STAT_RX_RST_DONE_1, 1, 5, 0x0000 },
+	{ MAC_PCS_GTY_STAT_RX_RST_DONE_2, 1, 6, 0x0000 },
+	{ MAC_PCS_GTY_STAT_RX_RST_DONE_3, 1, 7, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_BUF_STAT_0, 2, 8, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_BUF_STAT_1, 2, 10, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_BUF_STAT_2, 2, 12, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_BUF_STAT_3, 2, 14, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_RST_DONE_0, 1, 0, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_RST_DONE_1, 1, 1, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_RST_DONE_2, 1, 2, 0x0000 },
+	{ MAC_PCS_GTY_STAT_TX_RST_DONE_3, 1, 3, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_link_summary_fields[] = {
+	{ MAC_PCS_LINK_SUMMARY_ABS, 1, 0, 0x0000 },
+	{ MAC_PCS_LINK_SUMMARY_LH_ABS, 1, 2, 0x0000 },
+	{ MAC_PCS_LINK_SUMMARY_LH_LOCAL_FAULT, 1, 13, 0 },
+	{ MAC_PCS_LINK_SUMMARY_LH_REMOTE_FAULT, 1, 14, 0 },
+	{ MAC_PCS_LINK_SUMMARY_LINK_DOWN_CNT, 8, 4, 0 },
+	{ MAC_PCS_LINK_SUMMARY_LL_PHY_LINK_STATE, 1, 3, 0x0000 },
+	{ MAC_PCS_LINK_SUMMARY_LOCAL_FAULT, 1, 17, 0x0000 },
+	{ MAC_PCS_LINK_SUMMARY_NIM_INTERR, 1, 12, 0x0000 },
+	{ MAC_PCS_LINK_SUMMARY_NT_PHY_LINK_STATE, 1, 1, 0x0000 },
+	{ MAC_PCS_LINK_SUMMARY_REMOTE_FAULT, 1, 18, 0x0000 },
+	{ MAC_PCS_LINK_SUMMARY_RESERVED, 2, 15, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_mac_pcs_config_fields[] = {
+	{ MAC_PCS_MAC_PCS_CONFIG_RX_CORE_RST, 1, 3, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_RX_ENABLE, 1, 5, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_RX_FORCE_RESYNC, 1, 6, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_RX_PATH_RST, 1, 1, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_RX_TEST_PATTERN, 1, 7, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_TX_CORE_RST, 1, 2, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_TX_ENABLE, 1, 8, 1 },
+	{ MAC_PCS_MAC_PCS_CONFIG_TX_FCS_REMOVE, 1, 4, 1 },
+	{ MAC_PCS_MAC_PCS_CONFIG_TX_PATH_RST, 1, 0, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_TX_SEND_IDLE, 1, 9, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_TX_SEND_RFI, 1, 10, 0 },
+	{ MAC_PCS_MAC_PCS_CONFIG_TX_TEST_PATTERN, 1, 11, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_max_pkt_len_fields[] = {
+	{ MAC_PCS_MAX_PKT_LEN_MAX_LEN, 14, 0, 10000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_phymac_misc_fields[] = {
+	{ MAC_PCS_PHYMAC_MISC_TS_EOP, 1, 3, 1 },
+	{ MAC_PCS_PHYMAC_MISC_TX_MUX_STATE, 4, 4, 0x0000 },
+	{ MAC_PCS_PHYMAC_MISC_TX_SEL_HOST, 1, 0, 1 },
+	{ MAC_PCS_PHYMAC_MISC_TX_SEL_RX_LOOP, 1, 2, 0 },
+	{ MAC_PCS_PHYMAC_MISC_TX_SEL_TFG, 1, 1, 0 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_phy_stat_fields[] = {
+	{ MAC_PCS_PHY_STAT_ALARM, 1, 2, 0x0000 },
+	{ MAC_PCS_PHY_STAT_MOD_PRS, 1, 1, 0x0000 },
+	{ MAC_PCS_PHY_STAT_RX_LOS, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_stat_pcs_rx_fields[] = {
+	{ MAC_PCS_STAT_PCS_RX_ALIGNED, 1, 1, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_ALIGNED_ERR, 1, 2, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_GOT_SIGNAL_OS, 1, 9, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_HI_BER, 1, 8, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_INTERNAL_LOCAL_FAULT, 1, 4, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LOCAL_FAULT, 1, 6, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_MISALIGNED, 1, 3, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_RECEIVED_LOCAL_FAULT, 1, 5, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_REMOTE_FAULT, 1, 7, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_STATUS, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_stat_pcs_rx_latch_fields[] = {
+	{ MAC_PCS_STAT_PCS_RX_LATCH_ALIGNED, 1, 1, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_ALIGNED_ERR, 1, 2, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_GOT_SIGNAL_OS, 1, 9, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_HI_BER, 1, 8, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_INTERNAL_LOCAL_FAULT, 1, 4, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_LOCAL_FAULT, 1, 6, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_MISALIGNED, 1, 3, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_RECEIVED_LOCAL_FAULT, 1, 5, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_REMOTE_FAULT, 1, 7, 0x0000 },
+	{ MAC_PCS_STAT_PCS_RX_LATCH_STATUS, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_stat_pcs_tx_fields[] = {
+	{ MAC_PCS_STAT_PCS_TX_LOCAL_FAULT, 1, 0, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_LOCAL_FAULT_CHANGED, 1, 5, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_PTP_FIFO_READ_ERROR, 1, 4, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_PTP_FIFO_READ_ERROR_CHANGED, 1, 9, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_PTP_FIFO_WRITE_ERROR, 1, 3, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_PTP_FIFO_WRITE_ERROR_CHANGED, 1, 8, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_TX_OVFOUT, 1, 2, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_TX_OVFOUT_CHANGED, 1, 7, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_TX_UNFOUT, 1, 1, 0x0000 },
+	{ MAC_PCS_STAT_PCS_TX_TX_UNFOUT_CHANGED, 1, 6, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_synced_fields[] = {
+	{ MAC_PCS_SYNCED_SYNC, 20, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_synced_err_fields[] = {
+	{ MAC_PCS_SYNCED_ERR_SYNC_ERROR, 20, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_test_err_fields[] = {
+	{ MAC_PCS_TEST_ERR_CODE_ERR, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_timestamp_comp_fields[] = {
+	{ MAC_PCS_TIMESTAMP_COMP_RX_DLY, 16, 0, 1451 },
+	{ MAC_PCS_TIMESTAMP_COMP_TX_DLY, 16, 16, 1440 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_vl_demuxed_fields[] = {
+	{ MAC_PCS_VL_DEMUXED_LOCK, 20, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_pcs_vl_demuxed_chg_fields[] = {
+	{ MAC_PCS_VL_DEMUXED_CHG_LOCK_CHG, 20, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s mac_pcs_registers[] = {
+	{ MAC_PCS_BAD_CODE, 26, 16, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_bad_code_fields },
+	{ MAC_PCS_BIP_ERR, 31, 640, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_bip_err_fields },
+	{ MAC_PCS_BLOCK_LOCK, 27, 20, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_block_lock_fields },
+	{
+		MAC_PCS_BLOCK_LOCK_CHG, 28, 20, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_block_lock_chg_fields
+	},
+	{
+		MAC_PCS_DEBOUNCE_CTRL, 1, 19, NTHW_FPGA_REG_TYPE_RW, 264714, 4,
+		mac_pcs_debounce_ctrl_fields
+	},
+	{ MAC_PCS_DRP_CTRL, 43, 32, NTHW_FPGA_REG_TYPE_MIXED, 0, 6, mac_pcs_drp_ctrl_fields },
+	{ MAC_PCS_FEC_CTRL, 2, 5, NTHW_FPGA_REG_TYPE_RW, 0, 1, mac_pcs_fec_ctrl_fields },
+	{ MAC_PCS_FEC_CW_CNT, 9, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_fec_cw_cnt_fields },
+	{
+		MAC_PCS_FEC_ERR_CNT_0, 11, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_err_cnt_0_fields
+	},
+	{
+		MAC_PCS_FEC_ERR_CNT_1, 12, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_err_cnt_1_fields
+	},
+	{
+		MAC_PCS_FEC_ERR_CNT_2, 13, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_err_cnt_2_fields
+	},
+	{
+		MAC_PCS_FEC_ERR_CNT_3, 14, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_err_cnt_3_fields
+	},
+	{
+		MAC_PCS_FEC_LANE_DLY_0, 5, 14, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_lane_dly_0_fields
+	},
+	{
+		MAC_PCS_FEC_LANE_DLY_1, 6, 14, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_lane_dly_1_fields
+	},
+	{
+		MAC_PCS_FEC_LANE_DLY_2, 7, 14, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_lane_dly_2_fields
+	},
+	{
+		MAC_PCS_FEC_LANE_DLY_3, 8, 14, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_fec_lane_dly_3_fields
+	},
+	{ MAC_PCS_FEC_LANE_MAP, 4, 8, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_fec_lane_map_fields },
+	{ MAC_PCS_FEC_STAT, 3, 11, NTHW_FPGA_REG_TYPE_RO, 0, 11, mac_pcs_fec_stat_fields },
+	{ MAC_PCS_FEC_UCW_CNT, 10, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_fec_ucw_cnt_fields },
+	{ MAC_PCS_GTY_CTL_RX, 38, 28, NTHW_FPGA_REG_TYPE_RW, 0, 20, mac_pcs_gty_ctl_rx_fields },
+	{ MAC_PCS_GTY_CTL_TX, 39, 8, NTHW_FPGA_REG_TYPE_RW, 0, 8, mac_pcs_gty_ctl_tx_fields },
+	{
+		MAC_PCS_GTY_DIFF_CTL, 35, 20, NTHW_FPGA_REG_TYPE_RW, 811800, 4,
+		mac_pcs_gty_diff_ctl_fields
+	},
+	{ MAC_PCS_GTY_LOOP, 20, 12, NTHW_FPGA_REG_TYPE_RW, 0, 4, mac_pcs_gty_loop_fields },
+	{
+		MAC_PCS_GTY_POST_CURSOR, 36, 20, NTHW_FPGA_REG_TYPE_RW, 676500, 4,
+		mac_pcs_gty_post_cursor_fields
+	},
+	{ MAC_PCS_GTY_PRBS_SEL, 40, 32, NTHW_FPGA_REG_TYPE_RW, 0, 8, mac_pcs_gty_prbs_sel_fields },
+	{
+		MAC_PCS_GTY_PRE_CURSOR, 37, 20, NTHW_FPGA_REG_TYPE_RW, 0, 4,
+		mac_pcs_gty_pre_cursor_fields
+	},
+	{
+		MAC_PCS_GTY_RX_BUF_STAT, 34, 24, NTHW_FPGA_REG_TYPE_RO, 0, 8,
+		mac_pcs_gty_rx_buf_stat_fields
+	},
+	{
+		MAC_PCS_GTY_SCAN_CTL, 41, 16, NTHW_FPGA_REG_TYPE_RW, 0, 16,
+		mac_pcs_gty_scan_ctl_fields
+	},
+	{
+		MAC_PCS_GTY_SCAN_STAT, 42, 8, NTHW_FPGA_REG_TYPE_RO, 0, 8,
+		mac_pcs_gty_scan_stat_fields
+	},
+	{ MAC_PCS_GTY_STAT, 33, 16, NTHW_FPGA_REG_TYPE_RO, 0, 12, mac_pcs_gty_stat_fields },
+	{ MAC_PCS_LINK_SUMMARY, 0, 19, NTHW_FPGA_REG_TYPE_RO, 0, 11, mac_pcs_link_summary_fields },
+	{
+		MAC_PCS_MAC_PCS_CONFIG, 19, 12, NTHW_FPGA_REG_TYPE_RW, 272, 12,
+		mac_pcs_mac_pcs_config_fields
+	},
+	{
+		MAC_PCS_MAX_PKT_LEN, 17, 14, NTHW_FPGA_REG_TYPE_RW, 10000, 1,
+		mac_pcs_max_pkt_len_fields
+	},
+	{ MAC_PCS_PHYMAC_MISC, 16, 8, NTHW_FPGA_REG_TYPE_MIXED, 9, 5, mac_pcs_phymac_misc_fields },
+	{ MAC_PCS_PHY_STAT, 15, 3, NTHW_FPGA_REG_TYPE_RO, 0, 3, mac_pcs_phy_stat_fields },
+	{ MAC_PCS_STAT_PCS_RX, 21, 10, NTHW_FPGA_REG_TYPE_RO, 0, 10, mac_pcs_stat_pcs_rx_fields },
+	{
+		MAC_PCS_STAT_PCS_RX_LATCH, 22, 10, NTHW_FPGA_REG_TYPE_RO, 0, 10,
+		mac_pcs_stat_pcs_rx_latch_fields
+	},
+	{ MAC_PCS_STAT_PCS_TX, 23, 10, NTHW_FPGA_REG_TYPE_RO, 0, 10, mac_pcs_stat_pcs_tx_fields },
+	{ MAC_PCS_SYNCED, 24, 20, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_synced_fields },
+	{ MAC_PCS_SYNCED_ERR, 25, 20, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_synced_err_fields },
+	{ MAC_PCS_TEST_ERR, 32, 16, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_test_err_fields },
+	{
+		MAC_PCS_TIMESTAMP_COMP, 18, 32, NTHW_FPGA_REG_TYPE_RW, 94373291, 2,
+		mac_pcs_timestamp_comp_fields
+	},
+	{ MAC_PCS_VL_DEMUXED, 29, 20, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_pcs_vl_demuxed_fields },
+	{
+		MAC_PCS_VL_DEMUXED_CHG, 30, 20, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_pcs_vl_demuxed_chg_fields
+	},
+};
+
+static nthw_fpga_field_init_s mac_rx_bad_fcs_fields[] = {
+	{ MAC_RX_BAD_FCS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_fragment_fields[] = {
+	{ MAC_RX_FRAGMENT_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_packet_bad_fcs_fields[] = {
+	{ MAC_RX_PACKET_BAD_FCS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_packet_small_fields[] = {
+	{ MAC_RX_PACKET_SMALL_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_bytes_fields[] = {
+	{ MAC_RX_TOTAL_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_good_bytes_fields[] = {
+	{ MAC_RX_TOTAL_GOOD_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_good_packets_fields[] = {
+	{ MAC_RX_TOTAL_GOOD_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_packets_fields[] = {
+	{ MAC_RX_TOTAL_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_undersize_fields[] = {
+	{ MAC_RX_UNDERSIZE_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s mac_rx_registers[] = {
+	{ MAC_RX_BAD_FCS, 0, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_bad_fcs_fields },
+	{ MAC_RX_FRAGMENT, 6, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_fragment_fields },
+	{
+		MAC_RX_PACKET_BAD_FCS, 7, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_rx_packet_bad_fcs_fields
+	},
+	{ MAC_RX_PACKET_SMALL, 3, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_packet_small_fields },
+	{ MAC_RX_TOTAL_BYTES, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_total_bytes_fields },
+	{
+		MAC_RX_TOTAL_GOOD_BYTES, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_rx_total_good_bytes_fields
+	},
+	{
+		MAC_RX_TOTAL_GOOD_PACKETS, 2, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_rx_total_good_packets_fields
+	},
+	{ MAC_RX_TOTAL_PACKETS, 1, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_total_packets_fields },
+	{ MAC_RX_UNDERSIZE, 8, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_undersize_fields },
+};
+
+static nthw_fpga_field_init_s mac_tx_packet_small_fields[] = {
+	{ MAC_TX_PACKET_SMALL_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_bytes_fields[] = {
+	{ MAC_TX_TOTAL_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_good_bytes_fields[] = {
+	{ MAC_TX_TOTAL_GOOD_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_good_packets_fields[] = {
+	{ MAC_TX_TOTAL_GOOD_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_packets_fields[] = {
+	{ MAC_TX_TOTAL_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s mac_tx_registers[] = {
+	{ MAC_TX_PACKET_SMALL, 2, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_tx_packet_small_fields },
+	{ MAC_TX_TOTAL_BYTES, 3, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_tx_total_bytes_fields },
+	{
+		MAC_TX_TOTAL_GOOD_BYTES, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_tx_total_good_bytes_fields
+	},
+	{
+		MAC_TX_TOTAL_GOOD_PACKETS, 1, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_tx_total_good_packets_fields
+	},
+	{ MAC_TX_TOTAL_PACKETS, 0, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_tx_total_packets_fields },
+};
+
+static nthw_fpga_field_init_s pci_rd_tg_tg_ctrl_fields[] = {
+	{ PCI_RD_TG_TG_CTRL_TG_RD_RDY, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_rd_tg_tg_rdaddr_fields[] = {
+	{ PCI_RD_TG_TG_RDADDR_RAM_ADDR, 9, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_rd_tg_tg_rddata0_fields[] = {
+	{ PCI_RD_TG_TG_RDDATA0_PHYS_ADDR_LOW, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_rd_tg_tg_rddata1_fields[] = {
+	{ PCI_RD_TG_TG_RDDATA1_PHYS_ADDR_HIGH, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_rd_tg_tg_rddata2_fields[] = {
+	{ PCI_RD_TG_TG_RDDATA2_REQ_HID, 6, 22, 0 },
+	{ PCI_RD_TG_TG_RDDATA2_REQ_SIZE, 22, 0, 0 },
+	{ PCI_RD_TG_TG_RDDATA2_WAIT, 1, 30, 0 },
+	{ PCI_RD_TG_TG_RDDATA2_WRAP, 1, 31, 0 },
+};
+
+static nthw_fpga_field_init_s pci_rd_tg_tg_rd_run_fields[] = {
+	{ PCI_RD_TG_TG_RD_RUN_RD_ITERATION, 16, 0, 0 },
+};
+
+static nthw_fpga_register_init_s pci_rd_tg_registers[] = {
+	{ PCI_RD_TG_TG_CTRL, 5, 1, NTHW_FPGA_REG_TYPE_RO, 0, 1, pci_rd_tg_tg_ctrl_fields },
+	{ PCI_RD_TG_TG_RDADDR, 3, 9, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_rd_tg_tg_rdaddr_fields },
+	{ PCI_RD_TG_TG_RDDATA0, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_rd_tg_tg_rddata0_fields },
+	{ PCI_RD_TG_TG_RDDATA1, 1, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_rd_tg_tg_rddata1_fields },
+	{ PCI_RD_TG_TG_RDDATA2, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 4, pci_rd_tg_tg_rddata2_fields },
+	{ PCI_RD_TG_TG_RD_RUN, 4, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_rd_tg_tg_rd_run_fields },
+};
+
+static nthw_fpga_field_init_s pci_ta_control_fields[] = {
+	{ PCI_TA_CONTROL_ENABLE, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_ta_length_error_fields[] = {
+	{ PCI_TA_LENGTH_ERROR_AMOUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s pci_ta_packet_bad_fields[] = {
+	{ PCI_TA_PACKET_BAD_AMOUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s pci_ta_packet_good_fields[] = {
+	{ PCI_TA_PACKET_GOOD_AMOUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s pci_ta_payload_error_fields[] = {
+	{ PCI_TA_PAYLOAD_ERROR_AMOUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s pci_ta_registers[] = {
+	{ PCI_TA_CONTROL, 0, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_ta_control_fields },
+	{ PCI_TA_LENGTH_ERROR, 3, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, pci_ta_length_error_fields },
+	{ PCI_TA_PACKET_BAD, 2, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, pci_ta_packet_bad_fields },
+	{ PCI_TA_PACKET_GOOD, 1, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, pci_ta_packet_good_fields },
+	{ PCI_TA_PAYLOAD_ERROR, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, pci_ta_payload_error_fields },
+};
+
+static nthw_fpga_field_init_s pci_wr_tg_tg_ctrl_fields[] = {
+	{ PCI_WR_TG_TG_CTRL_TG_WR_RDY, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_wr_tg_tg_seq_fields[] = {
+	{ PCI_WR_TG_TG_SEQ_SEQUENCE, 16, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_wr_tg_tg_wraddr_fields[] = {
+	{ PCI_WR_TG_TG_WRADDR_RAM_ADDR, 9, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_wr_tg_tg_wrdata0_fields[] = {
+	{ PCI_WR_TG_TG_WRDATA0_PHYS_ADDR_LOW, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_wr_tg_tg_wrdata1_fields[] = {
+	{ PCI_WR_TG_TG_WRDATA1_PHYS_ADDR_HIGH, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pci_wr_tg_tg_wrdata2_fields[] = {
+	{ PCI_WR_TG_TG_WRDATA2_INC_MODE, 1, 29, 0 }, { PCI_WR_TG_TG_WRDATA2_REQ_HID, 6, 22, 0 },
+	{ PCI_WR_TG_TG_WRDATA2_REQ_SIZE, 22, 0, 0 }, { PCI_WR_TG_TG_WRDATA2_WAIT, 1, 30, 0 },
+	{ PCI_WR_TG_TG_WRDATA2_WRAP, 1, 31, 0 },
+};
+
+static nthw_fpga_field_init_s pci_wr_tg_tg_wr_run_fields[] = {
+	{ PCI_WR_TG_TG_WR_RUN_WR_ITERATION, 16, 0, 0 },
+};
+
+static nthw_fpga_register_init_s pci_wr_tg_registers[] = {
+	{ PCI_WR_TG_TG_CTRL, 5, 1, NTHW_FPGA_REG_TYPE_RO, 0, 1, pci_wr_tg_tg_ctrl_fields },
+	{ PCI_WR_TG_TG_SEQ, 6, 16, NTHW_FPGA_REG_TYPE_RW, 0, 1, pci_wr_tg_tg_seq_fields },
+	{ PCI_WR_TG_TG_WRADDR, 3, 9, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_wr_tg_tg_wraddr_fields },
+	{ PCI_WR_TG_TG_WRDATA0, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_wr_tg_tg_wrdata0_fields },
+	{ PCI_WR_TG_TG_WRDATA1, 1, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_wr_tg_tg_wrdata1_fields },
+	{ PCI_WR_TG_TG_WRDATA2, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 5, pci_wr_tg_tg_wrdata2_fields },
+	{ PCI_WR_TG_TG_WR_RUN, 4, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_wr_tg_tg_wr_run_fields },
+};
+
+static nthw_fpga_field_init_s pdb_config_fields[] = {
+	{ PDB_CONFIG_PORT_OFS, 6, 3, 0 },
+	{ PDB_CONFIG_TS_FORMAT, 3, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pdb_rcp_ctrl_fields[] = {
+	{ PDB_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ PDB_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s pdb_rcp_data_fields[] = {
+	{ PDB_RCP_DATA_ALIGN, 1, 17, 0x0000 },
+	{ PDB_RCP_DATA_CRC_OVERWRITE, 1, 16, 0x0000 },
+	{ PDB_RCP_DATA_DESCRIPTOR, 4, 0, 0x0000 },
+	{ PDB_RCP_DATA_DESC_LEN, 5, 4, 0 },
+	{ PDB_RCP_DATA_DUPLICATE_BIT, 5, 61, 0x0000 },
+	{ PDB_RCP_DATA_DUPLICATE_EN, 1, 60, 0x0000 },
+	{ PDB_RCP_DATA_IP_PROT_TNL, 1, 57, 0x0000 },
+	{ PDB_RCP_DATA_OFS0_DYN, 5, 18, 0x0000 },
+	{ PDB_RCP_DATA_OFS0_REL, 8, 23, 0x0000 },
+	{ PDB_RCP_DATA_OFS1_DYN, 5, 31, 0x0000 },
+	{ PDB_RCP_DATA_OFS1_REL, 8, 36, 0x0000 },
+	{ PDB_RCP_DATA_OFS2_DYN, 5, 44, 0x0000 },
+	{ PDB_RCP_DATA_OFS2_REL, 8, 49, 0x0000 },
+	{ PDB_RCP_DATA_PCAP_KEEP_FCS, 1, 66, 0x0000 },
+	{ PDB_RCP_DATA_PPC_HSH, 2, 58, 0x0000 },
+	{ PDB_RCP_DATA_TX_IGNORE, 1, 14, 0x0000 },
+	{ PDB_RCP_DATA_TX_NOW, 1, 15, 0x0000 },
+	{ PDB_RCP_DATA_TX_PORT, 5, 9, 0x0000 },
+};
+
+static nthw_fpga_register_init_s pdb_registers[] = {
+	{ PDB_CONFIG, 2, 10, NTHW_FPGA_REG_TYPE_WO, 0, 2, pdb_config_fields },
+	{ PDB_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, pdb_rcp_ctrl_fields },
+	{ PDB_RCP_DATA, 1, 67, NTHW_FPGA_REG_TYPE_WO, 0, 18, pdb_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s pdi_cr_fields[] = {
+	{ PDI_CR_EN, 1, 0, 0 }, { PDI_CR_PARITY, 1, 4, 0 }, { PDI_CR_RST, 1, 1, 0 },
+	{ PDI_CR_RXRST, 1, 2, 0 }, { PDI_CR_STOP, 1, 5, 0 }, { PDI_CR_TXRST, 1, 3, 0 },
+};
+
+static nthw_fpga_field_init_s pdi_drr_fields[] = {
+	{ PDI_DRR_DRR, 8, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pdi_dtr_fields[] = {
+	{ PDI_DTR_DTR, 8, 0, 0 },
+};
+
+static nthw_fpga_field_init_s pdi_pre_fields[] = {
+	{ PDI_PRE_PRE, 7, 0, 3 },
+};
+
+static nthw_fpga_field_init_s pdi_sr_fields[] = {
+	{ PDI_SR_DISABLE_BUSY, 1, 2, 0 }, { PDI_SR_DONE, 1, 0, 0 },
+	{ PDI_SR_ENABLE_BUSY, 1, 1, 0 }, { PDI_SR_FRAME_ERR, 1, 5, 0 },
+	{ PDI_SR_OVERRUN_ERR, 1, 7, 0 }, { PDI_SR_PARITY_ERR, 1, 6, 0 },
+	{ PDI_SR_RXLVL, 7, 8, 0 }, { PDI_SR_RX_BUSY, 1, 4, 0 },
+	{ PDI_SR_TXLVL, 7, 15, 0 }, { PDI_SR_TX_BUSY, 1, 3, 0 },
+};
+
+static nthw_fpga_field_init_s pdi_srr_fields[] = {
+	{ PDI_SRR_RST, 4, 0, 0 },
+};
+
+static nthw_fpga_register_init_s pdi_registers[] = {
+	{ PDI_CR, 1, 6, NTHW_FPGA_REG_TYPE_WO, 0, 6, pdi_cr_fields },
+	{ PDI_DRR, 4, 8, NTHW_FPGA_REG_TYPE_RO, 0, 1, pdi_drr_fields },
+	{ PDI_DTR, 3, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, pdi_dtr_fields },
+	{ PDI_PRE, 5, 7, NTHW_FPGA_REG_TYPE_WO, 3, 1, pdi_pre_fields },
+	{ PDI_SR, 2, 22, NTHW_FPGA_REG_TYPE_RO, 0, 10, pdi_sr_fields },
+	{ PDI_SRR, 0, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, pdi_srr_fields },
+};
+
+static nthw_fpga_field_init_s qsl_qen_ctrl_fields[] = {
+	{ QSL_QEN_CTRL_ADR, 5, 0, 0x0000 },
+	{ QSL_QEN_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qsl_qen_data_fields[] = {
+	{ QSL_QEN_DATA_EN, 4, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qsl_qst_ctrl_fields[] = {
+	{ QSL_QST_CTRL_ADR, 12, 0, 0x0000 },
+	{ QSL_QST_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qsl_qst_data_fields[] = {
+	{ QSL_QST_DATA_LRE, 1, 9, 0x0000 }, { QSL_QST_DATA_QEN, 1, 7, 0x0000 },
+	{ QSL_QST_DATA_QUEUE, 7, 0, 0x0000 }, { QSL_QST_DATA_TCI, 16, 10, 0x0000 },
+	{ QSL_QST_DATA_TX_PORT, 1, 8, 0x0000 }, { QSL_QST_DATA_VEN, 1, 26, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qsl_rcp_ctrl_fields[] = {
+	{ QSL_RCP_CTRL_ADR, 5, 0, 0x0000 },
+	{ QSL_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qsl_rcp_data_fields[] = {
+	{ QSL_RCP_DATA_DISCARD, 1, 0, 0x0000 }, { QSL_RCP_DATA_DROP, 2, 1, 0x0000 },
+	{ QSL_RCP_DATA_LR, 2, 51, 0x0000 }, { QSL_RCP_DATA_TBL_HI, 12, 15, 0x0000 },
+	{ QSL_RCP_DATA_TBL_IDX, 12, 27, 0x0000 }, { QSL_RCP_DATA_TBL_LO, 12, 3, 0x0000 },
+	{ QSL_RCP_DATA_TBL_MSK, 12, 39, 0x0000 }, { QSL_RCP_DATA_TSA, 1, 53, 0x0000 },
+	{ QSL_RCP_DATA_VLI, 2, 54, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qsl_unmq_ctrl_fields[] = {
+	{ QSL_UNMQ_CTRL_ADR, 1, 0, 0x0000 },
+	{ QSL_UNMQ_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qsl_unmq_data_fields[] = {
+	{ QSL_UNMQ_DATA_DEST_QUEUE, 7, 0, 0x0000 },
+	{ QSL_UNMQ_DATA_EN, 1, 7, 0x0000 },
+};
+
+static nthw_fpga_register_init_s qsl_registers[] = {
+	{ QSL_QEN_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_qen_ctrl_fields },
+	{ QSL_QEN_DATA, 5, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, qsl_qen_data_fields },
+	{ QSL_QST_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_qst_ctrl_fields },
+	{ QSL_QST_DATA, 3, 27, NTHW_FPGA_REG_TYPE_WO, 0, 6, qsl_qst_data_fields },
+	{ QSL_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_rcp_ctrl_fields },
+	{ QSL_RCP_DATA, 1, 56, NTHW_FPGA_REG_TYPE_WO, 0, 9, qsl_rcp_data_fields },
+	{ QSL_UNMQ_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_unmq_ctrl_fields },
+	{ QSL_UNMQ_DATA, 7, 8, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_unmq_data_fields },
+};
+
+static nthw_fpga_field_init_s qspi_cr_fields[] = {
+	{ QSPI_CR_CPHA, 1, 4, 0 }, { QSPI_CR_CPOL, 1, 3, 0 },
+	{ QSPI_CR_LOOP, 1, 0, 0 }, { QSPI_CR_LSBF, 1, 9, 0 },
+	{ QSPI_CR_MSSAE, 1, 7, 1 }, { QSPI_CR_MST, 1, 2, 0 },
+	{ QSPI_CR_MTI, 1, 8, 1 }, { QSPI_CR_RXFIFO_RST, 1, 6, 0 },
+	{ QSPI_CR_SPE, 1, 1, 0 }, { QSPI_CR_TXFIFO_RST, 1, 5, 0 },
+};
+
+static nthw_fpga_field_init_s qspi_dgie_fields[] = {
+	{ QSPI_DGIE_GIE, 1, 31, 0 },
+};
+
+static nthw_fpga_field_init_s qspi_drr_fields[] = {
+	{ QSPI_DRR_DATA_VAL, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qspi_dtr_fields[] = {
+	{ QSPI_DTR_DATA_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s qspi_ier_fields[] = {
+	{ QSPI_IER_CMD_ERR, 1, 13, 0 }, { QSPI_IER_CPOL_CPHA_ERR, 1, 9, 0 },
+	{ QSPI_IER_DRR_FULL, 1, 4, 0 }, { QSPI_IER_DRR_NEMPTY, 1, 8, 0 },
+	{ QSPI_IER_DRR_OR, 1, 5, 0 }, { QSPI_IER_DTR_EMPTY, 1, 2, 0 },
+	{ QSPI_IER_DTR_UR, 1, 3, 0 }, { QSPI_IER_LOOP_ERR, 1, 12, 0 },
+	{ QSPI_IER_MODF, 1, 0, 0 }, { QSPI_IER_MSB_ERR, 1, 11, 0 },
+	{ QSPI_IER_SLV_ERR, 1, 10, 0 }, { QSPI_IER_SLV_MODF, 1, 1, 0 },
+	{ QSPI_IER_SLV_MS, 1, 7, 0 }, { QSPI_IER_TXFIFO_HEMPTY, 1, 6, 0 },
+};
+
+static nthw_fpga_field_init_s qspi_isr_fields[] = {
+	{ QSPI_ISR_CMD_ERR, 1, 13, 0 }, { QSPI_ISR_CPOL_CPHA_ERR, 1, 9, 0 },
+	{ QSPI_ISR_DRR_FULL, 1, 4, 0 }, { QSPI_ISR_DRR_NEMPTY, 1, 8, 0 },
+	{ QSPI_ISR_DRR_OR, 1, 5, 0 }, { QSPI_ISR_DTR_EMPTY, 1, 2, 0 },
+	{ QSPI_ISR_DTR_UR, 1, 3, 0 }, { QSPI_ISR_LOOP_ERR, 1, 12, 0 },
+	{ QSPI_ISR_MODF, 1, 0, 0 }, { QSPI_ISR_MSB_ERR, 1, 11, 0 },
+	{ QSPI_ISR_SLV_ERR, 1, 10, 0 }, { QSPI_ISR_SLV_MODF, 1, 1, 0 },
+	{ QSPI_ISR_SLV_MS, 1, 7, 0 }, { QSPI_ISR_TXFIFO_HEMPTY, 1, 6, 0 },
+};
+
+static nthw_fpga_field_init_s qspi_rx_fifo_ocy_fields[] = {
+	{ QSPI_RX_FIFO_OCY_OCY_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s qspi_sr_fields[] = {
+	{ QSPI_SR_CMD_ERR, 1, 10, 0 }, { QSPI_SR_CPOL_CPHA_ERR, 1, 6, 0 },
+	{ QSPI_SR_LOOP_ERR, 1, 9, 0 }, { QSPI_SR_MODF, 1, 4, 0 },
+	{ QSPI_SR_MSB_ERR, 1, 8, 0 }, { QSPI_SR_RXEMPTY, 1, 0, 1 },
+	{ QSPI_SR_RXFULL, 1, 1, 0 }, { QSPI_SR_SLVMS, 1, 5, 1 },
+	{ QSPI_SR_SLV_ERR, 1, 7, 0 }, { QSPI_SR_TXEMPTY, 1, 2, 1 },
+	{ QSPI_SR_TXFULL, 1, 3, 0 },
+};
+
+static nthw_fpga_field_init_s qspi_srr_fields[] = {
+	{ QSPI_SRR_RST, 4, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s qspi_ssr_fields[] = {
+	{ QSPI_SSR_SEL_SLV, 32, 0, 4294967295 },
+};
+
+static nthw_fpga_field_init_s qspi_tx_fifo_ocy_fields[] = {
+	{ QSPI_TX_FIFO_OCY_OCY_VAL, 32, 0, 0 },
+};
+
+static nthw_fpga_register_init_s qspi_registers[] = {
+	{ QSPI_CR, 24, 10, NTHW_FPGA_REG_TYPE_RW, 384, 10, qspi_cr_fields },
+	{ QSPI_DGIE, 7, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, qspi_dgie_fields },
+	{ QSPI_DRR, 27, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, qspi_drr_fields },
+	{ QSPI_DTR, 26, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, qspi_dtr_fields },
+	{ QSPI_IER, 10, 14, NTHW_FPGA_REG_TYPE_RW, 0, 14, qspi_ier_fields },
+	{ QSPI_ISR, 8, 14, NTHW_FPGA_REG_TYPE_RW, 0, 14, qspi_isr_fields },
+	{ QSPI_RX_FIFO_OCY, 30, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, qspi_rx_fifo_ocy_fields },
+	{ QSPI_SR, 25, 11, NTHW_FPGA_REG_TYPE_RO, 37, 11, qspi_sr_fields },
+	{ QSPI_SRR, 16, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, qspi_srr_fields },
+	{ QSPI_SSR, 28, 32, NTHW_FPGA_REG_TYPE_RW, 4294967295, 1, qspi_ssr_fields },
+	{ QSPI_TX_FIFO_OCY, 29, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, qspi_tx_fifo_ocy_fields },
+};
+
+static nthw_fpga_field_init_s rac_dbg_ctrl_fields[] = {
+	{ RAC_DBG_CTRL_C, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rac_dbg_data_fields[] = {
+	{ RAC_DBG_DATA_D, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rac_rab_buf_free_fields[] = {
+	{ RAC_RAB_BUF_FREE_IB_FREE, 9, 0, 511 }, { RAC_RAB_BUF_FREE_IB_OVF, 1, 12, 0 },
+	{ RAC_RAB_BUF_FREE_OB_FREE, 9, 16, 511 }, { RAC_RAB_BUF_FREE_OB_OVF, 1, 28, 0 },
+	{ RAC_RAB_BUF_FREE_TIMEOUT, 1, 31, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_buf_used_fields[] = {
+	{ RAC_RAB_BUF_USED_FLUSH, 1, 31, 0 },
+	{ RAC_RAB_BUF_USED_IB_USED, 9, 0, 0 },
+	{ RAC_RAB_BUF_USED_OB_USED, 9, 16, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_dma_ib_hi_fields[] = {
+	{ RAC_RAB_DMA_IB_HI_PHYADDR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_dma_ib_lo_fields[] = {
+	{ RAC_RAB_DMA_IB_LO_PHYADDR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_dma_ib_rd_fields[] = {
+	{ RAC_RAB_DMA_IB_RD_PTR, 16, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_dma_ib_wr_fields[] = {
+	{ RAC_RAB_DMA_IB_WR_PTR, 16, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_dma_ob_hi_fields[] = {
+	{ RAC_RAB_DMA_OB_HI_PHYADDR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_dma_ob_lo_fields[] = {
+	{ RAC_RAB_DMA_OB_LO_PHYADDR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_dma_ob_wr_fields[] = {
+	{ RAC_RAB_DMA_OB_WR_PTR, 16, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rac_rab_ib_data_fields[] = {
+	{ RAC_RAB_IB_DATA_D, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rac_rab_init_fields[] = {
+	{ RAC_RAB_INIT_RAB, 3, 0, 7 },
+};
+
+static nthw_fpga_field_init_s rac_rab_ob_data_fields[] = {
+	{ RAC_RAB_OB_DATA_D, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s rac_registers[] = {
+	{ RAC_DBG_CTRL, 4200, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, rac_dbg_ctrl_fields },
+	{ RAC_DBG_DATA, 4208, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, rac_dbg_data_fields },
+	{
+		RAC_RAB_BUF_FREE, 4176, 32, NTHW_FPGA_REG_TYPE_MIXED, 33489407, 5,
+		rac_rab_buf_free_fields
+	},
+	{ RAC_RAB_BUF_USED, 4184, 32, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, rac_rab_buf_used_fields },
+	{ RAC_RAB_DMA_IB_HI, 4360, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, rac_rab_dma_ib_hi_fields },
+	{ RAC_RAB_DMA_IB_LO, 4352, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, rac_rab_dma_ib_lo_fields },
+	{ RAC_RAB_DMA_IB_RD, 4424, 16, NTHW_FPGA_REG_TYPE_RO, 0, 1, rac_rab_dma_ib_rd_fields },
+	{ RAC_RAB_DMA_IB_WR, 4416, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, rac_rab_dma_ib_wr_fields },
+	{ RAC_RAB_DMA_OB_HI, 4376, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, rac_rab_dma_ob_hi_fields },
+	{ RAC_RAB_DMA_OB_LO, 4368, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, rac_rab_dma_ob_lo_fields },
+	{ RAC_RAB_DMA_OB_WR, 4480, 16, NTHW_FPGA_REG_TYPE_RO, 0, 1, rac_rab_dma_ob_wr_fields },
+	{ RAC_RAB_IB_DATA, 4160, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, rac_rab_ib_data_fields },
+	{ RAC_RAB_INIT, 4192, 3, NTHW_FPGA_REG_TYPE_RW, 7, 1, rac_rab_init_fields },
+	{ RAC_RAB_OB_DATA, 4168, 32, NTHW_FPGA_REG_TYPE_RC1, 0, 1, rac_rab_ob_data_fields },
+};
+
+static nthw_fpga_field_init_s rfd_ctrl_fields[] = {
+	{ RFD_CTRL_CFP, 1, 2, 1 },
+	{ RFD_CTRL_ISL, 1, 0, 1 },
+	{ RFD_CTRL_PWMCW, 1, 1, 1 },
+};
+
+static nthw_fpga_field_init_s rfd_max_frame_size_fields[] = {
+	{ RFD_MAX_FRAME_SIZE_MAX, 14, 0, 9018 },
+};
+
+static nthw_fpga_field_init_s rfd_tnl_vlan_fields[] = {
+	{ RFD_TNL_VLAN_TPID0, 16, 0, 33024 },
+	{ RFD_TNL_VLAN_TPID1, 16, 16, 33024 },
+};
+
+static nthw_fpga_field_init_s rfd_vlan_fields[] = {
+	{ RFD_VLAN_TPID0, 16, 0, 33024 },
+	{ RFD_VLAN_TPID1, 16, 16, 33024 },
+};
+
+static nthw_fpga_field_init_s rfd_vxlan_fields[] = {
+	{ RFD_VXLAN_DP0, 16, 0, 4789 },
+	{ RFD_VXLAN_DP1, 16, 16, 4789 },
+};
+
+static nthw_fpga_register_init_s rfd_registers[] = {
+	{ RFD_CTRL, 0, 3, NTHW_FPGA_REG_TYPE_WO, 7, 3, rfd_ctrl_fields },
+	{ RFD_MAX_FRAME_SIZE, 1, 14, NTHW_FPGA_REG_TYPE_WO, 9018, 1, rfd_max_frame_size_fields },
+	{ RFD_TNL_VLAN, 3, 32, NTHW_FPGA_REG_TYPE_WO, 2164293888, 2, rfd_tnl_vlan_fields },
+	{ RFD_VLAN, 2, 32, NTHW_FPGA_REG_TYPE_WO, 2164293888, 2, rfd_vlan_fields },
+	{ RFD_VXLAN, 4, 32, NTHW_FPGA_REG_TYPE_WO, 313856693, 2, rfd_vxlan_fields },
+};
+
+static nthw_fpga_field_init_s rmc_ctrl_fields[] = {
+	{ RMC_CTRL_BLOCK_KEEPA, 1, 1, 1 }, { RMC_CTRL_BLOCK_MAC_PORT, 2, 8, 3 },
+	{ RMC_CTRL_BLOCK_RPP_SLICE, 8, 10, 0 }, { RMC_CTRL_BLOCK_STATT, 1, 0, 1 },
+	{ RMC_CTRL_LAG_PHY_ODD_EVEN, 1, 24, 0 },
+};
+
+static nthw_fpga_field_init_s rmc_dbg_fields[] = {
+	{ RMC_DBG_MERGE, 31, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rmc_mac_if_fields[] = {
+	{ RMC_MAC_IF_ERR, 31, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rmc_status_fields[] = {
+	{ RMC_STATUS_DESCR_FIFO_OF, 1, 16, 0 },
+	{ RMC_STATUS_SF_RAM_OF, 1, 0, 0 },
+};
+
+static nthw_fpga_register_init_s rmc_registers[] = {
+	{ RMC_CTRL, 0, 25, NTHW_FPGA_REG_TYPE_RW, 771, 5, rmc_ctrl_fields },
+	{ RMC_DBG, 2, 31, NTHW_FPGA_REG_TYPE_RO, 0, 1, rmc_dbg_fields },
+	{ RMC_MAC_IF, 3, 31, NTHW_FPGA_REG_TYPE_RO, 0, 1, rmc_mac_if_fields },
+	{ RMC_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_RO, 0, 2, rmc_status_fields },
+};
+
+static nthw_fpga_field_init_s rpl_ext_ctrl_fields[] = {
+	{ RPL_EXT_CTRL_ADR, 10, 0, 0x0000 },
+	{ RPL_EXT_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_ext_data_fields[] = {
+	{ RPL_EXT_DATA_RPL_PTR, 12, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rcp_ctrl_fields[] = {
+	{ RPL_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ RPL_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rcp_data_fields[] = {
+	{ RPL_RCP_DATA_DYN, 5, 0, 0x0000 }, { RPL_RCP_DATA_ETH_TYPE_WR, 1, 36, 0x0000 },
+	{ RPL_RCP_DATA_EXT_PRIO, 1, 35, 0x0000 }, { RPL_RCP_DATA_LEN, 8, 15, 0x0000 },
+	{ RPL_RCP_DATA_OFS, 10, 5, 0x0000 }, { RPL_RCP_DATA_RPL_PTR, 12, 23, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rpl_ctrl_fields[] = {
+	{ RPL_RPL_CTRL_ADR, 12, 0, 0x0000 },
+	{ RPL_RPL_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rpl_data_fields[] = {
+	{ RPL_RPL_DATA_VALUE, 128, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s rpl_registers[] = {
+	{ RPL_EXT_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpl_ext_ctrl_fields },
+	{ RPL_EXT_DATA, 3, 12, NTHW_FPGA_REG_TYPE_WO, 0, 1, rpl_ext_data_fields },
+	{ RPL_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpl_rcp_ctrl_fields },
+	{ RPL_RCP_DATA, 1, 37, NTHW_FPGA_REG_TYPE_WO, 0, 6, rpl_rcp_data_fields },
+	{ RPL_RPL_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpl_rpl_ctrl_fields },
+	{ RPL_RPL_DATA, 5, 128, NTHW_FPGA_REG_TYPE_WO, 0, 1, rpl_rpl_data_fields },
+};
+
+static nthw_fpga_field_init_s rpp_lr_ifr_rcp_ctrl_fields[] = {
+	{ RPP_LR_IFR_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ RPP_LR_IFR_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpp_lr_ifr_rcp_data_fields[] = {
+	{ RPP_LR_IFR_RCP_DATA_IPV4_DF_DROP, 1, 17, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_IPV4_EN, 1, 0, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_IPV6_DROP, 1, 16, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_IPV6_EN, 1, 1, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_MTU, 14, 2, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpp_lr_rcp_ctrl_fields[] = {
+	{ RPP_LR_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ RPP_LR_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpp_lr_rcp_data_fields[] = {
+	{ RPP_LR_RCP_DATA_EXP, 14, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s rpp_lr_registers[] = {
+	{ RPP_LR_IFR_RCP_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpp_lr_ifr_rcp_ctrl_fields },
+	{ RPP_LR_IFR_RCP_DATA, 3, 18, NTHW_FPGA_REG_TYPE_WO, 0, 5, rpp_lr_ifr_rcp_data_fields },
+	{ RPP_LR_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpp_lr_rcp_ctrl_fields },
+	{ RPP_LR_RCP_DATA, 1, 14, NTHW_FPGA_REG_TYPE_WO, 0, 1, rpp_lr_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s rst9563_ctrl_fields[] = {
+	{ RST9563_CTRL_PTP_MMCM_CLKSEL, 1, 2, 1 },
+	{ RST9563_CTRL_TS_CLKSEL, 1, 1, 1 },
+	{ RST9563_CTRL_TS_CLKSEL_OVERRIDE, 1, 0, 1 },
+};
+
+static nthw_fpga_field_init_s rst9563_power_fields[] = {
+	{ RST9563_POWER_PU_NSEB, 1, 1, 0 },
+	{ RST9563_POWER_PU_PHY, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s rst9563_rst_fields[] = {
+	{ RST9563_RST_CORE_MMCM, 1, 15, 0 }, { RST9563_RST_DDR4, 3, 3, 7 },
+	{ RST9563_RST_MAC_RX, 2, 9, 3 }, { RST9563_RST_PERIPH, 1, 13, 0 },
+	{ RST9563_RST_PHY, 2, 7, 3 }, { RST9563_RST_PTP, 1, 11, 1 },
+	{ RST9563_RST_PTP_MMCM, 1, 16, 0 }, { RST9563_RST_RPP, 1, 2, 1 },
+	{ RST9563_RST_SDC, 1, 6, 1 }, { RST9563_RST_SYS, 1, 0, 1 },
+	{ RST9563_RST_SYS_MMCM, 1, 14, 0 }, { RST9563_RST_TMC, 1, 1, 1 },
+	{ RST9563_RST_TS, 1, 12, 1 }, { RST9563_RST_TS_MMCM, 1, 17, 0 },
+};
+
+static nthw_fpga_field_init_s rst9563_stat_fields[] = {
+	{ RST9563_STAT_CORE_MMCM_LOCKED, 1, 5, 0x0000 },
+	{ RST9563_STAT_DDR4_MMCM_LOCKED, 1, 2, 0x0000 },
+	{ RST9563_STAT_DDR4_PLL_LOCKED, 1, 3, 0x0000 },
+	{ RST9563_STAT_PTP_MMCM_LOCKED, 1, 0, 0x0000 },
+	{ RST9563_STAT_SYS_MMCM_LOCKED, 1, 4, 0x0000 },
+	{ RST9563_STAT_TS_MMCM_LOCKED, 1, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rst9563_sticky_fields[] = {
+	{ RST9563_STICKY_CORE_MMCM_UNLOCKED, 1, 5, 0x0000 },
+	{ RST9563_STICKY_DDR4_MMCM_UNLOCKED, 1, 2, 0x0000 },
+	{ RST9563_STICKY_DDR4_PLL_UNLOCKED, 1, 3, 0x0000 },
+	{ RST9563_STICKY_PTP_MMCM_UNLOCKED, 1, 0, 0x0000 },
+	{ RST9563_STICKY_SYS_MMCM_UNLOCKED, 1, 4, 0x0000 },
+	{ RST9563_STICKY_TS_MMCM_UNLOCKED, 1, 1, 0x0000 },
+};
+
+static nthw_fpga_register_init_s rst9563_registers[] = {
+	{ RST9563_CTRL, 1, 3, NTHW_FPGA_REG_TYPE_RW, 7, 3, rst9563_ctrl_fields },
+	{ RST9563_POWER, 4, 2, NTHW_FPGA_REG_TYPE_RW, 0, 2, rst9563_power_fields },
+	{ RST9563_RST, 0, 18, NTHW_FPGA_REG_TYPE_RW, 8191, 14, rst9563_rst_fields },
+	{ RST9563_STAT, 2, 6, NTHW_FPGA_REG_TYPE_RO, 0, 6, rst9563_stat_fields },
+	{ RST9563_STICKY, 3, 6, NTHW_FPGA_REG_TYPE_RC1, 0, 6, rst9563_sticky_fields },
+};
+
+static nthw_fpga_field_init_s slc_rcp_ctrl_fields[] = {
+	{ SLC_RCP_CTRL_ADR, 6, 0, 0x0000 },
+	{ SLC_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s slc_rcp_data_fields[] = {
+	{ SLC_RCP_DATA_HEAD_DYN, 5, 1, 0x0000 }, { SLC_RCP_DATA_HEAD_OFS, 8, 6, 0x0000 },
+	{ SLC_RCP_DATA_HEAD_SLC_EN, 1, 0, 0x0000 }, { SLC_RCP_DATA_PCAP, 1, 35, 0x0000 },
+	{ SLC_RCP_DATA_TAIL_DYN, 5, 15, 0x0000 }, { SLC_RCP_DATA_TAIL_OFS, 15, 20, 0x0000 },
+	{ SLC_RCP_DATA_TAIL_SLC_EN, 1, 14, 0x0000 },
+};
+
+static nthw_fpga_register_init_s slc_registers[] = {
+	{ SLC_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, slc_rcp_ctrl_fields },
+	{ SLC_RCP_DATA, 1, 36, NTHW_FPGA_REG_TYPE_WO, 0, 7, slc_rcp_data_fields },
+};
+
+static nthw_fpga_field_init_s spim_cfg_fields[] = {
+	{ SPIM_CFG_PRE, 3, 0, 5 },
+};
+
+static nthw_fpga_field_init_s spim_cfg_clk_fields[] = {
+	{ SPIM_CFG_CLK_MODE, 2, 0, 0 },
+};
+
+static nthw_fpga_field_init_s spim_cr_fields[] = {
+	{ SPIM_CR_EN, 1, 1, 0 },
+	{ SPIM_CR_LOOP, 1, 0, 0 },
+	{ SPIM_CR_RXRST, 1, 3, 0 },
+	{ SPIM_CR_TXRST, 1, 2, 0 },
+};
+
+static nthw_fpga_field_init_s spim_drr_fields[] = {
+	{ SPIM_DRR_DRR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s spim_dtr_fields[] = {
+	{ SPIM_DTR_DTR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s spim_sr_fields[] = {
+	{ SPIM_SR_DONE, 1, 0, 0 }, { SPIM_SR_RXEMPTY, 1, 2, 1 }, { SPIM_SR_RXFULL, 1, 4, 0 },
+	{ SPIM_SR_RXLVL, 8, 16, 0 }, { SPIM_SR_TXEMPTY, 1, 1, 1 }, { SPIM_SR_TXFULL, 1, 3, 0 },
+	{ SPIM_SR_TXLVL, 8, 8, 0 },
+};
+
+static nthw_fpga_field_init_s spim_srr_fields[] = {
+	{ SPIM_SRR_RST, 4, 0, 0 },
+};
+
+static nthw_fpga_register_init_s spim_registers[] = {
+	{ SPIM_CFG, 5, 3, NTHW_FPGA_REG_TYPE_WO, 5, 1, spim_cfg_fields },
+	{ SPIM_CFG_CLK, 6, 2, NTHW_FPGA_REG_TYPE_WO, 0, 1, spim_cfg_clk_fields },
+	{ SPIM_CR, 1, 4, NTHW_FPGA_REG_TYPE_WO, 0, 4, spim_cr_fields },
+	{ SPIM_DRR, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, spim_drr_fields },
+	{ SPIM_DTR, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, spim_dtr_fields },
+	{ SPIM_SR, 2, 24, NTHW_FPGA_REG_TYPE_RO, 6, 7, spim_sr_fields },
+	{ SPIM_SRR, 0, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, spim_srr_fields },
+};
+
+static nthw_fpga_field_init_s spis_cr_fields[] = {
+	{ SPIS_CR_DEBUG, 1, 4, 0 }, { SPIS_CR_EN, 1, 1, 0 }, { SPIS_CR_LOOP, 1, 0, 0 },
+	{ SPIS_CR_RXRST, 1, 3, 0 }, { SPIS_CR_TXRST, 1, 2, 0 },
+};
+
+static nthw_fpga_field_init_s spis_drr_fields[] = {
+	{ SPIS_DRR_DRR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s spis_dtr_fields[] = {
+	{ SPIS_DTR_DTR, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s spis_ram_ctrl_fields[] = {
+	{ SPIS_RAM_CTRL_ADR, 6, 0, 0 },
+	{ SPIS_RAM_CTRL_CNT, 6, 6, 0 },
+};
+
+static nthw_fpga_field_init_s spis_ram_data_fields[] = {
+	{ SPIS_RAM_DATA_DATA, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s spis_sr_fields[] = {
+	{ SPIS_SR_DONE, 1, 0, 0 }, { SPIS_SR_FRAME_ERR, 1, 24, 0 },
+	{ SPIS_SR_READ_ERR, 1, 25, 0 }, { SPIS_SR_RXEMPTY, 1, 2, 1 },
+	{ SPIS_SR_RXFULL, 1, 4, 0 }, { SPIS_SR_RXLVL, 8, 16, 0 },
+	{ SPIS_SR_TXEMPTY, 1, 1, 1 }, { SPIS_SR_TXFULL, 1, 3, 0 },
+	{ SPIS_SR_TXLVL, 8, 8, 0 }, { SPIS_SR_WRITE_ERR, 1, 26, 0 },
+};
+
+static nthw_fpga_field_init_s spis_srr_fields[] = {
+	{ SPIS_SRR_RST, 4, 0, 0 },
+};
+
+static nthw_fpga_register_init_s spis_registers[] = {
+	{ SPIS_CR, 1, 5, NTHW_FPGA_REG_TYPE_WO, 0, 5, spis_cr_fields },
+	{ SPIS_DRR, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, spis_drr_fields },
+	{ SPIS_DTR, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, spis_dtr_fields },
+	{ SPIS_RAM_CTRL, 5, 12, NTHW_FPGA_REG_TYPE_RW, 0, 2, spis_ram_ctrl_fields },
+	{ SPIS_RAM_DATA, 6, 32, NTHW_FPGA_REG_TYPE_RW, 0, 1, spis_ram_data_fields },
+	{ SPIS_SR, 2, 27, NTHW_FPGA_REG_TYPE_RO, 6, 10, spis_sr_fields },
+	{ SPIS_SRR, 0, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, spis_srr_fields },
+};
+
+static nthw_fpga_field_init_s sta_byte_fields[] = {
+	{ STA_BYTE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_cfg_fields[] = {
+	{ STA_CFG_CNT_CLEAR, 1, 1, 0 },
+	{ STA_CFG_DMA_ENA, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s sta_cv_err_fields[] = {
+	{ STA_CV_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_fcs_err_fields[] = {
+	{ STA_FCS_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_host_adr_lsb_fields[] = {
+	{ STA_HOST_ADR_LSB_LSB, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s sta_host_adr_msb_fields[] = {
+	{ STA_HOST_ADR_MSB_MSB, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s sta_load_bin_fields[] = {
+	{ STA_LOAD_BIN_BIN, 32, 0, 8388607 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_rx_0_fields[] = {
+	{ STA_LOAD_BPS_RX_0_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_rx_1_fields[] = {
+	{ STA_LOAD_BPS_RX_1_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_tx_0_fields[] = {
+	{ STA_LOAD_BPS_TX_0_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_tx_1_fields[] = {
+	{ STA_LOAD_BPS_TX_1_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_rx_0_fields[] = {
+	{ STA_LOAD_PPS_RX_0_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_rx_1_fields[] = {
+	{ STA_LOAD_PPS_RX_1_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_tx_0_fields[] = {
+	{ STA_LOAD_PPS_TX_0_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_tx_1_fields[] = {
+	{ STA_LOAD_PPS_TX_1_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_pckt_fields[] = {
+	{ STA_PCKT_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_status_fields[] = {
+	{ STA_STATUS_STAT_TOGGLE_MISSED, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s sta_registers[] = {
+	{ STA_BYTE, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_byte_fields },
+	{ STA_CFG, 0, 2, NTHW_FPGA_REG_TYPE_RW, 0, 2, sta_cfg_fields },
+	{ STA_CV_ERR, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_cv_err_fields },
+	{ STA_FCS_ERR, 6, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_fcs_err_fields },
+	{ STA_HOST_ADR_LSB, 1, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, sta_host_adr_lsb_fields },
+	{ STA_HOST_ADR_MSB, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, sta_host_adr_msb_fields },
+	{ STA_LOAD_BIN, 8, 32, NTHW_FPGA_REG_TYPE_WO, 8388607, 1, sta_load_bin_fields },
+	{ STA_LOAD_BPS_RX_0, 11, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_rx_0_fields },
+	{ STA_LOAD_BPS_RX_1, 13, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_rx_1_fields },
+	{ STA_LOAD_BPS_TX_0, 15, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_tx_0_fields },
+	{ STA_LOAD_BPS_TX_1, 17, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_tx_1_fields },
+	{ STA_LOAD_PPS_RX_0, 10, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_rx_0_fields },
+	{ STA_LOAD_PPS_RX_1, 12, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_rx_1_fields },
+	{ STA_LOAD_PPS_TX_0, 14, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_tx_0_fields },
+	{ STA_LOAD_PPS_TX_1, 16, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_tx_1_fields },
+	{ STA_PCKT, 3, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_pckt_fields },
+	{ STA_STATUS, 7, 1, NTHW_FPGA_REG_TYPE_RC1, 0, 1, sta_status_fields },
+};
+
+static nthw_fpga_field_init_s tempmon_alarms_fields[] = {
+	{ TEMPMON_ALARMS_OT, 1, 1, 0x0000 },
+	{ TEMPMON_ALARMS_OT_OVERWR, 1, 2, 0 },
+	{ TEMPMON_ALARMS_OT_OVERWRVAL, 1, 3, 0 },
+	{ TEMPMON_ALARMS_TEMP, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tempmon_stat_fields[] = {
+	{ TEMPMON_STAT_TEMP, 12, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s tempmon_registers[] = {
+	{ TEMPMON_ALARMS, 1, 4, NTHW_FPGA_REG_TYPE_MIXED, 0, 4, tempmon_alarms_fields },
+	{ TEMPMON_STAT, 0, 12, NTHW_FPGA_REG_TYPE_RO, 0, 1, tempmon_stat_fields },
+};
+
+static nthw_fpga_field_init_s tint_ctrl_fields[] = {
+	{ TINT_CTRL_INTERVAL, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s tint_status_fields[] = {
+	{ TINT_STATUS_DELAYED, 8, 8, 0 },
+	{ TINT_STATUS_SKIPPED, 8, 0, 0 },
+};
+
+static nthw_fpga_register_init_s tint_registers[] = {
+	{ TINT_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, tint_ctrl_fields },
+	{ TINT_STATUS, 1, 16, NTHW_FPGA_REG_TYPE_RC1, 0, 2, tint_status_fields },
+};
+
+static nthw_fpga_field_init_s tsm_con0_config_fields[] = {
+	{ TSM_CON0_CONFIG_BLIND, 5, 8, 9 }, { TSM_CON0_CONFIG_DC_SRC, 3, 5, 0 },
+	{ TSM_CON0_CONFIG_PORT, 3, 0, 0 }, { TSM_CON0_CONFIG_PPSIN_2_5V, 1, 13, 0 },
+	{ TSM_CON0_CONFIG_SAMPLE_EDGE, 2, 3, 2 },
+};
+
+static nthw_fpga_field_init_s tsm_con0_interface_fields[] = {
+	{ TSM_CON0_INTERFACE_EX_TERM, 2, 0, 3 }, { TSM_CON0_INTERFACE_IN_REF_PWM, 8, 12, 128 },
+	{ TSM_CON0_INTERFACE_PWM_ENA, 1, 2, 0 }, { TSM_CON0_INTERFACE_RESERVED, 1, 3, 0 },
+	{ TSM_CON0_INTERFACE_VTERM_PWM, 8, 4, 0 },
+};
+
+static nthw_fpga_field_init_s tsm_con0_sample_hi_fields[] = {
+	{ TSM_CON0_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con0_sample_lo_fields[] = {
+	{ TSM_CON0_SAMPLE_LO_NS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con1_config_fields[] = {
+	{ TSM_CON1_CONFIG_BLIND, 5, 8, 9 }, { TSM_CON1_CONFIG_DC_SRC, 3, 5, 0 },
+	{ TSM_CON1_CONFIG_PORT, 3, 0, 0 }, { TSM_CON1_CONFIG_PPSIN_2_5V, 1, 13, 0 },
+	{ TSM_CON1_CONFIG_SAMPLE_EDGE, 2, 3, 2 },
+};
+
+static nthw_fpga_field_init_s tsm_con1_sample_hi_fields[] = {
+	{ TSM_CON1_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con1_sample_lo_fields[] = {
+	{ TSM_CON1_SAMPLE_LO_NS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con2_config_fields[] = {
+	{ TSM_CON2_CONFIG_BLIND, 5, 8, 9 }, { TSM_CON2_CONFIG_DC_SRC, 3, 5, 0 },
+	{ TSM_CON2_CONFIG_PORT, 3, 0, 0 }, { TSM_CON2_CONFIG_PPSIN_2_5V, 1, 13, 0 },
+	{ TSM_CON2_CONFIG_SAMPLE_EDGE, 2, 3, 2 },
+};
+
+static nthw_fpga_field_init_s tsm_con2_sample_hi_fields[] = {
+	{ TSM_CON2_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con2_sample_lo_fields[] = {
+	{ TSM_CON2_SAMPLE_LO_NS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con3_config_fields[] = {
+	{ TSM_CON3_CONFIG_BLIND, 5, 5, 26 },
+	{ TSM_CON3_CONFIG_PORT, 3, 0, 1 },
+	{ TSM_CON3_CONFIG_SAMPLE_EDGE, 2, 3, 1 },
+};
+
+static nthw_fpga_field_init_s tsm_con3_sample_hi_fields[] = {
+	{ TSM_CON3_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con3_sample_lo_fields[] = {
+	{ TSM_CON3_SAMPLE_LO_NS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con4_config_fields[] = {
+	{ TSM_CON4_CONFIG_BLIND, 5, 5, 26 },
+	{ TSM_CON4_CONFIG_PORT, 3, 0, 1 },
+	{ TSM_CON4_CONFIG_SAMPLE_EDGE, 2, 3, 1 },
+};
+
+static nthw_fpga_field_init_s tsm_con4_sample_hi_fields[] = {
+	{ TSM_CON4_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con4_sample_lo_fields[] = {
+	{ TSM_CON4_SAMPLE_LO_NS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con5_config_fields[] = {
+	{ TSM_CON5_CONFIG_BLIND, 5, 5, 26 },
+	{ TSM_CON5_CONFIG_PORT, 3, 0, 1 },
+	{ TSM_CON5_CONFIG_SAMPLE_EDGE, 2, 3, 1 },
+};
+
+static nthw_fpga_field_init_s tsm_con5_sample_hi_fields[] = {
+	{ TSM_CON5_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con5_sample_lo_fields[] = {
+	{ TSM_CON5_SAMPLE_LO_TIME, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con6_config_fields[] = {
+	{ TSM_CON6_CONFIG_BLIND, 5, 5, 26 },
+	{ TSM_CON6_CONFIG_PORT, 3, 0, 1 },
+	{ TSM_CON6_CONFIG_SAMPLE_EDGE, 2, 3, 1 },
+};
+
+static nthw_fpga_field_init_s tsm_con6_sample_hi_fields[] = {
+	{ TSM_CON6_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con6_sample_lo_fields[] = {
+	{ TSM_CON6_SAMPLE_LO_NS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con7_host_sample_hi_fields[] = {
+	{ TSM_CON7_HOST_SAMPLE_HI_SEC, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_con7_host_sample_lo_fields[] = {
+	{ TSM_CON7_HOST_SAMPLE_LO_NS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s tsm_config_fields[] = {
+	{ TSM_CONFIG_NTTS_SRC, 2, 5, 0 }, { TSM_CONFIG_NTTS_SYNC, 1, 4, 0 },
+	{ TSM_CONFIG_TIMESET_EDGE, 2, 8, 1 }, { TSM_CONFIG_TIMESET_SRC, 3, 10, 0 },
+	{ TSM_CONFIG_TIMESET_UP, 1, 7, 0 }, { TSM_CONFIG_TS_FORMAT, 4, 0, 1 },
+};
+
+static nthw_fpga_field_init_s tsm_int_config_fields[] = {
+	{ TSM_INT_CONFIG_AUTO_DISABLE, 1, 0, 0 },
+	{ TSM_INT_CONFIG_MASK, 19, 1, 0 },
+};
+
+static nthw_fpga_field_init_s tsm_int_stat_fields[] = {
+	{ TSM_INT_STAT_CAUSE, 19, 1, 0 },
+	{ TSM_INT_STAT_ENABLE, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s tsm_led_fields[] = {
+	{ TSM_LED_LED0_BG_COLOR, 2, 3, 0 }, { TSM_LED_LED0_COLOR, 2, 1, 0 },
+	{ TSM_LED_LED0_MODE, 1, 0, 0 }, { TSM_LED_LED0_SRC, 4, 5, 0 },
+	{ TSM_LED_LED1_BG_COLOR, 2, 12, 0 }, { TSM_LED_LED1_COLOR, 2, 10, 0 },
+	{ TSM_LED_LED1_MODE, 1, 9, 0 }, { TSM_LED_LED1_SRC, 4, 14, 1 },
+	{ TSM_LED_LED2_BG_COLOR, 2, 21, 0 }, { TSM_LED_LED2_COLOR, 2, 19, 0 },
+	{ TSM_LED_LED2_MODE, 1, 18, 0 }, { TSM_LED_LED2_SRC, 4, 23, 2 },
+};
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c new file +6 -0
new file mode 100644
index 0000000000..ea731ae979

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h new file +7 -0
new file mode 100644
index 0000000000..c19b43c19b

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h new file +93 -0

93 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c new file +78 -0

78 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.h new file +11 -0
new file mode 100644
index 0000000000..6bebe56329

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_param_defs.h new file +232 -0

232 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h new file +94 -0

94 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cat.h new file +237 -0

237 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cb.h new file +73 -0

73 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cor.h new file +81 -0

81 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cpy.h new file +112 -0

112 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_csu.h new file +30 -0
new file mode 100644
index 0000000000..eb68ccab33

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h new file +144 -0

144 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ddp.h new file +34 -0
new file mode 100644
index 0000000000..88ed30f494

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_epp.h new file +64 -0

64 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_eqm.h new file +45 -0

45 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_fhm.h new file +48 -0

48 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_flm.h new file +237 -0

237 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gfg.h new file +126 -0

126 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gmf.h new file +68 -0

68 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_phy.h new file +48 -0

48 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_phy_ports.h new file +72 -0

72 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_sfpp.h new file +34 -0
new file mode 100644
index 0000000000..f271b0cd46

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hfu.h new file +48 -0

48 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hif.h new file +79 -0

79 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hsh.h new file +49 -0

49 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_i2cm.h new file +38 -0
new file mode 100644
index 0000000000..56248d5261

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ifr.h new file +41 -0

41 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h new file +28 -0
new file mode 100644
index 0000000000..45c7516a48

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_iic.h new file +96 -0

96 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ins.h new file +29 -0
new file mode 100644
index 0000000000..a4fffb11ab

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ioa.h new file +44 -0

44 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ipf.h new file +84 -0

84 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_km.h new file +125 -0

125 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac.h new file +177 -0

177 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_pcs.h new file +298 -0

298 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_pcs_xxv.h new file +1092 -0

1,092 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h new file +90 -0

90 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tfg.h new file +42 -0

42 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h new file +70 -0

70 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_msk.h new file +42 -0

42 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_rd_tg.h new file +37 -0
new file mode 100644
index 0000000000..c21a1b20c3

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h new file +32 -0
new file mode 100644
index 0000000000..43dacda70a

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_wr_tg.h new file +40 -0
new file mode 100644
index 0000000000..491152bb97

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcie3.h new file +281 -0

281 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h new file +19 -0
new file mode 100644
index 0000000000..34c10c3bea

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt50b01_01.h new file +19 -0
new file mode 100644
index 0000000000..a3447de224

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcs.h new file +92 -0

92 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcs100.h new file +90 -0

90 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdb.h new file +47 -0

47 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h new file +48 -0

48 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h new file +196 -0

196 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h new file +19 -0
new file mode 100644
index 0000000000..87f255bfea

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt50b01_01.h new file +19 -0
new file mode 100644
index 0000000000..193598092d

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_qsl.h new file +65 -0

65 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_qspi.h new file +89 -0

89 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_r2drp.h new file +29 -0
new file mode 100644
index 0000000000..ffff2552fe

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rac.h new file +72 -0

72 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h new file +37 -0
new file mode 100644
index 0000000000..5e5a7e96d1

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rmc.h new file +35 -0
new file mode 100644
index 0000000000..7857314251

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_roa.h new file +67 -0

67 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h new file +30 -0
new file mode 100644
index 0000000000..90afca44c7

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpl.h new file +42 -0

42 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpp_lr.h new file +36 -0
new file mode 100644
index 0000000000..c8a6efb2b6

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9563.h new file +59 -0

59 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sdc.h new file +44 -0

44 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc.h new file +33 -0
new file mode 100644
index 0000000000..da257a9425

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc_lr.h new file +22 -0
new file mode 100644
index 0000000000..6d1cf03bd8

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h new file +75 -0

75 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h new file +50 -0

50 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h new file +59 -0

59 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tempmon.h new file +29 -0
new file mode 100644
index 0000000000..5c5190bb4f

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h new file +27 -0
new file mode 100644
index 0000000000..9ffcec3bf6

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h new file +294 -0

294 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cpy.h new file +22 -0
new file mode 100644
index 0000000000..2b156f9de9

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_csi.h new file +22 -0
new file mode 100644
index 0000000000..98d9bbc452

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cso.h new file +22 -0
new file mode 100644
index 0000000000..8b2d77878b

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_ins.h new file +22 -0
new file mode 100644
index 0000000000..48add8d788

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_rpl.h new file +22 -0
new file mode 100644
index 0000000000..2ddeadaf53

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.45.0

Part of the diff is not shown here. View the raw message.

#35 lore raw

PATCH v3 2/17 net/ntnic: add core platform functionality

Add ntnic platform interfaces for FPGA registers

---
v3:
* Fixed TYPO_SPELLING

---
 drivers/net/ntnic/nthw/nthw_drv.h          |  94 +++
 drivers/net/ntnic/nthw/nthw_epp.c          | 226 ++++++
 drivers/net/ntnic/nthw/nthw_epp.h          |  92 +++
 drivers/net/ntnic/nthw/nthw_helper.h       |  30 +
 drivers/net/ntnic/nthw/nthw_platform.c     |  52 ++
 drivers/net/ntnic/nthw/nthw_platform_drv.h |  49 ++
 drivers/net/ntnic/nthw/nthw_profile.h      |  16 +
 drivers/net/ntnic/nthw/nthw_rac.c          | 801 +++++++++++++++++++++
 drivers/net/ntnic/nthw/nthw_rac.h          | 154 ++++
 drivers/net/ntnic/nthw/nthw_register.h     |  22 +
 drivers/net/ntnic/nthw/nthw_utils.c        |  53 ++
 drivers/net/ntnic/nthw/nthw_utils.h        |  11 +
 12 files changed, 1600 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/nthw_drv.h
 create mode 100644 drivers/net/ntnic/nthw/nthw_epp.c
 create mode 100644 drivers/net/ntnic/nthw/nthw_epp.h
 create mode 100644 drivers/net/ntnic/nthw/nthw_helper.h
 create mode 100644 drivers/net/ntnic/nthw/nthw_platform.c
 create mode 100644 drivers/net/ntnic/nthw/nthw_platform_drv.h
 create mode 100644 drivers/net/ntnic/nthw/nthw_profile.h
 create mode 100644 drivers/net/ntnic/nthw/nthw_rac.c
 create mode 100644 drivers/net/ntnic/nthw/nthw_rac.h
 create mode 100644 drivers/net/ntnic/nthw/nthw_register.h
 create mode 100644 drivers/net/ntnic/nthw/nthw_utils.c
 create mode 100644 drivers/net/ntnic/nthw/nthw_utils.h
drivers/net/ntnic/nthw/nthw_drv.h new file +94 -0
new file mode 100644
index 0000000000..e9e25bbc29
@@ -0,0 +1,94 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_DRV_H__
+#define __NTHW_DRV_H__
+
+#include "nthw_profile.h"
+
+typedef enum nt_meta_port_type_e {
+	PORT_TYPE_PHYSICAL,
+	PORT_TYPE_VIRTUAL,
+	PORT_TYPE_OVERRIDE,
+} nt_meta_port_type_t;
+
+#include "nthw_helper.h"
+#include "nthw_utils.h"
+#include "nthw_platform_drv.h"
+#include "nthw_fpga_model.h"
+#include "ntnic_stat.h"
+#include "ntnic_dbs.h"
+#include "nthw_epp.h"
+#include "nthw_core.h"
+
+typedef struct mcu_info_s {
+	bool mb_has_mcu;
+	int mn_mcu_type;
+	int mn_mcu_dram_size;
+} mcu_info_t;
+
+typedef struct nthw_hw_info_s {
+	/* From FW */
+	int hw_id;
+	int hw_id_emulated;
+	char hw_plat_id_str[32];
+
+	struct vpd_info_s {
+		int mn_mac_addr_count;
+		uint64_t mn_mac_addr_value;
+		uint8_t ma_mac_addr_octets[6];
+	} vpd_info;
+} nthw_hw_info_t;
+
+typedef struct fpga_info_s {
+	uint64_t n_fpga_ident;
+
+	int n_fpga_type_id;
+	int n_fpga_prod_id;
+	int n_fpga_ver_id;
+	int n_fpga_rev_id;
+
+	int n_fpga_build_time;
+
+	int n_fpga_debug_mode;
+
+	int n_nims;
+	int n_phy_ports;
+	int n_phy_quads;
+	int n_rx_ports;
+	int n_tx_ports;
+	int n_vf_offset;
+
+	enum fpga_info_profile profile;
+
+	struct nthw_fpga_s *mp_fpga;
+
+	struct nthw_rac *mp_nthw_rac;
+	struct nthw_hif *mp_nthw_hif;
+	struct nthw_pcie3 *mp_nthw_pcie3;
+	struct nthw_tsm *mp_nthw_tsm;
+
+	nthw_dbs_t *mp_nthw_dbs;
+	nthw_epp_t *mp_nthw_epp;
+
+	uint8_t *bar0_addr;	/* Needed for register read/write */
+	size_t bar0_size;
+
+	int adapter_no;	/* Needed for nthw_rac DMA array indexing */
+	uint32_t pciident;	/* Needed for nthw_rac DMA memzone_reserve */
+	int numa_node;	/* Needed for nthw_rac DMA memzone_reserve */
+
+	char *mp_adapter_id_str;/* Pointer to string literal used in nthw log messages */
+
+	struct mcu_info_s mcu_info;
+
+	struct nthw_hw_info_s nthw_hw_info;
+
+	nthw_adapter_id_t n_nthw_adapter_id;
+
+} fpga_info_t;
+
+
+#endif	/* __NTHW_DRV_H__ */
drivers/net/ntnic/nthw/nthw_epp.c new file +226 -0

226 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_epp.h new file +92 -0

92 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_helper.h new file +30 -0
new file mode 100644
index 0000000000..d1bd5cec79
@@ -0,0 +1,30 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_HELPER_H__
+#define __NTHW_HELPER_H__
+
+#include <unistd.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+#include <assert.h>
+
+#ifndef PRIXPTR
+#define PRIXPTR "llX"
+#endif
+
+#ifndef UINT8_MAX
+#define UINT8_MAX (U8_MAX)
+#endif
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
+#endif	/* __NTHW_HELPER_H__ */
drivers/net/ntnic/nthw/nthw_platform.c new file +52 -0

52 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_platform_drv.h new file +49 -0

49 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_profile.h new file +16 -0
new file mode 100644
index 0000000000..d7ac30b20d
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_PROFILE_H__
+#define __NTHW_PROFILE_H__
+
+enum fpga_info_profile {
+	FPGA_INFO_PROFILE_UNKNOWN = 0,
+	FPGA_INFO_PROFILE_VSWITCH = 1,
+	FPGA_INFO_PROFILE_INLINE = 2,
+	FPGA_INFO_PROFILE_CAPTURE = 3,
+};
+
+#endif	/* __NTHW_PROFILE_H__ */
drivers/net/ntnic/nthw/nthw_rac.c new file +801 -0

801 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_rac.h new file +154 -0

154 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_register.h new file +22 -0
new file mode 100644
index 0000000000..ecc661a656
@@ -0,0 +1,22 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NTHW_REGISTER_H_
+#define NTHW_REGISTER_H_
+
+#include <unistd.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <inttypes.h>
+
+#include "nthw_fpga_model.h"
+
+#include "fpga_model.h"
+
+#include "nthw_fpga_mod_defs.h"
+#include "nthw_fpga_param_defs.h"
+#include "nthw_fpga_reg_defs.h"
+
+#endif	/* NTHW_REGISTER_H_ */
drivers/net/ntnic/nthw/nthw_utils.c new file +53 -0

53 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_utils.h new file +11 -0
new file mode 100644
index 0000000000..b1ac4977b3
@@ -0,0 +1,11 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_UTILS_H__
+#define __NTHW_UTILS_H__
+
+int socket_loopback_setup(uint16_t port);
+
+#endif	/* __NTHW_UTILS_H__ */
Signature · 1 line
2.45.0
#36 lore raw

PATCH v3 3/17 net/ntnic: add interfaces for platform functionality

In reply to Serhii Iliushyk

Add ntnic structures and prototypes for platform interfaces.

---
 .../nthw/core/include/nthw_clock_profiles.h   |  20 ++
 .../net/ntnic/nthw/core/include/nthw_core.h   |  32 +++
 .../net/ntnic/nthw/core/include/nthw_fpga.h   |  54 +++++
 .../ntnic/nthw/core/include/nthw_fpga_rst.h   |  18 ++
 .../net/ntnic/nthw/core/include/nthw_hif.h    | 152 +++++++++++++
 .../net/ntnic/nthw/core/include/nthw_igam.h   |  36 +++
 .../net/ntnic/nthw/core/include/nthw_iic.h    | 101 +++++++++
 .../nthw/core/include/nthw_mac_pcs_xxv.h      | 208 ++++++++++++++++++
 .../ntnic/nthw/core/include/nthw_mac_tfg.h    |  58 +++++
 .../net/ntnic/nthw/core/include/nthw_pcie3.h  |  99 +++++++++
 .../ntnic/nthw/core/include/nthw_phy_tile.h   | 123 +++++++++++
 .../net/ntnic/nthw/core/include/nthw_sdc.h    |  43 ++++
 .../net/ntnic/nthw/core/include/nthw_si5340.h |  33 +++
 .../net/ntnic/nthw/core/include/nthw_spi_v3.h | 105 +++++++++
 .../net/ntnic/nthw/core/include/nthw_spim.h   |  57 +++++
 .../net/ntnic/nthw/core/include/nthw_spis.h   |  62 ++++++
 .../net/ntnic/nthw/core/include/nthw_tsm.h    |  52 +++++
 17 files changed, 1253 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_clock_profiles.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_core.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_fpga.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_fpga_rst.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_hif.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_igam.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_iic.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_mac_pcs_xxv.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_mac_tfg.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcie3.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_sdc.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_si5340.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spim.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spis.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_tsm.h
drivers/net/ntnic/nthw/core/include/nthw_clock_profiles.h new file +20 -0
new file mode 100644
index 0000000000..bf8911bca2
@@ -0,0 +1,20 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _NTHW_CLOCK_PROFILES_H_
+#define _NTHW_CLOCK_PROFILES_H_
+
+/* TODO: figure out why static_assert(sizeof(x)...) does not work in plain C */
+#ifndef __cplusplus
+#ifndef __KERNEL__
+#include <assert.h>	/* static_assert */
+#endif	/* __KERNEL__ */
+#endif	/* __cplusplus */
+
+#include "nthw_helper.h"
+
+#include "clock_profiles_structs.h"
+
+#endif	/* _NTHW_CLOCK_PROFILES_H_ */
drivers/net/ntnic/nthw/core/include/nthw_core.h new file +32 -0
new file mode 100644
index 0000000000..f2d56a41f9
@@ -0,0 +1,32 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_CORE_H__
+#define __NTHW_CORE_H__
+
+#include "nthw_helper.h"
+#include "nthw_utils.h"
+
+#include "nthw_platform_drv.h"
+#include "nthw_fpga_model.h"
+#include "nthw_hif.h"
+#include "nthw_pcie3.h"
+#include "nthw_iic.h"
+
+#include "nthw_mac_pcs_xxv.h"
+#include "nthw_mac_tfg.h"
+#include "nthw_sdc.h"
+
+#include "nthw_spim.h"
+#include "nthw_spis.h"
+
+#include "nthw_tsm.h"
+
+#include "nthw_si5340.h"
+
+#include "nthw_phy_tile.h"
+#include "nthw_igam.h"
+
+#endif	/* __NTHW_CORE_H__ */
drivers/net/ntnic/nthw/core/include/nthw_fpga.h new file +54 -0

54 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_fpga_rst.h new file +18 -0
new file mode 100644
index 0000000000..206120fa37
@@ -0,0 +1,18 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_FPGA_RST_H__
+#define __NTHW_FPGA_RST_H__
+
+#include "nthw_drv.h"
+
+#include "nthw_fpga_model.h"
+
+#include "nthw_rac.h"
+#include "nthw_iic.h"
+
+#include "ntnic_nthw_fpga_rst_nt200a0x.h"
+
+#endif	/* __NTHW_FPGA_RST_H__ */
drivers/net/ntnic/nthw/core/include/nthw_hif.h new file +152 -0

152 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_igam.h new file +36 -0
new file mode 100644
index 0000000000..05c09cc89a
@@ -0,0 +1,36 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_IGAM_H__
+#define __NTHW_IGAM_H__
+
+#include "nthw_fpga_model.h"
+
+struct nt_igam {
+	nthw_fpga_t *mp_fpga;
+
+	nthw_module_t *mp_mod_igam;
+
+	int mn_igam_instance;
+
+	nthw_register_t *mp_reg_base;
+	nthw_field_t *mp_fld_base_ptr;
+	nthw_field_t *mp_fld_base_busy;
+	nthw_field_t *mp_fld_base_cmd;
+
+	nthw_register_t *mp_reg_data;
+	nthw_field_t *mp_fld_data_data;
+};
+
+typedef struct nt_igam nthw_igam_t;
+typedef struct nt_igam nthw_igam;
+
+nthw_igam_t *nthw_igam_new(void);
+void nthw_igam_delete(nthw_igam_t *p);
+int nthw_igam_init(nthw_igam_t *p, nthw_fpga_t *p_fpga, int mn_igam_instance);
+uint32_t nthw_igam_read(nthw_igam_t *p, uint32_t address);
+void nthw_igam_write(nthw_igam_t *p, uint32_t address, uint32_t data);
+
+#endif	/*  __NTHW_IGAM_H__ */
drivers/net/ntnic/nthw/core/include/nthw_iic.h new file +101 -0

101 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_mac_pcs_xxv.h new file +208 -0

208 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_mac_tfg.h new file +58 -0

58 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_pcie3.h new file +99 -0

99 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h new file +123 -0

123 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_sdc.h new file +43 -0

43 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_si5340.h new file +33 -0
new file mode 100644
index 0000000000..62e6c2d443
@@ -0,0 +1,33 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_SI5340_H__
+#define __NTHW_SI5340_H__
+
+#include "nthw_clock_profiles.h"
+
+#define SI5340_SUCCESS (0)
+#define SI5340_FAILED (999)
+#define SI5340_TIMEOUT (666)
+
+struct nthw_si5340 {
+	uint8_t mn_iic_addr;
+	nthw_iic_t *mp_nthw_iic;
+	int mn_clk_cfg;
+	uint8_t m_si5340_page;
+};
+
+typedef struct nthw_si5340 nthw_si5340_t;
+
+nthw_si5340_t *nthw_si5340_new(void);
+int nthw_si5340_init(nthw_si5340_t *p, nthw_iic_t *p_nthw_iic, uint8_t n_iic_addr);
+void nthw_si5340_delete(nthw_si5340_t *p);
+
+int nthw_si5340_config(nthw_si5340_t *p, const void *p_data, int data_cnt,
+	clk_profile_data_fmt_t data_format);
+int nthw_si5340_config_fmt2(nthw_si5340_t *p, const clk_profile_data_fmt2_t *p_data,
+	const int data_cnt);
+
+#endif	/* __NTHW_SI5338_H__ */
drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h new file +105 -0

105 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_spim.h new file +57 -0

57 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_spis.h new file +62 -0

62 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_tsm.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.45.0
#37 lore raw

PATCH v3 4/17 net/ntnic: add FPGA model implementation

In reply to Serhii Iliushyk

Add ntnic query FPGA functionality.

---
 .../net/ntnic/nthw/model/nthw_fpga_model.c    | 1218 +++++++++++++++++
 .../net/ntnic/nthw/model/nthw_fpga_model.h    |  247 ++++
 2 files changed, 1465 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/model/nthw_fpga_model.c
 create mode 100644 drivers/net/ntnic/nthw/model/nthw_fpga_model.h
drivers/net/ntnic/nthw/model/nthw_fpga_model.c new file +1218 -0
new file mode 100644
index 0000000000..36a7dfcf7a
@@ -0,0 +1,1218 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <time.h>	/* ctime */
+
+#include "nthw_drv.h"	/* fpga_info_s */
+#include "nthw_register.h"
+#include "nthw_fpga_model.h"
+#include "nthw_rac.h"
+#include "ntlog.h"
+
+/*
+ * NOTE: this needs to be (manually) synced with enum nthw_fpga_bus_type
+ */
+static const char *const sa_nthw_fpga_bus_type_str[] = {
+	"ERR",	/* NTHW_FPGA_BUS_TYPE_UNKNOWN, */
+	"BAR",	/* NTHW_FPGA_BUS_TYPE_BAR, */
+	"PCI",	/* NTHW_FPGA_BUS_TYPE_PCI, */
+	"CCIP",	/* NTHW_FPGA_BUS_TYPE_CCIP, */
+	"RAB0",	/* NTHW_FPGA_BUS_TYPE_RAB0, */
+	"RAB1",	/* NTHW_FPGA_BUS_TYPE_RAB1, */
+	"RAB2",	/* NTHW_FPGA_BUS_TYPE_RAB2, */
+	"NMB",	/* NTHW_FPGA_BUS_TYPE_NMB, */
+	"NDM",	/* NTHW_FPGA_BUS_TYPE_NDM, */
+};
+
+static const char *get_bus_name(int n_bus_type_id)
+{
+	if (n_bus_type_id >= 1 && n_bus_type_id <= (int)ARRAY_SIZE(sa_nthw_fpga_bus_type_str))
+		return sa_nthw_fpga_bus_type_str[n_bus_type_id];
+
+	else
+		return "ERR";
+}
+
+/*
+ * module name lookup by id from array
+ * Uses naive linear search as performance is not an issue here...
+ */
+
+static const struct {
+	const nthw_id_t a;
+	const char *b;
+} *sa_nthw_fpga_mod_str_map;
+
+static const char *nthw_fpga_mod_id_to_str(nthw_id_t n_fpga_mod_id)
+{
+	int i;
+
+	if (sa_nthw_fpga_mod_str_map) {
+		for (i = 0; sa_nthw_fpga_mod_str_map[i].a && sa_nthw_fpga_mod_str_map[i].b; i++)
+			if ((nthw_id_t)sa_nthw_fpga_mod_str_map[i].a == n_fpga_mod_id)
+				return sa_nthw_fpga_mod_str_map[i].b;
+	}
+
+	return "unknown";
+}
+
+static int nthw_read_data(struct fpga_info_s *p_fpga_info, bool trc, int n_bus_type_id,
+	uint32_t addr, uint32_t len, uint32_t *p_data)
+{
+	int rc = -1;
+
+	assert(p_fpga_info);
+	assert(p_data);
+	assert(len >= 1);
+
+	switch (n_bus_type_id) {
+	case NTHW_FPGA_BUS_TYPE_BAR:
+	case NTHW_FPGA_BUS_TYPE_PCI:
+		nthw_rac_bar0_read32(p_fpga_info, addr, len, p_data);
+		rc = 0;
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB0:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_read32(p_fpga_info->mp_nthw_rac, trc, 0, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB1:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_read32(p_fpga_info->mp_nthw_rac, trc, 1, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB2:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_read32(p_fpga_info->mp_nthw_rac, trc, 2, addr, len, p_data);
+		break;
+
+	default:
+		assert(false);
+		return -1;
+	}
+
+	return rc;
+}
+
+static int nthw_write_data(struct fpga_info_s *p_fpga_info, bool trc, int n_bus_type_id,
+	uint32_t addr, uint32_t len, const uint32_t *p_data)
+{
+	int rc = -1;
+
+	assert(p_fpga_info);
+	assert(p_data);
+	assert(len >= 1);
+
+	switch (n_bus_type_id) {
+	case NTHW_FPGA_BUS_TYPE_BAR:
+	case NTHW_FPGA_BUS_TYPE_PCI:
+		nthw_rac_bar0_write32(p_fpga_info, addr, len, p_data);
+		rc = 0;
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB0:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_write32(p_fpga_info->mp_nthw_rac, trc, 0, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB1:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_write32(p_fpga_info->mp_nthw_rac, trc, 1, addr, len, p_data);
+		break;
+
+	case NTHW_FPGA_BUS_TYPE_RAB2:
+		assert(p_fpga_info->mp_nthw_rac);
+		rc = nthw_rac_rab_write32(p_fpga_info->mp_nthw_rac, trc, 2, addr, len, p_data);
+		break;
+
+	default:
+		assert(false);
+		return -1;
+	}
+
+	return rc;
+}
+
+uint64_t nthw_fpga_read_ident(struct fpga_info_s *p_fpga_info)
+{
+	uint64_t n_fpga_ident;
+	uint32_t n_fpga_ident_lo, n_fpga_ident_hi;
+	nthw_rac_bar0_read32(p_fpga_info, 0x0, 1, &n_fpga_ident_lo);
+	nthw_rac_bar0_read32(p_fpga_info, 0x8, 1, &n_fpga_ident_hi);
+	n_fpga_ident = (((uint64_t)n_fpga_ident_hi << 32) | n_fpga_ident_lo);
+	return n_fpga_ident;
+}
+
+uint32_t nthw_fpga_read_buildtime(struct fpga_info_s *p_fpga_info)
+{
+	uint32_t n_fpga_build_time;
+	nthw_rac_bar0_read32(p_fpga_info, 0x10, 1, &n_fpga_build_time);
+	return n_fpga_build_time;
+}
+
+int nthw_fpga_extract_type_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)(n_fpga_ident >> 32) & 0xFF;
+}
+
+int nthw_fpga_extract_prod_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)(n_fpga_ident >> 16) & 0xFFFF;
+}
+
+int nthw_fpga_extract_ver_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)((n_fpga_ident >> 8) & 0xFF);
+}
+
+int nthw_fpga_extract_rev_id(const uint64_t n_fpga_ident)
+{
+	return (uint16_t)(n_fpga_ident & 0xFF);
+}
+
+/*
+ * FpgaMgr
+ */
+nthw_fpga_mgr_t *nthw_fpga_mgr_new(void)
+{
+	nthw_fpga_mgr_t *p = malloc(sizeof(nthw_fpga_mgr_t));
+	return p;
+}
+
+void nthw_fpga_mgr_delete(nthw_fpga_mgr_t *p)
+{
+	memset(p, 0, sizeof(nthw_fpga_mgr_t));
+	free(p);
+}
+
+void nthw_fpga_mgr_init(nthw_fpga_mgr_t *p, struct nthw_fpga_prod_init **pa_nthw_fpga_instances,
+	const void *pa_mod_str_map)
+{
+	size_t i = 0;
+
+	p->mpa_fpga_prod_init = pa_nthw_fpga_instances;
+	sa_nthw_fpga_mod_str_map = pa_mod_str_map;
+
+	/* Count fpga instance in array */
+	if (pa_nthw_fpga_instances) {
+		for (i = 0;; i++)
+			if (p->mpa_fpga_prod_init[i] == NULL)
+				break;
+	}
+
+	p->mn_fpgas = (int)i;
+}
+
+static nthw_fpga_t *nthw_fpga_mgr_lookup_fpga(nthw_fpga_mgr_t *p, uint64_t n_fpga_id,
+	struct fpga_info_s *p_fpga_info)
+{
+	const int n_fpga_prod_id = nthw_fpga_extract_prod_id(n_fpga_id);
+	const int n_fpga_ver = nthw_fpga_extract_ver_id(n_fpga_id);
+	const int n_fpga_rev = nthw_fpga_extract_rev_id(n_fpga_id);
+	int i;
+
+	for (i = 0; i < p->mn_fpgas; i++) {
+		nthw_fpga_prod_init_s *p_init = p->mpa_fpga_prod_init[i];
+
+		if (p_init->fpga_product_id == n_fpga_prod_id &&
+			p_init->fpga_version == n_fpga_ver && p_init->fpga_revision == n_fpga_rev) {
+			nthw_fpga_t *p_fpga = nthw_fpga_model_new();
+			nthw_fpga_model_init(p_fpga, p_init, p_fpga_info);
+			return p_fpga;
+		}
+	}
+
+	return NULL;
+}
+
+nthw_fpga_t *nthw_fpga_mgr_query_fpga(nthw_fpga_mgr_t *p_fpga_mgr, uint64_t n_fpga_id,
+	struct fpga_info_s *p_fpga_info)
+{
+	const int n_fpga_prod_id = nthw_fpga_extract_prod_id(n_fpga_id);
+	const int n_fpga_ver = nthw_fpga_extract_ver_id(n_fpga_id);
+	const int n_fpga_rev = nthw_fpga_extract_rev_id(n_fpga_id);
+
+	nthw_fpga_t *p_fpga = nthw_fpga_mgr_lookup_fpga(p_fpga_mgr, n_fpga_id, p_fpga_info);
+
+	if (p_fpga) {
+	} else {
+		NT_LOG(ERR, NTHW, "FPGA Id 0x%" PRIX64 ": %04d: %d.%d: no match found\n",
+			n_fpga_id, n_fpga_prod_id, n_fpga_ver, n_fpga_rev);
+	}
+
+	return p_fpga;
+}
+
+void nthw_fpga_mgr_show(nthw_fpga_mgr_t *p, FILE *fh_out, int detail_level)
+{
+	int i;
+
+	fprintf(fh_out, "\n");	/* start of records */
+
+	for (i = 0; i < p->mn_fpgas; i++) {
+		nthw_fpga_prod_init_s *p_init = p->mpa_fpga_prod_init[i];
+
+		if (detail_level == 0) {
+			fprintf(fh_out, "%04d-%02d-%02d\n", p_init->fpga_product_id,
+				p_init->fpga_version, p_init->fpga_revision);
+
+		} else {
+			time_t fpga_build_time = p_init->fpga_build_time;
+			fprintf(fh_out, "%04d-%02d-%02d: 0x%08lX: %s\n", p_init->fpga_product_id,
+				p_init->fpga_version, p_init->fpga_revision, fpga_build_time,
+				(fpga_build_time ? ctime(&fpga_build_time) : "NA\n"));
+		}
+	}
+
+	fprintf(fh_out, "\n");	/* end of records */
+	fflush(fh_out);
+}
+
+void nthw_fpga_mgr_log_dump(nthw_fpga_mgr_t *p)
+{
+	int i;
+
+	NT_LOG(DBG, NTHW, "%s: fpgas=%d\n", __func__, p->mn_fpgas);
+
+	for (i = 0; i < p->mn_fpgas; i++) {
+		nthw_fpga_prod_init_s *p_init = p->mpa_fpga_prod_init[i];
+		(void)p_init;
+		NT_LOG(DBG, NTHW, "%s: fpga=%d/%d: %04d-%02d-%02d\n", __func__, i, p->mn_fpgas,
+			p_init->fpga_product_id, p_init->fpga_version, p_init->fpga_revision);
+	}
+}
+
+/*
+ * Fpga
+ */
+nthw_fpga_t *nthw_fpga_model_new(void)
+{
+	nthw_fpga_t *p = malloc(sizeof(nthw_fpga_t));
+
+	if (p)
+		memset(p, 0, sizeof(nthw_fpga_t));
+
+	return p;
+}
+
+void nthw_fpga_model_init(nthw_fpga_t *p, nthw_fpga_prod_init_s *p_init,
+	struct fpga_info_s *p_fpga_info)
+{
+	int i;
+
+	p->p_fpga_info = p_fpga_info;
+	p->mp_init = p_init;
+
+	p->mn_item_id = p_init->fpga_item_id;
+	p->mn_product_id = p_init->fpga_product_id;
+	p->mn_fpga_version = p_init->fpga_version;
+	p->mn_fpga_revision = p_init->fpga_revision;
+	p->mn_fpga_patch_no = p_init->fpga_patch_no;
+	p->mn_fpga_build_no = p_init->fpga_build_no;
+	p->mn_fpga_build_time = p_init->fpga_build_time;
+
+	p->mn_params = p_init->nb_prod_params;
+
+	if (p->mn_params) {
+		p->mpa_params = malloc(p->mn_params * sizeof(nthw_param_t *));
+
+		if (p->mpa_params) {
+			memset(p->mpa_params, 0, (p->mn_params * sizeof(nthw_param_t *)));
+
+			for (i = 0; i < p->mn_params; i++) {
+				nthw_param_t *p_param = nthw_param_new();
+
+				nthw_param_init(p_param, p, &p_init->product_params[i]);
+				p->mpa_params[i] = p_param;
+			}
+		}
+	}
+
+	p->mn_modules = p_init->nb_modules;
+
+	if (p->mn_modules) {
+		p->mpa_modules = malloc(p_init->nb_modules * sizeof(nthw_module_t *));
+
+		if (p->mpa_modules) {
+			memset(p->mpa_modules, 0, (p->mn_modules * sizeof(nthw_module_t *)));
+
+			for (i = 0; i < p->mn_modules; i++) {
+				nthw_module_t *p_mod = nthw_module_new();
+
+				nthw_module_init(p_mod, p, &p_init->modules[i]);
+				p->mpa_modules[i] = p_mod;
+			}
+		}
+	}
+}
+
+void nthw_fpga_set_debug_mode(nthw_fpga_t *p, int debug_mode)
+{
+	int i;
+
+	p->m_debug_mode = debug_mode;
+
+	for (i = 0; i < p->mn_modules; i++) {
+		nthw_module_t *p_mod = p->mpa_modules[i];
+
+		if (p_mod)
+			nthw_module_set_debug_mode(p_mod, debug_mode);
+	}
+}
+
+static nthw_module_t *nthw_fpga_lookup_module(const nthw_fpga_t *p, nthw_id_t id, int instance)
+{
+	int i;
+
+	for (i = 0; i < p->mn_modules; i++) {
+		nthw_module_t *p_mod = p->mpa_modules[i];
+
+		if (p_mod->mn_mod_id == id && p_mod->mn_instance == instance)
+			return p_mod;
+	}
+
+	return NULL;
+}
+
+nthw_module_t *nthw_fpga_query_module(const nthw_fpga_t *p, nthw_id_t id, int instance)
+{
+	return nthw_fpga_lookup_module(p, id, instance);
+}
+
+int nthw_fpga_get_product_param(const nthw_fpga_t *p, const nthw_id_t n_param_id,
+	const int n_default_value)
+{
+	int i;
+
+	for (i = 0; i < p->mn_params; i++) {
+		nthw_param_t *p_param = p->mpa_params[i];
+
+		if (p_param->mn_param_id == n_param_id)
+			return p_param->mn_param_value;
+	}
+
+	return n_default_value;
+}
+
+int nthw_fpga_get_product_id(const nthw_fpga_t *p)
+{
+	return p->mn_product_id;
+}
+
+/*
+ * Param
+ */
+nthw_param_t *nthw_param_new(void)
+{
+	nthw_param_t *p = malloc(sizeof(nthw_param_t));
+
+	return p;
+}
+
+void nthw_param_init(nthw_param_t *p, nthw_fpga_t *p_fpga, nthw_fpga_prod_param_s *p_init)
+{
+	p->mp_owner = p_fpga;
+	p->mp_init = p_init;
+
+	p->mn_param_id = p_init->id;
+	p->mn_param_value = p_init->value;
+}
+
+/*
+ * Module
+ */
+nthw_module_t *nthw_module_new(void)
+{
+	nthw_module_t *p = malloc(sizeof(nthw_module_t));
+
+	return p;
+}
+
+void nthw_module_init(nthw_module_t *p, nthw_fpga_t *p_fpga, nthw_fpga_module_init_s *p_init)
+{
+	int i;
+
+	p->mp_owner = p_fpga;
+	p->mp_init = p_init;
+
+	p->mn_mod_id = p_init->id;
+	p->mn_instance = p_init->instance;
+
+	/* Copy debug mode from owner */
+	if (p->mp_owner)
+		p->mn_debug_mode = p->mp_owner->m_debug_mode;
+
+	else
+		p->mn_debug_mode = 0;
+
+	p->mn_mod_def_id = p_init->def_id;
+	p->mn_major_version = p_init->major_version;
+	p->mn_minor_version = p_init->minor_version;
+	p->mn_bus = p_init->bus_id;
+	p->mn_addr_base = p_init->addr_base;
+
+	p->mn_registers = p_init->nb_registers;
+
+	if (p->mn_registers) {
+		p->mpa_registers = malloc(p->mn_registers * sizeof(nthw_register_t *));
+
+		if (p->mpa_registers) {
+			memset(p->mpa_registers, 0, (p->mn_registers * sizeof(nthw_register_t *)));
+
+			for (i = 0; i < p->mn_registers; i++) {
+				nthw_register_t *p_reg = nthw_register_new();
+
+				nthw_register_init(p_reg, p, &p_init->registers[i]);
+				p->mpa_registers[i] = p_reg;
+			}
+		}
+	}
+}
+
+int nthw_module_get_major_version(const nthw_module_t *p)
+{
+	return p->mn_major_version;
+}
+
+int nthw_module_get_minor_version(const nthw_module_t *p)
+{
+	return p->mn_minor_version;
+}
+
+uint64_t nthw_module_get_version_packed64(const nthw_module_t *p)
+{
+	return (((uint64_t)p->mn_major_version & 0xFFFFFFFF) << 32) |
+		(p->mn_minor_version & 0xFFFFFFFF);
+}
+
+bool nthw_module_is_version_newer(const nthw_module_t *p, int major_version, int minor_version)
+{
+	if (major_version == p->mn_major_version)
+		return p->mn_minor_version >= minor_version;
+
+	return p->mn_major_version >= major_version;
+}
+
+static nthw_register_t *nthw_module_lookup_register(nthw_module_t *p, nthw_id_t id)
+{
+	int i;
+	nthw_register_t *p_register = NULL;
+
+	for (i = 0; i < p->mn_registers; i++) {
+		if (p->mpa_registers[i]->mn_id == id) {
+			p_register = p->mpa_registers[i];
+			break;
+		}
+	}
+
+	return p_register;
+}
+
+nthw_register_t *nthw_module_query_register(nthw_module_t *p, nthw_id_t id)
+{
+	return nthw_module_lookup_register(p, id);
+}
+
+nthw_register_t *nthw_module_get_register(nthw_module_t *p, nthw_id_t id)
+{
+	nthw_register_t *p_register;
+
+	if (p == NULL) {
+		NT_LOG(ERR, NTHW, "Illegal module context for register %u\n", id);
+		return NULL;
+	}
+
+	p_register = nthw_module_lookup_register(p, id);
+
+	if (!p_register) {
+		NT_LOG(ERR, NTHW, "Register %u not found in module: %s (%u)\n", id,
+			nthw_fpga_mod_id_to_str(p->mn_mod_id), p->mn_mod_id);
+	}
+
+	return p_register;
+}
+
+int nthw_module_get_debug_mode(const nthw_module_t *p)
+{
+	return p->mn_debug_mode;
+}
+
+void nthw_module_set_debug_mode(nthw_module_t *p, unsigned int debug_mode)
+{
+	int i;
+
+	p->mn_debug_mode = debug_mode;
+
+	for (i = 0; i < p->mn_registers; i++) {
+		nthw_register_t *p_register = p->mpa_registers[i];
+
+		if (p_register)
+			nthw_register_set_debug_mode(p_register, debug_mode);
+	}
+}
+
+int nthw_module_get_bus(const nthw_module_t *p)
+{
+	return p->mn_bus;
+}
+
+/*
+ * Register
+ */
+nthw_register_t *nthw_register_new(void)
+{
+	nthw_register_t *p = malloc(sizeof(nthw_register_t));
+
+	return p;
+}
+
+void nthw_register_init(nthw_register_t *p, nthw_module_t *p_module,
+	nthw_fpga_register_init_s *p_init)
+{
+	int i;
+
+	p->mp_owner = p_module;
+
+	p->mn_id = p_init->id;
+	p->mn_bit_width = p_init->bw;
+	p->mn_addr_rel = p_init->addr_rel;
+	p->mn_addr = p_module->mn_addr_base + p_init->addr_rel;
+	p->mn_type = p_init->type;
+	/* Old P200 registers have no bw at register level - default to BW=-1 */
+	p->mn_len = ((p_init->bw != (uint16_t)-1) ? ((p_init->bw + 31) >> 5) : 1);
+	p->mn_debug_mode = p_module->mn_debug_mode;
+
+	p->mn_fields = p_init->nb_fields;
+
+	if (p->mn_fields) {
+		p->mpa_fields = malloc(p->mn_fields * sizeof(nthw_field_t *));
+
+		if (p->mpa_fields) {
+			memset(p->mpa_fields, 0, (p->mn_fields * sizeof(nthw_field_t *)));
+
+			for (i = 0; i < p->mn_fields; i++) {
+				nthw_field_t *p_field = nthw_field_new();
+
+				nthw_field_init(p_field, p, &p_init->fields[i]);
+				p->mpa_fields[i] = p_field;
+			}
+
+			p->mp_shadow = malloc(p->mn_len * sizeof(uint32_t));
+
+			if (p->mp_shadow)
+				memset(p->mp_shadow, 0x00, (p->mn_len * sizeof(uint32_t)));
+
+			p->mp_dirty = malloc(p->mn_len * sizeof(bool));
+
+			if (p->mp_dirty)
+				memset(p->mp_dirty, 0x00, (p->mn_len * sizeof(bool)));
+		}
+	}
+}
+
+uint32_t nthw_register_get_address(const nthw_register_t *p)
+{
+	return p->mn_addr;
+}
+
+void nthw_register_reset(const nthw_register_t *p)
+{
+	int i;
+	nthw_field_t *p_field = NULL;
+
+	for (i = 0; i < p->mn_fields; i++) {
+		p_field = p->mpa_fields[i];
+
+		if (p_field)
+			nthw_field_reset(p_field);
+	}
+}
+
+static nthw_field_t *nthw_register_lookup_field(const nthw_register_t *p, nthw_id_t id)
+{
+	int i;
+	nthw_field_t *p_field = NULL;
+
+	if (!p)
+		return NULL;
+
+	for (i = 0; i < p->mn_fields; i++) {
+		if (p->mpa_fields[i]->mn_id == id) {
+			p_field = p->mpa_fields[i];
+			break;
+		}
+	}
+
+	return p_field;
+}
+
+nthw_field_t *nthw_register_query_field(const nthw_register_t *p, nthw_id_t id)
+{
+	return nthw_register_lookup_field(p, id);
+}
+
+nthw_field_t *nthw_register_get_field(const nthw_register_t *p, nthw_id_t id)
+{
+	nthw_field_t *p_field;
+
+	if (p == NULL) {
+		NT_LOG(ERR, NTHW, "Illegal register context for field %u\n", id);
+		return NULL;
+	}
+
+	p_field = nthw_register_lookup_field(p, id);
+
+	if (!p_field) {
+		NT_LOG(ERR, NTHW, "Field %u not found in module: %s (%u)\n", id,
+			nthw_fpga_mod_id_to_str(p->mp_owner->mn_mod_id), p->mp_owner->mn_mod_id);
+	}
+
+	return p_field;
+}
+
+int nthw_register_get_bit_width(const nthw_register_t *p)
+{
+	return p->mn_bit_width;
+}
+
+int nthw_register_get_debug_mode(const nthw_register_t *p)
+{
+	return p->mn_debug_mode;
+}
+
+/*
+ * NOTE: do not set debug on fields - as register operation dumps typically are enough
+ */
+void nthw_register_set_debug_mode(nthw_register_t *p, unsigned int debug_mode)
+{
+	int i;
+
+	p->mn_debug_mode = debug_mode;
+
+	for (i = 0; i < p->mn_fields; i++) {
+		nthw_field_t *p_field = p->mpa_fields[i];
+
+		if (p_field)
+			nthw_field_set_debug_mode(p_field, debug_mode);
+	}
+}
+
+static int nthw_register_read_data(const nthw_register_t *p)
+{
+	int rc = -1;
+
+	const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+	const uint32_t addr = p->mn_addr;
+	const uint32_t len = p->mn_len;
+	uint32_t *const p_data = p->mp_shadow;
+	const bool trc = (p->mn_debug_mode & NTHW_REG_TRACE_ON_READ);
+
+	struct fpga_info_s *p_fpga_info = NULL;
+
+	if (p && p->mp_owner && p->mp_owner->mp_owner)
+		p_fpga_info = p->mp_owner->mp_owner->p_fpga_info;
+
+	assert(p_fpga_info);
+	assert(p_data);
+
+	rc = nthw_read_data(p_fpga_info, trc, n_bus_type_id, addr, len, p_data);
+	return rc;
+}
+
+static int nthw_register_write_data(const nthw_register_t *p, uint32_t cnt)
+{
+	int rc = -1;
+
+	const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+	const uint32_t addr = p->mn_addr;
+	const uint32_t len = p->mn_len;
+	uint32_t *const p_data = p->mp_shadow;
+	const bool trc = (p->mn_debug_mode & NTHW_REG_TRACE_ON_WRITE);
+
+	struct fpga_info_s *p_fpga_info = NULL;
+
+	if (p && p->mp_owner && p->mp_owner->mp_owner)
+		p_fpga_info = p->mp_owner->mp_owner->p_fpga_info;
+
+	assert(p_fpga_info);
+	assert(p_data);
+
+	rc = nthw_write_data(p_fpga_info, trc, n_bus_type_id, addr, (len * cnt), p_data);
+
+	return rc;
+}
+
+void nthw_register_get_val(const nthw_register_t *p, uint32_t *p_data, uint32_t len)
+{
+	uint32_t i;
+
+	if (len == (uint32_t)-1 || len > p->mn_len)
+		len = p->mn_len;
+
+	assert(len <= p->mn_len);
+	assert(p_data);
+
+	for (i = 0; i < len; i++)
+		p_data[i] = p->mp_shadow[i];
+}
+
+uint32_t nthw_register_get_val32(const nthw_register_t *p)
+{
+	uint32_t val = 0;
+
+	nthw_register_get_val(p, &val, 1);
+	return val;
+}
+
+void nthw_register_update(const nthw_register_t *p)
+{
+	if (p && p->mn_type != NTHW_FPGA_REG_TYPE_WO) {
+		const char *const p_dev_name = "NA";
+		(void)p_dev_name;
+		const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+		const char *const p_bus_name = get_bus_name(n_bus_type_id);
+		(void)p_bus_name;
+		const uint32_t addr = p->mn_addr;
+		(void)addr;
+		const uint32_t len = p->mn_len;
+		uint32_t *const p_data = p->mp_shadow;
+
+		nthw_register_read_data(p);
+
+		if (p->mn_debug_mode & NTHW_REG_DEBUG_ON_READ) {
+			uint32_t i = len;
+			uint32_t *ptr = p_data;
+			(void)ptr;
+			char *tmp_string = ntlog_helper_str_alloc("Register::read");
+			ntlog_helper_str_add(tmp_string,
+				"(Dev: %s, Bus: %s, Addr: 0x%08X, Cnt: %d, Data:",
+				p_dev_name, p_bus_name, addr, len);
+
+			while (i--)
+				ntlog_helper_str_add(tmp_string, " 0x%08X", *ptr++);
+
+			ntlog_helper_str_add(tmp_string, ")");
+			NT_LOG(DBG, NTHW, "%s", tmp_string);
+			ntlog_helper_str_free(tmp_string);
+		}
+	}
+}
+
+uint32_t nthw_register_get_val_updated32(const nthw_register_t *p)
+{
+	uint32_t val = 0;
+
+	nthw_register_update(p);
+	nthw_register_get_val(p, &val, 1);
+	return val;
+}
+
+void nthw_register_make_dirty(nthw_register_t *p)
+{
+	uint32_t i;
+
+	for (i = 0; i < p->mn_len; i++)
+		p->mp_dirty[i] = true;
+}
+
+void nthw_register_set_val(nthw_register_t *p, const uint32_t *p_data, uint32_t len)
+{
+	assert(len <= p->mn_len);
+	assert(p_data);
+
+	if (len == (uint32_t)-1 || len > p->mn_len)
+		len = p->mn_len;
+
+	if (p->mp_shadow != p_data)
+		memcpy(p->mp_shadow, p_data, (len * sizeof(uint32_t)));
+}
+
+void nthw_register_flush(const nthw_register_t *p, uint32_t cnt)
+{
+	int rc;
+
+	if (p->mn_type != NTHW_FPGA_REG_TYPE_RO) {
+		const char *const p_dev_name = "NA";
+		const int n_bus_type_id = nthw_module_get_bus(p->mp_owner);
+		const char *p_bus_name = get_bus_name(n_bus_type_id);
+		const uint32_t addr = p->mn_addr;
+		const uint32_t len = p->mn_len;
+		uint32_t *const p_data = p->mp_shadow;
+		uint32_t i;
+
+		assert(len * cnt <= 256);
+
+		if (p->mn_debug_mode & NTHW_REG_DEBUG_ON_WRITE) {
+			uint32_t i = len * cnt;
+			uint32_t *ptr = p_data;
+			char *tmp_string = ntlog_helper_str_alloc("Register::write");
+
+			ntlog_helper_str_add(tmp_string,
+				"(Dev: %s, Bus: %s, Addr: 0x%08X, Cnt: %d, Data:",
+				p_dev_name, p_bus_name, addr, i);
+
+			while (i--)
+				ntlog_helper_str_add(tmp_string, " 0x%08X", *ptr++);
+
+			ntlog_helper_str_add(tmp_string, ")");
+			NT_LOG(DBG, NTHW, "%s", tmp_string);
+			ntlog_helper_str_free(tmp_string);
+		}
+
+		rc = nthw_register_write_data(p, cnt);
+
+		if (rc)
+			NT_LOG(ERR, NTHW, "Register write error %d\n", rc);
+
+		for (i = 0; i < cnt; i++)
+			p->mp_dirty[i] = false;
+	}
+}
+
+void nthw_register_clr(nthw_register_t *p)
+{
+	memset(p->mp_shadow, 0, p->mn_len * sizeof(uint32_t));
+	nthw_register_make_dirty(p);
+}
+
+/*
+ * Field
+ */
+nthw_field_t *nthw_field_new(void)
+{
+	nthw_field_t *p = malloc(sizeof(nthw_field_t));
+
+	return p;
+}
+
+void nthw_field_init(nthw_field_t *p, nthw_register_t *p_reg, const nthw_fpga_field_init_s *p_init)
+{
+	p->mp_owner = p_reg;
+
+	p->mn_debug_mode = p_reg->mn_debug_mode;
+
+	p->mn_id = p_init->id;
+	p->mn_bit_width = p_init->bw;
+	p->mn_bit_pos_low = p_init->low;
+	p->mn_reset_val = (uint32_t)p_init->reset_val;
+	p->mn_first_word = p_init->low / 32;
+	p->mn_first_bit = p_init->low % 32;
+	p->mn_front_mask = 0;
+	p->mn_body_length = 0;
+	p->mn_words = (p_init->bw + 0x1f) / 0x20;
+	p->mn_tail_mask = 0;
+
+	{
+		int bits_remaining = p_init->bw;
+		int front_mask_length = 32 - p->mn_first_bit;
+
+		if (front_mask_length > bits_remaining)
+			front_mask_length = bits_remaining;
+
+		bits_remaining -= front_mask_length;
+
+		p->mn_front_mask =
+			(uint32_t)(((1ULL << front_mask_length) - 1) << p->mn_first_bit);
+
+		p->mn_body_length = bits_remaining / 32;
+		bits_remaining -= p->mn_body_length * 32;
+		p->mn_tail_mask = (1 << bits_remaining) - 1;
+
+		if (p->mn_debug_mode >= 0x100) {
+			NT_LOG(DBG, NTHW,
+				"%s: fldid=%08d: [%08d:%08d] %08d/%08d: (%08d,%08d) (0x%08X,%08d,0x%08X)\n",
+				__func__, p_init->id, p_init->low, (p_init->low + p_init->bw),
+				p_init->bw, ((p_init->bw + 31) / 32), p->mn_first_word,
+				p->mn_first_bit, p->mn_front_mask, p->mn_body_length,
+				p->mn_tail_mask);
+		}
+	}
+}
+
+int nthw_field_get_debug_mode(const nthw_field_t *p)
+{
+	return p->mn_debug_mode;
+}
+
+void nthw_field_set_debug_mode(nthw_field_t *p, unsigned int debug_mode)
+{
+	p->mn_debug_mode = debug_mode;
+}
+
+int nthw_field_get_bit_width(const nthw_field_t *p)
+{
+	return p->mn_bit_width;
+}
+
+int nthw_field_get_bit_pos_low(const nthw_field_t *p)
+{
+	return p->mn_bit_pos_low;
+}
+
+int nthw_field_get_bit_pos_high(const nthw_field_t *p)
+{
+	return p->mn_bit_pos_low + p->mn_bit_width - 1;
+}
+
+uint32_t nthw_field_get_mask(const nthw_field_t *p)
+{
+	return p->mn_front_mask;
+}
+
+void nthw_field_reset(const nthw_field_t *p)
+{
+	nthw_field_set_val32(p, (uint32_t)p->mn_reset_val);
+}
+
+void nthw_field_get_val(const nthw_field_t *p, uint32_t *p_data, uint32_t len)
+{
+	uint32_t i;
+	uint32_t data_index = 0;
+	uint32_t shadow_index = p->mn_first_word;
+
+	union {
+		uint32_t w32[2];
+		uint64_t w64;
+	} buf;
+
+	(void)len;
+	assert(len <= p->mn_words);
+
+	/* handle front */
+	buf.w32[0] = p->mp_owner->mp_shadow[shadow_index++] & p->mn_front_mask;
+
+	/* handle body */
+	for (i = 0; i < p->mn_body_length; i++) {
+		buf.w32[1] = p->mp_owner->mp_shadow[shadow_index++];
+		buf.w64 = buf.w64 >> (p->mn_first_bit);
+		assert(data_index < len);
+		p_data[data_index++] = buf.w32[0];
+		buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+	}
+
+	/* handle tail */
+	if (p->mn_tail_mask)
+		buf.w32[1] = p->mp_owner->mp_shadow[shadow_index++] & p->mn_tail_mask;
+
+	else
+		buf.w32[1] = 0;
+
+	buf.w64 = buf.w64 >> (p->mn_first_bit);
+	p_data[data_index++] = buf.w32[0];
+
+	if (data_index < p->mn_words)
+		p_data[data_index++] = buf.w32[1];
+}
+
+void nthw_field_set_val(const nthw_field_t *p, const uint32_t *p_data, uint32_t len)
+{
+	uint32_t i;
+	uint32_t data_index = 0;
+	uint32_t shadow_index = p->mn_first_word;
+
+	union {
+		uint32_t w32[2];
+		uint64_t w64;
+	} buf;
+
+	(void)len;
+	assert(len == p->mn_words);
+
+	/* handle front */
+	buf.w32[0] = 0;
+	buf.w32[1] = p_data[data_index++];
+	buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+	p->mp_owner->mp_shadow[shadow_index] =
+		(p->mp_owner->mp_shadow[shadow_index] & ~p->mn_front_mask) |
+		(buf.w32[0] & p->mn_front_mask);
+	shadow_index++;
+
+	/* handle body */
+	for (i = 0; i < p->mn_body_length; i++) {
+		buf.w64 = buf.w64 >> (p->mn_first_bit);
+		assert(data_index < len);
+		buf.w32[1] = p_data[data_index++];
+		buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+		p->mp_owner->mp_shadow[shadow_index++] = buf.w32[0];
+	}
+
+	/* handle tail */
+	if (p->mn_tail_mask) {
+		buf.w64 = buf.w64 >> (p->mn_first_bit);
+
+		if (data_index < len)
+			buf.w32[1] = p_data[data_index];
+
+		buf.w64 = buf.w64 >> (32 - p->mn_first_bit);
+		p->mp_owner->mp_shadow[shadow_index] =
+			(p->mp_owner->mp_shadow[shadow_index] & ~p->mn_tail_mask) |
+			(buf.w32[0] & p->mn_tail_mask);
+	}
+
+	nthw_register_make_dirty(p->mp_owner);
+}
+
+void nthw_field_set_val_flush(const nthw_field_t *p, const uint32_t *p_data, uint32_t len)
+{
+	nthw_field_set_val(p, p_data, len);
+	nthw_field_flush_register(p);
+}
+
+uint32_t nthw_field_get_val32(const nthw_field_t *p)
+{
+	uint32_t val;
+
+	nthw_field_get_val(p, &val, 1);
+	return val;
+}
+
+uint32_t nthw_field_get_updated(const nthw_field_t *p)
+{
+	uint32_t val;
+
+	nthw_register_update(p->mp_owner);
+	nthw_field_get_val(p, &val, 1);
+
+	return val;
+}
+
+void nthw_field_update_register(const nthw_field_t *p)
+{
+	nthw_register_update(p->mp_owner);
+}
+
+void nthw_field_flush_register(const nthw_field_t *p)
+{
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+void nthw_field_set_val32(const nthw_field_t *p, uint32_t val)
+{
+	nthw_field_set_val(p, &val, 1);
+}
+
+void nthw_field_set_val_flush32(const nthw_field_t *p, uint32_t val)
+{
+	nthw_field_set_val(p, &val, 1);
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+void nthw_field_clr_all(const nthw_field_t *p)
+{
+	assert(p->mn_body_length == 0);
+	nthw_field_set_val32(p, 0);
+}
+
+void nthw_field_clr_flush(const nthw_field_t *p)
+{
+	nthw_field_clr_all(p);
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+void nthw_field_set_all(const nthw_field_t *p)
+{
+	assert(p->mn_body_length == 0);
+	nthw_field_set_val32(p, ~0);
+}
+
+void nthw_field_set_flush(const nthw_field_t *p)
+{
+	nthw_field_set_all(p);
+	nthw_register_flush(p->mp_owner, 1);
+}
+
+enum nthw_field_match {
+	NTHW_FIELD_MATCH_CLR_ALL,
+	NTHW_FIELD_MATCH_SET_ALL,
+	NTHW_FIELD_MATCH_CLR_ANY,
+	NTHW_FIELD_MATCH_SET_ANY,
+};
+
+static int nthw_field_wait_cond32(const nthw_field_t *p, enum nthw_field_match e_match,
+	int n_poll_iterations, int n_poll_interval)
+{
+	const uint32_t n_mask = (1 << p->mn_bit_width) - 1;
+
+	if (n_poll_iterations == -1)
+		n_poll_iterations = 10000;
+
+	if (n_poll_interval == -1)
+		n_poll_interval = 100;	/* usec */
+
+	if (p->mn_debug_mode) {
+		const char *const p_cond_name =
+			((e_match == NTHW_FIELD_MATCH_SET_ALL)
+				? "SetAll"
+				: ((e_match == NTHW_FIELD_MATCH_CLR_ALL)
+					? "ClrAll"
+					: ((e_match == NTHW_FIELD_MATCH_CLR_ANY) ? "ClrAny"
+						: "SetAny")));
+		(void)p_cond_name;
+		const char *const p_dev_name = "NA";
+		(void)p_dev_name;
+		const char *const p_bus_name =
+			get_bus_name(nthw_module_get_bus(p->mp_owner->mp_owner));
+		(void)p_bus_name;
+		uint32_t n_reg_addr = nthw_register_get_address(p->mp_owner);
+		(void)n_reg_addr;
+		uint32_t n_reg_mask = (((1 << p->mn_bit_width) - 1) << p->mn_bit_pos_low);
+		(void)n_reg_mask;
+
+		NT_LOG(DBG, NTHW,
+			"Register::Field::wait%s32(Dev: %s, Bus: %s, Addr: 0x%08X, Mask: 0x%08X, Iterations: %d, Interval: %d)\n",
+			p_cond_name, p_dev_name, p_bus_name, n_reg_addr, n_reg_mask,
+			n_poll_iterations, n_poll_interval);
+	}
+
+	while (true) {
+		uint32_t val = nthw_field_get_updated(p);
+
+		if (e_match == NTHW_FIELD_MATCH_SET_ANY && val != 0) {
+			return 0;
+
+		} else if (e_match == NTHW_FIELD_MATCH_SET_ALL && val == n_mask) {
+			return 0;
+
+		} else if (e_match == NTHW_FIELD_MATCH_CLR_ALL && val == 0) {
+			return 0;
+
+		} else if (e_match == NTHW_FIELD_MATCH_CLR_ANY) {
+			uint32_t mask = nthw_field_get_mask(p);
+
+			if (val != mask)
+				return 0;
+		}
+
+		n_poll_iterations--;
+
+		if (n_poll_iterations <= 0)
+			return -1;
+
+		nt_os_wait_usec(n_poll_interval);
+	}
+
+	return 0;
+}
+
+int nthw_field_wait_set_all32(const nthw_field_t *p, int n_poll_iterations, int n_poll_interval)
+{
+	return nthw_field_wait_cond32(p, NTHW_FIELD_MATCH_SET_ALL, n_poll_iterations,
+			n_poll_interval);
+}
+
+int nthw_field_wait_clr_all32(const nthw_field_t *p, int n_poll_iterations, int n_poll_interval)
+{
+	return nthw_field_wait_cond32(p, NTHW_FIELD_MATCH_CLR_ALL, n_poll_iterations,
+			n_poll_interval);
+}
+
+int nthw_field_wait_set_any32(const nthw_field_t *p, int n_poll_iterations, int n_poll_interval)
+{
+	return nthw_field_wait_cond32(p, NTHW_FIELD_MATCH_SET_ANY, n_poll_iterations,
+			n_poll_interval);
+}
+
+/* EOF */
drivers/net/ntnic/nthw/model/nthw_fpga_model.h new file +247 -0

247 lines not on this page · raw message

Signature · 1 line
2.45.0
#38 lore raw

PATCH v3 5/17 net/ntnic: add NTNIC adapter interfaces

In reply to Serhii Iliushyk

Add ntnic adapter interfaces structures.

---
v2:
* Fixed unused header.
v3:
* Remove pthread and left rte_thread

---
 .../ntnic/include/clock_profiles_structs.h    |  69 +++++++
 .../net/ntnic/include/common_adapter_defs.h   |  15 ++
 drivers/net/ntnic/include/fpga_model.h        | 153 +++++++++++++++
 drivers/net/ntnic/include/nt4ga_adapter.h     | 105 ++++++++++
 drivers/net/ntnic/include/nt4ga_pci_ta_tg.h   |  42 ++++
 drivers/net/ntnic/include/nt4ga_tfg.h         |  18 ++
 drivers/net/ntnic/include/ntdrv_4ga.h         |  33 ++++
 drivers/net/ntnic/include/nthw_bus.h          |  20 ++
 drivers/net/ntnic/include/ntos_drv.h          | 179 ++++++++++++++++++
 drivers/net/ntnic/include/ntos_system.h       |  25 +++
 drivers/net/ntnic/include/ntoss_virt_queue.h  | 163 ++++++++++++++++
 11 files changed, 822 insertions(+)
 create mode 100644 drivers/net/ntnic/include/clock_profiles_structs.h
 create mode 100644 drivers/net/ntnic/include/common_adapter_defs.h
 create mode 100644 drivers/net/ntnic/include/fpga_model.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_adapter.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_pci_ta_tg.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_tfg.h
 create mode 100644 drivers/net/ntnic/include/ntdrv_4ga.h
 create mode 100644 drivers/net/ntnic/include/nthw_bus.h
 create mode 100644 drivers/net/ntnic/include/ntos_drv.h
 create mode 100644 drivers/net/ntnic/include/ntos_system.h
 create mode 100644 drivers/net/ntnic/include/ntoss_virt_queue.h
drivers/net/ntnic/include/clock_profiles_structs.h new file +69 -0
new file mode 100644
index 0000000000..0f967453aa
@@ -0,0 +1,69 @@
+/* */
+/* clock_profiles_structs.h */
+/* */
+
+/*
+ * %NT_SOFTWARE_LICENSE%
+ */
+
+#ifndef _NT_CLOCK_PROFILES_STRUCTS_H_
+#define _NT_CLOCK_PROFILES_STRUCTS_H_
+
+/* */
+/* */
+/* */
+#include <stdint.h>
+
+/* */
+/* */
+/* */
+#define GET_VAR_NAME(var) #var
+
+#define clk_profile_size_error_msg "Size test failed"
+
+/* */
+/* */
+/* */
+struct clk_profile_data_fmt0_s {
+	unsigned char reg_addr;
+	unsigned char reg_val;
+	unsigned char reg_mask;
+};
+
+struct clk_profile_data_fmt1_s {
+	uint16_t reg_addr;
+	uint8_t reg_val;
+};
+
+struct clk_profile_data_fmt2_s {
+	unsigned int reg_addr;
+	unsigned char reg_val;
+};
+
+struct clk_profile_data_fmt3_s {
+	unsigned int address;
+	unsigned int data;
+};
+
+typedef struct clk_profile_data_fmt0_s clk_profile_data_fmt0_t;
+typedef struct clk_profile_data_fmt1_s clk_profile_data_fmt1_t;
+typedef struct clk_profile_data_fmt2_s clk_profile_data_fmt2_t;
+typedef struct clk_profile_data_fmt3_s clk_profile_data_fmt3_t;
+
+enum clk_profile_data_fmt_e {
+	clk_profile_data_fmt_0,
+	clk_profile_data_fmt_1,
+	clk_profile_data_fmt_2,
+	clk_profile_data_fmt_3,
+};
+
+typedef enum clk_profile_data_fmt_e clk_profile_data_fmt_t;
+
+/* */
+/* */
+/* */
+#endif	/* _NT_CLOCK_PROFILES_STRUCTS_H_ */
+
+/* */
+/* EOF */
+/* */
drivers/net/ntnic/include/common_adapter_defs.h new file +15 -0
new file mode 100644
index 0000000000..6ed9121f0f
@@ -0,0 +1,15 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _COMMON_ADAPTER_DEFS_H_
+#define _COMMON_ADAPTER_DEFS_H_
+
+/*
+ * Declarations shared by NT adapter types.
+ */
+#define NUM_ADAPTER_MAX (8)
+#define NUM_ADAPTER_PORTS_MAX (128)
+
+#endif	/* _COMMON_ADAPTER_DEFS_H_ */
drivers/net/ntnic/include/fpga_model.h new file +153 -0

153 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_adapter.h new file +105 -0

105 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_pci_ta_tg.h new file +42 -0

42 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_tfg.h new file +18 -0
new file mode 100644
index 0000000000..9797403dec
@@ -0,0 +1,18 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_TFG_H_
+#define NT4GA_TFG_H_
+
+typedef struct nt4ga_tfg_s {
+	nthw_mac_tfg_t *mp_nthw_mac_tfg;
+} nt4ga_tfg_t;
+
+int nt4ga_tfg_init(struct adapter_info_s *p_adapter_info);
+int nt4ga_tfg_setup(struct adapter_info_s *p_adapter_info, const int n_intf_no,
+	const int n_cmd_start_stop, const int n_frame_count, const int n_frame_size,
+	const int n_frame_fill_mode, const int n_frame_stream_id);
+
+#endif	/* NT4GA_TFG_H_ */
drivers/net/ntnic/include/ntdrv_4ga.h new file +33 -0
new file mode 100644
index 0000000000..cae25ecfa6
@@ -0,0 +1,33 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTDRV_4GA_H__
+#define __NTDRV_4GA_H__
+
+#include <rte_version.h>
+#include <rte_thread.h>
+#include "nthw_drv.h"
+#include "nt4ga_adapter.h"
+#include "nthw_platform_drv.h"
+
+typedef struct ntdrv_4ga_s {
+	uint32_t pciident;
+	struct adapter_info_s adapter_info;
+	char *p_drv_name;
+
+	volatile bool b_shutdown;
+	pthread_mutex_t stat_lck;
+#if RTE_VERSION_NUM(23, 11, 0, 0) < RTE_VERSION
+	rte_thread_t stat_thread;
+	rte_thread_t flm_thread;
+	rte_thread_t port_event_thread;
+#else
+	pthread_t stat_thread;
+	pthread_t flm_thread;
+	pthread_t port_event_thread;
+#endif
+} ntdrv_4ga_t;
+
+#endif	/* __NTDRV_4GA_H__ */
drivers/net/ntnic/include/nthw_bus.h new file +20 -0
new file mode 100644
index 0000000000..9d1532335b
@@ -0,0 +1,20 @@
+/* */
+/* nthw_bus.h */
+/* */
+
+/* */
+/* */
+/* */
+#ifndef __NTHW_BUS_H__
+#define __NTHW_BUS_H__
+
+/* */
+/* */
+/* */
+typedef uint8_t nthw_rab_bus_id_t;
+
+#endif	/* __NTHW_BUS_H__ */
+
+/* */
+/* EOF */
+/* */
drivers/net/ntnic/include/ntos_drv.h new file +179 -0

179 lines not on this page · raw message

drivers/net/ntnic/include/ntos_system.h new file +25 -0
new file mode 100644
index 0000000000..cf4768799d
@@ -0,0 +1,25 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTOS_SYSTEM_H__
+#define __NTOS_SYSTEM_H__
+
+#include "include/ntdrv_4ga.h"
+
+/*
+ * struct drv_s for DPDK (clone of kernel struct)
+ * keep it as close as possible to original kernel struct
+ */
+struct drv_s {
+	int adapter_no;
+	struct rte_pci_device *p_dev;
+	struct ntdrv_4ga_s ntdrv;
+
+	int n_eth_dev_init_count;
+	int probe_finished;
+	int setup_finished;
+};
+
+#endif	/* __NTOS_SYSTEM_H__ */
drivers/net/ntnic/include/ntoss_virt_queue.h new file +163 -0

163 lines not on this page · raw message

Signature · 1 line
2.45.0
#39 lore raw

PATCH v3 6/17 net/ntnic: add interfaces for PMD driver modules

In reply to Serhii Iliushyk

Add ntnic base interfaces for: link, NIM, sensors, statistics.

---
 drivers/net/ntnic/include/nt4ga_link.h        | 132 +++++
 drivers/net/ntnic/include/ntnic_dbs.h         | 356 ++++++++++++
 drivers/net/ntnic/include/ntnic_nim.h         | 160 ++++++
 .../include/ntnic_nthw_fpga_rst_nt200a0x.h    |  82 +++
 drivers/net/ntnic/include/ntnic_sensor.h      | 515 ++++++++++++++++++
 drivers/net/ntnic/include/ntnic_stat.h        | 291 ++++++++++
 6 files changed, 1536 insertions(+)
 create mode 100644 drivers/net/ntnic/include/nt4ga_link.h
 create mode 100644 drivers/net/ntnic/include/ntnic_dbs.h
 create mode 100644 drivers/net/ntnic/include/ntnic_nim.h
 create mode 100644 drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt200a0x.h
 create mode 100644 drivers/net/ntnic/include/ntnic_sensor.h
 create mode 100644 drivers/net/ntnic/include/ntnic_stat.h
drivers/net/ntnic/include/nt4ga_link.h new file +132 -0
new file mode 100644
index 0000000000..49e1c5d672
@@ -0,0 +1,132 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_LINK_H_
+#define NT4GA_LINK_H_
+
+#include "common_adapter_defs.h"
+#include "nthw_drv.h"
+#include "ntnic_nim.h"
+#include "ntnic_nthw_fpga_rst_nt200a0x.h"
+
+/*
+ * Link state.\n
+ * Just after start of ntservice the link state might be unknown since the
+ * monitoring routine is busy reading NIM state and NIM data. This might also
+ * be the case after a NIM is plugged into an interface.
+ * The error state indicates a HW reading error.
+ */
+enum nt_link_state_e {
+	NT_LINK_STATE_UNKNOWN = 0,	/* The link state has not been read yet */
+	NT_LINK_STATE_DOWN = 1,	/* The link state is DOWN */
+	NT_LINK_STATE_UP = 2,	/* The link state is UP */
+	NT_LINK_STATE_ERROR = 3	/* The link state could not be read */
+};
+
+typedef enum nt_link_state_e nt_link_state_t, *nt_link_state_p;
+
+/*
+ * Link duplex mode
+ */
+enum nt_link_duplex_e {
+	NT_LINK_DUPLEX_UNKNOWN = 0,
+	NT_LINK_DUPLEX_HALF = 0x01,	/* Half duplex */
+	NT_LINK_DUPLEX_FULL = 0x02,	/* Full duplex */
+};
+
+typedef enum nt_link_duplex_e nt_link_duplex_t;
+
+/*
+ * Link loopback mode
+ */
+enum nt_link_loopback_e {
+	NT_LINK_LOOPBACK_OFF = 0,
+	NT_LINK_LOOPBACK_HOST = 0x01,	/* Host loopback mode */
+	NT_LINK_LOOPBACK_LINE = 0x02,	/* Line loopback mode */
+};
+
+/*
+ * Link MDI mode
+ */
+enum nt_link_mdi_e {
+	NT_LINK_MDI_NA = 0,
+	NT_LINK_MDI_AUTO = 0x01,/* MDI auto */
+	NT_LINK_MDI_MDI = 0x02,	/* MDI mode */
+	NT_LINK_MDI_MDIX = 0x04,/* MDIX mode */
+};
+
+typedef enum nt_link_mdi_e nt_link_mdi_t;
+
+/*
+ * Link Auto/Manual mode
+ */
+enum nt_link_auto_neg_e {
+	NT_LINK_AUTONEG_NA = 0,
+	NT_LINK_AUTONEG_MANUAL = 0x01,
+	NT_LINK_AUTONEG_OFF = NT_LINK_AUTONEG_MANUAL,	/* Auto negotiation OFF */
+	NT_LINK_AUTONEG_AUTO = 0x02,
+	NT_LINK_AUTONEG_ON = NT_LINK_AUTONEG_AUTO,	/* Auto negotiation ON */
+};
+
+typedef enum nt_link_auto_neg_e nt_link_auto_neg_t;
+
+/*
+ * Callback functions to setup mac, pcs and phy
+ */
+typedef struct link_state_s {
+	bool link_disabled;
+	bool nim_present;
+	bool lh_nim_absent;
+	bool link_up;
+	enum nt_link_state_e link_state;
+	enum nt_link_state_e link_state_latched;
+} link_state_t;
+
+/*
+ * Link speed.
+ * Note this is a bitmask.
+ */
+enum nt_link_speed_e {
+	NT_LINK_SPEED_UNKNOWN = 0,
+	NT_LINK_SPEED_10M = 0x01,	/* 10 Mbps */
+	NT_LINK_SPEED_100M = 0x02,	/* 100 Mbps */
+	NT_LINK_SPEED_1G = 0x04,/* 1 Gbps  (Autoneg only) */
+	NT_LINK_SPEED_10G = 0x08,	/* 10 Gbps (Autoneg only) */
+	NT_LINK_SPEED_40G = 0x10,	/* 40 Gbps (Autoneg only) */
+	NT_LINK_SPEED_100G = 0x20,	/* 100 Gbps (Autoneg only) */
+	NT_LINK_SPEED_50G = 0x40,	/* 50 Gbps (Autoneg only) */
+	NT_LINK_SPEED_25G = 0x80,	/* 25 Gbps (Autoneg only) */
+	NT_LINK_SPEED_END	/* always keep this entry as the last in enum */
+};
+typedef enum nt_link_speed_e nt_link_speed_t;
+
+typedef struct link_info_s {
+	enum nt_link_speed_e link_speed;
+	enum nt_link_duplex_e link_duplex;
+	enum nt_link_auto_neg_e link_auto_neg;
+} link_info_t;
+
+typedef struct port_action_s {
+	bool port_disable;
+	enum nt_link_speed_e port_speed;
+	enum nt_link_duplex_e port_duplex;
+	uint32_t port_lpbk_mode;
+} port_action_t;
+
+typedef union adapter_var_s {
+	nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX];	/* First field in all the adaptors type */
+} adapter_var_u;
+
+typedef struct nt4ga_link_s {
+	link_state_t link_state[NUM_ADAPTER_PORTS_MAX];
+	link_info_t link_info[NUM_ADAPTER_PORTS_MAX];
+	port_action_t port_action[NUM_ADAPTER_PORTS_MAX];
+	uint32_t speed_capa;
+	/* */
+	bool variables_initialized;
+	adapter_var_u u;
+} nt4ga_link_t;
+
+#endif	/* NT4GA_LINK_H_ */
drivers/net/ntnic/include/ntnic_dbs.h new file +356 -0

356 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_nim.h new file +160 -0

160 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt200a0x.h new file +82 -0

82 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_sensor.h new file +515 -0

515 lines not on this page · raw message

drivers/net/ntnic/include/ntnic_stat.h new file +291 -0

291 lines not on this page · raw message

Signature · 1 line
2.45.0
#40 lore raw

PATCH v3 7/17 net/ntnic: add API for PMD driver modules

In reply to Serhii Iliushyk

Add API for ntnic PMD driver modules,
thus allow modules to be enabled/disabled.

---
v2:
* Fixed WARNING:TYPO_SPELLING

---
 drivers/net/ntnic/dpdk_mod_reg.c  |  64 ++++
 drivers/net/ntnic/dpdk_mod_reg.h  | 167 ++++++++++
 drivers/net/ntnic/ntnic_mod_reg.c | 382 ++++++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h | 512 ++++++++++++++++++++++++++++++
 4 files changed, 1125 insertions(+)
 create mode 100644 drivers/net/ntnic/dpdk_mod_reg.c
 create mode 100644 drivers/net/ntnic/dpdk_mod_reg.h
 create mode 100644 drivers/net/ntnic/ntnic_mod_reg.c
 create mode 100644 drivers/net/ntnic/ntnic_mod_reg.h
drivers/net/ntnic/dpdk_mod_reg.c new file +64 -0
new file mode 100644
index 0000000000..dec3e54dc0
@@ -0,0 +1,64 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <rte_flow_driver.h>
+#include "dpdk_mod_reg.h"
+
+static struct sg_ops_s *sg_ops;
+
+void register_sg_ops(struct sg_ops_s *ops)
+{
+	sg_ops = ops;
+}
+
+const struct sg_ops_s *get_sg_ops(void)
+{
+	return sg_ops;
+}
+
+/*
+ *
+ */
+static struct meter_ops_s *meter_ops;
+
+void register_meter_ops(struct meter_ops_s *ops)
+{
+	meter_ops = ops;
+}
+
+const struct meter_ops_s *get_meter_ops(void)
+{
+	return meter_ops;
+}
+
+/*
+ *
+ */
+static const struct ntnic_filter_ops *ntnic_filter_ops;
+
+void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops)
+{
+	ntnic_filter_ops = ops;
+}
+
+const struct ntnic_filter_ops *get_ntnic_filter_ops(void)
+{
+	return ntnic_filter_ops;
+}
+
+/*
+ *
+ */
+static struct ntnic_xstats_ops *ntnic_xstats_ops;
+
+void register_ntnic_xstats_ops(struct ntnic_xstats_ops *ops)
+{
+	ntnic_xstats_ops = ops;
+}
+
+struct ntnic_xstats_ops *get_ntnic_xstats_ops(void)
+{
+	return ntnic_xstats_ops;
+}
drivers/net/ntnic/dpdk_mod_reg.h new file +167 -0

167 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.c new file +382 -0

382 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h new file +512 -0

512 lines not on this page · raw message

Signature · 1 line
2.45.0
#41 lore raw

PATCH v3 8/17 net/ntnic: add interfaces for flow API engine

In reply to Serhii Iliushyk

Add ntnic basic flow filter functionality.

---
 drivers/net/ntnic/include/flow_api.h          |  89 ++
 drivers/net/ntnic/include/flow_api_actions.h  |  13 +
 drivers/net/ntnic/include/flow_api_engine.h   |  46 +
 drivers/net/ntnic/include/flow_filter.h       |  15 +
 drivers/net/ntnic/include/hw_mod_backend.h    |  70 ++
 drivers/net/ntnic/include/nt4ga_filter.h      |  16 +
 .../ntnic/include/stream_binary_flow_api.h    | 946 ++++++++++++++++++
 7 files changed, 1195 insertions(+)
 create mode 100644 drivers/net/ntnic/include/flow_api.h
 create mode 100644 drivers/net/ntnic/include/flow_api_actions.h
 create mode 100644 drivers/net/ntnic/include/flow_api_engine.h
 create mode 100644 drivers/net/ntnic/include/flow_filter.h
 create mode 100644 drivers/net/ntnic/include/hw_mod_backend.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_filter.h
 create mode 100644 drivers/net/ntnic/include/stream_binary_flow_api.h
drivers/net/ntnic/include/flow_api.h new file +89 -0
new file mode 100644
index 0000000000..4ccdbcde14
@@ -0,0 +1,89 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_API_H_
+#define _FLOW_API_H_
+
+#include <pthread.h>
+#include <stdint.h>
+#include <assert.h>
+
+#include "ntlog.h"
+
+#include "flow_api_actions.h"
+#include "flow_api_engine.h"
+#include "hw_mod_backend.h"
+#include "stream_binary_flow_api.h"
+
+/*
+ * Flow NIC and Eth port device management
+ */
+
+struct hw_mod_resource_s {
+	uint8_t *alloc_bm;	/* allocation bitmap */
+	uint32_t *ref;	/* reference counter for each resource element */
+	uint32_t resource_count;/* number of total available entries */
+};
+
+struct flow_eth_dev {
+	struct flow_nic_dev *ndev;	/* NIC that owns this port device */
+	uint8_t port;	/* NIC port id */
+	uint32_t port_id;	/* App assigned port_id - may be DPDK port_id */
+
+	struct flow_queue_id_s rx_queue[FLOW_MAX_QUEUES + 1];	/* 0th for exception */
+	int num_queues;	/* VSWITCH has exceptions sent on queue 0 per design */
+
+	int rss_target_id;	/* QSL_HSH index if RSS needed QSL v6+ */
+	struct flow_eth_dev *next;
+};
+
+enum flow_nic_hash_e {
+	HASH_ALGO_ROUND_ROBIN = 0,
+	HASH_ALGO_5TUPLE,
+};
+
+/* registered NIC backends */
+struct flow_nic_dev {
+	uint8_t adapter_no;	/* physical adapter no in the host system */
+	uint16_t ports;	/* number of in-ports addressable on this NIC */
+	enum flow_eth_dev_profile
+	flow_profile;	/* flow profile this NIC is initially prepared for */
+	int flow_mgnt_prepared;
+
+	struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */
+	void *km_res_handle;
+	void *kcc_res_handle;
+
+	void *flm_mtr_handle;
+	void *group_handle;
+	void *hw_db_handle;
+	void *id_table_handle;
+
+	/* statistics */
+	uint32_t flow_stat_id_map[MAX_COLOR_FLOW_STATS];
+
+	uint32_t flow_unique_id_counter;
+	/* linked list of all flows created on this NIC */
+	struct flow_handle *flow_base;
+	/* linked list of all FLM flows created on this NIC */
+	struct flow_handle *flow_base_flm;
+	pthread_mutex_t flow_mtx;
+
+	/* NIC backend API */
+	struct flow_api_backend_s be;
+	/* linked list of created eth-port devices on this NIC */
+	struct flow_eth_dev *eth_base;
+	pthread_mutex_t mtx;
+
+	/* pre allocated default QSL Drop */
+	int default_qsl_drop_index;
+	/* pre allocated default QSL Discard */
+	int default_qsl_discard_index;
+
+	/* next NIC linked list */
+	struct flow_nic_dev *next;
+};
+
+#endif
drivers/net/ntnic/include/flow_api_actions.h new file +13 -0
new file mode 100644
index 0000000000..f62cda5dc5
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_ACTIONS_H_
+#define _FLOW_ACTIONS_H_
+
+#include <stdint.h>
+
+#define MAX_COLOR_FLOW_STATS 0x400
+
+#endif	/* _FLOW_ACTIONS_H_ */
drivers/net/ntnic/include/flow_api_engine.h new file +46 -0

46 lines not on this page · raw message

drivers/net/ntnic/include/flow_filter.h new file +15 -0
new file mode 100644
index 0000000000..53f77a9b60
@@ -0,0 +1,15 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __FLOW_FILTER_HPP__
+#define __FLOW_FILTER_HPP__
+
+#include "flow_api.h"
+#include "nthw_fpga_model.h"
+
+int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no);
+int flow_filter_done(struct flow_nic_dev *dev);
+
+#endif	/* __FLOW_FILTER_HPP__ */
drivers/net/ntnic/include/hw_mod_backend.h new file +70 -0

70 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_filter.h new file +16 -0
new file mode 100644
index 0000000000..8d1abbd2ee
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_FILTER_H_
+#define NT4GA_FILTER_H_
+
+typedef struct nt4ga_filter_s {
+	int n_intf_cnt;
+	int n_queues_per_intf_cnt;
+
+	struct flow_nic_dev *mp_flow_device;
+} nt4ga_filter_t;
+
+#endif	/* NT4GA_FILTER_H_ */
drivers/net/ntnic/include/stream_binary_flow_api.h new file +946 -0

946 lines not on this page · raw message

Signature · 1 line
2.45.0
#42 lore raw

PATCH v3 9/17 net/ntnic: add VFIO module

In reply to Serhii Iliushyk

Add ntnic VFIO functionality.

---
 drivers/net/ntnic/ntnic_vfio.c | 232 +++++++++++++++++++++++++++++++++
 drivers/net/ntnic/ntnic_vfio.h |  21 +++
 2 files changed, 253 insertions(+)
 create mode 100644 drivers/net/ntnic/ntnic_vfio.c
 create mode 100644 drivers/net/ntnic/ntnic_vfio.h
drivers/net/ntnic/ntnic_vfio.c new file +232 -0
new file mode 100644
index 0000000000..116c238be6
@@ -0,0 +1,232 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <sys/ioctl.h>
+
+#include <rte_malloc.h>
+#include <rte_memory.h>
+#include <rte_vfio.h>
+#include <rte_dev.h>
+#include <rte_bus_pci.h>
+#include <rte_spinlock.h>
+
+#include <ntlog.h>
+#include <nt_util.h>
+#include "ntnic_vfio.h"
+
+#define ONE_G_SIZE 0x40000000
+#define ONE_G_MASK (ONE_G_SIZE - 1)
+#define START_VF_IOVA 0x220000000000
+
+int nt_vfio_vf_num(const struct rte_pci_device *pdev)
+{
+	return ((pdev->addr.devid & 0x1f) << 3) + ((pdev->addr.function) & 0x7);
+}
+
+/* Internal API */
+struct vfio_dev {
+	int container_fd;
+	int group_fd;
+	int dev_fd;
+	uint64_t iova_addr;
+};
+
+static struct vfio_dev vfio_list[256];
+
+static struct vfio_dev *vfio_get(int vf_num)
+{
+	if (vf_num < 0 || vf_num > 255)
+		return NULL;
+
+	return &vfio_list[vf_num];
+}
+
+/* External API */
+int nt_vfio_setup(struct rte_pci_device *dev)
+{
+	char devname[RTE_DEV_NAME_MAX_LEN] = { 0 };
+	int iommu_group_num;
+	int vf_num;
+	struct vfio_dev *vfio;
+
+	NT_LOG(INF, ETHDEV, "NT VFIO device setup %s\n", dev->name);
+
+	vf_num = nt_vfio_vf_num(dev);
+
+	vfio = vfio_get(vf_num);
+
+	if (vfio == NULL) {
+		NT_LOG(ERR, ETHDEV, "VFIO device setup failed. Illegal device id\n");
+		return -1;
+	}
+
+	vfio->dev_fd = -1;
+	vfio->group_fd = -1;
+	vfio->container_fd = -1;
+	vfio->iova_addr = START_VF_IOVA;
+
+	rte_pci_device_name(&dev->addr, devname, RTE_DEV_NAME_MAX_LEN);
+	rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname, &iommu_group_num);
+
+	if (vf_num == 0) {
+		/* use default container for pf0 */
+		vfio->container_fd = RTE_VFIO_DEFAULT_CONTAINER_FD;
+
+	} else {
+		vfio->container_fd = rte_vfio_container_create();
+
+		if (vfio->container_fd < 0) {
+			NT_LOG(ERR, ETHDEV,
+				"VFIO device setup failed. VFIO container creation failed.\n");
+			return -1;
+		}
+	}
+
+	vfio->group_fd = rte_vfio_container_group_bind(vfio->container_fd, iommu_group_num);
+
+	if (vfio->group_fd < 0) {
+		NT_LOG(ERR, ETHDEV,
+			"VFIO device setup failed. VFIO container group bind failed.\n");
+		goto err;
+	}
+
+	if (vf_num > 0) {
+		if (rte_pci_map_device(dev)) {
+			NT_LOG(ERR, ETHDEV,
+				"Map VFIO device failed. is the vfio-pci driver loaded?\n");
+			goto err;
+		}
+	}
+
+	vfio->dev_fd = rte_intr_dev_fd_get(dev->intr_handle);
+
+	NT_LOG(DBG, ETHDEV,
+		"%s: VFIO id=%d, dev_fd=%d, container_fd=%d, group_fd=%d, iommu_group_num=%d\n",
+		dev->name, vf_num, vfio->dev_fd, vfio->container_fd, vfio->group_fd,
+		iommu_group_num);
+
+	return vf_num;
+
+err:
+
+	if (vfio->container_fd != RTE_VFIO_DEFAULT_CONTAINER_FD)
+		rte_vfio_container_destroy(vfio->container_fd);
+
+	return -1;
+}
+
+int nt_vfio_remove(int vf_num)
+{
+	struct vfio_dev *vfio;
+
+	NT_LOG(DBG, ETHDEV, "NT VFIO device remove VF=%d\n", vf_num);
+
+	vfio = vfio_get(vf_num);
+
+	if (!vfio) {
+		NT_LOG(ERR, ETHDEV, "VFIO device remove failed. Illegal device id\n");
+		return -1;
+	}
+
+	rte_vfio_container_destroy(vfio->container_fd);
+	return 0;
+}
+
+int nt_vfio_dma_map(int vf_num, void *virt_addr, uint64_t *iova_addr, uint64_t size)
+{
+	uint64_t gp_virt_base;
+	uint64_t gp_offset;
+
+	if (size == ONE_G_SIZE) {
+		gp_virt_base = (uint64_t)virt_addr & ~ONE_G_MASK;
+		gp_offset = (uint64_t)virt_addr & ONE_G_MASK;
+
+	} else {
+		gp_virt_base = (uint64_t)virt_addr;
+		gp_offset = 0;
+	}
+
+	struct vfio_dev *vfio;
+
+	vfio = vfio_get(vf_num);
+
+	if (vfio == NULL) {
+		NT_LOG(ERR, ETHDEV, "VFIO MAP: VF number %d invalid\n", vf_num);
+		return -1;
+	}
+
+	NT_LOG(DBG, ETHDEV,
+		"VFIO MMAP VF=%d VirtAddr=%" PRIX64 " HPA=%" PRIX64 " VirtBase=%" PRIX64
+		" IOVA Addr=%" PRIX64 " size=%d\n",
+		vf_num, virt_addr, rte_malloc_virt2iova(virt_addr), gp_virt_base, vfio->iova_addr,
+		size);
+
+	int res = rte_vfio_container_dma_map(vfio->container_fd, gp_virt_base, vfio->iova_addr,
+			size);
+
+	NT_LOG(DBG, ETHDEV, "VFIO MMAP res %i, container_fd %i, vf_num %i\n", res,
+		vfio->container_fd, vf_num);
+
+	if (res) {
+		NT_LOG(ERR, ETHDEV, "rte_vfio_container_dma_map failed: res %d\n", res);
+		return -1;
+	}
+
+	*iova_addr = vfio->iova_addr + gp_offset;
+
+	vfio->iova_addr += ONE_G_SIZE;
+
+	return 0;
+}
+
+int nt_vfio_dma_unmap(int vf_num, void *virt_addr, uint64_t iova_addr, uint64_t size)
+{
+	uint64_t gp_virt_base;
+	struct vfio_dev *vfio;
+
+	if (size == ONE_G_SIZE) {
+		uint64_t gp_offset;
+		gp_virt_base = (uint64_t)virt_addr & ~ONE_G_MASK;
+		gp_offset = (uint64_t)virt_addr & ONE_G_MASK;
+		iova_addr -= gp_offset;
+
+	} else {
+		gp_virt_base = (uint64_t)virt_addr;
+	}
+
+	vfio = vfio_get(vf_num);
+
+	if (vfio == NULL) {
+		NT_LOG(ERR, ETHDEV, "VFIO UNMAP: VF number %d invalid\n", vf_num);
+		return -1;
+	}
+
+	if (vfio->container_fd == -1)
+		return 0;
+
+	int res = rte_vfio_container_dma_unmap(vfio->container_fd, gp_virt_base, iova_addr, size);
+
+	if (res != 0) {
+		NT_LOG(ERR, ETHDEV,
+			"VFIO UNMMAP FAILED! res %i, container_fd %i, vf_num %i, virt_base=%" PRIX64
+			", IOVA=%" PRIX64 ", size=%llu\n",
+			res, vfio->container_fd, vf_num, gp_virt_base, iova_addr, size);
+		return -1;
+	}
+
+	return 0;
+}
+
+/* Internal init */
+
+RTE_INIT(nt_vfio_init);
+
+static void nt_vfio_init(void)
+{
+	struct nt_util_vfio_impl s = { .vfio_dma_map = nt_vfio_dma_map,
+		       .vfio_dma_unmap = nt_vfio_dma_unmap
+	};
+	nt_util_vfio_init(&s);
+}
drivers/net/ntnic/ntnic_vfio.h new file +21 -0
new file mode 100644
index 0000000000..0e3b12f847
@@ -0,0 +1,21 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _NTNIC_VFIO_H_
+#define _NTNIC_VFIO_H_
+
+#include <rte_dev.h>
+#include <rte_bus_pci.h>
+#include <ethdev_pci.h>
+
+int nt_vfio_setup(struct rte_pci_device *dev);
+int nt_vfio_remove(int vf_num);
+
+int nt_vfio_dma_map(int vf_num, void *virt_addr, uint64_t *iova_addr, uint64_t size);
+int nt_vfio_dma_unmap(int vf_num, void *virt_addr, uint64_t iova_addr, uint64_t size);
+
+/* Find device (PF/VF) number from device address */
+int nt_vfio_vf_num(const struct rte_pci_device *dev);
+#endif	/* _NTNIC_VFIO_H_ */
Signature · 1 line
2.45.0
#43 lore raw

PATCH v3 10/17 net/ntnic: add Logs and utilities implementation

In reply to Serhii Iliushyk

Add ntnic logging API and utilities.

---
v2:
* Fixed unused header
* Fixed error on -Wformat-nonliteral

---
 drivers/net/ntnic/ntlog/include/ntlog.h    | 162 +++++++++++++++++++++
 drivers/net/ntnic/ntlog/ntlog.c            | 111 ++++++++++++++
 drivers/net/ntnic/ntutil/include/nt_util.h |  51 +++++++
 drivers/net/ntnic/ntutil/nt_util.c         |  97 ++++++++++++
 4 files changed, 421 insertions(+)
 create mode 100644 drivers/net/ntnic/ntlog/include/ntlog.h
 create mode 100644 drivers/net/ntnic/ntlog/ntlog.c
 create mode 100644 drivers/net/ntnic/ntutil/include/nt_util.h
 create mode 100644 drivers/net/ntnic/ntutil/nt_util.c
drivers/net/ntnic/ntlog/include/ntlog.h new file +162 -0
new file mode 100644
index 0000000000..75fc08d4e1
@@ -0,0 +1,162 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NTOSS_SYSTEM_NTLOG_H
+#define NTOSS_SYSTEM_NTLOG_H
+
+#include <stdarg.h>
+#include <stdint.h>
+
+#ifndef NT_LOG_MODULE_PREFIX
+
+/* DPDK modules */
+#define NT_LOG_MODULE_EAL 0
+#define NT_LOG_MODULE_MALLOC 1
+#define NT_LOG_MODULE_RING 2
+#define NT_LOG_MODULE_MEMPOOL 3
+#define NT_LOG_MODULE_TIMER 4
+#define NT_LOG_MODULE_PMD 5
+#define NT_LOG_MODULE_HASH 6
+#define NT_LOG_MODULE_LPM 7
+#define NT_LOG_MODULE_KNI 8
+#define NT_LOG_MODULE_ACL 9
+#define NT_LOG_MODULE_POWER 10
+#define NT_LOG_MODULE_METER 11
+#define NT_LOG_MODULE_SCHED 12
+#define NT_LOG_MODULE_PORT 13
+#define NT_LOG_MODULE_TABLE 14
+#define NT_LOG_MODULE_PIPELINE 15
+#define NT_LOG_MODULE_MBUF 16
+#define NT_LOG_MODULE_CRYPTODEV 17
+#define NT_LOG_MODULE_EFD 18
+#define NT_LOG_MODULE_EVENTDEV 19
+#define NT_LOG_MODULE_GSO 20
+#define NT_LOG_MODULE_USER1 24
+#define NT_LOG_MODULE_USER2 25
+#define NT_LOG_MODULE_USER3 26
+#define NT_LOG_MODULE_USER4 27
+#define NT_LOG_MODULE_USER5 28
+#define NT_LOG_MODULE_USER6 29
+#define NT_LOG_MODULE_USER7 30
+#define NT_LOG_MODULE_USER8 31
+
+/* NT modules */
+#define NT_LOG_MODULE_GENERAL 10000	/* Should always be a first (smallest) */
+#define NT_LOG_MODULE_NTHW 10001
+#define NT_LOG_MODULE_FILTER 10002
+#define NT_LOG_MODULE_DRV 10003
+#define NT_LOG_MODULE_VDPA 10004
+#define NT_LOG_MODULE_FPGA 10005
+#define NT_LOG_MODULE_NTCONNECT 10006
+#define NT_LOG_MODULE_ETHDEV 10007
+#define NT_LOG_MODULE_SENSOR 10008
+#define NT_LOG_MODULE_END 10009	/* Mark for the range end of NT_LOG */
+
+#define NT_LOG_MODULE_COUNT (NT_LOG_MODULE_END - NT_LOG_MODULE_GENERAL)
+#define NT_LOG_MODULE_INDEX(module) ((module) - (NT_LOG_MODULE_GENERAL))
+#define NT_LOG_MODULE_PREFIX(type) NT_LOG_MODULE_##type
+
+#endif
+
+#ifndef NT_LOG_ENABLE
+#define NT_LOG_ENABLE 1
+#endif
+
+#if defined NT_LOG_ENABLE && NT_LOG_ENABLE > 0
+#ifndef NT_LOG_ENABLE_ERR
+#define NT_LOG_ENABLE_ERR 1
+#endif
+#ifndef NT_LOG_ENABLE_WRN
+#define NT_LOG_ENABLE_WRN 1
+#endif
+#ifndef NT_LOG_ENABLE_INF
+#define NT_LOG_ENABLE_INF 1
+#endif
+#ifndef NT_LOG_ENABLE_DBG
+#define NT_LOG_ENABLE_DBG 1
+#endif
+#ifndef NT_LOG_ENABLE_DB1
+#define NT_LOG_ENABLE_DB1 0
+#endif
+#ifndef NT_LOG_ENABLE_DB2
+#define NT_LOG_ENABLE_DB2 0
+#endif
+#endif
+
+#if defined NT_LOG_ENABLE_ERR && NT_LOG_ENABLE_ERR > 0
+#define NT_LOG_NT_LOG_ERR(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_ERR(...)
+#endif
+
+#if defined NT_LOG_ENABLE_WRN && NT_LOG_ENABLE_WRN > 0
+#define NT_LOG_NT_LOG_WRN(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_WRN(...)
+#endif
+
+#if defined NT_LOG_ENABLE_INF && NT_LOG_ENABLE_INF > 0
+#define NT_LOG_NT_LOG_INF(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_INF(...)
+#endif
+
+#if defined NT_LOG_ENABLE_DBG && NT_LOG_ENABLE_DBG > 0
+#define NT_LOG_NT_LOG_DBG(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_DBG(...)
+#endif
+
+#if defined NT_LOG_ENABLE_DB1 && NT_LOG_ENABLE_DB1 > 0
+#define NT_LOG_NT_LOG_DB1(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_DB1(...)
+#endif
+
+#if defined NT_LOG_ENABLE_DB2 && NT_LOG_ENABLE_DB2 > 0
+#define NT_LOG_NT_LOG_DB2(...) nt_log(__VA_ARGS__)
+#else
+#define NT_LOG_NT_LOG_DB2(...)
+#endif
+
+#define NT_LOG(level, module, ...)                                                                \
+	NT_LOG_NT_LOG_##level(NT_LOG_##level, NT_LOG_MODULE_PREFIX(module),                       \
+			      #module ": " #level ": " __VA_ARGS__)
+
+enum nt_log_level {
+	NT_LOG_ERR = 0x001,
+	NT_LOG_WRN = 0x002,
+	NT_LOG_INF = 0x004,
+	NT_LOG_DBG = 0x008,
+	NT_LOG_DB1 = 0x010,
+	NT_LOG_DB2 = 0x020,
+};
+
+struct nt_log_impl {
+	int (*init)(void);
+	int (*log)(enum nt_log_level level, uint32_t module, const char *format, va_list args);
+	int (*is_debug)(uint32_t module);
+};
+
+int nt_log_init(struct nt_log_impl *impl);
+
+int nt_log(enum nt_log_level level, uint32_t module, const char *format, ...);
+
+/* Returns 1 if RTE_DEBUG, 0 if lower log level, -1 if incorrect module */
+int nt_log_is_debug(uint32_t module);
+
+/*
+ * nt log helper functions
+ * to create a string for NT_LOG usage to output a one-liner log
+ * to use when one single function call to NT_LOG is not optimal - that is
+ * you do not know the number of parameters at programming time or it is variable
+ */
+char *ntlog_helper_str_alloc(const char *sinit);
+
+void ntlog_helper_str_add(char *s, const char *format, ...);
+
+void ntlog_helper_str_free(char *s);
+
+#endif	/* NTOSS_SYSTEM_NTLOG_H */
drivers/net/ntnic/ntlog/ntlog.c new file +111 -0

111 lines not on this page · raw message

drivers/net/ntnic/ntutil/include/nt_util.h new file +51 -0

51 lines not on this page · raw message

drivers/net/ntnic/ntutil/nt_util.c new file +97 -0

97 lines not on this page · raw message

Signature · 1 line
2.45.0
#44 lore raw

PATCH v3 11/17 net/ntnic: add ethdev and makes PMD available

In reply to Serhii Iliushyk

Add ethdev to ntnic.

---
v2:
* Fixed error on -Wformat-nonliteral
* Fixed WARNING:TYPO_SPELLING
* Fixed commented lines in meson file
* Fixed unused functions
v3:
* Remove experimental API flag
* Remove pthread and left rte_thread

---
 .mailmap                           |    1 +
 MAINTAINERS                        |    6 +
 doc/guides/nics/features/ntnic.ini |    9 +
 doc/guides/nics/index.rst          |    1 +
 doc/guides/nics/ntnic.rst          |  115 +++
 drivers/net/meson.build            |    1 +
 drivers/net/ntnic/meson.build      |   92 ++
 drivers/net/ntnic/ntnic_ethdev.c   | 1508 ++++++++++++++++++++++++++++
 drivers/net/ntnic/ntnic_ethdev.h   |   32 +
 drivers/net/ntnic/rte_pmd_ntnic.h  |   43 +
 10 files changed, 1808 insertions(+)
 create mode 100644 doc/guides/nics/features/ntnic.ini
 create mode 100644 doc/guides/nics/ntnic.rst
 create mode 100644 drivers/net/ntnic/meson.build
 create mode 100644 drivers/net/ntnic/ntnic_ethdev.c
 create mode 100644 drivers/net/ntnic/ntnic_ethdev.h
 create mode 100644 drivers/net/ntnic/rte_pmd_ntnic.h
.mailmap +1 -0
index 87fa24714e..99719b74a1 100644
@@ -1288,6 +1288,7 @@ Sergey Madaminov <[email protected]>
 Sergey Mironov <[email protected]>
 Sergey Temerkhanov <[email protected]>
 Sergio Gonzalez Monroy <[email protected]>
+Serhii Iliushyk <[email protected]>
 Seth Arnold <[email protected]>
 Seth Howell <[email protected]>
 Shachar Beiser <[email protected]>
MAINTAINERS +6 -0
index c9adff9846..27e818d050 100644
@@ -1063,6 +1063,12 @@ F: drivers/net/memif/
 F: doc/guides/nics/memif.rst
 F: doc/guides/nics/features/memif.ini
 
+NTNIC PMD
+M: Christian Koue Muf <[email protected]>
+M: Serhii Iliushyk <[email protected]>
+F: drivers/net/ntnic/
+F: doc/guides/nics/ntnic.rst
+F: doc/guides/nics/features/ntnic.ini
 
 Crypto Drivers
 --------------
doc/guides/nics/features/ntnic.ini new file +9 -0
new file mode 100644
index 0000000000..25abc6df89
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'ntnic' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Link status          = Y
+Linux                = Y
+x86-64               = Y
doc/guides/nics/index.rst +1 -0
index 7bfcac880f..c14bc7988a 100644
@@ -53,6 +53,7 @@ Network Interface Controller Drivers
     nfb
     nfp
     ngbe
+    ntnic
     null
     octeon_ep
     octeontx
doc/guides/nics/ntnic.rst new file +115 -0

115 lines not on this page · raw message

drivers/net/meson.build +1 -0
index bd38b533c5..fb6d34b782 100644
@@ -45,6 +45,7 @@ drivers = [
         'nfb',
         'nfp',
         'ngbe',
+        'ntnic',
         'null',
         'octeontx',
         'octeon_ep',
drivers/net/ntnic/meson.build new file +92 -0

92 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c new file +1508 -0

1,508 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.h new file +32 -0
new file mode 100644
index 0000000000..c82070e9de
@@ -0,0 +1,32 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTNIC_ETHDEV_H__
+#define __NTNIC_ETHDEV_H__
+
+#include <rte_ether.h>
+#include <rte_version.h>/* RTE_VERSION, RTE_VERSION_NUM */
+#include <rte_mbuf.h>
+#include <rte_pci.h>
+#include <ethdev_pci.h>
+
+#include "ntos_drv.h"
+#include "ntos_system.h"
+#include "ntoss_virt_queue.h"
+#include "ntnic_stat.h"
+#include "nt_util.h"
+#include "stream_binary_flow_api.h"
+
+/* Total max ports per NT NFV NIC */
+#define MAX_NTNIC_PORTS 2
+
+/* Functions: */
+struct drv_s *get_pdrv(uint8_t adapter_no);
+
+extern uint64_t rte_tsc_freq;
+extern rte_spinlock_t hwlock;
+
+
+#endif	/* __NTNIC_ETHDEV_H__ */
drivers/net/ntnic/rte_pmd_ntnic.h new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.45.0
#45 lore raw

PATCH v3 12/17 net/ntnic: add support of the NT200A0X smartNIC

In reply to Serhii Iliushyk

Add ntnic support for NT200A0X NIC

* Reset

* Clock profiles

* FPGA Registers

* API for FPGA registers

---
 .../NT200A02_U23_Si5340_adr0_v5-Registers.h   |  752 +++++++++++
 drivers/net/ntnic/meson.build                 |   16 +
 .../clock_profiles/nthw_fpga_clk9563.c        |   51 +
 .../clock_profiles/nthw_fpga_clk9563.h        |    9 +
 .../nthw/core/nt200a0x/nthw_fpga_nt200a0x.c   |  107 ++
 .../nthw/core/nt200a0x/nthw_fpga_nt200a0x.h   |    9 +
 .../core/nt200a0x/reset/nthw_fpga_rst9563.c   |  258 ++++
 .../core/nt200a0x/reset/nthw_fpga_rst9563.h   |    9 +
 .../nt200a0x/reset/nthw_fpga_rst_nt200a0x.c   |  729 ++++++++++
 .../nt200a0x/reset/nthw_fpga_rst_nt200a0x.h   |    9 +
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |  888 +++++++++++++
 drivers/net/ntnic/nthw/core/nthw_fpga_rst.c   |   10 +
 drivers/net/ntnic/nthw/core/nthw_hif.c        |  312 +++++
 drivers/net/ntnic/nthw/core/nthw_iic.c        |  529 ++++++++
 .../net/ntnic/nthw/core/nthw_mac_pcs_xxv.c    | 1169 +++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_pcie3.c      |  270 ++++
 drivers/net/ntnic/nthw/core/nthw_sdc.c        |  176 +++
 drivers/net/ntnic/nthw/core/nthw_si5340.c     |  205 +++
 drivers/net/ntnic/nthw/core/nthw_spi_v3.c     |  356 +++++
 drivers/net/ntnic/nthw/core/nthw_spim.c       |  121 ++
 drivers/net/ntnic/nthw/core/nthw_spis.c       |  129 ++
 drivers/net/ntnic/nthw/core/nthw_tsm.c        |  167 +++
 22 files changed, 6281 insertions(+)
 create mode 100644 drivers/net/ntnic/include/NT200A02_U23_Si5340_adr0_v5-Registers.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_fpga.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_fpga_rst.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_hif.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_iic.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_mac_pcs_xxv.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcie3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_sdc.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5340.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spi_v3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spim.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spis.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_tsm.c
drivers/net/ntnic/include/NT200A02_U23_Si5340_adr0_v5-Registers.h new file +752 -0
new file mode 100644
index 0000000000..c4185c77ff
@@ -0,0 +1,752 @@
+/*
+ * Si5340 Rev D Configuration Register Export Header File
+ *
+ * This file represents a series of Silicon Labs Si5340 Rev D
+ * register writes that can be performed to load a single configuration
+ * on a device. It was created by a Silicon Labs ClockBuilder Pro
+ * export tool.
+ *
+ * Part:		                                       Si5340 Rev D
+ * Design ID:                                          05
+ * Includes Pre/Post Download Control Register Writes: Yes
+ * Created By:                                         ClockBuilder Pro v2.28.1 [2018-09-24]
+ * Timestamp:                                          2018-11-14 16:20:29 GMT+01:00
+ *
+ * A complete design report corresponding to this export is included at the end
+ * of this header file.
+ *
+ */
+
+#ifndef SI5340_REVD_REG_CONFIG_HEADER
+#define SI5340_REVD_REG_CONFIG_HEADER
+
+#define SI5340_REVD_REG_CONFIG_NUM_REGS 326
+
+typedef struct {
+	unsigned int address;	/* 16-bit register address */
+	unsigned char value;	/* 8-bit register data */
+
+} si5340_revd_register_t;
+
+static const si5340_revd_register_t si5340_revd_registers[SI5340_REVD_REG_CONFIG_NUM_REGS] = {
+	/* Start configuration preamble */
+	{ 0x0B24, 0xC0 },
+	{ 0x0B25, 0x00 },
+	/* Rev D stuck divider fix */
+	{ 0x0502, 0x01 },
+	{ 0x0505, 0x03 },
+	{ 0x0957, 0x17 },
+	{ 0x0B4E, 0x1A },
+	/* End configuration preamble */
+
+	/* Delay 300 msec */
+	/*    Delay is worst case time for device to complete any calibration */
+	/*    that is running due to device state change previous to this script */
+	/*    being processed. */
+
+	/* Start configuration registers */
+	{ 0x0006, 0x00 },
+	{ 0x0007, 0x00 },
+	{ 0x0008, 0x00 },
+	{ 0x000B, 0x74 },
+	{ 0x0017, 0xF0 },
+	{ 0x0018, 0xFF },
+	{ 0x0021, 0x0F },
+	{ 0x0022, 0x00 },
+	{ 0x002B, 0x0A },
+	{ 0x002C, 0x20 },
+	{ 0x002D, 0x00 },
+	{ 0x002E, 0x00 },
+	{ 0x002F, 0x00 },
+	{ 0x0030, 0x00 },
+	{ 0x0031, 0x00 },
+	{ 0x0032, 0x00 },
+	{ 0x0033, 0x00 },
+	{ 0x0034, 0x00 },
+	{ 0x0035, 0x00 },
+	{ 0x0036, 0x00 },
+	{ 0x0037, 0x00 },
+	{ 0x0038, 0x00 },
+	{ 0x0039, 0x00 },
+	{ 0x003A, 0x00 },
+	{ 0x003B, 0x00 },
+	{ 0x003C, 0x00 },
+	{ 0x003D, 0x00 },
+	{ 0x0041, 0x00 },
+	{ 0x0042, 0x00 },
+	{ 0x0043, 0x00 },
+	{ 0x0044, 0x00 },
+	{ 0x009E, 0x00 },
+	{ 0x0102, 0x01 },
+	{ 0x0112, 0x02 },
+	{ 0x0113, 0x09 },
+	{ 0x0114, 0x3E },
+	{ 0x0115, 0x19 },
+	{ 0x0117, 0x06 },
+	{ 0x0118, 0x09 },
+	{ 0x0119, 0x3E },
+	{ 0x011A, 0x18 },
+	{ 0x0126, 0x06 },
+	{ 0x0127, 0x09 },
+	{ 0x0128, 0x3E },
+	{ 0x0129, 0x18 },
+	{ 0x012B, 0x06 },
+	{ 0x012C, 0x09 },
+	{ 0x012D, 0x3E },
+	{ 0x012E, 0x1A },
+	{ 0x013F, 0x00 },
+	{ 0x0140, 0x00 },
+	{ 0x0141, 0x40 },
+	{ 0x0206, 0x00 },
+	{ 0x0208, 0x00 },
+	{ 0x0209, 0x00 },
+	{ 0x020A, 0x00 },
+	{ 0x020B, 0x00 },
+	{ 0x020C, 0x00 },
+	{ 0x020D, 0x00 },
+	{ 0x020E, 0x00 },
+	{ 0x020F, 0x00 },
+	{ 0x0210, 0x00 },
+	{ 0x0211, 0x00 },
+	{ 0x0212, 0x00 },
+	{ 0x0213, 0x00 },
+	{ 0x0214, 0x00 },
+	{ 0x0215, 0x00 },
+	{ 0x0216, 0x00 },
+	{ 0x0217, 0x00 },
+	{ 0x0218, 0x00 },
+	{ 0x0219, 0x00 },
+	{ 0x021A, 0x00 },
+	{ 0x021B, 0x00 },
+	{ 0x021C, 0x00 },
+	{ 0x021D, 0x00 },
+	{ 0x021E, 0x00 },
+	{ 0x021F, 0x00 },
+	{ 0x0220, 0x00 },
+	{ 0x0221, 0x00 },
+	{ 0x0222, 0x00 },
+	{ 0x0223, 0x00 },
+	{ 0x0224, 0x00 },
+	{ 0x0225, 0x00 },
+	{ 0x0226, 0x00 },
+	{ 0x0227, 0x00 },
+	{ 0x0228, 0x00 },
+	{ 0x0229, 0x00 },
+	{ 0x022A, 0x00 },
+	{ 0x022B, 0x00 },
+	{ 0x022C, 0x00 },
+	{ 0x022D, 0x00 },
+	{ 0x022E, 0x00 },
+	{ 0x022F, 0x00 },
+	{ 0x0235, 0x00 },
+	{ 0x0236, 0x00 },
+	{ 0x0237, 0x00 },
+	{ 0x0238, 0xA6 },
+	{ 0x0239, 0x8B },
+	{ 0x023A, 0x00 },
+	{ 0x023B, 0x00 },
+	{ 0x023C, 0x00 },
+	{ 0x023D, 0x00 },
+	{ 0x023E, 0x80 },
+	{ 0x0250, 0x03 },
+	{ 0x0251, 0x00 },
+	{ 0x0252, 0x00 },
+	{ 0x0253, 0x00 },
+	{ 0x0254, 0x00 },
+	{ 0x0255, 0x00 },
+	{ 0x025C, 0x00 },
+	{ 0x025D, 0x00 },
+	{ 0x025E, 0x00 },
+	{ 0x025F, 0x00 },
+	{ 0x0260, 0x00 },
+	{ 0x0261, 0x00 },
+	{ 0x026B, 0x30 },
+	{ 0x026C, 0x35 },
+	{ 0x026D, 0x00 },
+	{ 0x026E, 0x00 },
+	{ 0x026F, 0x00 },
+	{ 0x0270, 0x00 },
+	{ 0x0271, 0x00 },
+	{ 0x0272, 0x00 },
+	{ 0x0302, 0x00 },
+	{ 0x0303, 0x00 },
+	{ 0x0304, 0x00 },
+	{ 0x0305, 0x00 },
+	{ 0x0306, 0x0D },
+	{ 0x0307, 0x00 },
+	{ 0x0308, 0x00 },
+	{ 0x0309, 0x00 },
+	{ 0x030A, 0x00 },
+	{ 0x030B, 0x80 },
+	{ 0x030C, 0x00 },
+	{ 0x030D, 0x00 },
+	{ 0x030E, 0x00 },
+	{ 0x030F, 0x00 },
+	{ 0x0310, 0x61 },
+	{ 0x0311, 0x08 },
+	{ 0x0312, 0x00 },
+	{ 0x0313, 0x00 },
+	{ 0x0314, 0x00 },
+	{ 0x0315, 0x00 },
+	{ 0x0316, 0x80 },
+	{ 0x0317, 0x00 },
+	{ 0x0318, 0x00 },
+	{ 0x0319, 0x00 },
+	{ 0x031A, 0x00 },
+	{ 0x031B, 0xD0 },
+	{ 0x031C, 0x1A },
+	{ 0x031D, 0x00 },
+	{ 0x031E, 0x00 },
+	{ 0x031F, 0x00 },
+	{ 0x0320, 0x00 },
+	{ 0x0321, 0xA0 },
+	{ 0x0322, 0x00 },
+	{ 0x0323, 0x00 },
+	{ 0x0324, 0x00 },
+	{ 0x0325, 0x00 },
+	{ 0x0326, 0x00 },
+	{ 0x0327, 0x00 },
+	{ 0x0328, 0x00 },
+	{ 0x0329, 0x00 },
+	{ 0x032A, 0x00 },
+	{ 0x032B, 0x00 },
+	{ 0x032C, 0x00 },
+	{ 0x032D, 0x00 },
+	{ 0x0338, 0x00 },
+	{ 0x0339, 0x1F },
+	{ 0x033B, 0x00 },
+	{ 0x033C, 0x00 },
+	{ 0x033D, 0x00 },
+	{ 0x033E, 0x00 },
+	{ 0x033F, 0x00 },
+	{ 0x0340, 0x00 },
+	{ 0x0341, 0x00 },
+	{ 0x0342, 0x00 },
+	{ 0x0343, 0x00 },
+	{ 0x0344, 0x00 },
+	{ 0x0345, 0x00 },
+	{ 0x0346, 0x00 },
+	{ 0x0347, 0x00 },
+	{ 0x0348, 0x00 },
+	{ 0x0349, 0x00 },
+	{ 0x034A, 0x00 },
+	{ 0x034B, 0x00 },
+	{ 0x034C, 0x00 },
+	{ 0x034D, 0x00 },
+	{ 0x034E, 0x00 },
+	{ 0x034F, 0x00 },
+	{ 0x0350, 0x00 },
+	{ 0x0351, 0x00 },
+	{ 0x0352, 0x00 },
+	{ 0x0359, 0x00 },
+	{ 0x035A, 0x00 },
+	{ 0x035B, 0x00 },
+	{ 0x035C, 0x00 },
+	{ 0x035D, 0x00 },
+	{ 0x035E, 0x00 },
+	{ 0x035F, 0x00 },
+	{ 0x0360, 0x00 },
+	{ 0x0802, 0x00 },
+	{ 0x0803, 0x00 },
+	{ 0x0804, 0x00 },
+	{ 0x0805, 0x00 },
+	{ 0x0806, 0x00 },
+	{ 0x0807, 0x00 },
+	{ 0x0808, 0x00 },
+	{ 0x0809, 0x00 },
+	{ 0x080A, 0x00 },
+	{ 0x080B, 0x00 },
+	{ 0x080C, 0x00 },
+	{ 0x080D, 0x00 },
+	{ 0x080E, 0x00 },
+	{ 0x080F, 0x00 },
+	{ 0x0810, 0x00 },
+	{ 0x0811, 0x00 },
+	{ 0x0812, 0x00 },
+	{ 0x0813, 0x00 },
+	{ 0x0814, 0x00 },
+	{ 0x0815, 0x00 },
+	{ 0x0816, 0x00 },
+	{ 0x0817, 0x00 },
+	{ 0x0818, 0x00 },
+	{ 0x0819, 0x00 },
+	{ 0x081A, 0x00 },
+	{ 0x081B, 0x00 },
+	{ 0x081C, 0x00 },
+	{ 0x081D, 0x00 },
+	{ 0x081E, 0x00 },
+	{ 0x081F, 0x00 },
+	{ 0x0820, 0x00 },
+	{ 0x0821, 0x00 },
+	{ 0x0822, 0x00 },
+	{ 0x0823, 0x00 },
+	{ 0x0824, 0x00 },
+	{ 0x0825, 0x00 },
+	{ 0x0826, 0x00 },
+	{ 0x0827, 0x00 },
+	{ 0x0828, 0x00 },
+	{ 0x0829, 0x00 },
+	{ 0x082A, 0x00 },
+	{ 0x082B, 0x00 },
+	{ 0x082C, 0x00 },
+	{ 0x082D, 0x00 },
+	{ 0x082E, 0x00 },
+	{ 0x082F, 0x00 },
+	{ 0x0830, 0x00 },
+	{ 0x0831, 0x00 },
+	{ 0x0832, 0x00 },
+	{ 0x0833, 0x00 },
+	{ 0x0834, 0x00 },
+	{ 0x0835, 0x00 },
+	{ 0x0836, 0x00 },
+	{ 0x0837, 0x00 },
+	{ 0x0838, 0x00 },
+	{ 0x0839, 0x00 },
+	{ 0x083A, 0x00 },
+	{ 0x083B, 0x00 },
+	{ 0x083C, 0x00 },
+	{ 0x083D, 0x00 },
+	{ 0x083E, 0x00 },
+	{ 0x083F, 0x00 },
+	{ 0x0840, 0x00 },
+	{ 0x0841, 0x00 },
+	{ 0x0842, 0x00 },
+	{ 0x0843, 0x00 },
+	{ 0x0844, 0x00 },
+	{ 0x0845, 0x00 },
+	{ 0x0846, 0x00 },
+	{ 0x0847, 0x00 },
+	{ 0x0848, 0x00 },
+	{ 0x0849, 0x00 },
+	{ 0x084A, 0x00 },
+	{ 0x084B, 0x00 },
+	{ 0x084C, 0x00 },
+	{ 0x084D, 0x00 },
+	{ 0x084E, 0x00 },
+	{ 0x084F, 0x00 },
+	{ 0x0850, 0x00 },
+	{ 0x0851, 0x00 },
+	{ 0x0852, 0x00 },
+	{ 0x0853, 0x00 },
+	{ 0x0854, 0x00 },
+	{ 0x0855, 0x00 },
+	{ 0x0856, 0x00 },
+	{ 0x0857, 0x00 },
+	{ 0x0858, 0x00 },
+	{ 0x0859, 0x00 },
+	{ 0x085A, 0x00 },
+	{ 0x085B, 0x00 },
+	{ 0x085C, 0x00 },
+	{ 0x085D, 0x00 },
+	{ 0x085E, 0x00 },
+	{ 0x085F, 0x00 },
+	{ 0x0860, 0x00 },
+	{ 0x0861, 0x00 },
+	{ 0x090E, 0x02 },
+	{ 0x091C, 0x04 },
+	{ 0x0943, 0x00 },
+	{ 0x0949, 0x00 },
+	{ 0x094A, 0x00 },
+	{ 0x094E, 0x49 },
+	{ 0x094F, 0x02 },
+	{ 0x095E, 0x00 },
+	{ 0x0A02, 0x00 },
+	{ 0x0A03, 0x07 },
+	{ 0x0A04, 0x01 },
+	{ 0x0A05, 0x07 },
+	{ 0x0A14, 0x00 },
+	{ 0x0A1A, 0x00 },
+	{ 0x0A20, 0x00 },
+	{ 0x0A26, 0x00 },
+	{ 0x0B44, 0x0F },
+	{ 0x0B4A, 0x08 },
+	{ 0x0B57, 0x0E },
+	{ 0x0B58, 0x01 },
+	/* End configuration registers */
+
+	/* Start configuration postamble */
+	{ 0x001C, 0x01 },
+	{ 0x0B24, 0xC3 },
+	{ 0x0B25, 0x02 },
+	/* End configuration postamble */
+};
+
+/*
+ * Design Report
+ *
+ * Overview
+ * ========
+ * Part:               Si5340AB Rev D
+ * Project File:       P:\Hardware\NT
+ * Adapters\NT200A02\design\Clock_syn_design\NT200A02_U23_Si5340_adr0_v5.slabtimeproj Design ID: 05
+ * Created By:         ClockBuilder Pro v2.28.1 [2018-09-24]
+ * Timestamp:          2018-11-14 16:20:29 GMT+01:00
+ *
+ * Design Rule Check
+ * =================
+ * Errors:
+ * - No errors
+ *
+ * Warnings:
+ * - No warnings
+ *
+ * Device Grade
+ * ============
+ * Maximum Output Frequency: 257.8125 MHz
+ * Frequency Synthesis Mode: Fractional
+ * Frequency Plan Grade:     B
+ * Minimum Base OPN:         Si5340B*
+ *
+ * Base       Output Clock         Supported Frequency Synthesis Modes
+ * OPN Grade  Frequency Range      (Typical Jitter)
+ * ---------  -------------------  --------------------------------------------
+ * Si5340A    100 Hz to 1.028 GHz  Integer (< 100 fs) and fractional (< 150 fs)
+ * Si5340B*   100 Hz to 350 MHz    "
+ * Si5340C    100 Hz to 1.028 GHz  Integer only (< 100 fs)
+ * Si5340D    100 Hz to 350 MHz    "
+ *
+ * * Based on your calculated frequency plan, a Si5340B grade device is
+ * sufficient for your design. For more in-system configuration flexibility
+ * (higher frequencies and/or to enable fractional synthesis), consider
+ * selecting device grade Si5340A when specifying an ordering part number (OPN)
+ * for your application. See the datasheet Ordering Guide for more information.
+ *
+ * Design
+ * ======
+ * Host Interface:
+ *    I/O Power Supply: VDD (Core)
+ *    SPI Mode: 3-Wire
+ *    I2C Address Range: 116d to 119d / 0x74 to 0x77 (selected via A0/A1 pins)
+ *
+ * Inputs:
+ *    XAXB: 48 MHz
+ *          Crystal Mode
+ *     IN0: Unused
+ *     IN1: Unused
+ *     IN2: Unused
+ *   FB_IN: Unused
+ *
+ * Outputs:
+ *    OUT0: 100 MHz
+ *          Enabled, LVDS 1.8 V
+ *    OUT1: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *          Enabled, LVDS 1.8 V
+ *    OUT2: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *          Enabled, LVDS 1.8 V
+ *    OUT3: 156.25 MHz [ 156 + 1/4 MHz ]
+ *          Enabled, LVDS 1.8 V
+ *
+ * Frequency Plan
+ * ==============
+ * Priority: OUT1 is lowest jitter output
+ *
+ * Fpfd = 48 MHz
+ * Fvco = 13.40625 GHz [ 13 + 13/32 GHz ]
+ * Fms0 = 515.625 MHz [ 515 + 5/8 MHz ]
+ * Fms1 = 800 MHz
+ * Fms2 = 312.5 MHz [ 312 + 1/2 MHz ]
+ *
+ * P dividers:
+ *    P0  = Unused
+ *    P1  = Unused
+ *    P2  = Unused
+ *    P3  = Unused
+ *    Pxaxb = 1
+ *
+ * M = 279.296875 [ 279 + 19/64 ]
+ * N dividers:
+ *    N0:
+ *       Value: 26
+ *       Skew:  0.000 s
+ *       OUT1: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *       OUT2: 257.8125 MHz [ 257 + 13/16 MHz ]
+ *    N1:
+ *       Value: 16.7578125 [ 16 + 97/128 ]
+ *       Skew:  0.000 s
+ *       OUT0: 100 MHz
+ *    N2:
+ *       Value: 42.9 [ 42 + 9/10 ]
+ *       Skew:  0.000 s
+ *       OUT3: 156.25 MHz [ 156 + 1/4 MHz ]
+ *    N3:
+ *       Unused
+ *
+ * R dividers:
+ *    R0 = 8
+ *    R1 = 2
+ *    R2 = 2
+ *    R3 = 2
+ *
+ * Dividers listed above show effective values. These values are translated to register settings by
+ * ClockBuilder Pro. For the actual register values, see below. Refer to the Family Reference
+ * Manual for information on registers related to frequency plan.
+ *
+ * Digitally Controlled Oscillator (DCO)
+ * =====================================
+ * Mode: FINC/FDEC
+ *
+ * N0: DCO Disabled
+ *
+ * N1: DCO Disabled
+ *
+ * N2: DCO Disabled
+ *
+ * N3: DCO Disabled
+ *
+ * Estimated Power & Junction Temperature
+ * ======================================
+ * Assumptions:
+ *
+ * Revision: D
+ * VDD:      1.8 V
+ * Ta:       70 °C
+ * Airflow:  None
+ *
+ * Total Power: 767 mW, On Chip Power: 743 mW, Tj: 87 °C
+ *
+ *            Frequency  Format   Voltage   Current     Power
+ *         ------------  ------  --------  --------  --------
+ * VDD                              1.8 V  146.3 mA    263 mW
+ * VDDA                             3.3 V  117.4 mA    387 mW
+ * VDDO0        100 MHz  LVDS       1.8 V   15.6 mA     28 mW
+ * VDDO1   257.8125 MHz  LVDS       1.8 V   16.6 mA     30 mW
+ * VDDO2   257.8125 MHz  LVDS       1.8 V   16.6 mA     30 mW
+ * VDDO3     156.25 MHz  LVDS       1.8 V   15.9 mA     29 mW
+ *                                         --------  --------
+ *                                  Total  328.4 mA    767 mW
+ *
+ * Note:
+ *
+ * -Total power includes on- and off-chip power. This is a typical value and estimate only.
+ * -Use an EVB for a more exact power measurement
+ * -On-chip power excludes power dissipated in external terminations.
+ * -Tj is junction temperature. Tj must be less than 125 °C (on Si5340 Revision D) for device to
+ * comply with datasheet specifications.
+ *
+ * Settings
+ * ========
+ *
+ * Location      Setting Name         Decimal Value      Hex Value
+ * ------------  -------------------  -----------------  -----------------
+ * 0x0006[23:0]  TOOL_VERSION         0                  0x000000
+ * 0x000B[6:0]   I2C_ADDR             116                0x74
+ * 0x0017[0]     SYSINCAL_INTR_MSK    0                  0x0
+ * 0x0017[1]     LOSXAXB_INTR_MSK     0                  0x0
+ * 0x0017[2]     LOSREF_INTR_MSK      0                  0x0
+ * 0x0017[3]     LOL_INTR_MSK         0                  0x0
+ * 0x0017[5]     SMB_TMOUT_INTR_MSK   1                  0x1
+ * 0x0018[3:0]   LOSIN_INTR_MSK       15                 0xF
+ * 0x0021[0]     IN_SEL_REGCTRL       1                  0x1
+ * 0x0021[2:1]   IN_SEL               3                  0x3
+ * 0x0022[1]     OE                   0                  0x0
+ * 0x002B[3]     SPI_3WIRE            1                  0x1
+ * 0x002B[5]     AUTO_NDIV_UPDATE     0                  0x0
+ * 0x002C[3:0]   LOS_EN               0                  0x0
+ * 0x002C[4]     LOSXAXB_DIS          0                  0x0
+ * 0x002D[1:0]   LOS0_VAL_TIME        0                  0x0
+ * 0x002D[3:2]   LOS1_VAL_TIME        0                  0x0
+ * 0x002D[5:4]   LOS2_VAL_TIME        0                  0x0
+ * 0x002D[7:6]   LOS3_VAL_TIME        0                  0x0
+ * 0x002E[15:0]  LOS0_TRG_THR         0                  0x0000
+ * 0x0030[15:0]  LOS1_TRG_THR         0                  0x0000
+ * 0x0032[15:0]  LOS2_TRG_THR         0                  0x0000
+ * 0x0034[15:0]  LOS3_TRG_THR         0                  0x0000
+ * 0x0036[15:0]  LOS0_CLR_THR         0                  0x0000
+ * 0x0038[15:0]  LOS1_CLR_THR         0                  0x0000
+ * 0x003A[15:0]  LOS2_CLR_THR         0                  0x0000
+ * 0x003C[15:0]  LOS3_CLR_THR         0                  0x0000
+ * 0x0041[4:0]   LOS0_DIV_SEL         0                  0x00
+ * 0x0042[4:0]   LOS1_DIV_SEL         0                  0x00
+ * 0x0043[4:0]   LOS2_DIV_SEL         0                  0x00
+ * 0x0044[4:0]   LOS3_DIV_SEL         0                  0x00
+ * 0x009E[7:4]   LOL_SET_THR          0                  0x0
+ * 0x0102[0]     OUTALL_DISABLE_LOW   1                  0x1
+ * 0x0112[0]     OUT0_PDN             0                  0x0
+ * 0x0112[1]     OUT0_OE              1                  0x1
+ * 0x0112[2]     OUT0_RDIV_FORCE2     0                  0x0
+ * 0x0113[2:0]   OUT0_FORMAT          1                  0x1
+ * 0x0113[3]     OUT0_SYNC_EN         1                  0x1
+ * 0x0113[5:4]   OUT0_DIS_STATE       0                  0x0
+ * 0x0113[7:6]   OUT0_CMOS_DRV        0                  0x0
+ * 0x0114[3:0]   OUT0_CM              14                 0xE
+ * 0x0114[6:4]   OUT0_AMPL            3                  0x3
+ * 0x0115[2:0]   OUT0_MUX_SEL         1                  0x1
+ * 0x0115[5:4]   OUT0_VDD_SEL         1                  0x1
+ * 0x0115[3]     OUT0_VDD_SEL_EN      1                  0x1
+ * 0x0115[7:6]   OUT0_INV             0                  0x0
+ * 0x0117[0]     OUT1_PDN             0                  0x0
+ * 0x0117[1]     OUT1_OE              1                  0x1
+ * 0x0117[2]     OUT1_RDIV_FORCE2     1                  0x1
+ * 0x0118[2:0]   OUT1_FORMAT          1                  0x1
+ * 0x0118[3]     OUT1_SYNC_EN         1                  0x1
+ * 0x0118[5:4]   OUT1_DIS_STATE       0                  0x0
+ * 0x0118[7:6]   OUT1_CMOS_DRV        0                  0x0
+ * 0x0119[3:0]   OUT1_CM              14                 0xE
+ * 0x0119[6:4]   OUT1_AMPL            3                  0x3
+ * 0x011A[2:0]   OUT1_MUX_SEL         0                  0x0
+ * 0x011A[5:4]   OUT1_VDD_SEL         1                  0x1
+ * 0x011A[3]     OUT1_VDD_SEL_EN      1                  0x1
+ * 0x011A[7:6]   OUT1_INV             0                  0x0
+ * 0x0126[0]     OUT2_PDN             0                  0x0
+ * 0x0126[1]     OUT2_OE              1                  0x1
+ * 0x0126[2]     OUT2_RDIV_FORCE2     1                  0x1
+ * 0x0127[2:0]   OUT2_FORMAT          1                  0x1
+ * 0x0127[3]     OUT2_SYNC_EN         1                  0x1
+ * 0x0127[5:4]   OUT2_DIS_STATE       0                  0x0
+ * 0x0127[7:6]   OUT2_CMOS_DRV        0                  0x0
+ * 0x0128[3:0]   OUT2_CM              14                 0xE
+ * 0x0128[6:4]   OUT2_AMPL            3                  0x3
+ * 0x0129[2:0]   OUT2_MUX_SEL         0                  0x0
+ * 0x0129[5:4]   OUT2_VDD_SEL         1                  0x1
+ * 0x0129[3]     OUT2_VDD_SEL_EN      1                  0x1
+ * 0x0129[7:6]   OUT2_INV             0                  0x0
+ * 0x012B[0]     OUT3_PDN             0                  0x0
+ * 0x012B[1]     OUT3_OE              1                  0x1
+ * 0x012B[2]     OUT3_RDIV_FORCE2     1                  0x1
+ * 0x012C[2:0]   OUT3_FORMAT          1                  0x1
+ * 0x012C[3]     OUT3_SYNC_EN         1                  0x1
+ * 0x012C[5:4]   OUT3_DIS_STATE       0                  0x0
+ * 0x012C[7:6]   OUT3_CMOS_DRV        0                  0x0
+ * 0x012D[3:0]   OUT3_CM              14                 0xE
+ * 0x012D[6:4]   OUT3_AMPL            3                  0x3
+ * 0x012E[2:0]   OUT3_MUX_SEL         2                  0x2
+ * 0x012E[5:4]   OUT3_VDD_SEL         1                  0x1
+ * 0x012E[3]     OUT3_VDD_SEL_EN      1                  0x1
+ * 0x012E[7:6]   OUT3_INV             0                  0x0
+ * 0x013F[11:0]  OUTX_ALWAYS_ON       0                  0x000
+ * 0x0141[5]     OUT_DIS_LOL_MSK      0                  0x0
+ * 0x0141[7]     OUT_DIS_MSK_LOS_PFD  0                  0x0
+ * 0x0206[1:0]   PXAXB                0                  0x0
+ * 0x0208[47:0]  P0                   0                  0x000000000000
+ * 0x020E[31:0]  P0_SET               0                  0x00000000
+ * 0x0212[47:0]  P1                   0                  0x000000000000
+ * 0x0218[31:0]  P1_SET               0                  0x00000000
+ * 0x021C[47:0]  P2                   0                  0x000000000000
+ * 0x0222[31:0]  P2_SET               0                  0x00000000
+ * 0x0226[47:0]  P3                   0                  0x000000000000
+ * 0x022C[31:0]  P3_SET               0                  0x00000000
+ * 0x0235[43:0]  M_NUM                599785472000       0x08BA6000000
+ * 0x023B[31:0]  M_DEN                2147483648         0x80000000
+ * 0x0250[23:0]  R0_REG               3                  0x000003
+ * 0x0253[23:0]  R1_REG               0                  0x000000
+ * 0x025C[23:0]  R2_REG               0                  0x000000
+ * 0x025F[23:0]  R3_REG               0                  0x000000
+ * 0x026B[7:0]   DESIGN_ID0           48                 0x30
+ * 0x026C[7:0]   DESIGN_ID1           53                 0x35
+ * 0x026D[7:0]   DESIGN_ID2           0                  0x00
+ * 0x026E[7:0]   DESIGN_ID3           0                  0x00
+ * 0x026F[7:0]   DESIGN_ID4           0                  0x00
+ * 0x0270[7:0]   DESIGN_ID5           0                  0x00
+ * 0x0271[7:0]   DESIGN_ID6           0                  0x00
+ * 0x0272[7:0]   DESIGN_ID7           0                  0x00
+ * 0x0302[43:0]  N0_NUM               55834574848        0x00D00000000
+ * 0x0308[31:0]  N0_DEN               2147483648         0x80000000
+ * 0x030C[0]     N0_UPDATE            0                  0x0
+ * 0x030D[43:0]  N1_NUM               35987128320        0x00861000000
+ * 0x0313[31:0]  N1_DEN               2147483648         0x80000000
+ * 0x0317[0]     N1_UPDATE            0                  0x0
+ * 0x0318[43:0]  N2_NUM               115158810624       0x01AD0000000
+ * 0x031E[31:0]  N2_DEN               2684354560         0xA0000000
+ * 0x0322[0]     N2_UPDATE            0                  0x0
+ * 0x0323[43:0]  N3_NUM               0                  0x00000000000
+ * 0x0329[31:0]  N3_DEN               0                  0x00000000
+ * 0x032D[0]     N3_UPDATE            0                  0x0
+ * 0x0338[1]     N_UPDATE             0                  0x0
+ * 0x0339[4:0]   N_FSTEP_MSK          31                 0x1F
+ * 0x033B[43:0]  N0_FSTEPW            0                  0x00000000000
+ * 0x0341[43:0]  N1_FSTEPW            0                  0x00000000000
+ * 0x0347[43:0]  N2_FSTEPW            0                  0x00000000000
+ * 0x034D[43:0]  N3_FSTEPW            0                  0x00000000000
+ * 0x0359[15:0]  N0_DELAY             0                  0x0000
+ * 0x035B[15:0]  N1_DELAY             0                  0x0000
+ * 0x035D[15:0]  N2_DELAY             0                  0x0000
+ * 0x035F[15:0]  N3_DELAY             0                  0x0000
+ * 0x0802[15:0]  FIXREGSA0            0                  0x0000
+ * 0x0804[7:0]   FIXREGSD0            0                  0x00
+ * 0x0805[15:0]  FIXREGSA1            0                  0x0000
+ * 0x0807[7:0]   FIXREGSD1            0                  0x00
+ * 0x0808[15:0]  FIXREGSA2            0                  0x0000
+ * 0x080A[7:0]   FIXREGSD2            0                  0x00
+ * 0x080B[15:0]  FIXREGSA3            0                  0x0000
+ * 0x080D[7:0]   FIXREGSD3            0                  0x00
+ * 0x080E[15:0]  FIXREGSA4            0                  0x0000
+ * 0x0810[7:0]   FIXREGSD4            0                  0x00
+ * 0x0811[15:0]  FIXREGSA5            0                  0x0000
+ * 0x0813[7:0]   FIXREGSD5            0                  0x00
+ * 0x0814[15:0]  FIXREGSA6            0                  0x0000
+ * 0x0816[7:0]   FIXREGSD6            0                  0x00
+ * 0x0817[15:0]  FIXREGSA7            0                  0x0000
+ * 0x0819[7:0]   FIXREGSD7            0                  0x00
+ * 0x081A[15:0]  FIXREGSA8            0                  0x0000
+ * 0x081C[7:0]   FIXREGSD8            0                  0x00
+ * 0x081D[15:0]  FIXREGSA9            0                  0x0000
+ * 0x081F[7:0]   FIXREGSD9            0                  0x00
+ * 0x0820[15:0]  FIXREGSA10           0                  0x0000
+ * 0x0822[7:0]   FIXREGSD10           0                  0x00
+ * 0x0823[15:0]  FIXREGSA11           0                  0x0000
+ * 0x0825[7:0]   FIXREGSD11           0                  0x00
+ * 0x0826[15:0]  FIXREGSA12           0                  0x0000
+ * 0x0828[7:0]   FIXREGSD12           0                  0x00
+ * 0x0829[15:0]  FIXREGSA13           0                  0x0000
+ * 0x082B[7:0]   FIXREGSD13           0                  0x00
+ * 0x082C[15:0]  FIXREGSA14           0                  0x0000
+ * 0x082E[7:0]   FIXREGSD14           0                  0x00
+ * 0x082F[15:0]  FIXREGSA15           0                  0x0000
+ * 0x0831[7:0]   FIXREGSD15           0                  0x00
+ * 0x0832[15:0]  FIXREGSA16           0                  0x0000
+ * 0x0834[7:0]   FIXREGSD16           0                  0x00
+ * 0x0835[15:0]  FIXREGSA17           0                  0x0000
+ * 0x0837[7:0]   FIXREGSD17           0                  0x00
+ * 0x0838[15:0]  FIXREGSA18           0                  0x0000
+ * 0x083A[7:0]   FIXREGSD18           0                  0x00
+ * 0x083B[15:0]  FIXREGSA19           0                  0x0000
+ * 0x083D[7:0]   FIXREGSD19           0                  0x00
+ * 0x083E[15:0]  FIXREGSA20           0                  0x0000
+ * 0x0840[7:0]   FIXREGSD20           0                  0x00
+ * 0x0841[15:0]  FIXREGSA21           0                  0x0000
+ * 0x0843[7:0]   FIXREGSD21           0                  0x00
+ * 0x0844[15:0]  FIXREGSA22           0                  0x0000
+ * 0x0846[7:0]   FIXREGSD22           0                  0x00
+ * 0x0847[15:0]  FIXREGSA23           0                  0x0000
+ * 0x0849[7:0]   FIXREGSD23           0                  0x00
+ * 0x084A[15:0]  FIXREGSA24           0                  0x0000
+ * 0x084C[7:0]   FIXREGSD24           0                  0x00
+ * 0x084D[15:0]  FIXREGSA25           0                  0x0000
+ * 0x084F[7:0]   FIXREGSD25           0                  0x00
+ * 0x0850[15:0]  FIXREGSA26           0                  0x0000
+ * 0x0852[7:0]   FIXREGSD26           0                  0x00
+ * 0x0853[15:0]  FIXREGSA27           0                  0x0000
+ * 0x0855[7:0]   FIXREGSD27           0                  0x00
+ * 0x0856[15:0]  FIXREGSA28           0                  0x0000
+ * 0x0858[7:0]   FIXREGSD28           0                  0x00
+ * 0x0859[15:0]  FIXREGSA29           0                  0x0000
+ * 0x085B[7:0]   FIXREGSD29           0                  0x00
+ * 0x085C[15:0]  FIXREGSA30           0                  0x0000
+ * 0x085E[7:0]   FIXREGSD30           0                  0x00
+ * 0x085F[15:0]  FIXREGSA31           0                  0x0000
+ * 0x0861[7:0]   FIXREGSD31           0                  0x00
+ * 0x090E[0]     XAXB_EXTCLK_EN       0                  0x0
+ * 0x090E[1]     XAXB_PDNB            1                  0x1
+ * 0x091C[2:0]   ZDM_EN               4                  0x4
+ * 0x0943[0]     IO_VDD_SEL           0                  0x0
+ * 0x0949[3:0]   IN_EN                0                  0x0
+ * 0x0949[7:4]   IN_PULSED_CMOS_EN    0                  0x0
+ * 0x094A[7:4]   INX_TO_PFD_EN        0                  0x0
+ * 0x094E[11:0]  REFCLK_HYS_SEL       585                0x249
+ * 0x095E[0]     M_INTEGER            0                  0x0
+ * 0x0A02[4:0]   N_ADD_0P5            0                  0x00
+ * 0x0A03[4:0]   N_CLK_TO_OUTX_EN     7                  0x07
+ * 0x0A04[4:0]   N_PIBYP              1                  0x01
+ * 0x0A05[4:0]   N_PDNB               7                  0x07
+ * 0x0A14[3]     N0_HIGH_FREQ         0                  0x0
+ * 0x0A1A[3]     N1_HIGH_FREQ         0                  0x0
+ * 0x0A20[3]     N2_HIGH_FREQ         0                  0x0
+ * 0x0A26[3]     N3_HIGH_FREQ         0                  0x0
+ * 0x0B44[3:0]   PDIV_ENB             15                 0xF
+ * 0x0B4A[4:0]   N_CLK_DIS            8                  0x08
+ * 0x0B57[11:0]  VCO_RESET_CALCODE    270                0x10E
+ *
+ *
+ */
+
+#endif
drivers/net/ntnic/meson.build +16 -0
index e6af19b25a..e21c075d74 100644
@@ -78,6 +78,22 @@ sources = files(
     'nthw/supported/nthw_fpga_9563_055_039_0000.c',
     'nthw/supported/nthw_fpga_instances.c',
     'nthw/supported/nthw_fpga_mod_str_map.c',
+    'nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c',
+    'nthw/core/nt200a0x/nthw_fpga_nt200a0x.c',
+    'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c',
+    'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
+    'nthw/core/nthw_fpga.c',
+    'nthw/core/nthw_fpga_rst.c',
+    'nthw/core/nthw_hif.c',
+    'nthw/core/nthw_iic.c',
+    'nthw/core/nthw_mac_pcs_xxv.c',
+    'nthw/core/nthw_pcie3.c',
+    'nthw/core/nthw_sdc.c',
+    'nthw/core/nthw_si5340.c',
+    'nthw/core/nthw_spim.c',
+    'nthw/core/nthw_spis.c',
+    'nthw/core/nthw_spi_v3.c',
+    'nthw/core/nthw_tsm.c',
     'nthw/model/nthw_fpga_model.c',
     'nthw/nthw_epp.c',
     'nthw/nthw_platform.c',
drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c new file +51 -0

51 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.h new file +9 -0
new file mode 100644
index 0000000000..88d72cd334
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _NTHW_FPGA_CLK_9563_H_
+#define _NTHW_FPGA_CLK_9563_H_
+
+#endif	/* _NTHW_FPGA_CLK_9563_H_ */
drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c new file +107 -0

107 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.h new file +9 -0
new file mode 100644
index 0000000000..26efe27e0f
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef __NTHW_FPGA_NT200A0X_H__
+#define __NTHW_FPGA_NT200A0X_H__
+
+#endif	/* __NTHW_FPGA_NT200A0X_H__ */
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c new file +258 -0

258 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.h new file +9 -0
new file mode 100644
index 0000000000..e61cd32954
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_FPGA_RST9563_H__
+#define __NTHW_FPGA_RST9563_H__
+
+#endif	/* __NTHW_FPGA_RST9563_H__ */
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c new file +729 -0

729 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.h new file +9 -0
new file mode 100644
index 0000000000..af508bd2bd
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_FPGA_RST_NT200A0X_H__
+#define __NTHW_FPGA_RST_NT200A0X_H__
+
+#endif	/* __NTHW_FPGA_RST_NT200A0X_H__ */
drivers/net/ntnic/nthw/core/nthw_fpga.c new file +888 -0

888 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_fpga_rst.c new file +10 -0
new file mode 100644
index 0000000000..e0fb0ec3d8
@@ -0,0 +1,10 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include "ntlog.h"
+
+#include "nthw_fpga.h"
+
+#include "nthw_fpga_rst.h"
drivers/net/ntnic/nthw/core/nthw_hif.c new file +312 -0

147 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_iic.c new file +529 -0

529 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_mac_pcs_xxv.c new file +1169 -0

1,169 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pcie3.c new file +270 -0

270 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_sdc.c new file +176 -0

176 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_si5340.c new file +205 -0

205 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spi_v3.c new file +356 -0

356 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spim.c new file +121 -0

121 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spis.c new file +129 -0

129 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_tsm.c new file +167 -0

167 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.45.0

Part of the diff is not shown here. View the raw message.

#46 lore raw

PATCH v3 13/17 net/ntnic: add adapter initialization

In reply to Serhii Iliushyk

Add ntnic HW interfaces (PCIe, I2C) API.

---
v2:
* Fixed WARNING:TYPO_SPELLING
v3:
* Fix meson file: list of source files

---
 drivers/net/ntnic/adapter/nt4ga_pci_ta_tg.c   | 550 ++++++++++++++++++
 drivers/net/ntnic/adapter/nt4ga_tfg.c         |  69 +++
 drivers/net/ntnic/include/nt4ga_tfg.h         |   2 +
 drivers/net/ntnic/include/ntnic_nim.h         |   1 +
 drivers/net/ntnic/meson.build                 |   8 +
 .../net/ntnic/nthw/core/include/nthw_core.h   |   6 +
 .../net/ntnic/nthw/core/include/nthw_gfg.h    |  40 ++
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |  75 +++
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |  51 ++
 .../ntnic/nthw/core/include/nthw_pci_rd_tg.h  |  50 ++
 .../net/ntnic/nthw/core/include/nthw_pci_ta.h |  40 ++
 .../ntnic/nthw/core/include/nthw_pci_wr_tg.h  |  55 ++
 drivers/net/ntnic/nthw/core/nthw_gfg.c        | 365 ++++++++++++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        | 176 ++++++
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       | 197 +++++++
 drivers/net/ntnic/nthw/core/nthw_pci_rd_tg.c  | 115 ++++
 drivers/net/ntnic/nthw/core/nthw_pci_ta.c     |  94 +++
 drivers/net/ntnic/nthw/core/nthw_pci_wr_tg.c  | 122 ++++
 18 files changed, 2016 insertions(+)
 create mode 100644 drivers/net/ntnic/adapter/nt4ga_pci_ta_tg.c
 create mode 100644 drivers/net/ntnic/adapter/nt4ga_tfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gfg.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gmf.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_i2cm.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pci_rd_tg.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pci_ta.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pci_wr_tg.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gmf.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_i2cm.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pci_rd_tg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pci_ta.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pci_wr_tg.c
drivers/net/ntnic/adapter/nt4ga_pci_ta_tg.c new file +550 -0
new file mode 100644
index 0000000000..b7a9ca2fbe
@@ -0,0 +1,550 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include "ntlog.h"
+#include "nt_util.h"
+#include "nthw_drv.h"
+#include "nt4ga_adapter.h"
+#include "nt4ga_pci_ta_tg.h"
+#include "nthw_pci_ta.h"
+#include "nthw_pci_rd_tg.h"
+#include "nthw_pci_wr_tg.h"
+
+int nt4ga_pci_ta_tg_init(struct adapter_info_s *p_adapter_info)
+{
+	const char *const p_adapter_id_str = p_adapter_info->mp_adapter_id_str;
+	fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
+	nthw_fpga_t *p_fpga = fpga_info->mp_fpga;
+	nt4ga_pci_ta_tg_t *p = &p_adapter_info->nt4ga_pci_ta_tg;
+	int res;
+	int n_err_cnt = 0;
+
+	if (p) {
+		memset(p, 0, sizeof(nt4ga_pci_ta_tg_t));
+
+	} else {
+		NT_LOG(ERR, NTHW, "%s: %s: null ptr\n", p_adapter_id_str, __func__);
+		return -1;
+	}
+
+	assert(p_fpga);
+
+	p->mp_nthw_pci_rd_tg = nthw_pci_rd_tg_new();
+	assert(p->mp_nthw_pci_rd_tg);
+	res = nthw_pci_rd_tg_init(p->mp_nthw_pci_rd_tg, p_fpga, 0);
+
+	if (res) {
+		n_err_cnt++;
+		NT_LOG(WRN, NTHW, "%s: module PCI_RD_TG not found\n", p_adapter_id_str);
+	}
+
+	p->mp_nthw_pci_wr_tg = nthw_pci_wr_tg_new();
+	assert(p->mp_nthw_pci_wr_tg);
+	res = nthw_pci_wr_tg_init(p->mp_nthw_pci_wr_tg, p_fpga, 0);
+
+	if (res) {
+		n_err_cnt++;
+		NT_LOG(WRN, NTHW, "%s: module PCI_WR_TG not found\n", p_adapter_id_str);
+	}
+
+	p->mp_nthw_pci_ta = nthw_pci_ta_new();
+	assert(p->mp_nthw_pci_ta);
+	res = nthw_pci_ta_init(p->mp_nthw_pci_ta, p_fpga, 0);
+
+	if (res) {
+		n_err_cnt++;
+		NT_LOG(WRN, NTHW, "%s: module PCI_TA not found\n", p_adapter_id_str);
+	}
+
+	return n_err_cnt;
+}
+
+static int nt4ga_pci_ta_tg_ta_write_control_enable(nt4ga_pci_ta_tg_t *p, uint32_t enable)
+{
+	nthw_pci_ta_set_control_enable(p->mp_nthw_pci_ta, enable);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_length_error(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_length_error(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_packet_bad(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_packet_bad(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_packet_good(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_packet_good(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_ta_read_payload_error(nt4ga_pci_ta_tg_t *p, uint32_t *p_data)
+{
+	nthw_pci_ta_get_payload_error(p->mp_nthw_pci_ta, p_data);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_rd_tg_setup(nt4ga_pci_ta_tg_t *p, uint64_t iova, int slot_addr,
+	uint32_t req_size, bool wait, bool wrap)
+{
+	const uint64_t n_phys_addr = (iova + (unsigned long)(slot_addr * req_size));
+	nthw_pci_rd_tg_set_ram_addr(p->mp_nthw_pci_rd_tg, slot_addr);
+	nthw_pci_rd_tg_set_phys_addr(p->mp_nthw_pci_rd_tg, n_phys_addr);
+	nthw_pci_rd_tg_set_ram_data(p->mp_nthw_pci_rd_tg, req_size, wait, wrap);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_rd_tg_run(nt4ga_pci_ta_tg_t *p, uint32_t num_iterations)
+{
+	nthw_pci_rd_tg_set_run(p->mp_nthw_pci_rd_tg, num_iterations);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_rd_tg_wait_ready(nt4ga_pci_ta_tg_t *p)
+{
+	int poll = 0;
+	uint32_t data = 0;
+
+	while (data == 0) {
+		/* NOTE: Deliberately start with a sleep - ensures that the FPGA pipe is empty */
+		nt_os_wait_usec(1000);
+		data = nthw_pci_rd_tg_get_ctrl_rdy(p->mp_nthw_pci_rd_tg);
+		poll++;
+
+		if (poll >= 1000) {
+			NT_LOG(ERR, NTHW, "%s: FAILED waiting PCI RD TG ready: poll=%d\n",
+				__func__, poll);
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_wr_tg_setup(nt4ga_pci_ta_tg_t *p, uint64_t iova, int slot_addr,
+	uint32_t req_size, bool wait, bool wrap, bool inc)
+{
+	const uint64_t n_phys_addr = (iova + (unsigned long)(slot_addr * req_size));
+
+	nthw_pci_wr_tg_set_ram_addr(p->mp_nthw_pci_wr_tg, slot_addr);
+	nthw_pci_wr_tg_set_phys_addr(p->mp_nthw_pci_wr_tg, n_phys_addr);
+	nthw_pci_wr_tg_set_ram_data(p->mp_nthw_pci_wr_tg, req_size, wait, wrap, inc);
+
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_wr_tg_run(nt4ga_pci_ta_tg_t *p, uint32_t num_iterations)
+{
+	nthw_pci_wr_tg_set_run(p->mp_nthw_pci_wr_tg, num_iterations);
+	return 0;
+}
+
+static int nt4ga_pci_ta_tg_wr_tg_wait_ready(nt4ga_pci_ta_tg_t *p)
+{
+	int poll = 0;
+	uint32_t data = 0;
+
+	while (data == 0) {
+		/* NOTE: Deliberately start with a sleep - ensures that the FPGA pipe is empty */
+		nt_os_wait_usec(1000);
+		data = nthw_pci_wr_tg_get_ctrl_rdy(p->mp_nthw_pci_wr_tg);
+		poll++;
+
+		if (poll >= 1000) {
+			NT_LOG(ERR, NTHW, "%s: FAILED waiting PCI WR TG ready: poll=%d\n",
+				__func__, poll);
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
+int nt4ga_pci_ta_tg_measure_throughput_run(struct adapter_info_s *p_adapter_info,
+	struct nthw_hif_end_point_counters *pri,
+	struct nthw_hif_end_point_counters *sla)
+{
+	nt4ga_pci_ta_tg_t *p = &p_adapter_info->nt4ga_pci_ta_tg;
+
+	const int delay = pri->n_tg_delay;
+	const int pkt_size = pri->n_tg_pkt_size;
+	const int num_pkts = pri->n_tg_num_pkts;
+	const int n_direction = pri->n_tg_direction;
+	const uint8_t n_numa_node = (uint8_t)pri->n_numa_node;
+	const int dma_buf_size = (4 * 1024 * 1024);
+
+	const size_t align_size = nt_util_align_size(dma_buf_size);
+	uint32_t *mem_addr;
+	uint64_t iova;
+
+	int bo_error = 0;
+
+	nthw_hif *p_primary_instance = p_adapter_info->fpga_info.mp_nthw_hif;
+	nthw_hif *p_secondary_instance = NULL;
+
+	nthw_pcie3 *p_pci_primary = p_adapter_info->fpga_info.mp_nthw_pcie3;
+	nthw_pcie3 *p_pci_secondary = NULL;
+
+	assert(p_primary_instance || p_pci_primary);
+
+	struct nt_dma_s *p_dma;
+	/* FPGA needs a Page alignment (4K on Intel) */
+	p_dma = nt_dma_alloc(align_size, 0x1000, n_numa_node);
+
+	if (p_dma == NULL) {
+		NT_LOG(DBG, ETHDEV, "%s: vfio_dma_alloc failed\n", __func__);
+		return 0;
+	}
+
+	mem_addr = (uint32_t *)p_dma->addr;
+	iova = p_dma->iova;
+
+	NT_LOG(DBG, NTHW, "%s: Running HIF bandwidth measurements on NUMA node %d\n", __func__,
+		n_numa_node);
+
+	bo_error = 0;
+	{
+		int wrap;
+
+		/* Stop any existing running test */
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 0);
+
+		/* Prepare the HIF Traffic generator */
+		bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 1);
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		/*
+		 * Ensure that the hostbuffer memory contain data that can be read -
+		 * For this we will ask the FPGA to write data to it. The last wrap packet
+		 * does not generate any data it only wraps (unlike the PCIe2 TG)
+		 */
+		{
+			int pkt;
+
+			for (pkt = 0; pkt < num_pkts; pkt++) {
+				if (pkt >= (num_pkts - 1))
+					wrap = 1;
+
+				else
+					wrap = 0;
+
+				bo_error |= nt4ga_pci_ta_tg_wr_tg_setup(p, iova, pkt, pkt_size, 0,
+						wrap, 1);
+				bo_error |= nt4ga_pci_ta_tg_rd_tg_setup(p, iova, pkt, pkt_size, 0,
+						wrap);
+			}
+		}
+
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 1);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		/* Start WR TG Write once */
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 1);
+		/* Wait until WR TG ready */
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		/* Verify that we have a packet */
+		{
+			int pkt;
+
+			for (pkt = 0; pkt < num_pkts; pkt++) {
+				uint32_t value = 0;
+				int poll;
+
+				for (poll = 8; poll < pkt_size; poll += 4, value++) {
+					if (*(uint32_t *)((uint8_t *)mem_addr + (pkt * pkt_size) +
+							poll) != value) {
+						NT_LOG(ERR, NTHW,
+							"HIF TG: Prepare failed. Data write failed: #%d.%d:  %016X:%08X\n",
+							pkt, poll,
+							*(uint32_t *)((uint8_t *)mem_addr +
+								(pkt * pkt_size) + poll),
+							value);
+
+						/*
+						 * Break out of the verification loop on first
+						 * compare error
+						 */
+						bo_error |= 1;
+						break;
+					}
+				}
+			}
+		}
+
+		switch (n_direction) {
+		case 1:	/* Read only test */
+			nt4ga_pci_ta_tg_wr_tg_run(p, 0xffff);
+			break;
+
+		case 2:	/* Write only test */
+			nt4ga_pci_ta_tg_rd_tg_run(p, 0xffff);
+			break;
+
+		case 3:	/* Combined read/write test */
+			nt4ga_pci_ta_tg_wr_tg_run(p, 0xffff);
+			nt4ga_pci_ta_tg_rd_tg_run(p, 0xffff);
+			break;
+
+		default:/* stop tests */
+			nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+			nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+			break;
+		}
+
+		do {
+			/* prep */
+			if (p_pci_primary)
+				nthw_pcie3_end_point_counters_sample_pre(p_pci_primary, pri);
+
+			if (p_pci_secondary)
+				nthw_pcie3_end_point_counters_sample_pre(p_pci_secondary, sla);
+
+			/* start measure */
+			if (p_primary_instance)
+				nthw_hif_stat_req_enable(p_primary_instance);
+
+			if (p_pci_primary)
+				nthw_pcie3_stat_req_enable(p_pci_primary);
+
+			if (p_secondary_instance)
+				nthw_hif_stat_req_enable(p_secondary_instance);
+
+			if (p_pci_secondary)
+				nthw_pcie3_stat_req_enable(p_pci_secondary);
+
+			/* Wait */
+			nt_os_wait_usec(delay);
+
+			/* Stop measure */
+			if (p_primary_instance)
+				nthw_hif_stat_req_disable(p_primary_instance);
+
+			if (p_pci_primary)
+				nthw_pcie3_stat_req_disable(p_pci_primary);
+
+			if (p_secondary_instance)
+				nthw_hif_stat_req_disable(p_secondary_instance);
+
+			if (p_pci_secondary)
+				nthw_pcie3_stat_req_disable(p_pci_secondary);
+
+			/* Post process primary */
+			if (p_primary_instance)
+				nthw_hif_end_point_counters_sample(p_primary_instance, pri);
+
+			if (p_pci_primary)
+				nthw_pcie3_end_point_counters_sample_post(p_pci_primary, pri);
+
+			/* Post process secondary */
+			if (p_secondary_instance)
+				nthw_hif_end_point_counters_sample(p_secondary_instance, sla);
+
+			if (p_pci_secondary)
+				nthw_pcie3_end_point_counters_sample_post(p_pci_secondary, sla);
+
+			{
+				/* Check for TA transmit errors */
+				uint32_t dw_good_pkts, dw_bad_pkts, dw_bad_length, dw_bad_payload;
+				nt4ga_pci_ta_tg_ta_read_packet_good(p, &dw_good_pkts);
+				nt4ga_pci_ta_tg_ta_read_packet_bad(p, &dw_bad_pkts);
+				nt4ga_pci_ta_tg_ta_read_length_error(p, &dw_bad_length);
+				nt4ga_pci_ta_tg_ta_read_payload_error(p, &dw_bad_payload);
+
+				NT_LOG(DBG, NTHW,
+					"%s: NUMA node %u: HIF: TA: Good pkts, Bad pkts, Bad length, Bad payload\n",
+					__func__, n_numa_node);
+				NT_LOG(DBG, NTHW,
+					"%s: NUMA node %u: HIF: TA: 0x%08x 0x%08x 0x%08x 0x%08x\n",
+					__func__, n_numa_node, dw_good_pkts, dw_bad_pkts,
+					dw_bad_length, dw_bad_payload);
+
+				if (dw_bad_pkts | dw_bad_length | dw_bad_payload) {
+					bo_error |= 1;
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: error detected\n",
+						__func__, n_numa_node);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Good packets received: %u\n",
+						__func__, n_numa_node, dw_good_pkts);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Bad packets received : %u\n",
+						__func__, n_numa_node, dw_bad_pkts);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Bad length received  : %u\n",
+						__func__, n_numa_node, dw_bad_length);
+					NT_LOG(ERR, NTHW,
+						"%s: NUMA node %u: HIF: TA: Bad payload received : %u\n",
+						__func__, n_numa_node, dw_bad_payload);
+				}
+			}
+
+			if (bo_error != 0)
+				break;
+
+			break;	/* for now only loop once */
+
+			/*
+			 * Only do "signalstop" looping if a specific numa node and direction is to
+			 * be tested.
+			 */
+		} while ((bo_error == 0) && (n_numa_node != UINT8_MAX) && (n_direction != -1));
+
+		/* Stop the test */
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+		bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+
+		bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 0);
+
+		/* PCIe3 sanity checks */
+		{
+#if defined(DEBUG)
+			int do_loop = 1;
+#else
+			int do_loop = 0;
+#endif
+
+			while (do_loop) {
+				do_loop = 0;
+
+				if (p_primary_instance) {
+					nthw_hif_stat_req_enable(p_primary_instance);
+					nt_os_wait_usec(100);
+					nthw_hif_stat_req_disable(p_primary_instance);
+				}
+
+				if (do_loop == 0)
+					break;
+
+				NT_LOG(DBG, NTHW, "%s: WARNING this is wrong - wait again\n",
+					__func__);
+				nt_os_wait_usec(200 * 1000);
+			}
+		}
+	}
+
+	/* Stop the test */
+
+	bo_error |= nt4ga_pci_ta_tg_wr_tg_run(p, 0);
+	bo_error |= nt4ga_pci_ta_tg_wr_tg_wait_ready(p);
+
+	bo_error |= nt4ga_pci_ta_tg_rd_tg_run(p, 0);
+	bo_error |= nt4ga_pci_ta_tg_rd_tg_wait_ready(p);
+
+	bo_error |= nt4ga_pci_ta_tg_ta_write_control_enable(p, 0);
+
+	nt_dma_free(p_dma);
+
+	return bo_error;
+}
+
+int nt4ga_pci_ta_tg_measure_throughput_main(struct adapter_info_s *p_adapter_info,
+	const uint8_t numa_node, const int direction,
+	const int n_pkt_size, const int n_batch_count,
+	const int n_delay)
+{
+	/* All numa nodes is indicated by UINT8_MAX */
+	const uint8_t numa_begin = (numa_node == UINT8_MAX ? 0 : numa_node);
+	const uint8_t numa_end = numa_begin;
+
+	/* sanity check direction param */
+	const int dir_begin = (direction <= 0 ? 1 : direction);
+	const int dir_end = (direction <= 0 ? 3 : direction);
+
+	int bo_error = 0;
+	struct nthw_hif_end_points eps;
+
+	if (n_delay == 0)
+		return -1;
+
+	NT_LOG(DBG, NTHW, "HIF adapter throughput:\n");
+
+	/* Only do "signalstop"-looping if a specific numa node is to be tested. */
+	{
+		uint8_t numa;
+
+		for (numa = numa_begin; numa <= numa_end; numa++) {
+			int by_loop;
+
+			for (by_loop = dir_begin; by_loop <= dir_end; by_loop++) {
+				struct nthw_hif_end_point_counters *pri = &eps.pri;
+				struct nthw_hif_end_point_counters *sla = &eps.sla;
+
+				pri->n_numa_node = numa;
+				pri->n_tg_direction = by_loop;
+				pri->n_tg_pkt_size = (n_pkt_size > 0 ? n_pkt_size : TG_PKT_SIZE);
+				pri->n_tg_num_pkts =
+					(n_batch_count > 0 ? n_batch_count : TG_NUM_PACKETS);
+				pri->n_tg_delay = (n_delay > 0 ? n_delay : TG_DELAY);
+				pri->cur_rx = 0;
+				pri->cur_tx = 0;
+				pri->n_ref_clk_cnt = -1;
+				pri->bo_error = 0;
+
+				sla->n_numa_node = numa;
+				sla->n_tg_direction = by_loop;
+				sla->n_tg_pkt_size = (n_pkt_size > 0 ? n_pkt_size : TG_PKT_SIZE);
+				sla->n_tg_num_pkts =
+					(n_batch_count > 0 ? n_batch_count : TG_NUM_PACKETS);
+				sla->n_tg_delay = (n_delay > 0 ? n_delay : TG_DELAY);
+				sla->cur_rx = 0;
+				sla->cur_tx = 0;
+				pri->n_ref_clk_cnt = -1;
+				sla->bo_error = 0;
+
+				bo_error += nt4ga_pci_ta_tg_measure_throughput_run(p_adapter_info,
+						pri, sla);
+#if defined(DEBUG) && (1)
+				{
+					NT_LOG(DBG, NTHW,
+						"%s: @ %d: %d %d %d %d: %016lX %016lX : %6ld Mbps %6ld Mbps\n",
+						__func__, pri->n_numa_node, pri->n_tg_direction,
+						pri->n_tg_num_pkts, pri->n_tg_pkt_size,
+						pri->n_tg_delay, pri->cur_rx, pri->cur_tx,
+						(pri->cur_rx * 8UL / 1000000UL),
+						(pri->cur_tx * 8UL / 1000000UL));
+				}
+				{
+					NT_LOG(DBG, NTHW,
+						"%s: @ %d: %d %d %d %d: %016lX %016lX : %6ld Mbps %6ld Mbps\n",
+						__func__, sla->n_numa_node, sla->n_tg_direction,
+						sla->n_tg_num_pkts, sla->n_tg_pkt_size,
+						sla->n_tg_delay, sla->cur_rx, sla->cur_tx,
+						(sla->cur_rx * 8UL / 1000000UL),
+						(sla->cur_tx * 8UL / 1000000UL));
+				}
+#endif
+
+				if (pri->bo_error != 0 || sla->bo_error != 0)
+					bo_error++;
+
+				if (bo_error)
+					break;
+			}
+		}
+	}
+
+	if (bo_error != 0)
+		NT_LOG(ERR, NTHW, "%s: error during bandwidth measurement\n", __func__);
+
+	NT_LOG(DBG, NTHW, "HIF adapter throughput: done %s\n", __func__);
+
+	return 0;
+}
drivers/net/ntnic/adapter/nt4ga_tfg.c new file +69 -0

69 lines not on this page · raw message

drivers/net/ntnic/include/nt4ga_tfg.h +2 -0
index 9797403dec..db2f42b215 100644
@@ -7,6 +7,8 @@
 #define NT4GA_TFG_H_
 
 typedef struct nt4ga_tfg_s {
+	nthw_gfg_t *mp_nthw_gfg;
+	nthw_gmf_t *mp_nthw_gmf;
 	nthw_mac_tfg_t *mp_nthw_mac_tfg;
 } nt4ga_tfg_t;
 
drivers/net/ntnic/include/ntnic_nim.h +1 -0
index 41457b7a07..fc9b2a2b23 100644
@@ -93,6 +93,7 @@ typedef struct nim_i2c_ctx {
 	union {
 		nthw_iic_t hwiic;	/* depends on *Fpga_t, instance number, and cycle time */
 		struct {
+			nthw_i2cm_t *p_nt_i2cm;
 			int mux_channel;
 		} hwagx;
 	};
drivers/net/ntnic/meson.build +8 -0
index e21c075d74..84f8f47743 100644
@@ -75,6 +75,8 @@ headers = files('rte_pmd_ntnic.h')
 # all sources
 sources = files(
     'dpdk_mod_reg.c',
+    'adapter/nt4ga_pci_ta_tg.c',
+    'adapter/nt4ga_tfg.c',
     'nthw/supported/nthw_fpga_9563_055_039_0000.c',
     'nthw/supported/nthw_fpga_instances.c',
     'nthw/supported/nthw_fpga_mod_str_map.c',
@@ -84,10 +86,16 @@ sources = files(
     'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
     'nthw/core/nthw_fpga.c',
     'nthw/core/nthw_fpga_rst.c',
+    'nthw/core/nthw_gfg.c',
+    'nthw/core/nthw_gmf.c',
     'nthw/core/nthw_hif.c',
+    'nthw/core/nthw_i2cm.c',
     'nthw/core/nthw_iic.c',
     'nthw/core/nthw_mac_pcs_xxv.c',
     'nthw/core/nthw_pcie3.c',
+    'nthw/core/nthw_pci_rd_tg.c',
+    'nthw/core/nthw_pci_ta.c',
+    'nthw/core/nthw_pci_wr_tg.c',
     'nthw/core/nthw_sdc.c',
     'nthw/core/nthw_si5340.c',
     'nthw/core/nthw_spim.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +6 -0
index f2d56a41f9..b72766cc5c 100644
@@ -13,8 +13,14 @@
 #include "nthw_fpga_model.h"
 #include "nthw_hif.h"
 #include "nthw_pcie3.h"
+#include "nthw_pci_rd_tg.h"
+#include "nthw_pci_wr_tg.h"
+#include "nthw_pci_ta.h"
 #include "nthw_iic.h"
+#include "nthw_i2cm.h"
 
+#include "nthw_gfg.h"
+#include "nthw_gmf.h"
 #include "nthw_mac_pcs_xxv.h"
 #include "nthw_mac_tfg.h"
 #include "nthw_sdc.h"
drivers/net/ntnic/nthw/core/include/nthw_gfg.h new file +40 -0
new file mode 100644
index 0000000000..fd477775d5
@@ -0,0 +1,40 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NTHW_GFG_H_
+#define NTHW_GFG_H_
+
+struct nthw_gfg {
+	nthw_fpga_t *mp_fpga;
+	nthw_module_t *mp_mod_gfg;
+	int mn_instance;
+
+	int mn_param_gfg_present;
+
+	nthw_field_t *mpa_fld_ctrl_enable[8];
+	nthw_field_t *mpa_fld_ctrl_mode[8];
+	nthw_field_t *mpa_fld_ctrl_prbs_en[8];
+	nthw_field_t *mpa_fld_ctrl_size[8];
+	nthw_field_t *mpa_fld_stream_id_val[8];
+	nthw_field_t *mpa_fld_run_run[8];
+	nthw_field_t *mpa_fld_size_mask[8];
+	nthw_field_t *mpa_fld_burst_size_val[8];
+};
+
+typedef struct nthw_gfg nthw_gfg_t;
+typedef struct nthw_gfg nthw_gfg;
+
+nthw_gfg_t *nthw_gfg_new(void);
+int nthw_gfg_init(nthw_gfg_t *p, nthw_fpga_t *p_fpga, int n_instance);
+
+int nthw_gfg_start(nthw_gfg_t *p, const int n_intf_no, const int n_frame_count,
+	const int n_frame_size, const int n_frame_fill_mode,
+	const int n_frame_stream_id);
+int nthw_gfg_stop(nthw_gfg_t *p, const int n_intf_no);
+int nthw_gfg_setup(nthw_gfg_t *p, const size_t n_intf_no, const int n_enable,
+	const int n_frame_count, const int n_frame_size, const int n_frame_fill_mode,
+	const int n_frame_stream_id);
+
+#endif	/* NTHW_GFG_H_ */
drivers/net/ntnic/nthw/core/include/nthw_gmf.h new file +75 -0

75 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_i2cm.h new file +51 -0

51 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_pci_rd_tg.h new file +50 -0

50 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_pci_ta.h new file +40 -0
new file mode 100644
index 0000000000..56892d25d2
@@ -0,0 +1,40 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_PCI_TA_H__
+#define __NTHW_PCI_TA_H__
+
+struct nthw_pci_ta {
+	nthw_fpga_t *mp_fpga;
+	nthw_module_t *mp_mod_pci_ta;
+	int mn_instance;
+
+	int mn_param_pci_ta_tg_present;
+
+	nthw_register_t *mp_reg_pci_ta_ctrl;
+	nthw_field_t *mp_fld_pci_ta_ctrl_enable;
+	nthw_register_t *mp_reg_pci_ta_packet_good;
+	nthw_field_t *mp_fld_pci_ta_packet_good_amount;
+	nthw_register_t *mp_reg_pci_ta_packet_bad;
+	nthw_field_t *mp_fld_pci_ta_packet_bad_amount;
+	nthw_register_t *mp_reg_pci_ta_length_error;
+	nthw_field_t *mp_fld_pci_ta_length_error_amount;
+	nthw_register_t *mp_reg_pci_ta_payload_error;
+	nthw_field_t *mp_fld_pci_ta_payload_error_amount;
+};
+
+typedef struct nthw_pci_ta nthw_pci_ta_t;
+typedef struct nthw_pci_ta nthw_pci_ta;
+
+nthw_pci_ta_t *nthw_pci_ta_new(void);
+int nthw_pci_ta_init(nthw_pci_ta_t *p, nthw_fpga_t *p_fpga, int n_instance);
+
+void nthw_pci_ta_set_control_enable(nthw_pci_ta_t *p, uint32_t val);
+void nthw_pci_ta_get_packet_good(nthw_pci_ta_t *p, uint32_t *val);
+void nthw_pci_ta_get_packet_bad(nthw_pci_ta_t *p, uint32_t *val);
+void nthw_pci_ta_get_length_error(nthw_pci_ta_t *p, uint32_t *val);
+void nthw_pci_ta_get_payload_error(nthw_pci_ta_t *p, uint32_t *val);
+
+#endif	/* __NTHW_PCI_TA_H__ */
drivers/net/ntnic/nthw/core/include/nthw_pci_wr_tg.h new file +55 -0

55 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_gfg.c new file +365 -0

365 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_gmf.c new file +176 -0

176 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_i2cm.c new file +197 -0

197 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pci_rd_tg.c new file +115 -0

115 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pci_ta.c new file +94 -0

94 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pci_wr_tg.c new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.45.0
#47 lore raw

PATCH v3 14/17 net/ntnic: add adapter initialization API

In reply to Serhii Iliushyk

Add ntnic adapter initialization API.

---
v3:
* Fix meson file: list of source files
* Remove pthread and left rte_thread

---
 drivers/net/ntnic/adapter/nt4ga_adapter.c | 497 ++++++++++++++++++++++
 drivers/net/ntnic/meson.build             |   1 +
 2 files changed, 498 insertions(+)
 create mode 100644 drivers/net/ntnic/adapter/nt4ga_adapter.c
drivers/net/ntnic/adapter/nt4ga_adapter.c new file +497 -0
new file mode 100644
index 0000000000..e109d8eed1
@@ -0,0 +1,497 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <rte_thread.h>
+
+#include "ntlog.h"
+
+#include "nthw_drv.h"
+#include "nthw_fpga.h"
+#include "nthw_register.h"
+#include "nt4ga_adapter.h"
+#include "nt4ga_pci_ta_tg.h"
+#include "ntnic_mod_reg.h"
+
+#include "flow_filter.h"
+
+static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info);
+static int nt4ga_adapter_deinit(struct adapter_info_s *p_adapter_info);
+
+static int nt4ga_adapter_show_info(struct adapter_info_s *p_adapter_info, FILE *pfh);
+
+/*
+ * Global variables shared by NT adapter types
+ */
+rte_thread_t monitor_tasks[NUM_ADAPTER_MAX];
+volatile int monitor_task_is_running[NUM_ADAPTER_MAX];
+
+/*
+ * Signal-handler to stop all monitor threads
+ */
+static void stop_monitor_tasks(int signum)
+{
+	const size_t N = ARRAY_SIZE(monitor_task_is_running);
+	size_t i;
+
+	/* Stop all monitor tasks */
+	for (i = 0; i < N; i++) {
+		const int is_running = monitor_task_is_running[i];
+		monitor_task_is_running[i] = 0;
+
+		if (signum == -1 && is_running != 0) {
+			rte_thread_join(monitor_tasks[i], NULL);
+			memset(&monitor_tasks[i], 0, sizeof(monitor_tasks[0]));
+		}
+	}
+}
+
+static int nt4ga_adapter_show_info(struct adapter_info_s *p_adapter_info, FILE *pfh)
+{
+	const char *const p_dev_name = p_adapter_info->p_dev_name;
+	const char *const p_adapter_id_str = p_adapter_info->mp_adapter_id_str;
+	fpga_info_t *p_fpga_info = &p_adapter_info->fpga_info;
+	hw_info_t *p_hw_info = &p_adapter_info->hw_info;
+	mcu_info_t *mcu_info = &p_adapter_info->fpga_info.mcu_info;
+	char a_pci_ident_str[32];
+	const struct nt4ga_stat_ops *nt4ga_stat_ops = get_nt4ga_stat_ops();
+
+	if (nt4ga_stat_ops != NULL)
+		nt4ga_stat_ops->nt4ga_stat_dump(p_adapter_info, pfh);
+
+	snprintf(a_pci_ident_str, sizeof(a_pci_ident_str), "" PCIIDENT_PRINT_STR "",
+		PCIIDENT_TO_DOMAIN(p_fpga_info->pciident),
+		PCIIDENT_TO_BUSNR(p_fpga_info->pciident),
+		PCIIDENT_TO_DEVNR(p_fpga_info->pciident),
+		PCIIDENT_TO_FUNCNR(p_fpga_info->pciident));
+
+	fprintf(pfh, "%s: DeviceName: %s\n", p_adapter_id_str, (p_dev_name ? p_dev_name : "NA"));
+	fprintf(pfh, "%s: PCI Details:\n", p_adapter_id_str);
+	fprintf(pfh, "%s: %s: %08X: %04X:%04X %04X:%04X\n", p_adapter_id_str, a_pci_ident_str,
+		p_fpga_info->pciident, p_hw_info->pci_vendor_id, p_hw_info->pci_device_id,
+		p_hw_info->pci_sub_vendor_id, p_hw_info->pci_sub_device_id);
+	fprintf(pfh, "%s: FPGA Details:\n", p_adapter_id_str);
+	fprintf(pfh, "%s: %03d-%04d-%02d-%02d [%016" PRIX64 "] (%08X)\n", p_adapter_id_str,
+		p_fpga_info->n_fpga_type_id, p_fpga_info->n_fpga_prod_id,
+		p_fpga_info->n_fpga_ver_id, p_fpga_info->n_fpga_rev_id, p_fpga_info->n_fpga_ident,
+		p_fpga_info->n_fpga_build_time);
+	fprintf(pfh, "%s: FpgaDebugMode=0x%x\n", p_adapter_id_str, p_fpga_info->n_fpga_debug_mode);
+	fprintf(pfh, "%s: Nims=%d PhyPorts=%d PhyQuads=%d RxPorts=%d TxPorts=%d\n",
+		p_adapter_id_str, p_fpga_info->n_nims, p_fpga_info->n_phy_ports,
+		p_fpga_info->n_phy_quads, p_fpga_info->n_rx_ports, p_fpga_info->n_tx_ports);
+	fprintf(pfh, "%s: Hw=0x%02X_rev%d: %s\n", p_adapter_id_str, p_hw_info->hw_platform_id,
+		p_fpga_info->nthw_hw_info.hw_id, p_fpga_info->nthw_hw_info.hw_plat_id_str);
+	fprintf(pfh, "%s: MCU Details:\n", p_adapter_id_str);
+	fprintf(pfh, "%s: HasMcu=%d McuType=%d McuDramSize=%d\n", p_adapter_id_str,
+		mcu_info->mb_has_mcu, mcu_info->mn_mcu_type, mcu_info->mn_mcu_dram_size);
+
+	if (nt4ga_stat_ops != NULL)
+		nt4ga_stat_ops->nt4ga_stat_dump(p_adapter_info, pfh);
+
+	return 0;
+}
+
+/*
+ * SPI for sensors reading
+ */
+nthw_spis_t *new_sensors_t_spi(struct nthw_fpga_s *p_fpga)
+{
+	nthw_spis_t *sensors_t_spi = nthw_spis_new();
+
+	/* init SPI for sensor initialization process */
+	if (sensors_t_spi == NULL) {
+		NT_LOG(ERR, ETHDEV, "%s: SPI allocation error\n", __func__);
+		return NULL;
+	}
+
+	if (nthw_spis_init(sensors_t_spi, p_fpga, 0)) {
+		NT_LOG(ERR, ETHDEV, "%s: SPI initialization error\n", __func__);
+		nthw_spis_delete(sensors_t_spi);
+		return NULL;
+	}
+
+	return sensors_t_spi;
+}
+
+static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL)
+		NT_LOG(ERR, ETHDEV, "%s: flow_filter module uninitialized\n", __func__);
+
+	char *const p_dev_name = malloc(24);
+	char *const p_adapter_id_str = malloc(24);
+	fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
+	hw_info_t *p_hw_info = &p_adapter_info->hw_info;
+
+	/*
+	 * IMPORTANT: Most variables cannot be determined before nthw fpga model is instantiated
+	 * (nthw_fpga_init())
+	 */
+	bool b_has_mcu = false;
+	int n_phy_ports = -1;
+	int n_nim_ports = -1;
+	int res = -1;
+	nthw_fpga_t *p_fpga = NULL;
+
+	(void)b_has_mcu;/* currently UNUSED - prevent warning */
+	(void)n_nim_ports;	/* currently UNUSED - prevent warning */
+
+	p_hw_info->n_nthw_adapter_id = nthw_platform_get_nthw_adapter_id(p_hw_info->pci_device_id);
+
+	fpga_info->n_nthw_adapter_id = p_hw_info->n_nthw_adapter_id;
+	/* ref: DN-0060 section 9 */
+	p_hw_info->hw_product_type = p_hw_info->pci_device_id & 0x000f;
+	/* ref: DN-0060 section 9 */
+	p_hw_info->hw_platform_id = (p_hw_info->pci_device_id >> 4) & 0x00ff;
+	/* ref: DN-0060 section 9 */
+	p_hw_info->hw_reserved1 = (p_hw_info->pci_device_id >> 12) & 0x000f;
+
+	/* mp_dev_name */
+	p_adapter_info->p_dev_name = p_dev_name;
+
+	if (p_dev_name) {
+		snprintf(p_dev_name, 24, "" PCIIDENT_PRINT_STR "",
+			PCIIDENT_TO_DOMAIN(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_BUSNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_DEVNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_FUNCNR(p_adapter_info->fpga_info.pciident));
+		NT_LOG(DBG, ETHDEV, "%s: (0x%08X)\n", p_dev_name,
+			p_adapter_info->fpga_info.pciident);
+	}
+
+	/* mp_adapter_id_str */
+	p_adapter_info->mp_adapter_id_str = p_adapter_id_str;
+
+	p_adapter_info->fpga_info.mp_adapter_id_str = p_adapter_id_str;
+
+	if (p_adapter_id_str) {
+		snprintf(p_adapter_id_str, 24, "PCI:" PCIIDENT_PRINT_STR "",
+			PCIIDENT_TO_DOMAIN(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_BUSNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_DEVNR(p_adapter_info->fpga_info.pciident),
+			PCIIDENT_TO_FUNCNR(p_adapter_info->fpga_info.pciident));
+		NT_LOG(DBG, ETHDEV, "%s: %s\n", p_adapter_id_str, p_dev_name);
+	}
+
+	{
+		int i;
+
+		for (i = 0; i < (int)ARRAY_SIZE(p_adapter_info->mp_port_id_str); i++) {
+			char *p = malloc(32);
+
+			if (p) {
+				snprintf(p, 32, "%s:intf_%d",
+					(p_adapter_id_str ? p_adapter_id_str : "NA"), i);
+			}
+
+			p_adapter_info->mp_port_id_str[i] = p;
+		}
+	}
+
+	res = nthw_fpga_init(&p_adapter_info->fpga_info);
+
+	if (res) {
+		NT_LOG(ERR, ETHDEV, "%s: %s: FPGA=%04d res=x%08X [%s:%u]\n", p_adapter_id_str,
+			p_dev_name, fpga_info->n_fpga_prod_id, res, __func__, __LINE__);
+		return res;
+	}
+
+	assert(fpga_info);
+	p_fpga = fpga_info->mp_fpga;
+	assert(p_fpga);
+	n_phy_ports = fpga_info->n_phy_ports;
+	assert(n_phy_ports >= 1);
+	n_nim_ports = fpga_info->n_nims;
+	assert(n_nim_ports >= 1);
+	b_has_mcu = fpga_info->mcu_info.mb_has_mcu;
+
+	/* NOTE: RX and TX queues for VFs shall be considered too */
+	int max_rx_queues = nthw_fpga_get_product_param(p_fpga, NT_DBS_RX_QUEUES, -1);
+	int max_tx_queues = nthw_fpga_get_product_param(p_fpga, NT_DBS_TX_QUEUES, -1);
+
+	if (max_rx_queues < 0 || max_tx_queues < 0 ||
+		n_phy_ports * p_adapter_info->n_rx_host_buffers > max_rx_queues ||
+		n_phy_ports * p_adapter_info->n_tx_host_buffers > max_tx_queues) {
+		NT_LOG(ERR, ETHDEV,
+			"%s: Too many queues requested: phy_ports=%d, rxqs=%d, txqs=%d, rx_queues_avail=%d, tx_queues_avail=%d\n",
+			p_adapter_info->mp_adapter_id_str, n_phy_ports,
+			p_adapter_info->n_rx_host_buffers, p_adapter_info->n_tx_host_buffers,
+			max_rx_queues, max_tx_queues);
+		nthw_fpga_shutdown(&p_adapter_info->fpga_info);
+		return -1;
+	}
+
+	/* Nt4ga Init Filter */
+	nt4ga_filter_t *p_filter = &p_adapter_info->nt4ga_filter;
+
+	if (flow_filter_ops != NULL) {
+		res = flow_filter_ops->flow_filter_init(p_fpga, &p_filter->mp_flow_device,
+				p_adapter_info->adapter_no);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot initialize filter\n", p_adapter_id_str);
+			return res;
+		}
+	}
+
+	/*
+	 * HIF/PCI TA/TG
+	 */
+	{
+		res = nt4ga_pci_ta_tg_init(p_adapter_info);
+
+		if (res == 0) {
+			nt4ga_pci_ta_tg_measure_throughput_main(p_adapter_info, 0, 0, TG_PKT_SIZE,
+				TG_NUM_PACKETS, TG_DELAY);
+
+		} else {
+			NT_LOG(WRN, ETHDEV, "%s: PCI TA/TG is not available - skipping\n",
+				p_adapter_id_str);
+		}
+	}
+
+	{
+		int i;
+		const struct link_ops_s *link_ops = NULL;
+		assert(fpga_info->n_fpga_prod_id > 0);
+
+		for (i = 0; i < NUM_ADAPTER_PORTS_MAX; i++) {
+			/* Disable all ports. Must be enabled later */
+			p_adapter_info->nt4ga_link.port_action[i].port_disable = true;
+		}
+
+		switch (fpga_info->n_fpga_prod_id) {
+		/* NT200A01: 2x100G (Xilinx) */
+		case 9563:	/* NT200A02 (Cap) */
+			link_ops = get_100g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV,
+					"%s: NT200A02 100G link module uninitialized\n", __func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		/* NT200A0x: 2x10G/2x25G (Xilinx) */
+		case 9530:	/* NT200A02 (NFV) */
+		case 9544:	/* NT200A02 (NFV Lenovo) */
+			link_ops = get_25g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV, "%s: NT200A02 25G link module uninitialized\n",
+					__func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		/* NT50b0x: 2x10G/2x25G (Xilinx) */
+		case 9542:	/* NT50B01 (NFV) */
+		case 9547:	/* NT50B01 (NFV Lenovo) */
+			link_ops = get_25g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV, "%s: NT50B01 25G link module uninitialized\n",
+					__func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		case 9569:	/* NT400D11 (Intel Agilex FPGA) */
+			link_ops = get_agx_100g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV,
+					"%s: NT400D11 100G link module uninitialized\n", __func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		case 9572:
+			/* NT200A0x: 8x10G (Xilinx) */
+			link_ops = get_8x10g_link_ops();
+
+			if (link_ops == NULL) {
+				NT_LOG(ERR, ETHDEV,
+					"%s: NT200A0x 8x10G link module uninitialized\n", __func__);
+				res = -1;
+				break;
+			}
+
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
+
+		default:
+			NT_LOG(ERR, ETHDEV, "%s: Unsupported FPGA product: %04d\n", __func__,
+				fpga_info->n_fpga_prod_id);
+			res = -1;
+			break;
+		}
+
+		if (res) {
+			NT_LOG(ERR, ETHDEV, "%s: %s: %s: %u: FPGA=%04d res=x%08X\n",
+				p_adapter_id_str, p_dev_name, __func__, __LINE__,
+				fpga_info->n_fpga_prod_id, res);
+			return res;
+		}
+	}
+
+	/*
+	 * HostBuffer Systems
+	 */
+	p_adapter_info->n_rx_host_buffers = 0;
+	p_adapter_info->n_tx_host_buffers = 0;
+
+	p_adapter_info->fpga_info.mp_nthw_epp = NULL;
+
+	if (nthw_epp_present(p_adapter_info->fpga_info.mp_fpga, 0)) {
+		p_adapter_info->fpga_info.mp_nthw_epp = nthw_epp_new();
+
+		if (p_adapter_info->fpga_info.mp_nthw_epp == NULL) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot create EPP\n", p_adapter_id_str);
+			return -1;
+		}
+
+		res = nthw_epp_init(p_adapter_info->fpga_info.mp_nthw_epp,
+				p_adapter_info->fpga_info.mp_fpga, 0);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot initialize EPP\n", p_adapter_id_str);
+			return res;
+
+		} else {
+			NT_LOG(DBG, ETHDEV, "%s: Initialized EPP\n", p_adapter_id_str);
+		}
+
+		res = nthw_epp_setup(p_adapter_info->fpga_info.mp_nthw_epp);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot setup EPP\n", p_adapter_id_str);
+			return res;
+		}
+	}
+
+	const struct nt4ga_stat_ops *nt4ga_stat_ops = get_nt4ga_stat_ops();
+
+	if (nt4ga_stat_ops != NULL) {
+		/* Nt4ga Stat init/setup */
+		res = nt4ga_stat_ops->nt4ga_stat_init(p_adapter_info);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot initialize the statistics module\n",
+				p_adapter_id_str);
+			return res;
+		}
+
+		res = nt4ga_stat_ops->nt4ga_stat_setup(p_adapter_info);
+
+		if (res != 0) {
+			NT_LOG(ERR, ETHDEV, "%s: Cannot setup the statistics module\n",
+				p_adapter_id_str);
+			return res;
+		}
+	}
+
+	/*
+	 * MCU testing
+	 */
+
+	return 0;
+}
+
+static int nt4ga_adapter_deinit(struct adapter_info_s *p_adapter_info)
+{
+	const struct sensor_ops *sensor_ops = get_sensor_ops();
+	fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
+	int i;
+	int res;
+	struct nt_sensor_group *cur_adapter_sensor = NULL;
+	struct nt_sensor_group *next_adapter_sensor = NULL;
+	struct nim_sensor_group *cur_nim_sensor = NULL;
+	struct nim_sensor_group *next_nim_sensor = NULL;
+
+	stop_monitor_tasks(-1);
+
+	const struct nt4ga_stat_ops *nt4ga_stat_ops = get_nt4ga_stat_ops();
+
+	if (nt4ga_stat_ops != NULL)
+		nt4ga_stat_ops->nt4ga_stat_stop(p_adapter_info);
+
+	nthw_fpga_shutdown(&p_adapter_info->fpga_info);
+
+	/* Rac rab reset flip flop */
+	res = nthw_rac_rab_reset(fpga_info->mp_nthw_rac);
+
+	/* Free adapter port ident strings */
+	for (i = 0; i < fpga_info->n_phy_ports; i++) {
+		if (p_adapter_info->mp_port_id_str[i]) {
+			free(p_adapter_info->mp_port_id_str[i]);
+			p_adapter_info->mp_port_id_str[i] = NULL;
+		}
+	}
+
+	/* Free adapter ident string */
+	if (p_adapter_info->mp_adapter_id_str) {
+		free(p_adapter_info->mp_adapter_id_str);
+		p_adapter_info->mp_adapter_id_str = NULL;
+	}
+
+	/* Free devname ident string */
+	if (p_adapter_info->p_dev_name) {
+		free(p_adapter_info->p_dev_name);
+		p_adapter_info->p_dev_name = NULL;
+	}
+
+	/* Free adapter sensors */
+	if (p_adapter_info->adapter_sensors != NULL) {
+		do {
+			cur_adapter_sensor = p_adapter_info->adapter_sensors;
+			next_adapter_sensor = p_adapter_info->adapter_sensors->next;
+			p_adapter_info->adapter_sensors = next_adapter_sensor;
+
+			if (sensor_ops != NULL)
+				sensor_ops->sensor_deinit(cur_adapter_sensor);
+		} while (next_adapter_sensor != NULL);
+	}
+
+	/* Free NIM sensors */
+	for (i = 0; i < fpga_info->n_phy_ports; i++) {
+		if (p_adapter_info->nim_sensors[i] != NULL) {
+			do {
+				cur_nim_sensor = p_adapter_info->nim_sensors[i];
+				next_nim_sensor = p_adapter_info->nim_sensors[i]->next;
+				p_adapter_info->nim_sensors[i] = next_nim_sensor;
+				free(cur_nim_sensor->sensor);
+				free(cur_nim_sensor);
+			} while (next_nim_sensor != NULL);
+		}
+	}
+
+	return res;
+}
+
+static const struct adapter_ops ops = {
+	.init = nt4ga_adapter_init,
+	.deinit = nt4ga_adapter_deinit,
+
+	.show_info = nt4ga_adapter_show_info,
+};
+
+static void __attribute__((constructor(65535))) adapter_init(void)
+{
+	register_adapter_ops(&ops);
+}
drivers/net/ntnic/meson.build +1 -0
index 84f8f47743..74c9e93e72 100644
@@ -75,6 +75,7 @@ headers = files('rte_pmd_ntnic.h')
 # all sources
 sources = files(
     'dpdk_mod_reg.c',
+    'adapter/nt4ga_adapter.c',
     'adapter/nt4ga_pci_ta_tg.c',
     'adapter/nt4ga_tfg.c',
     'nthw/supported/nthw_fpga_9563_055_039_0000.c',
Signature · 1 line
2.45.0