From 885128efdc64b63c52985985b6048c75fa61de2c Mon Sep 17 00:00:00 2001 From: Nate Lawson Date: Mon, 30 Aug 2004 21:35:34 +0000 Subject: [PATCH] Fix _FDI drive type probing. The new fd child is not an ACPI device while the old one is. Hence we need to evaluate the old one for _FDI since it has a valid ACPI_HANDLE ivar. This is a minimal fix. Make a note that a more complete one is to make fdc support the ACPI_HANDLE ivar for its children. This and the previous change are MT5 candidates. --- sys/dev/fdc/fdc_acpi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dev/fdc/fdc_acpi.c b/sys/dev/fdc/fdc_acpi.c index 0ee234cce35b..9c0377812b5e 100644 --- a/sys/dev/fdc/fdc_acpi.c +++ b/sys/dev/fdc/fdc_acpi.c @@ -217,7 +217,7 @@ static ACPI_STATUS fdc_acpi_probe_child(ACPI_HANDLE h, device_t *dev, int level, void *arg) { struct fdc_walk_ctx *ctx; - device_t child; + device_t child, old_child; ACPI_BUFFER buf; ACPI_OBJECT *pkg, *obj; ACPI_STATUS status; @@ -241,6 +241,7 @@ fdc_acpi_probe_child(ACPI_HANDLE h, device_t *dev, int level, void *arg) child = fdc_add_child(ctx->dev, "fd", ctx->index); if (child == NULL) goto out; + old_child = *dev; *dev = child; /* Get temporary buffer for _FDI probe. */ @@ -249,8 +250,14 @@ fdc_acpi_probe_child(ACPI_HANDLE h, device_t *dev, int level, void *arg) if (buf.Pointer == NULL) goto out; - /* Evaluate _FDI to get drive type to pass to the child. */ - status = ACPI_EVALUATE_OBJECT(ctx->acpi_dev, *dev, "_FDI", NULL, &buf); + /* + * Evaluate _FDI to get drive type to pass to the child. We use the + * old child here since it has a valid ACPI_HANDLE since it is a + * child of acpi. A better way to implement this would be to make fdc + * support the ACPI handle ivar for its children. + */ + status = ACPI_EVALUATE_OBJECT(ctx->acpi_dev, old_child, "_FDI", NULL, + &buf); if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) device_printf(ctx->dev, "_FDI failed - %#x\n", status);