- Timestamp:
- Jan 24, 2011 2:24:34 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pci.h
r35358 r35676 984 984 return (pDev->Int.s.uFlags & PCIDEV_FLAG_MSIX_CAPABLE) != 0; 985 985 } 986 987 DECLINLINE(void) PCISetPassthrough(PPCIDEVICE pDev) 988 { 989 pDev->Int.s.uFlags |= PCIDEV_FLAG_PASSTHROUGH; 990 } 991 992 DECLINLINE(void) PCIClearPassthrough(PPCIDEVICE pDev) 993 { 994 pDev->Int.s.uFlags &= ~PCIDEV_FLAG_PASSTHROUGH; 995 } 996 997 DECLINLINE(bool) PCIIsPassthrough(PPCIDEVICE pDev) 998 { 999 return (pDev->Int.s.uFlags & PCIDEV_FLAG_PASSTHROUGH) != 0; 1000 } 986 1001 #endif 987 1002 … … 1071 1086 } 1072 1087 1073 voidfromLong(int32_t value)1088 PciBusAddress& fromLong(int32_t value) 1074 1089 { 1075 1090 iBus = (value >> 8) & 0xff; 1076 1091 iDevice = (value & 0xff) >> 3; 1077 1092 iFn = (value & 7); 1093 return *this; 1078 1094 } 1079 1095 }; -
trunk/include/VBox/vmm/pdmdev.h
r35361 r35676 1822 1822 #define PDM_HPETHLPR3_VERSION PDM_VERSION_MAKE(0xffec, 2, 0) 1823 1823 1824 1824 typedef struct PDMPCIRAWREG 1825 { 1826 /** Struct version+magic number (PDM_PCIRAWREG_VERSION). */ 1827 uint32_t u32Version; 1828 } PDMPCIRAWREG; 1829 1830 /** Pointer to a raw PCI registration structure. */ 1831 typedef PDMPCIRAWREG *PPDMPCIRAWREG; 1832 /** Current PDMPCIRAWREG version number. */ 1833 #define PDM_PCIRAWREG_VERSION PDM_VERSION_MAKE(0xffe3, 1, 0) 1834 struct PDMPCIRAWHLPRC 1835 { 1836 uint32_t u32Version; 1837 /** Just a safety precaution. */ 1838 uint32_t u32TheEnd; 1839 }; 1840 typedef RCPTRTYPE(PDMPCIRAWHLPRC *) PPDMPCIRAWHLPRC; 1841 typedef RCPTRTYPE(const PDMPCIRAWHLPRC *) PCPDMPCIRAWHLPRC; 1842 1843 struct PDMPCIRAWHLPR0 1844 { 1845 uint32_t u32Version; 1846 /** Just a safety precaution. */ 1847 uint32_t u32TheEnd; 1848 }; 1849 typedef R0PTRTYPE(PDMPCIRAWHLPR0 *) PPDMPCIRAWHLPR0; 1850 typedef R0PTRTYPE(const PDMPCIRAWHLPR0 *) PCPDMPCIRAWHLPR0; 1851 1852 1853 typedef struct PDMPCIRAWHLPR3 1854 { 1855 uint32_t u32Version; 1856 /** 1857 * Gets the address of the RC PCI raw helpers. 1858 * 1859 * This should be called at both construction and relocation time 1860 * to obtain the correct address of the RC helpers. 1861 * 1862 * @returns RC pointer to the PCI raw helpers. 1863 * @param pDevIns Device instance of the raw PCI device. 1864 */ 1865 DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns)); 1866 1867 /** 1868 * Gets the address of the R0 PCI raw helpers. 1869 * 1870 * This should be called at both construction and relocation time 1871 * to obtain the correct address of the R0 helpers. 1872 * 1873 * @returns R0 pointer to the PCI raw helpers. 1874 * @param pDevIns Device instance of the raw PCI device. 1875 */ 1876 DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns)); 1877 1878 /** Just a safety precaution. */ 1879 uint32_t u32TheEnd; 1880 } PDMPCIRAWHLPR3; 1881 /** Pointer to raw PCI R3 helpers. */ 1882 typedef R3PTRTYPE(PDMPCIRAWHLPR3 *) PPDMPCIRAWHLPR3; 1883 /** Pointer to const raw PCI R3 helpers. */ 1884 typedef R3PTRTYPE(const PDMPCIRAWHLPR3 *) PCPDMPCIRAWHLPR3; 1885 1886 /** Current PDMPCIRAWHLPRC version number. */ 1887 #define PDM_PCIRAWHLPRC_VERSION PDM_VERSION_MAKE(0xfff0, 1, 0) 1888 /** Current PDMPCIRAWHLPR0 version number. */ 1889 #define PDM_PCIRAWHLPR0_VERSION PDM_VERSION_MAKE(0xfff1, 1, 0) 1890 /** Current PDMPCIRAWHLPR3 version number. */ 1891 #define PDM_PCIRAWHLPR3_VERSION PDM_VERSION_MAKE(0xfff2, 1, 0) 1825 1892 1826 1893 #ifdef IN_RING3 … … 2921 2988 */ 2922 2989 DECLR3CALLBACKMEMBER(int, pfnHPETRegister,(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3)); 2990 2991 /** 2992 * Register the raw PCI device. 2993 * 2994 * @returns VBox status code. 2995 * @param pDevIns The device instance. 2996 * @param pHpetReg Pointer to a raw PCI registration structure. 2997 * @param ppHpetHlpR3 Where to store the pointer to the raw PCI 2998 * helpers. 2999 */ 3000 DECLR3CALLBACKMEMBER(int, pfnPciRawRegister,(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3)); 2923 3001 2924 3002 /** … … 4455 4533 } 4456 4534 4535 /** 4536 * @copydoc PDMDEVHLPR3::pfnPciRawRegister 4537 */ 4538 DECLINLINE(int) PDMDevHlpPciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3) 4539 { 4540 return pDevIns->pHlpR3->pfnPciRawRegister(pDevIns, pPciRawReg, ppPciRawHlpR3); 4541 } 4542 4457 4543 /** 4458 4544 * @copydoc PDMDEVHLPR3::pfnDMACRegister -
trunk/include/VBox/vmm/pdmdrv.h
r35361 r35676 338 338 /** SCSI driver. */ 339 339 #define PDM_DRVREG_CLASS_SCSI RT_BIT(15) 340 /** Generic raw PCI device driver. */ 341 #define PDM_DRVREG_CLASS_PCIRAW RT_BIT(16) 340 342 /** @} */ 341 343 -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r35397 r35676 949 949 static DECLCALLBACK(int) ich9pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM) 950 950 { 951 Assert(!PCIIsPassthrough(pPciDev)); 951 952 return SSMR3PutMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config)); 952 953 } … … 1201 1202 */ 1202 1203 uint8_t const fBridge = fIsBridge ? 2 : 1; 1204 Assert(!PCIIsPassthrough(pDev)); 1203 1205 uint8_t *pbDstConfig = &pDev->config[0]; 1206 1204 1207 for (uint32_t i = 0; i < RT_ELEMENTS(s_aFields); i++) 1205 1208 if (s_aFields[i].fBridge & fBridge) … … 1395 1398 1396 1399 /* commit the loaded device config. */ 1400 Assert(!PCIIsPassthrough(pDev)); 1397 1401 pciR3CommonRestoreConfig(pDev, &DevTmp.config[0], false ); /** @todo fix bridge fun! */ 1398 1402 … … 1426 1430 static DECLCALLBACK(int) ich9pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM) 1427 1431 { 1432 Assert(!PCIIsPassthrough(pPciDev)); 1428 1433 return SSMR3GetMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config)); 1429 1434 } … … 1751 1756 } 1752 1757 1758 AssertMsgReturn(u32Address + len <= 256, ("Read after end of PCI config space\n"), 1759 0); 1753 1760 if ( PCIIsMsiCapable(aDev) 1754 1761 && (u32Address >= aDev->Int.s.u8MsiCapOffset) … … 2146 2153 if (pPciDev != NULL) 2147 2154 { 2155 if (PCIIsPassthrough(pPciDev)) 2156 { 2157 printIndent(pHlp, iIndent); 2158 /** 2159 * For passthrough devices MSI/MSI-X mostly reflects the way interrupts delivered to the guest, 2160 * as host driver handles real devices interrupts. 2161 */ 2162 pHlp->pfnPrintf(pHlp, "%02x:%02x:%02x %s: %s%s - PASSTHROUGH\n", 2163 pBus->iBus, (iDev >> 3) & 0xff, iDev & 0x7, 2164 pPciDev->name, 2165 PCIIsMsiCapable(pPciDev) ? " MSI" : "", 2166 PCIIsMsixCapable(pPciDev) ? " MSI-X" : "" 2167 ); 2168 continue; 2169 } 2148 2170 printIndent(pHlp, iIndent); 2149 2171 pHlp->pfnPrintf(pHlp, "%02x:%02x:%02x %s: %04x-%04x%s%s", -
trunk/src/VBox/Devices/Bus/DevPciRaw.cpp
r35358 r35676 20 20 *******************************************************************************/ 21 21 #define LOG_GROUP LOG_GROUP_DEV_PCI 22 #include <VBox/log.h> 23 #define PCI_INCLUDE_PRIVATE 24 #include <VBox/pci.h> 22 25 #include <VBox/vmm/pdmdev.h> 23 26 #include <VBox/log.h> 24 27 #include <VBox/vmm/stam.h> 28 #include <VBox/vmm/pdmpci.h> 25 29 #include <iprt/assert.h> 26 30 #include <iprt/string.h> 31 #include <iprt/uuid.h> 27 32 28 33 #include "VBoxDD.h" … … 38 43 *******************************************************************************/ 39 44 40 /* Temporary PDM stubs */41 typedef struct PDMPCIRAWREG42 {43 /** Struct version+magic number (PDM_PCIRAWREG_VERSION). */44 uint32_t u32Version;45 46 } PDMPCIRAWREG;47 /** Pointer to a raw PCI registration structure. */48 typedef PDMPCIRAWREG *PPDMPCIRAWREG;49 50 /** Current PDMPCIRAWREG version number. */51 #define PDM_PCIRAWREG_VERSION PDM_VERSION_MAKE(0xffe3, 1, 0)52 53 struct PDMPCIRAWHLPRC54 {55 uint32_t u32Version;56 };57 typedef RCPTRTYPE(PDMPCIRAWHLPRC *) PPDMPCIRAWHLPRC;58 typedef RCPTRTYPE(const PDMPCIRAWHLPRC *) PCPDMPCIRAWHLPRC;59 60 struct PDMPCIRAWHLPR061 {62 uint32_t u32Version;63 };64 typedef R0PTRTYPE(PDMPCIRAWHLPR0 *) PPDMPCIRAWHLPR0;65 typedef R0PTRTYPE(const PDMPCIRAWHLPR0 *) PCPDMPCIRAWHLPR0;66 67 struct PDMPCIRAWHLPR368 {69 uint32_t u32Version;70 /**71 * Gets the address of the RC PCI raw helpers.72 *73 * This should be called at both construction and relocation time74 * to obtain the correct address of the RC helpers.75 *76 * @returns RC pointer to the PCI raw helpers.77 * @param pDevIns Device instance of the raw PCI device.78 */79 DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));80 81 /**82 * Gets the address of the R0 PCI raw helpers.83 *84 * This should be called at both construction and relocation time85 * to obtain the correct address of the R0 helpers.86 *87 * @returns R0 pointer to the PCI raw helpers.88 * @param pDevIns Device instance of the raw PCI device.89 */90 DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));91 92 /** Just a safety precaution. */93 uint32_t u32TheEnd;94 };95 /** Pointer to raw PCI R3 helpers. */96 typedef R3PTRTYPE(PDMPCIRAWHLPR3 *) PPDMPCIRAWHLPR3;97 /** Pointer to const raw PCI R3 helpers. */98 typedef R3PTRTYPE(const PDMPCIRAWHLPR3 *) PCPDMPCIRAWHLPR3;99 100 /**101 * @copydoc PDMDEVHLPR3::pfnPciRawRegister102 */103 DECLINLINE(int) PDMDevHlpPciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3)104 {105 //return pDevIns->pHlpR3->pfnPciRawRegister(pDevIns, pPciRawReg, ppPciRawHlpR3);106 return VINF_SUCCESS;107 }108 109 /* End of PDM stubs */110 111 45 typedef struct PciRawState 112 46 { … … 129 63 PCIDEVICE aPciDevice; 130 64 65 /* Device name, as provided by Main */ 66 char szDeviceName[64]; 67 131 68 /* Address of device on the host */ 132 PciBusAddress aHostDeviceAddress;69 int32_t i32HostDeviceAddress; 133 70 /* Address of device in the guest */ 134 PciBusAddress aGuestDeviceAddress;71 int32_t i32GuestDeviceAddress; 135 72 136 73 /* Global device lock */ 137 74 PDMCRITSECT csLock; 75 /** 76 * Device port - LUN#0. 77 * 78 * @implements PDMIBASE 79 * @implements PDMIPCIRAW 80 */ 81 struct 82 { 83 /** The base interface for the PCI device port. */ 84 PDMIBASE IBase; 85 /** The device port base interface. */ 86 PDMIPCIRAW IDevice; 87 88 /** The base interface of the attached raw PCI driver. */ 89 R3PTRTYPE(PPDMIBASE) pDrvBase; 90 /** The device interface of the attached raw PCI driver. */ 91 R3PTRTYPE(PPDMIPCIRAWCONNECTOR) pDrv; 92 } Lun0; 138 93 } PciRawState; 139 94 95 96 /** Pointer to the raw PCI instance data. */ 97 typedef PciRawState *PPciRawState; 140 98 141 99 #ifndef VBOX_DEVICE_STRUCT_TESTCASE … … 150 108 RT_C_DECLS_END 151 109 152 /*153 * Temporary control to disable locking if problems found154 */155 110 DECLINLINE(int) pcirawLock(PciRawState* pThis, int rcBusy) 156 111 { … … 331 286 } 332 287 288 static DECLCALLBACK(int) pcirawAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 289 { 290 PciRawState *pThis = PDMINS_2_DATA(pDevIns, PciRawState *); 291 292 LogFlow(("pcirawAttach: LUN%d\n", iLUN)); 293 /* Not yet used */ 294 return 0; 295 } 296 297 static DECLCALLBACK(void) pcirawDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 298 { 299 PciRawState *pThis = PDMINS_2_DATA(pDevIns, PciRawState *); 300 301 LogFlow(("pcirawDetach: LUN%d\n", iLUN)); 302 /* Not yet used */ 303 } 304 333 305 /** 334 306 * Initialization routine. … … 337 309 * @param pDevIns The device instance data. 338 310 */ 339 static int pcirawInit(PPDMDEVINS pDevIns, PciBusAddress hostAddress )311 static int pcirawInit(PPDMDEVINS pDevIns, PciBusAddress hostAddress, PciBusAddress guestAddress) 340 312 { 341 313 unsigned i; … … 349 321 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 350 322 351 pThis->aHostDeviceAddress.init(hostAddress); 323 pThis->i32HostDeviceAddress = hostAddress.asLong(); 324 pThis->i32GuestDeviceAddress = guestAddress.asLong(); 352 325 353 326 pcirawReset(pDevIns); 354 327 355 328 return VINF_SUCCESS; 329 } 330 static uint32_t pcirawConfigRead(PPCIDEVICE pPciDev, uint32_t Address, unsigned cb) 331 { 332 PPDMDEVINS pDevIns = pPciDev->pDevIns; 333 PciRawState* pThis = PDMINS_2_DATA(pDevIns, PciRawState *); 334 335 Log2(("rawpci: PCI config read: 0x%x (%d)\n", Address, cb)); 336 337 return 0; 338 } 339 340 static void pcirawConfigWrite(PPCIDEVICE pPciDev, uint32_t Address, uint32_t u32Value, unsigned cb) 341 { 342 PPDMDEVINS pDevIns = pPciDev->pDevIns; 343 PciRawState *pThis = PDMINS_2_DATA(pDevIns, PciRawState *); 344 345 Log2(("rawpci: PCI config write: 0x%x -> 0x%x (%d)\n", u32Value, Address, cb)); 346 } 347 348 349 /** 350 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 351 */ 352 static DECLCALLBACK(void *) pcirawQueryInterface(PPDMIBASE pInterface, const char *pszIID) 353 { 354 PciRawState* pThis = RT_FROM_CPP_MEMBER(pInterface, PciRawState, Lun0.IBase); 355 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->Lun0.IBase); 356 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIPCIRAW, &pThis->Lun0.IDevice); 357 return NULL; 358 } 359 360 static DECLCALLBACK(int) pcirawFoo(PPDMIPCIRAW pInterface) 361 { 362 return 0; 363 356 364 } 357 365 … … 373 381 "GCEnabled\0" 374 382 "R0Enabled\0" 383 "DeviceName\0" 384 "GuestPCIBusNo\0" 385 "GuestPCIDeviceNo\0" 386 "GuestPCIFunctionNo\0" 375 387 "HostPCIBusNo\0" 376 388 "HostPCIDeviceNo\0" … … 390 402 N_("Configuration error: failed to read R0Enabled as boolean")); 391 403 392 /* Obtain host device address */ 393 uint32_t u32Bus, u32Device, u32Fn; 394 rc = CFGMR3QueryU32(pCfg, "HostPCIBusNo", &u32Bus); 404 405 rc = CFGMR3QueryString(pCfg, "DeviceName", pThis->szDeviceName, sizeof(pThis->szDeviceName)); 395 406 if (RT_FAILURE(rc)) 396 407 return PDMDEV_SET_ERROR(pDevIns, rc, 397 N_("Configuration error: Querying \"HostPCIBusNo\" as a int failed")); 398 rc = CFGMR3QueryU32(pCfg, "HostPCIDeviceNo", &u32Device); 399 if (RT_FAILURE(rc)) 400 return PDMDEV_SET_ERROR(pDevIns, rc, 401 N_("Configuration error: Querying \"HostPCIDeviceNo\" as a int failed")); 402 rc = CFGMR3QueryU32(pCfg, "HostPCIFunctionNo", &u32Fn); 403 if (RT_FAILURE(rc)) 404 return PDMDEV_SET_ERROR(pDevIns, rc, 405 N_("Configuration error: Querying \"HostPCIFunctionNo\" as a int failed")); 406 407 408 /* Initialize the device state */ 409 rc = pcirawInit(pDevIns, PciBusAddress(u32Bus, u32Device, u32Fn)); 410 if (RT_FAILURE(rc)) 411 return rc; 412 413 pThis->pDevInsR3 = pDevIns; 414 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 415 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 416 417 /* 418 * Register the raw device and get helpers. 419 */ 420 PciRawReg.u32Version = PDM_PCIRAWREG_VERSION; 421 rc = PDMDevHlpPciRawRegister(pDevIns, &PciRawReg, &pThis->pPciRawHlpR3); 422 if (RT_FAILURE(rc)) 423 { 424 AssertMsgRC(rc, ("Cannot PciRawRegister: %Rrc\n", rc)); 425 return rc; 426 } 427 428 /* 429 * Initialize critical section. 430 */ 431 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->csLock, RT_SRC_POS, "PCIRAW"); 432 if (RT_FAILURE(rc)) 433 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Raw PCI device cannot initialize critical section")); 434 435 #if 0 436 /* 437 * Register IO/MMIO ranges for guest, basing on real device ranges. 438 */ 439 for (int iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS; iRegion++) 440 { 441 442 } 443 #endif 444 445 if (fRCEnabled) 446 { 447 pThis->pPciRawHlpRC = pThis->pPciRawHlpR3->pfnGetRCHelpers(pDevIns); 448 if (!pThis->pPciRawHlpRC) 449 { 450 AssertReleaseMsgFailed(("cannot get RC helper\n")); 451 return VERR_INTERNAL_ERROR; 452 } 453 } 454 if (fR0Enabled) 455 { 456 pThis->pPciRawHlpR0 = pThis->pPciRawHlpR3->pfnGetR0Helpers(pDevIns); 457 if (!pThis->pPciRawHlpR0) 458 { 459 AssertReleaseMsgFailed(("cannot get R0 helper\n")); 460 return VERR_INTERNAL_ERROR; 461 } 462 } 463 464 /* Register SSM callbacks */ 465 rc = PDMDevHlpSSMRegister3(pDevIns, PCIRAW_SAVED_STATE_VERSION, sizeof(*pThis), pcirawLiveExec, pcirawSaveExec, pcirawLoadExec); 466 if (RT_FAILURE(rc)) 467 return rc; 468 469 return VINF_SUCCESS; 408 N_("Configuration error: failed to read DeviceName as string")); 409 410 PciBusAddress hostAddress, guestAddress; 411 412 /* Obtain device address info */ 413 uint32_t u32Bus, u32Device, u32Fn; 414 415 do { 416 rc = CFGMR3QueryU32(pCfg, "HostPCIBusNo", &u32Bus); 417 if (RT_FAILURE(rc)) 418 { 419 PDMDEV_SET_ERROR(pDevIns, rc, 420 N_("Configuration error: Querying \"HostPCIBusNo\" as a int failed")); 421 break; 422 } 423 rc = CFGMR3QueryU32(pCfg, "HostPCIDeviceNo", &u32Device); 424 if (RT_FAILURE(rc)) 425 { 426 PDMDEV_SET_ERROR(pDevIns, rc, 427 N_("Configuration error: Querying \"HostPCIDeviceNo\" as a int failed")); 428 break; 429 } 430 rc = CFGMR3QueryU32(pCfg, "HostPCIFunctionNo", &u32Fn); 431 if (RT_FAILURE(rc)) 432 { 433 PDMDEV_SET_ERROR(pDevIns, rc, 434 N_("Configuration error: Querying \"HostPCIFunctionNo\" as a int failed")); 435 break; 436 } 437 hostAddress = PciBusAddress(u32Bus, u32Device, u32Fn); 438 439 rc = CFGMR3QueryU32(pCfg, "GuestPCIBusNo", &u32Bus); 440 if (RT_FAILURE(rc)) 441 { 442 PDMDEV_SET_ERROR(pDevIns, rc, 443 N_("Configuration error: Querying \"GuestPCIBusNo\" as a int failed")); 444 break; 445 } 446 rc = CFGMR3QueryU32(pCfg, "GuestPCIDeviceNo", &u32Device); 447 if (RT_FAILURE(rc)) 448 { 449 PDMDEV_SET_ERROR(pDevIns, rc, 450 N_("Configuration error: Querying \"GuestPCIDeviceNo\" as a int failed")); 451 break; 452 } 453 rc = CFGMR3QueryU32(pCfg, "GuestPCIFunctionNo", &u32Fn); 454 if (RT_FAILURE(rc)) 455 { 456 PDMDEV_SET_ERROR(pDevIns, rc, 457 N_("Configuration error: Querying \"GuestPCIFunctionNo\" as a int failed")); 458 break; 459 } 460 guestAddress = PciBusAddress(u32Bus, u32Device, u32Fn); 461 462 /* Initialize the device state */ 463 rc = pcirawInit(pDevIns, hostAddress, guestAddress); 464 if (RT_FAILURE(rc)) 465 break; 466 467 pThis->pDevInsR3 = pDevIns; 468 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 469 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 470 471 /* 472 * Register the raw device and get helpers. 473 */ 474 PciRawReg.u32Version = PDM_PCIRAWREG_VERSION; 475 rc = PDMDevHlpPciRawRegister(pDevIns, &PciRawReg, &pThis->pPciRawHlpR3); 476 if (RT_FAILURE(rc)) 477 { 478 AssertMsgRC(rc, ("Cannot PciRawRegister: %Rrc\n", rc)); 479 break; 480 } 481 482 /* 483 * Initialize critical section. 484 */ 485 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->csLock, RT_SRC_POS, "PCIRAW"); 486 if (RT_FAILURE(rc)) 487 { 488 PDMDEV_SET_ERROR(pDevIns, rc, N_("Raw PCI device cannot initialize critical section")); 489 break; 490 } 491 492 /* Mark device as passthrough */ 493 PCISetPassthrough(&pThis->aPciDevice); 494 495 /* IBase */ 496 pThis->Lun0.IBase.pfnQueryInterface = pcirawQueryInterface; 497 pThis->Lun0.IDevice.pfnFoo = pcirawFoo; 498 499 /* 500 * Attach to the Main driver. 501 */ 502 rc = pDevIns->pHlpR3->pfnDriverAttach(pDevIns, 0/*iLun*/, &pThis->Lun0.IBase, &pThis->Lun0.pDrvBase, "Device Port"); 503 if (RT_FAILURE(rc)) 504 { 505 rc = PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, N_("Raw PCI failed to attach Main driver")); 506 break; 507 } 508 509 pThis->Lun0.pDrv = PDMIBASE_QUERY_INTERFACE(pThis->Lun0.pDrvBase, PDMIPCIRAWCONNECTOR); 510 if (!pThis->Lun0.pDrv) 511 { 512 rc = PDMDevHlpVMSetError(pDevIns, VERR_PDM_MISSING_INTERFACE, RT_SRC_POS, N_("Raw PCI failed to query interface")); 513 break; 514 } 515 516 /* Just a safety measure, this data shall never be reached */ 517 PCIDevSetVendorId(&pThis->aPciDevice, 0xdead); 518 PCIDevSetDeviceId(&pThis->aPciDevice, 0xbeef); 519 520 rc = PDMDevHlpPCIRegister(pDevIns, &pThis->aPciDevice); 521 if (RT_FAILURE(rc)) 522 break; 523 524 PDMDevHlpPCISetConfigCallbacks(pDevIns, &pThis->aPciDevice, 525 pcirawConfigRead, NULL /* we don't care about old ones */, 526 pcirawConfigWrite, NULL /* we don't care about old ones */); 527 528 /* 529 * Register IO/MMIO ranges for the guest, basing on real device ranges. 530 */ 531 for (int iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS; iRegion++) 532 { 533 RTHCPHYS RegStart; 534 uint64_t iRegSize; 535 bool fMmio; 536 537 if (pThis->Lun0.pDrv->pfnGetRegionInfo(pThis->Lun0.pDrv, hostAddress.asLong(), iRegion, 538 &RegStart, &iRegSize, &fMmio)) 539 { 540 /* If region is present, register callbacks in guest. 541 @todo: replace it with direct region access with remap */ 542 // @todo: check if host's PA make sense for the guest 543 if (fMmio) 544 { 545 rc = PDMDevHlpMMIORegister(pDevIns, RegStart, iRegSize, NULL, 546 pcirawMMIOWrite, pcirawMMIORead, NULL, 547 "Raw PCI MMIO regions"); 548 if (RT_FAILURE(rc)) 549 { 550 AssertMsgRC(rc, ("Cannot register MMIO: %Rrc\n", rc)); 551 break; 552 } 553 } 554 else 555 { 556 rc = PDMDevHlpIOPortRegister(pDevIns, (RTIOPORT)RegStart, iRegSize, NULL, 557 pcirawIOPortWrite, pcirawIOPortRead, NULL, NULL, 558 "Raw PCI IO regions"); 559 if (RT_FAILURE(rc)) 560 { 561 AssertMsgRC(rc, ("Cannot register IO: %Rrc\n", rc)); 562 break; 563 } 564 } 565 } 566 } 567 568 if (RT_FAILURE(rc)) 569 break; 570 571 if (fRCEnabled) 572 { 573 pThis->pPciRawHlpRC = pThis->pPciRawHlpR3->pfnGetRCHelpers(pDevIns); 574 if (!pThis->pPciRawHlpRC) 575 { 576 AssertReleaseMsgFailed(("cannot get RC helper\n")); 577 rc = VERR_INTERNAL_ERROR; 578 break; 579 } 580 } 581 582 if (fR0Enabled) 583 { 584 pThis->pPciRawHlpR0 = pThis->pPciRawHlpR3->pfnGetR0Helpers(pDevIns); 585 if (!pThis->pPciRawHlpR0) 586 { 587 AssertReleaseMsgFailed(("cannot get R0 helper\n")); 588 rc = VERR_INTERNAL_ERROR; 589 break; 590 } 591 } 592 593 /* Register SSM callbacks */ 594 rc = PDMDevHlpSSMRegister3(pDevIns, PCIRAW_SAVED_STATE_VERSION, sizeof(*pThis), pcirawLiveExec, pcirawSaveExec, pcirawLoadExec); 595 if (RT_FAILURE(rc)) 596 break; 597 } while (0); 598 599 /* Notify Main about result of PCI device attach attempt */ 600 if (pThis->Lun0.pDrv != NULL) 601 pThis->Lun0.pDrv->pfnPciDeviceConstructComplete(pThis->Lun0.pDrv, hostAddress.asLong(), guestAddress.asLong(), 602 rc, pThis->szDeviceName); 603 604 return rc; 470 605 } 471 606 -
trunk/src/VBox/Devices/Bus/PCIInternal.h
r35358 r35676 87 87 /** Flag whether the device is capable of MSI-X. 88 88 * This one is set by MsixInit(). */ 89 PCIDEV_FLAG_MSIX_CAPABLE = 1<<4 89 PCIDEV_FLAG_MSIX_CAPABLE = 1<<4, 90 /** Flag if device represents real physical device in passthrough mode. */ 91 PCIDEV_FLAG_PASSTHROUGH = 1<<5 90 92 }; 91 93 -
trunk/src/VBox/Devices/Makefile.kmk
r35572 r35676 517 517 Bus/DevPCI.cpp_INCS = Bus 518 518 Bus/DevPciIch9.cpp_INCS = Bus 519 Bus/MsiCommon.cpp_INCS = Bus519 Bus/MsiCommon.cpp_INCS = Bus 520 520 Bus/MsixCommon.cpp_INCS = Bus 521 Bus/DevPciRaw.cpp_INCS = Bus 521 522 522 523 # For finding and generating vbetables.h (see Graphics/BIOS/Makefile.kmk). -
trunk/src/VBox/Main/Makefile.kmk
r35498 r35676 637 637 src-client/AudioSnifferInterface.cpp \ 638 638 src-client/BusAssignmentManager.cpp \ 639 src-client/PciRawDevImpl.cpp \ 639 640 src-client/ConsoleImpl.cpp \ 640 641 src-client/ConsoleImpl2.cpp \ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r35602 r35676 3422 3422 3423 3423 <interface 3424 name="IEventContext" extends="$unknown"3425 uuid="7563F4E7-1583-40F7-B4C4-C9BA02CB0AE3"3426 wsmap="managed"3427 >3428 <desc>3429 Placeholder class for event contexts.3430 </desc>3431 </interface>3432 3433 3434 <interface3435 3424 name="IPciAddress" extends="$unknown" 3436 3425 uuid="D88B324F-DB19-4D3B-A1A9-BF5B127199A8" … … 4743 4732 <desc>Desired position of this device on guest PCI bus.</desc> 4744 4733 </param> 4745 <param name="eventContext" type="IEventContext" dir="in">4746 <desc>Context passed into IHostPciDevicePlugEvent event.</desc>4747 </param>4748 4734 <param name="tryToUnbind" type="boolean" dir="in"> 4749 4735 <desc>If VMM shall try to unbind existing drivers from the … … 4756 4742 Detach host PCI device from the virtual machine. 4757 4743 Also HostPciDevicePlugEvent on IVirtualBox event source 4758 will be delivered. 4744 will be delivered. As currently we don't support hot device 4745 unplug, IHostPciDevicePlugEvent event is delivered immediately. 4759 4746 4760 4747 <note> … … 16644 16631 name="IHostPciDevicePlugEvent" extends="IMachineEvent" 16645 16632 waitable="yes" 16646 uuid=" EDD4782B-DB74-43A0-B724-2BAA36F039CC"16633 uuid="9cebfc27-c579-4965-8eb7-d31794cd7dcf" 16647 16634 wsmap="managed" autogen="VBoxEvent" id="OnHostPciDevicePlug" 16648 16635 > 16649 16636 <desc> 16650 Notification when host PCI device is plugged/unplugged. 16637 Notification when host PCI device is plugged/unplugged. Plugging 16638 usually takes place on VM startup, unplug - when 16639 IMachine::DetachHostPciDevice is called. 16640 16641 <see>IMachine::DetachHostPciDevice</see> 16642 16651 16643 </desc> 16652 16644 16653 16645 <attribute name="plugged" type="boolean" readonly="yes"> 16654 16646 <desc> 16655 16647 If device successfully plugged or unplugged. 16656 16648 </desc> 16657 16649 </attribute> … … 16667 16659 <desc> 16668 16660 Attachment info for this device. 16669 </desc>16670 </attribute>16671 16672 <attribute name="eventContext" type="IEventContext" readonly="yes">16673 <desc>16674 Context object, passed into attachHostPciDevice() and16675 attachHostPciDevice().16676 16661 </desc> 16677 16662 </attribute> -
trunk/src/VBox/Main/include/MachineImpl.h
r35638 r35676 291 291 BOOL mIoCacheEnabled; 292 292 ULONG mIoCacheSize; 293 294 typedef std::list< ComObjPtr<PciDeviceAttachment> > PciDeviceAssignmentList; 295 PciDeviceAssignmentList mPciDeviceAssignments; 293 296 }; 294 297 295 298 /** 296 299 * Hard disk and other media data. 297 300 * 298 301 * The usage policy is the same as for HWData, but a separate structure … … 521 524 STDMETHOD(QueryLogFilename(ULONG aIdx, BSTR *aName)); 522 525 STDMETHOD(ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeArrayOut(BYTE, aData))); 523 STDMETHOD(AttachHostPciDevice(LONG hostAddress, LONG desiredGuestAddress, IEventContext *eventContext,BOOL tryToUnbind));526 STDMETHOD(AttachHostPciDevice(LONG hostAddress, LONG desiredGuestAddress, BOOL tryToUnbind)); 524 527 STDMETHOD(DetachHostPciDevice(LONG hostAddress)); 525 528 STDMETHOD(COMGETTER(PciDeviceAssignments))(ComSafeArrayOut(IPciDeviceAttachment *, aAssignments)); … … 868 871 typedef std::list< ComObjPtr<StorageController> > StorageControllerList; 869 872 Backupable<StorageControllerList> mStorageControllers; 870 871 typedef std::list< ComObjPtr<PciDeviceAttachment> > PciDeviceAssignmentList;872 PciDeviceAssignmentList mPciDeviceAssignments;873 873 874 874 friend class SessionMachine; -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r35638 r35676 314 314 } 315 315 break; 316 317 case VBoxEventType_OnHostPciDevicePlug: 318 { 319 // handle if needed 320 break; 321 } 322 316 323 default: 317 324 AssertFailed(); 318 325 } 319 326 return S_OK; … … 387 394 388 395 uninit(); 389 396 390 397 BaseFinalRelease(); 391 398 } … … 491 498 com::SafeArray<VBoxEventType_T> eventTypes; 492 499 eventTypes.push_back(VBoxEventType_OnNATRedirect); 500 eventTypes.push_back(VBoxEventType_OnHostPciDevicePlug); 493 501 rc = pES->RegisterListener(mVmListener, ComSafeArrayAsInParam(eventTypes), true); 494 502 AssertComRC(rc); -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r35667 r35676 34 34 #include "VMMDev.h" 35 35 #include "Global.h" 36 #include "PciRawDevImpl.h" 36 37 37 38 // generated header … … 454 455 } 455 456 457 static HRESULT attachRawPciDevices(BusAssignmentManager* BusMgr, 458 PCFGMNODE pDevices, 459 Console* pConsole) 460 { 461 HRESULT hrc = S_OK; 462 PCFGMNODE pDev, pInst, pCfg, pLunL0; 463 464 SafeIfaceArray<IPciDeviceAttachment> assignments; 465 ComPtr<IMachine> aMachine = pConsole->machine(); 466 467 hrc = aMachine->COMGETTER(PciDeviceAssignments)(ComSafeArrayAsOutParam(assignments)); 468 if (hrc != S_OK) 469 return hrc; 470 471 for (size_t iDev = 0; iDev < assignments.size(); iDev++) 472 { 473 PciBusAddress HostPciAddress, GuestPciAddress; 474 ComPtr<IPciDeviceAttachment> assignment = assignments[iDev]; 475 LONG host, guest; 476 Bstr aDevName; 477 478 assignment->COMGETTER(HostAddress)(&host); 479 assignment->COMGETTER(GuestAddress)(&guest); 480 assignment->COMGETTER(Name)(aDevName.asOutParam()); 481 482 InsertConfigNode(pDevices, "pciraw", &pDev); 483 InsertConfigNode(pDev, Utf8StrFmt("%d", iDev).c_str(), &pInst); 484 InsertConfigInteger(pInst, "Trusted", 1); 485 486 HostPciAddress.fromLong(host); 487 Assert(HostPciAddress.valid()); 488 InsertConfigNode(pInst, "Config", &pCfg); 489 InsertConfigString(pCfg, "DeviceName", aDevName); 490 491 InsertConfigInteger(pCfg, "HostPCIBusNo", HostPciAddress.iBus); 492 InsertConfigInteger(pCfg, "HostPCIDeviceNo", HostPciAddress.iDevice); 493 InsertConfigInteger(pCfg, "HostPCIFunctionNo", HostPciAddress.iFn); 494 495 GuestPciAddress.fromLong(guest); 496 Assert(GuestPciAddress.valid()); 497 hrc = BusMgr->assignPciDevice("pciraw", pInst, GuestPciAddress, true); 498 if (hrc != S_OK) 499 return hrc; 500 InsertConfigInteger(pCfg, "GuestPCIBusNo", GuestPciAddress.iBus); 501 InsertConfigInteger(pCfg, "GuestPCIDeviceNo", GuestPciAddress.iDevice); 502 InsertConfigInteger(pCfg, "GuestPCIFunctionNo", GuestPciAddress.iFn); 503 504 /* the Main driver */ 505 PciRawDev* pMainDev = new PciRawDev(pConsole); 506 InsertConfigNode(pInst, "LUN#0", &pLunL0); 507 InsertConfigString(pLunL0, "Driver", "PciRawMain"); 508 InsertConfigNode(pLunL0, "Config" , &pCfg); 509 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMainDev); 510 } 511 512 return hrc; 513 } 456 514 457 515 /** … … 921 979 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 922 980 hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); H(); 981 982 /* Add PCI passthrough devices */ 983 hrc = attachRawPciDevices(BusMgr, pDevices, pConsole); H(); 923 984 } 924 925 /* 926 * Enable 3 following devices: HPET, SMC, LPC on MacOS X guests 985 /* 986 * Enable 3 following devices: HPET, SMC, LPC on MacOS X guests or on ICH9 chipset 927 987 */ 928 988 /* -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r35540 r35676 206 206 { 207 207 rc = TaskGuest::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, 208 Guest::tr("Source file \"%s\" does not exist "),208 Guest::tr("Source file \"%s\" does not exist, or is not a file"), 209 209 aTask->strSource.c_str()); 210 210 } … … 2531 2531 #endif /* VBOX_WITH_GUEST_CONTROL */ 2532 2532 } 2533 -
trunk/src/VBox/Main/src-client/VBoxDriversRegister.cpp
r35368 r35676 26 26 #include "AudioSnifferInterface.h" 27 27 #include "ConsoleImpl.h" 28 #include "PciRawDevImpl.h" 28 29 29 30 #include "Logging.h" … … 67 68 if (RT_FAILURE(rc)) 68 69 return rc; 70 71 rc = pCallbacks->pfnRegister(pCallbacks, &PciRawDev::DrvReg); 72 if (RT_FAILURE(rc)) 73 return rc; 74 69 75 return VINF_SUCCESS; 70 76 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r35638 r35676 50 50 #include "DisplayUtils.h" 51 51 #include "BandwidthControlImpl.h" 52 53 // generated header 54 #include "VBoxEvents.h" 52 55 53 56 #ifdef VBOX_WITH_USB … … 5812 5815 5813 5816 5814 STDMETHODIMP Machine::AttachHostPciDevice(LONG hostAddress, LONG desiredGuestAddress, IEventContext * /*eventContext*/, BOOL /*tryToUnbind*/) 5815 { 5816 AutoCaller autoCaller(this); 5817 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5818 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5819 5820 ComObjPtr<PciDeviceAttachment> pda; 5821 char name[32]; 5822 5823 pda.createObject(); 5824 RTStrPrintf(name, sizeof(name), "host%02x:%02x.%x", (hostAddress>>8) & 0xff, (hostAddress & 0xf8) >> 3, hostAddress & 7); 5825 Bstr bname(name); 5826 pda.createObject(); 5827 pda->init(this, bname, hostAddress, desiredGuestAddress, TRUE); 5828 5829 mPciDeviceAssignments.push_back(pda); 5830 return S_OK; 5831 } 5832 5833 STDMETHODIMP Machine::DetachHostPciDevice(LONG /*hostAddress*/) 5834 { 5835 AutoCaller autoCaller(this); 5836 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5837 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5838 5839 return E_NOTIMPL; 5817 /** 5818 * Currently this method doesn't attach device to the running VM, 5819 * just makes sure it's plugged on next VM start. 5820 */ 5821 STDMETHODIMP Machine::AttachHostPciDevice(LONG hostAddress, LONG desiredGuestAddress, BOOL /*tryToUnbind*/) 5822 { 5823 AutoCaller autoCaller(this); 5824 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5825 5826 // lock scope 5827 { 5828 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5829 5830 //HRESULT rc = checkStateDependency(MutableStateDep); 5831 //if (FAILED(rc)) return rc; 5832 5833 ComObjPtr<PciDeviceAttachment> pda; 5834 char name[32]; 5835 5836 RTStrPrintf(name, sizeof(name), "host%02x:%02x.%x", (hostAddress>>8) & 0xff, (hostAddress & 0xf8) >> 3, hostAddress & 7); 5837 Bstr bname(name); 5838 pda.createObject(); 5839 pda->init(this, bname, hostAddress, desiredGuestAddress, TRUE); 5840 setModified(IsModified_MachineData); 5841 mHWData.backup(); 5842 mHWData->mPciDeviceAssignments.push_back(pda); 5843 } 5844 5845 // do we need it? 5846 //saveSettings(NULL); 5847 mHWData.commit(); 5848 5849 return S_OK; 5850 } 5851 5852 /** 5853 * Currently this method doesn't detach device from the running VM, 5854 * just makes sure it's not plugged on next VM start. 5855 */ 5856 STDMETHODIMP Machine::DetachHostPciDevice(LONG hostAddress) 5857 { 5858 AutoCaller autoCaller(this); 5859 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5860 5861 ComObjPtr<PciDeviceAttachment> pAttach; 5862 bool fRemoved = false; 5863 HRESULT rc; 5864 5865 // lock scope 5866 { 5867 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5868 5869 rc = checkStateDependency(MutableStateDep); 5870 if (FAILED(rc)) return rc; 5871 5872 for (HWData::PciDeviceAssignmentList::iterator it = mHWData->mPciDeviceAssignments.begin(); 5873 it != mHWData->mPciDeviceAssignments.end(); 5874 ++it) 5875 { 5876 LONG iHostAddress = -1; 5877 pAttach = *it; 5878 pAttach->COMGETTER(HostAddress)(&iHostAddress); 5879 if (iHostAddress != -1 && iHostAddress == hostAddress) 5880 { 5881 setModified(IsModified_MachineData); 5882 mHWData.backup(); 5883 mHWData->mPciDeviceAssignments.remove(pAttach); 5884 fRemoved = true; 5885 break; 5886 } 5887 } 5888 // Indeed under lock? 5889 mHWData.commit(); 5890 5891 // do we need it? 5892 // saveSettings(NULL); 5893 } 5894 5895 5896 /* Fire event outside of the lock */ 5897 if (fRemoved) 5898 { 5899 Assert(!pAttach.isNull()); 5900 ComPtr<IEventSource> es; 5901 rc = mParent->COMGETTER(EventSource)(es.asOutParam()); 5902 Assert(SUCCEEDED(rc)); 5903 Bstr mid; 5904 rc = this->COMGETTER(Id)(mid.asOutParam()); 5905 Assert(SUCCEEDED(rc)); 5906 fireHostPciDevicePlugEvent(es, mid.raw(), false /* unplugged */, true /* success */, pAttach, NULL); 5907 } 5908 5909 return S_OK; 5840 5910 } 5841 5911 … … 5849 5919 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5850 5920 5851 SafeIfaceArray<IPciDeviceAttachment> assignments(m PciDeviceAssignments);5921 SafeIfaceArray<IPciDeviceAttachment> assignments(mHWData->mPciDeviceAssignments); 5852 5922 assignments.detachTo(ComSafeArrayOutArg(aAssignments)); 5853 5923 … … 6128 6198 Utf8Str idStr = mData->mUuid.toString(); 6129 6199 const char * args[] = {szPath, "--comment", mUserData->s.strName.c_str(), "--startvm", idStr.c_str(), 0 }; 6200 fprintf(stderr, "SDL=%s\n", szPath); 6130 6201 vrc = RTProcCreate(szPath, args, env, 0, &pid); 6131 6202 } -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r35358 r35676 48 48 extern DECLEXPORT(const PDMPCIHLPR0) g_pdmR0PciHlp; 49 49 extern DECLEXPORT(const PDMHPETHLPR0) g_pdmR0HpetHlp; 50 extern DECLEXPORT(const PDMPCIRAWHLPR0) g_pdmR0PciRawHlp; 50 51 extern DECLEXPORT(const PDMDRVHLPR0) g_pdmR0DrvHlp; 51 52 RT_C_DECLS_END … … 680 681 /** @} */ 681 682 682 683 683 /** @name Raw PCI Ring-0 Helpers 684 * @{ 685 */ 686 /** 687 * The Ring-0 PCI raw Helper Callbacks. 688 */ 689 extern DECLEXPORT(const PDMPCIRAWHLPR0) g_pdmR0PciRawHlp = 690 { 691 PDM_PCIRAWHLPR0_VERSION, 692 PDM_PCIRAWHLPR0_VERSION, /* the end */ 693 }; 694 695 /** @} */ 684 696 685 697 /** @name Ring-0 Context Driver Helpers … … 900 912 } 901 913 } 902 -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r35358 r35676 2812 2812 } 2813 2813 2814 /** @interface_method_impl{PDMDEVHLPR3,pfnPciRawRegister} */ 2815 static DECLCALLBACK(int) pdmR3DevHlp_PciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3) 2816 { 2817 PDMDEV_ASSERT_DEVINS(pDevIns); 2818 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3); 2819 LogFlow(("pdmR3DevHlp_PciRawRegister: caller='%s'/%d:\n")); 2820 2821 /* 2822 * Validate input. 2823 */ 2824 if (pPciRawReg->u32Version != PDM_PCIRAWREG_VERSION) 2825 { 2826 AssertMsgFailed(("u32Version=%#x expected %#x\n", pPciRawReg->u32Version, PDM_PCIRAWREG_VERSION)); 2827 LogFlow(("pdmR3DevHlp_PciRawRegister: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER)); 2828 return VERR_INVALID_PARAMETER; 2829 } 2830 2831 if (!ppPciRawHlpR3) 2832 { 2833 Assert(ppPciRawHlpR3); 2834 LogFlow(("pdmR3DevHlp_PciRawRegister: caller='%s'/%d: returns %Rrc (ppApicHlpR3)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER)); 2835 return VERR_INVALID_PARAMETER; 2836 } 2837 2838 /* set the helper pointer and return. */ 2839 *ppPciRawHlpR3 = &g_pdmR3DevPciRawHlp; 2840 LogFlow(("pdmR3DevHlp_PciRawRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS)); 2841 return VINF_SUCCESS; 2842 } 2814 2843 2815 2844 /** @interface_method_impl{PDMDEVHLPR3,pfnDMACRegister} */ … … 3182 3211 pdmR3DevHlp_IOAPICRegister, 3183 3212 pdmR3DevHlp_HPETRegister, 3213 pdmR3DevHlp_PciRawRegister, 3184 3214 pdmR3DevHlp_DMACRegister, 3185 3215 pdmR3DevHlp_DMARegister, … … 3392 3422 pdmR3DevHlp_IOAPICRegister, 3393 3423 pdmR3DevHlp_HPETRegister, 3424 pdmR3DevHlp_PciRawRegister, 3394 3425 pdmR3DevHlp_DMACRegister, 3395 3426 pdmR3DevHlp_DMARegister, … … 3469 3500 3470 3501 /** @} */ 3471 -
trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp
r35358 r35676 651 651 /** @} */ 652 652 653 653 /** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetRCHelpers} */ 654 static DECLCALLBACK(PCPDMPCIRAWHLPRC) pdmR3PciRawHlp_GetRCHelpers(PPDMDEVINS pDevIns) 655 { 656 PDMDEV_ASSERT_DEVINS(pDevIns); 657 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3); 658 RTRCPTR pRCHelpers = 0; 659 int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCPciRawHlp", &pRCHelpers); 660 AssertReleaseRC(rc); 661 AssertRelease(pRCHelpers); 662 LogFlow(("pdmR3PciRawHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n", 663 pDevIns->pReg->szName, pDevIns->iInstance, pRCHelpers)); 664 return pRCHelpers; 665 } 666 667 668 /** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetR0Helpers} */ 669 static DECLCALLBACK(PCPDMPCIRAWHLPR0) pdmR3PciRawHlp_GetR0Helpers(PPDMDEVINS pDevIns) 670 { 671 PDMDEV_ASSERT_DEVINS(pDevIns); 672 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3); 673 PCPDMHPETHLPR0 pR0Helpers = 0; 674 int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PciRawHlp", &pR0Helpers); 675 AssertReleaseRC(rc); 676 AssertRelease(pR0Helpers); 677 LogFlow(("pdmR3PciRawHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n", 678 pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers)); 679 return pR0Helpers; 680 } 681 682 /** 683 * Raw PCI Device Helpers. 684 */ 685 const PDMPCIRAWHLPR3 g_pdmR3DevPciRawHlp = 686 { 687 PDM_PCIRAWHLPR3_VERSION, 688 pdmR3PciRawHlp_GetRCHelpers, 689 pdmR3PciRawHlp_GetR0Helpers, 690 PDM_PCIRAWHLPR3_VERSION, /* the end */ 691 }; 654 692 655 693 /* none yet */ -
trunk/src/VBox/VMM/include/PDMInternal.h
r35358 r35676 1085 1085 extern const PDMRTCHLP g_pdmR3DevRtcHlp; 1086 1086 extern const PDMHPETHLPR3 g_pdmR3DevHpetHlp; 1087 extern const PDMPCIRAWHLPR3 g_pdmR3DevPciRawHlp; 1087 1088 #endif 1088 1089
Note:
See TracChangeset
for help on using the changeset viewer.