Lines Matching refs:hp
79 struct _hp_private *hp = &hp_private; in hp_zx1_ioc_shared() local
89 hp->io_tlb_ps = readq(hp->ioc_regs+HP_ZX1_TCNFG); in hp_zx1_ioc_shared()
90 switch (hp->io_tlb_ps) { in hp_zx1_ioc_shared()
91 case 0: hp->io_tlb_shift = 12; break; in hp_zx1_ioc_shared()
92 case 1: hp->io_tlb_shift = 13; break; in hp_zx1_ioc_shared()
93 case 2: hp->io_tlb_shift = 14; break; in hp_zx1_ioc_shared()
94 case 3: hp->io_tlb_shift = 16; break; in hp_zx1_ioc_shared()
97 "configuration 0x%x\n", hp->io_tlb_ps); in hp_zx1_ioc_shared()
98 hp->gatt = NULL; in hp_zx1_ioc_shared()
99 hp->gatt_entries = 0; in hp_zx1_ioc_shared()
102 hp->io_page_size = 1 << hp->io_tlb_shift; in hp_zx1_ioc_shared()
103 hp->io_pages_per_kpage = PAGE_SIZE / hp->io_page_size; in hp_zx1_ioc_shared()
105 hp->iova_base = readq(hp->ioc_regs+HP_ZX1_IBASE) & ~0x1; in hp_zx1_ioc_shared()
106 hp->gart_base = hp->iova_base + HP_ZX1_IOVA_SIZE - HP_ZX1_GART_SIZE; in hp_zx1_ioc_shared()
108 hp->gart_size = HP_ZX1_GART_SIZE; in hp_zx1_ioc_shared()
109 hp->gatt_entries = hp->gart_size / hp->io_page_size; in hp_zx1_ioc_shared()
111 hp->io_pdir = phys_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE)); in hp_zx1_ioc_shared()
112 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)]; in hp_zx1_ioc_shared()
114 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) { in hp_zx1_ioc_shared()
116 hp->gatt = NULL; in hp_zx1_ioc_shared()
117 hp->gatt_entries = 0; in hp_zx1_ioc_shared()
129 struct _hp_private *hp = &hp_private; in hp_zx1_ioc_owner() local
137 hp->io_tlb_shift = 16; in hp_zx1_ioc_owner()
138 hp->io_tlb_ps = 3; in hp_zx1_ioc_owner()
140 hp->io_tlb_shift = 14; in hp_zx1_ioc_owner()
141 hp->io_tlb_ps = 2; in hp_zx1_ioc_owner()
143 hp->io_tlb_shift = 13; in hp_zx1_ioc_owner()
144 hp->io_tlb_ps = 1; in hp_zx1_ioc_owner()
146 hp->io_tlb_shift = 12; in hp_zx1_ioc_owner()
147 hp->io_tlb_ps = 0; in hp_zx1_ioc_owner()
149 hp->io_page_size = 1 << hp->io_tlb_shift; in hp_zx1_ioc_owner()
150 hp->io_pages_per_kpage = PAGE_SIZE / hp->io_page_size; in hp_zx1_ioc_owner()
152 hp->iova_base = HP_ZX1_IOVA_BASE; in hp_zx1_ioc_owner()
153 hp->gart_size = HP_ZX1_GART_SIZE; in hp_zx1_ioc_owner()
154 hp->gart_base = hp->iova_base + HP_ZX1_IOVA_SIZE - hp->gart_size; in hp_zx1_ioc_owner()
156 hp->gatt_entries = hp->gart_size / hp->io_page_size; in hp_zx1_ioc_owner()
157 hp->io_pdir_size = (HP_ZX1_IOVA_SIZE / hp->io_page_size) * sizeof(u64); in hp_zx1_ioc_owner()
165 struct _hp_private *hp = &hp_private; in hp_zx1_ioc_init() local
167 hp->ioc_regs = ioremap(hpa, 1024); in hp_zx1_ioc_init()
168 if (!hp->ioc_regs) in hp_zx1_ioc_init()
175 hp->io_pdir_owner = (readq(hp->ioc_regs+HP_ZX1_IBASE) & 0x1) == 0; in hp_zx1_ioc_init()
177 if (hp->io_pdir_owner) in hp_zx1_ioc_init()
209 struct _hp_private *hp = &hp_private; in hp_zx1_lba_init() local
212 hp->lba_regs = ioremap(hpa, 256); in hp_zx1_lba_init()
213 if (!hp->lba_regs) in hp_zx1_lba_init()
216 hp->lba_cap_offset = hp_zx1_lba_find_capability(hp->lba_regs, PCI_CAP_ID_AGP); in hp_zx1_lba_init()
218 cap = readl(hp->lba_regs+hp->lba_cap_offset) & 0xff; in hp_zx1_lba_init()
221 cap, hp->lba_cap_offset); in hp_zx1_lba_init()
222 iounmap(hp->lba_regs); in hp_zx1_lba_init()
243 struct _hp_private *hp = &hp_private; in hp_zx1_configure() local
245 agp_bridge->gart_bus_addr = hp->gart_base; in hp_zx1_configure()
246 agp_bridge->capndx = hp->lba_cap_offset; in hp_zx1_configure()
247 agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); in hp_zx1_configure()
249 if (hp->io_pdir_owner) { in hp_zx1_configure()
250 writel(virt_to_phys(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE); in hp_zx1_configure()
251 readl(hp->ioc_regs+HP_ZX1_PDIR_BASE); in hp_zx1_configure()
252 writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG); in hp_zx1_configure()
253 readl(hp->ioc_regs+HP_ZX1_TCNFG); in hp_zx1_configure()
254 writel((unsigned int)(~(HP_ZX1_IOVA_SIZE-1)), hp->ioc_regs+HP_ZX1_IMASK); in hp_zx1_configure()
255 readl(hp->ioc_regs+HP_ZX1_IMASK); in hp_zx1_configure()
256 writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); in hp_zx1_configure()
257 readl(hp->ioc_regs+HP_ZX1_IBASE); in hp_zx1_configure()
258 writel(hp->iova_base|ilog2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); in hp_zx1_configure()
259 readl(hp->ioc_regs+HP_ZX1_PCOM); in hp_zx1_configure()
268 struct _hp_private *hp = &hp_private; in hp_zx1_cleanup() local
270 if (hp->ioc_regs) { in hp_zx1_cleanup()
271 if (hp->io_pdir_owner) { in hp_zx1_cleanup()
272 writeq(0, hp->ioc_regs+HP_ZX1_IBASE); in hp_zx1_cleanup()
273 readq(hp->ioc_regs+HP_ZX1_IBASE); in hp_zx1_cleanup()
275 iounmap(hp->ioc_regs); in hp_zx1_cleanup()
277 if (hp->lba_regs) in hp_zx1_cleanup()
278 iounmap(hp->lba_regs); in hp_zx1_cleanup()
284 struct _hp_private *hp = &hp_private; in hp_zx1_tlbflush() local
286 writeq(hp->gart_base | ilog2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); in hp_zx1_tlbflush()
287 readq(hp->ioc_regs+HP_ZX1_PCOM); in hp_zx1_tlbflush()
293 struct _hp_private *hp = &hp_private; in hp_zx1_create_gatt_table() local
296 if (hp->io_pdir_owner) { in hp_zx1_create_gatt_table()
297 hp->io_pdir = (u64 *) __get_free_pages(GFP_KERNEL, in hp_zx1_create_gatt_table()
298 get_order(hp->io_pdir_size)); in hp_zx1_create_gatt_table()
299 if (!hp->io_pdir) { in hp_zx1_create_gatt_table()
302 hp->gatt = NULL; in hp_zx1_create_gatt_table()
303 hp->gatt_entries = 0; in hp_zx1_create_gatt_table()
306 memset(hp->io_pdir, 0, hp->io_pdir_size); in hp_zx1_create_gatt_table()
308 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)]; in hp_zx1_create_gatt_table()
311 for (i = 0; i < hp->gatt_entries; i++) { in hp_zx1_create_gatt_table()
312 hp->gatt[i] = (unsigned long) agp_bridge->scratch_page; in hp_zx1_create_gatt_table()
321 struct _hp_private *hp = &hp_private; in hp_zx1_free_gatt_table() local
323 if (hp->io_pdir_owner) in hp_zx1_free_gatt_table()
324 free_pages((unsigned long) hp->io_pdir, in hp_zx1_free_gatt_table()
325 get_order(hp->io_pdir_size)); in hp_zx1_free_gatt_table()
327 hp->gatt[0] = HP_ZX1_SBA_IOMMU_COOKIE; in hp_zx1_free_gatt_table()
334 struct _hp_private *hp = &hp_private; in hp_zx1_insert_memory() local
344 io_pg_start = hp->io_pages_per_kpage * pg_start; in hp_zx1_insert_memory()
345 io_pg_count = hp->io_pages_per_kpage * mem->page_count; in hp_zx1_insert_memory()
346 if ((io_pg_start + io_pg_count) > hp->gatt_entries) { in hp_zx1_insert_memory()
352 if (hp->gatt[j]) { in hp_zx1_insert_memory()
368 k < hp->io_pages_per_kpage; in hp_zx1_insert_memory()
369 k++, j++, paddr += hp->io_page_size) { in hp_zx1_insert_memory()
370 hp->gatt[j] = HP_ZX1_PDIR_VALID_BIT | paddr; in hp_zx1_insert_memory()
381 struct _hp_private *hp = &hp_private; in hp_zx1_remove_memory() local
389 io_pg_start = hp->io_pages_per_kpage * pg_start; in hp_zx1_remove_memory()
390 io_pg_count = hp->io_pages_per_kpage * mem->page_count; in hp_zx1_remove_memory()
392 hp->gatt[i] = agp_bridge->scratch_page; in hp_zx1_remove_memory()
408 struct _hp_private *hp = &hp_private; in hp_zx1_enable() local
411 command = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); in hp_zx1_enable()
415 writel(command, hp->lba_regs+hp->lba_cap_offset+PCI_AGP_COMMAND); in hp_zx1_enable()