u32 aper_size, aper_alloc = 0, aper_order, last_aper_order = 0; 
u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0; 
void __init iommu_hole_init(void) { 	int fix, num; 	u32 aper_size, aper_alloc = 0, aper_order, last_aper_order = 0;	u64 aper_base, last_aper_base = 0;	int valid_agp = 0;	if (iommu_aperture_disabled || !fix_aperture)		return;	printk("Checking aperture...\n"); 	fix = 0;	for (num = 24; num < 32; num++) {				char name[30];		if (read_pci_config(0, num, 3, 0x00) != NB_ID_3) 			continue;			iommu_aperture = 1; 		aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7; 		aper_size = (32 * 1024 * 1024) << aper_order; 		aper_base = read_pci_config(0, num, 3, 0x94) & 0x7fff;		aper_base <<= 25; 		printk("CPU %d: aperture @ %Lx size %u MB\n", num-24, 		       aper_base, aper_size>>20);				sprintf(name, "northbridge cpu %d", num-24); 		if (!aperture_valid(name, aper_base, aper_size)) { 			fix = 1; 			break; 		}		if ((last_aper_order && aper_order != last_aper_order) ||		    (last_aper_base && aper_base != last_aper_base)) {			fix = 1;			break;		}		last_aper_order = aper_order;		last_aper_base = aper_base;	} 	if (!fix && !fallback_aper_force) 		return; 	if (!fallback_aper_force)		aper_alloc = search_agp_bridge(&aper_order, &valid_agp); 			if (aper_alloc) { 		/* Got the aperture from the AGP bridge */	} else if (swiotlb && !valid_agp) {		/* Do nothing */	} else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) ||		   force_iommu ||		   valid_agp ||		   fallback_aper_force) { 		printk("Your BIOS doesn't leave a aperture memory hole\n");		printk("Please enable the IOMMU option in the BIOS setup\n");		printk("This costs you %d MB of RAM\n",		       32 << fallback_aper_order);		aper_order = fallback_aper_order;		aper_alloc = allocate_aperture();		if (!aper_alloc) { 			/* Could disable AGP and IOMMU here, but it's probably			   not worth it. But the later users cannot deal with			   bad apertures and turning on the aperture over memory			   causes very strange problems, so it's better to 			   panic early. */			panic("Not enough memory for aperture");		}	} else { 		return; 	} 	/* Fix up the north bridges */	for (num = 24; num < 32; num++) { 				if (read_pci_config(0, num, 3, 0x00) != NB_ID_3) 			continue;			/* Don't enable translation yet. That is done later. 		   Assume this BIOS didn't initialise the GART so 		   just overwrite all previous bits */ 		write_pci_config(0, num, 3, 0x90, aper_order<<1); 		write_pci_config(0, num, 3, 0x94, aper_alloc>>25); 	} } 
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/50895c5d76e15d8af480eff1aaab5770cabbc2c2/aperture.c/clean/arch/x86_64/kernel/aperture.c