Changeset 5059 in vbox
- Timestamp:
- Sep 26, 2007 5:12:27 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r5015 r5059 1 1 /** $Id$ */ 2 2 /** @file 3 * AMD PC -Net II (Am79C970A +Am79C973) Ethernet Controller Emulation.3 * AMD PCnet-PCI II / PCnet-FAST III (Am79C970A / Am79C973) Ethernet Controller Emulation. 4 4 */ 5 5 … … 97 97 #define PCNET_PNPMMIO_SIZE 0x20 98 98 99 #define PCNET_SAVEDSTATE_VERSION 699 #define PCNET_SAVEDSTATE_VERSION 7 100 100 101 101 #define BCR_MAX_RAP 50 … … 238 238 bool fAm79C973; 239 239 bool afAlignment[5]; 240 uint32_t u32LinkSpeed; 240 241 241 242 #ifdef VBOX_WITH_STATISTICS … … 2565 2566 } 2566 2567 2568 /** 2569 * Encode a 32-bit link speed into a custom 16-bit floating-point value 2570 */ 2571 static uint32_t pcnetLinkSpd(uint32_t speed) 2572 { 2573 unsigned exp = 0; 2574 2575 while (speed & 0xFFFFE000) 2576 { 2577 speed /= 10; 2578 ++exp; 2579 } 2580 return (exp << 13) | speed; 2581 } 2582 2567 2583 static uint32_t pcnetCSRReadU16(PCNetState *pData, uint32_t u32RAP) 2568 2584 { … … 2582 2598 case 58: 2583 2599 return pcnetBCRReadU16(pData, BCR_SWS); 2600 case 68: /* Custom register to pass link speed to driver */ 2601 return pcnetLinkSpd(pData->u32LinkSpeed); 2584 2602 case 88: 2585 2603 val = pData->aCSR[89]; … … 3833 3851 SSMR3PutMem(pSSMHandle, &pData->MacConfigured, sizeof(pData->MacConfigured)); 3834 3852 SSMR3PutBool(pSSMHandle, pData->fAm79C973); 3853 SSMR3PutU32(pSSMHandle, pData->u32LinkSpeed); 3835 3854 #ifdef PCNET_NO_POLLING 3836 3855 return VINF_SUCCESS; … … 3873 3892 || SSMR3HandleGetAfter(pSSMHandle) == SSMAFTER_DEBUG_IT); 3874 3893 SSMR3GetBool(pSSMHandle, &pData->fAm79C973); 3894 SSMR3GetU32(pSSMHandle, &pData->u32LinkSpeed); 3875 3895 #ifndef PCNET_NO_POLLING 3876 3896 TMR3TimerLoad(pData->CTXSUFF(pTimerPoll), pSSMHandle); … … 4192 4212 * Validate configuration. 4193 4213 */ 4194 if (!CFGMR3AreValuesValid(pCfgHandle, "MAC\0CableConnected\0Am79C973\0 GCEnabled\0R0Enabled\0"))4214 if (!CFGMR3AreValuesValid(pCfgHandle, "MAC\0CableConnected\0Am79C973\0LineSpeed\0GCEnabled\0R0Enabled\0")) 4195 4215 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 4196 4216 N_("Invalid configuraton for pcnet device")); … … 4216 4236 return PDMDEV_SET_ERROR(pDevIns, rc, 4217 4237 N_("Configuration error: Failed to get the \"Am79C973\" value")); 4238 4239 rc = CFGMR3QueryU32(pCfgHandle, "LineSpeed", &pData->u32LinkSpeed); 4240 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 4241 pData->u32LinkSpeed = 100000; /* 100 Mbps (in kbps units)*/ 4242 else if (VBOX_FAILURE(rc)) 4243 return PDMDEV_SET_ERROR(pDevIns, rc, 4244 N_("Configuration error: Failed to get the \"LineSpeed\" value")); 4218 4245 4219 4246 #ifdef PCNET_GC_ENABLED
Note:
See TracChangeset
for help on using the changeset viewer.