VirtualBox

Changeset 33035 in vbox for trunk/src


Ignore:
Timestamp:
Oct 11, 2010 10:10:16 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66551
Message:

AHCI: checksumming in device identification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r33031 r33035  
    28022802}
    28032803
     2804static uint32_t ataChecksum(void* ptr, size_t count)
     2805{
     2806    uint8_t u8Sum = 0xa5, *p = (uint8_t*)ptr;
     2807    size_t i;
     2808
     2809    for (i = 0; i < count; i++)
     2810    {
     2811      u8Sum += *p++;
     2812    }
     2813
     2814    return (uint8_t)-(int32_t)u8Sum;
     2815}
     2816
    28042817static int ahciIdentifySS(PAHCIPort pAhciPort, void *pvBuf)
    28052818{
     
    28722885    p[75] = RT_H2LE_U16(31); /* We support 32 commands */
    28732886    p[76] = RT_H2LE_U16((1 << 8) | (1 << 2)); /* Native command queuing and Serial ATA Gen2 (3.0 Gbps) speed supported */
     2887
     2888    uint32_t uCsum = ataChecksum(p, 510);
     2889    p[255] = RT_H2LE_U16(0xa5 | (uCsum << 8)); /* Integrity word */
    28742890
    28752891    return VINF_SUCCESS;
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