VirtualBox

Changeset 82142 in vbox


Ignore:
Timestamp:
Nov 24, 2019 12:55:18 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134952
Message:

DevPCNet: Logging cleanups. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r82141 r82142  
    8484#define PCNET_GC_ENABLED
    8585
    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 */
    9593
    9694#define PCNET_IOPORT_SIZE               0x20
     
    644642*   Internal Functions                                                                                                           *
    645643*********************************************************************************************************************************/
    646 #define PRINT_TMD(T) Log2((    \
     644#define PRINT_TMD(T) Log10((    \
    647645        "TMD0 : TBADR=%#010x\n" \
    648646        "TMD1 : OWN=%d, ERR=%d, FCS=%d, LTI=%d, "       \
     
    661659        (T)->tmd2.tdr, (T)->tmd2.trc))
    662660
    663 #define PRINT_RMD(R) Log2((    \
     661#define PRINT_RMD(R) Log9((    \
    664662        "RMD0 : RBADR=%#010x\n" \
    665663        "RMD1 : OWN=%d, ERR=%d, FRAM=%d, OFLO=%d, "     \
     
    952950#pragma pack()
    953951
    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)));                    \
    965962} while (0)
    966963
     
    10651062    struct ether_header *hdr = (struct ether_header *)buf;
    10661063    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)
    10681065    result = !CSR_DRCVPA(pThis) && !memcmp(hdr->ether_dhost, pThis->aCSR + 12, 6);
    10691066#else
     
    10781075#endif
    10791076
    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));
    10871083    RT_NOREF_PV(size);
    10881084    return result;
     
    10941090    struct ether_header *hdr = (struct ether_header *)buf;
    10951091    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));
    10991093    RT_NOREF_PV(size);
    11001094   return result;
     
    19651959            cbPacket = (int)cbToRecv;                           Assert((size_t)cbPacket == cbToRecv);
    19661960
    1967 #ifdef PCNET_DEBUG_MATCH
     1961#ifdef LOG_ENABLED
    19681962            PRINT_PKTHDR(buf);
    19691963#endif
     
    20862080            Log(("#%d RCVRC=%d CRDA=%#010x\n", PCNET_INST_NR,
    20872081                 CSR_RCVRC(pThis), PHYSADDR(pThis, CSR_CRDA(pThis))));
    2088 #ifdef PCNET_DEBUG_RMD
     2082#ifdef LOG_ENABLED
    20892083            PRINT_RMD(&rmd);
    20902084#endif
     
    24712465            break;
    24722466
    2473 #ifdef PCNET_DEBUG_TMD
    2474         Log2(("#%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))));
    24752469        PRINT_TMD(&tmd);
    24762470#endif
     
    28152809          PCNET_INST_NR, CSR_CXDA(pThis), CSR_XMTRL(pThis), CSR_XMTRC(pThis)));
    28162810#endif
    2817 #ifdef PCNET_DEBUG_TMD
     2811#ifdef LOG_ENABLED
    28182812    if (CSR_CXDA(pThis))
    28192813    {
    28202814        TMD tmd;
    28212815        pcnetTmdLoad(pThis, &tmd, PHYSADDR(pThis, CSR_CXDA(pThis)), false);
    2822         Log2(("#%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))));
    28232817        PRINT_TMD(&tmd);
    28242818    }
     
    28632857{
    28642858    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));
    28682860    switch (u32RAP)
    28692861    {
     
    31113103            val = pThis->aCSR[u32RAP];
    31123104    }
    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));
    31163106    return val;
    31173107}
     
    31203110{
    31213111    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));
    31253113    switch (u32RAP)
    31263114    {
     
    31773165        case BCR_MIIMDR:
    31783166            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));
    31823168            break;
    31833169
     
    33413327    }
    33423328
    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));
    33463330    return val;
    33473331}
     
    33823366            break;
    33833367    }
    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));
    33873369    return val;
    33883370}
     
    35493531{
    35503532    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));
    35543534    if (RT_LIKELY(!BCR_DWIO(pThis)))
    35553535    {
     
    35853565    pcnetUpdateIrq(pThis);
    35863566
    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));
    35903568    return val;
    35913569}
     
    35953573    VBOXSTRICTRC rc = VINF_SUCCESS;
    35963574
    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));
    36003576    if (RT_LIKELY(!BCR_DWIO(pThis)))
    36013577    {
     
    36573633
    36583634skip_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));
    36623636    return val;
    36633637}
     
    36673641    VBOXSTRICTRC rc = VINF_SUCCESS;
    36683642
    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));
    36733644    if (RT_LIKELY(BCR_DWIO(pThis)))
    36743645    {
     
    36923663        /* switch device to dword I/O mode */
    36933664        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"));
    36973666    }
    36983667    else
     
    37373706
    37383707skip_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));
    37423709    return val;
    37433710}
     
    38023769static void pcnetR3MmioWriteU8(PPCNETSTATE pThis, RTGCPHYS off, uint32_t val)
    38033770{
    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));
    38073772    if (!(off & 0x10))
    38083773        pcnetAPROMWriteU8(pThis, off, val);
     
    38143779    if (!(addr & 0x10))
    38153780        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));
    38193782    return val;
    38203783}
     
    38233786{
    38243787    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));
    38283789    if (off & 0x10)
    38293790    {
     
    38533814        val |= pcnetAPROMReadU8(pThis, addr);
    38543815    }
    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));
    38583817    return val;
    38593818}
     
    38623821{
    38633822    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));
    38673824    if (off & 0x10)
    38683825    {
     
    38983855        val |= pcnetAPROMReadU8(pThis, addr  );
    38993856    }
    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));
    39033858    return val;
    39043859}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette