VirtualBox

Changeset 44849 in vbox for trunk/src/VBox/Devices/VirtIO


Ignore:
Timestamp:
Feb 27, 2013 8:22:06 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83998
Message:

DevirtioNet.cpp: cleanups.

Location:
trunk/src/VBox/Devices/VirtIO
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VirtIO/Virtio.cpp

    r44528 r44849  
    308308 * @param   pDevIns     The device instance.
    309309 * @param   pvUser      Pointer to the device state structure.
    310  * @param   port        Port number used for the IN operation.
     310 * @param   Port        Port number used for the IN operation.
    311311 * @param   pu32        Where to store the result.
    312312 * @param   cb          Number of bytes read.
     
    315315int vpciIOPortIn(PPDMDEVINS         pDevIns,
    316316                 void              *pvUser,
    317                  RTIOPORT           port,
     317                 RTIOPORT           Port,
    318318                 uint32_t          *pu32,
    319319                 unsigned           cb,
     
    342342        }*/
    343343
    344     port -= pState->addrIOPort;
    345     switch (port)
     344    Port -= pState->addrIOPort;
     345    switch (Port)
    346346    {
    347347        case VPCI_HOST_FEATURES:
     
    382382
    383383        default:
    384             if (port >= VPCI_CONFIG)
    385             {
    386                 rc = pfnGetConfig(pState, port - VPCI_CONFIG, cb, pu32);
    387             }
     384            if (Port >= VPCI_CONFIG)
     385                rc = pfnGetConfig(pState, Port - VPCI_CONFIG, cb, pu32);
    388386            else
    389387            {
    390388                *pu32 = 0xFFFFFFFF;
    391                 rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "%s vpciIOPortIn: "
    392                                        "no valid port at offset port=%RTiop "
    393                                        "cb=%08x\n", szInst, port, cb);
     389                rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "%s vpciIOPortIn: no valid port at offset port=%RTiop cb=%08x\n",
     390                                       szInst, Port, cb);
    394391            }
    395392            break;
    396393    }
    397     Log3(("%s vpciIOPortIn:  At %RTiop in  %0*x\n",
    398           szInst, port, cb*2, *pu32));
     394    Log3(("%s vpciIOPortIn:  At %RTiop in  %0*x\n", szInst, Port, cb*2, *pu32));
    399395    STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIORead), a);
    400396    //vpciCsLeave(pState);
     
    413409 * @param   u32         The value to output.
    414410 * @param   cb          The value size in bytes.
     411 * @todo    r=bird: Use a callback table instead of passing 6 function pointers
     412 *          for potential operations with each I/O port write.
    415413 * @thread  EMT
    416414 */
    417415int vpciIOPortOut(PPDMDEVINS                pDevIns,
    418416                  void                     *pvUser,
    419                   RTIOPORT                  port,
     417                  RTIOPORT                  Port,
    420418                  uint32_t                  u32,
    421419                  unsigned                  cb,
     
    434432    STAM_PROFILE_ADV_START(&pState->CTXSUFF(StatIOWrite), a);
    435433
    436     port -= pState->addrIOPort;
    437     Log3(("%s virtioIOPortOut: At %RTiop out          %0*x\n", szInst, port, cb*2, u32));
    438 
    439     switch (port)
     434    Port -= pState->addrIOPort;
     435    Log3(("%s virtioIOPortOut: At %RTiop out          %0*x\n", szInst, Port, cb*2, u32));
     436
     437    switch (Port)
    440438    {
    441439        case VPCI_GUEST_FEATURES:
     
    521519
    522520        default:
    523             if (port >= VPCI_CONFIG)
    524                 rc = pfnSetConfig(pState, port - VPCI_CONFIG, cb, &u32);
     521            if (Port >= VPCI_CONFIG)
     522                rc = pfnSetConfig(pState, Port - VPCI_CONFIG, cb, &u32);
    525523            else
    526                 rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "%s vpciIOPortOut: no valid port at offset port=%RTiop cb=%08x\n", szInst, port, cb);
     524                rc = PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "%s vpciIOPortOut: no valid port at offset Port=%RTiop cb=%08x\n",
     525                                       szInst, Port, cb);
    527526            break;
    528527    }
  • trunk/src/VBox/Devices/VirtIO/Virtio.h

    r44529 r44849  
    55
    66/*
    7  * Copyright (C) 2009-2012 Oracle Corporation
     7 * Copyright (C) 2009-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121#include <iprt/ctype.h>
    2222
    23 #define VIRTIO_RELOCATE(p, o) *(RTHCUINTPTR *)&p += o
    24 
    25 /*
     23
     24/** @name Saved state versions.
    2625 * The saved state version is changed if either common or any of specific
    2726 * parts are changed. That is, it is perfectly possible that the version
     
    3130#define VIRTIO_SAVEDSTATE_VERSION_3_1_BETA1 1
    3231#define VIRTIO_SAVEDSTATE_VERSION           2
     32/** @} */
    3333
    3434#define DEVICE_PCI_VENDOR_ID                0x1AF4
     
    6363#define VRINGDESC_F_WRITE                   0x02
    6464
    65 struct VRingDesc
     65typedef struct VRingDesc
    6666{
    6767    uint64_t u64Addr;
     
    6969    uint16_t u16Flags;
    7070    uint16_t u16Next;
    71 };
    72 typedef struct VRingDesc VRINGDESC;
     71} VRINGDESC;
    7372typedef VRINGDESC *PVRINGDESC;
    7473
    7574#define VRINGAVAIL_F_NO_INTERRUPT 0x01
    7675
    77 struct VRingAvail
     76typedef struct VRingAvail
    7877{
    7978    uint16_t uFlags;
    8079    uint16_t uNextFreeIndex;
    8180    uint16_t auRing[1];
    82 };
    83 typedef struct VRingAvail VRINGAVAIL;
    84 
    85 struct VRingUsedElem
     81} VRINGAVAIL;
     82
     83typedef struct VRingUsedElem
    8684{
    8785    uint32_t uId;
    8886    uint32_t uLen;
    89 };
    90 typedef struct VRingUsedElem VRINGUSEDELEM;
     87} VRINGUSEDELEM;
    9188
    9289#define VRINGUSED_F_NO_NOTIFY 0x01
    9390
    94 struct VRingUsed
     91typedef struct VRingUsed
    9592{
    9693    uint16_t      uFlags;
    9794    uint16_t      uIndex;
    9895    VRINGUSEDELEM aRing[1];
    99 };
    100 typedef struct VRingUsed VRINGUSED;
     96} VRINGUSED;
    10197typedef VRINGUSED *PVRINGUSED;
    10298
    10399#define VRING_MAX_SIZE 1024
    104100
    105 struct VRing
     101typedef struct VRing
    106102{
    107103    uint16_t   uSize;
     
    110106    RTGCPHYS   addrAvail;
    111107    RTGCPHYS   addrUsed;
    112 };
    113 typedef struct VRing VRING;
     108} VRING;
    114109typedef VRING *PVRING;
    115110
    116 struct VQueue
     111typedef struct VQueue
    117112{
    118113    VRING    VRing;
     
    126121#endif
    127122    R3PTRTYPE(const char *) pcszName;
    128 };
    129 typedef struct VQueue VQUEUE;
     123} VQUEUE;
    130124typedef VQUEUE *PVQUEUE;
    131125
    132 struct VQueueElemSeg
     126typedef struct VQueueElemSeg
    133127{
    134128    RTGCPHYS addr;
    135129    void    *pv;
    136130    uint32_t cb;
    137 };
    138 typedef struct VQueueElemSeg VQUEUESEG;
    139 
    140 struct VQueueElem
     131} VQUEUESEG;
     132
     133typedef struct VQueueElem
    141134{
    142135    uint32_t  uIndex;
     
    145138    VQUEUESEG aSegsIn[VRING_MAX_SIZE];
    146139    VQUEUESEG aSegsOut[VRING_MAX_SIZE];
    147 };
    148 typedef struct VQueueElem VQUEUEELEM;
     140} VQUEUEELEM;
    149141typedef VQUEUEELEM *PVQUEUEELEM;
    150142
     
    159151
    160152/**
    161  * The state of the VirtIO PCI device
     153 * The core (/common) state of the VirtIO PCI device
    162154 *
    163155 * @implements  PDMILEDPORTS
    164156 */
    165 struct VPCIState_st
     157typedef struct VPCIState_st
    166158{
    167159    PDMCRITSECT            cs;      /**< Critical section - what is it protecting? */
     
    219211    STAMPROFILE            StatCsHC;
    220212#endif /* VBOX_WITH_STATISTICS */
    221 };
    222 typedef struct VPCIState_st VPCISTATE;
     213} VPCISTATE;
     214/** Pointer to the core (/common) state of a VirtIO PCI device. */
    223215typedef VPCISTATE *PVPCISTATE;
    224216
    225 /* Callbacks *****************************************************************/
     217/** @name Callbacks
     218 * @{ */
    226219typedef uint32_t (*PFNGETHOSTFEATURES)(void *pState);
    227220typedef uint32_t (*PFNGETHOSTMINIMALFEATURES)(void *pState);
     
    231224typedef int      (*PFNRESET)(void *pState);
    232225typedef void     (*PFNREADY)(void *pState);
    233 /*****************************************************************************/
     226/** @} */
    234227
    235228int vpciRaiseInterrupt(VPCISTATE *pState, int rcBusy, uint8_t u8IntCause);
     
    326319}
    327320
    328 #endif /* ___VBox_Virtio_h */
     321#endif /* !___VBox_Virtio_h */
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