Changeset 7317 in vbox
- Timestamp:
- Mar 6, 2008 10:58:07 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r7314 r7317 597 597 * Load transmit message descriptor 598 598 * Make sure we read the own flag first. 599 */ 600 DECLINLINE(void) pcnetTmdLoad(PCNetState *pData, TMD *tmd, RTGCPHYS32 addr) 599 * 600 * @param pData adapter private data 601 * @param addr physical address of the descriptor 602 * @param fRetIfNotOwn return immediately after reading the own flag if we don't own the descriptor 603 */ 604 DECLINLINE(void) pcnetTmdLoad(PCNetState *pData, TMD *tmd, RTGCPHYS32 addr, bool fRetIfNotOwn) 601 605 { 602 606 PPDMDEVINS pDevIns = PCNETSTATE_2_DEVINS(pData); … … 608 612 609 613 PDMDevHlpPhysRead(pDevIns, addr+3, &ownbyte, 1); 614 if (!(ownbyte & 0x80) && fRetIfNotOwn) 615 return; 610 616 PDMDevHlpPhysRead(pDevIns, addr, (void*)&xda[0], sizeof(xda)); 611 617 ((uint32_t *)tmd)[0] = (uint32_t)xda[0] | ((uint32_t)(xda[1] & 0x00ff) << 16); … … 614 620 ((uint32_t *)tmd)[3] = 0; 615 621 } 616 else if ( BCR_SWSTYLE(pData) != 3)622 else if (RT_LIKELY(BCR_SWSTYLE(pData) != 3)) 617 623 { 618 624 PDMDevHlpPhysRead(pDevIns, addr+7, &ownbyte, 1); 625 if (!(ownbyte & 0x80) && fRetIfNotOwn) 626 return; 619 627 PDMDevHlpPhysRead(pDevIns, addr, (void*)tmd, 16); 620 628 } … … 623 631 uint32_t xda[4]; 624 632 PDMDevHlpPhysRead(pDevIns, addr+7, &ownbyte, 1); 633 if (!(ownbyte & 0x80) && fRetIfNotOwn) 634 return; 625 635 PDMDevHlpPhysRead(pDevIns, addr, (void*)&xda[0], sizeof(xda)); 626 636 ((uint32_t *)tmd)[0] = xda[2]; … … 658 668 PDMDevHlpPhysWrite(pDevIns, addr+3, (uint8_t*)xda + 3, 1); 659 669 } 660 else if ( BCR_SWSTYLE(pData) != 3)670 else if (RT_LIKELY(BCR_SWSTYLE(pData) != 3)) 661 671 { 662 672 ((uint32_t*)tmd)[1] |= 0x80000000; … … 683 693 * Load receive message descriptor 684 694 * Make sure we read the own flag first. 685 */ 686 DECLINLINE(void) pcnetRmdLoad(PCNetState *pData, RMD *rmd, RTGCPHYS32 addr) 695 * 696 * @param pData adapter private data 697 * @param addr physical address of the descriptor 698 * @param fRetIfNotOwn return immediately after reading the own flag if we don't own the descriptor 699 */ 700 DECLINLINE(void) pcnetRmdLoad(PCNetState *pData, RMD *rmd, RTGCPHYS32 addr, bool fRetIfNotOwn) 687 701 { 688 702 PPDMDEVINS pDevIns = PCNETSTATE_2_DEVINS(pData); … … 693 707 uint16_t rda[4]; 694 708 PDMDevHlpPhysRead(pDevIns, addr+3, &ownbyte, 1); 709 if ((!ownbyte & 0x80) && fRetIfNotOwn) 710 return; 695 711 PDMDevHlpPhysRead(pDevIns, addr, (void*)&rda[0], sizeof(rda)); 696 712 ((uint32_t *)rmd)[0] = (uint32_t)rda[0] | ((rda[1] & 0x00ff) << 16); … … 699 715 ((uint32_t *)rmd)[3] = 0; 700 716 } 701 else if ( BCR_SWSTYLE(pData) != 3)717 else if (RT_LIKELY(BCR_SWSTYLE(pData) != 3)) 702 718 { 703 719 PDMDevHlpPhysRead(pDevIns, addr+7, &ownbyte, 1); 720 if ((!ownbyte & 0x80) && fRetIfNotOwn) 721 return; 704 722 PDMDevHlpPhysRead(pDevIns, addr, (void*)rmd, 16); 705 723 } … … 708 726 uint32_t rda[4]; 709 727 PDMDevHlpPhysRead(pDevIns, addr+7, &ownbyte, 1); 728 if ((!ownbyte & 0x80) && fRetIfNotOwn) 729 return; 710 730 PDMDevHlpPhysRead(pDevIns, addr, (void*)&rda[0], sizeof(rda)); 711 731 ((uint32_t *)rmd)[0] = rda[2]; … … 717 737 #ifdef DEBUG 718 738 if (rmd->rmd1.own == 1 && !(ownbyte & 0x80)) 719 Log(("pcnet TmdLoad: own bit flipped while reading!!\n"));739 Log(("pcnetRmdLoad: own bit flipped while reading!!\n")); 720 740 #endif 721 741 if (!(ownbyte & 0x80)) … … 742 762 PDMDevHlpPhysWrite(pDevIns, addr+3, (uint8_t*)rda + 3, 1); 743 763 } 744 else if ( BCR_SWSTYLE(pData) != 3)764 else if (RT_LIKELY(BCR_SWSTYLE(pData) != 3)) 745 765 { 746 766 ((uint32_t*)rmd)[1] |= 0x80000000; … … 1500 1520 { 1501 1521 addr = pcnetRdraAddr(pData, i); 1502 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, addr) );1522 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, addr), true); 1503 1523 CSR_CRDA(pData) = CSR_CRBA(pData) = 0; 1504 1524 CSR_CRBC(pData) = CSR_CRST(pData) = 0; … … 1539 1559 i = CSR_RCVRL(pData); 1540 1560 addr = pcnetRdraAddr(pData, i); 1541 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, addr) );1561 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, addr), true); 1542 1562 CSR_NRDA(pData) = CSR_NRBA(pData) = 0; 1543 1563 CSR_NRBC(pData) = 0; … … 1586 1606 RTGCPHYS32 cxda = pcnetTdraAddr(pData, CSR_XMTRC(pData)); 1587 1607 1588 pcnetTmdLoad(pData, tmd, PHYSADDR(pData, cxda) );1608 pcnetTmdLoad(pData, tmd, PHYSADDR(pData, cxda), true); 1589 1609 1590 1610 if (!tmd->tmd1.own) … … 1691 1711 { 1692 1712 RMD rmd; 1693 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, GCPhys) );1713 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, GCPhys), false); 1694 1714 LogRel((" %#010x\n", rmd.rmd1)); 1695 1715 GCPhys += cb; … … 1726 1746 #endif 1727 1747 1728 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, crda) );1748 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, crda), false); 1729 1749 /*if (!CSR_LAPPEN(pData))*/ 1730 1750 rmd.rmd1.stp = 1; … … 1746 1766 i = CSR_RCVRL(pData); 1747 1767 next_crda = pcnetRdraAddr(pData, i); 1748 pcnetRmdLoad(pData, &next_rmd, PHYSADDR(pData, next_crda) );1768 pcnetRmdLoad(pData, &next_rmd, PHYSADDR(pData, next_crda), true); 1749 1769 1750 1770 /* Check next descriptor's own bit. If we don't own it, we have … … 2219 2239 cBuffers++; 2220 2240 #endif 2221 pcnetTmdLoad(pData, &tmd, PHYSADDR(pData, CSR_CXDA(pData)) );2241 pcnetTmdLoad(pData, &tmd, PHYSADDR(pData, CSR_CXDA(pData)), false); 2222 2242 cb = 4096 - tmd.tmd1.bcnt; 2223 2243 if ( pData->SendFrame.cb + cb < cbMaxFrame … … 2413 2433 { 2414 2434 TMD tmd; 2415 pcnetTmdLoad(pData, &tmd, PHYSADDR(pData, CSR_CXDA(pData)) );2435 pcnetTmdLoad(pData, &tmd, PHYSADDR(pData, CSR_CXDA(pData)), false); 2416 2436 Log2(("#%d pcnetPollTimer: TMDLOAD %#010x\n", PCNETSTATE_2_DEVINS(pData)->iInstance, PHYSADDR(pData, CSR_CXDA(pData)))); 2417 2437 PRINT_TMD(&tmd); … … 3855 3875 { 3856 3876 RMD rmd; 3857 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, GCPhys) );3877 pcnetRmdLoad(pData, &rmd, PHYSADDR(pData, GCPhys), false); 3858 3878 pHlp->pfnPrintf(pHlp, 3859 3879 "%04x %RGp:%c%c RBADR=%08RX32 BCNT=%03x MCNT=%03x " … … 3895 3915 { 3896 3916 TMD tmd; 3897 pcnetTmdLoad(pData, &tmd, PHYSADDR(pData, GCPhys) );3917 pcnetTmdLoad(pData, &tmd, PHYSADDR(pData, GCPhys), false); 3898 3918 pHlp->pfnPrintf(pHlp, 3899 3919 "%04x %RGp:%c%c TBADR=%08RX32 BCNT=%03x OWN=%d "
Note:
See TracChangeset
for help on using the changeset viewer.