Lines Matching refs:isc
67 #define READ1(off) bus_space_read_1(isc->bst, isc->bsh, off)
68 #define READ4(off) bus_space_read_4(isc->bst, isc->bsh, off)
69 #define WRITE4(off,v) bus_space_write_4(isc->bst, isc->bsh, off, v)
124 agp_i810_write_gtt_entry(struct agp_i810_softc *isc, off_t off, in agp_i810_write_gtt_entry() argument
147 if (isc->chiptype == CHIP_I965 || in agp_i810_write_gtt_entry()
148 isc->chiptype == CHIP_G33 || in agp_i810_write_gtt_entry()
149 isc->chiptype == CHIP_PINEVIEW || in agp_i810_write_gtt_entry()
150 isc->chiptype == CHIP_G4X) { in agp_i810_write_gtt_entry()
160 bus_space_write_4(isc->gtt_bst, isc->gtt_bsh, in agp_i810_write_gtt_entry()
167 agp_i810_post_gtt_entry(struct agp_i810_softc *isc, off_t off) in agp_i810_post_gtt_entry() argument
176 bus_space_barrier(isc->gtt_bst, isc->gtt_bsh, 0, isc->gtt_size, in agp_i810_post_gtt_entry()
178 (void)bus_space_read_4(isc->gtt_bst, isc->gtt_bsh, in agp_i810_post_gtt_entry()
190 agp_i810_chipset_flush(struct agp_i810_softc *isc) in agp_i810_chipset_flush() argument
194 switch (isc->chiptype) { in agp_i810_chipset_flush()
232 bus_space_write_4(isc->flush_bst, isc->flush_bsh, 0, 1); in agp_i810_chipset_flush()
316 struct agp_i810_softc *isc; in agp_i810_attach() local
323 isc = malloc(sizeof *isc, M_AGP, M_WAITOK|M_ZERO); in agp_i810_attach()
324 sc->as_chipc = isc; in agp_i810_attach()
327 if (pci_find_device(&isc->vga_pa, agp_i810_vgamatch) == 0) { in agp_i810_attach()
337 free(isc, M_AGP); in agp_i810_attach()
348 sc->as_dmat = isc->vga_pa.pa_dmat; in agp_i810_attach()
350 switch (PCI_PRODUCT(isc->vga_pa.pa_id)) { in agp_i810_attach()
355 isc->chiptype = CHIP_I810; in agp_i810_attach()
360 isc->chiptype = CHIP_I830; in agp_i810_attach()
365 isc->chiptype = CHIP_I855; in agp_i810_attach()
375 isc->chiptype = CHIP_I915; in agp_i810_attach()
388 isc->chiptype = CHIP_I965; in agp_i810_attach()
397 isc->chiptype = CHIP_G33; in agp_i810_attach()
402 isc->chiptype = CHIP_PINEVIEW; in agp_i810_attach()
414 isc->chiptype = CHIP_G4X; in agp_i810_attach()
421 switch (isc->chiptype) { in agp_i810_attach()
457 mmadr_type = pci_mapreg_type(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag, in agp_i810_attach()
484 switch (isc->chiptype) { in agp_i810_attach()
493 isc->size = 512*1024; in agp_i810_attach()
498 isc->size = 2*1024*1024; in agp_i810_attach()
502 if (pci_mapreg_info(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag, in agp_i810_attach()
503 mmadr_bar, mmadr_type, NULL, &isc->size, NULL)) in agp_i810_attach()
504 isc->size = 512*1024; in agp_i810_attach()
508 if (isc->chiptype == CHIP_I965 || isc->chiptype == CHIP_G4X) in agp_i810_attach()
509 error = agp_i965_map_aperture(&isc->vga_pa, sc, apbase); in agp_i810_attach()
511 error = agp_map_aperture(&isc->vga_pa, sc, apbase); in agp_i810_attach()
518 if (pci_mapreg_info(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag, mmadr_bar, in agp_i810_attach()
524 if (mmadr_size < isc->size) { in agp_i810_attach()
527 (uintmax_t)mmadr_size, (uintmax_t)isc->size); in agp_i810_attach()
531 isc->bst = isc->vga_pa.pa_memt; in agp_i810_attach()
532 error = bus_space_map(isc->bst, mmadr, isc->size, mmadr_flags, in agp_i810_attach()
533 &isc->bsh); in agp_i810_attach()
542 switch (isc->chiptype) { in agp_i810_attach()
562 agp_i810_vga_regsize = isc->size; in agp_i810_attach()
563 agp_i810_vga_bst = isc->bst; in agp_i810_attach()
564 agp_i810_vga_bsh = isc->bsh; in agp_i810_attach()
573 isc->gtt_bst = isc->bst; in agp_i810_attach()
574 if ((mmadr_size - gtt_off) < isc->gtt_size) { in agp_i810_attach()
579 (uintmax_t)isc->gtt_size); in agp_i810_attach()
589 if (isc->size < gtt_off) in agp_i810_attach()
590 error = bus_space_map(isc->gtt_bst, (mmadr + gtt_off), in agp_i810_attach()
591 isc->gtt_size, mmadr_flags, &isc->gtt_bsh); in agp_i810_attach()
593 error = bus_space_subregion(isc->bst, isc->bsh, in agp_i810_attach()
594 gtt_off, isc->gtt_size, &isc->gtt_bsh); in agp_i810_attach()
608 if (pci_mapreg_map(&isc->vga_pa, gtt_bar, PCI_MAPREG_TYPE_MEM, in agp_i810_attach()
610 &isc->gtt_bst, &isc->gtt_bsh, NULL, >t_bar_size)) { in agp_i810_attach()
615 if (gtt_bar_size != isc->gtt_size) { in agp_i810_attach()
621 (uintmax_t)isc->gtt_size); in agp_i810_attach()
622 isc->gtt_size = gtt_bar_size; in agp_i810_attach()
638 if ((gtt_bar != 0) || (isc->size < gtt_off)) in agp_i810_attach()
639 bus_space_unmap(isc->gtt_bst, isc->gtt_bsh, isc->gtt_size); in agp_i810_attach()
640 isc->gtt_size = 0; in agp_i810_attach()
645 fail3: switch (isc->chiptype) { in agp_i810_attach()
654 fail2: bus_space_unmap(isc->bst, isc->bsh, isc->size); in agp_i810_attach()
655 isc->size = 0; in agp_i810_attach()
656 fail1: free(isc, M_AGP); in agp_i810_attach()
676 struct agp_i810_softc *const isc = sc->as_chipc; in agp_i810_setup_chipset_flush_page() local
684 isc->flush_bst = isc->vga_pa.pa_memt; in agp_i810_setup_chipset_flush_page()
687 isc->flush_addr = 0; in agp_i810_setup_chipset_flush_page()
690 if (isc->chiptype == CHIP_I915) { in agp_i810_setup_chipset_flush_page()
721 error = bus_space_map(isc->flush_bst, addr & ~1, PAGE_SIZE, 0, in agp_i810_setup_chipset_flush_page()
722 &isc->flush_bsh); in agp_i810_setup_chipset_flush_page()
727 error = bus_space_alloc(isc->flush_bst, minaddr, maxaddr, in agp_i810_setup_chipset_flush_page()
729 &isc->flush_addr, &isc->flush_bsh); in agp_i810_setup_chipset_flush_page()
732 KASSERT(isc->flush_addr != 0); in agp_i810_setup_chipset_flush_page()
734 addr = isc->flush_addr | 1; in agp_i810_setup_chipset_flush_page()
735 if (isc->chiptype == CHIP_I915) { in agp_i810_setup_chipset_flush_page()
752 struct agp_i810_softc *const isc = sc->as_chipc; in agp_i810_teardown_chipset_flush_page() local
754 if (isc->flush_addr) { in agp_i810_teardown_chipset_flush_page()
756 if (isc->chiptype == CHIP_I915) { in agp_i810_teardown_chipset_flush_page()
765 isc->flush_addr = 0; in agp_i810_teardown_chipset_flush_page()
766 bus_space_free(isc->flush_bst, isc->flush_bsh, PAGE_SIZE); in agp_i810_teardown_chipset_flush_page()
769 bus_space_unmap(isc->flush_bst, isc->flush_bsh, PAGE_SIZE); in agp_i810_teardown_chipset_flush_page()
799 struct agp_i810_softc *isc; in agp_i810_init() local
802 isc = sc->as_chipc; in agp_i810_init()
804 if (isc->chiptype == CHIP_I810) { in agp_i810_init()
811 isc->dcache_size = 4 * 1024 * 1024; in agp_i810_init()
813 isc->dcache_size = 0; in agp_i810_init()
816 isc->gtt_size = 64 * 1024; in agp_i810_init()
818 gatt->ag_entries = isc->gtt_size / sizeof(uint32_t); in agp_i810_init()
819 error = agp_alloc_dmamem(sc->as_dmat, isc->gtt_size, in agp_i810_init()
835 isc->pgtblctl = gatt->ag_physical | 1; in agp_i810_init()
836 WRITE4(AGP_I810_PGTBL_CTL, isc->pgtblctl); in agp_i810_init()
837 isc->gatt = gatt; in agp_i810_init()
838 } else if (isc->chiptype == CHIP_I830) { in agp_i810_init()
844 isc->gtt_size = 128 * 1024; in agp_i810_init()
850 isc->stolen = (512 - 132) * 1024 / 4096; in agp_i810_init()
853 isc->stolen = (1024 - 132) * 1024 / 4096; in agp_i810_init()
856 isc->stolen = (8192 - 132) * 1024 / 4096; in agp_i810_init()
859 isc->stolen = 0; in agp_i810_init()
866 if (isc->stolen > 0) { in agp_i810_init()
869 isc->stolen * 4); in agp_i810_init()
873 isc->pgtblctl = READ4(AGP_I810_PGTBL_CTL); in agp_i810_init()
874 isc->pgtblctl |= 1; in agp_i810_init()
875 WRITE4(AGP_I810_PGTBL_CTL, isc->pgtblctl); in agp_i810_init()
876 } else if (isc->chiptype == CHIP_I855 || isc->chiptype == CHIP_I915 || in agp_i810_init()
877 isc->chiptype == CHIP_I965 || isc->chiptype == CHIP_G33 || in agp_i810_init()
878 isc->chiptype == CHIP_PINEVIEW || in agp_i810_init()
879 isc->chiptype == CHIP_G4X) { in agp_i810_init()
887 isc->pgtblctl = READ4(AGP_I810_PGTBL_CTL); in agp_i810_init()
893 switch (isc->chiptype) { in agp_i810_init()
901 switch (isc->pgtblctl & AGP_I810_PGTBL_SIZE_MASK) { in agp_i810_init()
950 switch (isc->pgtblctl & AGP_G4X_PGTBL_SIZE_MASK) { in agp_i810_init()
977 panic("impossible chiptype %d", isc->chiptype); in agp_i810_init()
1034 if (isc->chiptype != CHIP_I915 && in agp_i810_init()
1035 isc->chiptype != CHIP_I965 && in agp_i810_init()
1036 isc->chiptype != CHIP_G33 && in agp_i810_init()
1037 isc->chiptype != CHIP_PINEVIEW && in agp_i810_init()
1038 isc->chiptype != CHIP_G4X) in agp_i810_init()
1043 if (isc->chiptype != CHIP_I965 && in agp_i810_init()
1044 isc->chiptype != CHIP_G33 && in agp_i810_init()
1045 isc->chiptype != CHIP_PINEVIEW && in agp_i810_init()
1046 isc->chiptype != CHIP_G4X) in agp_i810_init()
1053 if (isc->chiptype != CHIP_I965 && in agp_i810_init()
1054 isc->chiptype != CHIP_G4X) in agp_i810_init()
1059 isc->gtt_size = gtt_size * 1024; in agp_i810_init()
1066 isc->stolen = (stolen - gtt_size) * 1024 / 4096; in agp_i810_init()
1068 if (isc->stolen > 0) { in agp_i810_init()
1071 isc->stolen * 4); in agp_i810_init()
1075 isc->pgtblctl |= 1; in agp_i810_init()
1076 WRITE4(AGP_I810_PGTBL_CTL, isc->pgtblctl); in agp_i810_init()
1105 struct agp_i810_softc *isc = sc->as_chipc;
1111 switch (isc->chiptype) {
1134 free(isc->gatt, M_AGP);
1144 struct agp_i810_softc *isc = sc->as_chipc; in agp_i810_get_aperture() local
1151 switch (isc->chiptype) { in agp_i810_get_aperture()
1199 struct agp_i810_softc *isc = sc->as_chipc; in agp_i810_bind_page() local
1201 if (offset < 0 || offset >= ((isc->gtt_size/4) << AGP_PAGE_SHIFT)) { in agp_i810_bind_page()
1206 (uintmax_t)isc->gtt_size/4); in agp_i810_bind_page()
1210 if (isc->chiptype != CHIP_I810) { in agp_i810_bind_page()
1211 if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) { in agp_i810_bind_page()
1217 return agp_i810_write_gtt_entry(isc, offset, physical, in agp_i810_bind_page()
1224 struct agp_i810_softc *isc = sc->as_chipc; in agp_i810_unbind_page() local
1226 if (offset < 0 || offset >= ((isc->gtt_size/4) << AGP_PAGE_SHIFT)) in agp_i810_unbind_page()
1229 if (isc->chiptype != CHIP_I810 ) { in agp_i810_unbind_page()
1230 if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) { in agp_i810_unbind_page()
1236 return agp_i810_write_gtt_entry(isc, offset, 0, 0); in agp_i810_unbind_page()
1261 struct agp_i810_softc *isc = sc->as_chipc; in agp_i810_alloc_memory() local
1274 if (size > ((isc->gtt_size/4) << AGP_PAGE_SHIFT)) in agp_i810_alloc_memory()
1281 if (isc->chiptype != CHIP_I810) in agp_i810_alloc_memory()
1283 if (size != isc->dcache_size) in agp_i810_alloc_memory()
1370 struct agp_i810_softc *isc = sc->as_chipc; in agp_i810_bind_memory() local
1383 pgtblctl = bus_space_read_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL); in agp_i810_bind_memory()
1384 if (pgtblctl != isc->pgtblctl) { in agp_i810_bind_memory()
1387 bus_space_write_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL, in agp_i810_bind_memory()
1388 isc->pgtblctl); in agp_i810_bind_memory()
1394 0, (isc->gtt_size/4) << AGP_PAGE_SHIFT); in agp_i810_bind_memory()
1416 struct agp_i810_softc *const isc __diagused = sc->as_chipc; in agp_i810_bind_memory_dcache()
1420 KASSERT(isc->chiptype == CHIP_I810); in agp_i810_bind_memory_dcache()
1424 error = agp_i810_write_gtt_entry(isc, offset + i, in agp_i810_bind_memory_dcache()
1466 struct agp_i810_softc *isc __diagused = sc->as_chipc; in agp_i810_unbind_memory()
1476 KASSERT(isc->chiptype == CHIP_I810); in agp_i810_unbind_memory()
1492 agp_i810_reset(struct agp_i810_softc *isc) in agp_i810_reset() argument
1496 bus_space_write_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL, in agp_i810_reset()
1497 isc->pgtblctl); in agp_i810_reset()
1506 struct agp_i810_softc *isc = sc->as_chipc; in agp_i810_resume() local
1508 agp_i810_reset(isc); in agp_i810_resume()