Changeset View
Changeset View
Standalone View
Standalone View
head/sys/x86/iommu/intel_gas.c
Show First 20 Lines • Show All 364 Lines • ▼ Show 20 Lines | dmar_gas_lowermatch(struct dmar_gas_match_args *a, struct dmar_map_entry *entry) | ||||
if (child != NULL && entry->end < a->common->lowaddr && | if (child != NULL && entry->end < a->common->lowaddr && | ||||
dmar_gas_match_one(a, entry->end, child->first, | dmar_gas_match_one(a, entry->end, child->first, | ||||
a->common->lowaddr)) { | a->common->lowaddr)) { | ||||
dmar_gas_match_insert(a); | dmar_gas_match_insert(a); | ||||
return (0); | return (0); | ||||
} | } | ||||
if (entry->free_down < a->size + a->offset + DMAR_PAGE_SIZE) | if (entry->free_down < a->size + a->offset + DMAR_PAGE_SIZE) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
if (entry->first >= a->common->lowaddr) | |||||
return (ENOMEM); | |||||
child = RB_LEFT(entry, rb_entry); | child = RB_LEFT(entry, rb_entry); | ||||
if (child != NULL && 0 == dmar_gas_lowermatch(a, child)) | if (child != NULL && 0 == dmar_gas_lowermatch(a, child)) | ||||
return (0); | return (0); | ||||
if (child != NULL && child->last < a->common->lowaddr && | if (child != NULL && child->last < a->common->lowaddr && | ||||
dmar_gas_match_one(a, child->last, entry->start, | dmar_gas_match_one(a, child->last, entry->start, | ||||
a->common->lowaddr)) { | a->common->lowaddr)) { | ||||
dmar_gas_match_insert(a); | dmar_gas_match_insert(a); | ||||
return (0); | return (0); | ||||
} | } | ||||
child = RB_RIGHT(entry, rb_entry); | child = RB_RIGHT(entry, rb_entry); | ||||
if (child != NULL && 0 == dmar_gas_lowermatch(a, child)) | if (child != NULL && 0 == dmar_gas_lowermatch(a, child)) | ||||
return (0); | return (0); | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
static int | static int | ||||
dmar_gas_uppermatch(struct dmar_gas_match_args *a, struct dmar_map_entry *entry) | dmar_gas_uppermatch(struct dmar_gas_match_args *a, struct dmar_map_entry *entry) | ||||
{ | { | ||||
struct dmar_map_entry *child; | struct dmar_map_entry *child; | ||||
if (entry->free_down < a->size + a->offset + DMAR_PAGE_SIZE) | |||||
return (ENOMEM); | |||||
if (entry->last < a->common->highaddr) | if (entry->last < a->common->highaddr) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
child = RB_LEFT(entry, rb_entry); | child = RB_LEFT(entry, rb_entry); | ||||
if (child != NULL && 0 == dmar_gas_uppermatch(a, child)) | if (child != NULL && 0 == dmar_gas_uppermatch(a, child)) | ||||
return (0); | return (0); | ||||
if (child != NULL && child->last >= a->common->highaddr && | if (child != NULL && child->last >= a->common->highaddr && | ||||
dmar_gas_match_one(a, child->last, entry->start, | dmar_gas_match_one(a, child->last, entry->start, | ||||
a->domain->end)) { | a->domain->end)) { | ||||
▲ Show 20 Lines • Show All 284 Lines • Show Last 20 Lines |