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

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

?? pci.c

?? ARM 嵌入式 系統 設計與實例開發 實驗教材 二源碼
?? C
字號:
/* $Id: pci.c,v 1.6 2000/01/29 00:12:05 grundler Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License.  See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1997, 1998 Ralf Baechle * Copyright (C) 1999 SuSE GmbH * Copyright (C) 1999 Hewlett-Packard Company * Copyright (C) 1999, 2000 Grant Grundler */#include <linux/config.h>#include <linux/types.h>#include <linux/kernel.h>#include <linux/init.h>		/* for __init and __devinit */#include <linux/pci.h>#include <linux/spinlock.h>#include <linux/string.h>	/* for memcpy() */#include <asm/system.h>#ifdef CONFIG_PCI#undef DEBUG_RESOURCES#ifdef DEBUG_RESOURCES#define DBG_RES(x...)	printk(x)#else#define DBG_RES(x...)#endif/* To be used as: mdelay(pci_post_reset_delay);**** post_reset is the time the kernel should stall to prevent anyone from** accessing the PCI bus once #RESET is de-asserted. ** PCI spec somewhere says 1 second but with multi-PCI bus systems,** this makes the boot time much longer than necessary.** 20ms seems to work for all the HP PCI implementations to date.*/int pci_post_reset_delay = 50;struct pci_port_ops *pci_port;struct pci_bios_ops *pci_bios;struct pci_hba_data *hba_list = NULL;int hba_count = 0;/*** parisc_pci_hba used by pci_port->in/out() ops to lookup bus data.*/#define PCI_HBA_MAX 32static struct pci_hba_data *parisc_pci_hba[PCI_HBA_MAX];/************************************************************************ I/O port space support***********************************************************************/#define PCI_PORT_HBA(a) ((a)>>16)#define PCI_PORT_ADDR(a) ((a) & 0xffffUL)/* KLUGE : inb needs to be defined differently for PCI devices than** for other bus interfaces. Doing this at runtime sucks but is the** only way one driver binary can support devices on different bus types.***/#define PCI_PORT_IN(type, size) \u##size in##type (int addr) \{ \	int b = PCI_PORT_HBA(addr); \	u##size d = (u##size) -1; \	ASSERT(pci_port); /* make sure services are defined */ \	ASSERT(parisc_pci_hba[b]); /* make sure ioaddr are "fixed up" */ \	if (parisc_pci_hba[b] == NULL) { \		printk(KERN_WARNING "\nPCI Host Bus Adapter %d not registered. in" #size "(0x%x) returning -1\n", b, addr); \	} else { \		d = pci_port->in##type(parisc_pci_hba[b], PCI_PORT_ADDR(addr)); \	} \	return d; \}PCI_PORT_IN(b,  8)PCI_PORT_IN(w, 16)PCI_PORT_IN(l, 32)#define PCI_PORT_OUT(type, size) \void out##type (u##size d, int addr) \{ \	int b = PCI_PORT_HBA(addr); \	ASSERT(pci_port); \	pci_port->out##type(parisc_pci_hba[b], PCI_PORT_ADDR(addr), d); \}PCI_PORT_OUT(b,  8)PCI_PORT_OUT(w, 16)PCI_PORT_OUT(l, 32)/* * BIOS32 replacement. */void pcibios_init(void){	ASSERT(pci_bios != NULL);	if (pci_bios)	{		if (pci_bios->init) {			(*pci_bios->init)();		} else {			printk(KERN_WARNING "pci_bios != NULL but init() is!\n");		}	}}/* Called from pci_do_scan_bus() *after* walking a bus but before walking PPBs. */void pcibios_fixup_bus(struct pci_bus *bus){	ASSERT(pci_bios != NULL);        /* If this is a bridge, get the current bases */	if (bus->self) {		pci_read_bridge_bases(bus);	}	if (pci_bios) {		if (pci_bios->fixup_bus) {			(*pci_bios->fixup_bus)(bus);		} else {			printk(KERN_WARNING "pci_bios != NULL but fixup_bus() is!\n");		}	}}char *pcibios_setup(char *str){	return str;}#endif /* defined(CONFIG_PCI) *//* -------------------------------------------------------------------** linux-2.4: NEW STUFF ** --------------------*//*** Used in drivers/pci/quirks.c*/struct pci_fixup pcibios_fixups[] = { {0} };/*** called by drivers/pci/setup.c:pdev_fixup_irq()*/void __devinit pcibios_update_irq(struct pci_dev *dev, int irq){/*** updates IRQ_LINE cfg register to reflect PCI-PCI bridge skewing.**** Calling path for Alpha is:**  alpha/kernel/pci.c:common_init_pci(swizzle_func, pci_map_irq_func )**	drivers/pci/setup.c:pci_fixup_irqs()**	    drivers/pci/setup.c:pci_fixup_irq()	(for each PCI device)**		invoke swizzle and map functions**	        alpha/kernel/pci.c:pcibios_update_irq()**** Don't need this for PA legacy PDC systems.**** On PAT PDC systems, We only support one "swizzle" for any number** of PCI-PCI bridges deep. That's how bit3 PCI expansion chassis** are implemented. The IRQ lines are "skewed" for all devices but** *NOT* routed through the PCI-PCI bridge. Ie any device "0" will** share an IRQ line. Legacy PDC is expecting this IRQ line routing** as well.**** Unfortunately, PCI spec allows the IRQ lines to be routed** around the PCI bridge as long as the IRQ lines are skewed** based on the device number...<sigh>...**** Lastly, dino.c might be able to use pci_fixup_irq() to** support RS-232 and PS/2 children. Not sure how but it's** something to think about.*/}/* ------------------------------------**** Program one BAR in PCI config space.**** ------------------------------------** PAT PDC systems need this routine. PA legacy PDC does not.**** Used by alpha/arm: ** alpha/kernel/pci.c:common_init_pci()** (or arm/kernel/pci.c:pcibios_init())**    drivers/pci/setup.c:pci_assign_unassigned_resources()**        drivers/pci/setup.c:pdev_assign_unassigned_resources()**            arch/<foo>/kernel/pci.c:pcibios_update_resource()**** When BAR's are configured by linux, this routine** will update configuration space with the "normalized"** address. "root" indicates where the range starts and res** is some portion of that range.**** For all PA-RISC systems except V-class, root->start would be zero.**** PAT PDC can tell us which MMIO ranges are available or already in use.** I/O port space and such are not memory mapped anyway for PA-Risc.*/void __devinitpcibios_update_resource(	struct pci_dev *dev,	struct resource *root,	struct resource *res,	int barnum	){	int where;	u32 barval = 0;	DBG_RES("pcibios_update_resource(%s, ..., %d) [%lx,%lx]/%x\n",		dev->slot_name,		barnum, res->start, res->end, (int) res->flags);	if (barnum >= PCI_BRIDGE_RESOURCES) {		/* handled in pbus_set_ranges_data() */		return;	}	if (barnum == PCI_ROM_RESOURCE) {		where = PCI_ROM_ADDRESS;	} else {		/* 0-5  standard PCI "regions" */		where = PCI_BASE_ADDRESS_0 + (barnum * 4);	}	if (res->flags & IORESOURCE_IO) {		barval = PCI_PORT_ADDR(res->start);	} else if (res->flags & IORESOURCE_MEM) {		/* This should work for VCLASS too */		barval = res->start & 0xffffffffUL;	} else {		panic("pcibios_update_resource() WTF? flags not IO or MEM");	}	pci_write_config_dword(dev, where, barval);/* XXX FIXME - Elroy does support 64-bit (dual cycle) addressing.** But at least one device (Symbios 53c896) which has 64-bit BAR** doesn't actually work right with dual cycle addresses.** So ignore the whole mess for now.*/	if ((res->flags & (PCI_BASE_ADDRESS_SPACE			   | PCI_BASE_ADDRESS_MEM_TYPE_MASK))	    == (PCI_BASE_ADDRESS_SPACE_MEMORY		| PCI_BASE_ADDRESS_MEM_TYPE_64)) {		pci_write_config_dword(dev, where+4, 0);		printk(KERN_WARNING "PCI: dev %s type 64-bit\n", dev->name);	}}/*** Called by pci_set_master() - a driver interface.**** Legacy PDC guarantees to set:**      Map Memory BAR's into PA IO space.**      Map Expansion ROM BAR into one common PA IO space per bus.**      Map IO BAR's into PCI IO space.**      Command (see below)**      Cache Line Size**      Latency Timer**      Interrupt Line**	PPB: secondary latency timer, io/mmio base/limit,**		bus numbers, bridge control***/voidpcibios_set_master(struct pci_dev *dev){	u8 lat;	pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);	if (lat >= 16) return;	/*	** HP generally has fewer devices on the bus than other architectures.	*/	printk("PCIBIOS: Setting latency timer of %s to 128\n", dev->slot_name);	pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x80);}/*** called by drivers/pci/setup-res.c:pbus_set_ranges().*/void pcibios_fixup_pbus_ranges(	struct pci_bus *bus,	struct pbus_set_ranges_data *ranges	){	/*	** I/O space may see busnumbers here. Something	** in the form of 0xbbxxxx where bb is the bus num	** and xxxx is the I/O port space address.	** Remaining address translation are done in the	** PCI Host adapter specific code - ie dino_out8.	*/	ranges->io_start = PCI_PORT_ADDR(ranges->io_start);	ranges->io_end   = PCI_PORT_ADDR(ranges->io_end);	DBG_RES("pcibios_fixup_pbus_ranges(%02x, [%lx,%lx %lx,%lx])\n", bus->number,		ranges->io_start, ranges->io_end,		ranges->mem_start, ranges->mem_end);}#define MAX(val1, val2)   ((val1) > (val2) ? (val1) : (val2))/*** pcibios align resources() is called everytime generic PCI code** wants to generate a new address. The process of looking for** an available address, each candidate is first "aligned" and** then checked if the resource is available until a match is found.**** Since we are just checking candidates, don't use any fields other** than res->start.*/void __devinitpcibios_align_resource(void *data, struct resource *res, unsigned long size){	unsigned long mask, align;	DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx)\n",		((struct pci_dev *) data)->slot_name,		res->parent, res->start, res->end, (int) res->flags, size);	/* has resource already been aligned/assigned? */	if (res->parent)		return;	/* If it's not IO, then it's gotta be MEM */	align = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM;	/* Align to largest of MIN or input size */	mask = MAX(size, align) - 1;	res->start += mask;	res->start &= ~mask;	/*	** WARNING : caller is expected to update "end" field.	** We can't since it might really represent the *size*.	** The difference is "end = start + size" vs "end += size".	*/}#define ROUND_UP(x, a)		(((x) + (a) - 1) & ~((a) - 1))void __devinitpcibios_size_bridge(struct pci_bus *bus, struct pbus_set_ranges_data *outer){	struct pbus_set_ranges_data inner;	struct pci_dev *dev;	struct pci_dev *bridge = bus->self;	struct list_head *ln;	/* set reasonable default "window" for pcibios_align_resource */	inner.io_start  = inner.io_end  = 0;	inner.mem_start = inner.mem_end = 0;	/* Collect information about how our direct children are layed out. */	for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {		int i;		dev = pci_dev_b(ln);		/* Skip bridges here - we'll catch them below */		if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI)			continue;		for (i = 0; i < PCI_NUM_RESOURCES; i++) {			struct resource res;			unsigned long size;			if (dev->resource[i].flags == 0)				continue;			memcpy(&res, &dev->resource[i], sizeof(res));			size = res.end - res.start + 1;			if (res.flags & IORESOURCE_IO) {				res.start = inner.io_end;				pcibios_align_resource(dev, &res, size);				inner.io_end += res.start + size;			} else if (res.flags & IORESOURCE_MEM) {				res.start = inner.mem_end;				pcibios_align_resource(dev, &res, size);				inner.mem_end = res.start + size;			}		DBG_RES("    %s  inner size %lx/%x IO %lx MEM %lx\n",			dev->slot_name,			size, res.flags, inner.io_end, inner.mem_end);		}	}	/* And for all of the subordinate busses. */	for (ln=bus->children.next; ln != &bus->children; ln=ln->next)		pcibios_size_bridge(pci_bus_b(ln), &inner);	/* turn the ending locations into sizes (subtract start) */	inner.io_end -= inner.io_start - 1;	inner.mem_end -= inner.mem_start - 1;	/* Align the sizes up by bridge rules */	inner.io_end = ROUND_UP(inner.io_end, 4*1024) - 1;	inner.mem_end = ROUND_UP(inner.mem_end, 1*1024*1024) - 1;	/* PPB - PCI bridge Device will normaller also have "outer" != NULL. */	if (bridge) {		/* Adjust the bus' allocation requirements */		/* PPB's pci device Bridge resources */		bus->resource[0] = &bridge->resource[PCI_BRIDGE_RESOURCES];		bus->resource[1] = &bridge->resource[PCI_BRIDGE_RESOURCES + 1];				bus->resource[0]->start = bus->resource[1]->start  = 0;		bus->resource[0]->parent= bus->resource[1]->parent = NULL;		bus->resource[0]->end    = inner.io_end;		bus->resource[0]->flags  = IORESOURCE_IO;		bus->resource[1]->end    = inner.mem_end;		bus->resource[1]->flags  = IORESOURCE_MEM;	}	/* adjust parent's resource requirements */	if (outer) {		outer->io_end = ROUND_UP(outer->io_end, 4*1024);		outer->io_end += inner.io_end;		outer->mem_end = ROUND_UP(outer->mem_end, 1*1024*1024);		outer->mem_end += inner.mem_end;	}}#undef ROUND_UPint __devinitpcibios_enable_device(struct pci_dev *dev){	u16 cmd, old_cmd;	int idx;	/*	** The various platform PDC's (aka "BIOS" for PCs) don't	** enable all the same bits. We just make sure they are here.	*/	pci_read_config_word(dev, PCI_COMMAND, &cmd);	old_cmd = cmd;	/*	** See if any resources have been allocated	*/        for (idx=0; idx<6; idx++) {		struct resource *r = &dev->resource[idx];		if (r->flags & IORESOURCE_IO)			cmd |= PCI_COMMAND_IO;		if (r->flags & IORESOURCE_MEM)			cmd |= PCI_COMMAND_MEMORY;	}	/*	** System error and Parity Error reporting are enabled by default.	** Devices that do NOT want those behaviors should clear them	** (eg PCI graphics, possibly networking).	** Interfaces like SCSI certainly should not. We want the	** system to crash if a system or parity error is detected.	** At least until the device driver can recover from such an error.	*/	cmd |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);	if (cmd != old_cmd) {		printk("PCIBIOS: Enabling device %s (%04x -> %04x)\n",			dev->slot_name, old_cmd, cmd);		pci_write_config_word(dev, PCI_COMMAND, cmd);	}	return 0;}void __devinitpcibios_assign_unassigned_resources(struct pci_bus *bus){	struct list_head *ln;        for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next)	{		pdev_assign_unassigned_resources(pci_dev_b(ln));	}        /* And for all of the sub-busses.  */	for (ln=bus->children.next; ln != &bus->children; ln=ln->next)		pcibios_assign_unassigned_resources(pci_bus_b(ln));}/*** PARISC specific (unfortunately)*/void pcibios_register_hba(struct pci_hba_data *hba){	hba->next = hba_list;	hba_list = hba;	ASSERT(hba_count < PCI_HBA_MAX);	/*	** pci_port->in/out() uses parisc_pci_hba to lookup parameter.	*/	parisc_pci_hba[hba_count] = hba;	hba->hba_num = hba_count++;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
另类小说综合欧美亚洲| 久久毛片高清国产| 最新不卡av在线| 一区二区三区**美女毛片| 不卡的av网站| 亚洲天堂免费在线观看视频| 91一区二区在线| 一区二区三区国产| 7777精品伊人久久久大香线蕉 | 日韩 欧美一区二区三区| 欧美一区二区在线播放| 国产一本一道久久香蕉| 欧美韩日一区二区三区四区| 91在线观看成人| 亚洲乱码一区二区三区在线观看| 91视频免费播放| 五月天激情综合网| 日韩午夜激情免费电影| 国内久久精品视频| 亚洲丝袜精品丝袜在线| 欧美精品三级日韩久久| 久久99精品国产麻豆不卡| 国产情人综合久久777777| 色偷偷一区二区三区| 偷拍日韩校园综合在线| 久久精品亚洲精品国产欧美| 91亚洲男人天堂| 日韩av网站免费在线| 久久久国际精品| 色欧美乱欧美15图片| 免费人成黄页网站在线一区二区| 精品久久久久久久久久久久久久久| 不卡免费追剧大全电视剧网站| 一二三区精品福利视频| 欧美成人aa大片| 国产一区二区三区久久久| 琪琪久久久久日韩精品| 日韩欧美国产一二三区| 国产真实乱对白精彩久久| 91丨九色丨尤物| 日韩你懂的在线观看| 亚洲精选一二三| 欧美在线观看视频一区二区| 一级特黄大欧美久久久| 欧美精品国产精品| 日av在线不卡| 久久视频一区二区| 91美女在线看| 亚洲国产成人精品视频| 欧美精品高清视频| 国产成人av一区二区三区在线观看| 久久精品人人做人人综合| 成人黄色电影在线 | 男男视频亚洲欧美| 久久久久久久久久久久久女国产乱 | 777奇米四色成人影色区| 午夜婷婷国产麻豆精品| 成人毛片在线观看| 亚洲一区日韩精品中文字幕| 欧美色视频在线观看| 日本不卡的三区四区五区| 精品国产一区a| 欧美色精品在线视频| 亚洲最大的成人av| 国产真实精品久久二三区| 亚洲成人免费av| 日韩你懂的在线观看| 91免费看视频| 亚洲欧美日韩国产成人精品影院| 在线成人高清不卡| 高清视频一区二区| 一个色综合av| 国模套图日韩精品一区二区| 日韩欧美国产综合在线一区二区三区| 老司机精品视频在线| 欧美日韩色综合| 亚洲天堂a在线| 91免费在线播放| 日韩影视精彩在线| 国产夜色精品一区二区av| 一本色道久久加勒比精品| 国产精品一卡二| 久久青草欧美一区二区三区| 欧美一区二区精美| 免费在线观看精品| 日本欧美在线看| 国产一区二区三区美女| 69堂国产成人免费视频| 韩国理伦片一区二区三区在线播放 | 日韩三级.com| 欧美一级欧美三级| 欧美v国产在线一区二区三区| 欧美性大战久久| 久久这里只有精品6| youjizz久久| 成人av网址在线观看| 成人一级黄色片| 久久99精品久久久久久动态图| 99国产精品久| 色哟哟日韩精品| 爽好久久久欧美精品| 六月丁香婷婷久久| 久久久久99精品国产片| 91精品办公室少妇高潮对白| 色嗨嗨av一区二区三区| 在线综合+亚洲+欧美中文字幕| 成人综合婷婷国产精品久久蜜臀| 欧美日韩国产综合一区二区| 91.com在线观看| 久久久精品影视| 国产精品久久久久久久久免费樱桃 | 亚洲欧洲国产专区| 一二三区精品福利视频| 蜜臀av一区二区在线免费观看 | 亚洲国产精品t66y| 亚洲精品自拍动漫在线| 七七婷婷婷婷精品国产| 国产一区二区三区综合| 97精品久久久久中文字幕| 91精品欧美福利在线观看| 久久欧美中文字幕| 精品一区免费av| 麻豆精品视频在线观看视频| 欧美日韩大陆在线| 亚洲天堂免费在线观看视频| 一本色道a无线码一区v| 色综合久久九月婷婷色综合| 国产精品久久久久国产精品日日| 中文字幕亚洲综合久久菠萝蜜| 亚洲资源在线观看| 欧美激情综合五月色丁香小说| 国产成人综合网| 免费在线观看一区| 久久男人中文字幕资源站| 日本系列欧美系列| 欧美国产在线观看| 婷婷综合五月天| 色综合久久99| 国产精品国产自产拍高清av王其| 国产精品99久久久久久久女警| 国产精品一区二区91| 国产亚洲精品精华液| 成人免费在线视频| 欧美精品一区二区三区在线播放| 男女男精品视频网| 久久国内精品自在自线400部| 欧美日韩视频在线第一区| 中文在线一区二区| 99久久精品99国产精品| 久久久av毛片精品| 在线亚洲精品福利网址导航| 国产精一品亚洲二区在线视频| 亚洲国产sm捆绑调教视频| 国产精品卡一卡二卡三| 精品成人一区二区三区四区| 欧美视频在线观看一区| 色综合色狠狠天天综合色| 粉嫩嫩av羞羞动漫久久久| 久久99久国产精品黄毛片色诱| 视频一区二区不卡| 天天色综合天天| 亚洲制服欧美中文字幕中文字幕| 中文字幕在线视频一区| 久久久久久久久久看片| 国产校园另类小说区| 欧美一二三区精品| 91麻豆精品91久久久久久清纯| 欧美日韩在线播放| 91精品国产色综合久久不卡蜜臀 | 成人性视频免费网站| 色婷婷综合五月| 5月丁香婷婷综合| 日韩理论片中文av| 激情综合色播激情啊| 不卡av免费在线观看| 日韩欧美三级在线| 自拍偷拍国产亚洲| 久久成人久久鬼色| 91精品国产91久久久久久一区二区 | xnxx国产精品| 欧美探花视频资源| 香蕉影视欧美成人| 久久九九99视频| 国产日韩av一区二区| 精品国产免费久久| 91精彩视频在线观看| 色婷婷av一区二区三区大白胸| 日韩精品亚洲专区| 亚洲精品你懂的| 午夜精品福利在线| 亚洲一区二区偷拍精品| 亚洲一区二区在线免费看| 国产精品成人在线观看| 久久精品亚洲国产奇米99| 1024国产精品| 国产精品久久久久久久久搜平片 | 色综合中文字幕| av电影在线观看不卡| 成人免费小视频| 亚洲精品免费视频|