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