- if(!(actpmap->pmapUsage[(sva >> pmapUsageShft) & pmapUsageMask])) { /* See if this chunk has anything in it */
- sva = (sva + pmapUsageSize) & (-pmapUsageSize); /* Jump up into the next slot if nothing here */
- if(!sva) break; /* We tried to wrap, kill loop... */
- continue; /* Check the next... */
- }
-
- if(!(mp = hw_lock_phys_vir(actpmap->space, sva))) { /* Find the mapping for this vaddr and lock physent */
- sva += PAGE_SIZE; /* Point to the next page */
- continue; /* Skip if the page is not mapped... */
- }
-
- if((unsigned int)mp&1) { /* Did the lock on the phys entry time out? */
- panic("pmap_attribute: timeout obtaining lock on physical entry\n"); /* Scream bloody murder! */
- continue;
- }
-
- mpv = hw_cpv(mp); /* Get virtual address of mapping */
- if((unsigned int)mpv->physent) { /* Is there a physical entry? */
- pa = (vm_offset_t)mpv->physent->pte1 & -PAGE_SIZE; /* Yes, get the physical address from there */
- }
- else {
- pa = (vm_offset_t)(mpv->PTEr & PAGE_SIZE); /* Otherwise from the mapping */
- }
-
- switch (*value) { /* What type was that again? */
- case MATTR_VAL_CACHE_SYNC: /* It is sync I+D caches */
- sync_cache(pa, PAGE_SIZE); /* Sync up dem caches */
- break; /* Done with this one here... */
-
- case MATTR_VAL_CACHE_FLUSH: /* It is flush from all caches */
- flush_dcache(pa, PAGE_SIZE, TRUE); /* Flush out the data cache */
- invalidate_icache(pa, PAGE_SIZE, TRUE); /* Flush out the instruction cache */
- break; /* Done with this one here... */
-
- case MATTR_VAL_DCACHE_FLUSH: /* It is flush from data cache(s) */
- flush_dcache(pa, PAGE_SIZE, TRUE); /* Flush out the data cache */
- break; /* Done with this one here... */
-
- case MATTR_VAL_ICACHE_FLUSH: /* It is flush from instr cache(s) */
- invalidate_icache(pa, PAGE_SIZE, TRUE); /* Flush out the instruction cache */
- break; /* Done with this one here... */
- }
- if(mpv->physent) hw_unlock_bit((unsigned int *)&mpv->physent->phys_link, PHYS_LOCK); /* Unlock the physical entry if it exists*/
-
- sva += PAGE_SIZE; /* Point to the next page */
- }
- splx(s);
- break;
-
- case MATTR_VAL_GET_INFO: /* Get info */
- total = 0;
- s = splhigh(); /* Lock 'em out */
-
- if (size <= PAGE_SIZE) { /* Do they want just one page */
- seg = sva >> 28; /* Isolate segment */
- if((0x00008000 >> seg) & pmap->vflags) actpmap = pmap->pmapPmaps[seg]; /* Set nested pmap if there is one */
- else actpmap = pmap; /* Otherwise use the one passed in */
- if(!(mp = hw_lock_phys_vir(actpmap->space, sva))) { /* Find the mapping for this vaddr and lock physent */
- *value = 0; /* Return nothing if no mapping */
- }
- else {
- if((unsigned int)mp&1) { /* Did the lock on the phys entry time out? */
- panic("pmap_attribute: timeout obtaining lock on physical entry\n"); /* Scream bloody murder! */
- }
- mpv = hw_cpv(mp); /* Get virtual address of mapping */
- if(pp = mpv->physent) { /* Check for a physical entry */
- total = 0; /* Clear the count */
- for (mpv = (mapping *)hw_cpv((mapping *)((unsigned int)pp->phys_link & ~PHYS_FLAGS)); mpv != NULL; mpv = hw_cpv(mp->next)) total++; /* Count the mapping */
- *value = (vm_machine_attribute_val_t) ((pp->pte1 & -PAGE_SIZE) | total); /* Pass back the physical address and the count of mappings */
- hw_unlock_bit((unsigned int *)&pp->phys_link, PHYS_LOCK); /* Clear the physical entry lock */
- }
- else { /* This is the case for an I/O mapped area */
- *value = (vm_machine_attribute_val_t) ((mpv->PTEr & -PAGE_SIZE) | 1); /* Pass back the physical address and the count of mappings */
- }
- }
- }
- else {
- total = 0;
- while (sva < eva) {
- seg = sva >> 28; /* Isolate segment */
- if((0x00008000 >> seg) & pmap->vflags) actpmap = pmap->pmapPmaps[seg]; /* Set nested pmap if there is one */
- else actpmap = pmap; /* Otherwise use the one passed in */
-
- if(!(actpmap->pmapUsage[(sva >> pmapUsageShft) & pmapUsageMask])) { /* See if this chunk has anything in it */
- sva = (sva + pmapUsageSize) & (-pmapUsageSize); /* Jump up into the next slot if nothing here */
- if(!sva) break; /* We tried to wrap, kill loop... */
- continue; /* Check the next... */
- }
- if(mp = hw_lock_phys_vir(actpmap->space, sva)) { /* Find the mapping for this vaddr and lock physent */
- if((unsigned int)mp&1) { /* Did the lock on the phys entry time out? */
- panic("pmap_attribute: timeout obtaining lock on physical entry\n"); /* Scream bloody murder! */
- continue;
- }
- mpv = hw_cpv(mp); /* Get virtual address of mapping */
- total += 65536 + (mpv->physent && ((mapping *)((unsigned int)mpv->physent->phys_link & -32))->next); /* Count the "resident" and shared pages */
- hw_unlock_bit((unsigned int *)&mpv->physent->phys_link, PHYS_LOCK); /* Clear the physical entry lock */
- }
- sva += PAGE_SIZE;
- }
- *value = total;
- }
- splx(s);
- break;