Changeset 275 for trunk/hal/x86_64/core/hal_acpi.c
- Timestamp:
- Jul 26, 2017, 1:20:36 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_acpi.c
r241 r275 173 173 /* -------------------------------------------------------------------------- */ 174 174 175 static void hal_acpi_parse_srat(srat_t *srat) 176 { 177 srat_cpu_affinity_t *cpu; 178 srat_mem_affinity_t *mem; 179 void *ptr, *end; 180 subheader_t *sub; 181 uint32_t dom; 182 183 ptr = (void *)(srat + 1); 184 end = (void *)srat + srat->Header.Length; 185 186 while (ptr < end) { 187 sub = (subheader_t *)ptr; 188 if (sub->Type == ACPI_SRAT_TYPE_CPU_AFFINITY) { 189 cpu = (srat_cpu_affinity_t *)sub; 190 if (cpu->Flags & ACPI_SRAT_CPU_USE_AFFINITY) { 191 dom = ((uint32_t)cpu->ProximityDomainHi[2] << 24) | 192 ((uint32_t)cpu->ProximityDomainHi[1] << 16) | 193 ((uint32_t)cpu->ProximityDomainHi[0] << 8) | 194 (uint32_t)cpu->ProximityDomainLo; 195 x86_printf("-> found CPU affinity: %z->%z\n", 196 (uint64_t)cpu->ApicId, (uint64_t)dom); 197 } 198 } else if (sub->Type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) { 199 mem = (srat_mem_affinity_t *)sub; 200 // if (mem->Flags & ACPI_SRAT_MEM_ENABLED) 201 x86_printf("-> found MEM affinity: %z->[%Z,%Z,%Z]\n", 202 mem->ProximityDomain, 203 mem->BaseAddress, mem->Length,(uint64_t)mem->Flags); 204 } 205 206 ptr += sub->Length; 207 } 208 209 } 210 211 static srat_t *hal_acpi_map_srat(rsdt_t *rsdt) 212 { 213 vaddr_t va; 214 paddr_t pa; 215 uint32_t *ent; 216 size_t i, n; 217 218 n = RSDT_NENTRIES(rsdt); 219 ent = RSDT_ENTRIES(rsdt); 220 221 for (i = 0; i < n; i++) { 222 pa = (paddr_t)ent[i]; 223 va = hal_acpi_map_table(pa, "SRAT"); 224 if (va == 0) 225 continue; 226 227 return (srat_t *)va; 228 } 229 230 return NULL; 231 } 232 233 /* -------------------------------------------------------------------------- */ 234 175 235 static rsdt_t *hal_acpi_map_rsdt(rsdp_t *rsdp) 176 236 { … … 242 302 rsdt_t *rsdt; 243 303 madt_t *madt; 304 srat_t *srat; 244 305 paddr_t bios_min = 0x0E0000; 245 306 paddr_t bios_max = 0x100000; … … 262 323 x86_panic("RSDT not found"); 263 324 264 /* Now, map MADT*/325 /* Map MADT and parse it */ 265 326 madt = hal_acpi_map_madt(rsdt); 266 327 if (madt == NULL) 267 328 x86_panic("MADT not found"); 268 269 /* Parse it */270 329 hal_acpi_parse_madt(madt); 271 } 272 330 331 /* Map SRAT and parse it */ 332 srat = hal_acpi_map_srat(rsdt); 333 if (srat != NULL) 334 hal_acpi_parse_srat(srat); 335 else 336 x86_printf("-> SRAT not found, single cluster\n"); 337 } 338
Note: See TracChangeset
for help on using the changeset viewer.