- Timestamp:
- May 8, 2007 3:04:53 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 20977
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdm.h
r2464 r2538 3219 3219 3220 3220 3221 /** @name IRQ Level for use with the *SetIrq APIs. 3222 * @{ 3223 */ 3224 /** Assert the IRQ (can assume value 1). */ 3225 #define PDM_IRQ_LEVEL_HIGH BIT(0) 3226 /** Deassert the IRQ (can assume value 0). */ 3227 #define PDM_IRQ_LEVEL_LOW 0 3228 /** flip-flop - assert and then deassert it again immediately. */ 3229 #define PDM_IRQ_LEVEL_FLIP_FLOP (BIT(1) | PDM_IRQ_LEVEL_HIGH) 3230 /** @} */ 3231 3232 3221 3233 /** 3222 3234 * PCI Bus registaration structure. … … 3261 3273 * @param pPciDev The PCI device structure. 3262 3274 * @param iIrq IRQ number to set. 3263 * @param iLevel IRQ level. 3275 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3264 3276 */ 3265 3277 DECLR3CALLBACKMEMBER(void, pfnSetIrqHC,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel)); … … 3321 3333 * @param pDevIns PCI device instance. 3322 3334 * @param iIrq IRQ number to set. 3323 * @param iLevel IRQ level. 3335 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3324 3336 * @thread EMT only. 3325 3337 */ … … 3331 3343 * @param pDevIns PCI device instance. 3332 3344 * @param iIrq IRQ number to set. 3333 * @param iLevel IRQ level. 3345 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3334 3346 * @thread EMT only. 3335 3347 */ … … 3379 3391 * @param pDevIns PCI device instance. 3380 3392 * @param iIrq IRQ number to set. 3381 * @param iLevel IRQ level. 3393 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3382 3394 * @thread EMT only. 3383 3395 */ … … 3389 3401 * @param pDevIns PCI device instance. 3390 3402 * @param iIrq IRQ number to set. 3391 * @param iLevel IRQ level. 3403 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3392 3404 * @thread EMT only. 3393 3405 */ … … 3437 3449 * @param pDevIns The PCI device instance. 3438 3450 * @param iIrq IRQ number to set. 3439 * @param iLevel IRQ level. 3451 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3440 3452 * @thread EMT only. 3441 3453 */ … … 3447 3459 * @param pDevIns The PCI device instance. 3448 3460 * @param iIrq IRQ number to set. 3449 * @param iLevel IRQ level. 3461 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3450 3462 * @thread EMT only. 3451 3463 */ … … 3520 3532 * @param pDevIns Device instance of the PIC. 3521 3533 * @param iIrq IRQ number to set. 3522 * @param iLevel IRQ level. 3534 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 3523 3535 */ 3524 3536 DECLR3CALLBACKMEMBER(void, pfnSetIrqHC,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); … … 4050 4062 * @param pDevIns Device instance of the I/O APIC. 4051 4063 * @param iIrq IRQ number to set. 4052 * @param iLevel IRQ level. 4064 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 4053 4065 */ 4054 4066 DECLR3CALLBACKMEMBER(void, pfnSetIrqHC,(PPDMDEVINS pDevIns, int iIrq, int iLevel)); … … 4693 4705 * @param pDevIns Device instance. 4694 4706 * @param iIrq IRQ number to set. 4695 * @param iLevel IRQ level. 4707 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 4696 4708 * @thread Any thread, but will involve the emulation thread. 4697 4709 */ … … 4714 4726 * @param pDevIns Device instance. 4715 4727 * @param iIrq IRQ number to set. 4716 * @param iLevel IRQ level. 4728 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 4717 4729 * @thread Any thread, but will involve the emulation thread. 4718 4730 */ … … 4725 4737 * @param pDevIns Device instance. 4726 4738 * @param iIrq IRQ number to set. 4727 * @param iLevel IRQ level. 4739 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 4728 4740 * @thread Any thread, but will involve the emulation thread. 4729 4741 */ … … 5302 5314 * @param pDevIns Device instance. 5303 5315 * @param iIrq IRQ number to set. 5304 * @param iLevel IRQ level. 5316 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 5305 5317 * @thread Any thread, but will involve the emulation thread. 5306 5318 */ … … 5312 5324 * @param pDevIns Device instance. 5313 5325 * @param iIrq IRQ number to set. 5314 * @param iLevel IRQ level. 5326 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 5315 5327 * @thread Any thread, but will involve the emulation thread. 5316 5328 */ … … 5406 5418 * @param pDevIns Device instance. 5407 5419 * @param iIrq IRQ number to set. 5408 * @param iLevel IRQ level. 5420 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 5409 5421 * @thread Any thread, but will involve the emulation thread. 5410 5422 */ … … 5416 5428 * @param pDevIns Device instance. 5417 5429 * @param iIrq IRQ number to set. 5418 * @param iLevel IRQ level. 5430 * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines. 5419 5431 * @thread Any thread, but will involve the emulation thread. 5420 5432 */ … … 6467 6479 * @param pVM VM handle. 6468 6480 * @param u8Irq The IRQ line. 6469 * @param u8Level The new level. 6481 * @param u8Level The new level. See the PDM_IRQ_LEVEL_* \#defines. 6470 6482 */ 6471 6483 PDMDECL(int) PDMIsaSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level); … … 6477 6489 * @param pVM VM handle. 6478 6490 * @param u8Irq The IRQ line. 6479 * @param u8Level The new level. 6491 * @param u8Level The new level. See the PDM_IRQ_LEVEL_* \#defines. 6480 6492 */ 6481 6493 PDMDECL(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level); -
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r2038 r2538 514 514 static void apic_set_irq(PPCIBUS pBus, PCIDevice *pci_dev, int irq_num1, int level, int acpi_irq) 515 515 { 516 PPCIGLOBALS pGlobals = PCIBUS2PCIGLOBALS(pBus);517 int shift, apic_irq, apic_level;518 uint32_t *p;519 520 516 if (acpi_irq == -1) { 517 int shift, apic_irq, apic_level; 518 uint32_t *p; 519 PPCIGLOBALS pGlobals = PCIBUS2PCIGLOBALS(pBus); 521 520 int uIrqIndex = pci_dev->Int.s.iIrq; 522 521 int irq_num = pci_slot_get_apic_pirq(pci_dev, irq_num1); 522 523 523 p = &pGlobals->pci_apic_irq_levels[irq_num][uIrqIndex >> 5]; 524 524 shift = (uIrqIndex & 0x1f); 525 *p = (*p & ~(1 << shift)) | ( level<< shift);525 *p = (*p & ~(1 << shift)) | ((level & PDM_IRQ_LEVEL_HIGH) << shift); 526 526 apic_irq = irq_num + 0x10; 527 527 apic_level = get_pci_irq_apic_level(pGlobals, irq_num); 528 528 Log3(("apic_set_irq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d\n", 529 529 HCSTRING(pci_dev->name), irq_num1, level, apic_irq, apic_level, irq_num)); 530 pBus->CTXALLSUFF(pPciHlp)->pfnIoApicSetIrq(CTXSUFF(pBus->pDevIns), apic_irq, apic_level); 531 532 if ((level & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP) { 533 *p = (*p & ~(1 << shift)); 534 apic_level = get_pci_irq_apic_level(pGlobals, irq_num); 535 Log3(("apic_set_irq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d (flop)\n", 536 HCSTRING(pci_dev->name), irq_num1, level, apic_irq, apic_level, irq_num)); 537 pBus->CTXALLSUFF(pPciHlp)->pfnIoApicSetIrq(CTXSUFF(pBus->pDevIns), apic_irq, apic_level); 538 } 530 539 } else { 531 apic_irq = acpi_irq; 532 apic_level = level; 533 Log3(("apic_set_irq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d\n", 534 HCSTRING(pci_dev->name), irq_num1, level, apic_irq, apic_level)); 535 } 536 537 pBus->CTXALLSUFF(pPciHlp)->pfnIoApicSetIrq(CTXSUFF(pBus->pDevIns), apic_irq, apic_level); 540 Log3(("apic_set_irq: %s: irq_num1=%d level=%d acpi_irq=%d\n", 541 HCSTRING(pci_dev->name), irq_num1, level, acpi_irq)); 542 pBus->CTXALLSUFF(pPciHlp)->pfnIoApicSetIrq(CTXSUFF(pBus->pDevIns), acpi_irq, level); 543 } 538 544 } 539 545 … … 599 605 pic_irq = pPciDev->config[0x3c]; 600 606 pGlobals->acpi_irq = pic_irq; 601 pGlobals->acpi_irq_level = iLevel ;607 pGlobals->acpi_irq_level = iLevel & PDM_IRQ_LEVEL_HIGH; 602 608 } 603 609 else … … 608 614 p = &pGlobals->pci_irq_levels[irq_num][uIrqIndex >> 5]; 609 615 shift = (uIrqIndex & 0x1f); 610 *p = (*p & ~(1 << shift)) | ( iLevel<< shift);616 *p = (*p & ~(1 << shift)) | ((iLevel & PDM_IRQ_LEVEL_HIGH) << shift); 611 617 612 618 /* now we change the pic irq level according to the piix irq mappings */ 613 619 pic_irq = pbCfg[0x60 + irq_num]; 614 620 if (pic_irq >= 16) 621 { 622 if ((iLevel & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP) 623 *p = (*p & ~(1 << shift)); 615 624 return; 625 } 616 626 } 617 627 … … 632 642 HCSTRING(pPciDev->name), iLevel, iIrq, pic_irq, pic_level)); 633 643 pBus->CTXALLSUFF(pPciHlp)->pfnIsaSetIrq(CTXSUFF(pBus->pDevIns), pic_irq, pic_level); 644 645 /** @todo optimize pci irq flip-flop some rainy day. */ 646 if ((iLevel & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP) 647 pciSetIrq(pDevIns, pPciDev, iIrq, PDM_IRQ_LEVEL_LOW); 634 648 } 635 649 -
trunk/src/VBox/Devices/PC/DevAPIC.cpp
r2468 r2538 1288 1288 s->irr |= mask; 1289 1289 ioapic_service(s); 1290 #ifdef VBOX 1291 if ((level & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP) { 1292 s->irr &= ~mask; 1293 } 1294 #endif 1290 1295 } else { 1291 1296 s->irr &= ~mask; -
trunk/src/VBox/Devices/PC/DevPIC.cpp
r2269 r2538 353 353 DumpPICState(&pData->aPics[1], "picSetIrq"); 354 354 STAM_COUNTER_INC(&pData->CTXSUFF(StatSetIrq)); 355 pic_set_irq1(&pData->aPics[iIrq >> 3], iIrq & 7, iLevel );355 pic_set_irq1(&pData->aPics[iIrq >> 3], iIrq & 7, iLevel & PDM_IRQ_LEVEL_HIGH); 356 356 pic_update_irq(pData); 357 if ((iLevel & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP) 358 { 359 pic_set_irq1(&pData->aPics[iIrq >> 3], iIrq & 7, 0); 360 pic_update_irq(pData); 361 } 357 362 } 358 363
Note:
See TracChangeset
for help on using the changeset viewer.