Changeset 82142 in vbox
- Timestamp:
- Nov 24, 2019 12:55:18 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134952
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r82141 r82142 84 84 #define PCNET_GC_ENABLED 85 85 86 #if defined(LOG_ENABLED) 87 #define PCNET_DEBUG_IO 88 #define PCNET_DEBUG_BCR 89 #define PCNET_DEBUG_CSR 90 #define PCNET_DEBUG_RMD 91 #define PCNET_DEBUG_TMD 92 #define PCNET_DEBUG_MATCH 93 #define PCNET_DEBUG_MII 94 #endif 86 /* PCNET_DEBUG_IO - Log6 */ 87 /* PCNET_DEBUG_BCR - Log7 */ 88 /* PCNET_DEBUG_CSR - Log8 */ 89 /* PCNET_DEBUG_RMD - Log9 */ 90 /* PCNET_DEBUG_TMD - Log10 */ 91 /* PCNET_DEBUG_MATCH - Log11 */ 92 /* PCNET_DEBUG_MII - Log12 */ 95 93 96 94 #define PCNET_IOPORT_SIZE 0x20 … … 644 642 * Internal Functions * 645 643 *********************************************************************************************************************************/ 646 #define PRINT_TMD(T) Log 2(( \644 #define PRINT_TMD(T) Log10(( \ 647 645 "TMD0 : TBADR=%#010x\n" \ 648 646 "TMD1 : OWN=%d, ERR=%d, FCS=%d, LTI=%d, " \ … … 661 659 (T)->tmd2.tdr, (T)->tmd2.trc)) 662 660 663 #define PRINT_RMD(R) Log 2(( \661 #define PRINT_RMD(R) Log9(( \ 664 662 "RMD0 : RBADR=%#010x\n" \ 665 663 "RMD1 : OWN=%d, ERR=%d, FRAM=%d, OFLO=%d, " \ … … 952 950 #pragma pack() 953 951 954 #define PRINT_PKTHDR(BUF) do { \ 955 struct ether_header *hdr = (struct ether_header *)(BUF); \ 956 Log(("#%d packet dhost=%02x:%02x:%02x:%02x:%02x:%02x, " \ 957 "shost=%02x:%02x:%02x:%02x:%02x:%02x, " \ 958 "type=%#06x (bcast=%d)\n", PCNET_INST_NR, \ 959 hdr->ether_dhost[0],hdr->ether_dhost[1],hdr->ether_dhost[2], \ 960 hdr->ether_dhost[3],hdr->ether_dhost[4],hdr->ether_dhost[5], \ 961 hdr->ether_shost[0],hdr->ether_shost[1],hdr->ether_shost[2], \ 962 hdr->ether_shost[3],hdr->ether_shost[4],hdr->ether_shost[5], \ 963 htons(hdr->ether_type), \ 964 !!ETHER_IS_MULTICAST(hdr->ether_dhost))); \ 952 #define PRINT_PKTHDR(BUF) do { \ 953 struct ether_header *hdr = (struct ether_header *)(BUF); \ 954 Log12(("#%d packet dhost=%02x:%02x:%02x:%02x:%02x:%02x, shost=%02x:%02x:%02x:%02x:%02x:%02x, type=%#06x (bcast=%d)\n", \ 955 PCNET_INST_NR, \ 956 hdr->ether_dhost[0],hdr->ether_dhost[1],hdr->ether_dhost[2], \ 957 hdr->ether_dhost[3],hdr->ether_dhost[4],hdr->ether_dhost[5], \ 958 hdr->ether_shost[0],hdr->ether_shost[1],hdr->ether_shost[2], \ 959 hdr->ether_shost[3],hdr->ether_shost[4],hdr->ether_shost[5], \ 960 htons(hdr->ether_type), \ 961 !!ETHER_IS_MULTICAST(hdr->ether_dhost))); \ 965 962 } while (0) 966 963 … … 1065 1062 struct ether_header *hdr = (struct ether_header *)buf; 1066 1063 int result; 1067 #if (defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && !defined(PCNET_DEBUG_MATCH)1064 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64) 1068 1065 result = !CSR_DRCVPA(pThis) && !memcmp(hdr->ether_dhost, pThis->aCSR + 12, 6); 1069 1066 #else … … 1078 1075 #endif 1079 1076 1080 #ifdef PCNET_DEBUG_MATCH 1081 Log(("#%d packet dhost=%02x:%02x:%02x:%02x:%02x:%02x, " 1082 "padr=%02x:%02x:%02x:%02x:%02x:%02x => %d\n", PCNET_INST_NR, 1083 hdr->ether_dhost[0],hdr->ether_dhost[1],hdr->ether_dhost[2], 1084 hdr->ether_dhost[3],hdr->ether_dhost[4],hdr->ether_dhost[5], 1085 padr[0],padr[1],padr[2],padr[3],padr[4],padr[5], result)); 1086 #endif 1077 Log11(("#%d packet dhost=%02x:%02x:%02x:%02x:%02x:%02x, padr=%02x:%02x:%02x:%02x:%02x:%02x => %d\n", PCNET_INST_NR, 1078 hdr->ether_dhost[0],hdr->ether_dhost[1],hdr->ether_dhost[2], 1079 hdr->ether_dhost[3],hdr->ether_dhost[4],hdr->ether_dhost[5], 1080 pThis->aCSR[12] & 0xff, pThis->aCSR[12] >> 8, 1081 pThis->aCSR[13] & 0xff, pThis->aCSR[13] >> 8, 1082 pThis->aCSR[14] & 0xff, pThis->aCSR[14] >> 8, result)); 1087 1083 RT_NOREF_PV(size); 1088 1084 return result; … … 1094 1090 struct ether_header *hdr = (struct ether_header *)buf; 1095 1091 int result = !CSR_DRCVBC(pThis) && !memcmp(hdr->ether_dhost, aBCAST, 6); 1096 #ifdef PCNET_DEBUG_MATCH 1097 Log(("#%d padr_bcast result=%d\n", PCNET_INST_NR, result)); 1098 #endif 1092 Log11(("#%d padr_bcast result=%d\n", PCNET_INST_NR, result)); 1099 1093 RT_NOREF_PV(size); 1100 1094 return result; … … 1965 1959 cbPacket = (int)cbToRecv; Assert((size_t)cbPacket == cbToRecv); 1966 1960 1967 #ifdef PCNET_DEBUG_MATCH1961 #ifdef LOG_ENABLED 1968 1962 PRINT_PKTHDR(buf); 1969 1963 #endif … … 2086 2080 Log(("#%d RCVRC=%d CRDA=%#010x\n", PCNET_INST_NR, 2087 2081 CSR_RCVRC(pThis), PHYSADDR(pThis, CSR_CRDA(pThis)))); 2088 #ifdef PCNET_DEBUG_RMD2082 #ifdef LOG_ENABLED 2089 2083 PRINT_RMD(&rmd); 2090 2084 #endif … … 2471 2465 break; 2472 2466 2473 #ifdef PCNET_DEBUG_TMD2474 Log 2(("#%d TMDLOAD %#010x\n", PCNET_INST_NR, PHYSADDR(pThis, CSR_CXDA(pThis))));2467 #ifdef LOG_ENABLED 2468 Log10(("#%d TMDLOAD %#010x\n", PCNET_INST_NR, PHYSADDR(pThis, CSR_CXDA(pThis)))); 2475 2469 PRINT_TMD(&tmd); 2476 2470 #endif … … 2815 2809 PCNET_INST_NR, CSR_CXDA(pThis), CSR_XMTRL(pThis), CSR_XMTRC(pThis))); 2816 2810 #endif 2817 #ifdef PCNET_DEBUG_TMD2811 #ifdef LOG_ENABLED 2818 2812 if (CSR_CXDA(pThis)) 2819 2813 { 2820 2814 TMD tmd; 2821 2815 pcnetTmdLoad(pThis, &tmd, PHYSADDR(pThis, CSR_CXDA(pThis)), false); 2822 Log 2(("#%d pcnetPollTimer: TMDLOAD %#010x\n", PCNET_INST_NR, PHYSADDR(pThis, CSR_CXDA(pThis))));2816 Log10(("#%d pcnetPollTimer: TMDLOAD %#010x\n", PCNET_INST_NR, PHYSADDR(pThis, CSR_CXDA(pThis)))); 2823 2817 PRINT_TMD(&tmd); 2824 2818 } … … 2863 2857 { 2864 2858 VBOXSTRICTRC rc = VINF_SUCCESS; 2865 #ifdef PCNET_DEBUG_CSR 2866 Log(("#%d pcnetCSRWriteU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 2867 #endif 2859 Log8(("#%d pcnetCSRWriteU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 2868 2860 switch (u32RAP) 2869 2861 { … … 3111 3103 val = pThis->aCSR[u32RAP]; 3112 3104 } 3113 #ifdef PCNET_DEBUG_CSR 3114 Log(("#%d pcnetCSRReadU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 3115 #endif 3105 Log8(("#%d pcnetCSRReadU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 3116 3106 return val; 3117 3107 } … … 3120 3110 { 3121 3111 u32RAP &= 0x7f; 3122 #ifdef PCNET_DEBUG_BCR 3123 Log2(("#%d pcnetBCRWriteU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 3124 #endif 3112 Log7(("#%d pcnetBCRWriteU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 3125 3113 switch (u32RAP) 3126 3114 { … … 3177 3165 case BCR_MIIMDR: 3178 3166 pThis->aMII[pThis->aBCR[BCR_MIIADDR] & 0x1f] = val; 3179 #ifdef PCNET_DEBUG_MII 3180 Log(("#%d pcnet: mii write %d <- %#x\n", PCNET_INST_NR, pThis->aBCR[BCR_MIIADDR] & 0x1f, val)); 3181 #endif 3167 Log12(("#%d pcnet: mii write %d <- %#x\n", PCNET_INST_NR, pThis->aBCR[BCR_MIIADDR] & 0x1f, val)); 3182 3168 break; 3183 3169 … … 3341 3327 } 3342 3328 3343 #ifdef PCNET_DEBUG_MII 3344 Log(("#%d pcnet: mii read %d -> %#x\n", PCNET_INST_NR, miiaddr, val)); 3345 #endif 3329 Log12(("#%d pcnet: mii read %d -> %#x\n", PCNET_INST_NR, miiaddr, val)); 3346 3330 return val; 3347 3331 } … … 3382 3366 break; 3383 3367 } 3384 #ifdef PCNET_DEBUG_BCR 3385 Log2(("#%d pcnetBCRReadU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 3386 #endif 3368 Log7(("#%d pcnetBCRReadU16: rap=%d val=%#06x\n", PCNET_INST_NR, u32RAP, val)); 3387 3369 return val; 3388 3370 } … … 3549 3531 { 3550 3532 RT_NOREF1(val); 3551 #ifdef PCNET_DEBUG_IO 3552 Log2(("#%d pcnetIoPortWriteU8: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val)); 3553 #endif 3533 Log6(("#%d pcnetIoPortWriteU8: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val)); 3554 3534 if (RT_LIKELY(!BCR_DWIO(pThis))) 3555 3535 { … … 3585 3565 pcnetUpdateIrq(pThis); 3586 3566 3587 #ifdef PCNET_DEBUG_IO 3588 Log2(("#%d pcnetIoPortReadU8: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val & 0xff)); 3589 #endif 3567 Log6(("#%d pcnetIoPortReadU8: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val & 0xff)); 3590 3568 return val; 3591 3569 } … … 3595 3573 VBOXSTRICTRC rc = VINF_SUCCESS; 3596 3574 3597 #ifdef PCNET_DEBUG_IO 3598 Log2(("#%d pcnetIoPortWriteU16: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val)); 3599 #endif 3575 Log6(("#%d pcnetIoPortWriteU16: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val)); 3600 3576 if (RT_LIKELY(!BCR_DWIO(pThis))) 3601 3577 { … … 3657 3633 3658 3634 skip_update_irq: 3659 #ifdef PCNET_DEBUG_IO 3660 Log2(("#%d pcnetIoPortReadU16: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val & 0xffff)); 3661 #endif 3635 Log6(("#%d pcnetIoPortReadU16: addr=%#010x val=%#06x\n", PCNET_INST_NR, addr, val & 0xffff)); 3662 3636 return val; 3663 3637 } … … 3667 3641 VBOXSTRICTRC rc = VINF_SUCCESS; 3668 3642 3669 #ifdef PCNET_DEBUG_IO 3670 Log2(("#%d pcnetIoPortWriteU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, 3671 addr, val)); 3672 #endif 3643 Log6(("#%d pcnetIoPortWriteU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val)); 3673 3644 if (RT_LIKELY(BCR_DWIO(pThis))) 3674 3645 { … … 3692 3663 /* switch device to dword I/O mode */ 3693 3664 pcnetBCRWriteU16(pDevIns, pThis, BCR_BSBC, pcnetBCRReadU16(pThis, BCR_BSBC) | 0x0080); 3694 #ifdef PCNET_DEBUG_IO 3695 Log2(("device switched into dword i/o mode\n")); 3696 #endif 3665 Log6(("device switched into dword i/o mode\n")); 3697 3666 } 3698 3667 else … … 3737 3706 3738 3707 skip_update_irq: 3739 #ifdef PCNET_DEBUG_IO 3740 Log2(("#%d pcnetIoPortReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val)); 3741 #endif 3708 Log6(("#%d pcnetIoPortReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val)); 3742 3709 return val; 3743 3710 } … … 3802 3769 static void pcnetR3MmioWriteU8(PPCNETSTATE pThis, RTGCPHYS off, uint32_t val) 3803 3770 { 3804 #ifdef PCNET_DEBUG_IO 3805 Log2(("#%d pcnetR3MmioWriteU8: off=%#010x val=%#04x\n", PCNET_INST_NR, off, val)); 3806 #endif 3771 Log6(("#%d pcnetR3MmioWriteU8: off=%#010x val=%#04x\n", PCNET_INST_NR, off, val)); 3807 3772 if (!(off & 0x10)) 3808 3773 pcnetAPROMWriteU8(pThis, off, val); … … 3814 3779 if (!(addr & 0x10)) 3815 3780 val = pcnetAPROMReadU8(pThis, addr); 3816 #ifdef PCNET_DEBUG_IO 3817 Log2(("#%d pcnetR3MmioReadU8: addr=%#010x val=%#04x\n", PCNET_INST_NR, addr, val & 0xff)); 3818 #endif 3781 Log6(("#%d pcnetR3MmioReadU8: addr=%#010x val=%#04x\n", PCNET_INST_NR, addr, val & 0xff)); 3819 3782 return val; 3820 3783 } … … 3823 3786 { 3824 3787 VBOXSTRICTRC rcStrict; 3825 #ifdef PCNET_DEBUG_IO 3826 Log2(("#%d pcnetR3MmioWriteU16: off=%#010x val=%#06x\n", PCNET_INST_NR, off, val)); 3827 #endif 3788 Log6(("#%d pcnetR3MmioWriteU16: off=%#010x val=%#06x\n", PCNET_INST_NR, off, val)); 3828 3789 if (off & 0x10) 3829 3790 { … … 3853 3814 val |= pcnetAPROMReadU8(pThis, addr); 3854 3815 } 3855 #ifdef PCNET_DEBUG_IO 3856 Log2(("#%d pcnetR3MmioReadU16: addr=%#010x val = %#06x\n", PCNET_INST_NR, addr, val & 0xffff)); 3857 #endif 3816 Log6(("#%d pcnetR3MmioReadU16: addr=%#010x val = %#06x\n", PCNET_INST_NR, addr, val & 0xffff)); 3858 3817 return val; 3859 3818 } … … 3862 3821 { 3863 3822 VBOXSTRICTRC rcStrict; 3864 #ifdef PCNET_DEBUG_IO 3865 Log2(("#%d pcnetR3MmioWriteU32: off=%#010x val=%#010x\n", PCNET_INST_NR, off, val)); 3866 #endif 3823 Log6(("#%d pcnetR3MmioWriteU32: off=%#010x val=%#010x\n", PCNET_INST_NR, off, val)); 3867 3824 if (off & 0x10) 3868 3825 { … … 3898 3855 val |= pcnetAPROMReadU8(pThis, addr ); 3899 3856 } 3900 #ifdef PCNET_DEBUG_IO 3901 Log2(("#%d pcnetR3MmioReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val)); 3902 #endif 3857 Log6(("#%d pcnetR3MmioReadU32: addr=%#010x val=%#010x\n", PCNET_INST_NR, addr, val)); 3903 3858 return val; 3904 3859 }
Note:
See TracChangeset
for help on using the changeset viewer.