linux/drivers/scsi/csiostor/csio_hw.h

/*
 * This file is part of the Chelsio FCoE driver for Linux.
 *
 * Copyright (c) 2008-2012 Chelsio Communications, Inc. All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#ifndef __CSIO_HW_H__
#define __CSIO_HW_H__

#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/device.h>
#include <linux/workqueue.h>
#include <linux/compiler.h>
#include <linux/cdev.h>
#include <linux/list.h>
#include <linux/mempool.h>
#include <linux/io.h>
#include <linux/spinlock_types.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_transport_fc.h>

#include "t4_hw.h"
#include "csio_hw_chip.h"
#include "csio_wr.h"
#include "csio_mb.h"
#include "csio_scsi.h"
#include "csio_defs.h"
#include "t4_regs.h"
#include "t4_msg.h"

/*
 * An error value used by host. Should not clash with FW defined return values.
 */
#define FW_HOSTERROR

#define CSIO_HW_NAME
#define CSIO_MAX_PFN
#define CSIO_MAX_PPORTS

#define CSIO_MAX_LUN
#define CSIO_MAX_QUEUE
#define CSIO_MAX_CMD_PER_LUN
#define CSIO_MAX_DDP_BUF_SIZE
#define CSIO_MAX_SECTOR_SIZE
#define CSIO_MIN_T6_FW

/* Interrupts */
#define CSIO_EXTRA_MSI_IQS
#define CSIO_EXTRA_VECS
#define CSIO_MAX_SCSI_CPU
#define CSIO_MAX_SCSI_QSETS
#define CSIO_MAX_MSIX_VECS

/* Queues */
enum {};

struct csio_msix_entries {};

struct csio_scsi_qset {};

struct csio_scsi_cpu_info {};

extern int csio_dbg_level;
extern unsigned int csio_port_mask;
extern int csio_msi;

#define CSIO_VENDOR_ID
#define CSIO_ASIC_DEVID_PROTO_MASK
#define CSIO_ASIC_DEVID_TYPE_MASK

#define CSIO_GLBL_INTR_MASK

/*
 * Hard parameters used to initialize the card in the absence of a
 * configuration file.
 */
enum {};

/* Slowpath events */
enum csio_evt {};

#define CSIO_EVT_MSG_SIZE
#define CSIO_EVTQ_SIZE

/* Event msg  */
struct csio_evt_msg {};

enum {};

enum {};

/* serial flash and firmware constants */
enum {};

/* Management module */
enum {};

#define CSIO_MGMT_EQSIZE
#define CSIO_MGMT_IQSIZE

/* mgmt module stats */
struct csio_mgmtm_stats {};

/* MGMT module */
struct csio_mgmtm {};

struct csio_adap_desc {};

struct pci_params {};

/* User configurable hw parameters */
struct csio_hw_params {};

struct csio_vpd {};

/* Firmware Port Capabilities types. */

fw_port_cap16_t;    /* 16-bit Port Capabilities integral value */
fw_port_cap32_t;    /* 32-bit Port Capabilities integral value */

enum fw_caps {};

enum cc_pause {};

enum cc_fec {};

struct link_config {};

#define FW_LEN16(fw_struct)

#define ADVERT_MASK

/* Enable or disable autonegotiation. */
#define AUTONEG_DISABLE
#define AUTONEG_ENABLE

struct csio_pport {};

/* fcoe resource information */
struct csio_fcoe_res_info {};

/* HW State machine Events */
enum csio_hw_ev {};

/* hw stats */
struct csio_hw_stats {};

/* Defines for hw->flags */
#define CSIO_HWF_MASTER
#define CSIO_HWF_HW_INTR_ENABLED
#define CSIO_HWF_FWEVT_PENDING
#define CSIO_HWF_Q_MEM_ALLOCED
#define CSIO_HWF_Q_FW_ALLOCED
#define CSIO_HWF_VPD_VALID
#define CSIO_HWF_DEVID_CACHED
#define CSIO_HWF_FWEVT_STOP
#define CSIO_HWF_USING_SOFT_PARAMS
#define CSIO_HWF_HOST_INTR_ENABLED
#define CSIO_HWF_ROOT_NO_RELAXED_ORDERING

#define csio_is_hw_intr_enabled(__hw)
#define csio_is_host_intr_enabled(__hw)
#define csio_is_hw_master(__hw)
#define csio_is_valid_vpd(__hw)
#define csio_is_dev_id_cached(__hw)
#define csio_valid_vpd_copied(__hw)
#define csio_dev_id_cached(__hw)

/* Defines for intr_mode */
enum csio_intr_mode {};

/* Master HW structure: One per function */
struct csio_hw {};

/* Register access macros */
#define csio_reg(_b, _r)

#define csio_rd_reg8(_h, _r)
#define csio_rd_reg16(_h, _r)
#define csio_rd_reg32(_h, _r)
#define csio_rd_reg64(_h, _r)

#define csio_wr_reg8(_h, _v, _r)
#define csio_wr_reg16(_h, _v, _r)
#define csio_wr_reg32(_h, _v, _r)
#define csio_wr_reg64(_h, _v, _r)

void csio_set_reg_field(struct csio_hw *, uint32_t, uint32_t, uint32_t);

/* Core clocks <==> uSecs */
static inline uint32_t
csio_core_ticks_to_us(struct csio_hw *hw, uint32_t ticks)
{}

static inline uint32_t
csio_us_to_core_ticks(struct csio_hw *hw, uint32_t us)
{}

/* Easy access macros */
#define csio_hw_to_wrm(hw)
#define csio_hw_to_mbm(hw)
#define csio_hw_to_scsim(hw)
#define csio_hw_to_mgmtm(hw)

#define CSIO_PCI_BUS(hw)
#define CSIO_PCI_DEV(hw)
#define CSIO_PCI_FUNC(hw)

#define csio_set_fwevt_intr_idx(_h, _i)
#define csio_get_fwevt_intr_idx(_h)
#define csio_set_nondata_intr_idx(_h, _i)
#define csio_get_nondata_intr_idx(_h)

/* Printing/logging */
#define CSIO_DEVID(__dev)
#define CSIO_DEVID_LO(__dev)
#define CSIO_DEVID_HI(__dev)

#define csio_info(__hw, __fmt, ...)

#define csio_fatal(__hw, __fmt, ...)

#define csio_err(__hw, __fmt, ...)

#define csio_warn(__hw, __fmt, ...)

#ifdef __CSIO_DEBUG__
#define csio_dbg
#else
#define csio_dbg(__hw, __fmt, ...)
#endif

int csio_hw_wait_op_done_val(struct csio_hw *, int, uint32_t, int,
			     int, int, uint32_t *);
void csio_hw_tp_wr_bits_indirect(struct csio_hw *, unsigned int,
				 unsigned int, unsigned int);
int csio_mgmt_req_lookup(struct csio_mgmtm *, struct csio_ioreq *);
void csio_hw_intr_disable(struct csio_hw *);
int csio_hw_slow_intr_handler(struct csio_hw *);
int csio_handle_intr_status(struct csio_hw *, unsigned int,
			    const struct intr_info *);

fw_port_cap32_t fwcap_to_fwspeed(fw_port_cap32_t acaps);
fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16);
fw_port_cap16_t fwcaps32_to_caps16(fw_port_cap32_t caps32);
fw_port_cap32_t lstatus_to_fwcap(u32 lstatus);

int csio_hw_start(struct csio_hw *);
int csio_hw_stop(struct csio_hw *);
int csio_hw_reset(struct csio_hw *);
int csio_is_hw_ready(struct csio_hw *);
int csio_is_hw_removing(struct csio_hw *);

int csio_fwevtq_handler(struct csio_hw *);
void csio_evtq_worker(struct work_struct *);
int csio_enqueue_evt(struct csio_hw *, enum csio_evt, void *, uint16_t);
void csio_evtq_flush(struct csio_hw *hw);

int csio_request_irqs(struct csio_hw *);
void csio_intr_enable(struct csio_hw *);
void csio_intr_disable(struct csio_hw *, bool);
void csio_hw_fatal_err(struct csio_hw *);

struct csio_lnode *csio_lnode_alloc(struct csio_hw *);
int csio_config_queues(struct csio_hw *);

int csio_hw_init(struct csio_hw *);
void csio_hw_exit(struct csio_hw *);
#endif /* ifndef __CSIO_HW_H__ */