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

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

?? hd.c

?? 一個2.4.21版本的嵌入式linux內核
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* *  linux/drivers/ide/legacy/hd.c * *  Copyright (C) 1991, 1992  Linus Torvalds *//* * This is the low-level hd interrupt support. It traverses the * request-list, using interrupts to jump between functions. As * all the functions are called within interrupts, we may not * sleep. Special care is recommended. *  *  modified by Drew Eckhardt to check nr of hd's from the CMOS. * *  Thanks to Branko Lankester, lankeste@fwi.uva.nl, who found a bug *  in the early extended-partition checks and added DM partitions * *  IRQ-unmask, drive-id, multiple-mode, support for ">16 heads", *  and general streamlining by Mark Lord. * *  Removed 99% of above. Use Mark's ide driver for those options. *  This is now a lightweight ST-506 driver. (Paul Gortmaker) * *  Modified 1995 Russell King for ARM processor. * *  Bugfix: max_sectors must be <= 255 or the wheels tend to come *  off in a hurry once you queue things up - Paul G. 02/2001 */  /* Uncomment the following if you want verbose error reports. *//* #define VERBOSE_ERRORS */  #include <linux/errno.h>#include <linux/signal.h>#include <linux/sched.h>#include <linux/timer.h>#include <linux/fs.h>#include <linux/devfs_fs_kernel.h>#include <linux/kernel.h>#include <linux/hdreg.h>#include <linux/genhd.h>#include <linux/slab.h>#include <linux/string.h>#include <linux/ioport.h>#include <linux/mc146818rtc.h> /* CMOS defines */#include <linux/init.h>#include <linux/blkpg.h>#define REALLY_SLOW_IO#include <asm/system.h>#include <asm/io.h>#include <asm/uaccess.h>#define MAJOR_NR HD_MAJOR#include <linux/blk.h>#ifdef __arm__#undef  HD_IRQ#endif#include <asm/irq.h>#ifdef __arm__#define HD_IRQ IRQ_HARDDISK#endifstatic int revalidate_hddisk(kdev_t, int);#define	HD_DELAY	0#define MAX_ERRORS     16	/* Max read/write errors/sector */#define RESET_FREQ      8	/* Reset controller every 8th retry */#define RECAL_FREQ      4	/* Recalibrate every 4th retry */#define MAX_HD		2#define STAT_OK		(READY_STAT|SEEK_STAT)#define OK_STATUS(s)	(((s)&(STAT_OK|(BUSY_STAT|WRERR_STAT|ERR_STAT)))==STAT_OK)static void recal_intr(void);static void bad_rw_intr(void);static char recalibrate[MAX_HD];static char special_op[MAX_HD];static int access_count[MAX_HD];static char busy[MAX_HD];static DECLARE_WAIT_QUEUE_HEAD(busy_wait);static int reset;static int hd_error;#define SUBSECTOR(block) (CURRENT->current_nr_sectors > 0)/* *  This struct defines the HD's and their types. */struct hd_i_struct {	unsigned int head,sect,cyl,wpcom,lzone,ctl;};	#ifdef HD_TYPEstatic struct hd_i_struct hd_info[] = { HD_TYPE };static int NR_HD = ((sizeof (hd_info))/(sizeof (struct hd_i_struct)));#elsestatic struct hd_i_struct hd_info[MAX_HD];static int NR_HD;#endifstatic struct hd_struct hd[MAX_HD<<6];static int hd_sizes[MAX_HD<<6];static int hd_blocksizes[MAX_HD<<6];static int hd_hardsectsizes[MAX_HD<<6];static int hd_maxsect[MAX_HD<<6];static struct timer_list device_timer;#define SET_TIMER 							\	do {								\		mod_timer(&device_timer, jiffies + TIMEOUT_VALUE);	\	} while (0)#define CLEAR_TIMER del_timer(&device_timer);#undef SET_INTR#define SET_INTR(x) \if ((DEVICE_INTR = (x)) != NULL) \	SET_TIMER; \else \	CLEAR_TIMER;#if (HD_DELAY > 0)unsigned long last_req;unsigned long read_timer(void){	unsigned long t, flags;	int i;	spin_lock_irqsave(&io_request_lock, flags);	t = jiffies * 11932;    	outb_p(0, 0x43);	i = inb_p(0x40);	i |= inb(0x40) << 8;	spin_unlock_irqrestore(&io_request_lock, flags);	return(t - i);}#endifvoid __init hd_setup(char *str, int *ints){	int hdind = 0;	if (ints[0] != 3)		return;	if (hd_info[0].head != 0)		hdind=1;	hd_info[hdind].head = ints[2];	hd_info[hdind].sect = ints[3];	hd_info[hdind].cyl = ints[1];	hd_info[hdind].wpcom = 0;	hd_info[hdind].lzone = ints[1];	hd_info[hdind].ctl = (ints[2] > 8 ? 8 : 0);	NR_HD = hdind+1;}static void dump_status (const char *msg, unsigned int stat){	unsigned long flags;	char devc;	devc = !QUEUE_EMPTY ? 'a' + DEVICE_NR(CURRENT->rq_dev) : '?';	save_flags (flags);	sti();#ifdef VERBOSE_ERRORS	printk("hd%c: %s: status=0x%02x { ", devc, msg, stat & 0xff);	if (stat & BUSY_STAT)	printk("Busy ");	if (stat & READY_STAT)	printk("DriveReady ");	if (stat & WRERR_STAT)	printk("WriteFault ");	if (stat & SEEK_STAT)	printk("SeekComplete ");	if (stat & DRQ_STAT)	printk("DataRequest ");	if (stat & ECC_STAT)	printk("CorrectedError ");	if (stat & INDEX_STAT)	printk("Index ");	if (stat & ERR_STAT)	printk("Error ");	printk("}\n");	if ((stat & ERR_STAT) == 0) {		hd_error = 0;	} else {		hd_error = inb(HD_ERROR);		printk("hd%c: %s: error=0x%02x { ", devc, msg, hd_error & 0xff);		if (hd_error & BBD_ERR)		printk("BadSector ");		if (hd_error & ECC_ERR)		printk("UncorrectableError ");		if (hd_error & ID_ERR)		printk("SectorIdNotFound ");		if (hd_error & ABRT_ERR)	printk("DriveStatusError ");		if (hd_error & TRK0_ERR)	printk("TrackZeroNotFound ");		if (hd_error & MARK_ERR)	printk("AddrMarkNotFound ");		printk("}");		if (hd_error & (BBD_ERR|ECC_ERR|ID_ERR|MARK_ERR)) {			printk(", CHS=%d/%d/%d",				(inb(HD_HCYL)<<8) + inb(HD_LCYL),				inb(HD_CURRENT) & 0xf, inb(HD_SECTOR));			if (!QUEUE_EMPTY)				printk(", sector=%ld", CURRENT->sector);		}		printk("\n");	}#else	printk("hd%c: %s: status=0x%02x.\n", devc, msg, stat & 0xff);	if ((stat & ERR_STAT) == 0) {		hd_error = 0;	} else {		hd_error = inb(HD_ERROR);		printk("hd%c: %s: error=0x%02x.\n", devc, msg, hd_error & 0xff);	}#endif	/* verbose errors */	restore_flags (flags);}void check_status(void){	int i = inb_p(HD_STATUS);	if (!OK_STATUS(i)) {		dump_status("check_status", i);		bad_rw_intr();	}}static int controller_busy(void){	int retries = 100000;	unsigned char status;	do {		status = inb_p(HD_STATUS);	} while ((status & BUSY_STAT) && --retries);	return status;}static int status_ok(void){	unsigned char status = inb_p(HD_STATUS);	if (status & BUSY_STAT)		return 1;	/* Ancient, but does it make sense??? */	if (status & WRERR_STAT)		return 0;	if (!(status & READY_STAT))		return 0;	if (!(status & SEEK_STAT))		return 0;	return 1;}static int controller_ready(unsigned int drive, unsigned int head){	int retry = 100;	do {		if (controller_busy() & BUSY_STAT)			return 0;		outb_p(0xA0 | (drive<<4) | head, HD_CURRENT);		if (status_ok())			return 1;	} while (--retry);	return 0;}static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect,		unsigned int head,unsigned int cyl,unsigned int cmd,		void (*intr_addr)(void)){	unsigned short port;#if (HD_DELAY > 0)	while (read_timer() - last_req < HD_DELAY)		/* nothing */;#endif	if (reset)		return;	if (!controller_ready(drive, head)) {		reset = 1;		return;	}	SET_INTR(intr_addr);	outb_p(hd_info[drive].ctl,HD_CMD);	port=HD_DATA;	outb_p(hd_info[drive].wpcom>>2,++port);	outb_p(nsect,++port);	outb_p(sect,++port);	outb_p(cyl,++port);	outb_p(cyl>>8,++port);	outb_p(0xA0|(drive<<4)|head,++port);	outb_p(cmd,++port);}static void hd_request (void);static int drive_busy(void){	unsigned int i;	unsigned char c;	for (i = 0; i < 500000 ; i++) {		c = inb_p(HD_STATUS);		if ((c & (BUSY_STAT | READY_STAT | SEEK_STAT)) == STAT_OK)			return 0;	}	dump_status("reset timed out", c);	return 1;}static void reset_controller(void){	int	i;	outb_p(4,HD_CMD);	for(i = 0; i < 1000; i++) barrier();	outb_p(hd_info[0].ctl & 0x0f,HD_CMD);	for(i = 0; i < 1000; i++) barrier();	if (drive_busy())		printk("hd: controller still busy\n");	else if ((hd_error = inb(HD_ERROR)) != 1)		printk("hd: controller reset failed: %02x\n",hd_error);}static void reset_hd(void){	static int i;repeat:	if (reset) {		reset = 0;		i = -1;		reset_controller();	} else {		check_status();		if (reset)			goto repeat;	}	if (++i < NR_HD) {		special_op[i] = recalibrate[i] = 1;		hd_out(i,hd_info[i].sect,hd_info[i].sect,hd_info[i].head-1,			hd_info[i].cyl,WIN_SPECIFY,&reset_hd);		if (reset)			goto repeat;	} else		hd_request();}void do_reset_hd(void){	DEVICE_INTR = NULL;	reset = 1;	reset_hd();}/* * Ok, don't know what to do with the unexpected interrupts: on some machines * doing a reset and a retry seems to result in an eternal loop. Right now I * ignore it, and just set the timeout. * * On laptops (and "green" PCs), an unexpected interrupt occurs whenever the * drive enters "idle", "standby", or "sleep" mode, so if the status looks * "good", we just ignore the interrupt completely. */void unexpected_hd_interrupt(void){	unsigned int stat = inb_p(HD_STATUS);	if (stat & (BUSY_STAT|DRQ_STAT|ECC_STAT|ERR_STAT)) {		dump_status ("unexpected interrupt", stat);		SET_TIMER;	}}/* * bad_rw_intr() now tries to be a bit smarter and does things * according to the error returned by the controller. * -Mika Liljeberg (liljeber@cs.Helsinki.FI) */static void bad_rw_intr(void){	int dev;	if (QUEUE_EMPTY)		return;	dev = DEVICE_NR(CURRENT->rq_dev);	if (++CURRENT->errors >= MAX_ERRORS || (hd_error & BBD_ERR)) {		end_request(0);		special_op[dev] = recalibrate[dev] = 1;	} else if (CURRENT->errors % RESET_FREQ == 0)		reset = 1;	else if ((hd_error & TRK0_ERR) || CURRENT->errors % RECAL_FREQ == 0)		special_op[dev] = recalibrate[dev] = 1;	/* Otherwise just retry */}static inline int wait_DRQ(void){	int retries = 100000, stat;	while (--retries > 0)		if ((stat = inb_p(HD_STATUS)) & DRQ_STAT)			return 0;	dump_status("wait_DRQ", stat);	return -1;}static void read_intr(void){	int i, retries = 100000;	do {		i = (unsigned) inb_p(HD_STATUS);		if (i & BUSY_STAT)			continue;		if (!OK_STATUS(i))			break;		if (i & DRQ_STAT)			goto ok_to_read;	} while (--retries > 0);	dump_status("read_intr", i);	bad_rw_intr();	hd_request();	return;ok_to_read:	insw(HD_DATA,CURRENT->buffer,256);	CURRENT->sector++;	CURRENT->buffer += 512;	CURRENT->errors = 0;	i = --CURRENT->nr_sectors;	--CURRENT->current_nr_sectors;#ifdef DEBUG	printk("hd%c: read: sector %ld, remaining = %ld, buffer=0x%08lx\n",		dev+'a', CURRENT->sector, CURRENT->nr_sectors,		(unsigned long) CURRENT->buffer+512));#endif	if (CURRENT->current_nr_sectors <= 0)		end_request(1);	if (i > 0) {		SET_INTR(&read_intr);		return;	}	(void) inb_p(HD_STATUS);#if (HD_DELAY > 0)	last_req = read_timer();#endif	if (!QUEUE_EMPTY)		hd_request();	return;}static void write_intr(void){	int i;	int retries = 100000;	do {		i = (unsigned) inb_p(HD_STATUS);		if (i & BUSY_STAT)			continue;		if (!OK_STATUS(i))			break;		if ((CURRENT->nr_sectors <= 1) || (i & DRQ_STAT))

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品区一区二区三| 国产成人激情av| 成人在线视频首页| 在线亚洲高清视频| 久久精品欧美一区二区三区麻豆| 有码一区二区三区| 国产不卡在线视频| 在线综合+亚洲+欧美中文字幕| 国产精品欧美一级免费| 日日夜夜免费精品| 91一区一区三区| 国产欧美精品在线观看| 久久精品国产999大香线蕉| 在线免费观看一区| 亚洲欧洲性图库| 高清成人在线观看| 久久亚洲精精品中文字幕早川悠里| 亚洲一二三四区| 波多野结衣中文字幕一区| 久久免费精品国产久精品久久久久| 亚洲成va人在线观看| 色偷偷一区二区三区| 26uuu色噜噜精品一区| 青娱乐精品视频在线| 欧美日韩一区二区在线观看| 亚洲人精品午夜| 色婷婷久久久亚洲一区二区三区| 国产欧美日本一区视频| 国产成人免费在线| 欧美国产1区2区| 粗大黑人巨茎大战欧美成人| 久久久精品一品道一区| 日韩va欧美va亚洲va久久| 欧美日韩精品专区| 三级成人在线视频| 日韩欧美国产不卡| 韩国三级在线一区| 国产亚洲精品bt天堂精选| 国产精品77777| 国产精品美女一区二区三区| 欧美午夜不卡视频| 一区二区三区美女| 欧美日韩不卡一区| 日韩成人免费在线| 精品国产乱码久久久久久久| 韩日欧美一区二区三区| 国产亚洲欧美在线| 99久久亚洲一区二区三区青草| 国产精品激情偷乱一区二区∴| 97精品视频在线观看自产线路二| 一区二区三区日韩精品| 欧美三日本三级三级在线播放| 日韩vs国产vs欧美| 国产亚洲污的网站| 在线观看视频一区二区| 日韩专区一卡二卡| 久久久天堂av| 91成人国产精品| 久久精品二区亚洲w码| 欧美激情一区二区三区在线| 91天堂素人约啪| 美腿丝袜亚洲色图| 中文字幕一区二区三中文字幕| 欧美亚洲禁片免费| 国模套图日韩精品一区二区| 亚洲欧洲一区二区在线播放| 欧美理论在线播放| 成人av免费在线| 日韩电影在线免费| 国产精品日韩精品欧美在线| 欧美日韩亚洲高清一区二区| 国产麻豆精品视频| 亚洲国产成人av| 日本一区二区成人在线| 欧美性感一区二区三区| 国产69精品久久99不卡| 亚洲国产精品一区二区久久| 久久天天做天天爱综合色| 欧美视频日韩视频在线观看| 在线视频你懂得一区二区三区| 蜜臀av性久久久久av蜜臀妖精| 亚洲人成亚洲人成在线观看图片| 日韩一二三区不卡| 91福利小视频| 国产成人午夜99999| 麻豆免费精品视频| 亚洲成人精品一区二区| 日韩一区在线看| 国产日产欧美一区二区三区| 欧美日韩不卡视频| 欧美私人免费视频| 色悠悠亚洲一区二区| 高清视频一区二区| 狠狠色狠狠色综合日日91app| 亚洲韩国精品一区| 一个色综合网站| 亚洲精品免费电影| 日韩美女视频一区| 成人欧美一区二区三区黑人麻豆| 久久久www免费人成精品| 欧美一区日本一区韩国一区| 欧美亚洲丝袜传媒另类| 色婷婷亚洲精品| 波多野结衣精品在线| 高清国产一区二区| 粉嫩欧美一区二区三区高清影视| 久久99蜜桃精品| 麻豆国产欧美一区二区三区| 日韩高清不卡在线| 日本欧美在线看| 蜜臂av日日欢夜夜爽一区| 免费在线一区观看| 玖玖九九国产精品| 国内精品久久久久影院一蜜桃| 久久国产尿小便嘘嘘| 久久99精品久久久久久| 麻豆精品精品国产自在97香蕉| 日本亚洲欧美天堂免费| 美女在线视频一区| 国产精品资源网站| www.综合网.com| 91丨porny丨蝌蚪视频| 91国偷自产一区二区三区成为亚洲经典| 99免费精品在线| 色爱区综合激月婷婷| 欧美三级日本三级少妇99| 欧美日韩免费观看一区三区| 7777精品久久久大香线蕉 | 欧美日韩国产精选| 欧美日本免费一区二区三区| 欧美蜜桃一区二区三区| 日韩一区二区三区在线视频| 欧美大片免费久久精品三p| 久久精品亚洲国产奇米99| 国产精品久久久久久亚洲伦| 亚洲男人的天堂网| 奇米精品一区二区三区在线观看一| 精品制服美女丁香| jlzzjlzz欧美大全| 欧美亚州韩日在线看免费版国语版| 91.麻豆视频| 欧美国产日韩在线观看| 洋洋成人永久网站入口| 久久精品国产久精国产| va亚洲va日韩不卡在线观看| 欧美理论片在线| 国产亚洲成aⅴ人片在线观看| 亚洲欧美精品午睡沙发| 美女网站一区二区| 99久久综合国产精品| 91精品国产乱码| 成人欧美一区二区三区1314| 日韩激情av在线| www.爱久久.com| 日韩三级免费观看| 亚洲精品欧美激情| 国产美女av一区二区三区| 欧美在线视频日韩| 欧美国产激情二区三区 | 欧美日韩激情一区二区三区| 精品裸体舞一区二区三区| 夜夜精品浪潮av一区二区三区| 激情综合网av| 欧美性xxxxx极品少妇| 国产精品私人自拍| 精品一区二区久久久| 在线视频观看一区| 国产精品久久夜| 久久精品国产秦先生| 欧美日韩中文字幕一区二区| 欧美激情一区二区在线| 美腿丝袜亚洲三区| 欧美日韩久久一区二区| 亚洲免费在线观看| 成人综合在线观看| 欧美不卡123| 青青草原综合久久大伊人精品 | 亚洲美女视频一区| 国产大陆精品国产| 日韩视频国产视频| 亚洲成人综合视频| 欧美日韩一二三区| 亚洲一区二区三区四区不卡| 99这里只有精品| 国产欧美精品一区| 国产激情精品久久久第一区二区| 欧美电影免费观看高清完整版在 | 麻豆精品在线视频| 欧美丰满美乳xxx高潮www| 亚洲精品乱码久久久久久黑人| 成人激情小说网站| 欧美国产激情二区三区| 国产精品一区一区三区| 精品国产污污免费网站入口| 日韩高清一区二区| 日韩欧美国产麻豆| 极品尤物av久久免费看| 欧美成人精品福利| 国产福利一区二区三区| 国产亚洲va综合人人澡精品|