bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real); 
bridge->gatt_bus_addr = virt_to_gart(bridge->gatt_table_real); 
int agp_generic_create_gatt_table(struct agp_bridge_data *bridge){	char *table;	char *table_end;	int size;	int page_order;	int num_entries;	int i;	void *temp;	struct page *page;	/* The generic routines can't handle 2 level gatt's */	if (bridge->driver->size_type == LVL2_APER_SIZE)		return -EINVAL;	table = NULL;	i = bridge->aperture_size_idx;	temp = bridge->current_size;	size = page_order = num_entries = 0;	if (bridge->driver->size_type != FIXED_APER_SIZE) {		do {			switch (bridge->driver->size_type) {			case U8_APER_SIZE:				size = A_SIZE_8(temp)->size;				page_order =				    A_SIZE_8(temp)->page_order;				num_entries =				    A_SIZE_8(temp)->num_entries;				break;			case U16_APER_SIZE:				size = A_SIZE_16(temp)->size;				page_order = A_SIZE_16(temp)->page_order;				num_entries = A_SIZE_16(temp)->num_entries;				break;			case U32_APER_SIZE:				size = A_SIZE_32(temp)->size;				page_order = A_SIZE_32(temp)->page_order;				num_entries = A_SIZE_32(temp)->num_entries;				break;				/* This case will never really happen. */			case FIXED_APER_SIZE:			case LVL2_APER_SIZE:			default:				size = page_order = num_entries = 0;				break;			}			table = (char *) __get_free_pages(GFP_KERNEL,							  page_order);			if (table == NULL) {				i++;				switch (bridge->driver->size_type) {				case U8_APER_SIZE:					bridge->current_size = A_IDX8(bridge);					break;				case U16_APER_SIZE:					bridge->current_size = A_IDX16(bridge);					break;				case U32_APER_SIZE:					bridge->current_size = A_IDX32(bridge);					break;					/* This case will never really happen. */				case FIXED_APER_SIZE:				case LVL2_APER_SIZE:				default:					bridge->current_size =					    bridge->current_size;					break;				}				temp = bridge->current_size;			} else {				bridge->aperture_size_idx = i;			}		} while (!table && (i < bridge->driver->num_aperture_sizes));	} else {		size = ((struct aper_size_info_fixed *) temp)->size;		page_order = ((struct aper_size_info_fixed *) temp)->page_order;		num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;		table = (char *) __get_free_pages(GFP_KERNEL, page_order);	}	if (table == NULL)		return -ENOMEM;	table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);	for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)		SetPageReserved(page);	bridge->gatt_table_real = (u32 *) table;	agp_gatt_table = (void *)table;	bridge->driver->cache_flush();	bridge->gatt_table = ioremap_nocache(virt_to_phys(table),					(PAGE_SIZE * (1 << page_order)));	bridge->driver->cache_flush();	if (bridge->gatt_table == NULL) {		for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)			ClearPageReserved(page);		free_pages((unsigned long) table, page_order);		return -ENOMEM;	}	bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real);	/* AK: bogus, should encode addresses > 4GB */	for (i = 0; i < num_entries; i++) {		writel(bridge->scratch_page, bridge->gatt_table+i);		readl(bridge->gatt_table+i);	/* PCI Posting. */	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/07eee78ea8ba2d0b7b20551c35a3e7dd158d50bb/generic.c/clean/drivers/char/agp/generic.c