MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / create_facp_table

Function create_facp_table

vmm/src/acpi.rs:280–335  ·  view source on GitHub ↗
(dsdt_offset: GuestAddress, device_manager: &DeviceManager)

Source from the content-addressed store, hash-verified

278const FACP_DSDT_OFFSET: usize = 140;
279
280fn create_facp_table(dsdt_offset: GuestAddress, device_manager: &DeviceManager) -> Sdt {
281 trace_scoped!("create_facp_table");
282
283 // Revision 6 of the ACPI FADT table is 276 bytes long
284 let mut facp = Sdt::new(*b"FACP", 276, 6, *b"CLOUDH", *b"CHFACP ", 1);
285
286 {
287 if let Some(address) = device_manager.acpi_platform_addresses().reset_reg_address {
288 // RESET_REG
289 facp.write(116, address);
290 // RESET_VALUE
291 facp.write(128, 1u8);
292 }
293
294 if let Some(address) = device_manager
295 .acpi_platform_addresses()
296 .sleep_control_reg_address
297 {
298 // SLEEP_CONTROL_REG
299 facp.write(244, address);
300 }
301
302 if let Some(address) = device_manager
303 .acpi_platform_addresses()
304 .sleep_status_reg_address
305 {
306 // SLEEP_STATUS_REG
307 facp.write(256, address);
308 }
309
310 if let Some(address) = device_manager.acpi_platform_addresses().pm_timer_address {
311 // X_PM_TMR_BLK
312 facp.write(208, address);
313 }
314 }
315
316 // aarch64 specific fields
317 #[cfg(target_arch = "aarch64")]
318 // ARM_BOOT_ARCH: enable PSCI with HVC enable-method
319 facp.write(129, 3u16);
320
321 // Architecture common fields
322 // HW_REDUCED_ACPI, RESET_REG_SUP, TMR_VAL_EXT
323 let fadt_flags: u32 = (1 << 20) | (1 << 10) | (1 << 8);
324 facp.write(112, fadt_flags);
325 // FADT minor version
326 facp.write(131, 3u8);
327 // X_DSDT
328 facp.write(FACP_DSDT_OFFSET, dsdt_offset.0);
329 // Hypervisor Vendor Identity
330 facp.write_bytes(268, b"CLOUDHYP");
331
332 facp.update_checksum();
333
334 facp
335}
336
337fn create_mcfg_table(pci_segments: &[PciSegment]) -> Sdt {

Callers 2

create_acpi_tables_tdxFunction · 0.85

Calls 3

newFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected