iPXE
|
NetXen Phantom NICs. More...
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/io.h>
#include <ipxe/malloc.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include <ipxe/spi.h>
#include <ipxe/settings.h>
#include "phantom.h"
Go to the source code of this file.
Data Structures | |
struct | phantom_descriptor_rings |
A Phantom descriptor ring set. More... | |
struct | phantom_create_rx_ctx_rqrsp |
RX context creation request and response buffers. More... | |
struct | phantom_create_tx_ctx_rqrsp |
TX context creation request and response buffers. More... | |
struct | phantom_nic |
A Phantom NIC. More... | |
union | phantom_clp_data |
Phantom CLP data. More... | |
struct | phantom_clp_setting |
A Phantom CLP setting. More... | |
Macros | |
#define | PHN_MAX_NUM_PORTS 8 |
Maximum number of ports. More... | |
#define | PHN_CMDPEG_INIT_TIMEOUT_SEC 50 |
Maximum time to wait for command PEG to initialise. More... | |
#define | PHN_RCVPEG_INIT_TIMEOUT_SEC 2 |
Maximum time to wait for receive PEG to initialise. More... | |
#define | PHN_ISSUE_CMD_TIMEOUT_MS 2000 |
Maximum time to wait for firmware to accept a command. More... | |
#define | PHN_TEST_MEM_TIMEOUT_MS 100 |
Maximum time to wait for test memory. More... | |
#define | PHN_CLP_CMD_TIMEOUT_MS 500 |
Maximum time to wait for CLP command to be issued. More... | |
#define | PHN_LINK_POLL_FREQUENCY 4096 |
Link state poll frequency. More... | |
#define | PHN_NUM_RDS 32 |
Number of RX descriptors. More... | |
#define | PHN_RDS_MAX_FILL 16 |
RX maximum fill level. More... | |
#define | PHN_RX_BUFSIZE |
RX buffer size. More... | |
#define | PHN_NUM_SDS 32 |
Number of RX status descriptors. More... | |
#define | PHN_NUM_CDS 8 |
Number of TX descriptors. More... | |
#define | PHN_CLP_BLKSIZE ( sizeof ( union phantom_clp_data ) ) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static unsigned long | phantom_crb_access_128m (struct phantom_nic *phantom, unsigned long reg) |
Prepare for access to CRB register via 128MB BAR. More... | |
static unsigned long | phantom_crb_access_32m (struct phantom_nic *phantom, unsigned long reg) |
Prepare for access to CRB register via 32MB BAR. More... | |
static unsigned long | phantom_crb_access_2m (struct phantom_nic *phantom, unsigned long reg) |
Prepare for access to CRB register via 2MB BAR. More... | |
static uint32_t | phantom_readl (struct phantom_nic *phantom, unsigned long reg) |
Read from Phantom CRB register. More... | |
static void | phantom_writel (struct phantom_nic *phantom, uint32_t value, unsigned long reg) |
Write to Phantom CRB register. More... | |
static void | phantom_write_hilo (struct phantom_nic *phantom, uint64_t value, unsigned long lo_offset, unsigned long hi_offset) |
Write to Phantom CRB HI/LO register pair. More... | |
static int | phantom_read_test_mem_block (struct phantom_nic *phantom, unsigned long offset, uint32_t buf[2]) |
Read from Phantom test memory. More... | |
static int | phantom_read_test_mem (struct phantom_nic *phantom, unsigned long offset) |
Read single byte from Phantom test memory. More... | |
static int | phantom_dmesg (struct phantom_nic *phantom, unsigned int log, unsigned int max_lines) |
Dump Phantom firmware dmesg log. More... | |
static void | phantom_dmesg_all (struct phantom_nic *phantom, unsigned int max_lines) |
Dump Phantom firmware dmesg logs. More... | |
static int | phantom_wait_for_cmd (struct phantom_nic *phantom) |
Wait for firmware to accept command. More... | |
static int | phantom_issue_cmd (struct phantom_nic *phantom, uint32_t command, uint32_t arg1, uint32_t arg2, uint32_t arg3) |
Issue command to firmware. More... | |
static int | phantom_issue_buf_cmd (struct phantom_nic *phantom, uint32_t command, void *buffer, size_t len) |
Issue buffer-format command to firmware. More... | |
static int | phantom_create_rx_ctx (struct phantom_nic *phantom) |
Create Phantom RX context. More... | |
static void | phantom_destroy_rx_ctx (struct phantom_nic *phantom) |
Destroy Phantom RX context. More... | |
static int | phantom_create_tx_ctx (struct phantom_nic *phantom) |
Create Phantom TX context. More... | |
static void | phantom_destroy_tx_ctx (struct phantom_nic *phantom) |
Destroy Phantom TX context. More... | |
static int | phantom_alloc_rds (struct phantom_nic *phantom) |
Allocate Phantom RX descriptor. More... | |
static void | phantom_post_rds (struct phantom_nic *phantom, struct phantom_rds *rds) |
Post Phantom RX descriptor. More... | |
static int | phantom_alloc_cds (struct phantom_nic *phantom) |
Allocate Phantom TX descriptor. More... | |
static void | phantom_post_cds (struct phantom_nic *phantom, union phantom_cds *cds) |
Post Phantom TX descriptor. More... | |
static int | phantom_update_macaddr (struct phantom_nic *phantom, const uint8_t *ll_addr, unsigned int opcode) |
Add/remove MAC address. More... | |
static int | phantom_add_macaddr (struct phantom_nic *phantom, const uint8_t *ll_addr) |
Add MAC address. More... | |
static int | phantom_del_macaddr (struct phantom_nic *phantom, const uint8_t *ll_addr) |
Remove MAC address. More... | |
static void | phantom_poll_link_state (struct net_device *netdev) |
Poll link state. More... | |
static void | phantom_refill_rx_ring (struct net_device *netdev) |
Refill descriptor ring. More... | |
static int | phantom_open (struct net_device *netdev) |
Open NIC. More... | |
static void | phantom_close (struct net_device *netdev) |
Close NIC. More... | |
static int | phantom_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
Transmit packet. More... | |
static void | phantom_poll (struct net_device *netdev) |
Poll for received packets. More... | |
static void | phantom_irq (struct net_device *netdev, int enable) |
Enable/disable interrupts. More... | |
static int | phantom_clp_wait (struct phantom_nic *phantom) |
Wait for Phantom CLP command to complete. More... | |
static int | phantom_clp_cmd (struct phantom_nic *phantom, unsigned int port, unsigned int opcode, const void *data_in, void *data_out, size_t offset, size_t len) |
Issue Phantom CLP command. More... | |
static int | phantom_clp_store (struct phantom_nic *phantom, unsigned int port, unsigned int setting, const void *data, size_t len) |
Store Phantom CLP setting. More... | |
static int | phantom_clp_fetch (struct phantom_nic *phantom, unsigned int port, unsigned int setting, void *data, size_t len) |
Fetch Phantom CLP setting. More... | |
static unsigned int | phantom_clp_setting (struct phantom_nic *phantom, const struct setting *setting) |
Find Phantom CLP setting. More... | |
static int | phantom_setting_applies (struct settings *settings, const struct setting *setting) |
Check applicability of Phantom CLP setting. More... | |
static int | phantom_store_setting (struct settings *settings, const struct setting *setting, const void *data, size_t len) |
Store Phantom CLP setting. More... | |
static int | phantom_fetch_setting (struct settings *settings, struct setting *setting, void *data, size_t len) |
Fetch Phantom CLP setting. More... | |
static int | phantom_map_crb (struct phantom_nic *phantom, struct pci_device *pci) |
Map Phantom CRB window. More... | |
static void | phantom_unhalt_pegs (struct phantom_nic *phantom) |
Unhalt all PEGs. More... | |
static int | phantom_init_cmdpeg (struct phantom_nic *phantom) |
Initialise the Phantom command PEG. More... | |
static void | phantom_get_macaddr (struct phantom_nic *phantom, uint8_t *hw_addr) |
Read Phantom MAC address. More... | |
static int | phantom_check_boot_enable (struct phantom_nic *phantom) |
Check Phantom is enabled for boot. More... | |
static int | phantom_init_rcvpeg (struct phantom_nic *phantom) |
Initialise Phantom receive PEG. More... | |
static int | phantom_probe (struct pci_device *pci) |
Probe PCI device. More... | |
static void | phantom_remove (struct pci_device *pci) |
Remove PCI device. More... | |
Variables | |
static const unsigned long | phantom_irq_mask_reg [PHN_MAX_NUM_PORTS] |
Interrupt mask registers. More... | |
static const unsigned long | phantom_irq_status_reg [PHN_MAX_NUM_PORTS] |
Interrupt status registers. More... | |
static struct net_device_operations | phantom_operations |
Phantom net device operations. More... | |
static const struct settings_scope | phantom_settings_scope |
Phantom CLP settings scope. More... | |
static struct phantom_clp_setting | clp_settings [] |
Phantom CLP settings. More... | |
static struct settings_operations | phantom_settings_operations |
Phantom CLP settings operations. More... | |
static struct pci_device_id | phantom_nics [] |
Phantom PCI IDs. More... | |
struct pci_driver phantom_driver | __pci_driver |
Phantom PCI driver. More... | |
NetXen Phantom NICs.
Definition in file phantom.c.
#define PHN_CMDPEG_INIT_TIMEOUT_SEC 50 |
Maximum time to wait for command PEG to initialise.
BUGxxxx
The command PEG will currently report initialisation complete only when at least one PHY has detected a link (so that the global PHY clock can be set to 10G/1G as appropriate). This can take a very, very long time.
A future firmware revision should decouple PHY initialisation from firmware initialisation, at which point the command PEG will report initialisation complete much earlier, and this timeout can be reduced.
#define PHN_RCVPEG_INIT_TIMEOUT_SEC 2 |
#define PHN_ISSUE_CMD_TIMEOUT_MS 2000 |
#define PHN_TEST_MEM_TIMEOUT_MS 100 |
#define PHN_CLP_CMD_TIMEOUT_MS 500 |
#define PHN_LINK_POLL_FREQUENCY 4096 |
#define PHN_RDS_MAX_FILL 16 |
#define PHN_RX_BUFSIZE |
#define PHN_CLP_BLKSIZE ( sizeof ( union phantom_clp_data ) ) |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Prepare for access to CRB register via 128MB BAR.
phantom | Phantom NIC |
reg | Register offset within abstract address space |
offset | Register offset within PCI BAR0 |
Definition at line 241 of file phantom.c.
References assert(), phantom_nic::bar0, phantom_nic::crb_window, offset, readl(), reg, UNM_128M_CRB_WINDOW, and writel().
Referenced by phantom_map_crb().
|
static |
Prepare for access to CRB register via 32MB BAR.
phantom | Phantom NIC |
reg | Register offset within abstract address space |
offset | Register offset within PCI BAR0 |
Definition at line 270 of file phantom.c.
References assert(), phantom_nic::bar0, phantom_nic::crb_window, offset, readl(), reg, UNM_32M_CRB_WINDOW, and writel().
Referenced by phantom_map_crb().
|
static |
Prepare for access to CRB register via 2MB BAR.
phantom | Phantom NIC |
reg | Register offset within abstract address space |
offset | Register offset within PCI BAR0 |
Definition at line 299 of file phantom.c.
References assert(), phantom_nic::bar0, block, phantom_nic::crb_window, offset, readl(), reg, UNM_2M_CRB_WINDOW, UNM_CRB_BLK, UNM_CRB_BLK_CAM, UNM_CRB_BLK_PCIE, UNM_CRB_BLK_PEG_0, UNM_CRB_BLK_PEG_1, UNM_CRB_BLK_PEG_2, UNM_CRB_BLK_PEG_3, UNM_CRB_BLK_PEG_4, UNM_CRB_BLK_ROMUSB, UNM_CRB_BLK_TEST, UNM_CRB_OFFSET, and writel().
Referenced by phantom_map_crb().
|
static |
Read from Phantom CRB register.
phantom | Phantom NIC |
reg | Register offset within abstract address space |
value | Register value |
Definition at line 358 of file phantom.c.
References phantom_nic::bar0, phantom_nic::crb_access, offset, readl(), and reg.
Referenced by phantom_check_boot_enable(), phantom_clp_cmd(), phantom_clp_wait(), phantom_dmesg(), phantom_get_macaddr(), phantom_init_cmdpeg(), phantom_init_rcvpeg(), phantom_poll(), phantom_poll_link_state(), phantom_read_test_mem_block(), phantom_unhalt_pegs(), and phantom_wait_for_cmd().
|
static |
Write to Phantom CRB register.
phantom | Phantom NIC |
value | Register value |
reg | Register offset within abstract address space |
Definition at line 373 of file phantom.c.
References phantom_nic::bar0, phantom_nic::crb_access, offset, reg, value, and writel().
Referenced by phantom_clp_cmd(), phantom_init_cmdpeg(), phantom_irq(), phantom_issue_cmd(), phantom_poll(), phantom_post_cds(), phantom_post_rds(), phantom_read_test_mem_block(), phantom_unhalt_pegs(), and phantom_write_hilo().
|
inlinestatic |
Write to Phantom CRB HI/LO register pair.
phantom | Phantom NIC |
value | Register value |
lo_offset | LO register offset within CRB |
hi_offset | HI register offset within CRB |
Definition at line 389 of file phantom.c.
References phantom_writel(), and value.
Referenced by phantom_init_cmdpeg(), and phantom_read_test_mem_block().
|
static |
Read from Phantom test memory.
phantom | Phantom NIC |
offset | Offset within test memory |
buf | 8-byte buffer to fill |
rc | Return status code |
Definition at line 414 of file phantom.c.
References DBGC, ETIMEDOUT, mdelay(), offset, phantom_readl(), phantom_write_hilo(), phantom_writel(), PHN_TEST_MEM_TIMEOUT_MS, UNM_TEST_ADDR_HI, UNM_TEST_ADDR_LO, UNM_TEST_CONTROL, UNM_TEST_CONTROL_BUSY, UNM_TEST_CONTROL_ENABLE, UNM_TEST_CONTROL_START, UNM_TEST_RDDATA_HI, and UNM_TEST_RDDATA_LO.
Referenced by phantom_read_test_mem().
|
static |
Read single byte from Phantom test memory.
phantom | Phantom NIC |
offset | Offset within test memory |
byte | Byte read, or negative error |
Definition at line 449 of file phantom.c.
References bytes, offset, phantom_read_test_mem_block(), and rc.
Referenced by phantom_dmesg().
|
static |
Dump Phantom firmware dmesg log.
phantom | Phantom NIC |
log | Log number |
max_lines | Maximum number of lines to show, or -1 to show all |
rc | Return status code |
Definition at line 480 of file phantom.c.
References assert(), DBG, DBG_LOG, DBGC, head, offset, phantom_read_test_mem(), phantom_readl(), sig, UNM_CAM_RAM_DMESG_HEAD, UNM_CAM_RAM_DMESG_SIG, UNM_CAM_RAM_DMESG_SIG_MAGIC, and UNM_CAM_RAM_DMESG_TAIL.
Referenced by phantom_dmesg_all().
|
static |
Dump Phantom firmware dmesg logs.
phantom | Phantom NIC |
max_lines | Maximum number of lines to show, or -1 to show all |
Definition at line 530 of file phantom.c.
References phantom_dmesg(), and UNM_CAM_RAM_NUM_DMESG_BUFFERS.
|
static |
Wait for firmware to accept command.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 549 of file phantom.c.
References DBGC, EIO, EPROTO, ETIMEDOUT, mdelay(), NX_CDRP_FORM_RSP, NX_CDRP_IS_RSP, NX_CDRP_RSP_FAIL, NX_CDRP_RSP_OK, NX_CDRP_RSP_TIMEOUT, phantom_readl(), PHN_ISSUE_CMD_TIMEOUT_MS, and UNM_NIC_REG_NX_CDRP.
Referenced by phantom_issue_cmd().
|
static |
Issue command to firmware.
phantom | Phantom NIC |
command | Firmware command |
arg1 | Argument 1 |
arg2 | Argument 2 |
arg3 | Argument 3 |
rc | Return status code |
Definition at line 585 of file phantom.c.
References arg1, arg2, arg3, DBGC, DBGC2, NX_CDRP_FORM_CMD, NX_CDRP_SIGNATURE_MAKE, NXHAL_VERSION, phantom_wait_for_cmd(), phantom_writel(), phantom_nic::port, rc, signature, strerror(), UNM_NIC_REG_NX_ARG1, UNM_NIC_REG_NX_ARG2, UNM_NIC_REG_NX_ARG3, UNM_NIC_REG_NX_CDRP, and UNM_NIC_REG_NX_SIGN.
Referenced by phantom_destroy_rx_ctx(), phantom_destroy_tx_ctx(), and phantom_issue_buf_cmd().
|
static |
Issue buffer-format command to firmware.
phantom | Phantom NIC |
command | Firmware command |
buffer | Buffer to pass to firmware |
len | Length of buffer |
rc | Return status code |
Definition at line 622 of file phantom.c.
References buffer, len, phantom_issue_cmd(), and virt_to_bus().
Referenced by phantom_create_rx_ctx(), and phantom_create_tx_ctx().
|
static |
Create Phantom RX context.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 638 of file phantom.c.
References nx_hostrq_rds_ring_s::buff_size, nx_hostrq_rx_ctx_s::capabilities, phantom_create_rx_ctx_rqrsp::cardrsp, cpu_to_le16, cpu_to_le32, cpu_to_le64, DBGC, DBGC2_HDA, DBGC_HDA, phantom_nic::desc, ENOMEM, free_phys(), nx_hostrq_rx_ctx_s::host_int_crb_mode, nx_hostrq_sds_ring_s::host_phys_addr, nx_hostrq_rds_ring_s::host_phys_addr, nx_hostrq_rx_ctx_s::host_rds_crb_mode, nx_hostrq_rx_ctx_s::host_rsp_dma_addr, phantom_create_rx_ctx_rqrsp::hostrq, le16_to_cpu, le32_to_cpu, malloc_phys(), memset(), nx_hostrq_rx_ctx_s::num_rds_rings, nx_hostrq_rx_ctx_s::num_sds_rings, NX_CAP0_LEGACY_CONTEXT, NX_CAP0_LEGACY_MN, NX_CDRP_CMD_CREATE_RX_CTX, NX_HOST_INT_CRB_MODE_SHARED, NX_HOST_RDS_CRB_MODE_UNIQUE, NX_RDS_RING_TYPE_NORMAL, out, phantom_issue_buf_cmd(), PHN_NUM_RDS, PHN_NUM_SDS, PHN_RX_BUFSIZE, rc, phantom_create_rx_ctx_rqrsp::rds, phantom_descriptor_rings::rds, phantom_nic::rds_producer_crb, nx_hostrq_rx_ctx_s::rds_ring_offset, nx_hostrq_rds_ring_s::ring_kind, nx_hostrq_sds_ring_s::ring_size, nx_hostrq_rds_ring_s::ring_size, phantom_nic::rx_context_id, phantom_create_rx_ctx_rqrsp::rx_ctx, phantom_create_rx_ctx_rqrsp::sds, phantom_descriptor_rings::sds, phantom_nic::sds_consumer_crb, phantom_nic::sds_irq_mask_crb, nx_hostrq_rx_ctx_s::sds_ring_offset, strerror(), UNM_CAM_RAM, UNM_DMA_BUFFER_ALIGN, and virt_to_bus().
Referenced by phantom_open().
|
static |
Destroy Phantom RX context.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 729 of file phantom.c.
References DBGC, NX_CDRP_CMD_DESTROY_RX_CTX, NX_DESTROY_CTX_RESET, phantom_issue_cmd(), rc, phantom_nic::rds_consumer_idx, phantom_nic::rds_producer_crb, phantom_nic::rds_producer_idx, phantom_nic::rx_context_id, phantom_nic::sds_consumer_crb, phantom_nic::sds_consumer_idx, and strerror().
Referenced by phantom_close(), and phantom_open().
|
static |
Create Phantom TX context.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 763 of file phantom.c.
References nx_hostrq_tx_ctx_s::capabilities, phantom_create_tx_ctx_rqrsp::cardrsp, phantom_descriptor_rings::cds, phantom_nic::cds_producer_crb, nx_hostrq_tx_ctx_s::cds_ring, phantom_descriptor_rings::cmd_cons, nx_hostrq_tx_ctx_s::cmd_cons_dma_addr, cpu_to_le32, cpu_to_le64, DBGC, DBGC2_HDA, DBGC_HDA, phantom_nic::desc, ENOMEM, free_phys(), nx_hostrq_tx_ctx_s::host_int_crb_mode, nx_hostrq_cds_ring_s::host_phys_addr, nx_hostrq_tx_ctx_s::host_rsp_dma_addr, phantom_create_tx_ctx_rqrsp::hostrq, le16_to_cpu, le32_to_cpu, malloc_phys(), memset(), NX_CAP0_LEGACY_CONTEXT, NX_CAP0_LEGACY_MN, NX_CDRP_CMD_CREATE_TX_CTX, NX_HOST_INT_CRB_MODE_SHARED, out, phantom_issue_buf_cmd(), PHN_NUM_CDS, rc, nx_hostrq_cds_ring_s::ring_size, strerror(), phantom_nic::tx_context_id, phantom_create_tx_ctx_rqrsp::tx_ctx, UNM_CAM_RAM, UNM_DMA_BUFFER_ALIGN, and virt_to_bus().
Referenced by phantom_open().
|
static |
Destroy Phantom TX context.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 834 of file phantom.c.
References phantom_nic::cds_consumer_idx, phantom_nic::cds_producer_crb, phantom_nic::cds_producer_idx, DBGC, NX_CDRP_CMD_DESTROY_TX_CTX, NX_DESTROY_CTX_RESET, phantom_issue_cmd(), rc, strerror(), and phantom_nic::tx_context_id.
Referenced by phantom_close(), and phantom_open().
|
static |
Allocate Phantom RX descriptor.
phantom | Phantom NIC |
index | RX descriptor index, or negative error |
Definition at line 872 of file phantom.c.
References DBGC, ENOBUFS, PHN_NUM_RDS, phantom_nic::rds_consumer_idx, and phantom_nic::rds_producer_idx.
Referenced by phantom_refill_rx_ring().
|
static |
Post Phantom RX descriptor.
phantom | Phantom NIC |
rds | RX descriptor |
Definition at line 899 of file phantom.c.
References DBGC2, DBGC2_HDA, phantom_nic::desc, handle, memcpy(), NX_GET, phantom_writel(), PHN_NUM_RDS, phantom_descriptor_rings::rds, phantom_nic::rds_producer_crb, phantom_nic::rds_producer_idx, virt_to_bus(), and wmb().
Referenced by phantom_refill_rx_ring().
|
static |
Allocate Phantom TX descriptor.
phantom | Phantom NIC |
index | TX descriptor index, or negative error |
Definition at line 927 of file phantom.c.
References phantom_nic::cds_consumer_idx, phantom_nic::cds_producer_idx, DBGC, ENOBUFS, and PHN_NUM_CDS.
Referenced by phantom_transmit(), and phantom_update_macaddr().
|
static |
Post Phantom TX descriptor.
phantom | Phantom NIC |
cds | TX descriptor |
Definition at line 952 of file phantom.c.
References phantom_descriptor_rings::cds, phantom_nic::cds_producer_crb, phantom_nic::cds_producer_idx, DBGC2, DBGC2_HDA, phantom_nic::desc, memcpy(), phantom_writel(), PHN_NUM_CDS, virt_to_bus(), and wmb().
Referenced by phantom_transmit(), and phantom_update_macaddr().
|
static |
Add/remove MAC address.
phantom | Phantom NIC |
ll_addr | MAC address to add or remove |
opcode | MAC request opcode |
rc | Return status code |
Definition at line 988 of file phantom.c.
References index, memset(), NX_FILL_1, NX_FILL_2, NX_FILL_7, opcode, phantom_alloc_cds(), phantom_post_cds(), phantom_nic::port, UNM_MAC_EVENT, and UNM_NIC_REQUEST.
Referenced by phantom_add_macaddr(), and phantom_del_macaddr().
|
inlinestatic |
Add MAC address.
phantom | Phantom NIC |
ll_addr | MAC address to add or remove |
rc | Return status code |
Definition at line 1028 of file phantom.c.
References DBGC, eth_ntoa(), phantom_update_macaddr(), and UNM_MAC_ADD.
Referenced by phantom_open().
|
inlinestatic |
Remove MAC address.
phantom | Phantom NIC |
ll_addr | MAC address to add or remove |
rc | Return status code |
Definition at line 1044 of file phantom.c.
References DBGC, eth_ntoa(), phantom_update_macaddr(), and UNM_MAC_DEL.
Referenced by phantom_close(), and phantom_open().
|
static |
Poll link state.
netdev | Network device |
Definition at line 1064 of file phantom.c.
References DBGC, link, phantom_nic::link_state, netdev, netdev_link_down(), netdev_link_up(), phantom_readl(), phantom_nic::port, net_device::priv, UNM_NIC_REG_XG_STATE_P3, UNM_NIC_REG_XG_STATE_P3_LINK, UNM_NIC_REG_XG_STATE_P3_LINK_DOWN, and UNM_NIC_REG_XG_STATE_P3_LINK_UP.
Referenced by phantom_poll().
|
static |
Refill descriptor ring.
netdev | Net device |
Definition at line 1111 of file phantom.c.
References alloc_iob(), assert(), io_buffer::data, ENOMEM, handle, index, iob_len(), length, memset(), netdev, netdev_rx_err(), NULL, NX_FILL_1, NX_FILL_2, phantom_alloc_rds(), phantom_post_rds(), PHN_NUM_RDS, PHN_RDS_MAX_FILL, PHN_RX_BUFSIZE, net_device::priv, phantom_nic::rds_iobuf, and virt_to_bus().
Referenced by phantom_open(), and phantom_poll().
|
static |
Open NIC.
netdev | Net device |
rc | Return status code |
Definition at line 1162 of file phantom.c.
References phantom_nic::desc, ENOMEM, free_phys(), net_device::ll_addr, net_device::ll_broadcast, malloc_phys(), memset(), netdev, NULL, phantom_add_macaddr(), phantom_create_rx_ctx(), phantom_create_tx_ctx(), phantom_del_macaddr(), phantom_destroy_rx_ctx(), phantom_destroy_tx_ctx(), phantom_refill_rx_ring(), net_device::priv, rc, and UNM_DMA_BUFFER_ALIGN.
|
static |
Close NIC.
netdev | Net device |
Definition at line 1222 of file phantom.c.
References phantom_nic::cds_iobuf, phantom_nic::desc, ECANCELED, free_iob(), free_phys(), net_device::ll_addr, net_device::ll_broadcast, netdev, netdev_tx_complete_err(), NULL, phantom_del_macaddr(), phantom_destroy_rx_ctx(), phantom_destroy_tx_ctx(), PHN_NUM_CDS, PHN_RDS_MAX_FILL, net_device::priv, and phantom_nic::rds_iobuf.
|
static |
Transmit packet.
netdev | Network device |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 1259 of file phantom.c.
References assert(), phantom_nic::cds_iobuf, io_buffer::data, index, iob_len(), memset(), netdev, NULL, NX_FILL_1, NX_FILL_2, NX_FILL_3, phantom_alloc_cds(), phantom_post_cds(), phantom_nic::port, net_device::priv, tx, UNM_TX_ETHER_PKT, and virt_to_bus().
|
static |
Poll for received packets.
netdev | Network device |
Definition at line 1299 of file phantom.c.
References assert(), phantom_nic::cds_consumer_idx, phantom_nic::cds_iobuf, phantom_descriptor_rings::cmd_cons, DBGC, DBGC2, DBGC2_HDA, DBGC_HDA, phantom_nic::desc, handle, iob_pull, iob_put, le32_to_cpu, phantom_nic::link_poll_timer, memset(), netdev, netdev_rx(), netdev_tx_complete(), NULL, NX_GET, opcode, owner, phantom_irq_status_reg, phantom_poll_link_state(), phantom_readl(), phantom_refill_rx_ring(), phantom_writel(), PHN_LINK_POLL_FREQUENCY, PHN_NUM_CDS, PHN_NUM_RDS, PHN_NUM_SDS, phantom_nic::port, net_device::priv, phantom_nic::rds_consumer_idx, phantom_nic::rds_iobuf, phantom_descriptor_rings::sds, phantom_nic::sds_consumer_crb, phantom_nic::sds_consumer_idx, phantom_nic::sds_irq_enabled, UNM_PCIE_IRQ_STATE, UNM_PCIE_IRQ_STATE_TRIGGERED, UNM_PCIE_IRQ_STATUS_MAGIC, UNM_PCIE_IRQ_VECTOR, UNM_PCIE_IRQ_VECTOR_BIT, UNM_RXPKT_DESC, UNM_SYN_OFFLOAD, virt_to_bus(), and wmb().
|
static |
Enable/disable interrupts.
netdev | Network device |
enable | Interrupts should be enabled |
Definition at line 1436 of file phantom.c.
References netdev, phantom_irq_mask_reg, phantom_writel(), phantom_nic::port, net_device::priv, phantom_nic::sds_irq_enabled, phantom_nic::sds_irq_mask_crb, and UNM_PCIE_IRQ_MASK_MAGIC.
|
static |
Wait for Phantom CLP command to complete.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 1491 of file phantom.c.
References DBGC, ETIMEDOUT, mdelay(), phantom_readl(), PHN_CLP_CMD_TIMEOUT_MS, status, UNM_CAM_RAM_CLP_STATUS, and UNM_CAM_RAM_CLP_STATUS_DONE.
Referenced by phantom_clp_cmd().
|
static |
Issue Phantom CLP command.
phantom | Phantom NIC |
port | Virtual port number |
opcode | Opcode |
data_in | Data in, or NULL |
data_out | Data out, or NULL |
offset | Offset within data |
len | Data buffer length |
len | Total transfer length (for reads), or negative error |
Definition at line 1519 of file phantom.c.
References assert(), be32_to_cpu, command, cpu_to_be32, data, DBGC, EINVAL, EIO, error, index, len, mb(), memcpy(), memset(), offset, opcode, phantom_clp_wait(), phantom_readl(), phantom_writel(), port, rc, status, UNM_CAM_RAM_CLP_COMMAND, UNM_CAM_RAM_CLP_DATA_HI, UNM_CAM_RAM_CLP_DATA_LO, UNM_CAM_RAM_CLP_STATUS, and UNM_CAM_RAM_CLP_STATUS_START.
Referenced by phantom_clp_fetch(), and phantom_clp_store().
|
static |
Store Phantom CLP setting.
phantom | Phantom NIC |
port | Virtual port number |
setting | Setting number |
data | Data buffer |
len | Length of data buffer |
rc | Return status code |
Definition at line 1615 of file phantom.c.
References data, len, NULL, offset, opcode, phantom_clp_cmd(), PHN_CLP_BLKSIZE, port, and rc.
Referenced by phantom_store_setting().
|
static |
Fetch Phantom CLP setting.
phantom | Phantom NIC |
port | Virtual port number |
setting | Setting number |
data | Data buffer |
len | Length of data buffer |
len | Length of setting, or negative error |
Definition at line 1640 of file phantom.c.
References data, len, NULL, offset, opcode, phantom_clp_cmd(), PHN_CLP_BLKSIZE, and port.
Referenced by phantom_fetch_setting().
|
static |
Find Phantom CLP setting.
setting | iPXE setting |
clp_setting | Setting number, or 0 if not found |
Definition at line 1680 of file phantom.c.
References phantom_clp_setting::clp_setting, clp_settings, DBGC2, setting::name, phantom_settings_scope, setting::scope, setting_cmp(), and setting::tag.
Referenced by phantom_fetch_setting(), phantom_setting_applies(), and phantom_store_setting().
|
static |
Check applicability of Phantom CLP setting.
settings | Settings block |
setting | Setting |
applies | Setting applies within this settings block |
Definition at line 1710 of file phantom.c.
References container_of, and phantom_clp_setting().
|
static |
Store Phantom CLP setting.
settings | Settings block |
setting | Setting to store |
data | Setting data, or NULL to clear setting |
len | Length of setting data |
rc | Return status code |
Definition at line 1730 of file phantom.c.
References assert(), container_of, data, DBGC, len, setting::name, phantom_clp_setting(), phantom_clp_store(), phantom_nic::port, rc, and strerror().
|
static |
Fetch Phantom CLP setting.
settings | Settings block |
setting | Setting to fetch |
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 1762 of file phantom.c.
References assert(), container_of, data, DBGC, len, setting::name, phantom_clp_fetch(), phantom_clp_setting(), phantom_nic::port, rc, and strerror().
|
static |
Map Phantom CRB window.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 1806 of file phantom.c.
References phantom_nic::bar0, phantom_nic::crb_access, phantom_nic::crb_window, DBGC, EINVAL, EIO, PCI_ARGS, pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS_0, PCI_FMT, pci_ioremap(), phantom_crb_access_128m(), phantom_crb_access_2m(), and phantom_crb_access_32m().
Referenced by phantom_probe().
|
static |
Unhalt all PEGs.
phantom | Phantom NIC |
Definition at line 1859 of file phantom.c.
References phantom_readl(), phantom_writel(), UNM_PEG_0_HALT_STATUS, UNM_PEG_1_HALT_STATUS, UNM_PEG_2_HALT_STATUS, UNM_PEG_3_HALT_STATUS, and UNM_PEG_4_HALT_STATUS.
Referenced by phantom_init_cmdpeg().
|
static |
Initialise the Phantom command PEG.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 1880 of file phantom.c.
References DBGC, EIO, ETIMEDOUT, mdelay(), phantom_readl(), phantom_unhalt_pegs(), phantom_write_hilo(), phantom_writel(), PHN_CMDPEG_INIT_TIMEOUT_SEC, UNM_CAM_RAM_COLD_BOOT, UNM_CAM_RAM_COLD_BOOT_MAGIC, UNM_CAM_RAM_PORT_MODE_AUTO_NEG_1G, UNM_CAM_RAM_WOL_PORT_MODE, UNM_NIC_REG_CMDPEG_STATE, UNM_NIC_REG_CMDPEG_STATE_INITIALIZE_ACK, UNM_NIC_REG_CMDPEG_STATE_INITIALIZED, UNM_NIC_REG_DUMMY_BUF, UNM_NIC_REG_DUMMY_BUF_ADDR_HI, UNM_NIC_REG_DUMMY_BUF_ADDR_LO, UNM_NIC_REG_DUMMY_BUF_INIT, UNM_ROMUSB_GLB_PEGTUNE_DONE, UNM_ROMUSB_GLB_PEGTUNE_DONE_MAGIC, UNM_ROMUSB_GLB_SW_RESET, and UNM_ROMUSB_GLB_SW_RESET_MAGIC.
Referenced by phantom_probe().
|
static |
Read Phantom MAC address.
phanton_port | Phantom NIC |
hw_addr | Buffer to fill with MAC address |
Definition at line 1969 of file phantom.c.
References DBGC, ETH_ALEN, eth_ntoa(), offset, phantom_readl(), phantom_nic::port, u, and UNM_CAM_RAM_MAC_ADDRS.
Referenced by phantom_probe().
|
static |
Check Phantom is enabled for boot.
phanton_port | Phantom NIC |
rc | Return status code |
This is something of an ugly hack to accommodate an OEM requirement. The NIC has only one expansion ROM BAR, rather than one per port. To allow individual ports to be selectively enabled/disabled for PXE boot (as required), we must therefore leave the expansion ROM always enabled, and place the per-port enable/disable logic within the iPXE driver.
Definition at line 2007 of file phantom.c.
References DBGC, ENOTSUP, phantom_readl(), phantom_nic::port, and UNM_CAM_RAM_BOOT_ENABLE.
Referenced by phantom_probe().
|
static |
Initialise Phantom receive PEG.
phantom | Phantom NIC |
rc | Return status code |
Definition at line 2026 of file phantom.c.
References DBGC, ETIMEDOUT, mdelay(), phantom_readl(), PHN_RCVPEG_INIT_TIMEOUT_SEC, UNM_NIC_REG_RCVPEG_STATE, and UNM_NIC_REG_RCVPEG_STATE_INITIALIZED.
Referenced by phantom_probe().
|
static |
Probe PCI device.
pci | PCI device |
id | PCI ID |
rc | Return status code |
Definition at line 2059 of file phantom.c.
References adjust_pci_device(), alloc_etherdev(), assert(), busdevfn, pci_device::busdevfn, DBGC, pci_device::dev, net_device::dev, ENOMEM, net_device::hw_addr, memset(), netdev, netdev_init(), netdev_nullify(), netdev_put(), netdev_settings(), PCI_BUS, PCI_BUSDEVFN, PCI_FUNC, pci_read_config_dword(), PCI_SEG, pci_set_drvdata(), PCI_SLOT, pci_write_config_dword(), phantom_check_boot_enable(), phantom_get_macaddr(), phantom_init_cmdpeg(), phantom_init_rcvpeg(), phantom_map_crb(), phantom_operations, phantom_settings_operations, phantom_settings_scope, PHN_MAX_NUM_PORTS, phantom_nic::port, net_device::priv, rc, net_device::refcnt, register_netdev(), register_settings(), phantom_nic::settings, settings_init(), strerror(), unregister_netdev(), and unregister_settings().
|
static |
Remove PCI device.
pci | PCI device |
Definition at line 2162 of file phantom.c.
References netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), net_device::priv, phantom_nic::settings, unregister_netdev(), and unregister_settings().
|
static |
Interrupt mask registers.
Definition at line 205 of file phantom.c.
Referenced by phantom_irq().
|
static |
Interrupt status registers.
Definition at line 217 of file phantom.c.
Referenced by phantom_poll().
|
static |
Phantom net device operations.
Definition at line 1447 of file phantom.c.
Referenced by phantom_probe().
|
static |
Phantom CLP settings scope.
Definition at line 1462 of file phantom.c.
Referenced by phantom_clp_setting(), and phantom_probe().
|
static |
Phantom CLP settings.
Definition at line 1669 of file phantom.c.
Referenced by phantom_clp_setting().
|
static |
Phantom CLP settings operations.
Definition at line 1788 of file phantom.c.
Referenced by phantom_probe().
|
static |
struct pci_driver phantom_driver __pci_driver |
Phantom PCI driver.