Changeset 32820 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- Sep 29, 2010 4:25:16 PM (14 years ago)
- Location:
- trunk/src/VBox/Devices/Bus
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r32776 r32820 2412 2412 PciBusReg.u32Version = PDM_PCIBUSREG_VERSION; 2413 2413 PciBusReg.pfnRegisterR3 = pcibridgeRegister; 2414 PciBusReg.pfnRegisterMsiR3 = NULL; 2414 2415 PciBusReg.pfnIORegionRegisterR3 = pciIORegionRegister; 2415 2416 PciBusReg.pfnSetConfigCallbacksR3 = pciSetConfigCallbacks; -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r32776 r32820 23 23 #define PCI_INCLUDE_PRIVATE 24 24 #include <VBox/pci.h> 25 #include <VBox/msi.h> 25 26 #include <VBox/pdmdev.h> 26 27 #include <iprt/asm.h> … … 29 30 30 31 #include "../Builtins.h" 32 33 #include "MsiCommon.h" 31 34 32 35 /** … … 176 179 #ifdef IN_RING3 177 180 static int ich9pciRegisterInternal(PPCIBUS pBus, int iDev, PPCIDEVICE pPciDev, const char *pszName); 178 static void ich9pciUpdateMappings(PCIDevice * d);181 static void ich9pciUpdateMappings(PCIDevice *pDev); 179 182 static DECLCALLBACK(uint32_t) ich9pciConfigRead(PCIDevice *aDev, uint32_t u32Address, unsigned len); 180 183 DECLINLINE(PPCIDEVICE) ich9pciFindBridge(PPCIBUS pBus, uint8_t iBus); … … 183 186 184 187 // See 7.2.2. PCI Express Enhanced Configuration Mechanism for details of address 185 // mapping, we take n= 8approach188 // mapping, we take n=6 approach 186 189 DECLINLINE(void) ich9pciPhysToPciAddr(PPCIGLOBALS pGlobals, RTGCPHYS GCPhysAddr, PciAddress* pPciAddr) 187 190 { … … 523 526 static void ich9pciSetIrqInternal(PPCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev, int iIrq, int iLevel) 524 527 { 528 if (MSIIsEnabled(pPciDev)) 529 { 530 Log2(("Raise a MSI interrupt: %d\n", iIrq)); 531 MSINotify(pGlobals->aPciBus.CTX_SUFF(pDevIns), pPciDev, iIrq); 532 return; 533 } 534 525 535 PPCIBUS pBus = &pGlobals->aPciBus; 526 536 const bool fIsAcpiDevice = PCIDevGetDeviceId(pPciDev) == 0x7113; … … 769 779 } 770 780 781 782 static DECLCALLBACK(int) ich9pciRegisterMsi(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PPDMMSIREG pMsiReg) 783 { 784 return MSIInit(pPciDev, pMsiReg); 785 } 786 787 771 788 static DECLCALLBACK(int) ich9pcibridgeRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev) 772 789 { 773 790 774 791 PPCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS); 775 792 776 793 /* 777 794 * Check input. … … 1574 1591 } 1575 1592 1593 if ( PCIIsMsiCapable(aDev) 1594 && (u32Address >= aDev->Int.s.u8MsiCapOffset) 1595 && (u32Address < aDev->Int.s.u8MsiCapOffset + aDev->Int.s.u8MsiCapSize) 1596 ) 1597 { 1598 return MSIPciConfigRead(aDev, u32Address, len); 1599 } 1600 1576 1601 AssertMsgReturn(u32Address + len <= 256, ("Read after end of PCI config space\n"), 1577 1602 0); … … 1579 1604 { 1580 1605 case 1: 1581 return aDev->config[u32Address];1606 return PCIDevGetByte(aDev, u32Address); 1582 1607 case 2: 1583 return RT_LE2H_U16(*(uint16_t *)(aDev->config + u32Address));1608 return PCIDevGetWord(aDev, u32Address); 1584 1609 default: 1585 1610 case 4: 1586 return RT_LE2H_U32(*(uint32_t *)(aDev->config + u32Address));1611 return PCIDevGetDWord(aDev, u32Address); 1587 1612 } 1588 1613 } … … 1602 1627 1603 1628 AssertMsgReturnVoid(u32Address + len <= 256, ("Write after end of PCI config space\n")); 1629 1630 if ( PCIIsMsiCapable(aDev) 1631 && (u32Address >= aDev->Int.s.u8MsiCapOffset) 1632 && (u32Address < aDev->Int.s.u8MsiCapOffset + aDev->Int.s.u8MsiCapSize) 1633 ) 1634 { 1635 MSIPciConfigWrite(aDev, u32Address, val, len); 1636 return; 1637 } 1638 1604 1639 1605 1640 /* Fast case - update one of BARs or ROM address, 'while' only for 'break' */ … … 1628 1663 val |= pRegion->type; 1629 1664 } 1630 *(uint32_t *)(aDev->config + u32Address) = RT_H2LE_U32(val);1665 PCIDevSetDWord(aDev, u32Address, val); 1631 1666 ich9pciUpdateMappings(aDev); 1632 1667 return; … … 1644 1679 switch (addr) 1645 1680 { 1646 /* Read-only registers , see*/1681 /* Read-only registers */ 1647 1682 case VBOX_PCI_VENDOR_ID: case VBOX_PCI_VENDOR_ID+1: 1648 1683 case VBOX_PCI_DEVICE_ID: case VBOX_PCI_DEVICE_ID+1: … … 1992 2027 PciBusReg.u32Version = PDM_PCIBUSREG_VERSION; 1993 2028 PciBusReg.pfnRegisterR3 = ich9pciRegister; 2029 PciBusReg.pfnRegisterMsiR3 = ich9pciRegisterMsi; 1994 2030 PciBusReg.pfnIORegionRegisterR3 = ich9pciIORegionRegister; 1995 2031 PciBusReg.pfnSetConfigCallbacksR3 = ich9pciSetConfigCallbacks; … … 2181 2217 PciBusReg.u32Version = PDM_PCIBUSREG_VERSION; 2182 2218 PciBusReg.pfnRegisterR3 = ich9pcibridgeRegister; 2219 PciBusReg.pfnRegisterMsiR3 = ich9pciRegisterMsi; 2183 2220 PciBusReg.pfnIORegionRegisterR3 = ich9pciIORegionRegister; 2184 2221 PciBusReg.pfnSetConfigCallbacksR3 = ich9pciSetConfigCallbacks; -
trunk/src/VBox/Devices/Bus/PCIInternal.h
r32779 r32820 75 75 /** Set if the specific device fun was requested by PDM. 76 76 * If clear the device and it's functions can be relocated to satisfy the slot request of another device. */ 77 PCIDEV_FLAG_REQUESTED_DEVFUNC = 1<<0,77 PCIDEV_FLAG_REQUESTED_DEVFUNC = 1<<0, 78 78 /** Flag whether the device is a pci-to-pci bridge. 79 79 * This is set prior to device registration. */ 80 PCIDEV_FLAG_PCI_TO_PCI_BRIDGE = 1<<1,80 PCIDEV_FLAG_PCI_TO_PCI_BRIDGE = 1<<1, 81 81 /** Flag whether the device is a PCI Express device. 82 82 * This is set prior to device registration. */ 83 83 PCIDEV_FLAG_PCI_EXPRESS_DEVICE = 1<<2, 84 84 /** Flag whether the device is capable of MSI. 85 * This is set prior to device registration. */ 86 PCIDEV_FLAG_PCI_MSI = 1<<3, 87 /** Flag whether the device is capable of MSI-X. 88 * This is set prior to device registration. */ 89 PCIDEV_FLAG_PCI_MSIX = 1<<4 90 85 * This one is set by analyzing device capabilities, or explicitly. */ 86 PCIDEV_FLAG_MSI_CAPABLE = 1<<3, 87 /** Flag whether the device is capable of MSI-X. 88 * This one is set by analyzing device capabilities. */ 89 PCIDEV_FLAG_MSIX_CAPABLE = 1<<4 91 90 }; 92 91 … … 118 117 int32_t uIrqPinState; 119 118 119 /* Offset of MSI PCI capability in config space, or 0 */ 120 uint8_t u8MsiCapOffset; 121 /* Size of MSI PCI capability in config space, or 0 */ 122 uint8_t u8MsiCapSize; 123 /* Offset of MSI-X PCI capability in config space, or 0 */ 124 uint8_t u8MsixCapOffset; 125 /* Size of MSI-X PCI capability in config space, or 0 */ 126 uint8_t u8MsixCapSize; 127 128 uint32_t Alignment1; 129 120 130 /** Read config callback for PCI bridges to pass requests 121 131 * to devices on another bus.
Note:
See TracChangeset
for help on using the changeset viewer.