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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? eexpress.c

?? 內核是系統的心臟
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* eexpress.c: Intel EtherExpress device driver for Linux. */
/*
	Written 1993 by Donald Becker.
	Copyright 1993 United States Government as represented by the Director,
	National Security Agency.  This software may only be used and distributed
	according to the terms of the GNU Public License as modified by SRC,
	incorported herein by reference.

	The author may be reached as becker@super.org or
	C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715

	Things remaining to do:
	Check that the 586 and ASIC are reset/unreset at the right times.
	Check tx and rx buffer setup.
	The current Tx is single-buffer-only.
	Move the theory of operation and memory map documentation.
	Rework the board error reset
	The statistics need to be updated correctly.
*/

static char *version =
	"eexpress.c:v0.07 1/19/94 Donald Becker (becker@super.org)\n";

#include <linux/config.h>

/*
  Sources:
	This driver wouldn't have been written with the availability of the
	Crynwr driver source code.	It provided a known-working implementation
	that filled in the gaping holes of the Intel documention.  Three cheers
	for Russ Nelson.

	Intel Microcommunications Databook, Vol. 1, 1990. It provides just enough
	info that the casual reader might think that it documents the i82586.
*/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <asm/system.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <errno.h>
#include <memory.h>

#include "dev.h"
#include "eth.h"
#include "skbuff.h"
#include "arp.h"

#ifndef HAVE_ALLOC_SKB
#define alloc_skb(size, priority) (struct sk_buff *) kmalloc(size,priority)
#else
/* This isn't quite right, but it's the best version define I can find right now. */
#include <linux/malloc.h>
#endif

/* use 0 for production, 1 for verification, 2..7 for debug */
#ifndef NET_DEBUG
#define NET_DEBUG 2
#endif
static unsigned int net_debug = NET_DEBUG;

/*
  			Details of the i82586.

   You'll really need the databook to understand the details of this part,
   but the outline is that the i82586 has two seperate processing units.

   The Rx unit uses a list of frame descriptors and a list of data buffer
   descriptors.  We use full-sized (1518 byte) data buffers, so there is
   a one-to-one pairing of frame descriptors to buffer descriptors.

   The Tx ("command") unit executes a list of commands that look like:
		Status word		Written by the 82586 when the command is done.
		Command word	Command in lower 3 bits, post-command action in upper 3
		Link word		The address of the next command.
		Parameters		(as needed).

	Some definitions related to the Command Word are:
 */
#define CMD_EOL		0x8000			/* The last command of the list, stop. */
#define CMD_SUSP	0x4000			/* Suspend after doing cmd. */
#define CMD_INTR	0x2000			/* Interrupt after doing cmd. */

enum commands {
	CmdNOp = 0, CmdSASetup = 1, CmdConfigure = 2, CmdMulticastList = 3,
	CmdTx = 4, CmdTDR = 5, CmdDump = 6, CmdDiagnose = 7};

/* Information that need to be kept for each board. */
struct net_local {
	struct enet_statistics stats;
	int last_restart;
	short rx_head;
	short rx_tail;
	short tx_head;
	short tx_cmd_link;
	short tx_reap;
};

/*
  		Details of the EtherExpress Implementation
  The EtherExpress takes an unusual approach to host access to packet buffer
  memory.  The host can use either the Dataport, with independent
  autoincrementing read and write pointers, or it can I/O map 32 bytes of the
  memory using the "Shadow Memory Pointer" (SMB) as follows:
			ioaddr						Normal EtherExpress registers
			ioaddr+0x4000...0x400f		Buffer Memory at SMB...SMB+15
			ioaddr+0x8000...0x800f		Buffer Memory at SMB+16...SMB+31
			ioaddr+0xC000...0xC007		"" SMB+16...SMB+23 (hardware flaw?)
			ioaddr+0xC008...0xC00f		Buffer Memory at 0x0008...0x000f
  The last I/O map set is useful if you put the i82586 System Command Block
  (the command mailbox) exactly at 0x0008.  (There seems to be some
  undocumented init structure at 0x0000-7, so I had to use the Crywnr memory
  setup verbatim for those four words anyway.)

  A problem with using either one of these mechanisms is that you must run
  single-threaded, or the interrupt handler must restore a changed value of
  the read, write, or SMB pointers.

  Unlike the Crynwr driver, my driver mostly ignores the I/O mapped "feature"
  and relies heavily on the dataport for buffer memory access.  To minimize
  switching, the read_pointer is dedicated to the Rx interrupt handler, and
  the write_pointer is used by the send_packet() routine (it's carefully saved
  and restored when it's needed by the interrupt handler).
  */

/* Offsets from the base I/O address. */
#define DATAPORT	0	/* Data Transfer Register. */
#define WRITE_PTR	2	/* Write Address Pointer. */
#define READ_PTR	4	/* Read Address Pointer. */
#define SIGNAL_CA	6	/* Frob the 82586 Channel Attention line. */
#define SET_IRQ		7	/* IRQ Select. */
#define SHADOW_PTR	8	/* Shadow Memory Bank Pointer. */
#define MEM_Ctrl	11
#define MEM_Page_Ctrl	12
#define Config		13
#define EEPROM_Ctrl		14
#define ID_PORT		15

/*	EEPROM_Ctrl bits. */

#define EE_SHIFT_CLK	0x01	/* EEPROM shift clock. */
#define EE_CS			0x02	/* EEPROM chip select. */
#define EE_DATA_WRITE	0x04	/* EEPROM chip data in. */
#define EE_DATA_READ	0x08	/* EEPROM chip data out. */
#define EE_CTRL_BITS	(EE_SHIFT_CLK | EE_CS | EE_DATA_WRITE | EE_DATA_READ)
#define ASIC_RESET		0x40
#define _586_RESET		0x80

/* Offsets to elements of the System Control Block structure. */
#define SCB_STATUS	0xc008
#define SCB_CMD		0xc00A
#define	 CUC_START	 0x0100
#define	 CUC_RESUME	 0x0200
#define	 CUC_SUSPEND 0x0300
#define	 RX_START	 0x0010
#define	 RX_RESUME	 0x0020
#define	 RX_SUSPEND	 0x0030
#define SCB_CBL		0xc00C	/* Command BLock offset. */
#define SCB_RFA		0xc00E	/* Rx Frame Area offset. */

/*
  What follows in 'init_words[]' is the "program" that is downloaded to the
  82586 memory.	 It's mostly tables and command blocks, and starts at the
  reset address 0xfffff6.

  Even with the additional "don't care" values, doing it this way takes less
  program space than initializing the individual tables, and I feel it's much
  cleaner.

  The databook is particularly useless for the first two structures; they are
  completely undocumented.  I had to use the Crynwr driver as an example.

   The memory setup is as follows:
   */

#define CONFIG_CMD	0x0018
#define SET_SA_CMD	0x0024
#define SA_OFFSET	0x002A
#define IDLELOOP	0x30
#define TDR_CMD		0x38
#define TDR_TIME	0x3C
#define DUMP_CMD	0x40
#define DIAG_CMD	0x48
#define SET_MC_CMD	0x4E
#define DUMP_DATA	0x56	/* A 170 byte buffer for dump and Set-MC into. */

#define TX_BUF_START	0x0100
#define NUM_TX_BUFS 	4
#define TX_BUF_SIZE		0x0680	/* packet+header+TBD+extra (1518+14+20+16) */
#define TX_BUF_END		0x2000

#define RX_BUF_START	0x2000
#define RX_BUF_SIZE 	(0x640)	/* packet+header+RBD+extra */
#define RX_BUF_END		0x4000

/*
  That's it: only 86 bytes to set up the beast, including every extra
  command available.  The 170 byte buffer at DUMP_DATA is shared between the
  Dump command (called only by the diagnostic program) and the SetMulticastList
  command.

  To complete the memory setup you only have to write the station address at
  SA_OFFSET and create the Tx & Rx buffer lists.

  The Tx command chain and buffer list is setup as follows:
  A Tx command table, with the data buffer pointing to...
  A Tx data buffer descriptor.  The packet is in a single buffer, rather than
     chaining together several smaller buffers.
  A NoOp command, which initially points to itself,
  And the packet data.

  A transmit is done by filling in the Tx command table and data buffer,
  re-writing the NoOp command, and finally changing the offset of the last
  command to point to the current Tx command.  When the Tx command is finished,
  it jumps to the NoOp, when it loops until the next Tx command changes the
  "link offset" in the NoOp.  This way the 82586 never has to go through the
  slow restart sequence.

  The Rx buffer list is set up in the obvious ring structure.  We have enough
  memory (and low enough interrupt latency) that we can avoid the complicated
  Rx buffer linked lists by alway associating a full-size Rx data buffer with
  each Rx data frame.

  I current use four transmit buffers starting at TX_BUF_START (0x0100), and
  use the rest of memory, from RX_BUF_START to RX_BUF_END, for Rx buffers.

  */

static short init_words[] = {
	0x0000,					/* Set bus size to 16 bits. */
	0x0000,0x0000,			/* Set control mailbox (SCB) addr. */
	0,0,					/* pad to 0x000000. */
	0x0001,					/* Status word that's cleared when init is done. */
	0x0008,0,0,				/* SCB offset, (skip, skip) */

	0,0xf000|RX_START|CUC_START,	/* SCB status and cmd. */
	CONFIG_CMD,				/* Command list pointer, points to Configure. */
	RX_BUF_START,				/* Rx block list. */
	0,0,0,0,				/* Error count: CRC, align, buffer, overrun. */

	/* 0x0018: Configure command.  Change to put MAC data with packet. */
	0, CmdConfigure,		/* Status, command.		*/
	SET_SA_CMD,				/* Next command is Set Station Addr. */
	0x0804,					/* "4" bytes of config data, 8 byte FIFO. */
	0x2e40,					/* Magic values, including MAC data location. */
	0,						/* Unused pad word. */

	/* 0x0024: Setup station address command. */
	0, CmdSASetup,
	SET_MC_CMD,				/* Next command. */
	0xaa00,0xb000,0x0bad,	/* Station address (to be filled in) */

	/* 0x0030: NOP, looping back to itself.	 Point to first Tx buffer to Tx. */
	0, CmdNOp, IDLELOOP, 0 /* pad */,

	/* 0x0038: A unused Time-Domain Reflectometer command. */
	0, CmdTDR, IDLELOOP, 0,

	/* 0x0040: An unused Dump State command. */
	0, CmdDump, IDLELOOP, DUMP_DATA,

	/* 0x0048: An unused Diagnose command. */
	0, CmdDiagnose, IDLELOOP,

	/* 0x004E: An empty set-multicast-list command. */
#ifdef initial_text_tx
	0, CmdMulticastList, DUMP_DATA, 0,
#else
	0, CmdMulticastList, IDLELOOP, 0,
#endif

	/* 0x0056: A continuous transmit command, only here for testing. */
	0, CmdTx, DUMP_DATA, DUMP_DATA+8, 0x83ff, -1, DUMP_DATA, 0,
};

/* Index to functions, as function prototypes. */

extern int express_probe(struct device *dev);	/* Called from Space.c */

static int	eexp_probe1(struct device *dev, short ioaddr);
static int	eexp_open(struct device *dev);
static int	eexp_send_packet(struct sk_buff *skb, struct device *dev);
static void	eexp_interrupt(int reg_ptr);
static void eexp_rx(struct device *dev);
static int	eexp_close(struct device *dev);
static struct enet_statistics *eexp_get_stats(struct device *dev);
#ifdef HAVE_MULTICAST
static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
#endif

static int read_eeprom(int ioaddr, int location);
static void hardware_send_packet(struct device *dev, void *buf, short length);
static void init_82586_mem(struct device *dev);
static void init_rx_bufs(struct device *dev);


/* Check for a network adaptor of this type, and return '0' iff one exists.
   If dev->base_addr == 0, probe all likely locations.
   If dev->base_addr == 1, always return failure.
   If dev->base_addr == 2, (detachable devices only) alloate space for the
   device and return success.
   */
int
express_probe(struct device *dev)
{
	/* Don't probe all settable addresses, 0x[23][0-7]0, just common ones. */
	int *port, ports[] = {0x300, 0x270, 0x320, 0x340, 0};
	int base_addr = dev->base_addr;

	if (base_addr > 0x1ff)	/* Check a single specified location. */
		return eexp_probe1(dev, base_addr);
	else if (base_addr > 0)
		return ENXIO;		/* Don't probe at all. */

	for (port = &ports[0]; *port; port++) {
		short id_addr = *port + ID_PORT;
		unsigned short sum = 0;
		int i;
#ifdef notdef
		for (i = 16; i > 0; i--)
			sum += inb(id_addr);
		printk("EtherExpress ID checksum is %04x.\n", sum);
#else
		for (i = 4; i > 0; i--) {
			short id_val = inb(id_addr);
			sum |= (id_val >> 4) << ((id_val & 3) << 2);
		}
#endif
		if (sum == 0xbaba
			&& eexp_probe1(dev, *port) == 0)
			return 0;
	}

	return ENODEV;			/* ENODEV would be more accurate. */
}

int eexp_probe1(struct device *dev, short ioaddr)
{
	unsigned short station_addr[3];
	int i;

	printk("%s: EtherExpress at %#x,", dev->name, ioaddr);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91老司机福利 在线| 欧美男男青年gay1069videost| 成人黄色av电影| 欧美精品视频www在线观看| 国产区在线观看成人精品| 午夜久久久影院| 一本一道综合狠狠老| 精品少妇一区二区三区日产乱码 | 国产成人欧美日韩在线电影| 在线观看欧美黄色| 国产精品视频免费| 国产在线视频精品一区| 欧美精品v日韩精品v韩国精品v| 国产精品久久久久久妇女6080 | 欧美一级二级三级蜜桃| 亚洲一二三区视频在线观看| 一区二区在线观看视频在线观看| 一区二区三区在线观看国产| 污片在线观看一区二区| 极品美女销魂一区二区三区| 成人av集中营| 欧美人体做爰大胆视频| 久久久午夜精品| 亚洲精品菠萝久久久久久久| 一区二区三区日韩精品| 久久久国产精品不卡| 夜夜操天天操亚洲| 日本丰满少妇一区二区三区| 亚洲欧洲韩国日本视频| www.成人网.com| **欧美大码日韩| 91麻豆国产自产在线观看| 亚洲视频每日更新| 在线一区二区三区做爰视频网站| 中文字幕一区二区三区在线观看 | 欧美日韩国产在线观看| 亚洲欧美激情视频在线观看一区二区三区| 国产黄色精品视频| 日本一区二区不卡视频| 99久久精品情趣| 亚洲精品国产一区二区三区四区在线 | 一区二区三区久久| 欧美影院一区二区| 日韩精品视频网| 精品动漫一区二区三区在线观看 | 亚洲一区中文日韩| 欧美女孩性生活视频| 男人的天堂久久精品| 日韩精品一区二区三区四区| 国产一区二区三区免费看| 久久精品视频在线看| 波多野结衣亚洲| 一区二区三区色| 欧美一卡2卡3卡4卡| 麻豆成人免费电影| 欧美国产日韩亚洲一区| 不卡的电影网站| 亚洲国产一区在线观看| 555夜色666亚洲国产免| 狠狠狠色丁香婷婷综合久久五月| 久久久久久99久久久精品网站| 99久久久免费精品国产一区二区| 亚洲综合在线五月| 精品剧情在线观看| 不卡欧美aaaaa| 日本在线不卡视频| 亚洲日本va在线观看| 欧美一区二区三区色| 成人ar影院免费观看视频| 亚洲一区自拍偷拍| 国产色产综合色产在线视频| 欧美私模裸体表演在线观看| 精品一区二区三区免费观看| 国产精品免费观看视频| 日本久久电影网| 国内精品久久久久影院色| 亚洲婷婷综合久久一本伊一区| 欧美日本在线一区| 成人97人人超碰人人99| 一区二区三区av电影| 久久亚洲私人国产精品va媚药| 91一区二区在线观看| 日本成人中文字幕| 日韩美女视频一区二区| 欧美va亚洲va| 欧美日韩一区视频| 不卡av免费在线观看| 日本va欧美va精品发布| 一区二区三区在线观看动漫| 日本一区二区三区在线不卡| 欧美一卡二卡三卡| 欧美日本在线一区| 在线观看91视频| fc2成人免费人成在线观看播放 | 99久久精品费精品国产一区二区| 久久精品国产免费| 亚洲成人中文在线| 一区二区三国产精华液| 最新国产精品久久精品| 久久久久久久综合狠狠综合| 日韩精品一区二区三区视频 | 久久久久久久久99精品| 911国产精品| 欧美亚洲国产一区二区三区va | 亚洲一二三四在线| 亚洲麻豆国产自偷在线| 18成人在线视频| 中文字幕高清不卡| 欧美激情综合五月色丁香小说| 26uuu国产在线精品一区二区| 91精品国产欧美日韩| 欧美精品一级二级三级| 在线播放一区二区三区| 欧美日韩国产另类一区| 在线电影国产精品| 欧美精品v日韩精品v韩国精品v| 欧美老年两性高潮| 欧美一区二区性放荡片| 久久久久久久久久久久久女国产乱| 欧美一区二区三级| 欧美一级久久久| 亚洲精选一二三| 日韩久久一区二区| 国产一区二区三区综合| 精品综合久久久久久8888| 老色鬼精品视频在线观看播放| 奇米888四色在线精品| 久久精品99久久久| 国产精品一区二区男女羞羞无遮挡| 黄网站免费久久| 成人动漫一区二区在线| 色婷婷综合久久久| 欧美人伦禁忌dvd放荡欲情| 日韩欧美国产精品一区| 久久久久久久久久久黄色| 1024精品合集| 视频在线在亚洲| 国产成人在线视频网址| 色系网站成人免费| 51久久夜色精品国产麻豆| 国产亚洲一区二区在线观看| 1区2区3区精品视频| 日韩电影在线一区| 国产一区二区三区蝌蚪| 一本到三区不卡视频| 日韩欧美一区在线观看| 国产精品无码永久免费888| 亚洲综合精品自拍| 国产自产高清不卡| 色呦呦网站一区| 久久综合狠狠综合久久综合88| 亚洲欧洲三级电影| 日韩av网站免费在线| 成人激情图片网| 制服.丝袜.亚洲.中文.综合| 国产精品一区二区在线播放| 伊人一区二区三区| 亚洲国产cao| 日韩av在线发布| 久久精品国产精品亚洲综合| 久久综合综合久久综合| 狠狠色丁香久久婷婷综合_中| 国产精品自拍av| 成人晚上爱看视频| 91蜜桃网址入口| 麻豆国产91在线播放| 国产成人在线视频免费播放| 欧美日韩精品一区二区三区| 亚洲国产精品精华液ab| 免费不卡在线观看| 欧美在线一区二区| 欧美国产丝袜视频| 国产精品综合网| 欧美一卡二卡三卡| 亚洲成a人片在线不卡一二三区| 成人午夜免费视频| 久久青草欧美一区二区三区| 日本不卡视频在线| 欧美日韩国产三级| 亚洲激情在线激情| 成人av电影在线| 中文字幕乱码一区二区免费| 麻豆91在线播放| 69久久夜色精品国产69蝌蚪网| 亚洲精品国产品国语在线app| 成人高清免费观看| 国产免费久久精品| 国产成人午夜片在线观看高清观看| 日韩欧美一区二区免费| 无码av免费一区二区三区试看| 在线精品视频一区二区| 樱花草国产18久久久久| 色综合久久综合网欧美综合网| 国产精品美女久久久久aⅴ国产馆| 国内精品久久久久影院一蜜桃| 精品99999| 国产91对白在线观看九色| 国产欧美日韩在线视频| 成人小视频免费观看| 最新欧美精品一区二区三区|