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

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

?? pci.c

?? ep9315平臺下PCI總線驅動的源碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* *	$Id: pci.c,v 1.91 1999/01/21 13:34:01 davem Exp $ * *	PCI Bus Services, see include/linux/pci.h for further explanation. * *	Copyright 1993 -- 1997 Drew Eckhardt, Frederic Potter, *	David Mosberger-Tang * *	Copyright 1997 -- 2000 Martin Mares <mj@ucw.cz> */#include <linux/config.h>#include <linux/module.h>#include <linux/types.h>#include <linux/kernel.h>#include <linux/pci.h>#include <linux/string.h>#include <linux/init.h>#include <linux/slab.h>#include <linux/ioport.h>#include <linux/spinlock.h>#include <linux/pm.h>#include <linux/kmod.h>		/* for hotplug_path */#include <linux/bitops.h>#include <linux/delay.h>#include <linux/cache.h>#include <asm/page.h>#include <asm/dma.h>	/* isa_dma_bridge_buggy */#undef DEBUG#ifdef DEBUG#define DBG(x...) printk(x)#else#define DBG(x...)#endifLIST_HEAD(pci_root_buses);LIST_HEAD(pci_devices);/** * pci_find_slot - locate PCI device from a given PCI slot * @bus: number of PCI bus on which desired PCI device resides * @devfn: encodes number of PCI slot in which the desired PCI  * device resides and the logical device number within that slot  * in case of multi-function devices. * * Given a PCI bus and slot/function number, the desired PCI device  * is located in system global list of PCI devices.  If the device * is found, a pointer to its data structure is returned.  If no  * device is found, %NULL is returned. */struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn){	struct pci_dev *dev;	pci_for_each_dev(dev) {		if (dev->bus->number == bus && dev->devfn == devfn)			return dev;	}	return NULL;}/** * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids * @ss_vendor: PCI subsystem vendor id to match, or %PCI_ANY_ID to match all vendor ids * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids * @from: Previous PCI device found in search, or %NULL for new search. * * Iterates through the list of known PCI devices.  If a PCI device is * found with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its * device structure is returned.  Otherwise, %NULL is returned. * A new search is initiated by passing %NULL to the @from argument. * Otherwise if @from is not %NULL, searches continue from next device on the global list. */struct pci_dev *pci_find_subsys(unsigned int vendor, unsigned int device,		unsigned int ss_vendor, unsigned int ss_device,		const struct pci_dev *from){	struct list_head *n = from ? from->global_list.next : pci_devices.next;	while (n != &pci_devices) {		struct pci_dev *dev = pci_dev_g(n);		if ((vendor == PCI_ANY_ID || dev->vendor == vendor) &&		    (device == PCI_ANY_ID || dev->device == device) &&		    (ss_vendor == PCI_ANY_ID || dev->subsystem_vendor == ss_vendor) &&		    (ss_device == PCI_ANY_ID || dev->subsystem_device == ss_device))			return dev;		n = n->next;	}	return NULL;}/** * pci_find_device - begin or continue searching for a PCI device by vendor/device id * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids * @from: Previous PCI device found in search, or %NULL for new search. * * Iterates through the list of known PCI devices.  If a PCI device is * found with a matching @vendor and @device, a pointer to its device structure is * returned.  Otherwise, %NULL is returned. * A new search is initiated by passing %NULL to the @from argument. * Otherwise if @from is not %NULL, searches continue from next device on the global list. */struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from){	return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);}/** * pci_find_class - begin or continue searching for a PCI device by class * @class: search for a PCI device with this class designation * @from: Previous PCI device found in search, or %NULL for new search. * * Iterates through the list of known PCI devices.  If a PCI device is * found with a matching @class, a pointer to its device structure is * returned.  Otherwise, %NULL is returned. * A new search is initiated by passing %NULL to the @from argument. * Otherwise if @from is not %NULL, searches continue from next device * on the global list. */struct pci_dev *pci_find_class(unsigned int class, const struct pci_dev *from){	struct list_head *n = from ? from->global_list.next : pci_devices.next;	while (n != &pci_devices) {		struct pci_dev *dev = pci_dev_g(n);		if (dev->class == class)			return dev;		n = n->next;	}	return NULL;}/** * pci_find_capability - query for devices' capabilities  * @dev: PCI device to query * @cap: capability code * * Tell if a device supports a given PCI capability. * Returns the address of the requested capability structure within the * device's PCI configuration space or 0 in case the device does not * support it.  Possible values for @cap: * *  %PCI_CAP_ID_PM           Power Management  * *  %PCI_CAP_ID_AGP          Accelerated Graphics Port  * *  %PCI_CAP_ID_VPD          Vital Product Data  * *  %PCI_CAP_ID_SLOTID       Slot Identification  * *  %PCI_CAP_ID_MSI          Message Signalled Interrupts * *  %PCI_CAP_ID_CHSWP        CompactPCI HotSwap  * *  %PCI_CAP_ID_PCIX         PCI-X */intpci_find_capability(struct pci_dev *dev, int cap){	u16 status;	u8 pos, id;	int ttl = 48;	pci_read_config_word(dev, PCI_STATUS, &status);	if (!(status & PCI_STATUS_CAP_LIST))		return 0;	switch (dev->hdr_type) {	case PCI_HEADER_TYPE_NORMAL:	case PCI_HEADER_TYPE_BRIDGE:		pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &pos);		break;	case PCI_HEADER_TYPE_CARDBUS:		pci_read_config_byte(dev, PCI_CB_CAPABILITY_LIST, &pos);		break;	default:		return 0;	}	while (ttl-- && pos >= 0x40) {		pos &= ~3;		pci_read_config_byte(dev, pos + PCI_CAP_LIST_ID, &id);		if (id == 0xff)			break;		if (id == cap)			return pos;		pci_read_config_byte(dev, pos + PCI_CAP_LIST_NEXT, &pos);	}	return 0;}/** * pci_find_parent_resource - return resource region of parent bus of given region * @dev: PCI device structure contains resources to be searched * @res: child resource record for which parent is sought * *  For given resource region of given device, return the resource *  region of parent bus the given region is contained in or where *  it should be allocated from. */struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res){	const struct pci_bus *bus = dev->bus;	int i;	struct resource *best = NULL;	for(i=0; i<4; i++) {		struct resource *r = bus->resource[i];		if (!r)			continue;		if (res->start && !(res->start >= r->start && res->end <= r->end))			continue;	/* Not contained */		if ((res->flags ^ r->flags) & (IORESOURCE_IO | IORESOURCE_MEM))			continue;	/* Wrong type */		if (!((res->flags ^ r->flags) & IORESOURCE_PREFETCH))			return r;	/* Exact match */		if ((res->flags & IORESOURCE_PREFETCH) && !(r->flags & IORESOURCE_PREFETCH))			best = r;	/* Approximating prefetchable by non-prefetchable */	}	return best;}/** * pci_set_power_state - Set the power state of a PCI device * @dev: PCI device to be suspended * @state: Power state we're entering * * Transition a device to a new power state, using the Power Management  * Capabilities in the device's config space. * * RETURN VALUE:  * -EINVAL if trying to enter a lower state than we're already in. * 0 if we're already in the requested state. * -EIO if device does not support PCI PM. * 0 if we can successfully change the power state. */intpci_set_power_state(struct pci_dev *dev, int state){	int pm;	u16 pmcsr;	/* bound the state we're entering */	if (state > 3) state = 3;	/* Validate current state:	 * Can enter D0 from any state, but if we can only go deeper 	 * to sleep if we're already in a low power state	 */	if (state > 0 && dev->current_state > state)		return -EINVAL;	else if (dev->current_state == state) 		return 0;        /* we're already there */	/* find PCI PM capability in list */	pm = pci_find_capability(dev, PCI_CAP_ID_PM);		/* abort if the device doesn't support PM capabilities */	if (!pm) return -EIO; 	/* check if this device supports the desired state */	if (state == 1 || state == 2) {		u16 pmc;		pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);		if (state == 1 && !(pmc & PCI_PM_CAP_D1)) return -EIO;		else if (state == 2 && !(pmc & PCI_PM_CAP_D2)) return -EIO;	}	/* If we're in D3, force entire word to 0.	 * This doesn't affect PME_Status, disables PME_En, and	 * sets PowerState to 0.	 */	if (dev->current_state >= 3)		pmcsr = 0;	else {		pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;		pmcsr |= state;	}	/* enter specified state */	pci_write_config_word(dev, pm + PCI_PM_CTRL, pmcsr);	/* Mandatory power management transition delays */	/* see PCI PM 1.1 5.6.1 table 18 */	if(state == 3 || dev->current_state == 3)	{		set_current_state(TASK_UNINTERRUPTIBLE);		schedule_timeout(HZ/100);	}	else if(state == 2 || dev->current_state == 2)		udelay(200);	dev->current_state = state;	return 0;}/** * pci_save_state - save the PCI configuration space of a device before suspending * @dev: - PCI device that we're dealing with * @buffer: - buffer to hold config space context * * @buffer must be large enough to hold the entire PCI 2.2 config space  * (>= 64 bytes). */intpci_save_state(struct pci_dev *dev, u32 *buffer){	int i;	if (buffer) {		/* XXX: 100% dword access ok here? */		for (i = 0; i < 16; i++)			pci_read_config_dword(dev, i * 4,&buffer[i]);	}	return 0;}/**  * pci_restore_state - Restore the saved state of a PCI device * @dev: - PCI device that we're dealing with * @buffer: - saved PCI config space * */int pci_restore_state(struct pci_dev *dev, u32 *buffer){	int i;	if (buffer) {		for (i = 0; i < 16; i++)			pci_write_config_dword(dev,i * 4, buffer[i]);	}	/*	 * otherwise, write the context information we know from bootup.	 * This works around a problem where warm-booting from Windows	 * combined with a D3(hot)->D0 transition causes PCI config	 * header data to be forgotten.	 */		else {		for (i = 0; i < 6; i ++)			pci_write_config_dword(dev,					       PCI_BASE_ADDRESS_0 + (i * 4),					       dev->resource[i].start);		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);	}	return 0;}int pci_compare_state(struct pci_dev *dev, u32 *buffer){	int i;	unsigned int temp;	if (buffer) {		for (i = 0; i < 16; i++) {			pci_read_config_dword(dev,i*4,&temp);			if (temp!=buffer[i])				return 1;		}	}	return 0;}int pci_generic_suspend_save(struct pci_dev *pdev, u32 state){	if (pdev)		pci_save_state(pdev,pdev->saved_state);	return 0;}int pci_generic_resume_restore(struct pci_dev *pdev){	if (pdev)		pci_restore_state(pdev,pdev->saved_state);	return 0;		}int pci_generic_resume_compare(struct pci_dev *pdev){	int retval=0;	if (pdev)		retval = pci_compare_state(pdev,pdev->saved_state);	return retval;		}EXPORT_SYMBOL(pci_generic_suspend_save);EXPORT_SYMBOL(pci_generic_resume_restore);EXPORT_SYMBOL(pci_generic_resume_compare);/** * pci_enable_device_bars - Initialize some of a device for use * @dev: PCI device to be initialized * @bars: bitmask of BAR's that must be configured * *  Initialize device before it's used by a driver. Ask low-level code *  to enable selected I/O and memory resources. Wake up the device if it  *  was suspended. Beware, this function can fail. */ intpci_enable_device_bars(struct pci_dev *dev, int bars){	int err;	pci_set_power_state(dev, 0);	if ((err = pcibios_enable_device(dev, bars)) < 0)		return err;	return 0;}/** * pci_enable_device - Initialize device before it's used by a driver. * @dev: PCI device to be initialized * *  Initialize device before it's used by a driver. Ask low-level code *  to enable I/O and memory. Wake up the device if it was suspended. *  Beware, this function can fail. */intpci_enable_device(struct pci_dev *dev){	return pci_enable_device_bars(dev, 0x3F);}/** * pci_disable_device - Disable PCI device after use * @dev: PCI device to be disabled * * Signal to the system that the PCI device is not in use by the system * anymore.  This only involves disabling PCI bus-mastering, if active. */voidpci_disable_device(struct pci_dev *dev){	u16 pci_command;	pci_read_config_word(dev, PCI_COMMAND, &pci_command);	if (pci_command & PCI_COMMAND_MASTER) {		pci_command &= ~PCI_COMMAND_MASTER;		pci_write_config_word(dev, PCI_COMMAND, pci_command);	}}/** * pci_enable_wake - enable device to generate PME# when suspended * @dev: - PCI device to operate on * @state: - Current state of device. * @enable: - Flag to enable or disable generation *  * Set the bits in the device's PM Capabilities to generate PME# when * the system is suspended.  * * -EIO is returned if device doesn't have PM Capabilities.  * -EINVAL is returned if device supports it, but can't generate wake events. * 0 if operation is successful. *  */int pci_enable_wake(struct pci_dev *dev, u32 state, int enable){	int pm;	u16 value;	/* find PCI PM capability in list */	pm = pci_find_capability(dev, PCI_CAP_ID_PM);	/* If device doesn't support PM Capabilities, but request is to disable	 * wake events, it's a nop; otherwise fail */	if (!pm) 		return enable ? -EIO : 0; 	/* Check device's ability to generate PME# */	pci_read_config_word(dev,pm+PCI_PM_PMC,&value);	value &= PCI_PM_CAP_PME_MASK;	value >>= ffs(value);   /* First bit of mask */	/* Check if it can generate PME# from requested state. */	if (!value || !(value & (1 << state))) 		return enable ? -EINVAL : 0;	pci_read_config_word(dev, pm + PCI_PM_CTRL, &value);	/* Clear PME_Status by writing 1 to it and enable PME# */	value |= PCI_PM_CTRL_PME_STATUS | PCI_PM_CTRL_PME_ENABLE;	if (!enable)		value &= ~PCI_PM_CTRL_PME_ENABLE;	pci_write_config_word(dev, pm + PCI_PM_CTRL, value);		return 0;}intpci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge){	u8 pin;	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);	if (!pin)		return -1;	pin--;	while (dev->bus->self) {		pin = (pin + PCI_SLOT(dev->devfn)) % 4;		dev = dev->bus->self;	}	*bridge = dev;	return pin;}/** *	pci_release_region - Release a PCI bar *	@pdev: PCI device whose resources were previously reserved by pci_request_region *	@bar: BAR to release * *	Releases the PCI I/O and memory resources previously reserved by a *	successful call to pci_request_region.  Call this function only *	after all use of the PCI regions has ceased. */void pci_release_region(struct pci_dev *pdev, int bar){	if (pci_resource_len(pdev, bar) == 0)		return;	if (pci_resource_flags(pdev, bar) & IORESOURCE_IO)		release_region(pci_resource_start(pdev, bar),				pci_resource_len(pdev, bar));	else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM)		release_mem_region(pci_resource_start(pdev, bar),				pci_resource_len(pdev, bar));}/** *	pci_request_region - Reserved PCI I/O and memory resource *	@pdev: PCI device whose resources are to be reserved *	@bar: BAR to be reserved *	@res_name: Name to be associated with resource. * *	Mark the PCI region associated with PCI device @pdev BR @bar as *	being reserved by owner @res_name.  Do not access any *	address inside the PCI regions unless this call returns *	successfully. * *	Returns 0 on success, or %EBUSY on error.  A warning *	message is also printed on failure. */int pci_request_region(struct pci_dev *pdev, int bar, char *res_name){	if (pci_resource_len(pdev, bar) == 0)		return 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人激情av| 欧美精品第1页| 亚洲永久精品大片| 日韩视频免费观看高清完整版| 国产精品亚洲视频| 丝袜诱惑制服诱惑色一区在线观看 | 亚洲图片欧美综合| wwwwww.欧美系列| 欧美优质美女网站| 国产精品一区二区久久不卡 | 暴力调教一区二区三区| 午夜电影网一区| 欧美日韩国产高清一区二区三区| 国产精品一区二区三区四区| 亚洲国产综合人成综合网站| 欧美国产日韩亚洲一区| 日韩亚洲国产中文字幕欧美| 色婷婷综合在线| 国产乱码字幕精品高清av| 天天做天天摸天天爽国产一区 | 免费成人美女在线观看.| 亚洲六月丁香色婷婷综合久久 | 91精品蜜臀在线一区尤物| 91丝袜国产在线播放| 国产电影一区在线| 蜜臀久久99精品久久久画质超高清| 亚洲精品亚洲人成人网在线播放| 久久久99精品免费观看| 日韩一本二本av| 欧美日韩一区中文字幕| 日本韩国欧美一区二区三区| 成人动漫在线一区| 国产成人激情av| 中文字幕欧美一| 国产综合色精品一区二区三区| 亚洲一区二区视频| 亚洲日本电影在线| 国产精品美女久久久久久2018| 欧美精品一区二区三区高清aⅴ| 91精品一区二区三区久久久久久| 在线观看亚洲精品| 色一情一乱一乱一91av| 91一区在线观看| 99视频精品免费视频| 成人av影视在线观看| 成人app网站| 成人18视频在线播放| 国产suv一区二区三区88区| 国产精品一二三四区| 国产一区二区伦理| 国产精品白丝jk白祙喷水网站| 国产一区二区三区免费在线观看| 精品一区二区免费看| 国精产品一区一区三区mba桃花| 国产专区欧美精品| 国产91在线观看| 精品1区2区在线观看| 欧洲一区二区av| 在线欧美日韩精品| 3d成人h动漫网站入口| 欧美一级一区二区| ww亚洲ww在线观看国产| 国产日韩欧美精品一区| 国产精品久久久久久久久免费桃花 | 亚洲精品高清在线| 亚洲一区二区三区在线播放| 香蕉成人啪国产精品视频综合网| 日韩精品一卡二卡三卡四卡无卡| 蜜臀av性久久久久蜜臀aⅴ流畅 | 99re视频精品| 精品视频1区2区3区| 日韩亚洲欧美成人一区| 久久精品在线免费观看| 亚洲欧美影音先锋| 首页亚洲欧美制服丝腿| 国产一区二区三区精品视频| 波多野结衣中文字幕一区二区三区| 一本在线高清不卡dvd| 欧美一区二区二区| 欧美激情艳妇裸体舞| 亚洲一区二区三区在线看| 免费人成在线不卡| 北条麻妃国产九九精品视频| 欧美日本不卡视频| 久久精品视频免费| 大尺度一区二区| 日本不卡一区二区| 国产精品一区二区三区四区| 91香蕉视频在线| 91精品国产色综合久久不卡蜜臀| 国产视频亚洲色图| 一区二区久久久久| 国产一区91精品张津瑜| 色中色一区二区| 日韩久久久精品| 亚洲色图色小说| 久久99久国产精品黄毛片色诱| 成人性视频免费网站| 这里只有精品免费| 中文字幕一区二区视频| 麻豆精品新av中文字幕| 91在线观看下载| 亚洲精品一区二区三区香蕉 | 日韩欧美中文字幕一区| 1000精品久久久久久久久| 麻豆国产欧美一区二区三区| 91丨九色porny丨蝌蚪| 精品不卡在线视频| 亚洲1区2区3区4区| 91啪亚洲精品| 国产视频一区二区三区在线观看| 三级在线观看一区二区| 91丝袜美腿高跟国产极品老师| 26uuu久久天堂性欧美| 日韩极品在线观看| 色先锋aa成人| 久久婷婷国产综合精品青草| 日产欧产美韩系列久久99| 一本到不卡免费一区二区| 国产午夜亚洲精品羞羞网站| 麻豆国产精品一区二区三区| 精品视频在线免费观看| 亚洲欧美激情在线| 成人av在线播放网址| 久久久久久久久久美女| 久久99精品国产| 91精品国产综合久久久久久| 亚洲国产精品久久艾草纯爱| 色天天综合色天天久久| 一区视频在线播放| 成人深夜视频在线观看| 欧美精品一区二区三| 麻豆视频一区二区| 日韩欧美黄色影院| 麻豆91精品视频| 日韩一级大片在线观看| 蜜桃视频在线一区| 日韩免费观看2025年上映的电影| 图片区小说区区亚洲影院| 欧美日韩一级片在线观看| 亚洲一区二区三区四区在线免费观看| aaa亚洲精品一二三区| 亚洲欧洲日韩一区二区三区| av成人老司机| 亚洲精品中文字幕乱码三区| 色素色在线综合| 一区二区三区欧美日韩| 欧美视频自拍偷拍| 亚洲成人av一区| 制服丝袜亚洲色图| 美女视频黄 久久| 精品国产人成亚洲区| 国产一区在线观看视频| 国产精品丝袜黑色高跟| 99这里都是精品| 亚洲一区影音先锋| 91麻豆精品国产91久久久久久久久| 日韩国产高清影视| 精品精品国产高清a毛片牛牛 | 91精品午夜视频| 精油按摩中文字幕久久| 久久久久久久久99精品| av电影天堂一区二区在线观看| 最近中文字幕一区二区三区| 欧美在线看片a免费观看| 日韩专区欧美专区| 精品av久久707| 99精品久久99久久久久| 亚洲va韩国va欧美va| 日韩欧美国产三级| 成人永久aaa| 一区二区三区四区乱视频| 91精选在线观看| 国产精品一区在线观看乱码| 亚洲人成亚洲人成在线观看图片| 欧美日韩日本视频| 精品一区二区三区的国产在线播放 | 1区2区3区精品视频| 69精品人人人人| 国产精品一二三四| 亚洲一二三区在线观看| 精品国产免费久久| 95精品视频在线| 蜜桃传媒麻豆第一区在线观看| 国产精品视频线看| 欧美夫妻性生活| 成人av免费在线| 日韩高清不卡一区二区三区| 中日韩免费视频中文字幕| 在线视频欧美精品| 国产精品亚洲第一区在线暖暖韩国 | 久久综合久色欧美综合狠狠| 日本国产一区二区| 国产真实精品久久二三区| 一区二区三区在线观看欧美 | 一区二区三区欧美在线观看| 精品第一国产综合精品aⅴ| 在线免费观看日本一区| 国产乱一区二区| 视频一区二区中文字幕|