Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpica/acpi.c
Show First 20 Lines • Show All 1,194 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Wire device unit numbers based on resource matches in hints. | * Wire device unit numbers based on resource matches in hints. | ||||
*/ | */ | ||||
static void | static void | ||||
acpi_hint_device_unit(device_t acdev, device_t child, const char *name, | acpi_hint_device_unit(device_t acdev, device_t child, const char *name, | ||||
int *unitp) | int *unitp) | ||||
{ | { | ||||
device_location_cache_t *cache; | |||||
const char *s; | const char *s; | ||||
int line, unit; | int line, unit; | ||||
bool matches; | bool matches; | ||||
/* | /* | ||||
* Iterate over all the hints for the devices with the specified | * Iterate over all the hints for the devices with the specified | ||||
* name to see if one's resources are a subset of this device. | * name to see if one's resources are a subset of this device. | ||||
*/ | */ | ||||
line = 0; | line = 0; | ||||
cache = dev_wired_cache_init(); | |||||
while (resource_find_dev(&line, name, &unit, "at", NULL) == 0) { | while (resource_find_dev(&line, name, &unit, "at", NULL) == 0) { | ||||
/* Must have an "at" for acpi or isa. */ | /* Must have an "at" for acpi or isa. */ | ||||
resource_string_value(name, unit, "at", &s); | resource_string_value(name, unit, "at", &s); | ||||
matches = false; | matches = false; | ||||
if (strcmp(s, "acpi0") == 0 || strcmp(s, "acpi") == 0 || | if (strcmp(s, "acpi0") == 0 || strcmp(s, "acpi") == 0 || | ||||
strcmp(s, "isa0") == 0 || strcmp(s, "isa") == 0) | strcmp(s, "isa0") == 0 || strcmp(s, "isa") == 0) | ||||
matches = acpi_hint_device_matches_resources(child, name, unit); | matches = acpi_hint_device_matches_resources(child, name, unit); | ||||
else | |||||
matches = dev_wired_cache_match(cache, child, s); | |||||
if (matches) { | if (matches) { | ||||
/* We have a winner! */ | /* We have a winner! */ | ||||
*unitp = unit; | *unitp = unit; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
dev_wired_cache_fini(cache); | |||||
} | } | ||||
/* | /* | ||||
* Fetch the NUMA domain for a device by mapping the value returned by | * Fetch the NUMA domain for a device by mapping the value returned by | ||||
* _PXM to a NUMA domain. If the device does not have a _PXM method, | * _PXM to a NUMA domain. If the device does not have a _PXM method, | ||||
* -2 is returned. If any other error occurs, -1 is returned. | * -2 is returned. If any other error occurs, -1 is returned. | ||||
*/ | */ | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 3,382 Lines • Show Last 20 Lines |