Changeset 32591 in vbox
- Timestamp:
- Sep 17, 2010 11:32:31 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevACPI.cpp
r32477 r32591 165 165 SYSTEM_INFO_INDEX_IOC_ADDRESS = 18, /**< IO controller PCI address */ 166 166 SYSTEM_INFO_INDEX_HBC_ADDRESS = 19, /**< host bus controller PCI address */ 167 SYSTEM_INFO_INDEX_END = 20, 167 SYSTEM_INFO_INDEX_END = 20, 168 168 SYSTEM_INFO_INDEX_INVALID = 0x80, 169 169 SYSTEM_INFO_INDEX_VALID = 0x200 … … 258 258 /** Flag whether CPU hot plugging is enabled. */ 259 259 bool fCpuHotPlug; 260 /** If MCFG ACPI table shown to the guest */ 261 bool fUseMcfg; 260 262 /** Primary NIC PCI address. */ 261 263 uint32_t u32NicPciAddress; … … 274 276 /** PCI address of the host bus controller device. */ 275 277 uint32_t u32HbcPciAddress; 278 /* Physical address of PCI config space MMIO region */ 279 uint64_t u64PciConfigMMioAddress; 276 280 277 281 /** ACPI port base interface. */ … … 525 529 AssertCompileSize(ACPITBLHPET, 56); 526 530 531 /** MCFG Descriptor Structure */ 532 struct ACPITBLMCFG 533 { 534 ACPITBLHEADER aHeader; 535 uint64_t u64Reserved; 536 }; 537 AssertCompileSize(ACPITBLMCFG, 44); 538 539 /* Number of such entries can be computed from the whole table length in header */ 540 struct ACPITBLMCFGENTRY 541 { 542 uint64_t u64BaseAddress; 543 uint16_t u16PciSegmentGroup; 544 uint8_t u8StartBus; 545 uint8_t u8EndBus; 546 uint32_t u32Reserved; 547 }; 548 AssertCompileSize(ACPITBLMCFGENTRY, 16); 549 527 550 # ifdef IN_RING3 /** @todo r=bird: Move this down to where it's used. */ 528 551 … … 990 1013 } 991 1014 1015 /** MMCONFIG PCI config space access (MCFG) descriptor */ 1016 static void acpiSetupMCFG(ACPIState *s, RTGCPHYS32 addr, 1017 RTGCPHYS64 u64PciConfigBase, 1018 uint8_t u8StartBus, 1019 uint8_t u8EndBus) 1020 { 1021 struct { 1022 ACPITBLMCFG hdr; 1023 ACPITBLMCFGENTRY entry; 1024 } tbl; 1025 1026 memset(&tbl, 0, sizeof(tbl)); 1027 1028 acpiPrepareHeader(&tbl.hdr.aHeader, "MCFG", sizeof(tbl), 1); 1029 tbl.entry.u64BaseAddress = u64PciConfigBase; 1030 tbl.entry.u8StartBus = u8StartBus; 1031 tbl.entry.u8EndBus = u8EndBus; 1032 // u16PciSegmentGroup must match _SEG in ACPI table 1033 1034 tbl.hdr.aHeader.u8Checksum = acpiChecksum((uint8_t *)&tbl, sizeof(tbl)); 1035 1036 acpiPhyscpy(s, addr, (const uint8_t *)&tbl, sizeof(tbl)); 1037 } 1038 992 1039 /* SCI IRQ */ 993 1040 DECLINLINE(void) acpiSetIrq(ACPIState *s, int level) … … 2122 2169 int rc; 2123 2170 RTGCPHYS32 GCPhysCur, GCPhysRsdt, GCPhysXsdt, GCPhysFadtAcpi1, GCPhysFadtAcpi2, GCPhysFacs, GCPhysDsdt; 2124 RTGCPHYS32 GCPhysHpet = 0, GCPhysApic = 0, GCPhysSsdt = 0 ;2171 RTGCPHYS32 GCPhysHpet = 0, GCPhysApic = 0, GCPhysSsdt = 0, GCPhysMcfg = 0; 2125 2172 uint32_t addend = 0; 2126 2173 RTGCPHYS32 aGCPhysRsdt[4]; 2127 2174 RTGCPHYS32 aGCPhysXsdt[4]; 2128 uint32_t cAddr, iMadt = 0, iHpet = 0, iSsdt = 0 ;2175 uint32_t cAddr, iMadt = 0, iHpet = 0, iSsdt = 0, iMcfg = 0; 2129 2176 size_t cbRsdt = sizeof(ACPITBLHEADER); 2130 2177 size_t cbXsdt = sizeof(ACPITBLHEADER); … … 2136 2183 if (s->fUseHpet) 2137 2184 iHpet = cAddr++; /* HPET */ 2185 2186 if (s->fUseMcfg) 2187 iMcfg = cAddr++; /* MCFG */ 2138 2188 2139 2189 iSsdt = cAddr++; /* SSDT */ … … 2192 2242 GCPhysHpet = GCPhysCur; 2193 2243 GCPhysCur = RT_ALIGN_32(GCPhysCur + sizeof(ACPITBLHPET), 16); 2244 } 2245 if (s->fUseMcfg) 2246 { 2247 GCPhysMcfg = GCPhysCur; 2248 /* Assume one entry */ 2249 GCPhysCur = RT_ALIGN_32(GCPhysCur + sizeof(ACPITBLMCFG) + sizeof(ACPITBLMCFGENTRY), 16); 2194 2250 } 2195 2251 … … 2226 2282 if (s->fUseHpet) 2227 2283 Log((" HPET 0x%08X", GCPhysHpet + addend)); 2284 if (s->fUseMcfg) 2285 Log((" MCFG 0x%08X", GCPhysMcfg + addend)); 2228 2286 Log((" SSDT 0x%08X", GCPhysSsdt + addend)); 2229 2287 Log(("\n")); … … 2249 2307 aGCPhysXsdt[iHpet] = GCPhysHpet + addend; 2250 2308 } 2309 if (s->fUseMcfg) 2310 { 2311 acpiSetupMCFG(s, GCPhysMcfg + addend, s->u64PciConfigMMioAddress, 0, 1); 2312 aGCPhysRsdt[iMcfg] = GCPhysMcfg + addend; 2313 aGCPhysXsdt[iMcfg] = GCPhysMcfg + addend; 2314 } 2315 2251 2316 acpiSetupSSDT(s, GCPhysSsdt + addend, pSsdtCode, cbSsdtSize); 2252 2317 acpiCleanupSsdt(s->pDevIns, pSsdtCode); … … 2464 2529 "R0Enabled\0" 2465 2530 "HpetEnabled\0" 2531 "McfgEnabled\0" 2466 2532 "SmcEnabled\0" 2467 2533 "FdcEnabled\0" … … 2505 2571 return PDMDEV_SET_ERROR(pDevIns, rc, 2506 2572 N_("Configuration error: Failed to read \"HpetEnabled\"")); 2573 /* query whether we are supposed to present HPET */ 2574 rc = CFGMR3QueryU64Def(pCfg, "McfgBase", &s->u64PciConfigMMioAddress, 0); 2575 if (RT_FAILURE(rc)) 2576 return PDMDEV_SET_ERROR(pDevIns, rc, 2577 N_("Configuration error: Failed to read \"McfgBase\"")); 2578 s->fUseMcfg = (s->u64PciConfigMMioAddress != 0); 2579 2507 2580 /* query whether we are supposed to present SMC */ 2508 2581 rc = CFGMR3QueryBoolDef(pCfg, "SmcEnabled", &s->fUseSmc, false); … … 2700 2773 2701 2774 /* See p. 50 of PIIX4 manual */ 2702 dev->config[0x04] = 0x01; /* command */ 2703 dev->config[0x05] = 0x00; 2704 2705 dev->config[0x06] = 0x80; /* status */ 2706 dev->config[0x07] = 0x02; 2707 2708 dev->config[0x08] = 0x08; /* revision number */ 2709 2710 dev->config[0x09] = 0x00; /* class code */ 2711 dev->config[0x0a] = 0x80; 2712 dev->config[0x0b] = 0x06; 2713 2714 dev->config[0x0e] = 0x80; /* header type */ 2715 2716 dev->config[0x0f] = 0x00; /* reserved */ 2717 2718 dev->config[0x3c] = SCI_INT; /* interrupt line */ 2775 PCIDevSetCommand(dev, 0x01); 2776 PCIDevSetStatus(dev, 0x0280); 2777 2778 PCIDevSetRevisionId(dev, 0x08); 2779 2780 PCIDevSetClassProg(dev, 0x00); 2781 PCIDevSetClassSub(dev, 0x80); 2782 PCIDevSetClassBase(dev, 0x06); 2783 2784 PCIDevSetHeaderType(dev, 0x80); 2785 2786 PCIDevSetBIST(dev, 0x00); 2787 2788 PCIDevSetInterruptLine(dev, SCI_INT); 2719 2789 2720 2790 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.