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

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

?? pci.c

?? linux下的pci接口驅動程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
int pci_request_regions(struct pci_dev *pdev, char *res_name){	int i;		for (i = 0; i < 6; i++) {		if (pci_resource_len(pdev, i) == 0)			continue;		if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {			if (!request_region(pci_resource_start(pdev, i),					    pci_resource_len(pdev, i), res_name))				goto err_out;		}				else if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {			if (!request_mem_region(pci_resource_start(pdev, i),					        pci_resource_len(pdev, i), res_name))				goto err_out;		}	}		return 0;err_out:	printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n",		pci_resource_flags(pdev, i) & IORESOURCE_IO ? "I/O" : "mem",		i + 1, /* PCI BAR # */		pci_resource_len(pdev, i), pci_resource_start(pdev, i),		pdev->slot_name);	pci_release_regions(pdev);	return -EBUSY;}/* *  Registration of PCI drivers and handling of hot-pluggable devices. */static LIST_HEAD(pci_drivers);/** * pci_match_device - Tell if a PCI device structure has a matching PCI device id structure * @ids: array of PCI device id structures to search in * @dev: the PCI device structure to match against *  * Used by a driver to check whether a PCI device present in the * system is in its list of supported devices.Returns the matching * pci_device_id structure or %NULL if there is no match. */const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev){	while (ids->vendor || ids->subvendor || ids->class_mask) {		if ((ids->vendor == PCI_ANY_ID || ids->vendor == dev->vendor) &&		    (ids->device == PCI_ANY_ID || ids->device == dev->device) &&		    (ids->subvendor == PCI_ANY_ID || ids->subvendor == dev->subsystem_vendor) &&		    (ids->subdevice == PCI_ANY_ID || ids->subdevice == dev->subsystem_device) &&		    !((ids->class ^ dev->class) & ids->class_mask))			return ids;		ids++;	}	return NULL;}static intpci_announce_device(struct pci_driver *drv, struct pci_dev *dev){	const struct pci_device_id *id;	int ret = 0;	if (drv->id_table) {		id = pci_match_device(drv->id_table, dev);		if (!id) {			ret = 0;			goto out;		}	} else		id = NULL;	dev_probe_lock();	if (drv->probe(dev, id) >= 0) {		dev->driver = drv;		ret = 1;	}	dev_probe_unlock();out:	return ret;}/** * pci_register_driver - register a new pci driver * @drv: the driver structure to register *  * Adds the driver structure to the list of registered drivers * Returns the number of pci devices which were claimed by the driver * during registration.  The driver remains registered even if the * return value is zero. */intpci_register_driver(struct pci_driver *drv){	struct pci_dev *dev;	int count = 0;	list_add_tail(&drv->node, &pci_drivers);	pci_for_each_dev(dev) {		if (!pci_dev_driver(dev))			count += pci_announce_device(drv, dev);	}	return count;}/** * pci_unregister_driver - unregister a pci driver * @drv: the driver structure to unregister *  * Deletes the driver structure from the list of registered PCI drivers, * gives it a chance to clean up by calling its remove() function for * each device it was responsible for, and marks those devices as * driverless. */voidpci_unregister_driver(struct pci_driver *drv){	struct pci_dev *dev;	list_del(&drv->node);	pci_for_each_dev(dev) {		if (dev->driver == drv) {			if (drv->remove)				drv->remove(dev);			dev->driver = NULL;		}	}}#ifdef CONFIG_HOTPLUG#ifndef FALSE#define FALSE	(0)#define TRUE	(!FALSE)#endifstatic voidrun_sbin_hotplug(struct pci_dev *pdev, int insert){	int i;	char *argv[3], *envp[8];	char id[20], sub_id[24], bus_id[24], class_id[20];	if (!hotplug_path[0])		return;	sprintf(class_id, "PCI_CLASS=%04X", pdev->class);	sprintf(id, "PCI_ID=%04X:%04X", pdev->vendor, pdev->device);	sprintf(sub_id, "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor, pdev->subsystem_device);	sprintf(bus_id, "PCI_SLOT_NAME=%s", pdev->slot_name);	i = 0;	argv[i++] = hotplug_path;	argv[i++] = "pci";	argv[i] = 0;	i = 0;	/* minimal command environment */	envp[i++] = "HOME=/";	envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";		/* other stuff we want to pass to /sbin/hotplug */	envp[i++] = class_id;	envp[i++] = id;	envp[i++] = sub_id;	envp[i++] = bus_id;	if (insert)		envp[i++] = "ACTION=add";	else		envp[i++] = "ACTION=remove";	envp[i] = 0;	call_usermodehelper (argv [0], argv, envp);}/** * pci_announce_device_to_drivers - tell the drivers a new device has appeared * @dev: the device that has shown up * * Notifys the drivers that a new device has appeared, and also notifys * userspace through /sbin/hotplug. */voidpci_announce_device_to_drivers(struct pci_dev *dev){	struct list_head *ln;	for(ln=pci_drivers.next; ln != &pci_drivers; ln=ln->next) {		struct pci_driver *drv = list_entry(ln, struct pci_driver, node);		if (drv->remove && pci_announce_device(drv, dev))			break;	}	/* notify userspace of new hotplug device */	run_sbin_hotplug(dev, TRUE);}/** * pci_insert_device - insert a hotplug device * @dev: the device to insert * @bus: where to insert it * * Add a new device to the device lists and notify userspace (/sbin/hotplug). */voidpci_insert_device(struct pci_dev *dev, struct pci_bus *bus){	list_add_tail(&dev->bus_list, &bus->devices);	list_add_tail(&dev->global_list, &pci_devices);#ifdef CONFIG_PROC_FS	pci_proc_attach_device(dev);#endif	pci_announce_device_to_drivers(dev);}static voidpci_free_resources(struct pci_dev *dev){	int i;	for (i = 0; i < PCI_NUM_RESOURCES; i++) {		struct resource *res = dev->resource + i;		if (res->parent)			release_resource(res);	}}/** * pci_remove_device - remove a hotplug device * @dev: the device to remove * * Delete the device structure from the device lists and  * notify userspace (/sbin/hotplug). */voidpci_remove_device(struct pci_dev *dev){	if (dev->driver) {		if (dev->driver->remove)			dev->driver->remove(dev);		dev->driver = NULL;	}	list_del(&dev->bus_list);	list_del(&dev->global_list);	pci_free_resources(dev);#ifdef CONFIG_PROC_FS	pci_proc_detach_device(dev);#endif	/* notify userspace of hotplug device removal */	run_sbin_hotplug(dev, FALSE);}#endifstatic struct pci_driver pci_compat_driver = {	name: "compat"};/** * pci_dev_driver - get the pci_driver of a device * @dev: the device to query * * Returns the appropriate pci_driver structure or %NULL if there is no  * registered driver for the device. */struct pci_driver *pci_dev_driver(const struct pci_dev *dev){	if (dev->driver)		return dev->driver;	else {		int i;		for(i=0; i<=PCI_ROM_RESOURCE; i++)			if (dev->resource[i].flags & IORESOURCE_BUSY)				return &pci_compat_driver;	}	return NULL;}/* * This interrupt-safe spinlock protects all accesses to PCI * configuration space. */static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED;/* *  Wrappers for all PCI configuration access functions.  They just check *  alignment, do locking and call the low-level functions pointed to *  by pci_dev->ops. */#define PCI_byte_BAD 0#define PCI_word_BAD (pos & 1)#define PCI_dword_BAD (pos & 3)#define PCI_OP(rw,size,type) \int pci_##rw##_config_##size (struct pci_dev *dev, int pos, type value) \{									\	int res;							\	unsigned long flags;						\	if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER;	\	spin_lock_irqsave(&pci_lock, flags);				\	res = dev->bus->ops->rw##_##size(dev, pos, value);		\	spin_unlock_irqrestore(&pci_lock, flags);			\	return res;							\}PCI_OP(read, byte, u8 *)PCI_OP(read, word, u16 *)PCI_OP(read, dword, u32 *)PCI_OP(write, byte, u8)PCI_OP(write, word, u16)PCI_OP(write, dword, u32)/** * pci_set_master - enables bus-mastering for device dev * @dev: the PCI device to enable * * Enables bus-mastering on the device and calls pcibios_set_master() * to do the needed arch specific settings. */voidpci_set_master(struct pci_dev *dev){	u16 cmd;	pci_read_config_word(dev, PCI_COMMAND, &cmd);	if (! (cmd & PCI_COMMAND_MASTER)) {		DBG("PCI: Enabling bus mastering for device %s\n", dev->slot_name);		cmd |= PCI_COMMAND_MASTER;		pci_write_config_word(dev, PCI_COMMAND, cmd);	}	pcibios_set_master(dev);}/** * pdev_set_mwi - arch helper function for pcibios_set_mwi * @dev: the PCI device for which MWI is enabled * * Helper function for implementation the arch-specific pcibios_set_mwi * function.  Originally copied from drivers/net/acenic.c. * Copyright 1998-2001 by Jes Sorensen, <jes@trained-monkey.org>. * * RETURNS: An appriopriate -ERRNO error value on eror, or zero for success. */intpdev_set_mwi(struct pci_dev *dev){	int rc = 0;	u8 cache_size;	/*	 * Looks like this is necessary to deal with on all architectures,	 * even this %$#%$# N440BX Intel based thing doesn't get it right.	 * Ie. having two NICs in the machine, one will have the cache	 * line set at boot time, the other will not.	 */	pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &cache_size);	cache_size <<= 2;	if (cache_size != SMP_CACHE_BYTES) {		printk(KERN_WARNING "PCI: %s PCI cache line size set incorrectly "		       "(%i bytes) by BIOS/FW, ",		       dev->slot_name, cache_size);		if (cache_size > SMP_CACHE_BYTES) {			printk("expecting %i\n", SMP_CACHE_BYTES);			rc = -EINVAL;		} else {			printk("correcting to %i\n", SMP_CACHE_BYTES);			pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,					      SMP_CACHE_BYTES >> 2);		}	}	return rc;}/** * pci_set_mwi - enables memory-write-invalidate PCI transaction * @dev: the PCI device for which MWI is enabled * * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND, * and then calls @pcibios_set_mwi to do the needed arch specific * operations or a generic mwi-prep function. * * RETURNS: An appriopriate -ERRNO error value on eror, or zero for success. */intpci_set_mwi(struct pci_dev *dev){	int rc;	u16 cmd;#ifdef HAVE_ARCH_PCI_MWI	rc = pcibios_set_mwi(dev);#else	rc = pdev_set_mwi(dev);#endif	if (rc)		return rc;	pci_read_config_word(dev, PCI_COMMAND, &cmd);	if (! (cmd & PCI_COMMAND_INVALIDATE)) {		DBG("PCI: Enabling Mem-Wr-Inval for device %s\n", dev->slot_name);		cmd |= PCI_COMMAND_INVALIDATE;		pci_write_config_word(dev, PCI_COMMAND, cmd);	}		return 0;}/** * pci_clear_mwi - disables Memory-Write-Invalidate for device dev * @dev: the PCI device to disable * * Disables PCI Memory-Write-Invalidate transaction on the device */voidpci_clear_mwi(struct pci_dev *dev){	u16 cmd;	pci_read_config_word(dev, PCI_COMMAND, &cmd);	if (cmd & PCI_COMMAND_INVALIDATE) {		cmd &= ~PCI_COMMAND_INVALIDATE;		pci_write_config_word(dev, PCI_COMMAND, cmd);	}}intpci_set_dma_mask(struct pci_dev *dev, u64 mask){	if (!pci_dma_supported(dev, mask))		return -EIO;	dev->dma_mask = mask;	return 0;}    intpci_dac_set_dma_mask(struct pci_dev *dev, u64 mask){	if (!pci_dac_dma_supported(dev, mask))		return -EIO;	dev->dma_mask = mask;	return 0;}    /* * Translate the low bits of the PCI base * to the resource type */static inline unsigned int pci_calc_resource_flags(unsigned int flags){	if (flags & PCI_BASE_ADDRESS_SPACE_IO)		return IORESOURCE_IO;	if (flags & PCI_BASE_ADDRESS_MEM_PREFETCH)		return IORESOURCE_MEM | IORESOURCE_PREFETCH;	return IORESOURCE_MEM;}/* * Find the extent of a PCI decode.. */static u32 pci_size(u32 base, unsigned long mask){	u32 size = mask & base;		/* Find the significant bits */	size = size & ~(size-1);	/* Get the lowest of them to find the decode size */	return size-1;			/* extent = size - 1 */}static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom){	unsigned int pos, reg, next;	u32 l, sz;	struct resource *res;	for(pos=0; pos<howmany; pos = next) {		next = pos+1;		res = &dev->resource[pos];		res->name = dev->name;		reg = PCI_BASE_ADDRESS_0 + (pos << 2);		pci_read_config_dword(dev, reg, &l);		pci_write_config_dword(dev, reg, ~0);		pci_read_config_dword(dev, reg, &sz);		pci_write_config_dword(dev, reg, l);		if (!sz || sz == 0xffffffff)			continue;		if (l == 0xffffffff)			l = 0;		if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) {			res->start = l & PCI_BASE_ADDRESS_MEM_MASK;			res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK;			sz = pci_size(sz, PCI_BASE_ADDRESS_MEM_MASK);		} else {			res->start = l & PCI_BASE_ADDRESS_IO_MASK;			res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK;			sz = pci_size(sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);		}		res->end = res->start + (unsigned long) sz;		res->flags |= pci_calc_resource_flags(l);		if ((l & (PCI_BASE_ADDRESS_SPACE | PCI_BASE_ADDRESS_MEM_TYPE_MASK))		    == (PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64)) {			pci_read_config_dword(dev, reg+4, &l);			next++;#if BITS_PER_LONG == 64			res->start |= ((unsigned long) l) << 32;			res->end = res->start + sz;			pci_write_config_dword(dev, reg+4, ~0);			pci_read_config_dword(dev, reg+4, &sz);			pci_write_config_dword(dev, reg+4, l);			if (~sz)				res->end = res->start + 0xffffffff +						(((unsigned long) ~sz) << 32);#else			if (l) {				printk(KERN_ERR "PCI: Unable to handle 64-bit address for device %s\n", dev->slot_name);				res->start = 0;				res->flags = 0;				continue;			}#endif		}	}	if (rom) {		dev->rom_base_reg = rom;		res = &dev->resource[PCI_ROM_RESOURCE];		pci_read_config_dword(dev, rom, &l);		pci_write_config_dword(dev, rom, ~PCI_ROM_ADDRESS_ENABLE);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品五月天| 日韩精品视频网站| 无吗不卡中文字幕| 国产成人在线观看| 这里只有精品视频在线观看| 国产午夜精品一区二区三区视频 | 欧美在线不卡视频| 欧美成人精品二区三区99精品| 亚洲婷婷在线视频| 国产精品一品二品| 欧美一卡2卡3卡4卡| 亚洲色图在线看| 国产黑丝在线一区二区三区| 日韩一区二区三区在线| 亚洲免费观看在线观看| 高清不卡在线观看av| 日韩视频一区二区三区在线播放| 一区二区三区蜜桃网| 国产精品18久久久久久久久| 91精品免费观看| 亚洲18色成人| 一本到高清视频免费精品| 久久久亚洲精品石原莉奈| 免费成人结看片| 欧美一区二区三区婷婷月色| 亚洲午夜精品17c| 色天天综合久久久久综合片| 国产精品视频看| 国产不卡视频一区| 国产亚洲一二三区| 韩国av一区二区三区在线观看| 欧美一二三四在线| 免费成人在线视频观看| 欧美一区二区三区视频在线观看| 香蕉加勒比综合久久 | 日韩高清不卡一区| 欧美午夜免费电影| 亚洲小说春色综合另类电影| 色婷婷久久99综合精品jk白丝| 国产精品麻豆网站| 成人v精品蜜桃久久一区| 中文字幕免费不卡在线| 粉嫩av亚洲一区二区图片| 亚洲国产成人午夜在线一区| 国产精品18久久久久久久久久久久 | 成人免费va视频| 久久久99免费| 国产69精品久久久久777| 国产精品剧情在线亚洲| 成人高清视频在线| 亚洲综合小说图片| 欧美一区二区三区免费观看视频| 六月丁香综合在线视频| 久久视频一区二区| 成人国产精品免费网站| 亚洲综合丝袜美腿| 91精品综合久久久久久| 精品一区二区三区香蕉蜜桃| 久久久噜噜噜久久中文字幕色伊伊| 国产成人免费网站| 亚洲美女淫视频| 欧美一级在线免费| 国产69精品久久777的优势| 亚洲欧美日韩综合aⅴ视频| 欧美日韩一区二区三区在线| 久久国产精品区| 中文字幕不卡一区| 欧美日韩国产精品自在自线| 麻豆成人91精品二区三区| 国产精品三级在线观看| 欧美日韩一区二区三区在线看| 精品一二三四区| 一区二区三区不卡视频在线观看| 欧美一区二区三区在线观看| 成人性生交大片免费看视频在线 | 肉色丝袜一区二区| 欧美激情一区二区| 欧美亚洲综合在线| 国产在线一区二区综合免费视频| 亚洲日本护士毛茸茸| 日韩一区二区中文字幕| 不卡一区在线观看| 美女视频黄久久| 一区二区三区美女| 国产欧美精品国产国产专区| 欧美精品一二三| 91最新地址在线播放| 国产一区三区三区| 五月综合激情婷婷六月色窝| 国产精品天干天干在线综合| 欧美电影一区二区三区| 99精品偷自拍| 高清不卡在线观看| 美女久久久精品| 亚洲国产一区视频| 18欧美亚洲精品| 国产日产欧美一区二区三区 | 国产1区2区3区精品美女| 天使萌一区二区三区免费观看| 中文字幕制服丝袜成人av| 精品国产一区二区三区久久影院 | 日日夜夜精品视频免费| 亚洲婷婷综合久久一本伊一区| 精品国产乱码久久久久久闺蜜| 欧美剧在线免费观看网站| 91麻豆国产香蕉久久精品| 国产精品一卡二卡在线观看| 久久er精品视频| 日本aⅴ免费视频一区二区三区| 一二三四区精品视频| 自拍偷拍国产亚洲| 成人欧美一区二区三区在线播放| 久久久久国产一区二区三区四区| 欧美成人女星排行榜| 日韩午夜av一区| 欧美一级夜夜爽| 日韩一区和二区| 精品久久久网站| 久久综合色播五月| 国产亚洲成年网址在线观看| 国产亚洲欧洲997久久综合| 欧美成人a在线| 久久蜜桃av一区二区天堂| 久久久久久久久久久电影| 国产欧美精品在线观看| 国产精品久久国产精麻豆99网站| 国产精品久久久久久久久快鸭 | 一本久久综合亚洲鲁鲁五月天 | 国产精品成人一区二区艾草| 麻豆一区二区三| 婷婷六月综合网| 日本美女一区二区三区视频| 久久av资源站| 粉嫩av亚洲一区二区图片| 99久久久无码国产精品| 欧洲av一区二区嗯嗯嗯啊| 欧美久久久久久久久中文字幕| 91精品国产综合久久婷婷香蕉| 日韩一级免费一区| 国产调教视频一区| 国产精品成人一区二区艾草| 亚洲激情自拍视频| 热久久一区二区| 国产精品亚洲午夜一区二区三区| 成人爱爱电影网址| 欧美理论片在线| 久久久久9999亚洲精品| 日韩毛片高清在线播放| 亚洲国产精品精华液网站| 麻豆精品在线观看| 成人h动漫精品一区二区| 欧美日韩国产免费一区二区 | 国产欧美一区二区三区网站| 亚洲人成网站在线| 日本不卡免费在线视频| 国产成a人亚洲| 在线观看亚洲精品| 亚洲精品一区二区三区在线观看| 成人欧美一区二区三区白人| 天堂va蜜桃一区二区三区漫画版| 国产专区综合网| 欧美在线视频日韩| 久久久五月婷婷| 一区二区三区中文字幕精品精品| 老司机精品视频一区二区三区| 成人高清视频免费观看| 8v天堂国产在线一区二区| 中文字幕乱码一区二区免费| 日韩高清欧美激情| 色悠久久久久综合欧美99| 久久美女高清视频| 亚洲综合丁香婷婷六月香| 国产伦精一区二区三区| 欧美精品三级日韩久久| 亚洲色欲色欲www| 韩国女主播成人在线| 884aa四虎影成人精品一区| 国产精品午夜电影| 精品中文字幕一区二区小辣椒| 91久久精品日日躁夜夜躁欧美| 国产亚洲欧美色| 久久福利视频一区二区| 欧美日韩一二三| 中文字幕日韩一区| 国产91丝袜在线观看| 日韩久久精品一区| 午夜电影网亚洲视频| 欧美影院午夜播放| 亚洲日本成人在线观看| 国产成人av自拍| 久久尤物电影视频在线观看| 奇米影视在线99精品| 欧美性生活大片视频| 亚洲欧美一区二区三区国产精品| 丁香婷婷深情五月亚洲| 久久综合九色综合欧美98| 激情综合网av| 久久久综合九色合综国产精品| 美国一区二区三区在线播放| 日韩一区二区电影在线|