16 #include <linux/module.h>
17 #include <linux/pci.h>
22 #include <linux/slab.h>
29 #define DRVNAME "quicksilver"
30 #define DRVPFX DRVNAME ": "
32 #define AGP8X_MODE_BIT 3
33 #define AGP8X_MODE (1 << AGP8X_MODE_BIT)
39 static struct _parisc_agp_info {
52 int io_pages_per_kpage;
55 static struct gatt_mask parisc_agp_masks[] =
69 parisc_agp_fetch_size(
void)
73 size = parisc_agp_info.gart_size /
MB(1);
75 agp_bridge->current_size = (
void *) &parisc_agp_sizes[0];
81 parisc_agp_configure(
void)
83 struct _parisc_agp_info *
info = &parisc_agp_info;
95 struct _parisc_agp_info *
info = &parisc_agp_info;
104 struct _parisc_agp_info *info = &parisc_agp_info;
107 for (i = 0; i < info->gatt_entries; i++) {
117 struct _parisc_agp_info *info = &parisc_agp_info;
127 struct _parisc_agp_info *info = &parisc_agp_info;
132 if (type != 0 || mem->
type != 0) {
136 io_pg_start = info->io_pages_per_kpage * pg_start;
137 io_pg_count = info->io_pages_per_kpage * mem->
page_count;
138 if ((io_pg_start + io_pg_count) > info->gatt_entries) {
143 while (j < (io_pg_start + io_pg_count)) {
154 for (i = 0, j = io_pg_start; i < mem->
page_count; i++) {
159 k < info->io_pages_per_kpage;
160 k++, j++, paddr += info->io_page_size) {
173 parisc_agp_remove_memory(
struct agp_memory *mem,
off_t pg_start,
int type)
175 struct _parisc_agp_info *info = &parisc_agp_info;
176 int i, io_pg_start, io_pg_count;
178 if (type != 0 || mem->
type != 0) {
182 io_pg_start = info->io_pages_per_kpage * pg_start;
183 io_pg_count = info->io_pages_per_kpage * mem->
page_count;
184 for (i = io_pg_start; i < io_pg_count + io_pg_start; i++) {
202 struct _parisc_agp_info *info = &parisc_agp_info;
208 command |= 0x00000100;
218 .configure = parisc_agp_configure,
219 .fetch_size = parisc_agp_fetch_size,
220 .tlb_flush = parisc_agp_tlbflush,
221 .mask_memory = parisc_agp_mask_memory,
222 .masks = parisc_agp_masks,
223 .agp_enable = parisc_agp_enable,
225 .create_gatt_table = parisc_agp_create_gatt_table,
226 .free_gatt_table = parisc_agp_free_gatt_table,
227 .insert_memory = parisc_agp_insert_memory,
228 .remove_memory = parisc_agp_remove_memory,
236 .cant_use_aperture =
true,
240 agp_ioc_init(
void __iomem *ioc_regs)
242 struct _parisc_agp_info *info = &parisc_agp_info;
243 u64 iova_base, *io_pdir, io_tlb_ps;
248 info->ioc_regs = ioc_regs;
252 case 0: io_tlb_shift = 12;
break;
253 case 1: io_tlb_shift = 13;
break;
254 case 2: io_tlb_shift = 14;
break;
255 case 3: io_tlb_shift = 16;
break;
258 "configuration 0x%llx\n", io_tlb_ps);
260 info->gatt_entries = 0;
263 info->io_page_size = 1 << io_tlb_shift;
264 info->io_pages_per_kpage =
PAGE_SIZE / info->io_page_size;
270 info->gatt_entries = info->gart_size / info->io_page_size;
277 info->gatt_entries = 0;
287 lba_find_capability(
int cap)
289 struct _parisc_agp_info *info = &parisc_agp_info;
298 while (ttl-- && pos >= 0x40) {
311 agp_lba_init(
void __iomem *lba_hpa)
313 struct _parisc_agp_info *info = &parisc_agp_info;
316 info->lba_regs = lba_hpa;
319 cap =
readl(lba_hpa + info->lba_cap_offset) & 0xff;
322 cap, info->lba_cap_offset);
337 if (!fake_bridge_dev) {
342 error = agp_ioc_init(ioc_hpa);
346 error = agp_lba_init(lba_hpa);
355 bridge->
driver = &parisc_agp_driver;
359 bridge->
dev = fake_bridge_dev;
367 kfree(fake_bridge_dev);
377 if (IS_QUICKSILVER(padev))
384 parisc_agp_init(
void)
397 if (!IS_PLUTO(sba)) {
410 lbadev = parisc_get_drvdata(lba);
413 parisc_agp_setup(sba_list->
ioc[0].ioc_hpa, lbadev->
hba.base_addr);