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

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

?? diskonchip.c

?? 嵌入式試驗箱S3C2410的bootloader源代碼
?? 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一区二区三区免费野_久草精品视频
欧美一区二区在线视频| 99精品久久久久久| 亚洲电影一区二区三区| 1000精品久久久久久久久| 国产午夜精品一区二区三区四区| 91精品国产综合久久久久久久久久| 欧美性生交片4| 在线观看av一区| 欧美日韩色一区| 欧美日韩美少妇| 日韩三级高清在线| 久久精品无码一区二区三区| 国产农村妇女精品| 最新久久zyz资源站| 亚洲一级不卡视频| 日本女优在线视频一区二区| 日产欧产美韩系列久久99| 另类调教123区 | 久久精品一区四区| 国产欧美一区视频| 亚洲视频免费在线观看| 亚洲一区欧美一区| 老司机午夜精品99久久| 成人夜色视频网站在线观看| 91久久精品网| 精品人在线二区三区| 国产欧美日韩三级| 亚洲成av人片在线观看无码| 免费观看一级特黄欧美大片| 国产精品77777| 经典三级在线一区| 色婷婷激情一区二区三区| 日韩一区二区三区在线| 亚洲国产精品t66y| 日韩国产欧美三级| 不卡的av中国片| 91精品国产综合久久精品| 中文字幕第一区二区| 亚洲成a人在线观看| 成人在线视频一区| 日韩欧美另类在线| 一区二区在线观看av| 国产在线精品国自产拍免费| 色欧美片视频在线观看 | 精品日韩在线观看| 亚洲专区一二三| 日本色综合中文字幕| 99久久久国产精品| 欧美精品一区二区三区久久久| 亚洲激情图片一区| 国产成人福利片| 日韩欧美一区二区在线视频| 亚洲精品日日夜夜| 国产69精品久久777的优势| 欧美一区二区三区在线看| 亚洲欧美影音先锋| 国产成人无遮挡在线视频| 在线综合亚洲欧美在线视频| 亚洲码国产岛国毛片在线| 国产999精品久久久久久绿帽| 这里只有精品电影| 亚洲电影一区二区| 色哟哟亚洲精品| 亚洲欧洲一区二区三区| 激情偷乱视频一区二区三区| 欧美精品第1页| 亚洲午夜电影在线观看| 91久久精品网| 一区二区三区不卡在线观看| a美女胸又www黄视频久久| 国产亚洲欧美激情| 国产高清亚洲一区| 久久久精品蜜桃| 国产剧情av麻豆香蕉精品| 精品福利在线导航| 久久超碰97人人做人人爱| 欧美成人官网二区| 久久成人综合网| 久久综合国产精品| 国产精品亚洲成人| 中文字幕国产一区二区| 国产成人鲁色资源国产91色综 | 欧美视频完全免费看| 曰韩精品一区二区| 欧美日韩日日夜夜| 天天色 色综合| 欧美一级片免费看| 国产精品自拍一区| 国产欧美综合在线| 一本色道久久综合亚洲精品按摩| 亚洲日本在线a| 欧美性受xxxx| 蜜桃视频第一区免费观看| 日韩精品一区二区三区视频| 国产精品一级黄| 最新久久zyz资源站| 欧美日韩亚州综合| 麻豆免费精品视频| 国产精品久久久久久久岛一牛影视 | 日韩一区有码在线| 欧美视频一区二区三区| 久热成人在线视频| 中文字幕av不卡| 欧美日韩亚州综合| 国产精品一二三四五| 亚洲精品中文在线观看| 91精品国产综合久久香蕉的特点| 国产一区二区在线影院| 亚洲视频在线一区| 欧美一区二区三区成人| 国产不卡视频在线播放| 亚洲小少妇裸体bbw| 久久久久国产精品麻豆| 欧洲国产伦久久久久久久| 另类的小说在线视频另类成人小视频在线 | www..com久久爱| 奇米888四色在线精品| 国产精品久久久久久久午夜片| 欧美日韩国产天堂| 成人免费av在线| 秋霞成人午夜伦在线观看| 中文字幕视频一区| 日韩视频免费观看高清完整版 | 亚洲综合视频在线观看| 久久亚洲精精品中文字幕早川悠里| 91玉足脚交白嫩脚丫在线播放| 亚洲成人综合视频| 亚洲人123区| 国产香蕉久久精品综合网| 欧美一区在线视频| 91行情网站电视在线观看高清版| 韩国一区二区视频| 日韩国产欧美三级| 亚洲午夜精品在线| 亚洲精品菠萝久久久久久久| 国产午夜精品久久| 日韩精品影音先锋| 欧美老女人第四色| 欧美最猛黑人xxxxx猛交| 成人免费视频caoporn| 国内久久婷婷综合| 蜜臀av性久久久久蜜臀aⅴ四虎 | 另类人妖一区二区av| 亚洲18女电影在线观看| 一区二区三区四区高清精品免费观看 | 麻豆极品一区二区三区| 午夜av电影一区| 亚洲成人精品一区| 亚洲精品成a人| 夜夜嗨av一区二区三区网页| 国产精品国产三级国产三级人妇| 国产亚洲1区2区3区| 久久久国产综合精品女国产盗摄| 538prom精品视频线放| 欧美精品电影在线播放| 91精品蜜臀在线一区尤物| 欧美喷水一区二区| 欧美另类久久久品| 欧美精品在线一区二区三区| 欧美日本一区二区在线观看| 欧美丝袜丝nylons| 欧美伦理电影网| 日韩精品专区在线| 国产视频911| 国产精品久久久久久亚洲伦| 亚洲桃色在线一区| 亚洲无线码一区二区三区| 亚洲va国产天堂va久久en| 视频一区欧美日韩| 麻豆国产精品一区二区三区| 韩国三级在线一区| 99免费精品视频| 欧美在线免费观看视频| 3d成人动漫网站| 久久久久久亚洲综合| 国产精品视频yy9299一区| 亚洲女人****多毛耸耸8| 亚洲国产精品久久人人爱| 青青国产91久久久久久| 国产91丝袜在线18| 色悠悠久久综合| 日韩视频在线你懂得| 国产精品萝li| 日韩黄色免费网站| 国产九色sp调教91| 色视频一区二区| 亚洲精品在线免费播放| 亚洲欧美日韩国产综合在线| 日本aⅴ免费视频一区二区三区| 韩国精品一区二区| 91久久精品午夜一区二区| 精品久久久久久亚洲综合网| **性色生活片久久毛片| 青青草伊人久久| 91在线无精精品入口| 精品国产一区久久| 一区二区三区中文字幕精品精品| 黄色精品一二区| 欧美喷潮久久久xxxxx| 国产精品久久久久毛片软件|