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

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

?? hd.c

?? LINUX 2.6.17.4的源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* *  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/blkdev.h>#include <linux/errno.h>#include <linux/signal.h>#include <linux/interrupt.h>#include <linux/timer.h>#include <linux/fs.h>#include <linux/kernel.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>#include <linux/hdreg.h>#define REALLY_SLOW_IO#include <asm/system.h>#include <asm/io.h>#include <asm/uaccess.h>#ifdef __arm__#undef  HD_IRQ#endif#include <asm/irq.h>#ifdef __arm__#define HD_IRQ IRQ_HARDDISK#endif/* Hd controller regster ports */#define HD_DATA		0x1f0		/* _CTL when writing */#define HD_ERROR	0x1f1		/* see err-bits */#define HD_NSECTOR	0x1f2		/* nr of sectors to read/write */#define HD_SECTOR	0x1f3		/* starting sector */#define HD_LCYL		0x1f4		/* starting cylinder */#define HD_HCYL		0x1f5		/* high byte of starting cyl */#define HD_CURRENT	0x1f6		/* 101dhhhh , d=drive, hhhh=head */#define HD_STATUS	0x1f7		/* see status-bits */#define HD_FEATURE	HD_ERROR	/* same io address, read=error, write=feature */#define HD_PRECOMP	HD_FEATURE	/* obsolete use of this port - predates IDE */#define HD_COMMAND	HD_STATUS	/* same io address, read=status, write=cmd */#define HD_CMD		0x3f6		/* used for resets */#define HD_ALTSTATUS	0x3f6		/* same as HD_STATUS but doesn't clear irq *//* Bits of HD_STATUS */#define ERR_STAT		0x01#define INDEX_STAT		0x02#define ECC_STAT		0x04	/* Corrected error */#define DRQ_STAT		0x08#define SEEK_STAT		0x10#define SERVICE_STAT		SEEK_STAT#define WRERR_STAT		0x20#define READY_STAT		0x40#define BUSY_STAT		0x80/* Bits for HD_ERROR */#define MARK_ERR		0x01	/* Bad address mark */#define TRK0_ERR		0x02	/* couldn't find track 0 */#define ABRT_ERR		0x04	/* Command aborted */#define MCR_ERR			0x08	/* media change request */#define ID_ERR			0x10	/* ID field not found */#define MC_ERR			0x20	/* media changed */#define ECC_ERR			0x40	/* Uncorrectable ECC error */#define BBD_ERR			0x80	/* pre-EIDE meaning:  block marked bad */#define ICRC_ERR		0x80	/* new meaning:  CRC error during transfer */static DEFINE_SPINLOCK(hd_lock);static struct request_queue *hd_queue;#define MAJOR_NR HD_MAJOR#define QUEUE (hd_queue)#define CURRENT elv_next_request(hd_queue)#define TIMEOUT_VALUE	(6*HZ)#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 int reset;static int hd_error;/* *  This struct defines the HD's and their types. */struct hd_i_struct {	unsigned int head,sect,cyl,wpcom,lzone,ctl;	int unit;	int recalibrate;	int special_op;};	#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 gendisk *hd_gendisk[MAX_HD];static struct timer_list device_timer;#define TIMEOUT_VALUE (6*HZ)#define SET_TIMER							\	do {								\		mod_timer(&device_timer, jiffies + TIMEOUT_VALUE);	\	} while (0)static void (*do_hd)(void) = NULL;#define SET_HANDLER(x) \if ((do_hd = (x)) != NULL) \	SET_TIMER; \else \	del_timer(&device_timer);#if (HD_DELAY > 0)#include <asm/i8253.h>unsigned long last_req;unsigned long read_timer(void){	unsigned long t, flags;	int i;	spin_lock_irqsave(&i8253_lock, flags);	t = jiffies * 11932;    	outb_p(0, 0x43);	i = inb_p(0x40);	i |= inb(0x40) << 8;	spin_unlock_irqrestore(&i8253_lock, flags);	return(t - i);}#endifstatic void __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){	char *name = "hd?";	if (CURRENT)		name = CURRENT->rq_disk->disk_name;#ifdef VERBOSE_ERRORS	printk("%s: %s: status=0x%02x { ", name, 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("%s: %s: error=0x%02x { ", name, 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 (CURRENT)				printk(", sector=%ld", CURRENT->sector);		}		printk("\n");	}#else	printk("%s: %s: status=0x%02x.\n", name, msg, stat & 0xff);	if ((stat & ERR_STAT) == 0) {		hd_error = 0;	} else {		hd_error = inb(HD_ERROR);		printk("%s: %s: error=0x%02x.\n", name, msg, hd_error & 0xff);	}#endif}static 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(struct hd_i_struct *disk,		   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(disk->unit, head)) {		reset = 1;		return;	}	SET_HANDLER(intr_addr);	outb_p(disk->ctl,HD_CMD);	port=HD_DATA;	outb_p(disk->wpcom>>2,++port);	outb_p(nsect,++port);	outb_p(sect,++port);	outb_p(cyl,++port);	outb_p(cyl>>8,++port);	outb_p(0xA0|(disk->unit<<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) {		struct hd_i_struct *disk = &hd_info[i];		disk->special_op = disk->recalibrate = 1;		hd_out(disk,disk->sect,disk->sect,disk->head-1,			disk->cyl,WIN_SPECIFY,&reset_hd);		if (reset)			goto repeat;	} else		hd_request();}/* * 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. */static 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){	struct request *req = CURRENT;	if (req != NULL) {		struct hd_i_struct *disk = req->rq_disk->private_data;		if (++req->errors >= MAX_ERRORS || (hd_error & BBD_ERR)) {			end_request(req, 0);			disk->special_op = disk->recalibrate = 1;		} else if (req->errors % RESET_FREQ == 0)			reset = 1;		else if ((hd_error & TRK0_ERR) || req->errors % RECAL_FREQ == 0)			disk->special_op = disk->recalibrate = 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色哟哟在线观看一区二区三区| 日韩精品亚洲一区二区三区免费| 高清不卡在线观看| 26uuu精品一区二区| 国产精品一卡二卡| 国产精品美女www爽爽爽| 不卡一区二区在线| 亚洲精品一卡二卡| 欧美精品自拍偷拍| 国内久久婷婷综合| 1区2区3区精品视频| 色欧美片视频在线观看在线视频| 亚洲综合一区二区精品导航| 欧美日韩亚洲国产综合| 久久国产精品72免费观看| 久久久久久免费| 色综合色狠狠综合色| 亚洲高清免费观看| 久久品道一品道久久精品| 97精品久久久久中文字幕 | 在线观看日韩电影| 亚洲丰满少妇videoshd| 精品国产一区二区精华| 成年人国产精品| 一区二区三区日本| 久久亚洲精精品中文字幕早川悠里| 成人黄色av网站在线| 亚洲福中文字幕伊人影院| 欧美v日韩v国产v| 91丝袜高跟美女视频| 日韩av一区二| 亚洲视频香蕉人妖| 精品久久久久久最新网址| 色婷婷久久久久swag精品| 久久精品久久99精品久久| 亚洲美女少妇撒尿| 26uuu亚洲| 欧美日韩另类一区| 成人av影视在线观看| 国产成人在线影院| 婷婷开心激情综合| 国产精品卡一卡二| 欧美成人三级在线| 欧美在线视频日韩| 成人免费三级在线| 男女男精品视频网| 亚洲国产综合91精品麻豆| 国产精品色在线| 日韩一区二区三| 欧美性猛交xxxx黑人交| 成人激情图片网| 精品一区二区三区的国产在线播放 | www.欧美色图| 久久黄色级2电影| 亚洲成人免费看| 亚洲黄色录像片| 国产精品久久久久久户外露出| 日韩精品中文字幕一区| 欧美日韩一区 二区 三区 久久精品| 不卡电影免费在线播放一区| 国产综合久久久久影院| 免费人成精品欧美精品| 天天av天天翘天天综合网| 亚洲黄色免费电影| 亚洲精品亚洲人成人网| 亚洲三级电影全部在线观看高清| 国产亚洲欧美在线| 精品1区2区在线观看| 精品国产凹凸成av人网站| 欧美一区二区播放| 日韩欧美国产综合一区 | 午夜电影网亚洲视频| 亚洲精品五月天| 中文字幕日本不卡| 中文字幕一区二区三区色视频| 欧美国产视频在线| 欧美激情综合五月色丁香小说| 26uuu久久综合| wwww国产精品欧美| 亚洲精品一线二线三线| 精品美女一区二区| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 亚洲高清免费视频| 午夜电影网一区| 欧美aaa在线| 精品一区二区在线播放| 国产一区二区三区观看| 日韩高清一区二区| 亚洲va韩国va欧美va精品| 亚洲h动漫在线| 亚洲成人av电影| 日本中文字幕一区二区有限公司| 首页国产欧美日韩丝袜| 久久精品国产亚洲aⅴ| 国产在线一区二区综合免费视频| 精品一区二区精品| 成人国产精品免费观看| 色又黄又爽网站www久久| 欧美日韩午夜在线| 日韩一区二区视频| 欧美激情资源网| 夜夜嗨av一区二区三区| 免费精品视频在线| 国产成人av电影在线播放| 一本到不卡免费一区二区| 欧美久久久一区| 久久这里只有精品首页| 日韩毛片精品高清免费| 日韩精品乱码免费| 国产91在线看| 欧美日韩国产bt| 久久毛片高清国产| 亚洲一区二区三区四区五区中文| 日韩黄色片在线观看| 国产99久久久久久免费看农村| 在线观看一区二区视频| 26uuu国产电影一区二区| 亚洲视频中文字幕| 久久国产精品一区二区| 91免费小视频| 精品美女被调教视频大全网站| 亚洲男人的天堂在线观看| 美国三级日本三级久久99| 成人视屏免费看| 日韩一区二区免费视频| 国产精品国产三级国产普通话三级 | 亚洲妇女屁股眼交7| 国产成人在线免费| 欧美丰满高潮xxxx喷水动漫| 日本欧美在线看| 99久久久无码国产精品| 日韩视频免费观看高清完整版在线观看| 国产日韩欧美一区二区三区乱码 | 亚洲女人****多毛耸耸8| 美女一区二区三区在线观看| 99久久精品国产一区二区三区| 欧美成人精品1314www| 亚洲最大色网站| 成人午夜激情视频| 精品国产三级a在线观看| 亚洲bt欧美bt精品| 色综合激情五月| 中文天堂在线一区| 国产精品中文有码| 日韩女优视频免费观看| 午夜精品久久久久久| 色8久久人人97超碰香蕉987| 中文欧美字幕免费| 激情久久五月天| 欧美成人性福生活免费看| 天堂在线亚洲视频| 欧美三级中文字幕| 亚洲最快最全在线视频| 91一区在线观看| 国产精品久久久久婷婷二区次| 国产乱码字幕精品高清av | 日韩精品国产欧美| 欧美日韩精品电影| 亚洲一区二区三区四区在线观看 | 国产高清不卡二三区| 91精品国产一区二区人妖| 无吗不卡中文字幕| 欧美日韩不卡一区| 午夜精品国产更新| 在线不卡一区二区| 免费精品视频最新在线| 日韩免费在线观看| 麻豆91在线看| 2022国产精品视频| 国产精品一区在线观看乱码| 亚洲精品一区二区三区香蕉| 久久精品72免费观看| 精品黑人一区二区三区久久| 狠狠狠色丁香婷婷综合激情| 精品sm捆绑视频| 国产麻豆欧美日韩一区| 中文字幕av一区 二区| 91日韩精品一区| 一区二区三区产品免费精品久久75| 色女孩综合影院| 亚洲成在人线在线播放| 国产精品激情偷乱一区二区∴| 91原创在线视频| 亚洲成人免费观看| 日韩欧美一区中文| 国产一区不卡视频| 中文字幕欧美激情| 色又黄又爽网站www久久| 五月综合激情婷婷六月色窝| 欧美电影免费观看高清完整版在| 国内精品伊人久久久久av影院| 久久五月婷婷丁香社区| www.色精品| 午夜久久电影网| 精品电影一区二区| 成人性生交大合| 亚洲电影在线免费观看| 精品奇米国产一区二区三区| 成人免费视频国产在线观看| 亚洲一区二区五区|