Lines Matching refs:softstate
56 /* Driver global softstate handle */
186 agp_find_bound_keyent(agpgart_softstate_t *softstate, uint32_t pg_offset);
199 agpgart_softstate_t *softstate;
207 softstate = ctxp->actx_sc;
208 ASSERT(softstate);
212 newctxp1->actx_sc = softstate;
219 newctxp2->actx_sc = softstate;
224 mutex_enter(&softstate->asoft_instmutex);
227 agp_find_bound_keyent(softstate, AGP_BYTES2PAGES(off));
232 agp_find_bound_keyent(softstate, AGP_BYTES2PAGES(off));
237 mutex_exit(&softstate->asoft_instmutex);
246 agpgart_softstate_t *softstate;
253 softstate = ddi_get_soft_state(agpgart_glob_soft_handle, instance);
254 if (softstate == NULL) {
259 ASSERT(softstate);
260 ASSERT(mutex_owned(&softstate->asoft_instmutex));
265 agp_find_bound_keyent(softstate, AGP_BYTES2PAGES(offset));
271 newctxp->actx_sc = softstate;
283 agpgart_softstate_t *softstate;
294 softstate = (agpgart_softstate_t *)newctxp->actx_sc;
296 mutex_enter(&softstate->asoft_instmutex);
297 mementry = agp_find_bound_keyent(softstate,
301 mutex_exit(&softstate->asoft_instmutex);
1230 agp_fill_empty_keyent(agpgart_softstate_t *softstate, keytable_ent_t *entryp)
1235 ASSERT(softstate);
1239 ASSERT(mutex_owned(&softstate->asoft_instmutex));
1242 newentryp = &softstate->asoft_table[key];
1278 agp_find_bound_keyent(agpgart_softstate_t *softstate, uint32_t pg_offset)
1283 ASSERT(softstate);
1284 ASSERT(mutex_owned(&softstate->asoft_instmutex));
1287 entryp = &softstate->asoft_table[keycount];
1420 * softstate driver soft state pointer
1429 agp_unbind_key(agpgart_softstate_t *softstate, keytable_ent_t *entryp)
1449 AGP_MB2PAGES(softstate->asoft_info.agpki_apersize));
1450 ASSERT((softstate->asoft_devreg.agprd_arctype != ARC_UNKNOWN));
1452 switch (softstate->asoft_devreg.agprd_arctype) {
1457 &softstate->asoft_devreg);
1469 softstate->gart_dma_handle,
1470 (uint32_t *)softstate->gart_vbase);
1472 lyr_flush_gart_cache(&softstate->asoft_devreg);
1586 agp_del_allkeys(agpgart_softstate_t *softstate)
1591 ASSERT(softstate);
1593 if (softstate->asoft_table[key].kte_memhdl != NULL) {
1599 if (agp_dealloc_mem(softstate,
1600 &softstate->asoft_table[key]))
1758 copyinfo(agpgart_softstate_t *softstate, agp_info_t *info)
1760 switch (softstate->asoft_devreg.agprd_arctype) {
1765 info->agpi_devid = softstate->asoft_info.agpki_mdevid;
1770 info->agpi_version = softstate->asoft_info.agpki_tver;
1771 info->agpi_devid = softstate->asoft_info.agpki_tdevid;
1772 info->agpi_mode = softstate->asoft_info.agpki_tstatus;
1781 info->agpi_aperbase = softstate->asoft_info.agpki_aperbase;
1782 info->agpi_apersize = softstate->asoft_info.agpki_apersize;
1783 info->agpi_pgtotal = softstate->asoft_pgtotal;
1785 info->agpi_pgused = softstate->asoft_pgused;
1960 agp_setup(agpgart_softstate_t *softstate, uint32_t mode)
1965 tstatus = softstate->asoft_info.agpki_tstatus;
1966 mstatus = softstate->asoft_info.agpki_mstatus;
1977 if ((softstate->asoft_info.agpki_tver.agpv_major == 3) &&
1980 if ((softstate->asoft_info.agpki_mver.agpv_major != 3) ||
1987 &softstate->asoft_devreg))
1990 softstate->asoft_mode = agp_mode;
2000 if ((softstate->asoft_info.agpki_mver.agpv_major == 3) &&
2005 if (lyr_set_agp_cmd(agp_mode, &softstate->asoft_devreg))
2007 softstate->asoft_mode = agp_mode;
2030 agp_alloc_kmem(agpgart_softstate_t *softstate, size_t length, int type)
2054 if (ddi_dma_alloc_handle(softstate->asoft_dip,
2114 ASSERT(!agp_check_pfns(softstate->asoft_devreg.agprd_arctype,
2116 if (agp_check_pfns(softstate->asoft_devreg.agprd_arctype,
2119 entryp = agp_fill_empty_keyent(softstate, &keyentry);
2198 * softstate driver soft state pointer
2373 * softstate driver soft state pointer
2380 agp_bind_key(agpgart_softstate_t *softstate,
2388 ASSERT(mutex_owned(&softstate->asoft_instmutex));
2392 if (pg_end > AGP_MB2PAGES(softstate->asoft_info.agpki_apersize)) {
2400 if (agp_check_off(softstate->asoft_table,
2410 switch (softstate->asoft_devreg.agprd_arctype) {
2414 &softstate->asoft_devreg);
2421 softstate->asoft_devreg.agprd_arctype,
2425 softstate->gart_dma_handle,
2426 (uint32_t *)softstate->gart_vbase);
2430 lyr_flush_gart_cache(&softstate->asoft_devreg);
2435 softstate->asoft_devreg.agprd_arctype));
2445 agpgart_softstate_t *softstate;
2461 softstate = ddi_get_soft_state(agpgart_glob_soft_handle, instance);
2462 mutex_init(&softstate->asoft_instmutex, NULL, MUTEX_DRIVER, NULL);
2463 softstate->asoft_dip = dip;
2468 if (ldi_ident_from_dip(dip, &softstate->asoft_li)) {
2474 softstate->asoft_devreg.agprd_arctype = ARC_UNKNOWN;
2476 if (agp_init_kstats(softstate)) {
2493 softstate->asoft_table = kmem_zalloc(
2497 list_head_init(&softstate->mapped_list);
2501 agp_fini_kstats(softstate);
2503 ldi_ident_release(softstate->asoft_li);
2527 * softstate mutex success in agp_dealloc_mem.
2631 agpgart_softstate_t *softstate;
2639 softstate = ddi_get_soft_state(agpgart_glob_soft_handle, instance);
2640 if (softstate == NULL) {
2645 mutex_enter(&softstate->asoft_instmutex);
2647 if (softstate->asoft_opened) {
2648 softstate->asoft_opened++;
2649 mutex_exit(&softstate->asoft_instmutex);
2655 * driver interface and softstate member here.
2657 softstate->asoft_pgused = 0;
2658 if (lyr_init(&softstate->asoft_devreg, softstate->asoft_li)) {
2660 mutex_exit(&softstate->asoft_instmutex);
2665 if (lyr_get_info(&softstate->asoft_info, &softstate->asoft_devreg)) {
2667 lyr_end(&softstate->asoft_devreg);
2668 mutex_exit(&softstate->asoft_instmutex);
2675 if (IS_INTEL_830(softstate->asoft_devreg.agprd_arctype)) {
2676 softstate->asoft_opened++;
2678 softstate->asoft_pgtotal =
2679 get_max_pages(softstate->asoft_info.agpki_apersize);
2681 if (lyr_config_devices(&softstate->asoft_devreg)) {
2684 lyr_end(&softstate->asoft_devreg);
2685 mutex_exit(&softstate->asoft_instmutex);
2689 devid = softstate->asoft_info.agpki_mdevid;
2694 rc = ldi_ioctl(softstate->asoft_devreg.agprd_targethdl,
2700 lyr_end(&softstate->asoft_devreg);
2701 mutex_exit(&softstate->asoft_instmutex);
2704 mutex_exit(&softstate->asoft_instmutex);
2708 rc = alloc_gart_table(softstate);
2718 while ((softstate->asoft_info.agpki_apersize >= 4) &&
2719 (alloc_gart_table(softstate))) {
2720 softstate->asoft_info.agpki_apersize >>= 1;
2722 if (softstate->asoft_info.agpki_apersize >= 4)
2729 lyr_end(&softstate->asoft_devreg);
2730 mutex_exit(&softstate->asoft_instmutex);
2734 softstate->asoft_pgtotal =
2735 get_max_pages(softstate->asoft_info.agpki_apersize);
2742 if (lyr_set_gart_addr(softstate->gart_pbase,
2743 &softstate->asoft_devreg)) {
2746 free_gart_table(softstate);
2747 lyr_end(&softstate->asoft_devreg);
2748 mutex_exit(&softstate->asoft_instmutex);
2751 if (lyr_config_devices(&softstate->asoft_devreg)) {
2754 free_gart_table(softstate);
2755 lyr_end(&softstate->asoft_devreg);
2756 mutex_exit(&softstate->asoft_instmutex);
2760 softstate->asoft_opened++;
2761 mutex_exit(&softstate->asoft_instmutex);
2789 agpgart_softstate_t *softstate;
2793 softstate = ddi_get_soft_state(agpgart_glob_soft_handle, instance);
2794 if (softstate == NULL) {
2799 mutex_enter(&softstate->asoft_instmutex);
2800 ASSERT(softstate->asoft_opened);
2809 if (softstate->asoft_acquired == 1) {
2812 release_control(softstate);
2815 devid = softstate->asoft_info.agpki_mdevid;
2820 rc = ldi_ioctl(softstate->asoft_devreg.agprd_targethdl,
2828 if (lyr_unconfig_devices(&softstate->asoft_devreg)) {
2831 mutex_exit(&softstate->asoft_instmutex);
2834 softstate->asoft_agpen = 0;
2836 if (!IS_INTEL_830(softstate->asoft_devreg.agprd_arctype)) {
2837 free_gart_table(softstate);
2840 lyr_end(&softstate->asoft_devreg);
2847 softstate->asoft_opened = 0;
2853 (void) agp_del_allkeys(softstate);
2855 mutex_exit(&softstate->asoft_instmutex);
2861 ioctl_agpgart_info(agpgart_softstate_t *softstate, void *arg, int flags)
2873 if (copyinfo(softstate, &infostruct))
2884 if (copyinfo(softstate, &infostruct))
3274 agpgart_softstate_t *softstate;
3277 softstate = ddi_get_soft_state(agpgart_glob_soft_handle, instance);
3278 if (softstate == NULL) {
3283 mutex_enter(&softstate->asoft_instmutex);
3287 retval = ioctl_agpgart_info(softstate, arg, flags);
3290 retval = ioctl_agpgart_acquire(softstate);
3293 retval = ioctl_agpgart_release(softstate);
3296 retval = ioctl_agpgart_setup(softstate, arg, flags);
3299 retval = ioctl_agpgart_alloc(softstate, arg, flags);
3302 retval = ioctl_agpgart_dealloc(softstate, intarg);
3305 retval = ioctl_agpgart_bind(softstate, arg, flags);
3308 retval = ioctl_agpgart_unbind(softstate, arg, flags);
3311 retval = ioctl_agpgart_flush_chipset(softstate);
3314 retval = ioctl_agpgart_pages_bind(softstate, arg, flags);
3317 retval = ioctl_agpgart_pages_unbind(softstate, arg, flags);
3320 retval = ioctl_agpgart_pages_rebind(softstate);
3328 mutex_exit(&softstate->asoft_instmutex);
3338 struct agpgart_softstate *softstate;
3343 softstate = ddi_get_soft_state(agpgart_glob_soft_handle, instance);
3344 if (softstate == NULL) {
3351 mutex_enter(&softstate->asoft_instmutex);
3356 mutex_exit(&softstate->asoft_instmutex);
3365 struct agpgart_softstate *softstate;
3371 softstate = ddi_get_soft_state(agpgart_glob_soft_handle, instance);
3372 if (softstate == NULL) {
3378 if (offset > MB2BYTES(softstate->asoft_info.agpki_apersize)) {
3387 mementry = agp_find_bound_keyent(softstate, AGP_BYTES2PAGES(offset));
3405 softstate->asoft_dip,