CS350 COS
COS
|
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <sys/kassert.h>
#include <sys/kdebug.h>
#include <sys/kmem.h>
#include <sys/semaphore.h>
#include <sys/pci.h>
#include <sys/irq.h>
#include <sys/mbuf.h>
#include <sys/nic.h>
#include <machine/pmap.h>
Go to the source code of this file.
Data Structures | |
struct | E1000Device |
struct | E1000RXDesc |
struct | E1000TXDesc |
struct | E1000Dev |
Macros | |
#define | E1000_REG_CTRL 0x0000 |
#define | E1000_REG_STATUS 0x0008 |
#define | E1000_REG_EECD 0x0010 |
#define | E1000_REG_EERD 0x0014 |
#define | E1000_REG_ICR 0x00C0 |
#define | E1000_REG_ICS 0x00C8 |
#define | E1000_REG_IMS 0x00D0 |
#define | E1000_REG_IMC 0x00D8 |
#define | E1000_REG_RCTL 0x0100 |
#define | E1000_REG_TCTL 0x0400 |
#define | E1000_REG_RDBAL 0x2800 |
#define | E1000_REG_RDBAH 0x2804 |
#define | E1000_REG_RDLEN 0x2808 |
#define | E1000_REG_RDH 0x2810 |
#define | E1000_REG_RDT 0x2818 |
#define | E1000_REG_RDTR 0x2820 |
#define | E1000_REG_TDBAL 0x3800 |
#define | E1000_REG_TDBAH 0x3804 |
#define | E1000_REG_TDLEN 0x3808 |
#define | E1000_REG_TDH 0x3810 |
#define | E1000_REG_TDT 0x3818 |
#define | E1000_REG_TIDV 0x3820 |
#define | E1000_REG_TADV 0x382C |
#define | E1000_REG_MTABASE 0x5200 |
#define | NVM_MAC_ADDR 0x0000 |
#define | NVM_DEVICE_ID 0x000D |
#define | NVM_VENDOR_ID 0x000E |
#define | CTRL_SLU (1 << 6) |
#define | RCTL_EN (1 << 1) |
#define | RCTL_SBP (1 << 2) |
#define | RCTL_UPE (1 << 3) |
#define | RCTL_MPE (1 << 4) |
#define | RCTL_LPE (1 << 5) |
#define | RCTL_BSIZE_1K (0x1 << 16) |
#define | RCTL_BSIZE_2K (0x0 << 16) |
#define | RCTL_BSIZE_4K ((1 << 25) | (0x3 << 16)) |
#define | RCTL_BSIZE_8K ((1 << 25) | (0x2 << 16)) |
#define | RCTL_BSIZE_16K ((1 << 25) | (0x1 << 16)) |
#define | TCTL_EN (1 << 1) |
#define | TCTL_PSP (1 << 3) |
#define | ICR_TXDW (1 << 0) |
#define | ICR_LSC (1 << 2) |
#define | ICR_RXO (1 << 6) |
#define | ICR_RXT0 (1 << 7) |
#define | RDESC_STATUS_EOP (1 << 1) |
#define | RDESC_STATUS_DD (1 << 0) |
#define | RDESC_ERROR_RDE (1 << 7) /* Receive Data Error */ |
#define | RDESC_ERROR_CE (1 << 0) /* CRC Error */ |
#define | TDESC_CMD_RS (1 << 3) /* Report Status */ |
#define | TDESC_CMD_IC (1 << 2) /* Insert Checksum */ |
#define | TDESC_CMD_IFCS (1 << 1) /* Insert Ethernet FCS/CRC */ |
#define | TDESC_CMD_EOP (1 << 0) /* End-of-Packet */ |
#define | E1000_TX_QLEN 128 |
#define | E1000_RX_QLEN 128 |
#define | E1000_MAX_MTU 9000 |
Typedefs | |
typedef struct E1000Device | E1000Device |
typedef struct PACKED E1000RXDesc | E1000RXDesc |
typedef struct PACKED E1000TXDesc | E1000TXDesc |
typedef struct E1000Dev | E1000Dev |
Functions | |
void | E1000_Configure (PCIDevice dev) |
DEFINE_SLAB (E1000RXDesc, &rxDescPool) | |
DEFINE_SLAB (E1000TXDesc, &txDescPool) | |
void * | RXPOOL_Alloc () |
void | RXPOOL_Free (void *buf) |
void | E1000_Init (uint32_t bus, uint32_t slot, uint32_t func) |
static uint32_t | MMIO_Read32 (E1000Dev *dev, uint64_t addr) |
static void | MMIO_Write32 (E1000Dev *dev, uint64_t addr, uint32_t val) |
static uint16_t | E1000_EEPROM_Read (E1000Dev *dev, uint8_t addr) |
void | E1000_TXPoll (E1000Dev *dev) |
void | E1000_RXPoll (E1000Dev *dev) |
void | E1000_Interrupt (void *arg) |
int | E1000_Dequeue (NIC *nic, MBuf *mbuf, NICCB cb, void *arg) |
int | E1000_Enqueue (NIC *nic, MBuf *mbuf, NICCB cb, void *arg) |
void | E1000_RXInit (E1000Dev *dev) |
void | E1000_TXInit (E1000Dev *dev) |
Variables | |
static E1000Device | deviceList [] |
static bool | runOnce = false |
static Slab | rxPool |
static Slab | rxDescPool |
static Slab | txDescPool |
struct E1000Device |
struct E1000RXDesc |
struct E1000TXDesc |
struct E1000Dev |
Data Fields | ||
---|---|---|
PCIDevice | dev | |
Semaphore | ioSema | |
IRQHandler | irqHandle | |
Spinlock | lock | |
uint8_t * | mmiobase | |
NIC | nic | |
E1000RXDesc * | rxDesc | |
uint32_t | rxTail | |
E1000TXDesc * | txDesc | |
uint32_t | txTail |
#define TDESC_CMD_IFCS (1 << 1) /* Insert Ethernet FCS/CRC */ |
typedef struct E1000Device E1000Device |
typedef struct PACKED E1000RXDesc E1000RXDesc |
typedef struct PACKED E1000TXDesc E1000TXDesc |
DEFINE_SLAB | ( | E1000RXDesc | , |
& | rxDescPool | ||
) |
DEFINE_SLAB | ( | E1000TXDesc | , |
& | txDescPool | ||
) |
void E1000_Configure | ( | PCIDevice | dev | ) |
Definition at line 437 of file e1000.c.
Definition at line 317 of file e1000.c.
Definition at line 168 of file e1000.c.
void E1000_Interrupt | ( | void * | arg | ) |
Definition at line 271 of file e1000.c.
void E1000_RXInit | ( | E1000Dev * | dev | ) |
Definition at line 379 of file e1000.c.
void E1000_RXPoll | ( | E1000Dev * | dev | ) |
Definition at line 232 of file e1000.c.
void E1000_TXInit | ( | E1000Dev * | dev | ) |
void E1000_TXPoll | ( | E1000Dev * | dev | ) |
void * RXPOOL_Alloc | ( | ) |
void RXPOOL_Free | ( | void * | buf | ) |
|
static |