VirtualBox

Changeset 89902 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 24, 2021 7:35:23 PM (3 years ago)
Author:
vboxsync
Message:

DevHda: Reordered HDAREGDESC so we avoid alignment padding. Saves ~900 bytes. bugref:9890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHda.cpp

    r89901 r89902  
    245245     *  specify the read/write handling policy of the register. */
    246246    uint32_t        fFlags;
     247    /** Index into the register storage array.
     248     * @todo r=bird: Bad structure layout. Move up before pfnRead. */
     249    uint32_t        mem_idx;
    247250    /** Read callback. */
    248251    FNHDAREGREAD   *pfnRead;
    249252    /** Write callback. */
    250253    FNHDAREGWRITE  *pfnWrite;
    251     /** Index into the register storage array.
    252      * @todo r=bird: Bad structure layout. Move up before pfnRead. */
    253     uint32_t        mem_idx;
    254254    /** Abbreviated name. */
    255255    const char     *abbrev;
     
    357357
    358358#define HDA_REG_ENTRY_EX(a_offBar, a_cbReg, a_fReadMask, a_fWriteMask, a_fFlags, a_pfnRead, a_pfnWrite, a_idxMap, a_szName, a_szDesc) \
    359     { a_offBar, a_cbReg, a_fReadMask, a_fWriteMask, a_fFlags, a_pfnRead, a_pfnWrite, a_idxMap, a_szName, a_szDesc }
     359    { a_offBar, a_cbReg, a_fReadMask, a_fWriteMask, a_fFlags, a_idxMap, a_pfnRead, a_pfnWrite, a_szName, a_szDesc }
    360360#define HDA_REG_ENTRY(a_offBar, a_cbReg, a_fReadMask, a_fWriteMask, a_fFlags, a_pfnRead, a_pfnWrite, a_ShortRegNm, a_szDesc) \
    361361    HDA_REG_ENTRY_EX(a_offBar, a_cbReg, a_fReadMask, a_fWriteMask, a_fFlags, a_pfnRead, a_pfnWrite, HDA_MEM_IND_NAME(a_ShortRegNm), #a_ShortRegNm, a_szDesc)
     
    365365/** Emits a single audio stream register set (e.g. OSD0) at a specified offset. */
    366366#define HDA_REG_MAP_STRM(offset, name) \
    367     /* offset        size     read mask   write mask  flags                  read callback   write callback     index + abbrev                description */ \
    368     /* -------       -------  ----------  ----------  ---------------------- --------------  -----------------  -----------------------------  ----------- */ \
     367                   /* offset         size     read mask   write mask  flags                  read callback   write callback     index, abbrev, description */ \
     368                   /* -------        -------  ----------  ----------  ---------------------- --------------  -----------------  -----------------------------  ----------- */ \
    369369    /* Offset 0x80 (SD0) */ \
    370     HDA_REG_ENTRY_STR(offset,        0x00003, 0x00FF001F, 0x00F0001F, HDA_RD_F_SD_WRITE_RUN, hdaRegReadU24 , hdaRegWriteSDCTL  , name, CTL,  " Stream Descriptor Control"), \
     370    HDA_REG_ENTRY_STR(offset,        0x00003, 0x00FF001F, 0x00F0001F, HDA_RD_F_SD_WRITE_RUN, hdaRegReadU24 , hdaRegWriteSDCTL  , name, CTL  , "Stream Descriptor Control"), \
    371371    /* Offset 0x83 (SD0) */ \
    372     HDA_REG_ENTRY_STR(offset + 0x3,  0x00001, 0x0000003C, 0x0000001C, HDA_RD_F_SD_WRITE_RUN, hdaRegReadU8  , hdaRegWriteSDSTS  , name, STS  , " Status" ), \
     372    HDA_REG_ENTRY_STR(offset + 0x3,  0x00001, 0x0000003C, 0x0000001C, HDA_RD_F_SD_WRITE_RUN, hdaRegReadU8  , hdaRegWriteSDSTS  , name, STS  , "Status" ), \
    373373    /* Offset 0x84 (SD0) */ \
    374     HDA_REG_ENTRY_STR(offset + 0x4,  0x00004, 0xFFFFFFFF, 0x00000000, HDA_RD_F_NONE,         hdaRegReadLPIB, hdaRegWriteU32    , name, LPIB , " Link Position In Buffer" ), \
     374    HDA_REG_ENTRY_STR(offset + 0x4,  0x00004, 0xFFFFFFFF, 0x00000000, HDA_RD_F_NONE,         hdaRegReadLPIB, hdaRegWriteU32    , name, LPIB , "Link Position In Buffer" ), \
    375375    /* Offset 0x88 (SD0) */ \
    376     HDA_REG_ENTRY_STR(offset + 0x8,  0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_F_NONE,         hdaRegReadU32 , hdaRegWriteSDCBL  , name, CBL  , " Cyclic Buffer Length" ), \
     376    HDA_REG_ENTRY_STR(offset + 0x8,  0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_F_NONE,         hdaRegReadU32 , hdaRegWriteSDCBL  , name, CBL  , "Cyclic Buffer Length" ), \
    377377    /* Offset 0x8C (SD0) -- upper 8 bits are reserved */ \
    378     HDA_REG_ENTRY_STR(offset + 0xC,  0x00002, 0x0000FFFF, 0x000000FF, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDLVI  , name, LVI  , " Last Valid Index" ), \
     378    HDA_REG_ENTRY_STR(offset + 0xC,  0x00002, 0x0000FFFF, 0x000000FF, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDLVI  , name, LVI  , "Last Valid Index" ), \
    379379    /* Reserved: FIFO Watermark. ** @todo Document this! */ \
    380     HDA_REG_ENTRY_STR(offset + 0xE,  0x00002, 0x00000007, 0x00000007, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDFIFOW, name, FIFOW, " FIFO Watermark" ), \
     380    HDA_REG_ENTRY_STR(offset + 0xE,  0x00002, 0x00000007, 0x00000007, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDFIFOW, name, FIFOW, "FIFO Watermark" ), \
    381381    /* Offset 0x90 (SD0) */ \
    382     HDA_REG_ENTRY_STR(offset + 0x10, 0x00002, 0x000000FF, 0x000000FF, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDFIFOS, name, FIFOS, " FIFO Size" ), \
     382    HDA_REG_ENTRY_STR(offset + 0x10, 0x00002, 0x000000FF, 0x000000FF, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDFIFOS, name, FIFOS, "FIFO Size" ), \
    383383    /* Offset 0x92 (SD0) */ \
    384     HDA_REG_ENTRY_STR(offset + 0x12, 0x00002, 0x00007F7F, 0x00007F7F, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDFMT  , name, FMT  , " Stream Format" ), \
     384    HDA_REG_ENTRY_STR(offset + 0x12, 0x00002, 0x00007F7F, 0x00007F7F, HDA_RD_F_NONE,         hdaRegReadU16 , hdaRegWriteSDFMT  , name, FMT  , "Stream Format" ), \
    385385    /* Reserved: 0x94 - 0x98. */ \
    386386    /* Offset 0x98 (SD0) */ \
    387     HDA_REG_ENTRY_STR(offset + 0x18, 0x00004, 0xFFFFFF80, 0xFFFFFF80, HDA_RD_F_NONE,         hdaRegReadU32 , hdaRegWriteSDBDPL , name, BDPL , " Buffer Descriptor List Pointer-Lower Base Address" ), \
     387    HDA_REG_ENTRY_STR(offset + 0x18, 0x00004, 0xFFFFFF80, 0xFFFFFF80, HDA_RD_F_NONE,         hdaRegReadU32 , hdaRegWriteSDBDPL , name, BDPL , "Buffer Descriptor List Pointer-Lower Base Address" ), \
    388388    /* Offset 0x9C (SD0) */ \
    389     HDA_REG_ENTRY_STR(offset + 0x1C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_F_NONE,         hdaRegReadU32 , hdaRegWriteSDBDPU , name, BDPU , " Buffer Descriptor List Pointer-Upper Base Address" )
     389    HDA_REG_ENTRY_STR(offset + 0x1C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_F_NONE,         hdaRegReadU32 , hdaRegWriteSDBDPU , name, BDPU , "Buffer Descriptor List Pointer-Upper Base Address" )
    390390
    391391/** Defines a single audio stream register set (e.g. OSD0). */
     
    396396static const HDAREGDESC g_aHdaRegMap[HDA_NUM_REGS] =
    397397{
    398     /* offset  size     read mask   write mask  flags          read callback     write callback       index + abbrev               */
    399     /*-------  -------  ----------  ----------  -------------- ----------------  -------------------  ------------------------     */
    400     //{ 0x00000, 0x00002, 0x0000FFFB, 0x00000000, HDA_RD_F_NONE, hdaRegReadU16   , hdaRegWriteUnimpl  , HDA_REG_IDX(GCAP)         }, /* Global Capabilities */
     398                /* offset  size     read mask   write mask  flags          read callback     write callback       index + abbrev               */
     399                /*-------  -------  ----------  ----------  -------------- ----------------  -------------------  ------------------------     */
    401400    HDA_REG_ENTRY(0x00000, 0x00002, 0x0000FFFB, 0x00000000, HDA_RD_F_NONE, hdaRegReadU16   , hdaRegWriteUnimpl  , GCAP,        "Global Capabilities" ),
    402401    HDA_REG_ENTRY(0x00002, 0x00001, 0x000000FF, 0x00000000, HDA_RD_F_NONE, hdaRegReadU8    , hdaRegWriteUnimpl  , VMIN,        "Minor Version" ),
Note: See TracChangeset for help on using the changeset viewer.

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