VirtualBox

Changeset 43410 in vbox


Ignore:
Timestamp:
Sep 22, 2012 6:31:50 PM (12 years ago)
Author:
vboxsync
Message:

Additions/haiku: cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c

    r43366 r43410  
    4545 */
    4646
     47/*******************************************************************************
     48*   Header Files                                                               *
     49*******************************************************************************/
    4750#define IN_VBOXGUEST
    48 #define LOG_GROUP LOG_GROUP_SUP_DRV
    49 //#undef LOG_DISABLED
    50 //#define LOG_ENABLED
    51 //#define LOG_ENABLE_FLOW
    52 //#define DO_LOG
    5351#include <sys/param.h>
    5452#include <sys/types.h>
     
    265263#endif
    266264
     265
    267266static status_t VBoxGuestHaikuDetach(void)
    268267{
     
    275274     * Reverse what we did in VBoxGuestHaikuAttach.
    276275     */
    277 
    278276    VBoxGuestHaikuRemoveIRQ(pState);
    279277
     
    293291
    294292    RTR0Term();
    295 
    296293    return B_OK;
    297294}
     
    309306
    310307    bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt);
    311 
    312     return fOurIRQ ? B_HANDLED_INTERRUPT : B_UNHANDLED_INTERRUPT;
     308    if (fOurIRQ)
     309        return B_HANDLED_INTERRUPT;
     310    return B_UNHANDLED_INTERRUPT;
    313311}
    314312
     
    351349static int VBoxGuestHaikuAddIRQ(void *pvState)
    352350{
    353     status_t status;
     351    status_t err;
    354352    struct VBoxGuestDeviceState *pState = (struct VBoxGuestDeviceState *)pvState;
    355353
    356     status = install_io_interrupt_handler(pState->iIrqResId, VBoxGuestHaikuISR, pState,  0);
    357 
    358     if (status != B_OK)
    359     {
    360         return VERR_DEV_IO_ERROR;
    361     }
    362 
    363     return VINF_SUCCESS;
     354    AssertReturn(pState, VERR_INVALID_PARAMETER);
     355
     356    err = install_io_interrupt_handler(pState->iIrqResId, VBoxGuestHaikuISR, pState,  0);
     357    if (err == B_OK)
     358        return VINF_SUCCESS;
     359    return VERR_DEV_IO_ERROR;
    364360}
    365361
     
    373369{
    374370    struct VBoxGuestDeviceState *pState = (struct VBoxGuestDeviceState *)pvState;
     371    AssertPtr(pState);
    375372
    376373    remove_io_interrupt_handler(pState->iIrqResId, VBoxGuestHaikuISR, pState);
     
    384381    int iResId = 0;
    385382    struct VBoxGuestDeviceState *pState = &sState;
    386     static const char *const   s_apszGroups[] = VBOX_LOGGROUP_NAMES;
    387     PRTLOGGER                   pRelLogger;
     383    static const char *const     s_apszGroups[] = VBOX_LOGGROUP_NAMES;
     384    PRTLOGGER                    pRelLogger;
     385
     386    AssertReturn(pDevice, B_BAD_VALUE);
    388387
    389388    cUsers = 0;
     
    395394    if (RT_FAILURE(rc))
    396395    {
    397         /** @todo r=ramshankar: use dprintf here */
     396        /** @todo r=ramshankar: use dprintf here & the error code looks wrong too. */
    398397        LogFunc(("RTR0Init failed.\n"));
    399398        return ENXIO;
     
    426425    }
    427426#endif
    428     Log((MODULE_NAME ": plip!\n"));
    429     LogAlways((MODULE_NAME ": plop!\n"));
    430 
    431427
    432428    /*
     
    434430     */
    435431    pState->uIOPortBase = pDevice->u.h0.base_registers[0];
    436     //XXX check flags for IO ?
     432    /* @todo check flags for IO? */
    437433    if (pState->uIOPortBase)
    438434    {
     
    441437         */
    442438        uint32 phys = pDevice->u.h0.base_registers[1];
    443         //XXX check flags for mem ?
     439        /* @todo Check flags for mem? */
    444440        pState->VMMDevMemSize    = pDevice->u.h0.base_register_sizes[1];
    445         pState->iVMMDevMemAreaId = map_physical_memory("VirtualBox Guest MMIO",
    446                                                        phys, pState->VMMDevMemSize, B_ANY_KERNEL_BLOCK_ADDRESS,
    447                                                        B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, &pState->pMMIOBase);
    448 
     441        pState->iVMMDevMemAreaId = map_physical_memory("VirtualBox Guest MMIO", phys, pState->VMMDevMemSize,
     442                                                       B_ANY_KERNEL_BLOCK_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
     443                                                       &pState->pMMIOBase);
    449444        if (pState->iVMMDevMemAreaId > 0 && pState->pMMIOBase)
    450445        {
     
    452447             * Call the common device extension initializer.
    453448             */
    454             rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase,
    455                                      pState->pMMIOBase, pState->VMMDevMemSize,
     449            rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize,
    456450#if ARCH_BITS == 64
    457451                                     VBOXOSTYPE_Haiku_x64,
     
    469463                if (RT_SUCCESS(rc))
    470464                {
    471                     dprintf(MODULE_NAME ": loaded successfully\n");
    472                     return 0;
     465                    LogRel((MODULE_NAME ": loaded successfully\n"));
     466                    return B_OK;
    473467                }
    474                 else
    475                     dprintf((MODULE_NAME ":VBoxGuestInitDevExt failed.\n"));
     468
     469                LogRel((MODULE_NAME ":VBoxGuestInitDevExt failed.\n"));
    476470                VBoxGuestDeleteDevExt(&g_DevExt);
    477471            }
    478472            else
    479                 dprintf((MODULE_NAME ":VBoxGuestHaikuAddIRQ failed.\n"));
     473                LogRel((MODULE_NAME ":VBoxGuestHaikuAddIRQ failed.\n"));
    480474        }
    481475        else
    482             dprintf((MODULE_NAME ":MMIO region setup failed.\n"));
     476            LogRel((MODULE_NAME ":MMIO region setup failed.\n"));
    483477    }
    484478    else
    485         dprintf((MODULE_NAME ":IOport setup failed.\n"));
     479        LogRel((MODULE_NAME ":IOport setup failed.\n"));
    486480
    487481    RTR0Term();
     
    493487{
    494488    if ((pDevice->vendor_id == VMMDEV_VENDORID) && (pDevice->device_id == VMMDEV_DEVICEID))
    495         return 0;
     489        return B_OK;
    496490
    497491    return ENXIO;
     
    501495status_t init_module(void)
    502496{
    503     status_t status = B_ENTRY_NOT_FOUND;
     497    status_t err = B_ENTRY_NOT_FOUND;
    504498    pci_info info;
    505499    int ix = 0;
     
    512506        if (VBoxGuestHaikuProbe(&info) == 0)
    513507        {
    514             // we found it
    515             status = VBoxGuestHaikuAttach(&info);
     508            /* we found it */
     509            err = VBoxGuestHaikuAttach(&info);
    516510            break;
    517511        }
    518512    }
    519513
    520     return status;
     514    return err;
    521515}
    522516
     
    525519{
    526520    VBoxGuestHaikuDetach();
    527 
    528521    put_module(B_PCI_MODULE_NAME);
    529522}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette