/* Get the current Aperture size from the x86-64. Note, that there may be multiple x86-64's, but we just return the value from the first one we find. The set_size functions keep the rest coherent anyway. Or at least should do.  */
static int amd64_fetch_size(void)
/* Get the current Aperture size from the x86-64. Note, that there may be multiple x86-64's, but we just return the value from the first one we find. The set_size functions keep the rest coherent anyway. Or at least should do.  */
static int amd64_fetch_size(void)
{
	struct pci_dev *dev;
	int i;
	u32 temp;
	struct aper_size_info_32 *values;
	dev = k8_northbridges[0];
	if (dev==NULL)
		return 0;
	pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &temp);
	temp = (temp & 0xe);
	values = A_SIZE_32(amd64_aperture_sizes);
	for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
		if (temp == values[i].size_value) {
			agp_bridge->previous_size =
			    agp_bridge->current_size = (void *) (values + i);
			agp_bridge->aperture_size_idx = i;
			return values[i].size;
		}
	}
	return 0;
}