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

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

?? diskonchip.c

?? U-boot源碼 ARM7啟動代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* * drivers/mtd/nand/diskonchip.c * * (C) 2003 Red Hat, Inc. * (C) 2004 Dan Brown <dan_brown@ieee.org> * (C) 2004 Kalev Lember <kalev@smartlink.ee> * * Author: David Woodhouse <dwmw2@infradead.org> * Additional Diskonchip 2000 and Millennium support by Dan Brown <dan_brown@ieee.org> * Diskonchip Millennium Plus support by Kalev Lember <kalev@smartlink.ee> * * Error correction code lifted from the old docecc code * Author: Fabrice Bellard (fabrice.bellard@netgem.com) * Copyright (C) 2000 Netgem S.A. * converted to the generic Reed-Solomon library by Thomas Gleixner <tglx@linutronix.de> * * Interface to generic NAND code for M-Systems DiskOnChip devices * * $Id: diskonchip.c,v 1.45 2005/01/05 18:05:14 dwmw2 Exp $ */#include <common.h>#if !defined(CFG_NAND_LEGACY)#include <linux/kernel.h>#include <linux/init.h>#include <linux/sched.h>#include <linux/delay.h>#include <linux/rslib.h>#include <linux/moduleparam.h>#include <asm/io.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/doc2000.h>#include <linux/mtd/compatmac.h>#include <linux/mtd/partitions.h>#include <linux/mtd/inftl.h>/* Where to look for the devices? */#ifndef CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS#define CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS 0#endifstatic unsigned long __initdata doc_locations[] = {#if defined (__alpha__) || defined(__i386__) || defined(__x86_64__)#ifdef CONFIG_MTD_DISKONCHIP_PROBE_HIGH	0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000,	0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000,	0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000,	0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000,	0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000,#else /*  CONFIG_MTD_DOCPROBE_HIGH */	0xc8000, 0xca000, 0xcc000, 0xce000,	0xd0000, 0xd2000, 0xd4000, 0xd6000,	0xd8000, 0xda000, 0xdc000, 0xde000,	0xe0000, 0xe2000, 0xe4000, 0xe6000,	0xe8000, 0xea000, 0xec000, 0xee000,#endif /*  CONFIG_MTD_DOCPROBE_HIGH */#elif defined(__PPC__)	0xe4000000,#elif defined(CONFIG_MOMENCO_OCELOT)	0x2f000000,	0xff000000,#elif defined(CONFIG_MOMENCO_OCELOT_G) || defined (CONFIG_MOMENCO_OCELOT_C)	0xff000000,##else#warning Unknown architecture for DiskOnChip. No default probe locations defined#endif	0xffffffff };static struct mtd_info *doclist = NULL;struct doc_priv {	void __iomem *virtadr;	unsigned long physadr;	u_char ChipID;	u_char CDSNControl;	int chips_per_floor; /* The number of chips detected on each floor */	int curfloor;	int curchip;	int mh0_page;	int mh1_page;	struct mtd_info *nextdoc;};/* Max number of eraseblocks to scan (from start of device) for the (I)NFTL   MediaHeader.  The spec says to just keep going, I think, but that's just   silly. */#define MAX_MEDIAHEADER_SCAN 8/* This is the syndrome computed by the HW ecc generator upon reading an empty   page, one with all 0xff for data and stored ecc code. */static u_char empty_read_syndrome[6] = { 0x26, 0xff, 0x6d, 0x47, 0x73, 0x7a };/* This is the ecc value computed by the HW ecc generator upon writing an empty   page, one with all 0xff for data. */static u_char empty_write_ecc[6] = { 0x4b, 0x00, 0xe2, 0x0e, 0x93, 0xf7 };#define INFTL_BBT_RESERVED_BLOCKS 4#define DoC_is_MillenniumPlus(doc) ((doc)->ChipID == DOC_ChipID_DocMilPlus16 || (doc)->ChipID == DOC_ChipID_DocMilPlus32)#define DoC_is_Millennium(doc) ((doc)->ChipID == DOC_ChipID_DocMil)#define DoC_is_2000(doc) ((doc)->ChipID == DOC_ChipID_Doc2k)static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd);static void doc200x_select_chip(struct mtd_info *mtd, int chip);static int debug=0;module_param(debug, int, 0);static int try_dword=1;module_param(try_dword, int, 0);static int no_ecc_failures=0;module_param(no_ecc_failures, int, 0);#ifdef CONFIG_MTD_PARTITIONSstatic int no_autopart=0;module_param(no_autopart, int, 0);#endif#ifdef MTD_NAND_DISKONCHIP_BBTWRITEstatic int inftl_bbt_write=1;#elsestatic int inftl_bbt_write=0;#endifmodule_param(inftl_bbt_write, int, 0);static unsigned long doc_config_location = CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS;module_param(doc_config_location, ulong, 0);MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe for DiskOnChip");/* Sector size for HW ECC */#define SECTOR_SIZE 512/* The sector bytes are packed into NB_DATA 10 bit words */#define NB_DATA (((SECTOR_SIZE + 1) * 8 + 6) / 10)/* Number of roots */#define NROOTS 4/* First consective root */#define FCR 510/* Number of symbols */#define NN 1023/* the Reed Solomon control structure */static struct rs_control *rs_decoder;/* * The HW decoder in the DoC ASIC's provides us a error syndrome, * which we must convert to a standard syndrom usable by the generic * Reed-Solomon library code. * * Fabrice Bellard figured this out in the old docecc code. I added * some comments, improved a minor bit and converted it to make use * of the generic Reed-Solomon libary. tglx */static int doc_ecc_decode (struct rs_control *rs, uint8_t *data, uint8_t *ecc){	int i, j, nerr, errpos[8];	uint8_t parity;	uint16_t ds[4], s[5], tmp, errval[8], syn[4];	/* Convert the ecc bytes into words */	ds[0] = ((ecc[4] & 0xff) >> 0) | ((ecc[5] & 0x03) << 8);	ds[1] = ((ecc[5] & 0xfc) >> 2) | ((ecc[2] & 0x0f) << 6);	ds[2] = ((ecc[2] & 0xf0) >> 4) | ((ecc[3] & 0x3f) << 4);	ds[3] = ((ecc[3] & 0xc0) >> 6) | ((ecc[0] & 0xff) << 2);	parity = ecc[1];	/* Initialize the syndrom buffer */	for (i = 0; i < NROOTS; i++)		s[i] = ds[0];	/*	 *  Evaluate	 *  s[i] = ds[3]x^3 + ds[2]x^2 + ds[1]x^1 + ds[0]	 *  where x = alpha^(FCR + i)	 */	for(j = 1; j < NROOTS; j++) {		if(ds[j] == 0)			continue;		tmp = rs->index_of[ds[j]];		for(i = 0; i < NROOTS; i++)			s[i] ^= rs->alpha_to[rs_modnn(rs, tmp + (FCR + i) * j)];	}	/* Calc s[i] = s[i] / alpha^(v + i) */	for (i = 0; i < NROOTS; i++) {		if (syn[i]) 			syn[i] = rs_modnn(rs, rs->index_of[s[i]] + (NN - FCR - i));	}	/* Call the decoder library */	nerr = decode_rs16(rs, NULL, NULL, 1019, syn, 0, errpos, 0, errval);	/* Incorrectable errors ? */	if (nerr < 0)		return nerr;	/*	 * Correct the errors. The bitpositions are a bit of magic,	 * but they are given by the design of the de/encoder circuit	 * in the DoC ASIC's.	 */	for(i = 0;i < nerr; i++) {		int index, bitpos, pos = 1015 - errpos[i];		uint8_t val;		if (pos >= NB_DATA && pos < 1019)			continue;		if (pos < NB_DATA) {			/* extract bit position (MSB first) */			pos = 10 * (NB_DATA - 1 - pos) - 6;			/* now correct the following 10 bits. At most two bytes			   can be modified since pos is even */			index = (pos >> 3) ^ 1;			bitpos = pos & 7;			if ((index >= 0 && index < SECTOR_SIZE) ||			    index == (SECTOR_SIZE + 1)) {				val = (uint8_t) (errval[i] >> (2 + bitpos));				parity ^= val;				if (index < SECTOR_SIZE)					data[index] ^= val;			}			index = ((pos >> 3) + 1) ^ 1;			bitpos = (bitpos + 10) & 7;			if (bitpos == 0)				bitpos = 8;			if ((index >= 0 && index < SECTOR_SIZE) ||			    index == (SECTOR_SIZE + 1)) {				val = (uint8_t)(errval[i] << (8 - bitpos));				parity ^= val;				if (index < SECTOR_SIZE)					data[index] ^= val;			}		}	}	/* If the parity is wrong, no rescue possible */	return parity ? -1 : nerr;}static void DoC_Delay(struct doc_priv *doc, unsigned short cycles){	volatile char dummy;	int i;	for (i = 0; i < cycles; i++) {		if (DoC_is_Millennium(doc))			dummy = ReadDOC(doc->virtadr, NOP);		else if (DoC_is_MillenniumPlus(doc))			dummy = ReadDOC(doc->virtadr, Mplus_NOP);		else			dummy = ReadDOC(doc->virtadr, DOCStatus);	}}#define CDSN_CTRL_FR_B_MASK	(CDSN_CTRL_FR_B0 | CDSN_CTRL_FR_B1)/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */static int _DoC_WaitReady(struct doc_priv *doc){	void __iomem *docptr = doc->virtadr;	unsigned long timeo = jiffies + (HZ * 10);	if(debug) printk("_DoC_WaitReady...\n");	/* Out-of-line routine to wait for chip response */	if (DoC_is_MillenniumPlus(doc)) {		while ((ReadDOC(docptr, Mplus_FlashControl) & CDSN_CTRL_FR_B_MASK) != CDSN_CTRL_FR_B_MASK) {			if (time_after(jiffies, timeo)) {				printk("_DoC_WaitReady timed out.\n");				return -EIO;			}			udelay(1);			cond_resched();		}	} else {		while (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B)) {			if (time_after(jiffies, timeo)) {				printk("_DoC_WaitReady timed out.\n");				return -EIO;			}			udelay(1);			cond_resched();		}	}	return 0;}static inline int DoC_WaitReady(struct doc_priv *doc){	void __iomem *docptr = doc->virtadr;	int ret = 0;	if (DoC_is_MillenniumPlus(doc)) {		DoC_Delay(doc, 4);		if ((ReadDOC(docptr, Mplus_FlashControl) & CDSN_CTRL_FR_B_MASK) != CDSN_CTRL_FR_B_MASK)			/* Call the out-of-line routine to wait */			ret = _DoC_WaitReady(doc);	} else {		DoC_Delay(doc, 4);		if (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B))			/* Call the out-of-line routine to wait */			ret = _DoC_WaitReady(doc);		DoC_Delay(doc, 2);	}	if(debug) printk("DoC_WaitReady OK\n");	return ret;}static void doc2000_write_byte(struct mtd_info *mtd, u_char datum){	struct nand_chip *this = mtd->priv;	struct doc_priv *doc = this->priv;	void __iomem *docptr = doc->virtadr;	if(debug)printk("write_byte %02x\n", datum);	WriteDOC(datum, docptr, CDSNSlowIO);	WriteDOC(datum, docptr, 2k_CDSN_IO);}static u_char doc2000_read_byte(struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	struct doc_priv *doc = this->priv;	void __iomem *docptr = doc->virtadr;	u_char ret;	ReadDOC(docptr, CDSNSlowIO);	DoC_Delay(doc, 2);	ret = ReadDOC(docptr, 2k_CDSN_IO);	if (debug) printk("read_byte returns %02x\n", ret);	return ret;}static void doc2000_writebuf(struct mtd_info *mtd,			     const u_char *buf, int len){	struct nand_chip *this = mtd->priv;	struct doc_priv *doc = this->priv;	void __iomem *docptr = doc->virtadr;	int i;	if (debug)printk("writebuf of %d bytes: ", len);	for (i=0; i < len; i++) {		WriteDOC_(buf[i], docptr, DoC_2k_CDSN_IO + i);		if (debug && i < 16)			printk("%02x ", buf[i]);	}	if (debug) printk("\n");}static void doc2000_readbuf(struct mtd_info *mtd,			    u_char *buf, int len){	struct nand_chip *this = mtd->priv;	struct doc_priv *doc = this->priv;	void __iomem *docptr = doc->virtadr; 	int i;	if (debug)printk("readbuf of %d bytes: ", len);	for (i=0; i < len; i++) {		buf[i] = ReadDOC(docptr, 2k_CDSN_IO + i);	}}static void doc2000_readbuf_dword(struct mtd_info *mtd,			    u_char *buf, int len){	struct nand_chip *this = mtd->priv;	struct doc_priv *doc = this->priv;	void __iomem *docptr = doc->virtadr; 	int i;	if (debug) printk("readbuf_dword of %d bytes: ", len);	if (unlikely((((unsigned long)buf)|len) & 3)) {		for (i=0; i < len; i++) {			*(uint8_t *)(&buf[i]) = ReadDOC(docptr, 2k_CDSN_IO + i);		}	} else {		for (i=0; i < len; i+=4) {			*(uint32_t*)(&buf[i]) = readl(docptr + DoC_2k_CDSN_IO + i);		}	}}static int doc2000_verifybuf(struct mtd_info *mtd,			      const u_char *buf, int len){	struct nand_chip *this = mtd->priv;	struct doc_priv *doc = this->priv;	void __iomem *docptr = doc->virtadr;	int i;	for (i=0; i < len; i++)		if (buf[i] != ReadDOC(docptr, 2k_CDSN_IO))			return -EFAULT;	return 0;}static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr){	struct nand_chip *this = mtd->priv;	struct doc_priv *doc = this->priv;	uint16_t ret;	doc200x_select_chip(mtd, nr);	doc200x_hwcontrol(mtd, NAND_CTL_SETCLE);	this->write_byte(mtd, NAND_CMD_READID);	doc200x_hwcontrol(mtd, NAND_CTL_CLRCLE);	doc200x_hwcontrol(mtd, NAND_CTL_SETALE);	this->write_byte(mtd, 0);	doc200x_hwcontrol(mtd, NAND_CTL_CLRALE);	ret = this->read_byte(mtd) << 8;	ret |= this->read_byte(mtd);	if (doc->ChipID == DOC_ChipID_Doc2k && try_dword && !nr) {		/* First chip probe. See if we get same results by 32-bit access */		union {			uint32_t dword;			uint8_t byte[4];		} ident;		void __iomem *docptr = doc->virtadr;		doc200x_hwcontrol(mtd, NAND_CTL_SETCLE);		doc2000_write_byte(mtd, NAND_CMD_READID);		doc200x_hwcontrol(mtd, NAND_CTL_CLRCLE);		doc200x_hwcontrol(mtd, NAND_CTL_SETALE);		doc2000_write_byte(mtd, 0);		doc200x_hwcontrol(mtd, NAND_CTL_CLRALE);		ident.dword = readl(docptr + DoC_2k_CDSN_IO);		if (((ident.byte[0] << 8) | ident.byte[1]) == ret) {			printk(KERN_INFO "DiskOnChip 2000 responds to DWORD access\n");			this->read_buf = &doc2000_readbuf_dword;		}	}	return ret;}static void __init doc2000_count_chips(struct mtd_info *mtd){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91福利精品视频| 一区二区三区鲁丝不卡| 国产精品久久777777| 日韩国产在线一| 99热这里都是精品| 日韩精品中午字幕| 一区二区国产盗摄色噜噜| 国产毛片一区二区| 欧美二区三区的天堂| 亚洲色图一区二区| 成人免费视频一区| 久久久久久影视| 麻豆国产91在线播放| 欧美精品aⅴ在线视频| 亚洲精品日日夜夜| av中文字幕不卡| 国产日韩欧美制服另类| 精东粉嫩av免费一区二区三区| 欧美视频一区在线| 亚洲欧美国产三级| 91在线高清观看| 欧美国产97人人爽人人喊| 国模套图日韩精品一区二区| 欧美日韩大陆在线| 一区二区激情小说| 色视频欧美一区二区三区| 中文字幕在线视频一区| 成人综合激情网| 国产欧美一区二区精品久导航| 精品一区二区三区免费播放| 欧美mv日韩mv国产网站| 狠狠色综合播放一区二区| 日韩欧美黄色影院| 精久久久久久久久久久| 久久蜜桃av一区二区天堂 | 国产欧美日韩久久| 国产裸体歌舞团一区二区| 亚洲精品在线观| 风间由美性色一区二区三区| 国产精品久久福利| 99在线精品视频| 一区二区三区在线观看动漫| 在线观看一区二区视频| 午夜精品在线视频一区| 欧美一区二区三区四区视频| 久久精品国产精品亚洲精品| www欧美成人18+| 波多野结衣一区二区三区 | 亚洲精品一区二区精华| 国产乱子伦视频一区二区三区| 久久伊人蜜桃av一区二区| 成人亚洲一区二区一| 综合久久久久久久| 欧美日韩免费不卡视频一区二区三区| 午夜精品123| 26uuu色噜噜精品一区| 成人久久视频在线观看| 亚洲免费在线观看| 欧美一二三区在线观看| 高清国产一区二区三区| 亚洲一区二区三区四区在线| 欧美一卡二卡在线| 成人精品高清在线| 亚洲国产精品精华液网站| 日韩免费看网站| 99综合影院在线| 日本欧美一区二区在线观看| 国产欧美视频一区二区三区| 欧洲人成人精品| 狠狠色狠狠色综合日日91app| 中文字幕永久在线不卡| 在线不卡中文字幕播放| 成人午夜视频福利| 天堂蜜桃91精品| 中文字幕日韩一区二区| 日韩一区二区三区四区五区六区| 国产99久久久久久免费看农村| 一级中文字幕一区二区| 久久久久久久久99精品| 欧美日韩视频在线一区二区| 国产丶欧美丶日本不卡视频| 亚洲国产va精品久久久不卡综合| 精品久久一二三区| 欧美视频三区在线播放| 成人激情免费网站| 老司机免费视频一区二区三区| 亚洲四区在线观看| 日本一区二区视频在线| 日韩精品最新网址| 欧美羞羞免费网站| 成人91在线观看| 国产一区二区在线看| 午夜成人免费电影| 亚洲男人的天堂在线aⅴ视频| 精品国产一二三区| 56国语精品自产拍在线观看| 色综合天天综合网天天狠天天 | 丝袜国产日韩另类美女| 日韩久久一区二区| 日本一区二区三区电影| 精品国产一区二区三区av性色| 欧美日韩一卡二卡| 91搞黄在线观看| 在线影院国内精品| 99国产精品久久| 成人av电影免费在线播放| 国产精品69久久久久水密桃| 麻豆精品精品国产自在97香蕉| 亚洲国产cao| 亚洲福利国产精品| 亚洲国产精品久久人人爱蜜臀| 国产精品美女久久久久aⅴ国产馆| 久久婷婷色综合| 精品1区2区在线观看| 精品国产一区二区三区久久久蜜月 | 欧美日韩国产美女| 欧美三级中文字幕在线观看| 在线精品视频一区二区| 欧美亚洲国产一区二区三区va| 93久久精品日日躁夜夜躁欧美| 9i在线看片成人免费| av在线不卡免费看| 一本色道久久加勒比精品 | 成人av小说网| 91女人视频在线观看| av一二三不卡影片| 91视频91自| 在线视频你懂得一区| 欧美日韩国产美女| 日韩欧美一区中文| 久久久久久日产精品| 欧美国产禁国产网站cc| 亚洲精品午夜久久久| 午夜伦理一区二区| 激情小说亚洲一区| 成人免费黄色在线| 欧美中文一区二区三区| 欧美高清视频一二三区| 欧美精品一区视频| 17c精品麻豆一区二区免费| 亚洲一卡二卡三卡四卡五卡| 蜜桃传媒麻豆第一区在线观看| 国产精品综合在线视频| 一本大道久久a久久综合| 欧美人妇做爰xxxⅹ性高电影| 欧美成人一区二区| 最新日韩av在线| 首页国产欧美久久| 国产精品66部| 欧美日本一区二区三区四区| 久久一区二区视频| 亚洲永久精品大片| 黑人巨大精品欧美一区| 色婷婷精品大在线视频| 日韩视频免费观看高清完整版| 国产精品人妖ts系列视频| 亚洲小说欧美激情另类| 国产精品自拍三区| 欧美色中文字幕| 欧美国产精品中文字幕| 日韩精品国产欧美| 成人久久久精品乱码一区二区三区| 欧美日韩国产中文| 中文字幕在线观看一区| 久久国产免费看| 在线精品视频免费播放| 国产日韩在线不卡| 久久精品国产77777蜜臀| 色综合久久综合网97色综合| 中文字幕视频一区二区三区久| 欧美a一区二区| 在线观看成人小视频| 国产欧美一区二区精品性色| 久久精品国产第一区二区三区| 在线精品视频小说1| 亚洲欧洲精品一区二区三区不卡| 精品一区二区三区久久| 3d动漫精品啪啪一区二区竹菊| 亚洲欧洲一区二区三区| 国产成人在线观看| 精品久久免费看| 日韩成人av影视| 在线观看亚洲a| 亚洲欧美综合在线精品| 国产成a人亚洲精品| 精品日韩一区二区三区免费视频| 亚洲国产成人精品视频| 欧美在线制服丝袜| 亚洲四区在线观看| 成人av免费观看| 国产精品素人视频| 国产精品原创巨作av| 久久综合五月天婷婷伊人| 日本午夜精品视频在线观看| 欧美日韩国产一区| 午夜欧美一区二区三区在线播放 | 国产一本一道久久香蕉| 欧美r级电影在线观看| 国产呦萝稀缺另类资源| 亚洲精品在线免费观看视频|