Changeset 25876 in vbox
- Timestamp:
- Jan 18, 2010 10:54:05 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56684
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r25732 r25876 181 181 #define EECD_EE_REQ 0x40 182 182 #define EECD_EE_GNT 0x80 183 184 #define EERD_START 0x00000001 185 #define EERD_DONE 0x00000010 186 #define EERD_DATA_MASK 0xFFFF0000 187 #define EERD_DATA_SHIFT 16 188 #define EERD_ADDR_MASK 0x0000FF00 189 #define EERD_ADDR_SHIFT 8 183 190 184 191 #define MDIC_DATA_MASK 0x0000FFFF … … 578 585 } 579 586 587 bool readWord(uint32_t u32Addr, uint16_t *pu16Value) 588 { 589 return eeprom.readWord(u32Addr, pu16Value); 590 } 591 580 592 int load(PSSMHANDLE pSSM) 581 593 { … … 1034 1046 static int e1kRegReadEECD (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value); 1035 1047 static int e1kRegWriteEECD (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value); 1048 static int e1kRegWriteEERD (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value); 1036 1049 static int e1kRegWriteMDIC (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value); 1037 1050 static int e1kRegReadICR (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value); … … 1082 1095 { 0x00008, 0x00004, 0x0000FDFF, 0x00000000, e1kRegReadDefault , e1kRegWriteUnimplemented, "STATUS" , "Device Status" }, 1083 1096 { 0x00010, 0x00004, 0x000027F0, 0x00000070, e1kRegReadEECD , e1kRegWriteEECD , "EECD" , "EEPROM/Flash Control/Data" }, 1084 { 0x00014, 0x00004, 0xFFFFFF FF, 0xFFFFFFFF, e1kRegReadUnimplemented, e1kRegWriteUnimplemented, "EERD" , "EEPROM Read" },1097 { 0x00014, 0x00004, 0xFFFFFF10, 0xFFFFFF00, e1kRegReadDefault , e1kRegWriteEERD , "EERD" , "EEPROM Read" }, 1085 1098 { 0x00018, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, e1kRegReadUnimplemented, e1kRegWriteUnimplemented, "CTRL_EXT", "Extended Device Control" }, 1086 1099 { 0x0001c, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, e1kRegReadUnimplemented, e1kRegWriteUnimplemented, "FLA" , "Flash Access (N/A)" }, … … 2185 2198 2186 2199 /** 2200 * Write handler for EEPROM Read register. 2201 * 2202 * Handles EEPROM word access requests, reads EEPROM and stores the result 2203 * into DATA field. 2204 * 2205 * @param pState The device state structure. 2206 * @param offset Register offset in memory-mapped frame. 2207 * @param index Register index in register array. 2208 * @param value The value to store. 2209 * @param mask Used to implement partial writes (8 and 16-bit). 2210 * @thread EMT 2211 */ 2212 static int e1kRegWriteEERD(E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t value) 2213 { 2214 #ifdef IN_RING3 2215 /* Make use of 'writable' and 'readable' masks. */ 2216 e1kRegWriteDefault(pState, offset, index, value); 2217 /* DONE and DATA are set only if read was triggered by START. */ 2218 if (value & EERD_START) 2219 { 2220 uint16_t tmp; 2221 STAM_PROFILE_ADV_START(&pState->StatEEPROMRead, a); 2222 if (pState->eeprom.readWord(GET_BITS_V(value, EERD, ADDR), &tmp)) 2223 SET_BITS(EERD, DATA, tmp); 2224 EERD |= EERD_DONE; 2225 STAM_PROFILE_ADV_STOP(&pState->StatEEPROMRead, a); 2226 } 2227 2228 return VINF_SUCCESS; 2229 #else /* !IN_RING3 */ 2230 return VINF_IOM_HC_MMIO_WRITE; 2231 #endif /* !IN_RING3 */ 2232 } 2233 2234 2235 /** 2187 2236 * Write handler for MDI Control register. 2188 2237 * -
trunk/src/VBox/Devices/Network/DevEEPROM.cpp
r24038 r25876 60 60 } 61 61 m_u16Mask = DATA_MSB; 62 } 63 64 /** 65 * Reads one word at specified location. 66 * 67 * @returns True if read was successful. 68 * 69 * @param u32Addr Address to read from 70 * @param pu16Value Placeholder to store the value 71 */ 72 bool EEPROM93C46::readWord(uint32_t u32Addr, uint16_t *pu16Value) 73 { 74 if (u32Addr < SIZE) 75 { 76 *pu16Value = m_au16Data[u32Addr]; 77 return true; 78 } 79 80 return false; 62 81 } 63 82 -
trunk/src/VBox/Devices/Network/DevEEPROM.h
r24020 r25876 122 122 uint32_t read(); 123 123 void write(uint32_t u32Wires); 124 bool readWord(uint32_t u32Addr, uint16_t *pu16Value); 124 125 125 126 void init(const uint16_t *pu16Initial = 0);
Note:
See TracChangeset
for help on using the changeset viewer.