Lines Matching +full:data +full:- +full:mapping

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * data here, so that it can be retrieved together.
86 * IORT node. Each node has some device specific data depending on the
94 u_int node_offset; /* offset in IORT - node ID */
107 } data; member
120 switch(node->type) { in iort_entry_get_id_mapping_index()
122 /* The ID mapping field was added in version 1 */ in iort_entry_get_id_mapping_index()
123 if (node->revision < 1) in iort_entry_get_id_mapping_index()
124 return (-1); in iort_entry_get_id_mapping_index()
128 * mapping field is ignored. in iort_entry_get_id_mapping_index()
130 if (node->data.smmu_v3.EventGsiv != 0 && in iort_entry_get_id_mapping_index()
131 node->data.smmu_v3.PriGsiv != 0 && in iort_entry_get_id_mapping_index()
132 node->data.smmu_v3.GerrGsiv != 0 && in iort_entry_get_id_mapping_index()
133 node->data.smmu_v3.SyncGsiv != 0) in iort_entry_get_id_mapping_index()
134 return (-1); in iort_entry_get_id_mapping_index()
136 if (node->data.smmu_v3.IdMappingIndex >= node->nentries) in iort_entry_get_id_mapping_index()
137 return (-1); in iort_entry_get_id_mapping_index()
139 return (node->data.smmu_v3.IdMappingIndex); in iort_entry_get_id_mapping_index()
146 return (-1); in iort_entry_get_id_mapping_index()
160 entry = node->entries.mappings; in iort_entry_lookup()
161 for (i = 0; i < node->nentries; i++, entry++) { in iort_entry_lookup()
164 if (entry->base <= id && id <= entry->end) in iort_entry_lookup()
167 if (i == node->nentries) in iort_entry_lookup()
169 if ((entry->flags & ACPI_IORT_ID_SINGLE_MAPPING) == 0) in iort_entry_lookup()
170 *outid = entry->outbase + (id - entry->base); in iort_entry_lookup()
172 *outid = entry->outbase; in iort_entry_lookup()
173 return (entry->out_node); in iort_entry_lookup()
188 (node->type == ACPI_IORT_NODE_SMMU_V3 || in iort_smmu_trymap()
189 node->type == ACPI_IORT_NODE_SMMU)) { in iort_smmu_trymap()
195 KASSERT(node->type == outtype, ("mapping fail")); in iort_smmu_trymap()
210 if (node->data.pci_rc.PciSegmentNumber != seg) in iort_pci_rc_map()
235 if (strstr(node->data.named_comp.DeviceName, devname) == NULL) in iort_named_comp_map()
269 struct iort_map_entry *mapping; in iort_copy_data() local
273 node_entry->MappingOffset); in iort_copy_data()
274 node->nentries = node_entry->MappingCount; in iort_copy_data()
275 node->usecount = 0; in iort_copy_data()
276 mapping = malloc(sizeof(*mapping) * node->nentries, M_DEVBUF, in iort_copy_data()
278 node->entries.mappings = mapping; in iort_copy_data()
279 for (i = 0; i < node->nentries; i++, mapping++, map_entry++) { in iort_copy_data()
280 mapping->base = map_entry->InputBase; in iort_copy_data()
285 mapping->end = map_entry->InputBase + map_entry->IdCount; in iort_copy_data()
286 mapping->outbase = map_entry->OutputBase; in iort_copy_data()
287 mapping->out_node_offset = map_entry->OutputReference; in iort_copy_data()
288 mapping->flags = map_entry->Flags; in iort_copy_data()
289 mapping->out_node = NULL; in iort_copy_data()
304 itsg_entry = (ACPI_IORT_ITS_GROUP *)node_entry->NodeData; in iort_copy_its()
305 node->nentries = itsg_entry->ItsCount; in iort_copy_its()
306 node->usecount = 0; in iort_copy_its()
307 its = malloc(sizeof(*its) * node->nentries, M_DEVBUF, M_WAITOK | M_ZERO); in iort_copy_its()
308 node->entries.its = its; in iort_copy_its()
309 id = &itsg_entry->Identifiers[0]; in iort_copy_its()
310 for (i = 0; i < node->nentries; i++, its++, id++) { in iort_copy_its()
311 its->its_id = *id; in iort_copy_its()
312 its->pxm = -1; in iort_copy_its()
313 its->xref = 0; in iort_copy_its()
330 node->type = node_entry->Type; in iort_add_nodes()
331 node->node_offset = node_offset; in iort_add_nodes()
332 node->revision = node_entry->Revision; in iort_add_nodes()
335 switch(node_entry->Type) { in iort_add_nodes()
337 pci_rc = (ACPI_IORT_ROOT_COMPLEX *)node_entry->NodeData; in iort_add_nodes()
338 memcpy(&node->data.pci_rc, pci_rc, sizeof(*pci_rc)); in iort_add_nodes()
343 smmu = (ACPI_IORT_SMMU *)node_entry->NodeData; in iort_add_nodes()
344 memcpy(&node->data.smmu, smmu, sizeof(*smmu)); in iort_add_nodes()
349 smmu_v3 = (ACPI_IORT_SMMU_V3 *)node_entry->NodeData; in iort_add_nodes()
350 memcpy(&node->data.smmu_v3, smmu_v3, sizeof(*smmu_v3)); in iort_add_nodes()
359 named_comp = (ACPI_IORT_NAMED_COMPONENT *)node_entry->NodeData; in iort_add_nodes()
360 memcpy(&node->data.named_comp, named_comp, sizeof(*named_comp)); in iort_add_nodes()
363 strncpy(node->data.named_comp.DeviceName, in iort_add_nodes()
364 named_comp->DeviceName, in iort_add_nodes()
365 sizeof(node->data.named_comp.DeviceName)); in iort_add_nodes()
366 node->data.named_comp.DeviceName[31] = 0; in iort_add_nodes()
373 node_entry->Type); in iort_add_nodes()
380 * For the mapping entry given, walk thru all the possible destination
391 if (entry->out_node_offset == np->node_offset) { in iort_resolve_node()
399 if (entry->out_node_offset == np->node_offset) { in iort_resolve_node()
406 node->usecount++; in iort_resolve_node()
407 entry->out_node = node; in iort_resolve_node()
409 printf("ACPI: IORT: Firmware Bug: no mapping for node %u\n", in iort_resolve_node()
410 entry->out_node_offset); in iort_resolve_node()
424 for (i = 0; i < node->nentries; i++) in iort_post_process_mappings()
425 iort_resolve_node(&node->entries.mappings[i], TRUE); in iort_post_process_mappings()
427 for (i = 0; i < node->nentries; i++) in iort_post_process_mappings()
428 iort_resolve_node(&node->entries.mappings[i], FALSE); in iort_post_process_mappings()
430 for (i = 0; i < node->nentries; i++) in iort_post_process_mappings()
431 iort_resolve_node(&node->entries.mappings[i], TRUE); in iort_post_process_mappings()
446 if (entry->Type != ACPI_MADT_TYPE_GENERIC_TRANSLATOR) in madt_resolve_its_xref()
453 its_entry = its_node->entries.its; in madt_resolve_its_xref()
454 for (i = 0; i < its_node->nentries; i++, its_entry++) { in madt_resolve_its_xref()
455 if (its_entry->its_id == gict->TranslationId) { in madt_resolve_its_xref()
456 its_entry->xref = xref; in madt_resolve_its_xref()
463 gict->TranslationId); in madt_resolve_its_xref()
478 if (entry->Type != ACPI_SRAT_TYPE_GIC_ITS_AFFINITY) in srat_resolve_its_pxm()
484 dom = acpi_map_pxm_to_vm_domainid(gicits->ProximityDomain); in srat_resolve_its_pxm()
488 * count of ProximityDomain values mapping to a domain ID in srat_resolve_its_pxm()
491 if (dom == -1) in srat_resolve_its_pxm()
494 gicits->ProximityDomain, gicits->ItsId); in srat_resolve_its_pxm()
496 /* use dom + 1 as index to handle the case where dom == -1 */ in srat_resolve_its_pxm()
500 if (dom != -1) in srat_resolve_its_pxm()
509 its_entry = its_node->entries.its; in srat_resolve_its_pxm()
510 for (i = 0; i < its_node->nentries; i++, its_entry++) { in srat_resolve_its_pxm()
511 if (its_entry->its_id == gicits->ItsId) { in srat_resolve_its_pxm()
512 its_entry->pxm = dom; in srat_resolve_its_pxm()
519 gicits->ItsId); in srat_resolve_its_pxm()
538 acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, in iort_post_process_its()
547 acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, in iort_post_process_its()
574 for (node_offset = iort->NodeOffset; in acpi_parse_iort()
575 node_offset < iort->Header.Length; in acpi_parse_iort()
576 node_offset += node_entry->Length) { in acpi_parse_iort()
588 * Provide ITS ID to PIC xref mapping.
598 its_entry = its_node->entries.its; in acpi_iort_its_lookup()
599 for (i = 0; i < its_node->nentries; i++, its_entry++) { in acpi_iort_its_lookup()
600 if (its_entry->its_id == its_id) { in acpi_iort_its_lookup()
601 *xref = its_entry->xref; in acpi_iort_its_lookup()
602 *pxm = its_entry->pxm; in acpi_iort_its_lookup()
611 * Find mapping for a PCIe device given segment and device ID
625 KASSERT(node->type == ACPI_IORT_NODE_ITS_GROUP, ("bad group")); in acpi_iort_map_pci_msi()
628 *xref = node->entries.its[0].xref; in acpi_iort_map_pci_msi()
643 KASSERT(node->type == ACPI_IORT_NODE_SMMU_V3, ("bad node")); in acpi_iort_map_pci_smmuv3()
645 smmu = (ACPI_IORT_SMMU_V3 *)&node->data.smmu_v3; in acpi_iort_map_pci_smmuv3()
646 *xref = smmu->BaseAddress; in acpi_iort_map_pci_smmuv3()
652 * Finds mapping for a named node given name and resource ID and returns the
667 KASSERT(node->type == ACPI_IORT_NODE_ITS_GROUP, ("bad group")); in acpi_iort_map_named_msi()
670 *xref = node->entries.its[0].xref; in acpi_iort_map_named_msi()
686 KASSERT(node->type == ACPI_IORT_NODE_SMMU_V3, ("bad node")); in acpi_iort_map_named_smmuv3()
688 smmu = (ACPI_IORT_SMMU_V3 *)&node->data.smmu_v3; in acpi_iort_map_named_smmuv3()
689 *xref = smmu->BaseAddress; in acpi_iort_map_named_smmuv3()