Changeset 64450 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Oct 28, 2016 10:10:53 AM (8 years ago)
- Location:
- trunk/src/VBox/Devices/Bus
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r64424 r64450 1510 1510 /* -=-=-=-=-=- PCI Bus Interface Methods (PDMPCIBUSREG) -=-=-=-=-=- */ 1511 1511 1512 1513 /**1514 * @interface_method_impl{PDMPCIBUSREG,pfnIORegionRegisterR3}1515 */1516 static DECLCALLBACK(int) pciR3CommonIORegionRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iRegion, RTGCPHYS cbRegion,1517 PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)1518 {1519 NOREF(pDevIns);1520 1521 /*1522 * Validate.1523 */1524 AssertMsgReturn( enmType == PCI_ADDRESS_SPACE_MEM1525 || enmType == PCI_ADDRESS_SPACE_IO1526 || enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH,1527 ("Invalid enmType=%#x? Or was this a bitmask after all...\n", enmType),1528 VERR_INVALID_PARAMETER);1529 AssertMsgReturn((unsigned)iRegion < PCI_NUM_REGIONS,1530 ("Invalid iRegion=%d PCI_NUM_REGIONS=%d\n", iRegion, PCI_NUM_REGIONS),1531 VERR_INVALID_PARAMETER);1532 int iLastSet = ASMBitLastSetU64(cbRegion);1533 AssertMsgReturn( iLastSet != 01534 && RT_BIT_64(iLastSet - 1) == cbRegion,1535 ("Invalid cbRegion=%RGp iLastSet=%#x (not a power of 2 or 0)\n", cbRegion, iLastSet),1536 VERR_INVALID_PARAMETER);1537 1538 /*1539 * Register the I/O region.1540 */1541 PPCIIOREGION pRegion = &pPciDev->Int.s.aIORegions[iRegion];1542 pRegion->addr = ~0U;1543 pRegion->size = cbRegion;1544 pRegion->type = enmType;1545 pRegion->map_func = pfnCallback;1546 1547 /* Set type in the config space. */1548 AssertCompile(PCI_ADDRESS_SPACE_MEM == 0);1549 AssertCompile(PCI_ADDRESS_SPACE_IO == 1);1550 AssertCompile(PCI_ADDRESS_SPACE_MEM_PREFETCH == RT_BIT_32(3));1551 PCIDevSetDWord(pPciDev, 0x10 + iRegion * 4, enmType);1552 1553 return VINF_SUCCESS;1554 }1555 1556 1557 1512 /** 1558 1513 * @interface_method_impl{PDMPCIBUSREG,pfnSetConfigCallbacksR3} … … 1739 1694 PciBusReg.pfnRegisterR3 = pciR3MergedRegister; 1740 1695 PciBusReg.pfnRegisterMsiR3 = NULL; 1741 PciBusReg.pfnIORegionRegisterR3 = pciR3CommonIORegionRegister;1696 PciBusReg.pfnIORegionRegisterR3 = devpciR3CommonIORegionRegister; 1742 1697 PciBusReg.pfnSetConfigCallbacksR3 = pciR3CommonSetConfigCallbacks; 1743 1698 PciBusReg.pfnSetIrqR3 = pciSetIrq; … … 2076 2031 PciBusReg.pfnRegisterR3 = pcibridgeR3MergedRegisterDevice; 2077 2032 PciBusReg.pfnRegisterMsiR3 = NULL; 2078 PciBusReg.pfnIORegionRegisterR3 = pciR3CommonIORegionRegister;2033 PciBusReg.pfnIORegionRegisterR3 = devpciR3CommonIORegionRegister; 2079 2034 PciBusReg.pfnSetConfigCallbacksR3 = pciR3CommonSetConfigCallbacks; 2080 2035 PciBusReg.pfnSetIrqR3 = pcibridgeSetIrq; -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r64424 r64450 782 782 783 783 int iCmd = ich9pciGetWord(pDev, VBOX_PCI_COMMAND); 784 for (int iRegion = 0; iRegion < PCI_NUM_REGIONS; iRegion++)784 for (int iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS; iRegion++) 785 785 { 786 786 PCIIORegion* pRegion = &pDev->Int.s.aIORegions[iRegion]; … … 862 862 863 863 864 /* -=-=-=-=-=- PCI Bus Interface Methods (PDMPCIBUSREG) -=-=-=-=-=- */ 865 866 864 867 static DECLCALLBACK(int) ich9pciRegisterMsi(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg) 865 868 { … … 879 882 880 883 881 static DECLCALLBACK(int) ich9pciIORegionRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iRegion, RTGCPHYS cbRegion, 884 /** 885 * @interface_method_impl{PDMPCIBUSREG,pfnIORegionRegisterR3} 886 */ 887 DECLCALLBACK(int) devpciR3CommonIORegionRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iRegion, RTGCPHYS cbRegion, 882 888 PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback) 883 889 { … … 895 901 ("Invalid enmType=%#x? Or was this a bitmask after all...\n", enmType), 896 902 VERR_INVALID_PARAMETER); 897 AssertMsgReturn((unsigned)iRegion < PCI_NUM_REGIONS,898 ("Invalid iRegion=%d PCI_NUM_REGIONS=%d\n", iRegion,PCI_NUM_REGIONS),903 AssertMsgReturn((unsigned)iRegion < VBOX_PCI_NUM_REGIONS, 904 ("Invalid iRegion=%d VBOX_PCI_NUM_REGIONS=%d\n", iRegion, VBOX_PCI_NUM_REGIONS), 899 905 VERR_INVALID_PARAMETER); 900 906 int iLastSet = ASMBitLastSetU64(cbRegion); … … 904 910 VERR_INVALID_PARAMETER); 905 911 906 Log((" ich9pciIORegionRegister: %s region %d size %RGp type %x\n",912 Log(("devpciR3CommonIORegionRegister: %s region %d size %RGp type %x\n", 907 913 pPciDev->pszNameR3, iRegion, cbRegion, enmType)); 908 914 … … 922 928 { 923 929 /* VBOX_PCI_BASE_ADDRESS_5 and VBOX_PCI_ROM_ADDRESS are excluded. */ 924 AssertMsgReturn(iRegion < PCI_NUM_REGIONS - 2,930 AssertMsgReturn(iRegion < VBOX_PCI_NUM_REGIONS - 2, 925 931 ("Region %d cannot be 64-bit\n", iRegion), 926 932 VERR_INVALID_PARAMETER); … … 930 936 931 937 /* Set type in the PCI config space. */ 938 AssertCompile(PCI_ADDRESS_SPACE_MEM == 0); 939 AssertCompile(PCI_ADDRESS_SPACE_IO == 1); 940 AssertCompile(PCI_ADDRESS_SPACE_BAR64 == RT_BIT_32(2)); 941 AssertCompile(PCI_ADDRESS_SPACE_MEM_PREFETCH == RT_BIT_32(3)); 932 942 uint32_t u32Value = (uint32_t)enmType & (PCI_ADDRESS_SPACE_IO | PCI_ADDRESS_SPACE_BAR64 | PCI_ADDRESS_SPACE_MEM_PREFETCH); 933 943 PCIDevSetDWord(pPciDev, ich9pciGetRegionReg(iRegion), u32Value); … … 1630 1640 * We ignore ROM region here. 1631 1641 */ 1632 for (int iRegion = 0; iRegion < (PCI_NUM_REGIONS-1); iRegion++)1642 for (int iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS - 1; iRegion++) 1633 1643 { 1634 1644 uint32_t u32Address = ich9pciGetRegionReg(iRegion); … … 2198 2208 if ((iCmd & (VBOX_PCI_COMMAND_IO | VBOX_PCI_COMMAND_MEMORY)) != 0) 2199 2209 { 2200 for (unsigned iRegion = 0; iRegion < PCI_NUM_REGIONS; iRegion++)2210 for (unsigned iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS; iRegion++) 2201 2211 { 2202 2212 PCIIORegion const *pRegion = &pPciDev->Int.s.aIORegions[iRegion]; … … 2389 2399 PciBusReg.pfnRegisterR3 = pciR3MergedRegister; 2390 2400 PciBusReg.pfnRegisterMsiR3 = ich9pciRegisterMsi; 2391 PciBusReg.pfnIORegionRegisterR3 = ich9pciIORegionRegister;2401 PciBusReg.pfnIORegionRegisterR3 = devpciR3CommonIORegionRegister; 2392 2402 PciBusReg.pfnSetConfigCallbacksR3 = ich9pciSetConfigCallbacks; 2393 2403 PciBusReg.pfnSetIrqR3 = ich9pciSetIrq; … … 2504 2514 { 2505 2515 /* Clear regions */ 2506 for (int iRegion = 0; iRegion < PCI_NUM_REGIONS; iRegion++)2516 for (int iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS; iRegion++) 2507 2517 { 2508 2518 PCIIORegion* pRegion = &pDev->Int.s.aIORegions[iRegion]; … … 2661 2671 PciBusReg.pfnRegisterR3 = pcibridgeR3MergedRegisterDevice; 2662 2672 PciBusReg.pfnRegisterMsiR3 = ich9pciRegisterMsi; 2663 PciBusReg.pfnIORegionRegisterR3 = ich9pciIORegionRegister;2673 PciBusReg.pfnIORegionRegisterR3 = devpciR3CommonIORegionRegister; 2664 2674 PciBusReg.pfnSetConfigCallbacksR3 = ich9pciSetConfigCallbacks; 2665 2675 PciBusReg.pfnSetIrqR3 = ich9pcibridgeSetIrq; -
trunk/src/VBox/Devices/Bus/DevPciInternal.h
r64424 r64450 185 185 DECLCALLBACK(void) devpciR3InfoPci(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs); 186 186 DECLCALLBACK(void) devpciR3InfoPciIrq(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs); 187 DECLCALLBACK(int) devpciR3CommonIORegionRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iRegion, RTGCPHYS cbRegion, 188 PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback); 187 189 188 190 #endif
Note:
See TracChangeset
for help on using the changeset viewer.