Changeset 5015 in vbox
- Timestamp:
- Sep 24, 2007 6:13:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r4787 r5015 2649 2649 case BCR_EECAS: 2650 2650 case BCR_PLAT: 2651 case BCR_MIICAS: 2651 2652 case BCR_MIIADDR: 2652 2653 LOG_REGISTER(("PCNet#%d: WRITE BCR%d, %#06x\n", … … 2670 2671 { 2671 2672 uint32_t val; 2673 bool autoneg, duplex, fast; 2672 2674 STAM_COUNTER_INC(&pData->StatMIIReads); 2675 2676 autoneg = (pData->aBCR[BCR_MIICAS] & 0x20) != 0; 2677 duplex = (pData->aBCR[BCR_MIICAS] & 0x10) != 0; 2678 fast = (pData->aBCR[BCR_MIICAS] & 0x08) != 0; 2673 2679 2674 2680 switch (miiaddr) … … 2676 2682 case 0: 2677 2683 /* MII basic mode control register. */ 2678 val = 0x1000; /* Enable auto negotiation. */ 2684 val = 0; 2685 if (autoneg) 2686 val |= 0x1000; /* Enable auto negotiation. */ 2687 if (fast) 2688 val |= 0x2000; /* 100 Mbps */ 2689 if (duplex) /* Full duplex forced */ 2690 val |= 0x0010; /* Full duplex */ 2679 2691 break; 2680 2692 2681 2693 case 1: 2682 2694 /* MII basic mode status register. */ 2683 if (pData->fLinkUp && !pData->fLinkTempDown) 2684 val = 0x7800 /* Can do 100mbps FD/HD and 10mbps FD/HD. */ 2685 | 0x0020 /* Auto-negotiation complete. */ 2686 | 0x0008 /* Able to do auto-negotiation. */ 2687 | 0x0004 /* Link status. */ 2688 | 0x0001; /* Extended Capability, i.e. registers 4+ valid. */ 2689 else 2690 { 2691 val = 0x7800 /* Can do 100mbps FD/HD and 10mbps FD/HD. */ 2692 | 0x0008 /* Able to do auto-negotiation. */ 2693 | 0x0001; /* Extended Capability, i.e. registers 4+ valid. */ 2695 val = 0x7800 /* Can do 100mbps FD/HD and 10mbps FD/HD. */ 2696 | 0x0040 /* Mgmt frame preamble not required. */ 2697 | 0x0020 /* Auto-negotiation complete. */ 2698 | 0x0008 /* Able to do auto-negotiation. */ 2699 | 0x0004 /* Link up. */ 2700 | 0x0001; /* Extended Capability, i.e. registers 4+ valid. */ 2701 if (!pData->fLinkUp || pData->fLinkTempDown) { 2702 val &= ~(0x0020 | 0x0004); 2694 2703 pData->cLinkDownReported++; 2695 2704 } 2705 if (!autoneg) { 2706 /* Auto-negotiation disabled. */ 2707 val &= ~(0x0020 | 0x0008); 2708 if (duplex) 2709 /* Full duplex forced. */ 2710 val &= ~0x2800; 2711 else 2712 /* Half duplex forced. */ 2713 val &= ~0x5000; 2714 2715 if (fast) 2716 /* 100 Mbps forced */ 2717 val &= ~0x1800; 2718 else 2719 /* 10 Mbps forced */ 2720 val &= ~0x6000; 2721 } 2696 2722 break; 2697 2723 2698 2724 case 2: 2699 2725 /* PHY identifier 1. */ 2700 val = 0 ; /* No name PHY. */2726 val = 0x22; /* Am79C874 PHY */ 2701 2727 break; 2702 2728 2703 2729 case 3: 2704 2730 /* PHY identifier 2. */ 2705 val = 0 ; /* No name PHY. */2731 val = 0x561b; /* Am79C874 PHY */ 2706 2732 break; 2707 2733 2708 2734 case 4: 2709 2735 /* Advertisement control register. */ 2710 val = 0x05e0 /* Try flow control, 100mbps FD/HD and 10mbps FD/HD. */ 2736 val = 0x01e0 /* Try 100mbps FD/HD and 10mbps FD/HD. */ 2737 #if 0 2738 // Advertising flow control is a) not the default, and b) confuses 2739 // the link speed detection routine in Windows PCnet driver 2740 | 0x0400 /* Try flow control. */ 2741 #endif 2711 2742 | 0x0001; /* CSMA selector. */ 2712 2743 break; … … 2717 2748 val = 0x8000 /* Next page bit. */ 2718 2749 | 0x4000 /* Link partner acked us. */ 2719 | 0x05e0 /* Can do flow control, 100mbps FD/HD and 10mbps FD/HD. */ 2750 | 0x0400 /* Can do flow control. */ 2751 | 0x01e0 /* Can do 100mbps FD/HD and 10mbps FD/HD. */ 2720 2752 | 0x0001; /* Use CSMA selector. */ 2721 2753 else … … 2825 2857 pData->iLog2DescSize = 3; 2826 2858 pData->aBCR[BCR_PLAT ] = 0xff06; 2859 pData->aBCR[BCR_MIIADDR ] = 0; /* Internal PHY on Am79C973 would be (0x1e << 5) */ 2827 2860 pData->aBCR[BCR_PCIVID] = PCIDevGetVendorId(&pData->PciDev); 2828 2861 pData->aBCR[BCR_PCISID] = PCIDevGetSubSystemId(&pData->PciDev); … … 4230 4263 pData->PciDev.config[0x06] = 0x80; /* status */ 4231 4264 pData->PciDev.config[0x07] = 0x02; 4232 pData->PciDev.config[0x08] = pData->fAm79C973 ? 0x 30 : 0x10; /* revision */4265 pData->PciDev.config[0x08] = pData->fAm79C973 ? 0x40 : 0x10; /* revision */ 4233 4266 pData->PciDev.config[0x09] = 0x00; 4234 4267 pData->PciDev.config[0x0a] = 0x00; /* ethernet network controller */
Note:
See TracChangeset
for help on using the changeset viewer.