void PspSpeedTests::fastCopySpeed() { PSP_INFO_PRINT("running fastCopy speed test\n"); uint32 *bufferSrc32 = (uint32 *)memalign(16, MEMCPY_BUFFER_SIZE); uint32 *bufferDst32 = (uint32 *)memalign(16, MEMCPY_BUFFER_SIZE); // fill buffer 1 for (int i=0; i<MEMCPY_BUFFER_SIZE/4; i++) bufferSrc32[i] = i | (((MEMCPY_BUFFER_SIZE/4)-i)<<16); // print buffer for (int i=0; i<50; i++) PSP_INFO_PRINT("%x ", bufferSrc32[i]); PSP_INFO_PRINT("\n"); byte *bufferSrc = ((byte *)bufferSrc32); byte *bufferDst = ((byte *)bufferDst32); PSP_INFO_PRINT("\n\ndst and src cached: -----------------\n"); fastCopyDifferentSizes(bufferDst, bufferSrc); fastCopyDifferentSizes(bufferDst+1, bufferSrc+1); fastCopyDifferentSizes(bufferDst, bufferSrc+1); fastCopyDifferentSizes(bufferDst+1, bufferSrc); PSP_INFO_PRINT("\n\ndst cached, src uncached: -----------------\n"); bufferSrc = UNCACHED(bufferSrc); fastCopyDifferentSizes(bufferDst, bufferSrc); fastCopyDifferentSizes(bufferDst+1, bufferSrc+1); fastCopyDifferentSizes(bufferDst, bufferSrc+1); fastCopyDifferentSizes(bufferDst+1, bufferSrc); PSP_INFO_PRINT("\n\ndst uncached, src uncached: --------------\n"); bufferDst = UNCACHED(bufferDst); fastCopyDifferentSizes(bufferDst, bufferSrc); fastCopyDifferentSizes(bufferDst+1, bufferSrc+1); fastCopyDifferentSizes(bufferDst, bufferSrc+1); fastCopyDifferentSizes(bufferDst+1, bufferSrc); PSP_INFO_PRINT("\n\ndst uncached, src cached: -------------------\n"); bufferSrc = CACHED(bufferSrc); fastCopyDifferentSizes(bufferDst, bufferSrc); fastCopyDifferentSizes(bufferDst+1, bufferSrc+1); fastCopyDifferentSizes(bufferDst, bufferSrc+1); fastCopyDifferentSizes(bufferDst+1, bufferSrc); free(bufferSrc32); free(bufferDst32); }
// Deallocate a block from VRAM void VramAllocator::deallocate(void *address) { DEBUG_ENTER_FUNC(); address = (byte *)CACHED(address); // Make sure all addresses are the same Common::List<Allocation>::iterator i; // Find the Allocator to deallocate for (i = _allocList.begin(); i != _allocList.end(); ++i) { if ((*i).address == address) { _bytesAllocated -= (*i).size; _allocList.erase(i); PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); return; } } PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); }
static Node* vmsdir(char *name) { char *cp; Node *np; char *oname; np = remroot; cp = strchr(name, '['); if(cp) strcpy(cp, cp+1); cp = strchr(name, ']'); if(cp) *cp = 0; oname = name = strdup(name); if(name == 0) return 0; while(cp = strchr(name, '.')){ *cp = 0; np = vmsextendpath(np, name); name = cp+1; } np = vmsextendpath(np, name); /* * walk back to first accessible directory */ for(; np->parent != np; np = np->parent) if(ISVALID(np)){ CACHED(np->parent); break; } free(oname); return np; }
__IRAM static int32 _swNic_recvLoop(int32 last){ volatile struct rtl_pktHdr * pPkthdr; //don't optimize volatile struct rtl_mBuf * pMbuf; //don't optimize int32 count=0; do{ #ifdef CONFIG_RTL865X_ROMEPERF rtl8651_romeperfEnterPoint(ROMEPERF_INDEX_RECVLOOP); #endif /* Increment counter */ if((RxPkthdrRing[rxPhdrIndex]&DESC_OWNED_BIT)==1){ goto out; } #ifdef SWNIC_EARLYSTOP if(nicRxEarlyStop && ((count & nicRxEarlyStop)==nicRxEarlyStop)){//check global interrupt status uint32 gisrNow = REG32(GISR); if(gisrNow & 0x65000000){ //Bit 30: USB, Bit 29:PCMCIA, Bit 26: PCI, Bit 24:GPIO nicRxAbort=1; goto out; } } #endif #ifdef CONFIG_RTL865X_CACHED_NETWORK_IO #if 0 /*Invalidate D-Cache*/ lx4180_writeCacheCtrl(0); lx4180_writeCacheCtrl(1); lx4180_writeCacheCtrl(0); pPkthdr = (struct rtl_pktHdr *) (RxPkthdrRing[rxPhdrIndex] & ~(DESC_OWNED_BIT | DESC_WRAP)); pMbuf = pPkthdr->ph_mbuf; #else pPkthdr = (struct rtl_pktHdr *) (RxPkthdrRing[rxPhdrIndex] & ~(DESC_OWNED_BIT | DESC_WRAP)); pMbuf = pPkthdr->ph_mbuf; //force update d-cache if hit. src32=(uint32 *)UNCACHE(pPkthdr); dst32=(uint32 *)CACHED(pPkthdr); dst32[0]=src32[0]; dst32[1]=src32[1]; dst32[2]=src32[2]; dst32[3]=src32[3]; src32=(uint32 *)UNCACHE(pMbuf); dst32=(uint32 *)CACHED(pMbuf); dst32[0]=src32[0]; dst32[1]=src32[1]; dst32[2]=src32[2]; dst32[3]=src32[3]; //pkt from ASIC, convert to uncached data pointer for used in //fwd engine pMbuf->m_data=UNCACHE(pMbuf->m_data); pMbuf->m_extbuf=UNCACHE(pMbuf->m_extbuf); #endif #else pPkthdr = (struct rtl_pktHdr *) (RxPkthdrRing[rxPhdrIndex] & ~(DESC_OWNED_BIT | DESC_WRAP)); pMbuf = pPkthdr->ph_mbuf; #endif //CONFIG_RTL865X_CACHED_NETWORK_IO #ifdef CONFIG_RTL865XB_EXP_PERFORMANCE_EVALUATION if(_pernicStart == TRUE){ static uint32 start, end; if(!_pernicPktCount){ startCOP3Counters(_pernicInst); start = jiffies; } else if(_pernicPktCount == _pernicPktLimit){ end = jiffies; stopCOP3Counters(); printk("%d pkts. Total %d bytes, %d ms. %u KBps\n", _pernicPktCount, _pernicByteCount, (uint32)((end-start)*10), (uint32)(_pernicByteCount/((end-start)*10))); _pernicStart = FALSE; } _pernicPktCount++; _pernicByteCount += pPkthdr->ph_len + 4; swNic_isrReclaim(rxPhdrIndex, pPkthdr, pMbuf); /* Increment index */ if ( ++rxPhdrIndex == totalRxPkthdr ) rxPhdrIndex = 0; if ( ++rxMbufIndex == totalRxMbuf ) rxMbufIndex = 0; continue; } #endif assert(pPkthdr->ph_len>0); if((pPkthdr->ph_flags&PKTHDR_DRIVERHOLD)==0){ //exception handling swNic_rxRunoutTxPending((struct rtl_pktHdr *)pPkthdr); goto out; } count++; //SETBITS(pPkthdr->ph_flags, PKT_INCOMING); //packet from physical port pPkthdr->ph_rxdesc=rxPhdrIndex; pPkthdr->ph_flags&=~PKTHDR_DRIVERHOLD; //Transform extension port numbers to continuous number for fwd engine. #ifdef CONFIG_RTL865X_MULTILAYER_BSP //Default run this except L2 BSP. //must call this API after rxPhdrIndex is assigned... if(rtl8651_rxPktPreprocess(pPkthdr)){ rtlglue_printf("Drop rxDesc=%d\n",rxPhdrIndex ); //memDump(pPkthdr->ph_mbuf->m_data, pPkthdr->ph_len,"Loopback Pkt"); swNic_isrReclaim(rxPhdrIndex, pPkthdr, pMbuf); }else #endif { #ifdef CONFIG_RTL865X_ROMEREAL rtl8651_romerealRecord( pPkthdr, 0x00000001 ); #endif/*CONFIG_RTL865X_ROMEREAL*/ /* Invoked installed function pointer to handle packet */ (*installedProcessInputPacket)((struct rtl_pktHdr*)pPkthdr); } #ifdef SWNIC_DEBUG assert(rxPhdrIndex==rxMbufIndex); #endif /* Increment index */ if ( ++rxPhdrIndex == totalRxPkthdr ) rxPhdrIndex = 0; if ( ++rxMbufIndex == totalRxMbuf ) rxMbufIndex = 0; }while(last>=0&&rxPhdrIndex!=last); out: return count; }
/* * find out about the other side. go to it's root if requested. set * image mode if a Plan9 system. */ void preamble(char *mountroot) { char *p, *ep; int rv; OS *o; /* * create a root directory mirror */ remroot = newnode(0, s_copy("/")); remroot->d->qid.type = QTDIR; remroot->d->mode = DMDIR|0777; remdir = remroot; /* * get system type */ sendrequest("SYST", nil); switch(getreply(&ctlin, msg, sizeof(msg), 1)){ case Success: for(o = oslist; o->os != Unknown; o++) if(strncmp(msg+4, o->name, strlen(o->name)) == 0) break; os = o->os; if(os == NT) os = Unix; break; default: os = defos; break; } if(os == Unknown) os = defos; remrootpath = s_reset(remrootpath); switch(os){ case NetWare: /* * Request long, rather than 8.3 filenames, * where the Servers & Volume support them. */ sendrequest("SITE LONG", nil); getreply(&ctlin, msg, sizeof(msg), 0); /* FALL THRU */ case Unix: case Plan9: /* * go to the remote root, if asked */ if(mountroot){ sendrequest("CWD", mountroot); getreply(&ctlin, msg, sizeof(msg), 0); } else { s_append(remrootpath, "/usr/"); s_append(remrootpath, user); } /* * get the root directory */ sendrequest("PWD", nil); rv = getreply(&ctlin, msg, sizeof(msg), 1); if(rv == PermFail){ sendrequest("XPWD", nil); rv = getreply(&ctlin, msg, sizeof(msg), 1); } if(rv == Success){ p = strchr(msg, '"'); if(p){ p++; ep = strchr(p, '"'); if(ep){ *ep = 0; s_append(s_reset(remrootpath), p); } } } break; case Tops: case VM: /* * top directory is a figment of our imagination. * make it permanently cached & valid. */ CACHED(remroot); VALID(remroot); remroot->d->atime = time(0) + 100000; /* * no initial directory. We are in the * imaginary root. */ remdir = newtopsdir("???"); topsdir[0] = 0; if(os == Tops && readdir(remdir) >= 0){ CACHED(remdir); if(*topsdir) remdir->remname = s_copy(topsdir); VALID(remdir); } break; case VMS: /* * top directory is a figment of our imagination. * make it permanently cached & valid. */ CACHED(remroot); VALID(remroot); remroot->d->atime = time(0) + 100000; /* * get current directory */ sendrequest("PWD", nil); rv = getreply(&ctlin, msg, sizeof(msg), 1); if(rv == PermFail){ sendrequest("XPWD", nil); rv = getreply(&ctlin, msg, sizeof(msg), 1); } if(rv == Success){ p = strchr(msg, '"'); if(p){ p++; ep = strchr(p, '"'); if(ep){ *ep = 0; remroot = remdir = vmsdir(p); } } } break; case MVS: usenlst = 1; break; } if(os == Plan9) image(); }