Lines Matching +full:broken +full:- +full:turn +full:- +full:around

1 // SPDX-License-Identifier: GPL-2.0-only
42 A_SIZE_32(agp_bridge->driver->aperture_sizes); in uninorth_fetch_size()
50 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) in uninorth_fetch_size()
54 if (i == agp_bridge->driver->num_aperture_sizes) { in uninorth_fetch_size()
55 dev_err(&agp_bridge->dev->dev, "invalid aperture size, " in uninorth_fetch_size()
63 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) in uninorth_fetch_size()
68 agp_bridge->previous_size = in uninorth_fetch_size()
69 agp_bridge->current_size = (void *)(values + i); in uninorth_fetch_size()
70 agp_bridge->aperture_size_idx = i; in uninorth_fetch_size()
80 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, in uninorth_tlbflush()
82 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, ctrl); in uninorth_tlbflush()
85 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, in uninorth_tlbflush()
87 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, in uninorth_tlbflush()
96 pci_read_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, &tmp); in uninorth_cleanup()
100 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, tmp); in uninorth_cleanup()
101 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, 0); in uninorth_cleanup()
104 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, in uninorth_cleanup()
106 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, in uninorth_cleanup()
115 current_size = A_SIZE_32(agp_bridge->current_size); in uninorth_configure()
117 dev_info(&agp_bridge->dev->dev, "configuring for size idx: %d\n", in uninorth_configure()
118 current_size->size_value); in uninorth_configure()
121 pci_write_config_dword(agp_bridge->dev, in uninorth_configure()
123 (agp_bridge->gatt_bus_addr & 0xfffff000) in uninorth_configure()
124 | current_size->size_value); in uninorth_configure()
130 agp_bridge->gart_bus_addr = 0; in uninorth_configure()
134 pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_AGP_BASE, in uninorth_configure()
135 (agp_bridge->gatt_bus_addr >> 32) & 0xf); in uninorth_configure()
137 pci_write_config_dword(agp_bridge->dev, in uninorth_configure()
138 UNI_N_CFG_AGP_BASE, agp_bridge->gart_bus_addr); in uninorth_configure()
142 pci_write_config_dword(agp_bridge->dev, in uninorth_configure()
144 page_to_phys(agp_bridge->scratch_page_page) >> 12); in uninorth_configure()
157 if (type != mem->type) in uninorth_insert_memory()
158 return -EINVAL; in uninorth_insert_memory()
160 mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type); in uninorth_insert_memory()
163 return -EINVAL; in uninorth_insert_memory()
166 if (mem->page_count == 0) in uninorth_insert_memory()
169 temp = agp_bridge->current_size; in uninorth_insert_memory()
170 num_entries = A_SIZE_32(temp)->num_entries; in uninorth_insert_memory()
172 if ((pg_start + mem->page_count) > num_entries) in uninorth_insert_memory()
173 return -EINVAL; in uninorth_insert_memory()
175 gp = (u32 *) &agp_bridge->gatt_table[pg_start]; in uninorth_insert_memory()
176 for (i = 0; i < mem->page_count; ++i) { in uninorth_insert_memory()
178 dev_info(&agp_bridge->dev->dev, in uninorth_insert_memory()
181 return -EBUSY; in uninorth_insert_memory()
185 for (i = 0; i < mem->page_count; i++) { in uninorth_insert_memory()
187 gp[i] = (page_to_phys(mem->pages[i]) >> PAGE_SHIFT) | 0x80000000UL; in uninorth_insert_memory()
189 gp[i] = cpu_to_le32((page_to_phys(mem->pages[i]) & 0xFFFFF000UL) | in uninorth_insert_memory()
191 flush_dcache_range((unsigned long)__va(page_to_phys(mem->pages[i])), in uninorth_insert_memory()
192 (unsigned long)__va(page_to_phys(mem->pages[i]))+0x1000); in uninorth_insert_memory()
206 if (type != mem->type) in uninorth_remove_memory()
207 return -EINVAL; in uninorth_remove_memory()
209 mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type); in uninorth_remove_memory()
212 return -EINVAL; in uninorth_remove_memory()
215 if (mem->page_count == 0) in uninorth_remove_memory()
218 gp = (u32 *) &agp_bridge->gatt_table[pg_start]; in uninorth_remove_memory()
219 for (i = 0; i < mem->page_count; ++i) { in uninorth_remove_memory()
233 pci_read_config_dword(bridge->dev, in uninorth_agp_enable()
234 bridge->capndx + PCI_AGP_STATUS, in uninorth_agp_enable()
243 * may assume it's broken. This is an AGP2 controller. in uninorth_agp_enable()
262 pci_write_config_dword(bridge->dev, in uninorth_agp_enable()
263 bridge->capndx + PCI_AGP_COMMAND, in uninorth_agp_enable()
265 pci_read_config_dword(bridge->dev, in uninorth_agp_enable()
266 bridge->capndx + PCI_AGP_COMMAND, in uninorth_agp_enable()
270 dev_err(&bridge->dev->dev, "can't write UniNorth AGP " in uninorth_agp_enable()
299 return -ENODEV; in agp_uninorth_suspend()
302 if (bridge->dev_private_data) in agp_uninorth_suspend()
305 /* turn off AGP on the video chip, if it was enabled */ in agp_uninorth_suspend()
311 * bridge on the AGP port, and mucking around the entire PCI in agp_uninorth_suspend()
316 if (device->bus != pdev->bus) in agp_uninorth_suspend()
324 dev_info(&pdev->dev, "disabling AGP on device %s\n", in agp_uninorth_suspend()
330 /* turn off AGP on the bridge */ in agp_uninorth_suspend()
333 bridge->dev_private_data = (void *)(long)cmd; in agp_uninorth_suspend()
335 dev_info(&pdev->dev, "disabling AGP on bridge\n"); in agp_uninorth_suspend()
339 /* turn off the GART */ in agp_uninorth_suspend()
352 return -ENODEV; in agp_uninorth_resume()
354 command = (long)bridge->dev_private_data; in agp_uninorth_resume()
355 bridge->dev_private_data = NULL; in agp_uninorth_resume()
381 if (bridge->driver->size_type == LVL2_APER_SIZE) in uninorth_create_gatt_table()
382 return -EINVAL; in uninorth_create_gatt_table()
385 i = bridge->aperture_size_idx; in uninorth_create_gatt_table()
386 temp = bridge->current_size; in uninorth_create_gatt_table()
390 size = A_SIZE_32(temp)->size; in uninorth_create_gatt_table()
391 page_order = A_SIZE_32(temp)->page_order; in uninorth_create_gatt_table()
392 num_entries = A_SIZE_32(temp)->num_entries; in uninorth_create_gatt_table()
398 bridge->current_size = A_IDX32(bridge); in uninorth_create_gatt_table()
400 bridge->aperture_size_idx = i; in uninorth_create_gatt_table()
402 } while (!table && (i < bridge->driver->num_aperture_sizes)); in uninorth_create_gatt_table()
405 return -ENOMEM; in uninorth_create_gatt_table()
413 table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); in uninorth_create_gatt_table()
421 bridge->gatt_table_real = (u32 *) table; in uninorth_create_gatt_table()
425 bridge->gatt_table = vmap(uninorth_priv.pages_arr, (1 << page_order), 0, PAGE_KERNEL_NCG); in uninorth_create_gatt_table()
427 if (bridge->gatt_table == NULL) in uninorth_create_gatt_table()
430 bridge->gatt_bus_addr = virt_to_phys(table); in uninorth_create_gatt_table()
433 scratch_value = (page_to_phys(agp_bridge->scratch_page_page) >> PAGE_SHIFT) | 0x80000000UL; in uninorth_create_gatt_table()
435 scratch_value = cpu_to_le32((page_to_phys(agp_bridge->scratch_page_page) & 0xFFFFF000UL) | in uninorth_create_gatt_table()
438 bridge->gatt_table[i] = scratch_value; in uninorth_create_gatt_table()
446 return -ENOMEM; in uninorth_create_gatt_table()
456 temp = bridge->current_size; in uninorth_free_gatt_table()
457 page_order = A_SIZE_32(temp)->page_order; in uninorth_free_gatt_table()
464 vunmap(bridge->gatt_table); in uninorth_free_gatt_table()
466 table = (char *) bridge->gatt_table_real; in uninorth_free_gatt_table()
467 table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); in uninorth_free_gatt_table()
472 free_pages((unsigned long) bridge->gatt_table_real, page_order); in uninorth_free_gatt_table()
613 return -ENODEV; in agp_uninorth_probe()
617 if (pdev->device == devs[j].device_id) { in agp_uninorth_probe()
618 dev_info(&pdev->dev, "Apple %s chipset\n", in agp_uninorth_probe()
624 dev_err(&pdev->dev, "unsupported Apple chipset [%04x/%04x]\n", in agp_uninorth_probe()
625 pdev->vendor, pdev->device); in agp_uninorth_probe()
626 return -ENODEV; in agp_uninorth_probe()
632 /* Locate core99 Uni-N */ in agp_uninorth_probe()
633 uninorth_node = of_find_node_by_name(NULL, "uni-n"); in agp_uninorth_probe()
641 "device-rev", NULL); in agp_uninorth_probe()
655 return -ENOMEM; in agp_uninorth_probe()
658 bridge->driver = &u3_agp_driver; in agp_uninorth_probe()
660 bridge->driver = &uninorth_agp_driver; in agp_uninorth_probe()
662 bridge->dev = pdev; in agp_uninorth_probe()
663 bridge->capndx = cap_ptr; in agp_uninorth_probe()
664 bridge->flags = AGP_ERRATA_FASTWRITES; in agp_uninorth_probe()
667 pci_read_config_dword(pdev, cap_ptr+PCI_AGP_STATUS, &bridge->mode); in agp_uninorth_probe()
701 .name = "agpgart-uninorth",
710 return -EINVAL; in agp_uninorth_init()