(&self, sink: &mut dyn acpi_tables::AmlSink)
| 2287 | |
| 2288 | impl Aml for Cpu { |
| 2289 | fn to_aml_bytes(&self, sink: &mut dyn acpi_tables::AmlSink) { |
| 2290 | #[cfg(target_arch = "x86_64")] |
| 2291 | let mat_data: Vec<u8> = self.generate_mat(); |
| 2292 | #[allow(clippy::if_same_then_else)] |
| 2293 | if self.dynamic { |
| 2294 | aml::Device::new( |
| 2295 | format!("C{:03X}", self.cpu_id).as_str().into(), |
| 2296 | vec![ |
| 2297 | &aml::Name::new("_HID".into(), &"ACPI0007"), |
| 2298 | &aml::Name::new("_UID".into(), &self.cpu_id), |
| 2299 | // Currently, AArch64 cannot support following fields. |
| 2300 | /* |
| 2301 | _STA return value: |
| 2302 | Bit [0] – Set if the device is present. |
| 2303 | Bit [1] – Set if the device is enabled and decoding its resources. |
| 2304 | Bit [2] – Set if the device should be shown in the UI. |
| 2305 | Bit [3] – Set if the device is functioning properly (cleared if device failed its diagnostics). |
| 2306 | Bit [4] – Set if the battery is present. |
| 2307 | Bits [31:5] – Reserved (must be cleared). |
| 2308 | */ |
| 2309 | #[cfg(target_arch = "x86_64")] |
| 2310 | &aml::Method::new( |
| 2311 | "_STA".into(), |
| 2312 | 0, |
| 2313 | false, |
| 2314 | // Call into CSTA method which will interrogate device |
| 2315 | vec![&aml::Return::new(&aml::MethodCall::new( |
| 2316 | "CSTA".into(), |
| 2317 | vec![&self.cpu_id], |
| 2318 | ))], |
| 2319 | ), |
| 2320 | &aml::Method::new( |
| 2321 | "_PXM".into(), |
| 2322 | 0, |
| 2323 | false, |
| 2324 | vec![&aml::Return::new(&self.proximity_domain)], |
| 2325 | ), |
| 2326 | // The Linux kernel expects every CPU device to have a _MAT entry |
| 2327 | // containing the LAPIC for this processor with the enabled bit set |
| 2328 | // even it if is disabled in the MADT (non-boot CPU) |
| 2329 | #[cfg(target_arch = "x86_64")] |
| 2330 | &aml::Name::new("_MAT".into(), &aml::BufferData::new(mat_data)), |
| 2331 | // Trigger CPU ejection |
| 2332 | #[cfg(target_arch = "x86_64")] |
| 2333 | &aml::Method::new( |
| 2334 | "_EJ0".into(), |
| 2335 | 1, |
| 2336 | false, |
| 2337 | // Call into CEJ0 method which will actually eject device |
| 2338 | vec![&aml::MethodCall::new("CEJ0".into(), vec![&self.cpu_id])], |
| 2339 | ), |
| 2340 | ], |
| 2341 | ) |
| 2342 | .to_aml_bytes(sink); |
| 2343 | } else { |
| 2344 | aml::Device::new( |
| 2345 | format!("C{:03X}", self.cpu_id).as_str().into(), |
| 2346 | vec![ |
no test coverage detected