Changeset 88327 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Mar 31, 2021 3:00:55 AM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Bus
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r88322 r88327 30 30 * Defined Constants And Macros * 31 31 *********************************************************************************************************************************/ 32 /** @def VTD_LO_U32 33 * Gets the low uint32_t of a uint64_t or something equivalent. 32 /** Gets the low uint32_t of a uint64_t or something equivalent. 34 33 * 35 34 * This is suitable for casting constants outside code (since RT_LO_U32 can't be … … 37 36 #define VTD_LO_U32(a) (uint32_t)(UINT32_MAX & (a)) 38 37 39 /** @def VTD_HI_U32 40 * Gets the high uint32_t of a uint64_t or something equivalent. 38 /** Gets the high uint32_t of a uint64_t or something equivalent. 41 39 * 42 40 * This is suitable for casting constants outside code (since RT_HI_U32 can't be … … 44 42 #define VTD_HI_U32(a) (uint32_t)((a) >> 32) 45 43 46 /** @def VTD_ASSERT_MMIO_ACCESS 47 * Asserts MMIO access' offset and size are valid or returns appropriate error 44 /** Asserts MMIO access' offset and size are valid or returns appropriate error 48 45 * code suitable for returning from MMIO access handlers. */ 49 46 #define VTD_ASSERT_MMIO_ACCESS_RET(a_off, a_cb) \ … … 53 50 } while (0); 54 51 55 /** @def VTD_IS_MMIO_OFF_VALID 56 * Returns @c true if the MMIO offset is valid, or @c false otherwise. */ 52 /** Checks whether the MMIO offset is valid. */ 57 53 #define VTD_IS_MMIO_OFF_VALID(a_off) ( (a_off) < VTD_MMIO_GROUP_0_OFF_END \ 58 54 || (a_off) - VTD_MMIO_GROUP_1_OFF_FIRST < VTD_MMIO_GROUP_1_SIZE) … … 83 79 #define VTD_MMIO_GROUP_1_OFF_FIRST VTD_MMIO_OFF_VCCAP_REG 84 80 /** Offset of last register in group 1 (inclusive). */ 85 #define VTD_MMIO_GROUP_1_OFF_LAST VTD_MMIO_OFF_FRCD_LO_REG + 8* VTD_FRCD_REG_COUNT81 #define VTD_MMIO_GROUP_1_OFF_LAST (VTD_MMIO_OFF_FRCD_LO_REG + 8) * VTD_FRCD_REG_COUNT 86 82 /** Last valid offset in group 1 (exclusive). */ 87 83 #define VTD_MMIO_GROUP_1_OFF_END (VTD_MMIO_GROUP_1_OFF_LAST + 8 /* sizeof FRCD_HI_REG */) … … 428 424 AssertMsg(VTD_IS_MMIO_OFF_VALID(offLast), ("off=%#x cb=%u\n", offReg, cbReg)); 429 425 430 uint8_t * apbRegs[] = { &pThis->abRegs0[0], &pThis->abRegs1[0] };426 uint8_t *const apbRegs[] = { &pThis->abRegs0[0], &pThis->abRegs1[0] }; 431 427 *pIdxGroup = !(offLast < VTD_MMIO_GROUP_0_OFF_END); 432 428 return apbRegs[*pIdxGroup]; … … 771 767 AssertRCReturn(rc, rc); 772 768 769 /* 770 * Initialize PCI configuration registers. 771 */ 772 PPDMPCIDEV pPciDev = pDevIns->apPciDevs[0]; 773 PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev); 774 775 /* Header. */ 776 PDMPciDevSetVendorId(pPciDev, VTD_PCI_VENDOR_ID); /* Intel */ 777 PDMPciDevSetDeviceId(pPciDev, VTD_PCI_DEVICE_ID); /* VirtualBox DMAR device */ 778 PDMPciDevSetRevisionId(pPciDev, VTD_PCI_REVISION_ID); /* VirtualBox specific device implementation revision */ 779 PDMPciDevSetClassBase(pPciDev, VBOX_PCI_CLASS_SYSTEM); /* System Base Peripheral */ 780 PDMPciDevSetClassSub(pPciDev, VBOX_PCI_SUB_SYSTEM_OTHER); /* Other */ 781 PDMPciDevSetHeaderType(pPciDev, 0x0); /* Single function, type 0 */ 782 PDMPciDevSetSubSystemId(pPciDev, VTD_PCI_DEVICE_ID); /* VirtualBox DMAR device */ 783 PDMPciDevSetSubSystemVendorId(pPciDev, VTD_PCI_VENDOR_ID); /* Intel */ 784 785 /** @todo VTD: Chipset spec says PCI Express Capability Id. Relevant for us? */ 786 PDMPciDevSetStatus(pPciDev, 0); 787 PDMPciDevSetCapabilityList(pPciDev, 0); 788 789 /** @todo VTD: VTBAR at 0x180? */ 790 791 /* 792 * Register the PCI function with PDM. 793 */ 794 rc = PDMDevHlpPCIRegister(pDevIns, pPciDev); 795 AssertLogRelRCReturn(rc, rc); 796 797 /** @todo VTD: Register MSI but what's the MSI capability offset? */ 798 #if 0 799 /* 800 * Register MSI support for the PCI device. 801 * This must be done -after- registering it as a PCI device! 802 */ 803 #endif 773 804 774 805 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Devices/Bus/DevIommuIntel.h
r88310 r88327 24 24 #include <VBox/iommu-intel.h> 25 25 26 /** Intel vendor ID for the DMAR unit. */ 27 #define VTD_PCI_VENDOR_ID 0x8086 28 /** VirtualBox DMAR unit's device ID. */ 29 #define VTD_PCI_DEVICE_ID 0xc0de 30 /** VirtualBox DMAR unit's device revision ID. */ 31 #define VTD_PCI_REVISION_ID 0x01 32 26 33 /** Feature/capability flags exposed to the guest (x2APIC Opt Out until we get 27 34 * regular APIC setup working). */ 28 35 #define VTD_ACPI_DMAR_FLAGS (ACPI_DMAR_F_INTR_REMAP | ACPI_DMAR_F_X2APIC_OPT_OUT) 36 29 37 /** The MMIO base address of the DMAR unit (taken from real hardware). */ 30 38 #define VTD_MMIO_BASE_ADDR 0xfed90000
Note:
See TracChangeset
for help on using the changeset viewer.