Changeset 44849 in vbox for trunk/src/VBox/Devices/VirtIO
- Timestamp:
- Feb 27, 2013 8:22:06 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83998
- Location:
- trunk/src/VBox/Devices/VirtIO
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VirtIO/Virtio.cpp
r44528 r44849 308 308 * @param pDevIns The device instance. 309 309 * @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. 311 311 * @param pu32 Where to store the result. 312 312 * @param cb Number of bytes read. … … 315 315 int vpciIOPortIn(PPDMDEVINS pDevIns, 316 316 void *pvUser, 317 RTIOPORT port,317 RTIOPORT Port, 318 318 uint32_t *pu32, 319 319 unsigned cb, … … 342 342 }*/ 343 343 344 port -= pState->addrIOPort;345 switch ( port)344 Port -= pState->addrIOPort; 345 switch (Port) 346 346 { 347 347 case VPCI_HOST_FEATURES: … … 382 382 383 383 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); 388 386 else 389 387 { 390 388 *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); 394 391 } 395 392 break; 396 393 } 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)); 399 395 STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIORead), a); 400 396 //vpciCsLeave(pState); … … 413 409 * @param u32 The value to output. 414 410 * @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. 415 413 * @thread EMT 416 414 */ 417 415 int vpciIOPortOut(PPDMDEVINS pDevIns, 418 416 void *pvUser, 419 RTIOPORT port,417 RTIOPORT Port, 420 418 uint32_t u32, 421 419 unsigned cb, … … 434 432 STAM_PROFILE_ADV_START(&pState->CTXSUFF(StatIOWrite), a); 435 433 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) 440 438 { 441 439 case VPCI_GUEST_FEATURES: … … 521 519 522 520 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); 525 523 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); 527 526 break; 528 527 } -
trunk/src/VBox/Devices/VirtIO/Virtio.h
r44529 r44849 5 5 6 6 /* 7 * Copyright (C) 2009-201 2Oracle Corporation7 * Copyright (C) 2009-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #include <iprt/ctype.h> 22 22 23 #define VIRTIO_RELOCATE(p, o) *(RTHCUINTPTR *)&p += o 24 25 /* 23 24 /** @name Saved state versions. 26 25 * The saved state version is changed if either common or any of specific 27 26 * parts are changed. That is, it is perfectly possible that the version … … 31 30 #define VIRTIO_SAVEDSTATE_VERSION_3_1_BETA1 1 32 31 #define VIRTIO_SAVEDSTATE_VERSION 2 32 /** @} */ 33 33 34 34 #define DEVICE_PCI_VENDOR_ID 0x1AF4 … … 63 63 #define VRINGDESC_F_WRITE 0x02 64 64 65 struct VRingDesc65 typedef struct VRingDesc 66 66 { 67 67 uint64_t u64Addr; … … 69 69 uint16_t u16Flags; 70 70 uint16_t u16Next; 71 }; 72 typedef struct VRingDesc VRINGDESC; 71 } VRINGDESC; 73 72 typedef VRINGDESC *PVRINGDESC; 74 73 75 74 #define VRINGAVAIL_F_NO_INTERRUPT 0x01 76 75 77 struct VRingAvail76 typedef struct VRingAvail 78 77 { 79 78 uint16_t uFlags; 80 79 uint16_t uNextFreeIndex; 81 80 uint16_t auRing[1]; 82 }; 83 typedef struct VRingAvail VRINGAVAIL; 84 85 struct VRingUsedElem 81 } VRINGAVAIL; 82 83 typedef struct VRingUsedElem 86 84 { 87 85 uint32_t uId; 88 86 uint32_t uLen; 89 }; 90 typedef struct VRingUsedElem VRINGUSEDELEM; 87 } VRINGUSEDELEM; 91 88 92 89 #define VRINGUSED_F_NO_NOTIFY 0x01 93 90 94 struct VRingUsed91 typedef struct VRingUsed 95 92 { 96 93 uint16_t uFlags; 97 94 uint16_t uIndex; 98 95 VRINGUSEDELEM aRing[1]; 99 }; 100 typedef struct VRingUsed VRINGUSED; 96 } VRINGUSED; 101 97 typedef VRINGUSED *PVRINGUSED; 102 98 103 99 #define VRING_MAX_SIZE 1024 104 100 105 struct VRing101 typedef struct VRing 106 102 { 107 103 uint16_t uSize; … … 110 106 RTGCPHYS addrAvail; 111 107 RTGCPHYS addrUsed; 112 }; 113 typedef struct VRing VRING; 108 } VRING; 114 109 typedef VRING *PVRING; 115 110 116 struct VQueue111 typedef struct VQueue 117 112 { 118 113 VRING VRing; … … 126 121 #endif 127 122 R3PTRTYPE(const char *) pcszName; 128 }; 129 typedef struct VQueue VQUEUE; 123 } VQUEUE; 130 124 typedef VQUEUE *PVQUEUE; 131 125 132 struct VQueueElemSeg126 typedef struct VQueueElemSeg 133 127 { 134 128 RTGCPHYS addr; 135 129 void *pv; 136 130 uint32_t cb; 137 }; 138 typedef struct VQueueElemSeg VQUEUESEG; 139 140 struct VQueueElem 131 } VQUEUESEG; 132 133 typedef struct VQueueElem 141 134 { 142 135 uint32_t uIndex; … … 145 138 VQUEUESEG aSegsIn[VRING_MAX_SIZE]; 146 139 VQUEUESEG aSegsOut[VRING_MAX_SIZE]; 147 }; 148 typedef struct VQueueElem VQUEUEELEM; 140 } VQUEUEELEM; 149 141 typedef VQUEUEELEM *PVQUEUEELEM; 150 142 … … 159 151 160 152 /** 161 * The state of the VirtIO PCI device153 * The core (/common) state of the VirtIO PCI device 162 154 * 163 155 * @implements PDMILEDPORTS 164 156 */ 165 struct VPCIState_st157 typedef struct VPCIState_st 166 158 { 167 159 PDMCRITSECT cs; /**< Critical section - what is it protecting? */ … … 219 211 STAMPROFILE StatCsHC; 220 212 #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. */ 223 215 typedef VPCISTATE *PVPCISTATE; 224 216 225 /* Callbacks *****************************************************************/ 217 /** @name Callbacks 218 * @{ */ 226 219 typedef uint32_t (*PFNGETHOSTFEATURES)(void *pState); 227 220 typedef uint32_t (*PFNGETHOSTMINIMALFEATURES)(void *pState); … … 231 224 typedef int (*PFNRESET)(void *pState); 232 225 typedef void (*PFNREADY)(void *pState); 233 /** ***************************************************************************/226 /** @} */ 234 227 235 228 int vpciRaiseInterrupt(VPCISTATE *pState, int rcBusy, uint8_t u8IntCause); … … 326 319 } 327 320 328 #endif /* ___VBox_Virtio_h */321 #endif /* !___VBox_Virtio_h */
Note:
See TracChangeset
for help on using the changeset viewer.