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

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

?? pmc551.c

?? 根據fs2410移植過后的mtd驅動源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * $Id: pmc551.c,v 1.32 2005/11/07 11:14:25 gleixner Exp $ * * PMC551 PCI Mezzanine Ram Device * * Author: *       Mark Ferrell <mferrell@mvista.com> *       Copyright 1999,2000 Nortel Networks * * License: *	 As part of this driver was derived from the slram.c driver it *	 falls under the same license, which is GNU General Public *	 License v2 * * Description: *	 This driver is intended to support the PMC551 PCI Ram device *	 from Ramix Inc.  The PMC551 is a PMC Mezzanine module for *	 cPCI embedded systems.  The device contains a single SROM *	 that initially programs the V370PDC chipset onboard the *	 device, and various banks of DRAM/SDRAM onboard.  This driver *	 implements this PCI Ram device as an MTD (Memory Technology *	 Device) so that it can be used to hold a file system, or for *	 added swap space in embedded systems.  Since the memory on *	 this board isn't as fast as main memory we do not try to hook *	 it into main memory as that would simply reduce performance *	 on the system.  Using it as a block device allows us to use *	 it as high speed swap or for a high speed disk device of some *	 sort.  Which becomes very useful on diskless systems in the *	 embedded market I might add. * * Notes: *	 Due to what I assume is more buggy SROM, the 64M PMC551 I *	 have available claims that all 4 of it's DRAM banks have 64M *	 of ram configured (making a grand total of 256M onboard). *	 This is slightly annoying since the BAR0 size reflects the *	 aperture size, not the dram size, and the V370PDC supplies no *	 other method for memory size discovery.  This problem is *	 mostly only relevant when compiled as a module, as the *	 unloading of the module with an aperture size smaller then *	 the ram will cause the driver to detect the onboard memory *	 size to be equal to the aperture size when the module is *	 reloaded.  Soooo, to help, the module supports an msize *	 option to allow the specification of the onboard memory, and *	 an asize option, to allow the specification of the aperture *	 size.  The aperture must be equal to or less then the memory *	 size, the driver will correct this if you screw it up.  This *	 problem is not relevant for compiled in drivers as compiled *	 in drivers only init once. * * Credits: *       Saeed Karamooz <saeed@ramix.com> of Ramix INC. for the *       initial example code of how to initialize this device and for *       help with questions I had concerning operation of the device. * *       Most of the MTD code for this driver was originally written *       for the slram.o module in the MTD drivers package which *       allows the mapping of system memory into an MTD device. *       Since the PMC551 memory module is accessed in the same *       fashion as system memory, the slram.c code became a very nice *       fit to the needs of this driver.  All we added was PCI *       detection/initialization to the driver and automatically figure *       out the size via the PCI detection.o, later changes by Corey *       Minyard set up the card to utilize a 1M sliding apature. * *	 Corey Minyard <minyard@nortelnetworks.com> *       * Modified driver to utilize a sliding aperture instead of *         mapping all memory into kernel space which turned out to *         be very wasteful. *       * Located a bug in the SROM's initialization sequence that *         made the memory unusable, added a fix to code to touch up *         the DRAM some. * * Bugs/FIXME's: *       * MUST fix the init function to not spin on a register *       waiting for it to set .. this does not safely handle busted *       devices that never reset the register correctly which will *       cause the system to hang w/ a reboot being the only chance at *       recover. [sort of fixed, could be better] *       * Add I2C handling of the SROM so we can read the SROM's information *       about the aperture size.  This should always accurately reflect the *       onboard memory size. *       * Comb the init routine.  It's still a bit cludgy on a few things. */#include <linux/config.h>#include <linux/kernel.h>#include <linux/module.h>#include <asm/uaccess.h>#include <linux/types.h>#include <linux/sched.h>#include <linux/init.h>#include <linux/ptrace.h>#include <linux/slab.h>#include <linux/string.h>#include <linux/timer.h>#include <linux/major.h>#include <linux/fs.h>#include <linux/ioctl.h>#include <asm/io.h>#include <asm/system.h>#include <linux/pci.h>#ifndef CONFIG_PCI#error Enable PCI in your kernel config#endif#include <linux/mtd/mtd.h>#include <linux/mtd/pmc551.h>#include <linux/mtd/compatmac.h>static struct mtd_info *pmc551list;static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr){        struct mypriv *priv = mtd->priv;        u32 soff_hi, soff_lo; /* start address offset hi/lo */        u32 eoff_hi, eoff_lo; /* end address offset hi/lo */        unsigned long end;	u_char *ptr;	size_t retlen;#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_erase(pos:%ld, len:%ld)\n", (long)instr->addr, (long)instr->len);#endif        end = instr->addr + instr->len - 1;        /* Is it past the end? */        if ( end > mtd->size ) {#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_erase() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size);#endif                return -EINVAL;        }        eoff_hi = end & ~(priv->asize - 1);        soff_hi = instr->addr & ~(priv->asize - 1);        eoff_lo = end & (priv->asize - 1);        soff_lo = instr->addr & (priv->asize - 1);	pmc551_point (mtd, instr->addr, instr->len, &retlen, &ptr);        if ( soff_hi == eoff_hi || mtd->size == priv->asize) {                /* The whole thing fits within one access, so just one shot                   will do it. */                memset(ptr, 0xff, instr->len);        } else {                /* We have to do multiple writes to get all the data                   written. */                while (soff_hi != eoff_hi) {#ifdef CONFIG_MTD_PMC551_DEBUG			printk( KERN_DEBUG "pmc551_erase() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);#endif                        memset(ptr, 0xff, priv->asize);                        if (soff_hi + priv->asize >= mtd->size) {                                goto out;                        }                        soff_hi += priv->asize;			pmc551_point (mtd,(priv->base_map0|soff_hi),				      priv->asize, &retlen, &ptr);                }                memset (ptr, 0xff, eoff_lo);        }out:	instr->state = MTD_ERASE_DONE;#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_erase() done\n");#endif        mtd_erase_callback(instr);        return 0;}static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf){        struct mypriv *priv = mtd->priv;        u32 soff_hi;        u32 soff_lo;#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_point(%ld, %ld)\n", (long)from, (long)len);#endif	if (from + len > mtd->size) {#ifdef CONFIG_MTD_PMC551_DEBUG		printk(KERN_DEBUG "pmc551_point() out of bounds (%ld > %ld)\n", (long)from+len, (long)mtd->size);#endif		return -EINVAL;	}        soff_hi = from & ~(priv->asize - 1);        soff_lo = from & (priv->asize - 1);	/* Cheap hack optimization */	if( priv->curr_map0 != from ) {        	pci_write_config_dword ( priv->dev, PMC551_PCI_MEM_MAP0,                                 	(priv->base_map0 | soff_hi) );		priv->curr_map0 = soff_hi;	}	*mtdbuf = priv->start + soff_lo;	*retlen = len;	return 0;}static void pmc551_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len){#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_unpoint()\n");#endif}static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf){        struct mypriv *priv = mtd->priv;        u32 soff_hi, soff_lo; /* start address offset hi/lo */        u32 eoff_hi, eoff_lo; /* end address offset hi/lo */        unsigned long end;	u_char *ptr;        u_char *copyto = buf;#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_read(pos:%ld, len:%ld) asize: %ld\n", (long)from, (long)len, (long)priv->asize);#endif        end = from + len - 1;        /* Is it past the end? */        if (end > mtd->size) {#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_read() out of bounds (%ld > %ld)\n", (long) end, (long)mtd->size);#endif                return -EINVAL;        }        soff_hi = from & ~(priv->asize - 1);        eoff_hi = end & ~(priv->asize - 1);        soff_lo = from & (priv->asize - 1);        eoff_lo = end & (priv->asize - 1);	pmc551_point (mtd, from, len, retlen, &ptr);        if (soff_hi == eoff_hi) {                /* The whole thing fits within one access, so just one shot                   will do it. */                memcpy(copyto, ptr, len);                copyto += len;        } else {                /* We have to do multiple writes to get all the data                   written. */                while (soff_hi != eoff_hi) {#ifdef CONFIG_MTD_PMC551_DEBUG			printk( KERN_DEBUG "pmc551_read() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);#endif                        memcpy(copyto, ptr, priv->asize);                        copyto += priv->asize;                        if (soff_hi + priv->asize >= mtd->size) {                                goto out;                        }                        soff_hi += priv->asize;			pmc551_point (mtd, soff_hi, priv->asize, retlen, &ptr);                }                memcpy(copyto, ptr, eoff_lo);                copyto += eoff_lo;        }out:#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_read() done\n");#endif        *retlen = copyto - buf;        return 0;}static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf){        struct mypriv *priv = mtd->priv;        u32 soff_hi, soff_lo; /* start address offset hi/lo */        u32 eoff_hi, eoff_lo; /* end address offset hi/lo */        unsigned long end;	u_char *ptr;        const u_char *copyfrom = buf;#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_write(pos:%ld, len:%ld) asize:%ld\n", (long)to, (long)len, (long)priv->asize);#endif        end = to + len - 1;        /* Is it past the end?  or did the u32 wrap? */        if (end > mtd->size ) {#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_write() out of bounds (end: %ld, size: %ld, to: %ld)\n", (long) end, (long)mtd->size, (long)to);#endif                return -EINVAL;        }        soff_hi = to & ~(priv->asize - 1);        eoff_hi = end & ~(priv->asize - 1);        soff_lo = to & (priv->asize - 1);        eoff_lo = end & (priv->asize - 1);	pmc551_point (mtd, to, len, retlen, &ptr);        if (soff_hi == eoff_hi) {                /* The whole thing fits within one access, so just one shot                   will do it. */                memcpy(ptr, copyfrom, len);                copyfrom += len;        } else {                /* We have to do multiple writes to get all the data                   written. */                while (soff_hi != eoff_hi) {#ifdef CONFIG_MTD_PMC551_DEBUG			printk( KERN_DEBUG "pmc551_write() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);#endif                	memcpy(ptr, copyfrom, priv->asize);                	copyfrom += priv->asize;                        if (soff_hi >= mtd->size) {                                goto out;                        }                        soff_hi += priv->asize;			pmc551_point (mtd, soff_hi, priv->asize, retlen, &ptr);                }                memcpy(ptr, copyfrom, eoff_lo);                copyfrom += eoff_lo;        }out:#ifdef CONFIG_MTD_PMC551_DEBUG	printk(KERN_DEBUG "pmc551_write() done\n");#endif        *retlen = copyfrom - buf;        return 0;}/* * Fixup routines for the V370PDC * PCI device ID 0x020011b0 * * This function basicly kick starts the DRAM oboard the card and gets it * ready to be used.  Before this is done the device reads VERY erratic, so * much that it can crash the Linux 2.2.x series kernels when a user cat's * /proc/pci .. though that is mainly a kernel bug in handling the PCI DEVSEL * register.  FIXME: stop spinning on registers .. must implement a timeout * mechanism * returns the size of the memory region found. */static u32 fixup_pmc551 (struct pci_dev *dev){#ifdef CONFIG_MTD_PMC551_BUGFIX        u32 dram_data;#endif        u32 size, dcmd, cfg, dtmp;        u16 cmd, tmp, i;	u8 bcmd, counter;        /* Sanity Check */        if(!dev) {                return -ENODEV;        }	/*	 * Attempt to reset the card	 * FIXME: Stop Spinning registers	 */	counter=0;	/* unlock registers */	pci_write_config_byte(dev, PMC551_SYS_CTRL_REG, 0xA5 );	/* read in old data */	pci_read_config_byte(dev, PMC551_SYS_CTRL_REG, &bcmd );	/* bang the reset line up and down for a few */	for(i=0;i<10;i++) {		counter=0;		bcmd &= ~0x80;		while(counter++ < 100) {			pci_write_config_byte(dev, PMC551_SYS_CTRL_REG, bcmd);		}		counter=0;		bcmd |= 0x80;		while(counter++ < 100) {			pci_write_config_byte(dev, PMC551_SYS_CTRL_REG, bcmd);		}	}	bcmd |= (0x40|0x20);	pci_write_config_byte(dev, PMC551_SYS_CTRL_REG, bcmd);        /*	 * Take care and turn off the memory on the device while we	 * tweak the configurations	 */        pci_read_config_word(dev, PCI_COMMAND, &cmd);        tmp = cmd & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY);        pci_write_config_word(dev, PCI_COMMAND, tmp);	/*	 * Disable existing aperture before probing memory size	 */	pci_read_config_dword(dev, PMC551_PCI_MEM_MAP0, &dcmd);        dtmp=(dcmd|PMC551_PCI_MEM_MAP_ENABLE|PMC551_PCI_MEM_MAP_REG_EN);	pci_write_config_dword(dev, PMC551_PCI_MEM_MAP0, dtmp);	/*	 * Grab old BAR0 config so that we can figure out memory size	 * This is another bit of kludge going on.  The reason for the	 * redundancy is I am hoping to retain the original configuration	 * previously assigned to the card by the BIOS or some previous	 * fixup routine in the kernel.  So we read the old config into cfg,	 * then write all 1's to the memory space, read back the result into	 * "size", and then write back all the old config.	 */	pci_read_config_dword( dev, PCI_BASE_ADDRESS_0, &cfg );#ifndef CONFIG_MTD_PMC551_BUGFIX	pci_write_config_dword( dev, PCI_BASE_ADDRESS_0, ~0 );	pci_read_config_dword( dev, PCI_BASE_ADDRESS_0, &size );	size = (size&PCI_BASE_ADDRESS_MEM_MASK);	size &= ~(size-1);	pci_write_config_dword( dev, PCI_BASE_ADDRESS_0, cfg );#else

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三区在线不卡| 亚洲精品在线三区| 91精品国产色综合久久久蜜香臀| 日韩亚洲欧美综合| 国产欧美日韩视频在线观看| 亚洲免费观看高清在线观看| 中文字幕一区二区三区视频| 午夜精品久久久久久久| 成人三级在线视频| 777xxx欧美| 久久久亚洲精品一区二区三区 | 中文字幕人成不卡一区| 日韩国产欧美在线视频| jizz一区二区| 精品国产乱码久久久久久久 | 国产一区二区精品久久99| 91视频免费观看| 日韩亚洲欧美高清| 一区二区三区四区国产精品| 国产精品羞羞答答xxdd| 色香蕉成人二区免费| 2欧美一区二区三区在线观看视频| 亚洲品质自拍视频| 日韩精品色哟哟| 欧美伊人久久大香线蕉综合69| 精品久久一区二区三区| 亚洲欧美日韩一区二区三区在线观看| 久久精品99国产精品日本| 日本韩国欧美国产| 国产精品久久久久久久久免费桃花| 蜜臀久久久久久久| 欧美性做爰猛烈叫床潮| 中文字幕一区二区三| 国产自产高清不卡| 欧美r级电影在线观看| 午夜久久久影院| 91极品美女在线| 亚洲婷婷综合色高清在线| 国产成人av自拍| 欧美精品少妇一区二区三区 | 国产又粗又猛又爽又黄91精品| 欧美日本不卡视频| 亚洲国产一区二区a毛片| 91久久国产最好的精华液| 亚洲人xxxx| 91丨九色丨黑人外教| 亚洲色图视频网站| 9人人澡人人爽人人精品| 中文字幕精品在线不卡| 国产99精品在线观看| 亚洲国产激情av| 激情综合一区二区三区| 欧美tickling挠脚心丨vk| 秋霞av亚洲一区二区三| 日韩一级黄色大片| 国产凹凸在线观看一区二区| 一个色综合av| 精品福利av导航| 99久久婷婷国产精品综合| 丝袜美腿高跟呻吟高潮一区| 337p粉嫩大胆噜噜噜噜噜91av| 97国产精品videossex| 丝袜亚洲另类丝袜在线| 国产视频亚洲色图| 欧美系列亚洲系列| 韩国视频一区二区| 一区二区三区精品视频在线| 精品国产污网站| 色老头久久综合| 国产精品538一区二区在线| 亚洲电影在线播放| 国产亚洲精品资源在线26u| 91极品美女在线| 国产91精品精华液一区二区三区| 亚洲高清视频的网址| 久久精品综合网| 欧美日韩国产成人在线免费| 成人午夜av电影| 青青草91视频| 亚洲妇熟xx妇色黄| 国产日产精品1区| 日本一区二区综合亚洲| 欧美日本免费一区二区三区| 东方aⅴ免费观看久久av| 日本亚洲天堂网| 一区二区三区在线不卡| 久久久高清一区二区三区| 欧美人狂配大交3d怪物一区| 99re这里都是精品| 国产乱码精品一区二区三| 青青草精品视频| 亚洲精品福利视频网站| 国产精品入口麻豆原神| 精品国产露脸精彩对白 | 亚洲mv大片欧洲mv大片精品| 国产精品色哟哟| 久久精品亚洲国产奇米99 | 欧美色精品在线视频| 99久久精品国产麻豆演员表| 国产老肥熟一区二区三区| 日本美女一区二区三区视频| 亚欧色一区w666天堂| 亚洲啪啪综合av一区二区三区| 中文字幕一区二区三区乱码在线 | 国产99久久久久| 国产精品白丝jk白祙喷水网站| 捆绑紧缚一区二区三区视频 | 91麻豆高清视频| 成av人片一区二区| 99视频有精品| 91猫先生在线| 色婷婷国产精品| 色婷婷久久久综合中文字幕| 91看片淫黄大片一级| 色婷婷久久99综合精品jk白丝| 91免费国产视频网站| 在线免费观看日本一区| 欧美三级在线视频| 欧美日韩1区2区| 欧美mv日韩mv国产网站app| 久久综合色一综合色88| 337p日本欧洲亚洲大胆色噜噜| 久久久噜噜噜久久中文字幕色伊伊 | 2020国产精品| 国产欧美日本一区视频| 综合在线观看色| 亚洲综合色视频| 视频一区二区中文字幕| 九九**精品视频免费播放| 国产传媒一区在线| 91在线视频免费观看| 欧美视频一二三区| 欧美videossexotv100| 欧美国产1区2区| 一区二区三区久久| 久久国产综合精品| 不卡的av电影| 欧美日韩一区久久| wwww国产精品欧美| 亚洲电影中文字幕在线观看| 久久精品国产第一区二区三区| 国产东北露脸精品视频| 91麻豆.com| 日韩精品专区在线影院重磅| 国产精品亲子伦对白| 亚洲综合精品自拍| 国内精品伊人久久久久av影院| 91丝袜国产在线播放| 91麻豆精品国产| 国产精品成人免费在线| 日韩av在线播放中文字幕| 国产不卡在线一区| 欧美卡1卡2卡| 国产精品初高中害羞小美女文| 日日夜夜免费精品视频| 成人小视频在线观看| 欧美日韩aaaaa| 自拍偷拍国产精品| 日韩精品免费视频人成| 国产高清久久久| 337p亚洲精品色噜噜| 亚洲人成人一区二区在线观看| 麻豆国产精品777777在线| av电影天堂一区二区在线观看| 日韩视频一区二区三区在线播放| 亚洲欧洲av在线| 狠狠色丁香九九婷婷综合五月| 欧美亚州韩日在线看免费版国语版| 国产亚洲1区2区3区| 天堂va蜜桃一区二区三区| 91免费看视频| 日本一区二区电影| 国产一区啦啦啦在线观看| 欧美亚洲丝袜传媒另类| 一区二区中文字幕在线| 激情图区综合网| 制服丝袜国产精品| 亚洲一区二区免费视频| 99久久精品免费精品国产| 久久久91精品国产一区二区精品| 免费在线观看日韩欧美| 欧美日韩视频专区在线播放| 亚洲天堂av一区| 高清视频一区二区| 国产日韩欧美亚洲| 国产精品1区2区3区| 精品国产在天天线2019| 美女视频一区二区三区| 91精品国产综合久久久久| 亚洲一区二区美女| 欧美日韩亚洲另类| 洋洋成人永久网站入口| 91在线视频在线| 亚洲女同女同女同女同女同69| gogo大胆日本视频一区| 综合自拍亚洲综合图不卡区| 99riav一区二区三区| 一区二区三区在线视频观看| 在线观看欧美精品| 丝袜美腿亚洲综合|