summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-11-15 11:32:19 +0000
committermav <mav@FreeBSD.org>2013-11-15 11:32:19 +0000
commitf6b2403684daa994b97bc94ce6995e4499405e08 (patch)
tree80c26341d15df3421b59a99822f45eb78c828163
parent616c9705f8244383b4b14b2156f0bef150837f6f (diff)
downloadFreeBSD-src-f6b2403684daa994b97bc94ce6995e4499405e08.zip
FreeBSD-src-f6b2403684daa994b97bc94ce6995e4499405e08.tar.gz
Handle case when ACPI reports HPET device, but does not provide memory
resource for it. In such case take the address range from the HPET table. This fixes hpet(4) driver attach on Asrock C2750D4I board.
-rw-r--r--sys/dev/acpica/acpi_hpet.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c
index be869ed..4d600f5 100644
--- a/sys/dev/acpica/acpi_hpet.c
+++ b/sys/dev/acpica/acpi_hpet.c
@@ -293,7 +293,7 @@ hpet_find(ACPI_HANDLE handle, UINT32 level, void *context,
return (AE_OK);
if (ACPI_FAILURE(acpi_GetInteger(handle, "_UID", &uid)) ||
id == uid)
- *((int *)status) = 1;
+ *status = acpi_get_device(handle);
return (AE_OK);
}
@@ -321,7 +321,7 @@ hpet_identify(driver_t *driver, device_t parent)
ACPI_TABLE_HPET *hpet;
ACPI_STATUS status;
device_t child;
- int i, found;
+ int i;
/* Only one HPET device can be added. */
if (devclass_get_device(hpet_devclass, 0))
@@ -332,12 +332,18 @@ hpet_identify(driver_t *driver, device_t parent)
if (ACPI_FAILURE(status))
return;
/* Search for HPET device with same ID. */
- found = 0;
+ child = NULL;
AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- 100, hpet_find, NULL, (void *)(uintptr_t)hpet->Sequence, (void *)&found);
+ 100, hpet_find, NULL, (void *)(uintptr_t)hpet->Sequence,
+ (void *)&child);
/* If found - let it be probed in normal way. */
- if (found)
+ if (child) {
+ if (bus_get_resource(child, SYS_RES_MEMORY, 0,
+ NULL, NULL) != 0)
+ bus_set_resource(child, SYS_RES_MEMORY, 0,
+ hpet->Address.Address, HPET_MEM_WIDTH);
continue;
+ }
/* If not - create it from table info. */
child = BUS_ADD_CHILD(parent, 2, "hpet", 0);
if (child == NULL) {
OpenPOWER on IntegriCloud