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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pci-x86_64.c

?? 這個linux源代碼是很全面的~基本完整了~使用c編譯的~由于時間問題我沒有親自測試~但就算用來做參考資料也是非常好的
?? C
字號:
/* *	Low-Level PCI Access for x86-64 machines * * Copyright 1993, 1994 Drew Eckhardt *      Visionary Computing *      (Unix and Linux consulting and custom programming) *      Drew@Colorado.EDU *      +1 (303) 786-7975 * * Drew's work was sponsored by: *	iX Multiuser Multitasking Magazine *	Hannover, Germany *	hm@ix.de * * Copyright 1997--2000 Martin Mares <mj@ucw.cz> * * For more information, please consult the following manuals (look at * http://www.pcisig.com/ for how to get them): * * PCI BIOS Specification * PCI Local Bus Specification * PCI to PCI Bridge Specification * PCI System Design Guide * * * CHANGELOG : * Jun 17, 1994 : Modified to accommodate the broken pre-PCI BIOS SPECIFICATION *	Revision 2.0 present on <thys@dennis.ee.up.ac.za>'s ASUS mainboard. * * Jan 5,  1995 : Modified to probe PCI hardware at boot time by Frederic *     Potter, potter@cao-vlsi.ibp.fr * * Jan 10, 1995 : Modified to store the information about configured pci *      devices into a list, which can be accessed via /proc/pci by *      Curtis Varner, cvarner@cs.ucr.edu * * Jan 12, 1995 : CPU-PCI bridge optimization support by Frederic Potter. *	Alpha version. Intel & UMC chipset support only. * * Apr 16, 1995 : Source merge with the DEC Alpha PCI support. Most of the code *	moved to drivers/pci/pci.c. * * Dec 7, 1996  : Added support for direct configuration access of boards *      with Intel compatible access schemes (tsbogend@alpha.franken.de) * * Feb 3, 1997  : Set internal functions to static, save/restore flags *	avoid dead locks reading broken PCI BIOS, werner@suse.de  * * Apr 26, 1997 : Fixed case when there is BIOS32, but not PCI BIOS *	(mj@atrey.karlin.mff.cuni.cz) * * May 7,  1997 : Added some missing cli()'s. [mj] *  * Jun 20, 1997 : Corrected problems in "conf1" type accesses. *      (paubert@iram.es) * * Aug 2,  1997 : Split to PCI BIOS handling and direct PCI access parts *	and cleaned it up...     Martin Mares <mj@atrey.karlin.mff.cuni.cz> * * Feb 6,  1998 : No longer using BIOS to find devices and device classes. [mj] * * May 1,  1998 : Support for peer host bridges. [mj] * * Jun 19, 1998 : Changed to use spinlocks, so that PCI configuration space *	can be accessed from interrupts even on SMP systems. [mj] * * August  1998 : Better support for peer host bridges and more paranoid *	checks for direct hardware access. Ugh, this file starts to look as *	a large gallery of common hardware bug workarounds (watch the comments) *	-- the PCI specs themselves are sane, but most implementors should be *	hit hard with \hammer scaled \magstep5. [mj] * * Jan 23, 1999 : More improvements to peer host bridge logic. i450NX fixup. [mj] * * Feb 8,  1999 : Added UM8886BF I/O address fixup. [mj] * * August  1999 : New resource management and configuration access stuff. [mj] * * Sep 19, 1999 : Use PCI IRQ routing tables for detection of peer host bridges. *		  Based on ideas by Chris Frantz and David Hinds. [mj] * * Sep 28, 1999 : Handle unreported/unassigned IRQs. Thanks to Shuu Yamaguchi *		  for a lot of patience during testing. [mj] * * Oct  8, 1999 : Split to pci-i386.c, pci-pc.c and pci-visws.c. [mj] */#include <linux/types.h>#include <linux/kernel.h>#include <linux/pci.h>#include <linux/init.h>#include <linux/ioport.h>#include <linux/errno.h>#include "pci-x86_64.h"voidpcibios_update_resource(struct pci_dev *dev, struct resource *root,			struct resource *res, int resource){	u32 new, check;	int reg;	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);	if (resource < 6) {		reg = PCI_BASE_ADDRESS_0 + 4*resource;	} else if (resource == PCI_ROM_RESOURCE) {		res->flags |= PCI_ROM_ADDRESS_ENABLE;		new |= PCI_ROM_ADDRESS_ENABLE;		reg = dev->rom_base_reg;	} else {		/* Somebody might have asked allocation of a non-standard resource */		return;	}		pci_write_config_dword(dev, reg, new);	pci_read_config_dword(dev, reg, &check);	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {		printk(KERN_ERR "PCI: Error while updating region "		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,		       new, check);	}}/* * We need to avoid collisions with `mirrored' VGA ports * and other strange ISA hardware, so we always want the * addresses to be allocated in the 0x000-0x0ff region * modulo 0x400. * * Why? Because some silly external IO cards only decode * the low 10 bits of the IO address. The 0x00-0xff region * is reserved for motherboard devices that decode all 16 * bits, so it's ok to allocate at, say, 0x2800-0x28ff, * but we want to try to avoid allocating at 0x2900-0x2bff * which might have be mirrored at 0x0100-0x03ff.. */voidpcibios_align_resource(void *data, struct resource *res, unsigned long size, unsigned long align){	if (res->flags & IORESOURCE_IO) {		unsigned long start = res->start;		if (start & 0x300) {			start = (start + 0x3ff) & ~0x3ff;			res->start = start;		}	}}/* *  Handle resources of PCI devices.  If the world were perfect, we could *  just allocate all the resource regions and do nothing more.  It isn't. *  On the other hand, we cannot just re-allocate all devices, as it would *  require us to know lots of host bridge internals.  So we attempt to *  keep as much of the original configuration as possible, but tweak it *  when it's found to be wrong. * *  Known BIOS problems we have to work around: *	- I/O or memory regions not configured *	- regions configured, but not enabled in the command register *	- bogus I/O addresses above 64K used *	- expansion ROMs left enabled (this may sound harmless, but given *	  the fact the PCI specs explicitly allow address decoders to be *	  shared between expansion ROMs and other resource regions, it's *	  at least dangerous) * *  Our solution: *	(1) Allocate resources for all buses behind PCI-to-PCI bridges. *	    This gives us fixed barriers on where we can allocate. *	(2) Allocate resources for all enabled devices.  If there is *	    a collision, just mark the resource as unallocated. Also *	    disable expansion ROMs during this step. *	(3) Try to allocate resources for disabled devices.  If the *	    resources were assigned correctly, everything goes well, *	    if they weren't, they won't disturb allocation of other *	    resources. *	(4) Assign new addresses to resources which were either *	    not configured at all or misconfigured.  If explicitly *	    requested by the user, configure expansion ROM address *	    as well. */static void __init pcibios_allocate_bus_resources(struct list_head *bus_list){	struct list_head *ln;	struct pci_bus *bus;	struct pci_dev *dev;	int idx;	struct resource *r, *pr;	/* Depth-First Search on bus tree */	for (ln=bus_list->next; ln != bus_list; ln=ln->next) {		bus = pci_bus_b(ln);		if ((dev = bus->self)) {			for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {				r = &dev->resource[idx];				if (!r->start)					continue;				pr = pci_find_parent_resource(dev, r);				if (!pr || request_resource(pr, r) < 0)					printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, dev->slot_name);			}		}		pcibios_allocate_bus_resources(&bus->children);	}}static void __init pcibios_allocate_resources(int pass){	struct pci_dev *dev;	int idx, disabled;	u16 command;	struct resource *r, *pr;	pci_for_each_dev(dev) {		pci_read_config_word(dev, PCI_COMMAND, &command);		for(idx = 0; idx < 6; idx++) {			r = &dev->resource[idx];			if (r->parent)		/* Already allocated */				continue;			if (!r->start)		/* Address not assigned at all */				continue;			if (r->flags & IORESOURCE_IO)				disabled = !(command & PCI_COMMAND_IO);			else				disabled = !(command & PCI_COMMAND_MEMORY);			if (pass == disabled) {				DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n",				    r->start, r->end, r->flags, disabled, pass);				pr = pci_find_parent_resource(dev, r);				if (!pr || request_resource(pr, r) < 0) {					printk(KERN_ERR "PCI: Cannot allocate resource region %d of device %s\n", idx, dev->slot_name);					/* We'll assign a new address later */					r->end -= r->start;					r->start = 0;				}			}		}		if (!pass) {			r = &dev->resource[PCI_ROM_RESOURCE];			if (r->flags & PCI_ROM_ADDRESS_ENABLE) {				/* Turn the ROM off, leave the resource region, but keep it unregistered. */				u32 reg;				DBG("PCI: Switching off ROM of %s\n", dev->slot_name);				r->flags &= ~PCI_ROM_ADDRESS_ENABLE;				pci_read_config_dword(dev, dev->rom_base_reg, &reg);				pci_write_config_dword(dev, dev->rom_base_reg, reg & ~PCI_ROM_ADDRESS_ENABLE);			}		}	}}static void __init pcibios_assign_resources(void){	struct pci_dev *dev;	int idx;	struct resource *r;	pci_for_each_dev(dev) {		int class = dev->class >> 8;		/* Don't touch classless devices and host bridges */		if (!class || class == PCI_CLASS_BRIDGE_HOST)			continue;		for(idx=0; idx<6; idx++) {			r = &dev->resource[idx];			/*			 *  Don't touch IDE controllers and I/O ports of video cards!			 */			if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) ||			    (class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO)))				continue;			/*			 *  We shall assign a new address to this resource, either because			 *  the BIOS forgot to do so or because we have decided the old			 *  address was unusable for some reason.			 */			if (!r->start && r->end)				pci_assign_resource(dev, idx);		}		if (pci_probe & PCI_ASSIGN_ROMS) {			r = &dev->resource[PCI_ROM_RESOURCE];			r->end -= r->start;			r->start = 0;			if (r->end)				pci_assign_resource(dev, PCI_ROM_RESOURCE);		}	}}void __init pcibios_resource_survey(void){	DBG("PCI: Allocating resources\n");	pcibios_allocate_bus_resources(&pci_root_buses);	pcibios_allocate_resources(0);	pcibios_allocate_resources(1);	pcibios_assign_resources();}int pcibios_enable_resources(struct pci_dev *dev, int mask){	u16 cmd, old_cmd;	int idx;	struct resource *r;	pci_read_config_word(dev, PCI_COMMAND, &cmd);	old_cmd = cmd;	for(idx=0; idx<6; idx++) {		r = &dev->resource[idx];		if (!(mask & (1<<idx)))			continue;		if (!r->start && r->end) {			printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", dev->slot_name);			return -EINVAL;		}		if (r->flags & IORESOURCE_IO)			cmd |= PCI_COMMAND_IO;		if (r->flags & IORESOURCE_MEM)			cmd |= PCI_COMMAND_MEMORY;	}	if (dev->resource[PCI_ROM_RESOURCE].start)		cmd |= PCI_COMMAND_MEMORY;	if (cmd != old_cmd) {		printk("PCI: Enabling device %s (%04x -> %04x)\n", dev->slot_name, old_cmd, cmd);		pci_write_config_word(dev, PCI_COMMAND, cmd);	}	return 0;}/* *  If we set up a device for bus mastering, we need to check the latency *  timer as certain crappy BIOSes forget to set it properly. */unsigned int pcibios_max_latency = 255;void pcibios_set_master(struct pci_dev *dev){	u8 lat;	pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);	if (lat < 16)		lat = (64 <= pcibios_max_latency) ? 64 : pcibios_max_latency;	else if (lat > pcibios_max_latency)		lat = pcibios_max_latency;	else		return;	printk("PCI: Setting latency timer of device %s to %d\n", dev->slot_name, lat);	pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);}int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,			enum pci_mmap_state mmap_state, int write_combine){	unsigned long prot;	/* I/O space cannot be accessed via normal processor loads and	 * stores on this platform.	 */	if (mmap_state == pci_mmap_io)		return -EINVAL;	/* Leave vm_pgoff as-is, the PCI space address is the physical	 * address on this platform.	 */	vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO);	prot = pgprot_val(vma->vm_page_prot);	if (boot_cpu_data.x86 > 3)		prot |= _PAGE_PCD | _PAGE_PWT;	vma->vm_page_prot = __pgprot(prot);	/* Write-combine setting is ignored, it is changed via the mtrr	 * interfaces on this platform.	 */	if (remap_page_range(vma, vma->vm_start, vma->vm_pgoff << PAGE_SHIFT,			     vma->vm_end - vma->vm_start,			     vma->vm_page_prot))		return -EAGAIN;	return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩亚洲欧美在线| 亚洲欧美另类图片小说| 欧美激情在线一区二区| 亚洲图片欧美一区| 国模冰冰炮一区二区| 在线精品视频免费播放| 精品欧美一区二区三区精品久久| 亚洲啪啪综合av一区二区三区| 日韩精品免费视频人成| 色婷婷综合久久久中文一区二区| 国产亚洲综合av| 另类小说图片综合网| 在线欧美小视频| 亚洲午夜在线视频| 97久久超碰国产精品电影| 亚洲精品一区二区三区99| 日韩影视精彩在线| 欧美视频三区在线播放| 日韩毛片视频在线看| 国产99久久久国产精品潘金网站| 91精品在线免费观看| 午夜久久久久久久久| 色天天综合久久久久综合片| 国产精品另类一区| 国产成人在线色| 久久久国产精品麻豆| 国产一区二区视频在线播放| 日韩欧美一级二级三级久久久| 亚洲mv在线观看| 欧美天天综合网| 亚洲午夜影视影院在线观看| 日本道精品一区二区三区| 亚洲蜜臀av乱码久久精品| 成人伦理片在线| 国产精品国产自产拍在线| 大桥未久av一区二区三区中文| 久久久国产精品午夜一区ai换脸| 国产精品中文字幕日韩精品| 国产日韩三级在线| 成人免费毛片app| 亚洲男人电影天堂| 欧美午夜片在线看| 天天综合网天天综合色| 日韩欧美中文字幕一区| 韩国女主播一区二区三区| 久久久久久久精| 成人aa视频在线观看| 一区二区三区日韩精品视频| 欧美日韩国产精品自在自线| 日韩—二三区免费观看av| 精品福利av导航| 成人性视频免费网站| 亚洲精品乱码久久久久| 欧美日韩在线播放三区四区| 美国三级日本三级久久99 | 免费不卡在线观看| 精品国产91亚洲一区二区三区婷婷| 国产精品一级片| 亚洲精品精品亚洲| 日韩欧美在线一区二区三区| 国产乱国产乱300精品| 亚洲欧美电影院| 欧美肥妇毛茸茸| 成人免费视频视频| 亚洲高清视频的网址| 久久毛片高清国产| 日本道精品一区二区三区| 麻豆成人91精品二区三区| 国产精品网友自拍| 91.麻豆视频| 不卡av在线网| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产亚洲欧美日韩俺去了| 欧美伊人久久久久久午夜久久久久| 蜜臀av性久久久久蜜臀av麻豆| 中文字幕一区二区三区av| 91精品一区二区三区在线观看| 丁香天五香天堂综合| 亚洲福利一区二区三区| 2023国产精华国产精品| 在线观看视频91| 成人免费高清视频| 久久精品噜噜噜成人av农村| 亚洲黄色在线视频| 欧美国产亚洲另类动漫| 欧美一区二区播放| 在线视频你懂得一区| 高清shemale亚洲人妖| 免费成人在线网站| 亚洲成人精品一区| 伊人夜夜躁av伊人久久| 国产精品视频一二| 精品播放一区二区| 日韩一区二区精品| 欧美日韩精品一二三区| 色综合色综合色综合| 成人午夜视频在线| 国产毛片精品视频| 久久激情五月激情| 日韩av一区二区在线影视| 亚洲午夜激情av| 一区二区三区日本| 亚洲精品视频在线观看网站| 国产精品婷婷午夜在线观看| 久久天天做天天爱综合色| 日韩一区二区三区高清免费看看| 欧美日韩一区高清| 精品视频1区2区3区| 欧美性生交片4| 色噜噜狠狠色综合欧洲selulu| 91精品国产丝袜白色高跟鞋| 91成人国产精品| 色欧美日韩亚洲| 在线观看视频一区| 欧美色图天堂网| 欧美日韩精品一区二区三区 | 中文字幕va一区二区三区| 久久综合九色综合欧美就去吻| 精品国产制服丝袜高跟| 精品区一区二区| 久久精品夜色噜噜亚洲aⅴ| 日本一区二区免费在线观看视频| 欧美国产日产图区| 国产精品久久久一本精品| 亚洲视频中文字幕| 亚洲综合无码一区二区| 香蕉久久一区二区不卡无毒影院| 午夜精品久久久久影视| 蜜桃91丨九色丨蝌蚪91桃色| 激情深爱一区二区| 国产麻豆成人精品| 99久久综合狠狠综合久久| 在线视频综合导航| 日韩一级片在线播放| 久久精品一二三| 亚洲免费av观看| 蜜臀99久久精品久久久久久软件 | 午夜精品123| 久久精品免费观看| 成人福利在线看| 日本韩国视频一区二区| 91精品国产综合久久精品性色| www亚洲一区| 亚洲免费观看在线观看| 丝袜诱惑亚洲看片| 国产成人亚洲综合色影视 | 国产一区激情在线| 成人av在线播放网站| 欧美高清在线一区| 亚洲激情综合网| 乱中年女人伦av一区二区| 成人激情免费视频| 91精品国产综合久久久久久久久久 | 日韩三级电影网址| 中文字幕在线一区| 日本亚洲视频在线| 91浏览器打开| 精品国产伦一区二区三区观看方式| 国产精品视频免费| 日本中文字幕一区二区有限公司| 成人性生交大片免费看在线播放| 欧美日韩三级视频| 国产精品青草综合久久久久99| 视频一区视频二区中文字幕| 国产99久久久精品| 日韩欧美一区电影| 亚洲国产精品嫩草影院| 成人美女视频在线观看| 精品国产一区二区三区av性色 | 国产欧美精品一区二区色综合| 亚洲高清免费在线| 91在线看国产| 久久精品欧美一区二区三区麻豆| 五月天国产精品| 色噜噜夜夜夜综合网| 国产亚洲一区二区三区四区| 丝袜诱惑亚洲看片| 欧美视频在线不卡| 亚洲三级久久久| 国产成人精品亚洲午夜麻豆| 日韩一卡二卡三卡四卡| 午夜伦理一区二区| 欧美在线看片a免费观看| 成人免费一区二区三区视频| 国产精品99久久久久久有的能看| 51精品国自产在线| 亚洲成a人v欧美综合天堂下载| 91色综合久久久久婷婷| 中文字幕av一区二区三区| 国产一区中文字幕| 精品播放一区二区| 精品一区二区三区欧美| 日韩视频在线你懂得| 天堂资源在线中文精品| 欧美在线看片a免费观看| 一区二区三区四区不卡视频| 91麻豆国产福利精品| 亚洲精品免费在线| 欧美自拍丝袜亚洲| 午夜精品福利一区二区三区av|