Ticket #6008: e1000_eerd.patch
| File e1000_eerd.patch, 5.3 KB (added by , 15 years ago) |
|---|
-
src/VBox/Devices/Network/DevE1000.cpp
181 181 #define EECD_EE_REQ 0x40 182 182 #define EECD_EE_GNT 0x80 183 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 190 184 191 #define MDIC_DATA_MASK 0x0000FFFF 185 192 #define MDIC_DATA_SHIFT 0 186 193 #define MDIC_REG_MASK 0x001F0000 … … 577 584 eeprom.write(u32Wires); 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 { 582 594 return eeprom.load(pSSM); … … 1033 1045 static int e1kRegWriteCTRL (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value); 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); 1038 1051 static int e1kRegWriteICR (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value); … … 1081 1094 { 0x00000, 0x00004, 0xDBF31BE9, 0xDBF31BE9, e1kRegReadDefault , e1kRegWriteCTRL , "CTRL" , "Device Control" }, 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)" }, 1087 1100 { 0x00020, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, e1kRegReadDefault , e1kRegWriteMDIC , "MDIC" , "MDI Control" }, … … 2184 2197 } 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 * 2189 2238 * Handles PHY read/write requests; forwards requests to internal PHY device. -
src/VBox/Devices/Network/DevEEPROM.cpp
62 62 } 63 63 64 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; 81 } 82 83 /** 65 84 * Fetch next word pointer by m_u16Addr. 66 85 * 67 86 * m_u16Addr is advanced and mask is reset to support sequential reads. -
src/VBox/Devices/Network/DevEEPROM.h
121 121 #ifdef IN_RING3 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); 126 127

