Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

fec.c File Reference

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/malloc.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <asm/8xx_immap.h>
#include <asm/pgtable.h>
#include <asm/fads.h>
#include <asm/irq.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include "commproc.h"

Include dependency graph for fec.c:

Go to the source code of this file.

Defines

#define FEC_ENET_RX_PAGES   4
#define FEC_ENET_RX_FRSIZE   2048
#define FEC_ENET_RX_FRPPG   (PAGE_SIZE / FEC_ENET_RX_FRSIZE)
#define RX_RING_SIZE   (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
#define TX_RING_SIZE   8
#define TX_RING_MOD_MASK   7
#define FEC_ENET_HBERR   ((uint)0x80000000)
#define FEC_ENET_BABR   ((uint)0x40000000)
#define FEC_ENET_BABT   ((uint)0x20000000)
#define FEC_ENET_GRA   ((uint)0x10000000)
#define FEC_ENET_TXF   ((uint)0x08000000)
#define FEC_ENET_TXB   ((uint)0x04000000)
#define FEC_ENET_RXF   ((uint)0x02000000)
#define FEC_ENET_RXB   ((uint)0x01000000)
#define FEC_ENET_MII   ((uint)0x00800000)
#define FEC_ENET_EBERR   ((uint)0x00400000)
#define PKT_MAXBUF_SIZE   1518
#define PKT_MINBUF_SIZE   64
#define PKT_MAXBLR_SIZE   1520
#define NMII   10
#define mk_mii_read(REG)   (0x60020000 | ((REG & 0x1f) << 18))
#define mk_mii_write(REG, VAL)

Typedefs

typedef mii_list mii_list_t

Functions

static int fec_enet_open (struct device *dev)
static int fec_enet_start_xmit (struct sk_buff *skb, struct device *dev)
static int fec_enet_rx (struct device *dev)
static void fec_enet_mii (struct device *dev)
static void fec_enet_interrupt (int irq, void *dev_id, struct pt_regs *regs)
static int fec_enet_close (struct device *dev)
static struct net_device_statsfec_enet_get_stats (struct device *dev)
static void set_multicast_list (struct device *dev)
static int mii_queue (int request, void(*func)(int))
static void mii_status (uint mii_reg)
static void mii_startup_cmds (void)
static void mii_relink (uint mii_reg)
static void mii_link_interrupt (int irq, void *dev_id, struct pt_regs *regs)
 __initfunc (int m8xx_enet_init(void))

Variables

static ushort my_enet_addr [] = { 0x0800, 0x3e26, 0x1559 }
mii_list_t mii_cmds [NMII]
mii_list_tmii_free
mii_list_tmii_head
mii_list_tmii_tail
static uint mii_saved_reg1


Define Documentation

#define FEC_ENET_BABR   ((uint)0x40000000)
 

Definition at line 67 of file fec.c.

Referenced by fec_enet_interrupt().

#define FEC_ENET_BABT   ((uint)0x20000000)
 

Definition at line 68 of file fec.c.

Referenced by fec_enet_interrupt().

#define FEC_ENET_EBERR   ((uint)0x00400000)
 

Definition at line 75 of file fec.c.

Referenced by fec_enet_interrupt().

#define FEC_ENET_GRA   ((uint)0x10000000)
 

Definition at line 69 of file fec.c.

#define FEC_ENET_HBERR   ((uint)0x80000000)
 

Definition at line 66 of file fec.c.

Referenced by fec_enet_interrupt().

#define FEC_ENET_MII   ((uint)0x00800000)
 

Definition at line 74 of file fec.c.

Referenced by __initfunc(), and fec_enet_interrupt().

#define FEC_ENET_RX_FRPPG   (PAGE_SIZE / FEC_ENET_RX_FRSIZE)
 

Definition at line 51 of file fec.c.

Referenced by __initfunc().

#define FEC_ENET_RX_FRSIZE   2048
 

Definition at line 50 of file fec.c.

Referenced by __initfunc().

#define FEC_ENET_RX_PAGES   4
 

Definition at line 49 of file fec.c.

Referenced by __initfunc().

#define FEC_ENET_RXB   ((uint)0x01000000)
 

Definition at line 73 of file fec.c.

Referenced by __initfunc(), and fec_enet_interrupt().

#define FEC_ENET_RXF   ((uint)0x02000000)
 

Definition at line 72 of file fec.c.

Referenced by __initfunc(), and fec_enet_interrupt().

#define FEC_ENET_TXB   ((uint)0x04000000)
 

Definition at line 71 of file fec.c.

Referenced by __initfunc(), and fec_enet_interrupt().

#define FEC_ENET_TXF   ((uint)0x08000000)
 

Definition at line 70 of file fec.c.

Referenced by __initfunc(), and fec_enet_interrupt().

#define mk_mii_read REG   )     (0x60020000 | ((REG & 0x1f) << 18))
 

Definition at line 140 of file fec.c.

Referenced by mii_link_interrupt(), and mii_startup_cmds().

#define mk_mii_write REG,
VAL   ) 
 

Value:

(0x50020000 | ((REG & 0x1f) << 18) | \
                                                (VAL & 0xffff))

Definition at line 141 of file fec.c.

#define NMII   10
 

Definition at line 130 of file fec.c.

Referenced by __initfunc().

#define PKT_MAXBLR_SIZE   1520
 

Definition at line 81 of file fec.c.

#define PKT_MAXBUF_SIZE   1518
 

Definition at line 79 of file fec.c.

#define PKT_MINBUF_SIZE   64
 

Definition at line 80 of file fec.c.

#define RX_RING_SIZE   (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
 

Definition at line 52 of file fec.c.

#define TX_RING_MOD_MASK   7
 

Definition at line 54 of file fec.c.

#define TX_RING_SIZE   8
 

Definition at line 53 of file fec.c.


Typedef Documentation

typedef struct mii_list mii_list_t
 


Function Documentation

__initfunc int   m8xx_enet_init(void)  ) 
 

Definition at line 793 of file fec.c.

References __clear_user, __pa, _PAGE_NO_CACHE, BD_ENET_RX_EMPTY, BD_SC_WRAP, cpm_buf_desc::cbd_bufaddr, cpm_buf_desc::cbd_sc, comm_proc::cp_fec, current, dev, device, fec::fec_addr_high, fec::fec_addr_low, fec::fec_ecntrl, fec_enet_close(), fec_enet_get_stats(), fec_enet_interrupt(), FEC_ENET_MII, fec_enet_open(), FEC_ENET_RX_FRPPG, FEC_ENET_RX_FRSIZE, FEC_ENET_RX_PAGES, FEC_ENET_RXB, FEC_ENET_RXF, fec_enet_start_xmit(), FEC_ENET_TXB, FEC_ENET_TXF, fec::fec_fun_code, fec::fec_hash_table_high, fec::fec_hash_table_low, fec::fec_ievent, fec::fec_imask, fec::fec_ivec, fec::fec_mii_speed, fec::fec_r_buff_size, fec::fec_r_cntrl, fec::fec_r_des_active, fec::fec_r_des_start, fec::fec_r_hash, fec::fec_x_cntrl, fec::fec_x_des_start, flush_tlb_page, i, immap::im_cpm, immap::im_ioport, IMAP_ADDR, init_etherdev(), init_task, io_port::iop_pddir, io_port::iop_pdpar, j, kmalloc(), mii_link_interrupt(), mii_list::mii_next, mii_startup_cmds(), my_enet_addr, NMII, PAGE_SIZE, panic(), PKT_MAXBLR_SIZE, PKT_MAXBUF_SIZE, printk, request_irq(), RX_RING_SIZE, set_multicast_list(), TX_RING_SIZE, udelay, and va_to_pte().

Here is the call graph for this function:

static int fec_enet_close struct device *  dev  )  [static]
 

Definition at line 699 of file fec.c.

Referenced by __initfunc().

static struct net_device_stats * fec_enet_get_stats struct device *  dev  )  [static]
 

Definition at line 707 of file fec.c.

References fec_enet_private::stats.

Referenced by __initfunc().

static void fec_enet_interrupt int  irq,
void *  dev_id,
struct pt_regs regs
[static]
 

Definition at line 283 of file fec.c.

References BD_ENET_TX_CSL, BD_ENET_TX_DEF, BD_ENET_TX_HB, BD_ENET_TX_LC, BD_ENET_TX_READY, BD_ENET_TX_RL, BD_ENET_TX_UN, BD_ENET_TX_WRAP, c, cpm_buf_desc::cbd_sc, net_device_stats::collisions, fec_enet_private::cur_tx, dev, dev_kfree_skb, device, fec_enet_private::dirty_tx, ep, FEC_ENET_BABR, FEC_ENET_BABT, FEC_ENET_EBERR, FEC_ENET_HBERR, fec_enet_mii(), FEC_ENET_MII, fec_enet_rx(), FEC_ENET_RXB, FEC_ENET_RXF, FEC_ENET_TXB, FEC_ENET_TXF, fec::fec_ievent, IMAP_ADDR, mark_bh, NET_BH, printk, fec_enet_private::skb_dirty, fec_enet_private::stats, net_device_stats::tx_aborted_errors, fec_enet_private::tx_bd_base, net_device_stats::tx_carrier_errors, net_device_stats::tx_errors, net_device_stats::tx_fifo_errors, fec_enet_private::tx_full, net_device_stats::tx_heartbeat_errors, net_device_stats::tx_packets, TX_RING_MOD_MASK, fec_enet_private::tx_skbuff, net_device_stats::tx_window_errors, and uint.

Referenced by __initfunc().

Here is the call graph for this function:

static void fec_enet_mii struct device *  dev  )  [static]
 

Definition at line 509 of file fec.c.

References ep, fec::fec_mii_data, IMAP_ADDR, mii_list::mii_func, mii_list::mii_next, mii_list::mii_regval, NULL, printk, and uint.

Referenced by fec_enet_interrupt().

static int fec_enet_open struct device *  dev  )  [static]
 

Definition at line 145 of file fec.c.

Referenced by __initfunc().

static int fec_enet_rx struct device *  dev  )  [static]
 

Definition at line 396 of file fec.c.

References __va, BD_ENET_RX_CL, BD_ENET_RX_CR, BD_ENET_RX_EMPTY, BD_ENET_RX_LAST, BD_ENET_RX_LG, BD_ENET_RX_NO, BD_ENET_RX_OV, BD_ENET_RX_SH, BD_ENET_RX_STATS, BD_ENET_RX_WRAP, cpm_buf_desc::cbd_bufaddr, cpm_buf_desc::cbd_datlen, cpm_buf_desc::cbd_sc, fec_enet_private::cur_rx, sk_buff::dev, ep, eth_copy_and_sum(), eth_type_trans(), fec::fec_r_des_active, IMAP_ADDR, netif_rx(), NULL, printk, sk_buff::protocol, fec_enet_private::rx_bd_base, net_device_stats::rx_bytes, net_device_stats::rx_crc_errors, net_device_stats::rx_dropped, net_device_stats::rx_frame_errors, net_device_stats::rx_length_errors, net_device_stats::rx_packets, fec_enet_private::stats, and ushort.

Referenced by fec_enet_interrupt().

Here is the call graph for this function:

static int fec_enet_start_xmit struct sk_buff skb,
struct device *  dev
[static]
 

Definition at line 160 of file fec.c.

References __pa, BD_ENET_TX_INTR, BD_ENET_TX_LAST, BD_ENET_TX_READY, BD_ENET_TX_STATS, BD_ENET_TX_TC, BD_ENET_TX_WRAP, cpm_buf_desc::cbd_bufaddr, cpm_buf_desc::cbd_datlen, cpm_buf_desc::cbd_sc, cli, fec_enet_private::cur_rx, fec_enet_private::cur_tx, sk_buff::data, i, IMAP_ADDR, jiffies, sk_buff::len, fec_enet_private::lock, printk, restore_flags, fec_enet_private::rx_bd_base, RX_RING_SIZE, save_flags, fec_enet_private::skb_cur, fec_enet_private::stats, test_and_set_bit, fec_enet_private::tx_bd_base, net_device_stats::tx_bytes, net_device_stats::tx_errors, fec_enet_private::tx_full, TX_RING_MOD_MASK, TX_RING_SIZE, and fec_enet_private::tx_skbuff.

Referenced by __initfunc().

static void mii_link_interrupt int  irq,
void *  dev_id,
struct pt_regs regs
[static]
 

Definition at line 677 of file fec.c.

References dev, device, ep, IMAP_ADDR, mii_queue(), mii_relink(), and mk_mii_read.

Referenced by __initfunc().

Here is the call graph for this function:

static int mii_queue int  request,
void(*)(int)  func
[static]
 

Definition at line 537 of file fec.c.

References cli, IMAP_ADDR, mii_list::mii_func, mii_list::mii_next, mii_list::mii_regval, NULL, restore_flags, and save_flags.

Referenced by mii_link_interrupt(), and mii_startup_cmds().

static void mii_relink uint  mii_reg  )  [static]
 

Definition at line 630 of file fec.c.

References printk, x1000, x1f, x4000(), and x8000.

Referenced by mii_link_interrupt().

Here is the call graph for this function:

static void mii_startup_cmds void   )  [static]
 

Definition at line 606 of file fec.c.

References mii_queue(), mii_status(), mk_mii_read, and x14.

Referenced by __initfunc().

Here is the call graph for this function:

static void mii_status uint  mii_reg  )  [static]
 

Definition at line 572 of file fec.c.

References printk, x1000, x14, and x1f.

Referenced by epic_probe1(), hamachi_probe1(), mii_lookup_and_reset(), mii_startup_cmds(), rtl8129_probe1(), rtl8139_init_one(), sis900_mii_probe(), starfire_init_one(), tulip_probe1(), via_probe1(), vortex_probe1(), vortex_timer(), and yellowfin_probe1().

static void set_multicast_list struct device *  dev  )  [static]
 

Definition at line 724 of file fec.c.

References comm_proc::cp_cpcr, CPM_CR_CH_SCC1, CPM_CR_FLG, CPM_CR_SET_GADDR, cpmp, ep, fec::fec_hash_table_high, fec::fec_hash_table_low, fec::fec_r_cntrl, i, IFF_ALLMULTI, IFF_PROMISC, IMAP_ADDR, j, mk_cr_cmd, printk, u_char, and udelay.


Variable Documentation

mii_list_t mii_cmds[NMII]
 

Definition at line 131 of file fec.c.

mii_list_t* mii_free
 

Definition at line 132 of file fec.c.

mii_list_t* mii_head
 

Definition at line 133 of file fec.c.

uint mii_saved_reg1 [static]
 

Definition at line 627 of file fec.c.

mii_list_t* mii_tail
 

Definition at line 134 of file fec.c.

ushort my_enet_addr[] = { 0x0800, 0x3e26, 0x1559 } [static]
 

Definition at line 118 of file fec.c.

Referenced by __initfunc().