UbixOS
2.0
|
#include <pci/lnc.h>
#include <sys/io.h>
#include <sys/types.h>
#include <sys/idt.h>
#include <sys/gdt.h>
#include <lib/kmalloc.h>
#include <lib/kprintf.h>
#include <sys/video.h>
#include <isa/8259.h>
#include <net/net.h>
#include <net/netif.h>
#include <ubixos/spinlock.h>
Go to the source code of this file.
Functions | |
asm (".globl lnc_isr \n" "lnc_isr: \n" " pusha \n" " push %ss \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " call lnc_INT \n" " mov $0xA0,%dx \n" " mov $0x20,%ax \n" " outb %al,%dx \n" " mov $0x20,%dx \n" " mov $0x20,%ax \n" " outb %al,%dx \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " pop %ss \n" " popa \n" " iret \n") | |
int | initLNC () |
int | lanceProbe (struct lncInfo *lnc) |
int | lnc_driverOwnsRX (struct lncInfo *lnc) |
int | lnc_driverOwnsTX (struct lncInfo *lnc) |
int | lnc_getMode (struct lncInfo *lnc) |
void | lnc_INT () |
int | lnc_nextRxPtr (struct lncInfo *lnc) |
int | lnc_nextTxPtr (struct lncInfo *lnc) |
int | lnc_probe (struct lncInfo *lnc) |
uint16_t | lnc_readBCR (struct lncInfo *lnc, uint16_t port) |
uint32_t | lnc_readBCR32 (struct lncInfo *lnc, uint32_t port) |
uint16_t | lnc_readCSR (struct lncInfo *lnc, uint16_t port) |
uint32_t | lnc_readCSR32 (struct lncInfo *lnc, uint32_t port) |
void | lnc_reset (struct lncInfo *lnc) |
void | lnc_reset32 (struct lncInfo *lnc) |
void | lnc_rxINT () |
int | lnc_sendPacket (struct lncInfo *lnc, void *packet, size_t len, uint8_t *dest) |
int | lnc_switchDWord (struct lncInfo *lnc) |
void | lnc_thread () |
void | lnc_txINT () |
void | lnc_writeBCR (struct lncInfo *lnc, uint16_t port, uint16_t val) |
void | lnc_writeBCR32 (struct lncInfo *lnc, uint32_t port, uint32_t val) |
void | lnc_writeCSR (struct lncInfo *lnc, uint16_t port, uint16_t val) |
void | lnc_writeCSR32 (struct lncInfo *lnc, uint32_t port, uint32_t val) |
int | lncAttach (struct lncInfo *lnc, int unit) |
void | lncInt () |
Variables | |
struct lncInfo * | lnc = 0x0 |
struct netif | lnc_netif |
struct nicBuffer * | tmpBuf |
asm | ( | ".globl lnc_isr \n" "lnc_isr: \n" " pusha \n" " push %ss \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " call lnc_INT \n" " mov | $0xA0, |
%dx \n" " mov | $0x20, | ||
%ax \n" " outb % | al, | ||
%dx \n" " mov | $0x20, | ||
%dx \n" " mov | $0x20, | ||
%ax \n" " outb % | al, | ||
%dx \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " pop %ss \n" " popa \n" " iret \n" | |||
) |
int initLNC | ( | ) |
Definition at line 94 of file lnc.c.
References arpcom::ac_enaddr, lncInfo::arpcom, lncInfo::bufferSize, CSR0, CSR1, CSR2, CSR3, dDpl3, dInt, DMA_FIXED, dPresent, ETHER_ADDR_LEN, nicInfo::ic, nicInfo::ident, IDON, INEA, lncInfo::init, INIT, inportByte(), lncInfo::ioAddr, irqEnable(), kmalloc(), kprintf(), lnc, lnc_getMode(), lnc_isr(), lnc_probe(), lnc_readBCR32(), lnc_readCSR32(), lnc_switchDWord(), lnc_writeBCR32(), lnc_writeCSR32(), lncAttach(), nicInfo::memMode, memset(), initBlock32::mode, MODE_16, MODE_32, NE2100, lncInfo::nic, lncInfo::nrdre, NRDRE, lncInfo::ntdre, NTDRE, initBlock32::padr, PCnet_32, initBlock32::rdra, initBlock32::rlen, lncInfo::rxRing, setVector(), STRT, sVec, initBlock32::tdra, initBlock32::tlen, lncInfo::txRing, and vmm_getRealAddr().
int lanceProbe | ( | struct lncInfo * | lnc | ) |
Definition at line 231 of file lnc.c.
References C_LANCE, CSR0, CSR0_STOP, CSR3, INEA, inportWord(), lncInfo::ioAddr, LANCE, lnc, lnc_readCSR(), lnc_writeCSR(), RDP, and UNKNOWN.
Referenced by lnc_probe().
int lnc_driverOwnsRX | ( | struct lncInfo * | lnc | ) |
Definition at line 518 of file lnc.c.
References lnc, hostRingEntry::md, lncInfo::rxPtr, and lncInfo::rxRing.
Referenced by lnc_rxINT(), and lnc_thread().
int lnc_driverOwnsTX | ( | struct lncInfo * | lnc | ) |
Definition at line 514 of file lnc.c.
References lnc, hostRingEntry::md, lncInfo::txPtr, and lncInfo::txRing.
Referenced by lnc_sendPacket().
int lnc_getMode | ( | struct lncInfo * | lnc | ) |
Definition at line 573 of file lnc.c.
References CSR0, CSR0_STOP, lnc, lnc_readCSR(), lnc_readCSR32(), lnc_reset(), lnc_reset32(), MODE_16, MODE_32, and MODE_INVALID.
Referenced by initLNC().
void lnc_INT | ( | ) |
int lnc_nextRxPtr | ( | struct lncInfo * | lnc | ) |
Definition at line 534 of file lnc.c.
References lnc, NDESC, lncInfo::nrdre, and lncInfo::rxPtr.
Referenced by lnc_rxINT(), and lnc_thread().
int lnc_nextTxPtr | ( | struct lncInfo * | lnc | ) |
Definition at line 522 of file lnc.c.
References lnc, NDESC, lncInfo::ntdre, and lncInfo::txPtr.
Referenced by lnc_sendPacket().
int lnc_probe | ( | struct lncInfo * | lnc | ) |
Definition at line 191 of file lnc.c.
References Am79C960, Am79C961, Am79C961A, Am79C965, Am79C970, Am79C970A, Am79C971, Am79C972, Am79C973, Am79C978, AMD_MASK, CSR88, CSR89, lanceProbe(), lnc, lnc_readCSR(), PART_MASK, PCnet_32, PCnet_FAST, PCnet_FASTplus, PCnet_Home, PCnet_ISA, PCnet_ISA_II, PCnet_ISAplus, PCnet_PCI, and PCnet_PCI_II.
Referenced by initLNC().
Definition at line 84 of file lnc.c.
References BDP, inportWord(), lncInfo::ioAddr, lnc, outportWord(), and RAP.
Definition at line 89 of file lnc.c.
References BDP32, inportDWord(), lncInfo::ioAddr, lnc, outportDWord(), and RAP32.
Referenced by initLNC(), and lnc_switchDWord().
Definition at line 64 of file lnc.c.
References inportWord(), lncInfo::ioAddr, lnc, outportWord(), RAP, and RDP.
Referenced by lanceProbe(), lnc_getMode(), and lnc_probe().
Definition at line 69 of file lnc.c.
References inportDWord(), lncInfo::ioAddr, lnc, outportDWord(), RAP32, and RDP32.
Referenced by initLNC(), lnc_getMode(), and lnc_switchDWord().
void lnc_reset | ( | struct lncInfo * | lnc | ) |
Definition at line 585 of file lnc.c.
References inportWord(), lncInfo::ioAddr, lnc, and RESET.
Referenced by lnc_getMode().
void lnc_reset32 | ( | struct lncInfo * | lnc | ) |
Definition at line 589 of file lnc.c.
References inportDWord(), lncInfo::ioAddr, lnc, and RESET32.
Referenced by lnc_getMode().
void lnc_rxINT | ( | ) |
Definition at line 316 of file lnc.c.
References nicBuffer::buffer, lncInfo::bufferSize, kmalloc(), nicBuffer::length, lnc, lnc_driverOwnsRX(), lnc_nextRxPtr(), hostRingEntry::md, memset(), lncInfo::rxBuffer, lncInfo::rxPtr, lncInfo::rxRing, and tmpBuf.
Definition at line 546 of file lnc.c.
References hostRingEntry::bcnt, lncInfo::bufferSize, kpanic(), lnc, lnc_driverOwnsTX(), lnc_nextTxPtr(), hostRingEntry::md, memcpy(), lncInfo::txBuffer, lncInfo::txPtr, and lncInfo::txRing.
int lnc_switchDWord | ( | struct lncInfo * | lnc | ) |
Definition at line 593 of file lnc.c.
References BCR18, BCR18_DWIO, CSR58, inportDWord(), inportWord(), lncInfo::ioAddr, kprintf(), lnc, lnc_readBCR32(), lnc_readCSR32(), lnc_writeCSR32(), outportDWord(), RDP, RESET, and RESET32.
Referenced by initLNC().
void lnc_thread | ( | ) |
Definition at line 278 of file lnc.c.
References nicBuffer::buffer, lncInfo::bufferSize, ethernetif_input(), kmalloc(), nicBuffer::length, lnc, lnc_driverOwnsRX(), lnc_netif, lnc_nextRxPtr(), hostRingEntry::md, memset(), lncInfo::rxBuffer, lncInfo::rxPtr, lncInfo::rxRing, sched_yield(), and tmpBuf.
Referenced by net_init().
Definition at line 74 of file lnc.c.
References BDP, lncInfo::ioAddr, lnc, outportWord(), and RAP.
Definition at line 79 of file lnc.c.
References BDP32, lncInfo::ioAddr, lnc, outportDWord(), and RAP32.
Referenced by initLNC().
Definition at line 54 of file lnc.c.
References lncInfo::ioAddr, lnc, outportWord(), RAP, and RDP.
Referenced by lanceProbe().
Definition at line 59 of file lnc.c.
References lncInfo::ioAddr, lnc, outportDWord(), RAP32, and RDP32.
Referenced by initLNC(), lnc_INT(), and lnc_switchDWord().
int lncAttach | ( | struct lncInfo * | lnc, |
int | unit | ||
) |
Definition at line 419 of file lnc.c.
References hostRingEntry::addr, hostRingEntry::bcnt, lncInfo::bufferSize, C_LANCE, nicInfo::ic, kmalloc(), kprintf(), LANCE, lnc, hostRingEntry::md, nicInfo::memMode, memset(), nicInfo::mode, NDESC, lncInfo::nic, NORMAL, lncInfo::nrdre, lncInfo::ntdre, PCnet_32, lncInfo::rxBuffer, lncInfo::rxRing, SHMEM, lncInfo::txBuffer, lncInfo::txRing, and vmm_getRealAddr().
Referenced by initLNC().
void lncInt | ( | ) |
Definition at line 368 of file lnc.c.
References ERR, inportWord(), INTR, lncInfo::ioAddr, kprintf(), lnc, outportByte(), outportWord(), RDP, RINT, and TINT.
struct lncInfo* lnc = 0x0 |
Definition at line 44 of file lnc.c.
Referenced by initLNC(), lanceProbe(), lnc_driverOwnsRX(), lnc_driverOwnsTX(), lnc_getMode(), lnc_INT(), lnc_nextRxPtr(), lnc_nextTxPtr(), lnc_probe(), lnc_readBCR(), lnc_readBCR32(), lnc_readCSR(), lnc_readCSR32(), lnc_reset(), lnc_reset32(), lnc_rxINT(), lnc_sendPacket(), lnc_switchDWord(), lnc_thread(), lnc_writeBCR(), lnc_writeBCR32(), lnc_writeCSR(), lnc_writeCSR32(), lncAttach(), and lncInt().
struct netif lnc_netif |
Definition at line 42 of file lnc.c.
Referenced by lnc_thread().
struct nicBuffer* tmpBuf |
Definition at line 52 of file lnc.c.
Referenced by lnc_rxINT(), lnc_thread(), ne2kAllocBuffer(), and ne2kGetBuffer().