Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 00/11] SATA ZPODD support

Hi all,

This is the v6 patches to add SATA ZPODD support, to try it:
git pull git://git.kernel.org/pub/scm/linux/kernel/git/mlin/linux.git zpodd

Holger and Mathtew,
Patch 1 to Patch 3 are the libata acpi binding patches from you.
I removed dock related code from your original version.

v6:
- rebase to v3.5-rc4
- merge patch 4("libata: use correct PCI devices") with patch 2 (Dan Williams)
- makes ata_acpi_find_device mostly independent of the topology,
  gives some type safety, and drops some redundant work finding the ata_port
  (Dan Williams)

v5:
http://lkml.org/lkml/2012/6/18/62
- rebase to v3.5-rc3
- fixed crash reported at https://lkml.org/lkml/2012/2/24/2 (Aaron Lu)
- rename is_pci_ata to compat_pci_ata (Alan Cox)

v4:
https://lkml.org/lkml/2012/5/28/11
- Includes libata acpi binding patches from Holger Macht and Matthew Garrett.
- tell scsi layer device supports runtime power off
- check support for device busy class events

v3:
https://lkml.org/lkml/2012/3/28/20
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 03/11] libata: migrate ACPI code over to new bindings

From: Matthew Garrett <mjg <at> redhat.com>

Now that we have the ability to directly glue the ACPI namespace to the
driver model in libata, we don't need the custom code to handle the same
thing. Remove it and migrate the functions over to the new code.

Signed-off-by: Matthew Garrett <mjg <at> redhat.com>
Signed-off-by: Holger Macht <holger <at> homac.de>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/ata/libata-acpi.c |  161 ++++++++++-----------------------------------
 drivers/ata/libata-core.c |    3 -
 drivers/ata/libata-pmp.c  |    4 --
 drivers/ata/libata.h      |    5 --
 drivers/ata/pata_acpi.c   |    4 +-
 include/linux/libata.h    |    7 +-
 6 files changed, 40 insertions(+), 144 deletions(-)

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index b3025a7..c6f0101 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
 <at>  <at>  -47,7 +47,14  <at>  <at>  static void ata_acpi_clear_gtf(struct ata_device *dev)
 	dev->gtf_cache = NULL;
 }

-static acpi_handle ap_acpi_handle(struct ata_port *ap)
+/**
+ * ata_ap_acpi_handle - provide the acpi_handle for an ata_port
+ *  <at> ap: the acpi_handle returned will correspond to this port
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 02/11] libata: bind the Linux device tree to the ACPI device tree

From: Matthew Garrett <mjg <at> redhat.com>

Associate the ACPI device tree and libata devices.
This patch uses the generic ACPI glue framework to do so.

Signed-off-by: Matthew Garrett <mjg <at> redhat.com>
Signed-off-by: Holger Macht <holger <at> homac.de>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/acpi/glue.c       |    4 +-
 drivers/ata/libata-acpi.c |  137 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/ata/libata-core.c |    5 +-
 drivers/ata/libata.h      |    6 ++
 4 files changed, 148 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 1564e09..18d6812 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
 <at>  <at>  -39,6 +39,7  <at>  <at>  int register_acpi_bus_type(struct acpi_bus_type *type)
 	}
 	return -ENODEV;
 }
+EXPORT_SYMBOL(register_acpi_bus_type);

 int unregister_acpi_bus_type(struct acpi_bus_type *type)
 {
 <at>  <at>  -54,6 +55,7  <at>  <at>  int unregister_acpi_bus_type(struct acpi_bus_type *type)
 	}
 	return -ENODEV;
(Continue reading)

Dan Williams | 25 Jun 2012 21:22
Picon
Favicon

Re: [PATCH v6 02/11] libata: bind the Linux device tree to the ACPI device tree

On Mon, Jun 25, 2012 at 1:13 AM, Lin Ming <ming.m.lin <at> intel.com> wrote:
> From: Matthew Garrett <mjg <at> redhat.com>
>
> Associate the ACPI device tree and libata devices.
> This patch uses the generic ACPI glue framework to do so.
>
> Signed-off-by: Matthew Garrett <mjg <at> redhat.com>
> Signed-off-by: Holger Macht <holger <at> homac.de>
> Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>

Reviewed-by: Dan Williams <dan.j.williams <at> intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 11/11] [SCSI] sr: make sure ODD is in resumed state in block ioctl

From: Aaron Lu <aaron.lu <at> amd.com>

When application tries to access the ODD's block device by ioctl,
make sure ODD is in an active state.

Signed-off-by: Aaron Lu <aaron.lu <at> amd.com>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/scsi/sr.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 72488c2..3da0879 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
 <at>  <at>  -654,6 +654,13  <at>  <at>  static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
 	void __user *argp = (void __user *)arg;
 	int ret;

+	/* Make sure the ODD is not suspended */
+	ret = pm_runtime_get_sync(&sdev->sdev_gendev);
+	if (ret < 0) {
+		pm_runtime_put_noidle(&sdev->sdev_gendev);
+		return -EACCES;
+	}
+
 	mutex_lock(&sr_mutex);

 	/*
 <at>  <at>  -685,6 +692,8  <at>  <at>  static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 09/11] [SCSI] sr: check support for device busy class events

From: Aaron Lu <aaron.lu <at> amd.com>

Signed-off-by: Aaron Lu <aaron.lu <at> amd.com>
---
 drivers/scsi/sr.c     |   23 +++++++++++++++++++++++
 drivers/scsi/sr.h     |    1 +
 include/linux/cdrom.h |   43 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 5fc97d2..abfefab 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
 <at>  <at>  -101,6 +101,7  <at>  <at>  static DEFINE_MUTEX(sr_ref_mutex);
 static int sr_open(struct cdrom_device_info *, int);
 static void sr_release(struct cdrom_device_info *);

+static void check_dbml(struct scsi_cd *);
 static void get_sectorsize(struct scsi_cd *);
 static void get_capabilities(struct scsi_cd *);

 <at>  <at>  -728,6 +729,28  <at>  <at>  static int sr_probe(struct device *dev)
 	return error;
 }

+static void check_dbml(struct scsi_cd *cd)
+{
+	struct packet_command cgc;
+	unsigned char buffer[16];
+	struct rm_feature_desc *rfd;
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 10/11] [SCSI] sr: support zero power ODD

From: Aaron Lu <aaron.lu <at> amd.com>

If there is no media inside the ODD and the ODD's tray is closed, it's
safe to omit power. When user ejects the tray by pressing the button or
inserts a disc into the slot, the ODD will gets resumed from acpi
notifier handler.

Signed-off-by: Aaron Lu <aaron.lu <at> amd.com>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/ata/libata-acpi.c  |    4 +-
 drivers/scsi/sr.c          |  128 +++++++++++++++++++++++++++++++++++++++++++-
 drivers/scsi/sr.h          |    2 +
 include/scsi/scsi_device.h |    1 +
 4 files changed, 133 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index f1d6901..4112eaa 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
 <at>  <at>  -985,8 +985,10  <at>  <at>  static void ata_acpi_wake_dev(acpi_handle handle, u32 event, void *context)
 	struct ata_device *ata_dev = context;

 	if (event == ACPI_NOTIFY_DEVICE_WAKE && ata_dev &&
-			pm_runtime_suspended(&ata_dev->sdev->sdev_gendev))
+			pm_runtime_suspended(&ata_dev->sdev->sdev_gendev)) {
+		ata_dev->sdev->wakeup_by_user = 1;
 		scsi_autopm_get_device(ata_dev->sdev);
+	}
 }
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 08/11] libata: tell scsi layer device supports runtime power off

From: Aaron Lu <aaron.lu <at> amd.com>

If ATA device supports "Device Attention", then tell scsi layer that
the device supports runtime power off.

Signed-off-by: Aaron Lu <aaron.lu <at> amd.com>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/ata/libata-acpi.c  |   28 ++++++++++++++++++++++++++--
 include/scsi/scsi_device.h |    1 +
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index f36284e..f1d6901 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
 <at>  <at>  -1000,7 +1000,10  <at>  <at>  static void ata_acpi_add_pm_notifier(struct ata_device *dev)
 		return;

 	status = acpi_bus_get_device(handle, &acpi_dev);
-	if (ACPI_SUCCESS(status)) {
+	if (ACPI_FAILURE(status))
+		return;
+
+	if (dev->sdev->can_power_off) {
 		acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
 			ata_acpi_wake_dev, dev);
 		device_set_run_wake(&dev->sdev->sdev_gendev, true);
 <at>  <at>  -1018,7 +1021,10  <at>  <at>  static void ata_acpi_remove_pm_notifier(struct ata_device *dev)
 		return;
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 04/11] libata-acpi: set acpi state for SATA port

Currently, ata_acpi_set_state() only sets acpi sate for IDE port.
Remove this limitation.

Acked-by: Aaron Lu <aaron.lu <at> amd.com>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/ata/libata-acpi.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index c6f0101..bb20fd5 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
 <at>  <at>  -852,23 +852,25  <at>  <at>  void ata_acpi_on_resume(struct ata_port *ap)
 void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
 {
 	struct ata_device *dev;
-
-	if (!ata_ap_acpi_handle(ap) || (ap->flags & ATA_FLAG_ACPI_SATA))
-		return;
+	acpi_handle handle;

 	/* channel first and then drives for power on and vica versa
 	   for power off */
-	if (state.event == PM_EVENT_ON)
-		acpi_bus_set_power(ata_ap_acpi_handle(ap), ACPI_STATE_D0);
+	handle = ata_ap_acpi_handle(ap);
+	if (handle && state.event == PM_EVENT_ON)
+		acpi_bus_set_power(handle, ACPI_STATE_D0);

(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 07/11] libata: detect Device Attention support

Add a new flag ATA_DFLAG_DA to indicate that device supports "Device
Attention".

Acked-by: Aaron Lu <aaron.lu <at> amd.com>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/ata/libata-core.c |    3 +++
 include/linux/ata.h       |    1 +
 include/linux/libata.h    |    2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 7705191..c14f88c 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
 <at>  <at>  -2374,6 +2374,9  <at>  <at>  int ata_dev_configure(struct ata_device *dev)
 			dma_dir_string = ", DMADIR";
 		}

+		if (ata_id_has_da(dev->id))
+			dev->flags |= ATA_DFLAG_DA;
+
 		/* print device info to dmesg */
 		if (ata_msg_drv(ap) && print_info)
 			ata_dev_info(dev,
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 32df2b6..5713d3a 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
 <at>  <at>  -578,6 +578,7  <at>  <at>  static inline int ata_is_data(u8 prot)
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 05/11] libata-acpi: add ata port runtime D3Cold support

ATA port may support runtime D3Cold state, for example, Zero-power ODD case.
This patch adds wakeup notifier and enable/disable run_wake during
supend/resume.

Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/acpi/sleep.c      |    2 ++
 drivers/ata/libata-acpi.c |   78 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/ata/libata-scsi.c |    3 ++
 drivers/ata/libata.h      |    4 +++
 4 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 8856102..1784cb3 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
 <at>  <at>  -795,6 +795,7  <at>  <at>  int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
 		*d_min_p = d_min;
 	return d_max;
 }
+EXPORT_SYMBOL(acpi_pm_device_sleep_state);
 #endif /* CONFIG_PM */

 #ifdef CONFIG_PM_SLEEP
 <at>  <at>  -831,6 +832,7  <at>  <at>  int acpi_pm_device_run_wake(struct device *phys_dev, bool enable)

 	return 0;
 }
+EXPORT_SYMBOL(acpi_pm_device_run_wake);

(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 06/11] libata-acpi: register/unregister device to/from power resource

Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/acpi/power.c      |    2 ++
 drivers/ata/libata-acpi.c |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index dd6d6a3..eb640874 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
 <at>  <at>  -390,6 +390,7  <at>  <at>  void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handl
 		__acpi_power_resource_unregister_device(dev,
 			list->handles[i]);
 }
+EXPORT_SYMBOL_GPL(acpi_power_resource_unregister_device);

 static int __acpi_power_resource_register_device(
 	struct acpi_power_managed_device *powered_device, acpi_handle handle)
 <at>  <at>  -460,6 +461,7  <at>  <at>  int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
 	printk(KERN_WARNING PREFIX "Invalid Power Resource to register!");
 	return -ENODEV;
 }
+EXPORT_SYMBOL_GPL(acpi_power_resource_register_device);

 /**
  * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index e01807a..f36284e 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
(Continue reading)

Lin Ming | 25 Jun 2012 10:13
Picon
Favicon

[PATCH v6 01/11] [SCSI]: add wrapper to access and set scsi_bus_type in struct acpi_bus_type

From: Holger Macht <holger <at> homac.de>

For being able to bind ata devices against acpi devices, scsi_bus_type
needs to be set as bus in struct acpi_bus_type. So add wrapper to
scsi_lib to accomplish that.

Signed-off-by: Holger Macht <holger <at> homac.de>
Signed-off-by: Lin Ming <ming.m.lin <at> intel.com>
---
 drivers/scsi/scsi_lib.c |   17 +++++++++++++++++
 include/scsi/scsi.h     |   10 ++++++++++
 2 files changed, 27 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6dfb978..08f1e29 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
 <at>  <at>  -68,6 +68,23  <at>  <at>  static struct scsi_host_sg_pool scsi_sg_pools[] = {

 struct kmem_cache *scsi_sdb_cache;

+#ifdef CONFIG_ACPI
+#include <acpi/acpi_bus.h>
+
+int scsi_register_acpi_bus_type(struct acpi_bus_type *bus)
+{
+        bus->bus = &scsi_bus_type;
+        return register_acpi_bus_type(bus);
+}
+EXPORT_SYMBOL_GPL(scsi_register_acpi_bus_type);
(Continue reading)

Lin Ming | 29 Jun 2012 05:20
Picon
Favicon

Re: [PATCH v6 00/11] SATA ZPODD support

On Mon, Jun 25, 2012 at 4:13 PM, Lin Ming <ming.m.lin <at> intel.com> wrote:
> Hi all,
>
> This is the v6 patches to add SATA ZPODD support, to try it:
> git pull git://git.kernel.org/pub/scm/linux/kernel/git/mlin/linux.git zpodd
>
> Holger and Mathtew,
> Patch 1 to Patch 3 are the libata acpi binding patches from you.
> I removed dock related code from your original version.
>
> v6:
> - rebase to v3.5-rc4
> - merge patch 4("libata: use correct PCI devices") with patch 2 (Dan Williams)
> - makes ata_acpi_find_device mostly independent of the topology,
>  gives some type safety, and drops some redundant work finding the ata_port
>  (Dan Williams)

Hi Jeff,

Dan has reviewed the changes.

Would you like to apply these v6 patches?

Thanks,
Lin Ming

>
> v5:
> http://lkml.org/lkml/2012/6/18/62
> - rebase to v3.5-rc3
(Continue reading)


Gmane