VirtualBox

Changeset 6033 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Dec 10, 2007 8:04:17 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
26665
Message:

vboxadd changes.

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  
    2020*   Header Files                                                               *
    2121*******************************************************************************/
    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
    2332#include "VBoxGuestInternal.h"
    24 
    2533#include <VBox/log.h>
    2634#include <VBox/VBoxGuest.h>
     
    6169static uint_t VBoxGuestSolarisISR(caddr_t Arg);
    6270
    63 DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvState, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned);
     71DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned);
    6472DECLVBGL(void *) VBoxGuestSolarisServiceOpen(uint32_t *pu32Version);
    65 DECLVBGL(void) VBoxGuestSolarisServiceClose(void *pvState);
     73DECLVBGL(int) VBoxGuestSolarisServiceClose(void *pvSession);
    6674
    6775
     
    176184int _init(void)
    177185{
    178     int rc;
    179 
    180186    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);
    182189    if (!rc)
    183190    {
     
    192199int _fini(void)
    193200{
    194     int rc;
    195 
    196201    VBA_LOGCONT("_fini\n");
    197     rc = mod_remove(&g_VBoxAddSolarisModLinkage);
     202
     203    int rc = mod_remove(&g_VBoxAddSolarisModLinkage);
    198204    if (!rc)
    199205        ddi_soft_state_fini(&g_pVBoxAddSolarisState);
     
    313319                                        {
    314320                                            /*
    315                                              * Create kernel session.
     321                                             * Call the common device extension initializer.
    316322                                             */
    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);
    320324                                            if (RT_SUCCESS(rc))
    321325                                            {
    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)
    327328                                                {
    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;
    339334                                                }
    340                                                 else
    341                                                     VBA_LOGNOTE("VBoxGuestInitDevExt failed.\n");
     335
     336                                                VBA_LOGNOTE("ddi_create_minor_node failed.\n");
    342337                                            }
    343338                                            else
    344                                                 VBA_LOGNOTE("VBoxGuestCreateKernelSession failed.\n");
     339                                                VBA_LOGNOTE("VBoxGuestInitDevExt failed.\n");
    345340                                            VBoxGuestSolarisRemoveIRQ(pDip, pState);
    346341                                        }
     
    625620 *
    626621 * @returns VBox error code.
    627  * @param   pvState             Opaque pointer to the state info structure.
     622 * @param   pvSession           Opaque pointer to the session.
    628623 * @param   iCmd                Requested function.
    629624 * @param   pvData              IO data buffer.
     
    631626 * @param   pcbDataReturned     Where to store the amount of returned data.
    632627 */
    633 DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvState, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned)
     628DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned)
    634629{
    635630    VBA_LOGCONT("VBoxGuestSolarisServiceCall\n");
    636631
    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);
    642636
    643637    return VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pState->pKernelSession, pvData, cbData, pcbDataReturned);
     
    648642 * Solaris Guest service open.
    649643 *
    650  * @returns Opaque pointer to driver state info structure.
     644 * @returns Opaque pointer to session object.
    651645 * @param   pu32Version         Where to store VMMDev version.
    652646 */
     
    655649    VBA_LOGCONT("VBoxGuestSolarisServiceOpen\n");
    656650
    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))
    663655    {
    664656        *pu32Version = VMMDEV_VERSION;
    665         return pState;
    666     }
     657        return pSession;
     658    }
     659    VBA_LOGNOTE("VBoxGuestCreateKernelSession failed. rc=%d\n", rc);
    667660    return NULL;
    668661}
     
    672665 * Solaris Guest service close.
    673666 *
    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 */
     670DECLVBGL(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  
    192192        if (pDevExt->WaitSpinlock != NIL_RTSPINLOCK)
    193193            RTSpinlockDestroy(pDevExt->WaitSpinlock);
    194         rc2 = RTR0MemObjFree(pDevExt->MemObjMMIO, true); AssertRC(rc2);
    195194        return rc;
    196195    }
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h

    r6032 r6033  
    145145__BEGIN_DECLS
    146146
    147 int  VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, RTCCPHYS PhysMMIOBase, VBOXOSTYPE enmOSType);
     147int  VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, RTCCPHYS PhysMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType);
    148148void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
    149149bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);
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