Changeset 43410 in vbox
- Timestamp:
- Sep 22, 2012 6:31:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c
r43366 r43410 45 45 */ 46 46 47 /******************************************************************************* 48 * Header Files * 49 *******************************************************************************/ 47 50 #define IN_VBOXGUEST 48 #define LOG_GROUP LOG_GROUP_SUP_DRV49 //#undef LOG_DISABLED50 //#define LOG_ENABLED51 //#define LOG_ENABLE_FLOW52 //#define DO_LOG53 51 #include <sys/param.h> 54 52 #include <sys/types.h> … … 265 263 #endif 266 264 265 267 266 static status_t VBoxGuestHaikuDetach(void) 268 267 { … … 275 274 * Reverse what we did in VBoxGuestHaikuAttach. 276 275 */ 277 278 276 VBoxGuestHaikuRemoveIRQ(pState); 279 277 … … 293 291 294 292 RTR0Term(); 295 296 293 return B_OK; 297 294 } … … 309 306 310 307 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; 313 311 } 314 312 … … 351 349 static int VBoxGuestHaikuAddIRQ(void *pvState) 352 350 { 353 status_t status;351 status_t err; 354 352 struct VBoxGuestDeviceState *pState = (struct VBoxGuestDeviceState *)pvState; 355 353 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; 364 360 } 365 361 … … 373 369 { 374 370 struct VBoxGuestDeviceState *pState = (struct VBoxGuestDeviceState *)pvState; 371 AssertPtr(pState); 375 372 376 373 remove_io_interrupt_handler(pState->iIrqResId, VBoxGuestHaikuISR, pState); … … 384 381 int iResId = 0; 385 382 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); 388 387 389 388 cUsers = 0; … … 395 394 if (RT_FAILURE(rc)) 396 395 { 397 /** @todo r=ramshankar: use dprintf here */396 /** @todo r=ramshankar: use dprintf here & the error code looks wrong too. */ 398 397 LogFunc(("RTR0Init failed.\n")); 399 398 return ENXIO; … … 426 425 } 427 426 #endif 428 Log((MODULE_NAME ": plip!\n"));429 LogAlways((MODULE_NAME ": plop!\n"));430 431 427 432 428 /* … … 434 430 */ 435 431 pState->uIOPortBase = pDevice->u.h0.base_registers[0]; 436 / /XXX check flags for IO ?432 /* @todo check flags for IO? */ 437 433 if (pState->uIOPortBase) 438 434 { … … 441 437 */ 442 438 uint32 phys = pDevice->u.h0.base_registers[1]; 443 / /XXX check flags for mem ?439 /* @todo Check flags for mem? */ 444 440 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); 449 444 if (pState->iVMMDevMemAreaId > 0 && pState->pMMIOBase) 450 445 { … … 452 447 * Call the common device extension initializer. 453 448 */ 454 rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, 455 pState->pMMIOBase, pState->VMMDevMemSize, 449 rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize, 456 450 #if ARCH_BITS == 64 457 451 VBOXOSTYPE_Haiku_x64, … … 469 463 if (RT_SUCCESS(rc)) 470 464 { 471 dprintf(MODULE_NAME ": loaded successfully\n");472 return 0;465 LogRel((MODULE_NAME ": loaded successfully\n")); 466 return B_OK; 473 467 } 474 else 475 dprintf((MODULE_NAME ":VBoxGuestInitDevExt failed.\n"));468 469 LogRel((MODULE_NAME ":VBoxGuestInitDevExt failed.\n")); 476 470 VBoxGuestDeleteDevExt(&g_DevExt); 477 471 } 478 472 else 479 dprintf((MODULE_NAME ":VBoxGuestHaikuAddIRQ failed.\n"));473 LogRel((MODULE_NAME ":VBoxGuestHaikuAddIRQ failed.\n")); 480 474 } 481 475 else 482 dprintf((MODULE_NAME ":MMIO region setup failed.\n"));476 LogRel((MODULE_NAME ":MMIO region setup failed.\n")); 483 477 } 484 478 else 485 dprintf((MODULE_NAME ":IOport setup failed.\n"));479 LogRel((MODULE_NAME ":IOport setup failed.\n")); 486 480 487 481 RTR0Term(); … … 493 487 { 494 488 if ((pDevice->vendor_id == VMMDEV_VENDORID) && (pDevice->device_id == VMMDEV_DEVICEID)) 495 return 0;489 return B_OK; 496 490 497 491 return ENXIO; … … 501 495 status_t init_module(void) 502 496 { 503 status_t status= B_ENTRY_NOT_FOUND;497 status_t err = B_ENTRY_NOT_FOUND; 504 498 pci_info info; 505 499 int ix = 0; … … 512 506 if (VBoxGuestHaikuProbe(&info) == 0) 513 507 { 514 / / we found it515 status= VBoxGuestHaikuAttach(&info);508 /* we found it */ 509 err = VBoxGuestHaikuAttach(&info); 516 510 break; 517 511 } 518 512 } 519 513 520 return status;514 return err; 521 515 } 522 516 … … 525 519 { 526 520 VBoxGuestHaikuDetach(); 527 528 521 put_module(B_PCI_MODULE_NAME); 529 522 }
Note:
See TracChangeset
for help on using the changeset viewer.