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

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

?? programming.c

?? BIOS Open Platform!
?? C
字號:
/* *                     OpenBIOS - free your system!  *              ( firmware/flash device driver for Linux ) *                           *  programming.c - flash device programming and probing algorithms.   *   *  This program is part of a free implementation of the IEEE 1275-1994  *  Standard for Boot (Initialization Configuration) Firmware. * *  Copyright (C) 1998-2004  Stefan Reinauer, <stepan@openbios.org> * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; version 2 of the License. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA * */// <-- C++ style comments are for experimental comments only.// They will disappear as soon as I fixed all the stuff./* #define DEBUG_PROBING */#include <linux/config.h>#include <linux/version.h>#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && defined(MODVERSIONS)#include <linux/modversions.h>#endif#include <linux/pci.h>#include <linux/errno.h>#include <linux/types.h>#include <linux/vmalloc.h>#include <linux/delay.h>#include <linux/spinlock.h>#include <asm/io.h>#include <asm/delay.h>#include <asm/uaccess.h>#include "bios.h"#include "pcisets.h"#include "flashchips.h"#include "programming.h"struct flashdevice flashdevices[BIOS_MAXDEV];int flashcount;/* * ****************************************** * *	flashchip handling * * ******************************************  */void flash_command (unsigned char *addr, unsigned char command)#if 1{	flash_writeb(addr, 0x5555, 0xaa);	flash_writeb(addr, 0x2AAA, 0x55);	flash_writeb(addr, 0x5555, command);}void fwh_flash_command(unsigned char *addr, unsigned char command)#endif{	flash_writeb(addr, 0x75555, 0xaa);	flash_writeb(addr, 0x72aaa, 0x55);	flash_writeb(addr, 0x75555, command);}#define CFLASH flashdevices[flashcount]int flash_probe_address(void *address){	int flashnum=0, manufnum=0, sectors=0;	unsigned short flash_id, testflash;	unsigned long flags;#ifdef DEBUG_PROBING	printk( KERN_DEBUG "BIOS: Probing for flash chip @0x%08lx\n", (unsigned long) address);#endif#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)	save_flags(flags);#endif	spin_lock_irqsave(&bios_lock, flags);	testflash= (flash_readb(address, 0))+(flash_readb(address, 1)<<8);	/* 1st method: Intel, Atmel listen to this.. */	flash_command(address, 0x90);	udelay(20);	flash_id = (flash_readb(address, 0))+(flash_readb(address, 1)<<8);#ifdef DEBUG_PROBING	printk (KERN_DEBUG "BIOS: testflash[%04x] flash_id[%04x]\n",		testflash, flash_id); #endif		/* 2nd method: Winbond (I think this is Jedec standard) */	if (flash_id==testflash) {#ifdef DEBUG_PROBING		printk (KERN_DEBUG "BIOS: Trying 2nd ID method.\n"); #endif		flash_command(address, 0xf0); /* Reset */		udelay(20);		flash_command(address, 0x80);		flash_command(address, 0x60);		udelay(20);		flash_id = (flash_readb(address, 0))+(flash_readb(address, 1)<<8);#ifdef DEBUG_PROBING	printk (KERN_DEBUG "BIOS: testflash[%04x] flash_id[%04x]\n",		testflash, flash_id); #endif	}	/* 3rd Method: Some Winbonds seem to want this */	if (flash_id==testflash) {#ifdef DEBUG_PROBING		printk (KERN_DEBUG "BIOS: Trying 3rd ID method.\n"); #endif		flash_command(address, 0xf0); /* Reset again */		udelay(20);		flash_command(address, 0x80);		flash_command(address, 0x20);		udelay(20);		flash_id = (flash_readb(address, 0))+(flash_readb(address, 1)<<8);#ifdef DEBUG_PROBING	printk (KERN_DEBUG "BIOS: testflash[%04x] flash_id[%04x]\n",		testflash, flash_id); #endif	}	if (flash_id==0x7f7f && flash_readb(address, 0x100)==0x1c) {		/* We have an Eon flashchip. They keep their		 * device id at 0x101 instead of 0x1		 */		printk(KERN_INFO "BIOS: Eon flash device detected\n");		flash_id=(flash_readb(address, 0x1))+(flash_readb(address, 0x101)<<8);	}	flash_command(address, 0xf0);	udelay(20);	spin_unlock_irqrestore(&bios_lock, flags);	if (flash_id==testflash) return 0; /* Nothing found :-( */	while (flashchips[flashnum].id!=0) {		if (flash_id==flashchips[flashnum].id) 			break;		flashnum++;	}	while (manufacturers[manufnum].id!=0) {		if ((flash_id&0xff)==manufacturers[manufnum].id) 			break;		manufnum++;	}		if (flashchips[flashnum].id) {		while (flashchips[flashnum].sectors[sectors]<flashchips[flashnum].size)			sectors++;	}	if (flashcount >= BIOS_MAXDEV) {		printk(KERN_DEBUG "BIOS: Too many flash devices found.\n");		return -1;	}	CFLASH.flashnum	= flashnum;	CFLASH.manufnum	= manufnum;	CFLASH.id	= flash_id;	CFLASH.size	= (flashchips[flashnum].size<<10);	CFLASH.sectors	= sectors;	CFLASH.open_mode= 0;	CFLASH.open_cnt	= 0;	return 1;}void flash_probe_area(unsigned long romaddr, unsigned long romsize, 		int map_always){	unsigned long probeaddr;	unsigned char *mapped;	mapped=ioremap(romaddr, romsize);		devices[flashdevices[currflash].idx].activate();		probeaddr=(unsigned long)mapped;		while ( probeaddr < (unsigned long)mapped + romsize - 0x5555 ) {		if ( flash_probe_address ((void *)probeaddr) != 1) {			probeaddr += 4*1024;			continue;		}				CFLASH.offset	= probeaddr-(unsigned long)mapped;		CFLASH.mapped	= (unsigned long)mapped;		CFLASH.physical	= romaddr+CFLASH.offset;				printk( KERN_INFO "BIOS: flash device with size "				"%dk (ID 0x%04x) found.\n", 				CFLASH.size >> 10, CFLASH.id);				printk( KERN_INFO "BIOS:   physical address "				"0x%08lx (va=0x%08lx+0x%lx).\n",				CFLASH.physical, (unsigned long)CFLASH.mapped,				CFLASH.offset);		if (flashchips[CFLASH.flashnum].flags&f_fwh_compl) {			unsigned long t_lk;			unsigned int i=7;			printk(KERN_INFO "BIOS:   FWH compliant "							"chip detected.\n");			for (t_lk=0xffb80002; t_lk<=0xffbf0002; t_lk+=0x10000) 			{				printk(KERN_INFO "Lock register %d "						 "(0x%08lx): 0x%x\n",						i, t_lk, (unsigned int)						(readb(phys_to_virt(t_lk))));				i--;			}		}		flashcount++;		currflash++;#ifdef MULTIPLE_FLASH		probeaddr += flashdevices[flashcount-1].size;		flashdevices[flashcount].mapped=flashdevices[flashcount-1].mapped;		flashdevices[flashcount].data=flashdevices[flashcount-1].data;		continue;#else		break;#endif	}	/* We might want to always map the memory	 * region in certain cases	 */	if (map_always) {		CFLASH.flashnum = 0;		CFLASH.manufnum = 0;		CFLASH.id       = 0;		CFLASH.size     = romsize;		CFLASH.sectors  = 0;		CFLASH.open_mode= 0;		CFLASH.open_cnt = 0;		CFLASH.offset   = 0;		CFLASH.mapped   = (unsigned long)mapped;		CFLASH.physical = romaddr;		printk( KERN_INFO "BIOS: rom device with size "				"%dk registered.\n", CFLASH.size >> 10);		flashcount++; currflash++;		return;	}		/* We found nothing in this area, so let's unmap it again */		if (flashcount && flashdevices[flashcount-1].mapped != (unsigned long)mapped)		iounmap(mapped);	devices[flashdevices[currflash].idx].deactivate();}#undef CFLASHvoid flash_program (unsigned char *addr){	flash_command(addr, 0xa0);}void flash_program_atmel (unsigned char *addr){	flash_command(addr, 0x80);	flash_command(addr, 0x20);}int flash_erase (unsigned char *addr, unsigned int flashnum) {	flash_command(addr, 0x80);	flash_command(addr, 0x10);	udelay(80);	return flash_ready_toggle(addr, 0);}int flash_erase_sectors (unsigned char *addr, unsigned int flashnum, unsigned int startsec, unsigned int endsec) {	unsigned int sector;  	if (!(flashchips[flashnum].flags & f_slow_sector_erase)) {		flash_command(addr, 0x80);		if (flashchips[flashnum].flags&f_fwh_compl) {			flash_writeb(addr, 0x75555,0xaa);			flash_writeb(addr, 0x72aaa,0x55);		} else {			flash_writeb(addr, 0x5555,0xaa);			flash_writeb(addr, 0x2aaa,0x55);		}    		for (sector=startsec; sector <= endsec; sector++) {			flash_writeb (addr, flashchips[flashnum].sectors[sector]*1024, 0x30);		}    		udelay(150); // 80 max normally, wait 150usec to be sure#if 0  		if (flashchips[flashnum].flags&f_fwh_compl)#endif			return flash_ready_toggle(addr, flashchips[flashnum].sectors[sector-1]*1024);#if 0		else			return flash_ready_poll(addr, flashchips[flashnum].sectors[sector-1]*1024, 0xff);#endif	}  	/* sectors must be sent the sector erase command for every sector */	for (sector=startsec; sector <= endsec; sector++) {		flash_command(addr, 0x80);		if (flashchips[flashnum].flags&f_fwh_compl) {			flash_writeb(addr, 0x75555,0xaa);			flash_writeb(addr, 0x72aaa,0x55);		} else {			flash_writeb(addr, 0x5555,0xaa);			flash_writeb(addr, 0x2aaa,0x55);		}    		flash_writeb(addr, flashchips[flashnum].sectors[sector]*1024, 0x30);		udelay(150);#if 0		if (flashchips[flashnum].flags&f_fwh_compl)#endif			flash_ready_toggle(addr, flashchips[flashnum].sectors[sector] *1024);#if 0		else			flash_ready_poll(addr, flashchips[flashnum].sectors[sector]*1024, 0xff);#endif	}	return 0;}/* waiting for the end of programming/erasure by using the toggle method. * As long as there is a programming procedure going on, bit 6 of the last * written byte is toggling it's state with each consecutive read.  * The toggling stops as soon as the procedure is completed. * This function returns 0 if everything is ok, 1 if an error occured * while programming was in progress. */ int flash_ready_toggle (unsigned char *addr, unsigned int offset){	unsigned long int timeout=0;	unsigned char oldflag, flag;	int loop=1;	oldflag=flash_readb(addr, offset) & 0x40;	while (loop && (timeout<0x7fffffff)) {		flag=flash_readb(addr, offset) & 0x40;		if (flag == oldflag)			loop=0;				oldflag=flag;		timeout++;	}	if (loop) {		printk(KERN_DEBUG "BIOS: operation timed out (Toggle)\n");		return 1;	}		return 0;}/* This functions is similar to the above one. While a programming * procedure is going on, bit 7 of the last written data byte is * inverted. When the procedure is completed, bit 7 contains the * correct data value */int flash_ready_poll (unsigned char *addr, unsigned int offset, unsigned char data){	unsigned long int timeout=0;	unsigned char flag;	flag=flash_readb(addr, offset);	while ( ( flag & 0x80) != ( data & 0x80)) {		if ( ( flag & 0x80 ) == ( data & 0x80 ) ) {#ifdef DBGTIMEOUT			printk(KERN_DEBUG "BIOS: Timeout value (EOT Polling) %ld\n",timeout);#endif			return 0;		}					flag=flash_readb(addr, offset);		if (timeout++>12800) {	// 10 times more than usual.			printk(KERN_ERR "BIOS: EOT Polling timed out at 0x%08x."				" Try again or increase max. timeout.\n",offset);			return 1;		}		if ((flag & 0x80) == ( data & 0x80)) {		  flag=flash_readb(addr, offset);		}	}#ifdef DBGTIMEOUT	printk(KERN_DEBUG "BIOS: Timeout value (EOT Polling) %ld\n",timeout);#endif	flag=flash_readb(addr, offset);	if ( ( flag & 0x80 ) == ( data & 0x80 ) ) return 0; else return 1;}void iflash_program_byte (unsigned char *addr, unsigned int offset, unsigned char data){	unsigned long int timeout=0;	unsigned char flag;	flash_writeb (addr, offset, 0x40);	flash_writeb (addr, offset, data);	flash_writeb (addr, offset, 0x70);	/* Read Status */	do {		flag=flash_readb (addr, offset);		if (timeout++>100) { // usually 2 or 3 :-)			printk(KERN_ERR "BIOS: Intel programming timed out at"				"0x%08x. Try again or increase max. timeout.\n",offset);			return;		}	} while ((flag&0x80) != 0x80);#ifdef DBGTIMEOUT	printk (KERN_DEBUG"BIOS: Timeout value (Intel byte program) %ld\n",timeout);#endif	if (flag&0x18) {		flash_writeb (addr, offset, 0x50);	/* Reset Status Register */		printk (KERN_ERR "BIOS: Error occured, please repeat write operation. (intel)\n");	}	flash_writeb (addr, offset, 0xff);}int  iflash_erase_sectors (unsigned char *addr, unsigned int flashnum, unsigned int startsec, unsigned int endsec){	unsigned long int timeout;	unsigned int sector, offset=0;	unsigned char flag;	for (sector=startsec; sector<=endsec; sector++) {		offset=(flashchips[flashnum].sectors[sector]*1024);		flash_writeb (addr, offset, 0x20);		flash_writeb (addr, offset, 0xd0);		flash_writeb (addr, offset, 0x70);	/* Read Status */		timeout=0;		do {			flag=flash_readb (addr, offset);			if (timeout++>1440000) { // usually 144000				printk(KERN_ERR "BIOS: Intel sector erase timed out at 0x%08x. Try again or increase max. timeout.\n",offset);				return 1;			}		} while ((flag&0x80) != 0x80);#ifdef DBGTIMEOUT		printk (KERN_DEBUG "BIOS: Timeout value (Intel sector erase) %ld\n",timeout);#endif		if (flag&0x28) {			flash_writeb (addr, offset, 0x50);			flash_writeb (addr, offset, 0xff);			return 1; /* Error! */		}	}	flash_writeb (addr, offset, 0xff);	return 0;	}unsigned char flash_readb(unsigned char *addr, unsigned int offset){#if defined(__alpha__)	if (flashdevices[currflash].data==(void *)0xfff80000) {		if (offset<0x80000)			outb(0x00,0x800);		else {			outb(0x01, 0x800);			offset-=0x80000;		}	}#endif		return readb(addr+offset);}void flash_writeb(unsigned char *addr, unsigned int offset, unsigned char data) {#if defined(__alpha__)	if (flashdevices[currflash].data==(void *)0xfff80000) {		if (offset<0x80000)			outb(0x00,0x800);		else {			outb(0x01, 0x800);			offset-=0x80000;		}	}#endif	/* 	printk(KERN_DEBUG "BIOS: writing 0x%02x to 0x%lx+0x%x\n",							data,bios,offset); */	writeb(data,addr+offset);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区三区久久久久久久久不 | 97se狠狠狠综合亚洲狠狠| 日韩午夜精品电影| 久久国产精品免费| 亚洲精品在线电影| 国产成人超碰人人澡人人澡| 中文字幕欧美激情| 色综合天天综合狠狠| 亚洲宅男天堂在线观看无病毒| 在线免费亚洲电影| 丝袜亚洲另类欧美综合| 日韩精品一区二区三区在线播放| 久久疯狂做爰流白浆xx| 国产午夜精品久久| 日本伦理一区二区| 日韩中文字幕1| 久久久久久夜精品精品免费| 成人午夜激情片| 亚洲午夜国产一区99re久久| 欧美第一区第二区| 高清国产一区二区| 亚洲一区二区三区四区五区黄| 欧美一区二区网站| 国产盗摄一区二区| 亚洲电影一区二区三区| 欧美美女视频在线观看| 国产精品77777| 亚洲综合丝袜美腿| 久久久久久久精| 在线中文字幕不卡| 久久国产精品免费| 亚洲黄色尤物视频| 亚洲精品一区二区三区蜜桃下载| 99视频有精品| 男男视频亚洲欧美| 国产精品久久久久久久久果冻传媒| 欧美三级欧美一级| 国产精品自拍av| 亚洲一区二区偷拍精品| 久久久www成人免费无遮挡大片 | 亚洲一本大道在线| 久久久99免费| 欧美伦理电影网| av午夜一区麻豆| 麻豆精品一区二区三区| 一区二区三区资源| 日本一区二区三区国色天香| 欧美一区二区三区系列电影| av亚洲精华国产精华精| 国产精品一级片| 首页综合国产亚洲丝袜| 亚洲视频网在线直播| 久久久久国产一区二区三区四区 | 国产一区二三区| 亚洲国产精品一区二区久久 | 蜜臀99久久精品久久久久久软件| 亚洲免费大片在线观看| 国产日韩欧美电影| 欧美成人官网二区| 制服丝袜日韩国产| 在线一区二区视频| 色国产精品一区在线观看| 99久久婷婷国产综合精品| 国产成人精品一区二区三区四区| 美脚の诱脚舐め脚责91 | 国产激情精品久久久第一区二区| 日韩一区欧美二区| 亚洲电影第三页| 亚洲欧美日韩小说| 中文字幕乱码久久午夜不卡 | 欧美久久一二区| 欧洲视频一区二区| 91官网在线免费观看| 91在线高清观看| 成人av资源在线观看| 成人深夜视频在线观看| 国产盗摄视频一区二区三区| 国产一区二区视频在线| 国产综合久久久久久鬼色| 狠狠狠色丁香婷婷综合久久五月| 久久99精品久久只有精品| 麻豆国产一区二区| 国产乱理伦片在线观看夜一区| 国产精品77777| 成人av电影免费在线播放| 波多野结衣在线一区| www.爱久久.com| 97se亚洲国产综合自在线观| 色综合天天综合网天天狠天天| 色哟哟欧美精品| 91国产精品成人| 日韩欧美国产一二三区| 精品国产乱码久久久久久免费| 精品处破学生在线二十三| 久久久91精品国产一区二区精品 | 欧美丰满一区二区免费视频| 欧美精品xxxxbbbb| 久久亚洲欧美国产精品乐播| 久久亚洲一区二区三区四区| 国产午夜精品一区二区三区嫩草 | 中文幕一区二区三区久久蜜桃| 中文字幕欧美激情一区| 伊人婷婷欧美激情| 日韩激情一二三区| 狠狠色丁香久久婷婷综| eeuss影院一区二区三区| 日本精品一区二区三区高清| 欧美日韩国产欧美日美国产精品| 精品国产sm最大网站| 成人欧美一区二区三区| 三级亚洲高清视频| 国产suv精品一区二区三区| 色视频一区二区| 欧美精品一区二区蜜臀亚洲| 成人免费一区二区三区在线观看| 日韩专区一卡二卡| 国产成人免费视频网站 | 国产精品区一区二区三| 亚洲成人免费在线观看| 国产精品一二三| 日本精品免费观看高清观看| 欧美一级欧美一级在线播放| 欧美国产日韩在线观看| 日韩和欧美的一区| 成人av网址在线| 欧美一区国产二区| 亚洲三级电影网站| 激情综合网av| 欧美三级电影在线看| 国产午夜一区二区三区| 香蕉久久一区二区不卡无毒影院| 国产成人精品综合在线观看| 欧美日本一区二区三区四区| 中文字幕第一页久久| 日韩激情视频网站| 91激情在线视频| 国产精品亲子乱子伦xxxx裸| 日韩国产高清在线| 91精品福利视频| 亚洲桃色在线一区| 国产高清成人在线| 欧美mv和日韩mv国产网站| 一区二区三区毛片| 99视频在线精品| 国产精品免费久久| 国产真实乱对白精彩久久| 欧美日韩中文字幕一区| 亚洲免费在线看| 不卡视频一二三四| 欧美激情中文不卡| 国产伦精一区二区三区| 欧美日韩激情一区二区三区| 国产精品久久久久7777按摩| 国产盗摄一区二区三区| 欧美变态tickling挠脚心| 五月天欧美精品| 欧美亚洲禁片免费| 亚洲美女屁股眼交3| 99久久精品一区二区| 中文字幕在线观看一区二区| 国产91对白在线观看九色| 精品国产a毛片| 精品一区二区三区免费毛片爱 | 国产一区二区主播在线| 日韩精品中文字幕在线一区| 蜜臀av在线播放一区二区三区| 欧美日韩国产综合一区二区三区| 亚洲资源在线观看| 在线观看av一区二区| 亚洲视频资源在线| 色婷婷国产精品久久包臀| 亚洲青青青在线视频| 91理论电影在线观看| 亚洲国产中文字幕| 欧美色国产精品| 亚洲h在线观看| 欧美一区二区三区免费在线看| 日韩av中文字幕一区二区| 日韩欧美精品在线| 国产做a爰片久久毛片| 欧美国产日韩一二三区| 99精品视频在线观看| 亚洲综合小说图片| 欧美一卡二卡在线观看| 激情小说亚洲一区| 国产精品免费aⅴ片在线观看| 99精品久久久久久| 亚洲国产cao| 精品捆绑美女sm三区| 国产乱码精品一区二区三| 综合av第一页| 3d成人动漫网站| 国产高清视频一区| 亚洲综合男人的天堂| 精品日产卡一卡二卡麻豆| 成人看片黄a免费看在线| 亚洲午夜私人影院| 精品国产成人在线影院 | 91精品国产综合久久蜜臀| 精品一区二区av|