亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? winbond-840.c

?? LINUX 2.6.17.4的源碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* winbond-840.c: A Linux PCI network adapter device driver. *//*	Written 1998-2001 by Donald Becker.	This software may be used and distributed according to the terms of	the GNU General Public License (GPL), incorporated herein by reference.	Drivers based on or derived from this code fall under the GPL and must	retain the authorship, copyright and license notice.  This file is not	a complete program and may only be used when the entire operating	system is licensed under the GPL.	The author may be reached as becker@scyld.com, or C/O	Scyld Computing Corporation	410 Severn Ave., Suite 210	Annapolis MD 21403	Support and updates available at	http://www.scyld.com/network/drivers.html	Do not remove the copyright information.	Do not change the version information unless an improvement has been made.	Merely removing my name, as Compex has done in the past, does not count	as an improvement.	Changelog:	* ported to 2.4		???	* spin lock update, memory barriers, new style dma mappings		limit each tx buffer to < 1024 bytes		remove DescIntr from Rx descriptors (that's an Tx flag)		remove next pointer from Tx descriptors		synchronize tx_q_bytes		software reset in tx_timeout			Copyright (C) 2000 Manfred Spraul	* further cleanups		power management.		support for big endian descriptors			Copyright (C) 2001 Manfred Spraul  	* ethtool support (jgarzik)	* Replace some MII-related magic numbers with constants (jgarzik)  	TODO:	* enable pci_power_off	* Wake-On-LAN*/  #define DRV_NAME	"winbond-840"#define DRV_VERSION	"1.01-d"#define DRV_RELDATE	"Nov-17-2001"/* Automatically extracted configuration info:probe-func: winbond840_probeconfig-in: tristate 'Winbond W89c840 Ethernet support' CONFIG_WINBOND_840c-help-name: Winbond W89c840 PCI Ethernet supportc-help-symbol: CONFIG_WINBOND_840c-help: This driver is for the Winbond W89c840 chip.  It also works withc-help: the TX9882 chip on the Compex RL100-ATX board.c-help: More specific information and updates are available from c-help: http://www.scyld.com/network/drivers.html*//* The user-configurable values.   These may be modified when a driver module is loaded.*/static int debug = 1;			/* 1 normal messages, 0 quiet .. 7 verbose. */static int max_interrupt_work = 20;/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).   The '840 uses a 64 element hash table based on the Ethernet CRC.  */static int multicast_filter_limit = 32;/* Set the copy breakpoint for the copy-only-tiny-frames scheme.   Setting to > 1518 effectively disables this feature. */static int rx_copybreak;/* Used to pass the media type, etc.   Both 'options[]' and 'full_duplex[]' should exist for driver   interoperability.   The media type is usually passed in 'options[]'.*/#define MAX_UNITS 8		/* More are supported, limit only on options */static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};/* Operational parameters that are set at compile time. *//* Keep the ring sizes a power of two for compile efficiency.   The compiler will convert <unsigned>'%'<2^N> into a bit mask.   Making the Tx ring too large decreases the effectiveness of channel   bonding and packet priority.   There are no ill effects from too-large receive rings. */#define TX_RING_SIZE	16#define TX_QUEUE_LEN	10		/* Limit ring entries actually used.  */#define TX_QUEUE_LEN_RESTART	5#define RX_RING_SIZE	32#define TX_BUFLIMIT	(1024-128)/* The presumed FIFO size for working around the Tx-FIFO-overflow bug.   To avoid overflowing we don't queue again until we have room for a   full-size packet. */#define TX_FIFO_SIZE (2048)#define TX_BUG_FIFO_LIMIT (TX_FIFO_SIZE-1514-16)/* Operational parameters that usually are not changed. *//* Time in jiffies before concluding the transmitter is hung. */#define TX_TIMEOUT  (2*HZ)#define PKT_BUF_SZ		1536			/* Size of each temporary Rx buffer.*//* Include files, designed to support most kernel versions 2.0.0 and later. */#include <linux/module.h>#include <linux/kernel.h>#include <linux/string.h>#include <linux/timer.h>#include <linux/errno.h>#include <linux/ioport.h>#include <linux/slab.h>#include <linux/interrupt.h>#include <linux/pci.h>#include <linux/dma-mapping.h>#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/skbuff.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/ethtool.h>#include <linux/mii.h>#include <linux/rtnetlink.h>#include <linux/crc32.h>#include <linux/bitops.h>#include <asm/uaccess.h>#include <asm/processor.h>		/* Processor type for cache alignment. */#include <asm/io.h>#include <asm/irq.h>/* These identify the driver base version and may not be removed. */static char version[] __devinitdata =KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " DRV_RELDATE "  Donald Becker <becker@scyld.com>\n"KERN_INFO "  http://www.scyld.com/network/drivers.html\n";MODULE_AUTHOR("Donald Becker <becker@scyld.com>");MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver");MODULE_LICENSE("GPL");MODULE_VERSION(DRV_VERSION);module_param(max_interrupt_work, int, 0);module_param(debug, int, 0);module_param(rx_copybreak, int, 0);module_param(multicast_filter_limit, int, 0);module_param_array(options, int, NULL, 0);module_param_array(full_duplex, int, NULL, 0);MODULE_PARM_DESC(max_interrupt_work, "winbond-840 maximum events handled per interrupt");MODULE_PARM_DESC(debug, "winbond-840 debug level (0-6)");MODULE_PARM_DESC(rx_copybreak, "winbond-840 copy breakpoint for copy-only-tiny-frames");MODULE_PARM_DESC(multicast_filter_limit, "winbond-840 maximum number of filtered multicast addresses");MODULE_PARM_DESC(options, "winbond-840: Bits 0-3: media type, bit 17: full duplex");MODULE_PARM_DESC(full_duplex, "winbond-840 full duplex setting(s) (1)");/*				Theory of OperationI. Board CompatibilityThis driver is for the Winbond w89c840 chip.II. Board-specific settingsNone.III. Driver operationThis chip is very similar to the Digital 21*4* "Tulip" family.  The firsttwelve registers and the descriptor format are nearly identical.  Read aTulip manual for operational details.A significant difference is that the multicast filter and station address arestored in registers rather than loaded through a pseudo-transmit packet.Unlike the Tulip, transmit buffers are limited to 1KB.  To transmit afull-sized packet we must use both data buffers in a descriptor.  Thus thedriver uses ring mode where descriptors are implicitly sequential in memory,rather than using the second descriptor address as a chain pointer tosubsequent descriptors.IV. NotesIf you are going to almost clone a Tulip, why not go all the way and avoidthe need for a new driver?IVb. Referenceshttp://www.scyld.com/expert/100mbps.htmlhttp://www.scyld.com/expert/NWay.htmlhttp://www.winbond.com.tw/IVc. ErrataA horrible bug exists in the transmit FIFO.  Apparently the chip doesn'tcorrectly detect a full FIFO, and queuing more than 2048 bytes may result insilent data corruption.Test with 'ping -s 10000' on a fast computer.*//*  PCI probe table.*/enum pci_id_flags_bits {        /* Set PCI command register bits before calling probe1(). */        PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,        /* Read and map the single following PCI BAR. */        PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4,        PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400,};enum chip_capability_flags {	CanHaveMII=1, HasBrokenTx=2, AlwaysFDX=4, FDXOnNoMII=8,};#ifdef USE_IO_OPS#define W840_FLAGS (PCI_USES_IO | PCI_ADDR0 | PCI_USES_MASTER)#else#define W840_FLAGS (PCI_USES_MEM | PCI_ADDR1 | PCI_USES_MASTER)#endifstatic struct pci_device_id w840_pci_tbl[] = {	{ 0x1050, 0x0840, PCI_ANY_ID, 0x8153,     0, 0, 0 },	{ 0x1050, 0x0840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },	{ 0x11f6, 0x2011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 },	{ 0, }};MODULE_DEVICE_TABLE(pci, w840_pci_tbl);struct pci_id_info {        const char *name;        struct match_info {                int     pci, pci_mask, subsystem, subsystem_mask;                int revision, revision_mask;                            /* Only 8 bits. */        } id;        enum pci_id_flags_bits pci_flags;        int io_size;                            /* Needed for I/O region check or ioremap(). */        int drv_flags;                          /* Driver use, intended as capability flags. */};static struct pci_id_info pci_id_tbl[] = {	{"Winbond W89c840",			/* Sometime a Level-One switch card. */	 { 0x08401050, 0xffffffff, 0x81530000, 0xffff0000 },	 W840_FLAGS, 128, CanHaveMII | HasBrokenTx | FDXOnNoMII},	{"Winbond W89c840", { 0x08401050, 0xffffffff, },	 W840_FLAGS, 128, CanHaveMII | HasBrokenTx},	{"Compex RL100-ATX", { 0x201111F6, 0xffffffff,},	 W840_FLAGS, 128, CanHaveMII | HasBrokenTx},	{NULL,},					/* 0 terminated list. */};/* This driver was written to use PCI memory space, however some x86 systems   work only with I/O space accesses.  Pass -DUSE_IO_OPS to use PCI I/O space   accesses instead of memory space. *//* Offsets to the Command and Status Registers, "CSRs".   While similar to the Tulip, these registers are longword aligned.   Note: It's not useful to define symbolic names for every register bit in   the device.  The name can only partially document the semantics and make   the driver longer and more difficult to read.*/enum w840_offsets {	PCIBusCfg=0x00, TxStartDemand=0x04, RxStartDemand=0x08,	RxRingPtr=0x0C, TxRingPtr=0x10,	IntrStatus=0x14, NetworkConfig=0x18, IntrEnable=0x1C,	RxMissed=0x20, EECtrl=0x24, MIICtrl=0x24, BootRom=0x28, GPTimer=0x2C,	CurRxDescAddr=0x30, CurRxBufAddr=0x34,			/* Debug use */	MulticastFilter0=0x38, MulticastFilter1=0x3C, StationAddr=0x40,	CurTxDescAddr=0x4C, CurTxBufAddr=0x50,};/* Bits in the interrupt status/enable registers. *//* The bits in the Intr Status/Enable registers, mostly interrupt sources. */enum intr_status_bits {	NormalIntr=0x10000, AbnormalIntr=0x8000,	IntrPCIErr=0x2000, TimerInt=0x800,	IntrRxDied=0x100, RxNoBuf=0x80, IntrRxDone=0x40,	TxFIFOUnderflow=0x20, RxErrIntr=0x10,	TxIdle=0x04, IntrTxStopped=0x02, IntrTxDone=0x01,};/* Bits in the NetworkConfig register. */enum rx_mode_bits {	AcceptErr=0x80, AcceptRunt=0x40,	AcceptBroadcast=0x20, AcceptMulticast=0x10,	AcceptAllPhys=0x08, AcceptMyPhys=0x02,};enum mii_reg_bits {	MDIO_ShiftClk=0x10000, MDIO_DataIn=0x80000, MDIO_DataOut=0x20000,	MDIO_EnbOutput=0x40000, MDIO_EnbIn = 0x00000,};/* The Tulip Rx and Tx buffer descriptors. */struct w840_rx_desc {	s32 status;	s32 length;	u32 buffer1;	u32 buffer2;};struct w840_tx_desc {	s32 status;	s32 length;	u32 buffer1, buffer2;};/* Bits in network_desc.status */enum desc_status_bits {	DescOwn=0x80000000, DescEndRing=0x02000000, DescUseLink=0x01000000,	DescWholePkt=0x60000000, DescStartPkt=0x20000000, DescEndPkt=0x40000000,	DescIntr=0x80000000,};#define MII_CNT		1 /* winbond only supports one MII */struct netdev_private {	struct w840_rx_desc *rx_ring;	dma_addr_t	rx_addr[RX_RING_SIZE];	struct w840_tx_desc *tx_ring;	dma_addr_t	tx_addr[TX_RING_SIZE];	dma_addr_t ring_dma_addr;	/* The addresses of receive-in-place skbuffs. */	struct sk_buff* rx_skbuff[RX_RING_SIZE];	/* The saved address of a sent-in-place packet/buffer, for later free(). */	struct sk_buff* tx_skbuff[TX_RING_SIZE];	struct net_device_stats stats;	struct timer_list timer;	/* Media monitoring timer. */	/* Frequently used values: keep some adjacent for cache effect. */	spinlock_t lock;	int chip_id, drv_flags;	struct pci_dev *pci_dev;	int csr6;	struct w840_rx_desc *rx_head_desc;	unsigned int cur_rx, dirty_rx;		/* Producer/consumer ring indices */	unsigned int rx_buf_sz;				/* Based on MTU+slack. */	unsigned int cur_tx, dirty_tx;	unsigned int tx_q_bytes;	unsigned int tx_full;				/* The Tx queue is full. */	/* MII transceiver section. */	int mii_cnt;						/* MII device addresses. */	unsigned char phys[MII_CNT];		/* MII device addresses, but only the first is used */	u32 mii;	struct mii_if_info mii_if;	void __iomem *base_addr;};static int  eeprom_read(void __iomem *ioaddr, int location);static int  mdio_read(struct net_device *dev, int phy_id, int location);static void mdio_write(struct net_device *dev, int phy_id, int location, int value);static int  netdev_open(struct net_device *dev);static int  update_link(struct net_device *dev);static void netdev_timer(unsigned long data);static void init_rxtx_rings(struct net_device *dev);static void free_rxtx_rings(struct netdev_private *np);static void init_registers(struct net_device *dev);static void tx_timeout(struct net_device *dev);static int alloc_ringdesc(struct net_device *dev);static void free_ringdesc(struct netdev_private *np);static int  start_tx(struct sk_buff *skb, struct net_device *dev);static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs);static void netdev_error(struct net_device *dev, int intr_status);static int  netdev_rx(struct net_device *dev);static u32 __set_rx_mode(struct net_device *dev);static void set_rx_mode(struct net_device *dev);static struct net_device_stats *get_stats(struct net_device *dev);static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);static struct ethtool_ops netdev_ethtool_ops;static int  netdev_close(struct net_device *dev);static int __devinit w840_probe1 (struct pci_dev *pdev,				  const struct pci_device_id *ent){	struct net_device *dev;	struct netdev_private *np;	static int find_cnt;	int chip_idx = ent->driver_data;	int irq;	int i, option = find_cnt < MAX_UNITS ? options[find_cnt] : 0;	void __iomem *ioaddr;	int bar = 1;	i = pci_enable_device(pdev);	if (i) return i;	pci_set_master(pdev);	irq = pdev->irq;	if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {		printk(KERN_WARNING "Winbond-840: Device %s disabled due to DMA limitations.\n",		       pci_name(pdev));		return -EIO;	}	dev = alloc_etherdev(sizeof(*np));	if (!dev)		return -ENOMEM;	SET_MODULE_OWNER(dev);	SET_NETDEV_DEV(dev, &pdev->dev);	if (pci_request_regions(pdev, DRV_NAME))		goto err_out_netdev;#ifdef USE_IO_OPS	bar = 0;#endif	ioaddr = pci_iomap(pdev, bar, pci_id_tbl[chip_idx].io_size);	if (!ioaddr)		goto err_out_free_res;	for (i = 0; i < 3; i++)		((u16 *)dev->dev_addr)[i] = le16_to_cpu(eeprom_read(ioaddr, i));	/* Reset the chip to erase previous misconfiguration.	   No hold time required! */	iowrite32(0x00000001, ioaddr + PCIBusCfg);	dev->base_addr = (unsigned long)ioaddr;	dev->irq = irq;	np = netdev_priv(dev);	np->pci_dev = pdev;	np->chip_id = chip_idx;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产做a爰片久久毛片| 成人av午夜电影| 中文字幕一区二区三区在线观看| 欧美猛男男办公室激情| 色天天综合色天天久久| 99久久婷婷国产综合精品| 国产成人av一区| 国产一区二区网址| 国产原创一区二区三区| 国内精品久久久久影院薰衣草| 日韩精品久久久久久| 视频一区二区国产| 午夜免费久久看| 亚洲444eee在线观看| 亚洲图片欧美综合| 热久久国产精品| 天堂在线一区二区| 久久精品国产网站| 国产福利一区在线| 成人性色生活片免费看爆迷你毛片| 国产福利精品一区| av一区二区三区| 欧日韩精品视频| 日韩一级黄色大片| 欧美国产日产图区| 亚洲综合另类小说| 欧美aⅴ一区二区三区视频| 精品在线一区二区| 成人18视频在线播放| 色国产综合视频| 欧美成人三级在线| 国产精品不卡一区二区三区| 一区二区在线观看视频在线观看| 一区二区视频免费在线观看| 香蕉加勒比综合久久| 国产一区三区三区| 色婷婷一区二区三区四区| 欧美福利视频一区| 国产精品私人自拍| 亚洲成a天堂v人片| 丁香一区二区三区| 91精品久久久久久久99蜜桃| 国产视频不卡一区| 亚洲成人久久影院| 国产成人精品亚洲日本在线桃色 | 日韩欧美在线网站| 国产精品日产欧美久久久久| 午夜激情久久久| 国产曰批免费观看久久久| 在线一区二区三区四区五区| 精品国产乱码久久久久久浪潮| 国产精品国产三级国产| 日韩av电影免费观看高清完整版| 成人a区在线观看| 欧美一区中文字幕| 一区二区高清免费观看影视大全| 极品少妇一区二区| 欧美日韩国产综合视频在线观看| 国产精品免费视频观看| 蜜桃久久久久久| 欧美日韩综合在线| 亚洲免费观看高清在线观看| 欧美日本在线视频| 国产精品18久久久久久久久 | 国产成人精品www牛牛影视| 91小视频免费看| 国产女人水真多18毛片18精品视频 | 日韩高清不卡在线| 91蜜桃在线观看| 久久久精品国产免大香伊| 美腿丝袜在线亚洲一区| 欧美日韩成人高清| 亚洲一区二区三区影院| 91一区二区在线| |精品福利一区二区三区| 男女视频一区二区| 国产成人精品免费| 亚洲激情自拍偷拍| 国产精品丝袜91| 亚洲精品伦理在线| 99久久国产综合精品麻豆| 久久久一区二区三区| 国产精品一色哟哟哟| 久久亚洲精品小早川怜子| 久久精品国产免费| 久久中文娱乐网| 国产福利一区二区三区视频| 久久在线观看免费| 国产盗摄女厕一区二区三区| 国产欧美一区二区精品性色| 国产一区二区不卡| 国产精品国产馆在线真实露脸| 成人午夜免费av| 一个色综合网站| 91麻豆精品国产91久久久久久久久 | 欧美一区二区黄| 中文字幕电影一区| 国产麻豆视频精品| 丁香婷婷综合激情五月色| 久久精品国产免费| 欧美天堂亚洲电影院在线播放| 3d成人动漫网站| 久久国产免费看| 国产午夜精品福利| 色www精品视频在线观看| 亚洲一区二区精品3399| 日韩西西人体444www| 丰满亚洲少妇av| 亚洲第一搞黄网站| 久久综合狠狠综合久久激情| 国产+成+人+亚洲欧洲自线| 色综合久久久久综合体桃花网| 91精品国产91综合久久蜜臀| 亚洲一区二区欧美日韩| 日韩你懂的电影在线观看| 波多野结衣中文字幕一区二区三区 | 亚洲福利视频导航| 欧美精品一区二区三区蜜桃| av一区二区不卡| 水蜜桃久久夜色精品一区的特点| 精品成a人在线观看| 欧美性高清videossexo| 国产乱人伦精品一区二区在线观看| 国产精品乱人伦| 欧美一区二区在线不卡| heyzo一本久久综合| 欧美aaaaaa午夜精品| 亚洲视频在线观看三级| 欧美精品一区二区三区很污很色的 | 精品嫩草影院久久| 日韩三级视频在线看| 99久久精品情趣| 国产精品久久综合| 色综合久久久久网| 成人短视频下载 | 欧美日韩在线三区| 国产成人午夜精品5599| 日本aⅴ免费视频一区二区三区| 国产欧美日韩不卡| 欧美成人女星排行榜| 久久久亚洲午夜电影| 成人免费av资源| 中文字幕免费在线观看视频一区| 在线免费一区三区| 欧美少妇xxx| 色哟哟一区二区在线观看| 精品理论电影在线| 一区视频在线播放| 国产午夜亚洲精品理论片色戒| 欧美裸体一区二区三区| 欧洲一区二区av| 欧美在线不卡一区| 色综合久久久久网| 色婷婷av一区二区三区软件| 99国产精品久久久久久久久久久| 国产丶欧美丶日本不卡视频| 国产露脸91国语对白| 国产原创一区二区| 国产成人免费在线观看不卡| 国产综合久久久久久鬼色| 国产一区二区福利| 国产99精品国产| 不卡电影一区二区三区| 白白色 亚洲乱淫| 91蜜桃网址入口| 在线精品亚洲一区二区不卡| 在线观看欧美日本| 欧美日韩精品欧美日韩精品一| 欧美三级视频在线| 91精品国产全国免费观看| 欧美一三区三区四区免费在线看 | 日韩激情一二三区| 蜜臀精品久久久久久蜜臀| 日韩精品欧美精品| 国产一区二区视频在线播放| 国产成人免费在线观看| 久久国产日韩欧美精品| 日本美女一区二区三区视频| 欧美一区二区三区在线观看视频| 欧美日韩高清一区二区不卡| 欧美裸体一区二区三区| 久久综合色鬼综合色| 国内精品伊人久久久久av影院| 久久精品久久综合| 韩日欧美一区二区三区| 成人高清av在线| 精品视频一区二区三区免费| 欧美不卡一区二区三区四区| 久久久国产精华| 亚洲欧美综合色| 天天色天天操综合| 国产成a人无v码亚洲福利| 色悠久久久久综合欧美99| 欧美成人免费网站| 亚洲男人都懂的| 国产一区高清在线| 欧美日韩精品二区第二页| 欧美猛男男办公室激情| 岛国av在线一区| 欧美xxxx在线观看|