Re: [ACPI] [PATCH/RFC 4/4]An experimental implementation for IDE bus

From: Matthew Wilcox
Date: Mon Nov 08 2004 - 11:57:45 EST


On Mon, Nov 08, 2004 at 12:11:47PM +0800, Li Shaohua wrote:
> A sample patch to bind IDE devices. I'm not familar with IDE driver, so
> the patch possibly is completely wrong, though it can show correct ACPI
> path in my laptop. This test case just shows the framework works, please
> don't apply it.

> +#ifdef CONFIG_ACPI
> +#include <linux/acpi.h>
> +int generic_ide_platform_bind(struct device *dev)
> +{
> + acpi_handle parent_handle = NULL;
> + acpi_integer address;
> + int i;
> +
> + /* Seems dev->parent->parent is the PCI IDE controller */
> + if (dev->parent && dev->parent->parent)
> + parent_handle = dev->parent->parent->handle;

An IDE struct device is the gendev embedded in the ide_drive_t. Its parent
is the ide_hwif_t, and its parent is the PCI device (or maybe SBUS
or whatever). You can see this in /sys:

$ ls /sys/devices/pci0000:00/0000:00:1f.1/ide0/0.0
block detach_state power

The '0.0' is the device with an ide_bus_type. ide0 is the hwif.
0000:00:1f.1 is a pci_dev. Or in ACPI terms, ACPI/_SB/PCI0/IDEC
is ide0 and ACPI/_SB/PCI0/IDEC/PRID is 0.0

At least, I think that's the mapping. Are we ever going to do anything
with /sys/firmware/acpi/namespace/ or will it just stay around consuming
inodes and dentries for no good reason?

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/