|
1 | 1 | pub mod interrupt; |
2 | 2 |
|
3 | 3 | use crate::{ |
4 | | - address::GenericAddress, |
5 | | - fadt::Fadt, |
6 | | - madt::{Madt, MadtError, MpProtectedModeWakeupCommand, MultiprocessorWakeupMailbox}, |
7 | | - AcpiError, |
8 | | - AcpiHandler, |
9 | | - AcpiResult, |
10 | | - AcpiTables, |
11 | | - ManagedSlice, |
12 | | - PowerProfile, |
| 4 | + address::GenericAddress, fadt::Fadt, madt::{Madt, MadtError, MpProtectedModeWakeupCommand, MultiprocessorWakeupMailbox}, slit::Slit, AcpiError, AcpiHandler, AcpiResult, AcpiTables, ManagedSlice, PowerProfile |
13 | 5 | }; |
14 | 6 | use core::{alloc::Allocator, mem, ptr}; |
15 | 7 | use interrupt::InterruptModel; |
|
64 | 56 | } |
65 | 57 | } |
66 | 58 |
|
| 59 | +#[derive(Clone, Debug)] |
| 60 | +pub struct SystemLocalityInfo<'a, A> |
| 61 | +where |
| 62 | + A: Allocator, |
| 63 | +{ |
| 64 | + nr_system_localities: u64, |
| 65 | + distance_matrix: ManagedSlice<'a, ManagedSlice<'a, u8, A>, A>, |
| 66 | +} |
| 67 | + |
| 68 | +impl <'a, A> SystemLocalityInfo<'a, A> |
| 69 | +where |
| 70 | + A: Allocator, |
| 71 | +{ |
| 72 | + pub(crate) fn new(nr_system_localities: u64, distance_matrix: ManagedSlice<'a, ManagedSlice<'a, u8, A>, A>) -> Self { |
| 73 | + Self { nr_system_localities, distance_matrix } |
| 74 | + } |
| 75 | +} |
| 76 | + |
67 | 77 | /// Information about the ACPI Power Management Timer (ACPI PM Timer). |
68 | 78 | #[derive(Debug, Clone)] |
69 | 79 | pub struct PmTimer { |
|
95 | 105 | /// On `x86_64` platforms that support the APIC, the processor topology must also be inferred from the |
96 | 106 | /// interrupt model. That information is stored here, if present. |
97 | 107 | pub processor_info: Option<ProcessorInfo<'a, A>>, |
| 108 | + pub system_locality_info: Option<SystemLocalityInfo<'a, A>>, |
98 | 109 | pub pm_timer: Option<PmTimer>, |
99 | 110 | /* |
100 | 111 | * TODO: we could provide a nice view of the hardware register blocks in the FADT here. |
@@ -124,12 +135,16 @@ where |
124 | 135 |
|
125 | 136 | let madt = tables.find_table::<Madt>(); |
126 | 137 | let (interrupt_model, processor_info) = match madt { |
127 | | - Ok(madt) => madt.get().parse_interrupt_model_in(allocator)?, |
| 138 | + Ok(madt) => madt.get().parse_interrupt_model_in(allocator.clone())?, |
128 | 139 | Err(_) => (InterruptModel::Unknown, None), |
129 | 140 | }; |
| 141 | + let system_locality_info = { |
| 142 | + let slit = tables.find_table::<Slit>(); |
| 143 | + slit.and_then(|slit| slit.get().parse_system_locality_in(allocator)).ok() |
| 144 | + }; |
130 | 145 | let pm_timer = PmTimer::new(&fadt)?; |
131 | 146 |
|
132 | | - Ok(PlatformInfo { power_profile, interrupt_model, processor_info, pm_timer }) |
| 147 | + Ok(PlatformInfo { power_profile, interrupt_model, processor_info, system_locality_info, pm_timer }) |
133 | 148 | } |
134 | 149 | } |
135 | 150 |
|
|
0 commit comments