linux/drivers/net/ethernet/cavium/thunder/thunder_bgx.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2015 Cavium, Inc.
 */

#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/phy.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/of_net.h>

#include "nic_reg.h"
#include "nic.h"
#include "thunder_bgx.h"

#define DRV_NAME
#define DRV_VERSION

/* RX_DMAC_CTL configuration */
enum MCAST_MODE {};

#define BCAST_ACCEPT
#define CAM_ACCEPT
#define MCAST_MODE_MASK
#define BGX_MCAST_MODE(x)

struct dmac_map {};

struct lmac {};

struct bgx {};

static struct bgx *bgx_vnic[MAX_BGX_THUNDER];
static int lmac_count; /* Total no of LMACs in system */

static int bgx_xaui_check_link(struct lmac *lmac);

/* Supported devices */
static const struct pci_device_id bgx_id_table[] =;

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_VERSION();
MODULE_DEVICE_TABLE(pci, bgx_id_table);

/* The Cavium ThunderX network controller can *only* be found in SoCs
 * containing the ThunderX ARM64 CPU implementation.  All accesses to the device
 * registers on this platform are implicitly strongly ordered with respect
 * to memory accesses. So writeq_relaxed() and readq_relaxed() are safe to use
 * with no memory barriers in this driver.  The readq()/writeq() functions add
 * explicit ordering operation which in this case are redundant, and only
 * add overhead.
 */

/* Register read/write APIs */
static u64 bgx_reg_read(struct bgx *bgx, u8 lmac, u64 offset)
{}

static void bgx_reg_write(struct bgx *bgx, u8 lmac, u64 offset, u64 val)
{}

static void bgx_reg_modify(struct bgx *bgx, u8 lmac, u64 offset, u64 val)
{}

static int bgx_poll_reg(struct bgx *bgx, u8 lmac, u64 reg, u64 mask, bool zero)
{}

static int max_bgx_per_node;
static void set_max_bgx_per_node(struct pci_dev *pdev)
{}

static struct bgx *get_bgx(int node, int bgx_idx)
{}

/* Return number of BGX present in HW */
unsigned bgx_get_map(int node)
{}
EXPORT_SYMBOL();

/* Return number of LMAC configured for this BGX */
int bgx_get_lmac_count(int node, int bgx_idx)
{}
EXPORT_SYMBOL();

/* Returns the current link status of LMAC */
void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status)
{}
EXPORT_SYMBOL();

const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
{}
EXPORT_SYMBOL();

void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac)
{}
EXPORT_SYMBOL();

static void bgx_flush_dmac_cam_filter(struct bgx *bgx, int lmacid)
{}

static void bgx_lmac_remove_filters(struct lmac *lmac, u8 vf_id)
{}

static int bgx_lmac_save_filter(struct lmac *lmac, u64 dmac, u8 vf_id)
{}

static int bgx_set_dmac_cam_filter_mac(struct bgx *bgx, int lmacid,
				       u64 cam_dmac, u8 idx)
{}

void bgx_set_dmac_cam_filter(int node, int bgx_idx, int lmacid,
			     u64 cam_dmac, u8 vf_id)
{}
EXPORT_SYMBOL();

void bgx_set_xcast_mode(int node, int bgx_idx, int lmacid, u8 mode)
{}
EXPORT_SYMBOL();

void bgx_reset_xcast_mode(int node, int bgx_idx, int lmacid, u8 vf_id)
{}
EXPORT_SYMBOL();

void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable)
{}
EXPORT_SYMBOL();

/* Enables or disables timestamp insertion by BGX for Rx packets */
void bgx_config_timestamping(int node, int bgx_idx, int lmacid, bool enable)
{}
EXPORT_SYMBOL();

void bgx_lmac_get_pfc(int node, int bgx_idx, int lmacid, void *pause)
{}
EXPORT_SYMBOL();

void bgx_lmac_set_pfc(int node, int bgx_idx, int lmacid, void *pause)
{}
EXPORT_SYMBOL();

static void bgx_sgmii_change_link_state(struct lmac *lmac)
{}

static void bgx_lmac_handler(struct net_device *netdev)
{}

u64 bgx_get_rx_stats(int node, int bgx_idx, int lmac, int idx)
{}
EXPORT_SYMBOL();

u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx)
{}
EXPORT_SYMBOL();

/* Configure BGX LMAC in internal loopback mode */
void bgx_lmac_internal_loopback(int node, int bgx_idx,
				int lmac_idx, bool enable)
{}
EXPORT_SYMBOL();

static int bgx_lmac_sgmii_init(struct bgx *bgx, struct lmac *lmac)
{}

static int bgx_lmac_xaui_init(struct bgx *bgx, struct lmac *lmac)
{}

static int bgx_xaui_check_link(struct lmac *lmac)
{}

static void bgx_poll_for_sgmii_link(struct lmac *lmac)
{}

static void bgx_poll_for_link(struct work_struct *work)
{}

static int phy_interface_mode(u8 lmac_type)
{}

static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid)
{}

static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid)
{}

static void bgx_init_hw(struct bgx *bgx)
{}

static u8 bgx_get_lane2sds_cfg(struct bgx *bgx, struct lmac *lmac)
{}

static void bgx_print_qlm_mode(struct bgx *bgx, u8 lmacid)
{}

static void lmac_set_lane2sds(struct bgx *bgx, struct lmac *lmac)
{}

static void lmac_set_training(struct bgx *bgx, struct lmac *lmac, int lmacid)
{}

static void bgx_set_lmac_config(struct bgx *bgx, u8 idx)
{}

static void bgx_get_qlm_mode(struct bgx *bgx)
{}

#ifdef CONFIG_ACPI

static int acpi_get_mac_address(struct device *dev, struct acpi_device *adev,
				u8 *dst)
{}

/* Currently only sets the MAC address. */
static acpi_status bgx_acpi_register_phy(acpi_handle handle,
					 u32 lvl, void *context, void **rv)
{}

static acpi_status bgx_acpi_match_id(acpi_handle handle, u32 lvl,
				     void *context, void **ret_val)
{}

static int bgx_init_acpi_phy(struct bgx *bgx)
{}

#else

static int bgx_init_acpi_phy(struct bgx *bgx)
{
	return -ENODEV;
}

#endif /* CONFIG_ACPI */

#if IS_ENABLED(CONFIG_OF_MDIO)

static int bgx_init_of_phy(struct bgx *bgx)
{}

#else

static int bgx_init_of_phy(struct bgx *bgx)
{
	return -ENODEV;
}

#endif /* CONFIG_OF_MDIO */

static int bgx_init_phy(struct bgx *bgx)
{}

static irqreturn_t bgx_intr_handler(int irq, void *data)
{}

static void bgx_register_intr(struct pci_dev *pdev)
{}

static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{}

static void bgx_remove(struct pci_dev *pdev)
{}

static struct pci_driver bgx_driver =;

static int __init bgx_init_module(void)
{}

static void __exit bgx_cleanup_module(void)
{}

module_init();
module_exit(bgx_cleanup_module);