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

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

?? hp.c

?? 內(nèi)核是系統(tǒng)的心臟
?? C
字號:
/* hp.c: A HP LAN ethernet driver for linux. */
/*
	Written 1993 by Donald Becker.
	Copyright 1993 United States Government as represented by the
	Director, National Security Agency.	 This software may be used and
	distributed according to the terms of the GNU Public License,
	incorporated herein by reference.

	This is a driver for the HP LAN adaptors.

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

static char *version =
	"hp.c:v0.99.15k 3/3/94 Donald Becker (becker@super.org)\n";

#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <asm/system.h>
#include <asm/io.h>

#include "dev.h"
#include "8390.h"

#ifndef HAVE_PORTRESERVE
#define check_region(ioaddr, size)				0
#define snarf_region(ioaddr, size);				do ; while (0)
#endif

#define HP_IO_EXTENT	32

#define HP_DATAPORT		0x0c	/* "Remote DMA" data port. */
#define HP_ID			0x07
#define HP_CONFIGURE	0x08	/* Configuration register. */
#define	 HP_RUN			0x01	/* 1 == Run, 0 == reset. */
#define	 HP_IRQ			0x0E	/* Mask for software-configured IRQ line. */
#define	 HP_DATAON		0x10	/* Turn on dataport */
#define NIC_OFFSET		0x10	/* Offset the 8390 registers. */

#define HP_START_PG		0x00	/* First page of TX buffer */
#define HP_8BSTOP_PG	0x80	/* Last page +1 of RX ring */
#define HP_16BSTOP_PG	0xFF	/* Same, for 16 bit cards. */

int hp_probe(struct device *dev);
int hpprobe1(struct device *dev, int ioaddr);

static void hp_reset_8390(struct device *dev);
static int hp_block_input(struct device *dev, int count,
						  char *buf, int ring_offset);
static void hp_block_output(struct device *dev, int count,
							const unsigned char *buf, const start_page);
static void hp_init_card(struct device *dev);

/* The map from IRQ number to HP_CONFIGURE register setting. */
/* My default is IRQ5	   0  1	 2  3  4  5  6	7  8  9 10 11 */
static char irqmap[16] = { 0, 0, 4, 6, 8,10, 0,14, 0, 4, 2,12,0,0,0,0};


/*	Probe for an HP LAN adaptor.
	Also initialize the card and fill in STATION_ADDR with the station
	address. */

int hp_probe(struct device *dev)
{
	int *port, ports[] = {0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240, 0};
	short ioaddr = dev->base_addr;

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

	for (port = &ports[0]; *port; port++) {
		if (check_region(*port, HP_IO_EXTENT))
			continue;
		if (hpprobe1(dev, *port) == 0) {
			return 0;
		}
	}
	return ENODEV;
}

int hpprobe1(struct device *dev, int ioaddr)
{
	int i, board_id, wordmode;
	char *name;
	unsigned char *station_addr = dev->dev_addr;

	/* Check for the HP physical address, 08 00 09 xx xx xx. */
	/* This really isn't good enough: we may pick up HP LANCE boards
	   also!  Avoid the lance 0x5757 signature. */
	if (inb(ioaddr) != 0x08
		|| inb(ioaddr+1) != 0x00
		|| inb(ioaddr+2) != 0x09
		|| inb(ioaddr+14) == 0x57)
		return ENODEV;

	/* Set up the parameters based on the board ID.
	   If you have additional mappings, please mail them to becker@super.org. */
	if ((board_id = inb(ioaddr + HP_ID)) & 0x80) {
		name = "HP27247";
		wordmode = 1;
	} else {
		name = "HP27250";
		wordmode = 0;
	}

	/* Grab the region so we can find another board if something fails. */
	snarf_region(ioaddr, HP_IO_EXTENT);

	printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);

	for(i = 0; i < ETHER_ADDR_LEN; i++)
		printk(" %2.2x", station_addr[i] = inb(ioaddr + i));

	/* Snarf the interrupt now.  Someday this could be moved to open(). */
	if (dev->irq < 2) {
		int irq_16list[] = { 11, 10, 5, 3, 4, 7, 9, 0};
		int irq_8list[] = { 7, 5, 3, 4, 9, 0};
		int *irqp = wordmode ? irq_16list : irq_8list;
		do {
			int irq = *irqp;
			if (request_irq (irq, NULL) != -EBUSY) {
				autoirq_setup(0);
				/* Twinkle the interrupt, and check if it's seen. */
				outb_p(irqmap[irq] | HP_RUN, ioaddr + HP_CONFIGURE);
				outb_p( 0x00 | HP_RUN, ioaddr + HP_CONFIGURE);
				if (irq == autoirq_report(0)		 /* It's a good IRQ line! */
					&& request_irq (irq, &ei_interrupt) == 0) {
					printk(" selecting IRQ %d.\n", irq);
					dev->irq = *irqp;
					break;
				}
			}
		} while (*++irqp);
		if (*irqp == 0) {
			printk(" no free IRQ lines.\n");
			return EBUSY;
		}
	} else {
		if (dev->irq == 2)
			dev->irq = 9;
		if (irqaction(dev->irq, &ei_sigaction)) {
			printk (" unable to get IRQ %d.\n", dev->irq);
			return EBUSY;
		}
	}

	if (ei_debug > 1)
		printk(version);

	/* Set the base address to point to the NIC, not the "real" base! */
	dev->base_addr = ioaddr + NIC_OFFSET;

	ethdev_init(dev);

	ei_status.name = name;
	ei_status.word16 = wordmode;
	ei_status.tx_start_page = HP_START_PG;
	ei_status.rx_start_page = HP_START_PG + TX_PAGES;
	ei_status.stop_page = wordmode ? HP_16BSTOP_PG : HP_8BSTOP_PG;

	ei_status.reset_8390 = &hp_reset_8390;
	ei_status.block_input = &hp_block_input;
	ei_status.block_output = &hp_block_output;
	hp_init_card(dev);

	return 0;
}

static void
hp_reset_8390(struct device *dev)
{
	int hp_base = dev->base_addr - NIC_OFFSET;
	int saved_config = inb_p(hp_base + HP_CONFIGURE);

	if (ei_debug > 1) printk("resetting the 8390 time=%ld...", jiffies);
	outb_p(0x00, hp_base + HP_CONFIGURE);
	ei_status.txing = 0;
	/* Pause just a few cycles for the hardware reset to take place. */
	SLOW_DOWN_IO;
	SLOW_DOWN_IO;

	outb_p(saved_config, hp_base + HP_CONFIGURE);
	SLOW_DOWN_IO; SLOW_DOWN_IO;
	
	if ((inb_p(hp_base+NIC_OFFSET+EN0_ISR) & ENISR_RESET) == 0)
		printk("%s: hp_reset_8390() did not complete.\n", dev->name);

	if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies);
	return;
}

/* Block input and output, similar to the Crynwr packet driver.	 If you
   porting to a new ethercard look at the packet driver source for hints.
   The HP LAN doesn't use shared memory -- we put the packet
   out through the "remote DMA" dataport. */

static int
hp_block_input(struct device *dev, int count, char *buf, int ring_offset)
{
	int nic_base = dev->base_addr;
	int saved_config = inb_p(nic_base - NIC_OFFSET + HP_CONFIGURE);
	int xfer_count = count;

	outb_p(saved_config | HP_DATAON, nic_base - NIC_OFFSET + HP_CONFIGURE);
	outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base);
	outb_p(count & 0xff, nic_base + EN0_RCNTLO);
	outb_p(count >> 8, nic_base + EN0_RCNTHI);
	outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
	outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
	outb_p(E8390_RREAD+E8390_START, nic_base);
	if (ei_status.word16) {
	  insw(nic_base - NIC_OFFSET + HP_DATAPORT,buf,count>>1);
	  if (count & 0x01)
		buf[count-1] = inb(nic_base - NIC_OFFSET + HP_DATAPORT), xfer_count++;
	} else {
		insb(nic_base - NIC_OFFSET + HP_DATAPORT, buf, count);
	}
	/* This is for the ALPHA version only, remove for later releases. */
	if (ei_debug > 0) {			/* DMA termination address check... */
	  int high = inb_p(nic_base + EN0_RSARHI);
	  int low = inb_p(nic_base + EN0_RSARLO);
	  int addr = (high << 8) + low;
	  /* Check only the lower 8 bits so we can ignore ring wrap. */
	  if (((ring_offset + xfer_count) & 0xff) != (addr & 0xff))
		printk("%s: RX transfer address mismatch, %#4.4x vs. %#4.4x (actual).\n",
			   dev->name, ring_offset + xfer_count, addr);
	}
	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
	return ring_offset + count;
}

static void
hp_block_output(struct device *dev, int count,
				const unsigned char *buf, const start_page)
{
	int nic_base = dev->base_addr;
	int saved_config = inb_p(nic_base - NIC_OFFSET + HP_CONFIGURE);

	outb_p(saved_config | HP_DATAON, nic_base - NIC_OFFSET + HP_CONFIGURE);
	/* Round the count up for word writes.	Do we need to do this?
	   What effect will an odd byte count have on the 8390?
	   I should check someday. */
	if (ei_status.word16 && (count & 0x01))
	  count++;
	/* We should already be in page 0, but to be safe... */
	outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base);

#ifdef ei8390_bug
	/* Handle the read-before-write bug the same way as the
	   Crynwr packet driver -- the NatSemi method doesn't work. */
	outb_p(0x42, nic_base + EN0_RCNTLO);
	outb_p(0,	nic_base + EN0_RCNTHI);
	outb_p(0xff, nic_base + EN0_RSARLO);
	outb_p(0x00, nic_base + EN0_RSARHI);
	outb_p(E8390_RREAD+E8390_START, EN_CMD);
	/* Make certain that the dummy read has occured. */
	inb_p(0x61);
	inb_p(0x61);
#endif

	outb_p(count & 0xff, nic_base + EN0_RCNTLO);
	outb_p(count >> 8,	 nic_base + EN0_RCNTHI);
	outb_p(0x00, nic_base + EN0_RSARLO);
	outb_p(start_page, nic_base + EN0_RSARHI);

	outb_p(E8390_RWRITE+E8390_START, nic_base);
	if (ei_status.word16) {
		/* Use the 'rep' sequence for 16 bit boards. */
		outsw(nic_base - NIC_OFFSET + HP_DATAPORT, buf, count>>1);
	} else {
		outsb(nic_base - NIC_OFFSET + HP_DATAPORT, buf, count);
	}

	/* DON'T check for 'inb_p(EN0_ISR) & ENISR_RDC' here -- it's broken! */

	/* This is for the ALPHA version only, remove for later releases. */
	if (ei_debug > 0) {			/* DMA termination address check... */
	  int high = inb_p(nic_base + EN0_RSARHI);
	  int low  = inb_p(nic_base + EN0_RSARLO);
	  int addr = (high << 8) + low;
	  if ((start_page << 8) + count != addr)
		printk("%s: TX Transfer address mismatch, %#4.4x vs. %#4.4x.\n",
			   dev->name, (start_page << 8) + count, addr);
	}
	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
	return;
}

/* This function resets the ethercard if something screws up. */
static void
hp_init_card(struct device *dev)
{
	int irq = dev->irq;
	NS8390_init(dev, 0);
	outb_p(irqmap[irq&0x0f] | HP_RUN,
		   dev->base_addr - NIC_OFFSET + HP_CONFIGURE);
	return;
}


/*
 * Local variables:
 * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c hp.c"
 * version-control: t
 * kept-new-versions: 5
 * tab-width: 4
 * c-indent-level: 4
 * End:
 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区在线| 亚洲激情网站免费观看| 中文一区一区三区高中清不卡| 国产午夜精品一区二区三区视频| 亚洲日本韩国一区| 日韩国产欧美三级| 国产盗摄一区二区| 在线观看亚洲a| 精品播放一区二区| 亚洲精品欧美在线| 狠狠色综合日日| 在线免费观看视频一区| 日韩欧美国产高清| 亚洲情趣在线观看| 伦理电影国产精品| 9人人澡人人爽人人精品| 欧美日韩国产经典色站一区二区三区| 精品国产免费视频| 亚洲自拍偷拍麻豆| 国产在线精品一区二区不卡了 | 精品国产成人在线影院 | 欧美性猛交一区二区三区精品| 欧美成人一区二区三区在线观看 | 成人性生交大片免费看中文 | 另类小说色综合网站| 91色在线porny| 日韩欧美www| 亚洲一区精品在线| 成人午夜激情片| 制服丝袜国产精品| 亚洲精品水蜜桃| 国产精品夜夜爽| 日韩欧美国产综合一区| 亚洲激情网站免费观看| 粉嫩高潮美女一区二区三区| 日韩一区二区免费在线观看| 亚洲美女免费视频| 风间由美一区二区av101| 欧美日本视频在线| 亚洲免费av高清| 国产一区二区三区高清播放| 在线观看国产日韩| 亚洲国产精品成人综合| 天堂影院一区二区| 99久免费精品视频在线观看| 在线观看不卡视频| 国产精品欧美一区喷水| 男女性色大片免费观看一区二区 | 欧美在线观看一区| 国产视频一区二区在线| 首页国产欧美久久| 色综合久久中文字幕| 国产亚洲女人久久久久毛片| 亚洲一区二区三区视频在线| 成人午夜又粗又硬又大| 91精品国产日韩91久久久久久| 亚洲女人的天堂| 国产福利91精品| 欧美大片在线观看一区| 亚洲自拍偷拍av| 99久久99久久久精品齐齐| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 欧美mv日韩mv国产网站| 亚洲成人av在线电影| www.久久久久久久久| 精品久久人人做人人爱| 午夜视频在线观看一区二区三区| 色综合久久中文字幕| 国产精品美女久久久久高潮| 国产一区二区三区在线看麻豆| 欧美日本高清视频在线观看| 一区二区视频在线看| youjizz久久| 国产日产欧美一区| 激情文学综合网| 日韩欧美国产综合| 久久精品国产一区二区三区免费看| 欧美色综合网站| 夜夜嗨av一区二区三区网页| 欧美日韩在线免费视频| 香蕉久久一区二区不卡无毒影院| 欧美性xxxxx极品少妇| 亚洲自拍偷拍综合| 欧美午夜在线一二页| 亚洲大片免费看| 欧美日韩国产乱码电影| 亚洲伦理在线免费看| 欧美日本精品一区二区三区| 亚洲mv在线观看| 欧美日韩国产首页| 亚洲国产精品自拍| 欧美精品三级日韩久久| 秋霞成人午夜伦在线观看| 欧美一区二区免费观在线| 日本欧美在线看| 精品国产一区二区三区忘忧草| 久久精品av麻豆的观看方式| 欧美成人性福生活免费看| 另类成人小视频在线| 亚洲欧美另类久久久精品| 99视频一区二区| 午夜伊人狠狠久久| 日韩精品一区二区三区四区| 国产在线播放一区二区三区 | 国产麻豆成人精品| 国产日韩亚洲欧美综合| av在线不卡网| 一区二区三区丝袜| 欧美无砖专区一中文字| 午夜欧美2019年伦理| 欧美猛男男办公室激情| 亚洲精品国产视频| 欧美日韩精品一区视频| 老司机精品视频一区二区三区| 国产性色一区二区| 欧美成人一区二区三区| 国产成人av影院| 亚洲欧洲日韩一区二区三区| 色天天综合色天天久久| 日本不卡免费在线视频| 欧美国产日本视频| 精品视频1区2区3区| 久久成人羞羞网站| 国产精品麻豆久久久| 欧美揉bbbbb揉bbbbb| 精品一区二区三区免费毛片爱| 国产精品网站在线观看| 欧美在线免费视屏| 韩国中文字幕2020精品| 亚洲一区在线看| 26uuu国产在线精品一区二区| av亚洲精华国产精华精华| 亚洲午夜电影在线观看| 久久亚洲二区三区| 色综合视频在线观看| 蜜臀久久99精品久久久画质超高清| 国产亚洲1区2区3区| 欧美日韩精品免费| 豆国产96在线|亚洲| 亚洲一区二区三区爽爽爽爽爽 | 亚洲aaa精品| 中文字幕中文字幕一区二区| 在线电影院国产精品| 国产98色在线|日韩| 香蕉加勒比综合久久| 国产欧美精品国产国产专区| 欧美视频一区在线观看| 福利一区福利二区| 日韩一区欧美二区| 综合在线观看色| www激情久久| 欧美电影影音先锋| 色偷偷88欧美精品久久久| 久久99精品国产麻豆婷婷洗澡| 国产欧美日韩精品a在线观看| 欧美一区二区美女| 欧洲精品中文字幕| 成人中文字幕在线| 久久国产免费看| 亚洲国产精品精华液网站| 中文字幕一区二区三区四区不卡| 欧美大度的电影原声| 懂色av中文字幕一区二区三区| 久久99这里只有精品| 亚洲成人福利片| 亚洲精品乱码久久久久久久久| 国产婷婷色一区二区三区在线| 欧美一级黄色大片| 在线观看一区二区视频| 99久久精品免费看| 久久精品国产99久久6| 天堂蜜桃91精品| 中文字幕一区二区三区不卡在线| 国产精品免费久久| 久久亚洲捆绑美女| 日韩你懂的在线播放| 欧美久久婷婷综合色| 一本大道久久精品懂色aⅴ | 久久午夜电影网| 91麻豆精品国产91久久久使用方法 | 久久99久久久久| 日本免费新一区视频| 一级女性全黄久久生活片免费| 日韩美女视频19| 中文字幕日韩一区| 1024精品合集| 亚洲三级在线免费观看| 中文字幕视频一区| 中文字幕佐山爱一区二区免费| 国产精品入口麻豆九色| 国产片一区二区| 日本一区二区三区国色天香 | 国产麻豆精品久久一二三| 激情小说亚洲一区| 久草精品在线观看| 日日摸夜夜添夜夜添亚洲女人| 蜜桃一区二区三区四区| 久久福利资源站| 国产一区二区三区四| 国产真实乱偷精品视频免|