Changeset 6033 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Dec 10, 2007 8:04:17 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 26665
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c
r6032 r6033 20 20 * Header Files * 21 21 *******************************************************************************/ 22 #include "the-solaris-kernel.h" /** @todo r=bird: no need to do like linux here, solaris is stable. */ 22 #include <sys/conf.h> 23 #include <sys/cmn_err.h> 24 #include <sys/modctl.h> 25 #include <sys/mutex.h> 26 #include <sys/pci.h> 27 #include <sys/stat.h> 28 #include <sys/ddi.h> 29 #include <sys/sunddi.h> 30 #undef u /* /usr/include/sys/user.h:249:1 is where this is defined to (curproc->p_user). very cool. */ 31 23 32 #include "VBoxGuestInternal.h" 24 25 33 #include <VBox/log.h> 26 34 #include <VBox/VBoxGuest.h> … … 61 69 static uint_t VBoxGuestSolarisISR(caddr_t Arg); 62 70 63 DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvS tate, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned);71 DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned); 64 72 DECLVBGL(void *) VBoxGuestSolarisServiceOpen(uint32_t *pu32Version); 65 DECLVBGL( void) VBoxGuestSolarisServiceClose(void *pvState);73 DECLVBGL(int) VBoxGuestSolarisServiceClose(void *pvSession); 66 74 67 75 … … 176 184 int _init(void) 177 185 { 178 int rc;179 180 186 VBA_LOGCONT("_init\n"); 181 rc = ddi_soft_state_init(&g_pVBoxAddSolarisState, sizeof(VBoxAddDevState), 1); 187 188 int rc = ddi_soft_state_init(&g_pVBoxAddSolarisState, sizeof(VBoxAddDevState), 1); 182 189 if (!rc) 183 190 { … … 192 199 int _fini(void) 193 200 { 194 int rc;195 196 201 VBA_LOGCONT("_fini\n"); 197 rc = mod_remove(&g_VBoxAddSolarisModLinkage); 202 203 int rc = mod_remove(&g_VBoxAddSolarisModLinkage); 198 204 if (!rc) 199 205 ddi_soft_state_fini(&g_pVBoxAddSolarisState); … … 313 319 { 314 320 /* 315 * C reate kernel session.321 * Call the common device extension initializer. 316 322 */ 317 /** @todo this should be done *each* time the device is opened by a client kernel module. */ 318 rc = VBoxGuestCreateKernelSession(&g_DevExt, &pState->pKernelSession); 319 pState->u32Version = VMMDEV_VERSION; 323 rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, NULL, 0, OSTypeSolaris); 320 324 if (RT_SUCCESS(rc)) 321 325 { 322 /* 323 * Call the common device extension initializer. 324 */ 325 rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, NULL, 0, OSTypeSolaris); 326 if (RT_SUCCESS(rc)) 326 rc = ddi_create_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 0); 327 if (rc == DDI_SUCCESS) 327 328 { 328 rc = ddi_create_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 0); 329 if (rc == DDI_SUCCESS) 330 { 331 g_pDip = pDip; 332 ddi_set_driver_private(pDip, pState); 333 pci_config_teardown(&pState->PciHandle); 334 ddi_report_dev(pDip); 335 return DDI_SUCCESS; 336 } 337 338 VBA_LOGNOTE("ddi_create_minor_node failed.\n"); 329 g_pDip = pDip; 330 ddi_set_driver_private(pDip, pState); 331 pci_config_teardown(&pState->PciHandle); 332 ddi_report_dev(pDip); 333 return DDI_SUCCESS; 339 334 } 340 else 341 VBA_LOGNOTE("VBoxGuestInitDevExtfailed.\n");335 336 VBA_LOGNOTE("ddi_create_minor_node failed.\n"); 342 337 } 343 338 else 344 VBA_LOGNOTE("VBoxGuest CreateKernelSessionfailed.\n");339 VBA_LOGNOTE("VBoxGuestInitDevExt failed.\n"); 345 340 VBoxGuestSolarisRemoveIRQ(pDip, pState); 346 341 } … … 625 620 * 626 621 * @returns VBox error code. 627 * @param pvS tate Opaque pointer to the state info structure.622 * @param pvSession Opaque pointer to the session. 628 623 * @param iCmd Requested function. 629 624 * @param pvData IO data buffer. … … 631 626 * @param pcbDataReturned Where to store the amount of returned data. 632 627 */ 633 DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvS tate, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned)628 DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned) 634 629 { 635 630 VBA_LOGCONT("VBoxGuestSolarisServiceCall\n"); 636 631 637 VBoxAddDevState *pState = (VBoxAddDevState *)pvState; 638 AssertPtrReturn(pState, VERR_INVALID_POINTER); 639 AssertPtrReturn(pState->pKernelSession, VERR_INVALID_POINTER); 640 AssertMsgReturn(pState->pKernelSession->pDevExt == &g_DevExt, 641 ("SC: %p != %p\n", pState->pKernelSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE); 632 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pvSession; 633 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 634 AssertMsgReturn(pSession->pDevExt == &g_DevExt, 635 ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE); 642 636 643 637 return VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pState->pKernelSession, pvData, cbData, pcbDataReturned); … … 648 642 * Solaris Guest service open. 649 643 * 650 * @returns Opaque pointer to driver state info structure.644 * @returns Opaque pointer to session object. 651 645 * @param pu32Version Where to store VMMDev version. 652 646 */ … … 655 649 VBA_LOGCONT("VBoxGuestSolarisServiceOpen\n"); 656 650 657 /** @todo See the comment where pKernelSession is initialized. 658 * This is the same call as VBoxGuestOS2IDCConnect */ 659 VBoxAddDevState *pState = ddi_get_driver_private(g_pDip); 660 AssertPtrReturn(pState, NULL); 661 662 if (pState) 651 AssertPtrReturn(pu32Version, NULL); 652 PVBOXGUESTSESSION pSession; 653 int rc = VBoxGuestCreateKernelSession(&g_DevExt, &pSession); 654 if (RT_SUCCESS(rc)) 663 655 { 664 656 *pu32Version = VMMDEV_VERSION; 665 return pState; 666 } 657 return pSession; 658 } 659 VBA_LOGNOTE("VBoxGuestCreateKernelSession failed. rc=%d\n", rc); 667 660 return NULL; 668 661 } … … 672 665 * Solaris Guest service close. 673 666 * 674 * @param pvState Opaque pointer to the state info structure. 675 */ 676 DECLVBGL(void) VBoxGuestSolarisServiceClose(void *pvState) 677 { 678 /** @todo Must close the session created above. 679 * This is the same call as VBoxGuestOS2IDCService / case VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT. */ 680 VBA_LOGCONT("VBoxGuestSolarisServiceClosel\n"); 681 NOREF(pvState); 682 } 683 667 * @returns VBox error code. 668 * @param pvState Opaque pointer to the session object. 669 */ 670 DECLVBGL(int) VBoxGuestSolarisServiceClose(void *pvSession) 671 { 672 VBA_LOGCONT("VBoxGuestSolarisServiceClose\n"); 673 674 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pvSession; 675 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 676 if (pSession) 677 { 678 VBoxGuestCloseSession(&g_DevExt, pSession); 679 return VINF_SUCCESS; 680 } 681 VBA_LOGNOTE("Invalid pSession.\n"); 682 return VERR_INVALID_HANDLE; 683 } 684 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r6032 r6033 192 192 if (pDevExt->WaitSpinlock != NIL_RTSPINLOCK) 193 193 RTSpinlockDestroy(pDevExt->WaitSpinlock); 194 rc2 = RTR0MemObjFree(pDevExt->MemObjMMIO, true); AssertRC(rc2);195 194 return rc; 196 195 } -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
r6032 r6033 145 145 __BEGIN_DECLS 146 146 147 int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, RTCCPHYS PhysMMIOBase, VBOXOSTYPE enmOSType);147 int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, RTCCPHYS PhysMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType); 148 148 void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt); 149 149 bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);
Note:
See TracChangeset
for help on using the changeset viewer.