From: Li Shaohua <shaohua.li@intel.com>
To: ACPI-DEV <acpi-devel@lists.sourceforge.net>,
lkml <linux-kernel@vger.kernel.org>
Cc: Len Brown <len.brown@intel.com>, Greg <greg@kroah.com>,
Patrick Mochel <mochel@digitalimplant.org>
Subject: [PATCH/RFC 4/4]An experimental implementation for IDE bus
Date: Mon, 08 Nov 2004 12:11:47 +0800 [thread overview]
Message-ID: <1099887081.1750.249.camel@sli10-desk.sh.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1948 bytes --]
Hi,
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.
Thanks,
Shaohua
---
2.6-root/drivers/ide/ide.c | 43
+++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+)
diff -puN drivers/ide/ide.c~ide-bind-acpi drivers/ide/ide.c
--- 2.6/drivers/ide/ide.c~ide-bind-acpi 2004-11-08 11:09:12.625009440
+0800
+++ 2.6-root/drivers/ide/ide.c 2004-11-08 11:10:04.477126720 +0800
@@ -2412,10 +2412,53 @@ EXPORT_SYMBOL(ide_fops);
EXPORT_SYMBOL(ide_lock);
+#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;
+
+ if (!parent_handle) {
+ printk("Can't find parent handle \n");
+ return -1;
+ }
+ /* Please ref to ACPI spec for syntax of _ADR */
+ sscanf(dev->bus_id, "%d", &i);
+ address = i;
+ dev->handle = acpi_get_child(parent_handle, address);
+
+#if 1
+ {/* For debug */
+ char name[80] = {'?','\0'};
+ struct acpi_buffer buffer = {sizeof(name), name};
+
+ printk("IDE device %d:", i);
+ if (dev->handle) {
+ acpi_get_name(dev->handle, ACPI_FULL_PATHNAME,
&buffer);
+ printk("%s", name);
+ }
+ printk("\n");
+ }
+#endif
+ return 0;
+}
+#else
+int generic_ide_platform_bind(struct device *dev)
+{
+ return 0;
+}
+#endif
struct bus_type ide_bus_type = {
.name = "ide",
.suspend = generic_ide_suspend,
.resume = generic_ide_resume,
+ .platform_bind = generic_ide_platform_bind,
};
/*
_
[-- Attachment #2: p00004_ide-bind-acpi.patch --]
[-- Type: text/x-patch, Size: 1925 bytes --]
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.
---
2.6-root/drivers/ide/ide.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+)
diff -puN drivers/ide/ide.c~ide-bind-acpi drivers/ide/ide.c
--- 2.6/drivers/ide/ide.c~ide-bind-acpi 2004-11-08 11:09:12.625009440 +0800
+++ 2.6-root/drivers/ide/ide.c 2004-11-08 11:10:04.477126720 +0800
@@ -2412,10 +2412,53 @@ EXPORT_SYMBOL(ide_fops);
EXPORT_SYMBOL(ide_lock);
+#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;
+
+ if (!parent_handle) {
+ printk("Can't find parent handle \n");
+ return -1;
+ }
+ /* Please ref to ACPI spec for syntax of _ADR */
+ sscanf(dev->bus_id, "%d", &i);
+ address = i;
+ dev->handle = acpi_get_child(parent_handle, address);
+
+#if 1
+ {/* For debug */
+ char name[80] = {'?','\0'};
+ struct acpi_buffer buffer = {sizeof(name), name};
+
+ printk("IDE device %d:", i);
+ if (dev->handle) {
+ acpi_get_name(dev->handle, ACPI_FULL_PATHNAME, &buffer);
+ printk("%s", name);
+ }
+ printk("\n");
+ }
+#endif
+ return 0;
+}
+#else
+int generic_ide_platform_bind(struct device *dev)
+{
+ return 0;
+}
+#endif
struct bus_type ide_bus_type = {
.name = "ide",
.suspend = generic_ide_suspend,
.resume = generic_ide_resume,
+ .platform_bind = generic_ide_platform_bind,
};
/*
_
next reply other threads:[~2004-11-08 4:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-08 4:11 Li Shaohua [this message]
2004-11-08 5:15 ` [ACPI] " Hiroshi 2 Itoh
2004-11-08 15:24 ` Matthew Wilcox
2004-11-09 5:35 ` /sys/firmware/acpi (Re: [ACPI] [PATCH/RFC 4/4]An experimental implementation for IDE bus) Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1099887081.1750.249.camel@sli10-desk.sh.intel.com \
--to=shaohua.li@intel.com \
--cc=acpi-devel@lists.sourceforge.net \
--cc=greg@kroah.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®