提交 07cb52ff 编写于 作者: D David Woodhouse

iommu/vt-d: Allocate space for ACPI devices

Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
上级 e625b4a9
...@@ -84,7 +84,8 @@ void *dmar_alloc_dev_scope(void *start, void *end, int *cnt) ...@@ -84,7 +84,8 @@ void *dmar_alloc_dev_scope(void *start, void *end, int *cnt)
*cnt = 0; *cnt = 0;
while (start < end) { while (start < end) {
scope = start; scope = start;
if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_ENDPOINT || if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_ACPI ||
scope->entry_type == ACPI_DMAR_SCOPE_TYPE_ENDPOINT ||
scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE) scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE)
(*cnt)++; (*cnt)++;
else if (scope->entry_type != ACPI_DMAR_SCOPE_TYPE_IOAPIC && else if (scope->entry_type != ACPI_DMAR_SCOPE_TYPE_IOAPIC &&
...@@ -342,7 +343,6 @@ dmar_parse_one_drhd(struct acpi_dmar_header *header) ...@@ -342,7 +343,6 @@ dmar_parse_one_drhd(struct acpi_dmar_header *header)
dmaru->reg_base_addr = drhd->address; dmaru->reg_base_addr = drhd->address;
dmaru->segment = drhd->segment; dmaru->segment = drhd->segment;
dmaru->include_all = drhd->flags & 0x1; /* BIT0: INCLUDE_ALL */ dmaru->include_all = drhd->flags & 0x1; /* BIT0: INCLUDE_ALL */
if (!dmaru->include_all) {
dmaru->devices = dmar_alloc_dev_scope((void *)(drhd + 1), dmaru->devices = dmar_alloc_dev_scope((void *)(drhd + 1),
((void *)drhd) + drhd->header.length, ((void *)drhd) + drhd->header.length,
&dmaru->devices_cnt); &dmaru->devices_cnt);
...@@ -350,11 +350,9 @@ dmar_parse_one_drhd(struct acpi_dmar_header *header) ...@@ -350,11 +350,9 @@ dmar_parse_one_drhd(struct acpi_dmar_header *header)
kfree(dmaru); kfree(dmaru);
return -ENOMEM; return -ENOMEM;
} }
}
ret = alloc_iommu(dmaru); ret = alloc_iommu(dmaru);
if (ret) { if (ret) {
if (!dmaru->include_all)
dmar_free_dev_scope(&dmaru->devices, dmar_free_dev_scope(&dmaru->devices,
&dmaru->devices_cnt); &dmaru->devices_cnt);
kfree(dmaru); kfree(dmaru);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册