VirtualBox

Changeset 25876 in vbox


Ignore:
Timestamp:
Jan 18, 2010 10:54:05 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56684
Message:

e1000: Revised EERD patch applied (http://www.virtualbox.org/ticket/6008)

Location:
trunk/src/VBox/Devices/Network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevE1000.cpp

    r25732 r25876  
    181181#define EECD_EE_REQ   0x40
    182182#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
    183190
    184191#define MDIC_DATA_MASK  0x0000FFFF
     
    578585        }
    579586
     587        bool readWord(uint32_t u32Addr, uint16_t *pu16Value)
     588        {
     589            return eeprom.readWord(u32Addr, pu16Value);
     590        }
     591
    580592        int load(PSSMHANDLE pSSM)
    581593        {
     
    10341046static int e1kRegReadEECD          (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value);
    10351047static int e1kRegWriteEECD         (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value);
     1048static int e1kRegWriteEERD         (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value);
    10361049static int e1kRegWriteMDIC         (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t u32Value);
    10371050static int e1kRegReadICR           (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value);
     
    10821095    { 0x00008, 0x00004, 0x0000FDFF, 0x00000000, e1kRegReadDefault      , e1kRegWriteUnimplemented, "STATUS"  , "Device Status" },
    10831096    { 0x00010, 0x00004, 0x000027F0, 0x00000070, e1kRegReadEECD         , e1kRegWriteEECD         , "EECD"    , "EEPROM/Flash Control/Data" },
    1084     { 0x00014, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, e1kRegReadUnimplemented, e1kRegWriteUnimplemented, "EERD"    , "EEPROM Read" },
     1097    { 0x00014, 0x00004, 0xFFFFFF10, 0xFFFFFF00, e1kRegReadDefault      , e1kRegWriteEERD         , "EERD"    , "EEPROM Read" },
    10851098    { 0x00018, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, e1kRegReadUnimplemented, e1kRegWriteUnimplemented, "CTRL_EXT", "Extended Device Control" },
    10861099    { 0x0001c, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, e1kRegReadUnimplemented, e1kRegWriteUnimplemented, "FLA"     , "Flash Access (N/A)" },
     
    21852198
    21862199/**
     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 */
     2212static 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/**
    21872236 * Write handler for MDI Control register.
    21882237 *
  • trunk/src/VBox/Devices/Network/DevEEPROM.cpp

    r24038 r25876  
    6060    }
    6161    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 */
     72bool 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;
    6281}
    6382
  • trunk/src/VBox/Devices/Network/DevEEPROM.h

    r24020 r25876  
    122122    uint32_t read();
    123123    void     write(uint32_t u32Wires);
     124    bool     readWord(uint32_t u32Addr, uint16_t *pu16Value);
    124125
    125126    void init(const uint16_t *pu16Initial = 0);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette