Changeset 25928 in vbox
- Timestamp:
- Jan 20, 2010 11:58:14 AM (15 years ago)
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevACPI.cpp
r25855 r25928 466 466 AssertCompileSize(ACPITBLIOAPIC, 12); 467 467 468 469 470 /* HPET Descriptor Structure */ 471 struct ACPITBLHPET 472 { 473 ACPITBLHEADER aHeader; 474 uint32_t u32Id; 475 ACPIGENADDR HpetAddr; 476 uint8_t u32Number; 477 uint16_t u32MinTick; 478 uint8_t u8Attributes; 479 }; 480 468 481 # ifdef IN_RING3 /** @todo r=bird: Move this down to where it's used. */ 469 482 … … 872 885 } 873 886 887 888 /** High Performance Event Timer (HPET) descriptor */ 889 static void acpiSetupHPET(ACPIState *s, RTGCPHYS32 addr) 890 { 891 ACPITBLHPET hpet; 892 893 memset(&hpet, 0, sizeof(hpet)); 894 895 acpiPrepareHeader(&hpet.aHeader, "HPET", sizeof(hpet), 1); 896 /* Keep base address consistent with appropriate DSDT entry (vbox.dsl) */ 897 acpiWriteGenericAddr(&hpet.HpetAddr, 898 0 /* Memory address space */, 899 64 /* Register bit width */, 900 0 /* Bit offset */, 901 0, /* Register access size, is it correct? */ 902 0xfed00000 /* Address */); 903 904 hpet.u32Id = 0x8086a201; /* must match what HPET ID returns, is it correct ? */ 905 hpet.u32Number = 0; 906 hpet.u32MinTick = 4096; 907 hpet.u8Attributes = 0; 908 909 hpet.aHeader.u8Checksum = acpiChecksum((uint8_t *)&hpet, sizeof(hpet)); 910 911 acpiPhyscpy(s, addr, (const uint8_t *)&hpet, sizeof(hpet)); 912 } 913 874 914 /* SCI IRQ */ 875 915 DECLINLINE(void) acpiSetIrq(ACPIState *s, int level) … … 1923 1963 { 1924 1964 int rc; 1925 RTGCPHYS32 rsdt_addr, xsdt_addr, fadt_acpi1_addr, fadt_acpi2_addr, facs_addr, dsdt_addr, last_addr, apic_addr = 0;1965 RTGCPHYS32 cur_addr, rsdt_addr, xsdt_addr, fadt_acpi1_addr, fadt_acpi2_addr, facs_addr, dsdt_addr, hpet_addr, apic_addr = 0; 1926 1966 uint32_t addend = 0; 1927 1967 RTGCPHYS32 rsdt_addrs[4]; 1928 1968 RTGCPHYS32 xsdt_addrs[4]; 1929 uint32_t cAddr ;1969 uint32_t cAddr, madt_index, hpet_index; 1930 1970 size_t rsdt_tbl_len = sizeof(ACPITBLHEADER); 1931 1971 size_t xsdt_tbl_len = sizeof(ACPITBLHEADER); … … 1933 1973 cAddr = 1; /* FADT */ 1934 1974 if (s->u8UseIOApic) 1935 cAddr++; /* MADT */ 1975 madt_index = cAddr++; /* MADT */ 1976 1977 1978 if (s->fUseHpet) 1979 hpet_index = cAddr++; /* HPET */ 1936 1980 1937 1981 rsdt_tbl_len += cAddr*4; /* each entry: 32 bits phys. address. */ … … 1964 2008 s->cbRamLow = (uint32_t)cbRamLow; 1965 2009 1966 rsdt_addr = 0; 1967 xsdt_addr = RT_ALIGN_32(rsdt_addr + rsdt_tbl_len, 16); 1968 fadt_acpi1_addr = RT_ALIGN_32(xsdt_addr + xsdt_tbl_len, 16); 1969 fadt_acpi2_addr = RT_ALIGN_32(fadt_acpi1_addr + ACPITBLFADT_VERSION1_SIZE, 16); 2010 cur_addr = 0; 2011 2012 rsdt_addr = cur_addr; 2013 cur_addr = RT_ALIGN_32(cur_addr + rsdt_tbl_len, 16); 2014 2015 xsdt_addr = cur_addr; 2016 cur_addr = RT_ALIGN_32(cur_addr + xsdt_tbl_len, 16); 2017 2018 fadt_acpi1_addr = cur_addr; 2019 cur_addr = RT_ALIGN_32(cur_addr + ACPITBLFADT_VERSION1_SIZE, 16); 2020 2021 fadt_acpi2_addr = cur_addr; 1970 2022 /** @todo ACPI 3.0 doc says it needs to be aligned on a 64 byte boundary. */ 1971 facs_addr = RT_ALIGN_32(fadt_acpi2_addr + sizeof(ACPITBLFADT), 16); 2023 cur_addr = RT_ALIGN_32(cur_addr + sizeof(ACPITBLFADT), 16); 2024 2025 2026 facs_addr = cur_addr; 2027 cur_addr = RT_ALIGN_32(cur_addr + sizeof(ACPITBLFACS), 16); 2028 1972 2029 if (s->u8UseIOApic) 1973 2030 { 1974 apic_addr = RT_ALIGN_32(facs_addr + sizeof(ACPITBLFACS), 16); 1975 /** 1976 * @todo nike: maybe some refactoring needed to compute tables layout, 1977 * but as this code is executed only once it doesn't make sense to optimize much 1978 */ 1979 dsdt_addr = RT_ALIGN_32(apic_addr + AcpiTableMADT::sizeFor(s), 16); 1980 } 1981 else 1982 { 1983 dsdt_addr = RT_ALIGN_32(facs_addr + sizeof(ACPITBLFACS), 16); 2031 apic_addr = cur_addr; 2032 cur_addr = RT_ALIGN_32(cur_addr + AcpiTableMADT::sizeFor(s), 16); 2033 } 2034 if (s->fUseHpet) 2035 { 2036 hpet_addr = cur_addr; 2037 cur_addr = RT_ALIGN_32(cur_addr + sizeof(ACPITBLHPET), 16); 1984 2038 } 1985 2039 … … 1990 2044 return rc; 1991 2045 1992 last_addr = RT_ALIGN_32(dsdt_addr + uDsdtSize, 16); 1993 if (last_addr > 0x10000) 2046 dsdt_addr = cur_addr; 2047 cur_addr = RT_ALIGN_32(cur_addr + uDsdtSize, 16); 2048 2049 if (cur_addr > 0x10000) 1994 2050 return PDMDEV_SET_ERROR(s->pDevIns, VERR_TOO_MUCH_DATA, 1995 2051 N_("Error: ACPI tables > 64KB")); … … 2000 2056 Log(("FACS 0x%08X FADT (1.0) 0x%08X, FADT (2+) 0x%08X\n", facs_addr + addend, fadt_acpi1_addr + addend, fadt_acpi2_addr + addend)); 2001 2057 Log(("DSDT 0x%08X\n", dsdt_addr + addend)); 2058 if (s->fUseHpet) 2059 { 2060 Log(("HPET 0x%08X\n", hpet_addr + addend)); 2061 } 2002 2062 acpiSetupRSDP((ACPITBLRSDP*)s->au8RSDPPage, rsdt_addr + addend, xsdt_addr + addend); 2003 2063 acpiSetupDSDT(s, dsdt_addr + addend, pDsdtCode, uDsdtSize); … … 2011 2071 { 2012 2072 acpiSetupMADT(s, apic_addr + addend); 2013 rsdt_addrs[1] = apic_addr + addend; 2014 xsdt_addrs[1] = apic_addr + addend; 2073 rsdt_addrs[madt_index] = apic_addr + addend; 2074 xsdt_addrs[madt_index] = apic_addr + addend; 2075 } 2076 if (s->fUseHpet) 2077 { 2078 acpiSetupHPET(s, hpet_addr + addend); 2079 rsdt_addrs[hpet_index] = hpet_addr + addend; 2080 xsdt_addrs[hpet_index] = hpet_addr + addend; 2015 2081 } 2016 2082 -
trunk/src/VBox/Devices/PC/vbox.dsl
r25895 r25928 891 891 // High Precision Event Timer 892 892 Device(HPET) { 893 Name (_HID, EISAID("PNP0103"))894 Name (_CID, 0x010CD041)893 Name (_HID, EISAID("PNP0103")) 894 Name (_CID, EISAID("PNP0C01")) 895 895 Name(_UID, 0) 896 896 Method (_STA, 0, NotSerialized) { 897 897 Return(UHPT) 898 898 } 899 Name( _CRS, ResourceTemplate() {899 Name(CRS, ResourceTemplate() { 900 900 IRQNoFlags () 901 901 {0} … … 904 904 Memory32Fixed (ReadWrite, 905 905 0xFED00000, // Address Base 906 0x00000400 ,// Address Length907 _Y16)906 0x00000400 // Address Length 907 ) 908 908 }) 909 910 } 911 Method (_CRS, 0, NotSerialized) 912 { 913 Return (CRS) 909 914 } 910 915
Note:
See TracChangeset
for help on using the changeset viewer.