Linux Kernel
3.7.1
|
#include <linux/init.h>
#include <linux/delay.h>
#include "cxgb4.h"
#include "t4_regs.h"
#include "t4fw_api.h"
Go to the source code of this file.
Data Structures | |
struct | intr_info |
Macros | |
#define | MC_DATA(i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA, i) |
#define | EDC_DATA(i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA, i) + idx) |
#define | EEPROM_STAT_ADDR 0x7bfc |
#define | VPD_BASE 0 |
#define | VPD_LEN 512 |
#define | FIND_VPD_KW(var, name) |
#define | ADVERT_MASK |
#define | MEM_INT_MASK (PERR_INT_CAUSE | ECC_CE_INT_CAUSE | ECC_UE_INT_CAUSE) |
#define | PF_INTR_MASK (PFSW) |
#define | GLBL_INTR_MASK |
#define | STAT_IDX(x) ((TP_MIB_TCP_##x) - TP_MIB_TCP_OUT_RST) |
#define | STAT(x) val[STAT_IDX(x)] |
#define | STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO)) |
#define | CC_MIN_INCR 2U |
#define | GET_STAT(name) t4_read_reg64(adap, PORT_REG(idx, MPS_PORT_STAT_##name##_L)) |
#define | GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) |
#define | EPIO_REG(name) PORT_REG(port, XGMAC_PORT_EPIO_##name) |
#define | INIT_CMD(var, cmd, rd_wr) |
Typedefs | |
typedef void(* | int_handler_t )(struct adapter *adap) |
Enumerations | |
enum | { SF_ATTEMPTS = 10, SF_PROG_PAGE = 2, SF_WR_DISABLE = 4, SF_RD_STATUS = 5, SF_WR_ENABLE = 6, SF_RD_DATA_FAST = 0xb, SF_RD_ID = 0x9f, SF_ERASE_SECTOR = 0xd8, FW_MAX_SIZE = 512 * 1024 } |
#define ADVERT_MASK |
#define EDC_DATA | ( | i | ) | (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA, i) + idx) |
#define FIND_VPD_KW | ( | var, | |
name | |||
) |
#define GLBL_INTR_MASK |
#define MC_DATA | ( | i | ) | MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA, i) |
#define MEM_INT_MASK (PERR_INT_CAUSE | ECC_CE_INT_CAUSE | ECC_UE_INT_CAUSE) |
#define STAT_IDX | ( | x | ) | ((TP_MIB_TCP_##x) - TP_MIB_TCP_OUT_RST) |
anonymous enum |
int get_vpd_params | ( | struct adapter * | adapter, |
struct vpd_params * | p | ||
) |
int t4_alloc_mac_filt | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | viid, | ||
bool | free, | ||
unsigned int | naddr, | ||
const u8 ** | addr, | ||
u16 * | idx, | ||
u64 * | hash, | ||
bool | sleep_ok | ||
) |
t4_alloc_mac_filt - allocates exact-match filters for MAC addresses : the adapter : mailbox to use for the FW command : the VI id : if true any existing filters for this VI id are first removed : the number of MAC addresses to allocate filters for (up to 7) : the MAC address(es) : where to store the index of each allocated filter : pointer to hash address filter bitmap : call is allowed to sleep
Allocates an exact-match filter for each of the supplied addresses and sets it to the corresponding address. If is not NULL it should have at least entries, each of which will be set to the index of the filter allocated for the corresponding MAC address. If a filter could not be allocated for an address its index is set to 0xffff. If is not NULL addresses that fail to allocate an exact filter are hashed and update the hash filter bitmap pointed at by .
Returns a negative error number or the number of filters allocated.
int t4_alloc_vi | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | port, | ||
unsigned int | pf, | ||
unsigned int | vf, | ||
unsigned int | nmac, | ||
u8 * | mac, | ||
unsigned int * | rss_size | ||
) |
t4_alloc_vi - allocate a virtual interface : the adapter : mailbox to use for the FW command : physical port associated with the VI : the PF owning the VI : the VF owning the VI : number of MAC addresses needed (1 to 5) : the MAC addresses of the VI : size of RSS table slice associated with this VI
Allocates a virtual interface for the given physical port. If is not NULL it contains the MAC addresses of the VI as assigned by FW. should be large enough to hold Ethernet addresses, they are stored consecutively so the space needed is * 6 bytes. Returns a negative error number or the non-negative VI id.
int t4_cfg_pfvf | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | pf, | ||
unsigned int | vf, | ||
unsigned int | txq, | ||
unsigned int | txq_eth_ctrl, | ||
unsigned int | rxqi, | ||
unsigned int | rxq, | ||
unsigned int | tc, | ||
unsigned int | vi, | ||
unsigned int | cmask, | ||
unsigned int | pmask, | ||
unsigned int | nexact, | ||
unsigned int | rcaps, | ||
unsigned int | wxcaps | ||
) |
t4_cfg_pfvf - configure PF/VF resource limits : the adapter : mailbox to use for the FW command : the PF being configured : the VF being configured : the max number of egress queues : the max number of egress Ethernet or control queues : the max number of interrupt-capable ingress queues : the max number of interruptless ingress queues : the PCI traffic class : the max number of virtual interfaces : the channel access rights mask for the PF/VF : the port access rights mask for the PF/VF : the maximum number of exact MPS filters : read capabilities : write/execute capabilities
Configures resource limits and capabilities for a physical or virtual function.
int t4_change_mac | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | viid, | ||
int | idx, | ||
const u8 * | addr, | ||
bool | persist, | ||
bool | add_smt | ||
) |
t4_change_mac - modifies the exact-match filter for a MAC address : the adapter : mailbox to use for the FW command : the VI id : index of existing filter for old value of MAC address, or -1 : the new MAC address value : whether a new MAC allocation should be persistent : if true also add the address to the HW SMT
Modifies an exact-match filter and sets it to the new MAC address. Note that in general it is not possible to modify the value of a given filter so the generic way to modify an address filter is to free the one being used by the old address value and allocate a new filter for the new address value. can be -1 if the address is a new addition.
Returns a negative error number or the index of the filter with the new MAC value.
t4_check_fw_version - check if the FW is compatible with this driver : the adapter
Checks if an adapter's FW is compatible with the driver. Returns 0 if there's exact match, a negative error if the version could not be read or there's a major version mismatch, and a positive value if the expected major version is found but there's a minor version mismatch.
int t4_config_rss_range | ( | struct adapter * | adapter, |
int | mbox, | ||
unsigned int | viid, | ||
int | start, | ||
int | n, | ||
const u16 * | rspq, | ||
unsigned int | nrspq | ||
) |
t4_config_rss_range - configure a portion of the RSS mapping table : the adapter : mbox to use for the FW command : virtual interface whose RSS subtable is to be written : start entry in the table to write
: how many table entries to write : values for the response queue lookup table : number of values in
Programs the selected part of the VI's RSS mapping table with the provided values. If <
the supplied values are used repeatedly until the full table range is populated.
The caller must ensure the values in are in the range allowed for .
t4_edc_read - read from EDC through backdoor accesses : the adapter : which EDC to access : address of first byte requested : 64 bytes of data containing the requested address : where to store the corresponding 64-bit ECC word
Read 64 bytes of data from EDC starting at a 64-byte-aligned address that covers the requested address . If is not NULL it is assigned the 64-bit ECC word for the read data.
int t4_fixup_host_params | ( | struct adapter * | adap, |
unsigned int | page_size, | ||
unsigned int | cache_line_size | ||
) |
t4_fixup_host_params - fix up host-dependent parameters : the adapter : the host's Base Page Size : the host's Cache Line Size
Various registers in T4 contain values which are dependent on the host's Base Page and Cache Line Sizes. This function will fix all of those registers with the appropriate values as passed in ...
int t4_fw_config_file | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | mtype, | ||
unsigned int | maddr, | ||
u32 * | finiver, | ||
u32 * | finicsum, | ||
u32 * | cfcsum | ||
) |
t4_fw_config_file - setup an adapter via a Configuration File : the adapter : mailbox to use for the FW command : the memory type where the Configuration File is located : the memory address where the Configuration File is located : return value for CF [fini] version : return value for CF [fini] checksum : return value for CF computed checksum
Issue a command to get the firmware to process the Configuration File located at the specified mtype/maddress. If the Configuration File is processed successfully and return value pointers are provided, the Configuration File "[fini] section version and checksum values will be returned along with the computed checksum. It's up to the caller to decide how it wants to respond to the checksums not matching but it recommended that a prominant warning be emitted in order to help people rapidly identify changed or corrupted Configuration Files.
Also note that it's possible to modify things like "niccaps", "toecaps",etc. between processing the Configuration File and telling the firmware to use the new configuration. Callers which want to do this will need to "hand-roll" their own CAPS_CONFIGS commands for Configuration Files if they want to do this.
t4_fw_halt - issue a reset/halt to FW and put uP into RESET : the adapter : mailbox to use for the FW RESET command (if desired) : force uP into RESET even if FW RESET command fails
Issues a RESET command to firmware (if desired) with a HALT indication and then puts the microprocessor into RESET state. The RESET command will only be issued if a legitimate mailbox is provided (mbox <= FW_PCIE_FW_MASTER_MASK).
This is generally used in order for the host to safely manipulate the adapter without fear of conflicting with whatever the firmware might be doing. The only way out of this state is to RESTART the firmware ...
int t4_fw_hello | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | evt_mbox, | ||
enum dev_master | master, | ||
enum dev_state * | state | ||
) |
t4_fw_hello - establish communication with FW @adap: the adapter @mbox: mailbox to use for the FW command @evt_mbox: mailbox to receive async FW events @master: specifies the caller's willingness to be the device master
: returns the current device state (if non-NULL)
Issues a command to establish communication with FW. Returns either an error (negative integer) or the mailbox of the Master PF.
t4_fw_restart - restart the firmware by taking the uP out of RESET : the adapter : if we want to do a RESET to restart things
Restart firmware previously halted by t4_fw_halt(). On successful return the previous PF Master remains as the new PF Master and there is no need to issue a new HELLO command, etc.
We do this in two ways:
int t4_fw_upgrade | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
const u8 * | fw_data, | ||
unsigned int | size, | ||
int | force | ||
) |
t4_fw_upgrade - perform all of the steps necessary to upgrade FW : the adapter : mailbox to use for the FW RESET command (if desired) : the firmware image to write : image size : force upgrade even if firmware doesn't cooperate
Perform all of the steps necessary for upgrading an adapter's firmware image. Normally this requires the cooperation of the existing firmware in order to halt all existing activities but if an invalid mailbox token is passed in we skip that step (though we'll still put the adapter microprocessor into RESET in that case).
On successful return the new firmware will have been loaded and the adapter will have been fully RESET losing all previous setup state. On unsuccessful return the adapter may be completely hosed ... positive errno indicates that the adapter is ~probably~ intact, a negative errno indicates that things are looking bad ...
t4_intr_enable - enable interrupts : the adapter whose interrupts should be enabled
Enable PF-specific interrupts for the calling function and the top-level interrupt concentrator for global interrupts. Interrupts are already enabled at each module, here we just enable the roots of the interrupt hierarchies.
Note: this function should be called only when the driver manages non PF-specific interrupts from the various HW modules. Only one PCI function at a time should be doing this.
int t4_iq_free | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | pf, | ||
unsigned int | vf, | ||
unsigned int | iqtype, | ||
unsigned int | iqid, | ||
unsigned int | fl0id, | ||
unsigned int | fl1id | ||
) |
t4_iq_free - free an ingress queue and its FLs : the adapter : mailbox to use for the FW command : the PF owning the queues : the VF owning the queues : the ingress queue type : ingress queue id : FL0 queue id or 0xffff if no attached FL0 : FL1 queue id or 0xffff if no attached FL1
Frees an ingress queue and its associated FLs, if any.
int t4_link_start | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | port, | ||
struct link_config * | lc | ||
) |
t4_link_start - apply link configuration to MAC/PHY : the PHY to setup : the MAC to setup : the requested link configuration
Set up a port's MAC and PHY according to a desired link configuration.
void t4_load_mtus | ( | struct adapter * | adap, |
const unsigned short * | mtus, | ||
const unsigned short * | alpha, | ||
const unsigned short * | beta | ||
) |
t4_load_mtus - write the MTU and congestion control HW tables : the adapter : the values for the MTU table : the values for the congestion control alpha parameter : the values for the congestion control beta parameter
Write the HW MTU table with the supplied MTUs and the high-speed congestion control table with the supplied alpha, beta, and MTUs. We write the two tables together because the additive increments depend on the MTUs.
t4_mc_read - read from MC through backdoor accesses : the adapter : address of first byte requested : 64 bytes of data containing the requested address : where to store the corresponding 64-bit ECC word
Read 64 bytes of data from MC starting at a 64-byte-aligned address that covers the requested address . If is not NULL it is assigned the 64-bit ECC word for the read data.
int t4_mdio_rd | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | phy_addr, | ||
unsigned int | mmd, | ||
unsigned int | reg, | ||
u16 * | valp | ||
) |
int t4_mdio_wr | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | phy_addr, | ||
unsigned int | mmd, | ||
unsigned int | reg, | ||
u16 | val | ||
) |
t4_mem_win_read_len - read memory through PCIE memory window : the adapter : address of first byte requested aligned on 32b. : len bytes to hold the data read : amount of data to read from window. Must be <= MEMWIN0_APERATURE after adjusting for 16B alignment requirements of the the memory window.
Read len bytes of data from MC starting at .
int t4_query_params | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | pf, | ||
unsigned int | vf, | ||
unsigned int | nparams, | ||
const u32 * | params, | ||
u32 * | val | ||
) |
int t4_set_addr_hash | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | viid, | ||
bool | ucast, | ||
u64 | vec, | ||
bool | sleep_ok | ||
) |
t4_set_addr_hash - program the MAC inexact-match hash filter : the adapter : mailbox to use for the FW command : the VI id : whether the hash filter should also match unicast addresses : the value to be written to the hash filter : call is allowed to sleep
Sets the 64-bit inexact-match hash filter for a virtual interface.
int t4_set_params | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | pf, | ||
unsigned int | vf, | ||
unsigned int | nparams, | ||
const u32 * | params, | ||
const u32 * | val | ||
) |
int t4_set_rxmode | ( | struct adapter * | adap, |
unsigned int | mbox, | ||
unsigned int | viid, | ||
int | mtu, | ||
int | promisc, | ||
int | all_multi, | ||
int | bcast, | ||
int | vlanex, | ||
bool | sleep_ok | ||
) |
t4_set_rxmode - set Rx properties of a virtual interface : the adapter : mailbox to use for the FW command : the VI id : the new MTU or -1 : 1 to enable promiscuous mode, 0 to disable it, -1 no change : 1 to enable all-multi mode, 0 to disable it, -1 no change : 1 to enable broadcast Rx, 0 to disable it, -1 no change : 1 to enable HW VLAN extraction, 0 to disable it, -1 no change : if true we may sleep while awaiting command completion
Sets Rx properties of a virtual interface.
void t4_tp_get_tcp_stats | ( | struct adapter * | adap, |
struct tp_tcp_stats * | v4, | ||
struct tp_tcp_stats * | v6 | ||
) |
int t4_wol_pat_enable | ( | struct adapter * | adap, |
unsigned int | port, | ||
unsigned int | map, | ||
u64 | mask0, | ||
u64 | mask1, | ||
unsigned int | crc, | ||
bool | enable | ||
) |
t4_wol_pat_enable - enable/disable pattern-based WoL : the adapter : the physical port index : bitmap of which HW pattern filters to set : byte mask for bytes 0-63 of a packet : byte mask for bytes 64-127 of a packet : Ethernet CRC for selected bytes : enable/disable switch
Sets the pattern filters indicated in to mask out the bytes specified in / in received packets and compare the CRC of the resulting packet against . If is true pattern-based WoL is enabled, otherwise disabled.
int t4_wr_mbox_meat | ( | struct adapter * | adap, |
int | mbox, | ||
const void * | cmd, | ||
int | size, | ||
void * | rpl, | ||
bool | sleep_ok | ||
) |
t4_wr_mbox_meat - send a command to FW through the given mailbox : the adapter : index of the mailbox to use : the command to write : command length in bytes : where to optionally store the reply : if true we may sleep while awaiting command completion
Sends the given command to FW through the selected mailbox and waits for the FW to execute the command. If is not NULL it is used to store the FW's reply to the command. The command and its optional reply are of the same length. FW can take up to FW_CMD_MAX_TIMEOUT ms to respond. determines whether we may sleep while awaiting the response. If sleeping is allowed we use progressive backoff otherwise we spin.
The return value is 0 on success or a negative errno on failure. A failure can happen either because we are not able to execute the command or FW executes it but signals an error. In the latter case the return value is the error code indicated by FW (negated).
void t4_write_indirect | ( | struct adapter * | adap, |
unsigned int | addr_reg, | ||
unsigned int | data_reg, | ||
const u32 * | vals, | ||
unsigned int | nregs, | ||
unsigned int | start_idx | ||
) |
t4_write_indirect - write indirectly addressed registers : the adapter : register holding the indirect addresses : register holding the value for the indirect registers : values to write : how many indirect registers to write : address of first indirect register to write
Writes a sequential block of registers that are accessed indirectly through an address/data register pair.