Changeset 28628 in vbox
- Timestamp:
- Apr 23, 2010 8:23:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r28338 r28628 1510 1510 } 1511 1511 } 1512 1513 /** 1514 * Hardware reset. Revert all registers to initial values. 1515 * 1516 * @param pState The device state structure. 1517 */ 1518 PDMBOTHCBDECL(void) e1kHardReset(E1KSTATE *pState) 1519 { 1520 E1kLog(("%s Hard reset triggered\n", INSTANCE(pState))); 1521 memset(pState->auRegs, 0, sizeof(pState->auRegs)); 1522 memset(pState->aRecAddr.au32, 0, sizeof(pState->aRecAddr.au32)); 1523 #ifdef E1K_INIT_RA0 1524 memcpy(pState->aRecAddr.au32, pState->macConfigured.au8, 1525 sizeof(pState->macConfigured.au8)); 1526 pState->aRecAddr.array[0].ctl |= RA_CTL_AV; 1527 #endif /* E1K_INIT_RA0 */ 1528 STATUS = 0x0081; /* SPEED=10b (1000 Mb/s), FD=1b (Full Duplex) */ 1529 EECD = 0x0100; /* EE_PRES=1b (EEPROM present) */ 1530 CTRL = 0x0a09; /* FRCSPD=1b SPEED=10b LRST=1b FD=1b */ 1531 TSPMT = 0x01000400;/* TSMT=0400h TSPBP=0100h */ 1532 Assert(GET_BITS(RCTL, BSIZE) == 0); 1533 pState->u16RxBSize = 2048; 1534 1535 /* Reset promiscous mode */ 1536 if (pState->pDrvR3) 1537 pState->pDrvR3->pfnSetPromiscuousMode(pState->pDrvR3, false); 1538 } 1512 1539 #endif 1513 1540 … … 1696 1723 1697 1724 /** 1698 * Hardware reset. Revert all registers to initial values.1699 *1700 * @param pState The device state structure.1701 */1702 PDMBOTHCBDECL(void) e1kHardReset(E1KSTATE *pState)1703 {1704 E1kLog(("%s Hard reset triggered\n", INSTANCE(pState)));1705 memset(pState->auRegs, 0, sizeof(pState->auRegs));1706 memset(pState->aRecAddr.au32, 0, sizeof(pState->aRecAddr.au32));1707 #ifdef E1K_INIT_RA01708 memcpy(pState->aRecAddr.au32, pState->macConfigured.au8,1709 sizeof(pState->macConfigured.au8));1710 pState->aRecAddr.array[0].ctl |= RA_CTL_AV;1711 #endif /* E1K_INIT_RA0 */1712 STATUS = 0x0081; /* SPEED=10b (1000 Mb/s), FD=1b (Full Duplex) */1713 EECD = 0x0100; /* EE_PRES=1b (EEPROM present) */1714 CTRL = 0x0a09; /* FRCSPD=1b SPEED=10b LRST=1b FD=1b */1715 TSPMT = 0x01000400;/* TSMT=0400h TSPBP=0100h */1716 Assert(GET_BITS(RCTL, BSIZE) == 0);1717 pState->u16RxBSize = 2048;1718 }1719 1720 /**1721 1725 * Raise interrupt if not masked. 1722 1726 * … … 2173 2177 if (value & CTRL_RESET) 2174 2178 { /* RST */ 2179 #ifndef IN_RING3 2180 return VINF_IOM_HC_IOPORT_WRITE; 2181 #else 2175 2182 e1kHardReset(pState); 2183 #endif 2176 2184 } 2177 2185 else … … 2561 2569 static int e1kRegWriteRCTL(E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t value) 2562 2570 { 2571 /* Update promiscous mode */ 2572 bool fBecomePromiscous = !!(value & (RCTL_UPE | RCTL_MPE)); 2573 if (fBecomePromiscous != !!( RCTL & (RCTL_UPE | RCTL_MPE))) 2574 { 2575 /* Promiscuity has changed, pass the knowledge on. */ 2576 #ifndef IN_RING3 2577 return VINF_IOM_HC_IOPORT_WRITE; 2578 #else 2579 if (pState->pDrvR3) 2580 pState->pDrvR3->pfnSetPromiscuousMode(pState->pDrvR3, fBecomePromiscous); 2581 #endif 2582 } 2583 /* Adjust receive buffer size */ 2584 if (GET_BITS(RCTL, BSIZE) != GET_BITS_V(value, RCTL, BSIZE)) 2585 { 2586 pState->u16RxBSize = 2048 >> GET_BITS(RCTL, BSIZE); 2587 if (RCTL & RCTL_BSEX) 2588 pState->u16RxBSize *= 16; 2589 E1kLog2(("%s e1kRegWriteRCTL: Setting receive buffer size to %d\n", 2590 INSTANCE(pState), pState->u16RxBSize)); 2591 } 2563 2592 e1kRegWriteDefault(pState, offset, index, value); 2564 pState->u16RxBSize = 2048 >> GET_BITS(RCTL, BSIZE);2565 if (RCTL & RCTL_BSEX)2566 pState->u16RxBSize *= 16;2567 E1kLog2(("%s e1kRegWriteRCTL: Setting receive buffer size to %d\n",2568 INSTANCE(pState), pState->u16RxBSize));2569 2593 2570 2594 return VINF_SUCCESS; … … 5235 5259 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 5236 5260 return rc; 5261 5262 /* Update promiscous mode */ 5263 if (pState->pDrvR3) 5264 pState->pDrvR3->pfnSetPromiscuousMode(pState->pDrvR3, 5265 !!(RCTL & (RCTL_UPE | RCTL_MPE))); 5266 5237 5267 /* 5238 5268 * Force the link down here, since PDMNETWORKLINKSTATE_DOWN_RESUME is never
Note:
See TracChangeset
for help on using the changeset viewer.