VirtualBox

Changeset 2538 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
May 8, 2007 3:04:53 PM (18 years ago)
Author:
vboxsync
Message:

Quick implementation of IRQ level flip-flip (pass PDM_IRQ_LEVEL_FLIP_FLOP as the level).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r2038 r2538  
    514514static void apic_set_irq(PPCIBUS pBus, PCIDevice *pci_dev, int irq_num1, int level, int acpi_irq)
    515515{
    516     PPCIGLOBALS pGlobals = PCIBUS2PCIGLOBALS(pBus);
    517     int shift, apic_irq, apic_level;
    518     uint32_t *p;
    519 
    520516    if (acpi_irq == -1) {
     517        int shift, apic_irq, apic_level;
     518        uint32_t *p;
     519        PPCIGLOBALS pGlobals = PCIBUS2PCIGLOBALS(pBus);
    521520        int uIrqIndex = pci_dev->Int.s.iIrq;
    522521        int irq_num = pci_slot_get_apic_pirq(pci_dev, irq_num1);
     522
    523523        p = &pGlobals->pci_apic_irq_levels[irq_num][uIrqIndex >> 5];
    524524        shift = (uIrqIndex & 0x1f);
    525         *p = (*p & ~(1 << shift)) | (level << shift);
     525        *p = (*p & ~(1 << shift)) | ((level & PDM_IRQ_LEVEL_HIGH) << shift);
    526526        apic_irq = irq_num + 0x10;
    527527        apic_level = get_pci_irq_apic_level(pGlobals, irq_num);
    528528        Log3(("apic_set_irq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d\n",
    529529              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        }
    530539    } 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    }
    538544}
    539545
     
    599605        pic_irq = pPciDev->config[0x3c];
    600606        pGlobals->acpi_irq = pic_irq;
    601         pGlobals->acpi_irq_level = iLevel;
     607        pGlobals->acpi_irq_level = iLevel & PDM_IRQ_LEVEL_HIGH;
    602608    }
    603609    else
     
    608614        p = &pGlobals->pci_irq_levels[irq_num][uIrqIndex >> 5];
    609615        shift = (uIrqIndex & 0x1f);
    610         *p = (*p & ~(1 << shift)) | (iLevel << shift);
     616        *p = (*p & ~(1 << shift)) | ((iLevel & PDM_IRQ_LEVEL_HIGH) << shift);
    611617
    612618        /* now we change the pic irq level according to the piix irq mappings */
    613619        pic_irq = pbCfg[0x60 + irq_num];
    614620        if (pic_irq >= 16)
     621        {
     622            if ((iLevel & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP)
     623                *p = (*p & ~(1 << shift));
    615624            return;
     625        }
    616626    }
    617627
     
    632642          HCSTRING(pPciDev->name), iLevel, iIrq, pic_irq, pic_level));
    633643    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);
    634648}
    635649
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