/* * NOTES for uninorth3 (G5 AGP) supports : * * There maybe also possibility to have bigger cache line size for * agp (see pmac_pci.c and look for cache line). Need to be investigated * by someone. * * PAGE size are hardcoded but this may change, see asm/page.h. * * Jerome Glisse <j.glisse@gmail.com>
*/ staticint uninorth_rev; staticint is_u3; static u32 scratch_value;
/* HACK ALERT * UniNorth seem to be buggy enough not to handle properly when * the AGP aperture isn't mapped at bus physical address 0
*/
agp_bridge->gart_bus_addr = 0; #ifdef CONFIG_PPC64 /* Assume U3 or later on PPC64 systems */ /* high 4 bits of GART physical address go in UNI_N_CFG_AGP_BASE */
pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_AGP_BASE,
(agp_bridge->gatt_bus_addr >> 32) & 0xf); #else
pci_write_config_dword(agp_bridge->dev,
UNI_N_CFG_AGP_BASE, agp_bridge->gart_bus_addr); #endif
if (is_u3) {
pci_write_config_dword(agp_bridge->dev,
UNI_N_CFG_GART_DUMMY_PAGE,
page_to_phys(agp_bridge->scratch_page_page) >> 12);
}
return 0;
}
staticint uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
{ int i, num_entries; void *temp;
u32 *gp; int mask_type;
if (type != mem->type) return -EINVAL;
mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type); if (mask_type != 0) { /* We know nothing of memory types */ return -EINVAL;
}
if (uninorth_rev == 0x21) { /* * Darwin disable AGP 4x on this revision, thus we * may assume it's broken. This is an AGP2 controller.
*/
command &= ~AGPSTAT2_4X;
}
if ((uninorth_rev >= 0x30) && (uninorth_rev <= 0x33)) { /* * We need to set REQ_DEPTH to 7 for U3 versions 1.0, 2.1, * 2.2 and 2.3, Darwin do so.
*/ if ((command >> AGPSTAT_RQ_DEPTH_SHIFT) > 7)
command = (command & ~AGPSTAT_RQ_DEPTH)
| (7 << AGPSTAT_RQ_DEPTH_SHIFT);
}
if (uninorth_rev >= 0x30) { /* This is an AGP V3 */
agp_device_command(command, (status & AGPSTAT_MODE_3_0) != 0);
} else { /* AGP V2 */
agp_device_command(command, false);
}
uninorth_tlbflush(NULL);
}
#ifdef CONFIG_PM /* * These Power Management routines are _not_ called by the normal PCI PM layer, * but directly by the video driver through function pointers in the device * tree.
*/ staticint agp_uninorth_suspend(struct pci_dev *pdev)
{ struct agp_bridge_data *bridge;
u32 cmd;
u8 agp; struct pci_dev *device = NULL;
bridge = agp_find_bridge(pdev); if (bridge == NULL) return -ENODEV;
/* Only one suspend supported */ if (bridge->dev_private_data) return 0;
/* turn off AGP on the video chip, if it was enabled */
for_each_pci_dev(device) { /* Don't touch the bridge yet, device first */ if (device == pdev) continue; /* Only deal with devices on the same bus here, no Mac has a P2P * bridge on the AGP port, and mucking around the entire PCI * tree is source of problems on some machines because of a bug * in some versions of pci_find_capability() when hitting a dead * device
*/ if (device->bus != pdev->bus) continue;
agp = pci_find_capability(device, PCI_CAP_ID_AGP); if (!agp) continue;
pci_read_config_dword(device, agp + PCI_AGP_COMMAND, &cmd); if (!(cmd & PCI_AGP_COMMAND_AGP)) continue;
dev_info(&pdev->dev, "disabling AGP on device %s\n",
pci_name(device));
cmd &= ~PCI_AGP_COMMAND_AGP;
pci_write_config_dword(device, agp + PCI_AGP_COMMAND, cmd);
}
/* turn off AGP on the bridge */
agp = pci_find_capability(pdev, PCI_CAP_ID_AGP);
pci_read_config_dword(pdev, agp + PCI_AGP_COMMAND, &cmd);
bridge->dev_private_data = (void *)(long)cmd; if (cmd & PCI_AGP_COMMAND_AGP) {
dev_info(&pdev->dev, "disabling AGP on bridge\n");
cmd &= ~PCI_AGP_COMMAND_AGP;
pci_write_config_dword(pdev, agp + PCI_AGP_COMMAND, cmd);
} /* turn off the GART */
uninorth_cleanup();
for (page = virt_to_page(table), i = 0; page <= virt_to_page(table_end);
page++, i++) {
SetPageReserved(page);
uninorth_priv.pages_arr[i] = page;
}
bridge->gatt_table_real = (u32 *) table; /* Need to clear out any dirty data still sitting in caches */
flush_dcache_range((unsignedlong)table,
(unsignedlong)table_end + 1);
bridge->gatt_table = vmap(uninorth_priv.pages_arr, (1 << page_order), 0, PAGE_KERNEL_NCG);
if (bridge->gatt_table == NULL) goto enomem;
bridge->gatt_bus_addr = virt_to_phys(table);
if (is_u3)
scratch_value = (page_to_phys(agp_bridge->scratch_page_page) >> PAGE_SHIFT) | 0x80000000UL; else
scratch_value = cpu_to_le32((page_to_phys(agp_bridge->scratch_page_page) & 0xFFFFF000UL) |
0x1UL); for (i = 0; i < num_entries; i++)
bridge->gatt_table[i] = scratch_value;
return 0;
enomem:
kfree(uninorth_priv.pages_arr); if (table)
free_pages((unsignedlong)table, page_order); return -ENOMEM;
}
module_param(aperture, charp, 0);
MODULE_PARM_DESC(aperture, "Aperture size, must be power of two between 4MB and an\n" "\t\tupper limit specific to the UniNorth revision.\n" "\t\tDefault: " DEFAULT_APERTURE_STRING "M");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.