Linux ATA/IDE development
 help / color / mirror / Atom feed
* Re: [RFC][PATCH] libata: enable SATA disk fua detection on default
From: Michael Tokarev @ 2012-07-03 20:11 UTC (permalink / raw)
  To: Jeff Garzik, linux-kernel, linux-ide, linux-scsi, Zheng Liu
In-Reply-To: <20120703090441.GA4804@gmail.com>

On 03.07.2012 13:04, Zheng Liu wrote:
> Hi Jeff,
> 
> Sorry for bothering you.  Could you please review this patch, or give me
> some feedbacks.  If this patch can be applied, I can rebase it to the
> lastest version of mainline kernel.  Thank you.
[]
>> -int libata_fua = 0;
>> +int libata_fua = 1;

I guess it can be enabled after LOTS of testing of various drives out
there, which shows that no current drives have issues with FUA anymore,
and after building a black-list of devices which misbehave.  It is quite
a big project, I think.  But what it gives us in return?

(I've no idea if this is the right answer, speaking of myself only)

Thanks,

/mjt

^ permalink raw reply

* Re: [RFC][PATCH] libata: enable SATA disk fua detection on default
From: Zheng Liu @ 2012-07-03  9:04 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, linux-ide, linux-scsi, Zheng Liu
In-Reply-To: <1336447443-4685-1-git-send-email-wenqing.lz@taobao.com>

Hi Jeff,

Sorry for bothering you.  Could you please review this patch, or give me
some feedbacks.  If this patch can be applied, I can rebase it to the
lastest version of mainline kernel.  Thank you.

Regards,
Zheng

On Tue, May 08, 2012 at 11:24:03AM +0800, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> Currently, SATA disk fua detection is disabled on default because most of
> devices don't support this feature at that time.  With the development of
> technology, more and more SATA disks support this feature.  So now we can enable
> this detection on default.
> 
> Although fua detection is defined as a kernel module parameter, it is too hard
> to set its value because it must be loaded and set before system starts up.
> That needs to modify initrd file.  So it is inconvenient for administrator who
> needs to manage a huge number of servers.
> 
> CC: Jeff Garzik <jeff@garzik.org>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
>  drivers/ata/libata-core.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 23763a1..3627251 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -133,9 +133,9 @@ int atapi_passthru16 = 1;
>  module_param(atapi_passthru16, int, 0444);
>  MODULE_PARM_DESC(atapi_passthru16, "Enable ATA_16 passthru for ATAPI devices (0=off, 1=on [default])");
>  
> -int libata_fua = 0;
> +int libata_fua = 1;
>  module_param_named(fua, libata_fua, int, 0444);
> -MODULE_PARM_DESC(fua, "FUA support (0=off [default], 1=on)");
> +MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on [default])");
>  
>  static int ata_ignore_hpa;
>  module_param_named(ignore_hpa, ata_ignore_hpa, int, 0644);
> -- 
> 1.7.4.1
> 

^ permalink raw reply

* I'm sure u will like it
From: Charlsie Coachman @ 2012-07-03  0:43 UTC (permalink / raw)
  To: jahve@vip.cybercity.dk

Howdy, I am Charlsie. I really don't know u. 
I found your account right here, was impressed with it and here am I writing u. 
My boyfriend and I decided to let us part friends three weeks ago. 
That is why, I decided to try something new and who knows maybe to find it on this site. I didn't use to meet on websites but you really impressed me!  I am waiting for ur mail :)
Kiss you

^ permalink raw reply

* [Bug 30802] exception & eSATA hard link resets
From: bugzilla-daemon @ 2012-07-02 13:40 UTC (permalink / raw)
  To: linux-ide
In-Reply-To: <bug-30802-11633@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=30802


Alan <alan@lxorguk.ukuu.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alan@lxorguk.ukuu.org.uk
         Resolution|                            |DOCUMENTED




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply

* Your Funds Notification
From: Western Union, Malaysia @ 2012-07-01 12:29 UTC (permalink / raw)
  To: Recipients

Your funds payment notification.
Do send your Name, Address & Phone Number to;
Mrs Franca Lee
+6010 3770 946.

^ permalink raw reply

* [UTEXAS: SUSPECTED SPAM] Your Funds Notification
From: Western Union, Malaysia @ 2012-07-01 11:00 UTC (permalink / raw)
  To: Recipients

Your funds payment notification.
Do send your Name, Address & Phone Number to;
Mrs Franca Lee
+6010 3770 946.

^ permalink raw reply

* Re: [PATCH v6 00/11] SATA ZPODD support
From: Lin Ming @ 2012-06-29  3:20 UTC (permalink / raw)
  To: Jeff Garzik, Aaron Lu, Holger Macht, Matthew Garrett, Alan Cox,
	David Woodhouse, Dan Williams
  Cc: linux-kernel, linux-pm, linux-scsi, linux-ide, linux-acpi
In-Reply-To: <1340611992-41457-1-git-send-email-ming.m.lin@intel.com>

On Mon, Jun 25, 2012 at 4:13 PM, Lin Ming <ming.m.lin@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
> - fixed crash reported at https://lkml.org/lkml/2012/2/24/2 (Aaron Lu)
> - rename is_pci_ata to compat_pci_ata (Alan Cox)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] libsas, ipr: cleanup ata_host flags initialization via ata_host_init
From: Dan Williams @ 2012-06-28 21:46 UTC (permalink / raw)
  To: linux-scsi; +Cc: linux-ide, Hannes Reinecke, Brian King

libsas and ipr pass flags to ata_host_init that are meant for the port.

ata_host flags:
	ATA_HOST_SIMPLEX	= (1 << 0),	/* Host is simplex, one DMA channel per host only */
	ATA_HOST_STARTED	= (1 << 1),	/* Host started */
	ATA_HOST_PARALLEL_SCAN	= (1 << 2),	/* Ports on this host can be scanned in parallel */
	ATA_HOST_IGNORE_ATA	= (1 << 3),	/* Ignore ATA devices on this host. */

flags passed by libsas:
	ATA_FLAG_SATA		= (1 << 1),
	ATA_FLAG_PIO_DMA	= (1 << 7), /* PIO cmds via DMA */
	ATA_FLAG_NCQ		= (1 << 10), /* host supports NCQ */

The only one that aliases is ATA_HOST_STARTED which is a 'don't care' in
the libsas and ipr cases since ata_hosts from these sources are not
registered with libata.

Cc: Brian King <brking@us.ibm.com>
Reported-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/ata/libata-core.c     |    3 +--
 drivers/scsi/ipr.c            |    3 +--
 drivers/scsi/libsas/sas_ata.c |    5 +----
 include/linux/libata.h        |    3 +--
 4 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index da31691..6f1e459 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5970,12 +5970,11 @@ int ata_host_start(struct ata_host *host)
  */
 /* KILLME - the only user left is ipr */
 void ata_host_init(struct ata_host *host, struct device *dev,
-		   unsigned long flags, struct ata_port_operations *ops)
+		   struct ata_port_operations *ops)
 {
 	spin_lock_init(&host->lock);
 	mutex_init(&host->eh_mutex);
 	host->dev = dev;
-	host->flags = flags;
 	host->ops = ops;
 }
 
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 467dc38..dacc784 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -8775,8 +8775,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
 
 	ioa_cfg = (struct ipr_ioa_cfg *)host->hostdata;
 	memset(ioa_cfg, 0, sizeof(struct ipr_ioa_cfg));
-	ata_host_init(&ioa_cfg->ata_host, &pdev->dev,
-		      sata_port_info.flags, &ipr_sata_ops);
+	ata_host_init(&ioa_cfg->ata_host, &pdev->dev, &ipr_sata_ops);
 
 	ioa_cfg->ipr_chip = ipr_get_chip_info(dev_id);
 
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 4208e16..5d10e4d 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -580,10 +580,7 @@ int sas_ata_init(struct domain_device *found_dev)
 	struct ata_port *ap;
 	int rc;
 
-	ata_host_init(&found_dev->sata_dev.ata_host,
-		      ha->dev,
-		      sata_port_info.flags,
-		      &sas_sata_ops);
+	ata_host_init(&found_dev->sata_dev.ata_host, ha->dev, &sas_sata_ops);
 	ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host,
 				&sata_port_info,
 				shost);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index af467d3..baf9f82 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -990,8 +990,7 @@ extern int ata_host_activate(struct ata_host *host, int irq,
 			     irq_handler_t irq_handler, unsigned long irq_flags,
 			     struct scsi_host_template *sht);
 extern void ata_host_detach(struct ata_host *host);
-extern void ata_host_init(struct ata_host *, struct device *,
-			  unsigned long, struct ata_port_operations *);
+extern void ata_host_init(struct ata_host *, struct device *, struct ata_port_operations *);
 extern int ata_scsi_detect(struct scsi_host_template *sht);
 extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);


^ permalink raw reply related

* Re: Highpoint DC7280
From: Robert Hancock @ 2012-06-28  5:30 UTC (permalink / raw)
  To: Christian Brandt; +Cc: linux-ide
In-Reply-To: <4FEB345D.2070708@psi5.com>

On Wed, Jun 27, 2012 at 10:27 AM, Christian Brandt <brandtc@psi5.com> wrote:
> Sorry for the delay, I was sick for a couple of days.
>
> Am 19.06.2012 05:28, schrieb Robert Hancock:
>> What does lspci -vv show for that board?
>
>  Please see MIME attachment dc7280lspci-initialized.txt (for
> completeness, uninitialized the IRQ is 64 and MaxPayload is 128 bytes).
>
>> It looks like that driver contains a binary blob so who knows what it is
>> actually doing internally.
>
>  I am now done playing with ubuntu 12.04 and are going to dig a bit
> deeper in using debian and a vanilla kernel.

Well, it looks like it doesn't claim compatibility with anything
standard like AHCI. If it's just a pure HBA with no hardware RAID,
etc. then I'm not sure exactly why there seems to be so much code in
the driver?

^ permalink raw reply

* [PATCH 1/1] ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327) v2
From: Mark Nelson @ 2012-06-28  2:32 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Sergei Shtylyov, linux-ide, tj
In-Reply-To: <4FEAF1D5.9000505@mvista.com>

Like e65cc194f7628ecaa02462f22f42fb09b50dcd49 (ahci: Enable SB600 64bit
DMA on MSI K9A2 Platinum) and 3c4aa91f21f65b7b40bdfb015eacbcb8453ccae2
(ahci: Enable SB600 64bit DMA on Asus M3A), this patch enables 64bit DMA
for the AHCI SATA controller of another board that has the SB600
southbridge.

In this case though we're enabling 64bit DMA for another MSI motherboard,
the K9AGM2 or MS-7327. It is new enough that all of the BIOS releases
since the initial release (1.0 from 2007-02-09) work correctly with 64bit
DMA enabled.

Signed-off-by: Mark Nelson <mdnelson8@gmail.com>
---
v2 brings a more fleshed out commit message including the commit
summaries of the commits mentioned

  drivers/ata/ahci.c |   16 ++++++++++++++++
  1 file changed, 16 insertions(+)

Index: linux-2.6/drivers/ata/ahci.c
===================================================================
--- linux-2.6.orig/drivers/ata/ahci.c
+++ linux-2.6/drivers/ata/ahci.c
@@ -777,6 +777,22 @@ static bool ahci_sb600_enable_64bit(stru
  			},
  		},
  		/*
+		 * All BIOS versions for the MSI K9AGM2 (MS-7327) support
+		 * 64bit DMA.
+		 *
+		 * This board also had the typo mentioned above in the
+		 * Manufacturer DMI field (fixed in BIOS version 1.5), so
+		 * match on DMI_BOARD_VENDOR of "MICRO-STAR INTER" again.
+		 */
+		{
+			.ident = "MSI K9AGM2",
+			.matches = {
+				DMI_MATCH(DMI_BOARD_VENDOR,
+					  "MICRO-STAR INTER"),
+				DMI_MATCH(DMI_BOARD_NAME, "MS-7327"),
+			},
+		},
+		/*
  		 * All BIOS versions for the Asus M3A support 64bit DMA.
  		 * (all release versions from 0301 to 1206 were tested)
  		 */

^ permalink raw reply

* Hey! I think we met a couple months ago. Even if we did not we could talk a little, right?
From: Lawerence Sack @ 2012-06-28  1:16 UTC (permalink / raw)
  To: linux-ide@vger.kernel.org

Hi)))
My name is Lawerence and I randomly pick out people in order to find some interesting ones and get to know each other in what follows.
I suppose you are not afraid of such things. So, I'll be first. I'm rather communicative and open to people.
I am sure that everyone has something peculiar about himself. So what is special about u??)) What are ur interests?:)
I am sorry, I've got to go now but I rely on you. I hope you'll have some free time to write me an answer. Please do it...:)
Waiting for your answer!

^ permalink raw reply

* Re: Highpoint DC7280
From: Christian Brandt @ 2012-06-27 16:27 UTC (permalink / raw)
  To: Robert Hancock; +Cc: linux-ide
In-Reply-To: <4FDFF1C1.4060808@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

Sorry for the delay, I was sick for a couple of days.

Am 19.06.2012 05:28, schrieb Robert Hancock:
> What does lspci -vv show for that board?

 Please see MIME attachment dc7280lspci-initialized.txt (for
completeness, uninitialized the IRQ is 64 and MaxPayload is 128 bytes).

> It looks like that driver contains a binary blob so who knows what it is
> actually doing internally.

 I am now done playing with ubuntu 12.04 and are going to dig a bit
deeper in using debian and a vanilla kernel.

-- 
Christian Brandt

 life is short and in most cases it ends with death
 but my tombstone will carry the hiscore


[-- Attachment #2: dc7280lspci-initialized.txt --]
[-- Type: text/plain, Size: 3574 bytes --]

84:00.0 RAID bus controller: HighPoint Technologies, Inc. Device 7280 (rev 03)
        Subsystem: HighPoint Technologies, Inc. Device 0000
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 64
        Region 0: Memory at fbe40000 (64-bit, non-prefetchable) [size=128K]
        Region 2: Memory at fbe00000 (64-bit, non-prefetchable) [size=256K]
        Expansion ROM at fbe60000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
                Flags: PMEClk- DSI- D1+ D2- AuxCurrent=375mA PME(D0+,D1+,D2-,D3hot+,D3cold-)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [70] Express (v2) Endpoint, MSI 00
                DevCap: MaxPayload 4096 bytes, PhantFunc 0, Latency L0s <1us, L1 <8us
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
                        MaxPayload 128 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend-
                LnkCap: Port #0, Speed 5GT/s, Width x8, ASPM unknown, Latency L0 <512ns, L1 <64us
                        ClockPM- Surprise- LLActRep- BwNot-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 5GT/s, Width x8, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis+
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
                LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -6dB
        Capabilities: [100 v1] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
                AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
        Capabilities: [140 v1] Virtual Channel
                Caps:   LPEVC=0 RefClk=100ns PATEntryBits=1
                Arb:    Fixed- WRR32- WRR64- WRR128-
                Ctrl:   ArbSelect=Fixed
                Status: InProgress-
                VC0:    Caps:   PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
                        Arb:    Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
                        Ctrl:   Enable+ ID=0 ArbSelect=Fixed TC/VC=01
                        Status: NegoPending- InProgress-
        Kernel modules: dc7280


^ permalink raw reply

* Re: [PATCH 1/1] ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327)
From: Sergei Shtylyov @ 2012-06-27 11:43 UTC (permalink / raw)
  To: Mark Nelson; +Cc: Jeff Garzik, linux-ide, tj
In-Reply-To: <4FEAA8AE.8040807@gmail.com>

Hello.

On 27-06-2012 10:31, Mark Nelson wrote:

>>> Like e65cc194f7628ecaa02462f22f42fb09b50dcd49

>> Please also specify that commit's summary in parens.

> Very good point! Should I do a simple respin of this patch adding the commit
> summary, or just do it for future patches?

    That's up to the maintainer but I'd respin the patch...

> Thanks!
> Mark

>>> this patch enables 64bit DMA
>>> for the AHCI SATA controller of a board that has the SB600
>>> southbridge. In
>>> this case though we're enabling 64bit DMA for another MSI motherboard,
>>> the
>>> K9AGM2 or MS-7327. It is new enough that all of the BIOS releases since
>>> the initial release (1.0 from 2007-02-09) work correctly with 64bit
>>> DMA enabled.

>>> Signed-off-by: Mark Nelson <mdnelson8@gmail.com>

MBR, Sergei

^ permalink raw reply

* Re: [PATCH 1/1] ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327)
From: Mark Nelson @ 2012-06-27  6:31 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Jeff Garzik, linux-ide, tj
In-Reply-To: <4FE9937B.7080503@mvista.com>

On 26/06/12 20:48, Sergei Shtylyov wrote:
> Hello.
>
> On 26-06-2012 6:45, Mark Nelson wrote:
>
>> Like e65cc194f7628ecaa02462f22f42fb09b50dcd49
>
> Please also specify that commit's summary in parens.

Very good point! Should I do a simple respin of this patch adding the 
commit summary, or just do it for future patches?

Thanks!
Mark

>
>> this patch enables 64bit DMA
>> for the AHCI SATA controller of a board that has the SB600
>> southbridge. In
>> this case though we're enabling 64bit DMA for another MSI motherboard,
>> the
>> K9AGM2 or MS-7327. It is new enough that all of the BIOS releases since
>> the initial release (1.0 from 2007-02-09) work correctly with 64bit
>> DMA enabled.
>
>> Signed-off-by: Mark Nelson <mdnelson8@gmail.com>
>
> MBR, Sergei

^ permalink raw reply

* Re: [PATCH 1/1] ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327)
From: Sergei Shtylyov @ 2012-06-26 10:48 UTC (permalink / raw)
  To: Mark Nelson; +Cc: Jeff Garzik, linux-ide, tj
In-Reply-To: <4FE92267.60106@gmail.com>

Hello.

On 26-06-2012 6:45, Mark Nelson wrote:

> Like e65cc194f7628ecaa02462f22f42fb09b50dcd49

    Please also specify that commit's summary in parens.

> this patch enables 64bit DMA
> for the AHCI SATA controller of a board that has the SB600 southbridge. In
> this case though we're enabling 64bit DMA for another MSI motherboard, the
> K9AGM2 or MS-7327. It is new enough that all of the BIOS releases since
> the initial release (1.0 from 2007-02-09) work correctly with 64bit DMA enabled.

> Signed-off-by: Mark Nelson <mdnelson8@gmail.com>

MBR, Sergei

^ permalink raw reply

* [PATCH 1/1] ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327)
From: Mark Nelson @ 2012-06-26  2:45 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, tj

Like e65cc194f7628ecaa02462f22f42fb09b50dcd49 this patch enables 64bit DMA
for the AHCI SATA controller of a board that has the SB600 southbridge. In
this case though we're enabling 64bit DMA for another MSI motherboard, the
K9AGM2 or MS-7327. It is new enough that all of the BIOS releases since
the initial release (1.0 from 2007-02-09) work correctly with 64bit DMA 
enabled.

Signed-off-by: Mark Nelson <mdnelson8@gmail.com>
---
  drivers/ata/ahci.c |   16 ++++++++++++++++
  1 file changed, 16 insertions(+)

Index: linux-2.6/drivers/ata/ahci.c
===================================================================
--- linux-2.6.orig/drivers/ata/ahci.c
+++ linux-2.6/drivers/ata/ahci.c
@@ -777,6 +777,22 @@ static bool ahci_sb600_enable_64bit(stru
  			},
  		},
  		/*
+		 * All BIOS versions for the MSI K9AGM2 (MS-7327) support
+		 * 64bit DMA.
+		 *
+		 * This board also had the typo mentioned above in the
+		 * Manufacturer DMI field (fixed in BIOS version 1.5), so
+		 * match on DMI_BOARD_VENDOR of "MICRO-STAR INTER" again.
+		 */
+		{
+			.ident = "MSI K9AGM2",
+			.matches = {
+				DMI_MATCH(DMI_BOARD_VENDOR,
+					  "MICRO-STAR INTER"),
+				DMI_MATCH(DMI_BOARD_NAME, "MS-7327"),
+			},
+		},
+		/*
  		 * All BIOS versions for the Asus M3A support 64bit DMA.
  		 * (all release versions from 0301 to 1206 were tested)
  		 */

^ permalink raw reply

* [PATCH 0/1] ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327)
From: Mark Nelson @ 2012-06-26  2:45 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, tj

I've come across another motherboard that uses an SB600 southbridge so I
figured I'd run some tests to see if it worked correctly with 64bit DMA
enabled in the AHCI driver. And it does indeed work properly, so this patch
enables 64bit DMA on the MSI K9AGM2 (MS-7327).

Similar to my earlier patches that enabled 64bit DMA on the MSI K9A2
Platinum (e65cc194f7628ecaa02462f22f42fb09b50dcd49) and the Asus M3A
(3c4aa91f21f65b7b40bdfb015eacbcb8453ccae2) this patch matches on a Board
Product Name DMI field of "MS-7327" which stays constant across all BIOS
versions.

Testing was done in exactly the same way as it was for the other patches
(http://patchwork.ozlabs.org/patch/36881) - with 4GB RAM installed in the
machine (which had ~1GB remapped above the 4GB boundary) a large (~8GB)
file was copied and the checksums of the copy and original were compared.
To make sure that we were actually DMAing to a high enough address for the
copy the following simple patch was used:

---
  drivers/ata/libahci.c |    5 +++++
  1 file changed, 5 insertions(+)

Index: linux-2.6/drivers/ata/libahci.c
===================================================================
--- linux-2.6.orig/drivers/ata/libahci.c
+++ linux-2.6/drivers/ata/libahci.c
@@ -1395,6 +1395,11 @@ static unsigned int ahci_fill_sg(struct
  	for_each_sg(qc->sg, sg, qc->n_elem, si) {
  		dma_addr_t addr = sg_dma_address(sg);
  		u32 sg_len = sg_dma_len(sg);
+		static int cnt;
+
+		if (addr > 0xffffffffULL && !(cnt++ % 500))
+			printk("ahci: dma'ing to address 0x%llx\n",
+				(unsigned long long)addr);

  		ahci_sg[si].addr = cpu_to_le32(addr & 0xffffffff);
  		ahci_sg[si].addr_hi = cpu_to_le32((addr >> 16) >> 16);


For the testing I had an old enough CPU that I could flash to and test
all the BIOS releases going all the way back to 1.0. I ended up testing
7 BIOS releases from 1.0 to 1.6 (all those that MSI publicly released)
to make sure that there weren't any regressions lurking in there.

And all worked flawlessly. Thus this patch :)

Thanks!
Mark

^ permalink raw reply

* MAIL 26.06.2012
From: Mr. Richard Sun @ 2012-06-25 21:34 UTC (permalink / raw)
  To: Recipients

Mail From Sun.

I work with the hang seng Bank Hong Kong.I have a business proposition for you involving a trade in my bank which I know we will be of mutual benefit to both of us, If interested mail me at:ricadtang@ymail.com

Regards,
Richard Sun.

^ permalink raw reply

* Re: [PATCH v6 02/11] libata: bind the Linux device tree to the ACPI device tree
From: Dan Williams @ 2012-06-25 19:22 UTC (permalink / raw)
  To: Lin Ming
  Cc: Jeff Garzik, Aaron Lu, Holger Macht, Matthew Garrett, Alan Cox,
	David Woodhouse, linux-kernel, linux-pm, linux-scsi, linux-ide,
	linux-acpi
In-Reply-To: <1340611992-41457-3-git-send-email-ming.m.lin@intel.com>

On Mon, Jun 25, 2012 at 1:13 AM, Lin Ming <ming.m.lin@intel.com> wrote:
> From: Matthew Garrett <mjg@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@redhat.com>
> Signed-off-by: Holger Macht <holger@homac.de>
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

^ permalink raw reply

* ATENCIÓN ATENCIÓN
From: WEB ADMIN @ 2012-06-25 14:30 UTC (permalink / raw)


Su buzón ha superado su límite, su correo web se está ejecutando
actualmente el 99,7% de su límite de cuota del 100%. No se puede enviar o
recibir correo electrónico correctamente hasta que haya actualizado su
cuenta de correo web. Para actualizar su cuenta de correo web, haga clic
en el enlace de abajo y pegarlo en su navegador a la solicitud de
actualización.

http://www.bonaenovae.org/feedback/use/editor2/form1.html

Estamos sinceramente disculpas por cualquier inconveniente que esto pueda
causarle, tendemos a ofrecerle un mejor servicio.

Gracias por su cooperación.
Webmail actualización de equipo.


^ permalink raw reply

* CUENTA DE ADVERTENCIA
From: WEB ADMIN @ 2012-06-25 12:59 UTC (permalink / raw)


Su buzón ha superado su límite, su correo web se está ejecutando
actualmente el 99,7% de su límite de cuota del 100%. No se puede enviar o
recibir correo electrónico correctamente hasta que haya actualizado su
cuenta de correo web. Para actualizar su cuenta de correo web, haga clic
en el enlace de abajo y pegarlo en su navegador a la solicitud de
actualización.

HAGA CLIC AQUÍ: http://goo.gl/Ezg4z

Estamos sinceramente disculpas por cualquier inconveniente que esto pueda
causarle, tendemos a ofrecerle un mejor servicio.

Gracias por su cooperación.
Webmail actualización de equipo.


^ permalink raw reply

* [PATCH v6 00/11] SATA ZPODD support
From: Lin Ming @ 2012-06-25  8:13 UTC (permalink / raw)
  To: Jeff Garzik, Aaron Lu, Holger Macht, Matthew Garrett, Alan Cox,
	David Woodhouse, Dan Williams
  Cc: linux-kernel, linux-pm, linux-scsi, linux-ide, linux-acpi

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
- Split the ACPI D3Cold state support patches out
- Adds "Device Attention" bit check

v2:
https://lkml.org/lkml/2012/3/1/61
- _PR3 indicates D3Cold support
- move can_power_off flag to pm_subsys_data
- allow all combinations of power resource and device
- split patches into smaller ones to make review easy

v1:
https://lkml.org/lkml/2012/2/13/86

Aaron Lu (4):
      libata: tell scsi layer device supports runtime power off
      [SCSI] sr: check support for device busy class events
      [SCSI] sr: support zero power ODD
      [SCSI] sr: make sure ODD is in resumed state in block ioctl

Holger Macht (1):
      [SCSI]: add wrapper to access and set scsi_bus_type in struct acpi_bus_type

Lin Ming (4):
      libata-acpi: set acpi state for SATA port
      libata-acpi: add ata port runtime D3Cold support
      libata-acpi: register/unregister device to/from power resource
      libata: detect Device Attention support

Matthew Garrett (2):
      libata: bind the Linux device tree to the ACPI device tree
      libata: migrate ACPI code over to new bindings

 drivers/acpi/glue.c        |    4 +-
 drivers/acpi/power.c       |    2 +
 drivers/acpi/sleep.c       |    2 +
 drivers/ata/libata-acpi.c  |  410 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
 drivers/ata/libata-core.c  |   11 +--
 drivers/ata/libata-pmp.c   |    4 -
 drivers/ata/libata-scsi.c  |    3 +
 drivers/ata/libata.h       |   15 ++--
 drivers/ata/pata_acpi.c    |    4 +-
 drivers/scsi/scsi_lib.c    |   17 ++++
 drivers/scsi/sr.c          |  160 ++++++++++++++++++++++++++++++++++-
 drivers/scsi/sr.h          |    3 +
 include/linux/ata.h        |    1 +
 include/linux/cdrom.h      |   43 ++++++++++
 include/linux/libata.h     |    9 +-
 include/scsi/scsi.h        |   10 +++
 include/scsi/scsi_device.h |    2 +
 17 files changed, 560 insertions(+), 140 deletions(-)



^ permalink raw reply

* [PATCH v6 11/11] [SCSI] sr: make sure ODD is in resumed state in block ioctl
From: Lin Ming @ 2012-06-25  8:13 UTC (permalink / raw)
  To: Jeff Garzik, Aaron Lu, Holger Macht, Matthew Garrett, Alan Cox,
	David Woodhouse, Dan Williams
  Cc: linux-kernel, linux-pm, linux-scsi, linux-ide, linux-acpi
In-Reply-To: <1340611992-41457-1-git-send-email-ming.m.lin@intel.com>

From: Aaron Lu <aaron.lu@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@amd.com>
Signed-off-by: Lin Ming <ming.m.lin@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
@@ -654,6 +654,13 @@ 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);
 
 	/*
@@ -685,6 +692,8 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
 
 out:
 	mutex_unlock(&sr_mutex);
+	pm_runtime_mark_last_busy(&cd->device->sdev_gendev);
+	pm_runtime_put_autosuspend(&cd->device->sdev_gendev);
 	return ret;
 }
 
-- 
1.7.10

^ permalink raw reply related

* [PATCH v6 10/11] [SCSI] sr: support zero power ODD
From: Lin Ming @ 2012-06-25  8:13 UTC (permalink / raw)
  To: Jeff Garzik, Aaron Lu, Holger Macht, Matthew Garrett, Alan Cox,
	David Woodhouse, Dan Williams
  Cc: linux-kernel, linux-pm, linux-scsi, linux-ide, linux-acpi
In-Reply-To: <1340611992-41457-1-git-send-email-ming.m.lin@intel.com>

From: Aaron Lu <aaron.lu@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@amd.com>
Signed-off-by: Lin Ming <ming.m.lin@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
@@ -985,8 +985,10 @@ 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);
+	}
 }
 
 static void ata_acpi_add_pm_notifier(struct ata_device *dev)
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index abfefab..72488c2 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -46,6 +46,7 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <asm/uaccess.h>
+#include <linux/pm_runtime.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_dbg.h>
@@ -79,6 +80,8 @@ static DEFINE_MUTEX(sr_mutex);
 static int sr_probe(struct device *);
 static int sr_remove(struct device *);
 static int sr_done(struct scsi_cmnd *);
+static int sr_suspend(struct device *dev, pm_message_t msg);
+static int sr_resume(struct device *dev);
 
 static struct scsi_driver sr_template = {
 	.owner			= THIS_MODULE,
@@ -86,6 +89,8 @@ static struct scsi_driver sr_template = {
 		.name   	= "sr",
 		.probe		= sr_probe,
 		.remove		= sr_remove,
+		.suspend	= sr_suspend,
+		.resume		= sr_resume,
 	},
 	.done			= sr_done,
 };
@@ -167,6 +172,58 @@ static void scsi_cd_put(struct scsi_cd *cd)
 	mutex_unlock(&sr_ref_mutex);
 }
 
+static int sr_suspend(struct device *dev, pm_message_t msg)
+{
+	int poweroff;
+	struct scsi_sense_hdr sshdr;
+	struct scsi_cd *cd = dev_get_drvdata(dev);
+
+	/* no action for system suspend */
+	if (msg.event == PM_EVENT_SUSPEND)
+		return 0;
+
+	/* do another TUR to see if the ODD is still ready to be powered off */
+	scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr);
+
+	if (cd->cdi.mask & CDC_CLOSE_TRAY)
+		/* no media for caddy/slot type ODD */
+		poweroff = scsi_sense_valid(&sshdr) && sshdr.asc == 0x3a;
+	else
+		/* no media and door closed for tray type ODD */
+		poweroff = scsi_sense_valid(&sshdr) && sshdr.asc == 0x3a &&
+				sshdr.ascq == 0x01;
+
+	if (!poweroff) {
+		pm_runtime_get_noresume(dev);
+		atomic_set(&cd->suspend_count, 1);
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
+static int sr_resume(struct device *dev)
+{
+	struct scsi_cd *cd;
+	struct scsi_sense_hdr sshdr;
+
+	cd = dev_get_drvdata(dev);
+
+	/* get the disk ready */
+	scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr);
+
+	/* if user wakes up the ODD, eject the tray */
+	if (cd->device->wakeup_by_user) {
+		cd->device->wakeup_by_user = 0;
+		if (!(cd->cdi.mask & CDC_CLOSE_TRAY))
+			sr_tray_move(&cd->cdi, 1);
+	}
+
+	atomic_set(&cd->suspend_count, 1);
+
+	return 0;
+}
+
 static unsigned int sr_get_events(struct scsi_device *sdev)
 {
 	u8 buf[8];
@@ -201,6 +258,37 @@ static unsigned int sr_get_events(struct scsi_device *sdev)
 	return 0;
 }
 
+static int sr_unit_load_done(struct scsi_cd *cd)
+{
+	u8 buf[8];
+	u8 cmd[] = { GET_EVENT_STATUS_NOTIFICATION,
+		     1,			/* polled */
+		     0, 0,		/* reserved */
+		     1 << 6,		/* notification class: Device Busy */
+		     0, 0,		/* reserved */
+		     0, sizeof(buf),	/* allocation length */
+		     0,			/* control */
+	};
+	struct event_header *eh = (void *)buf;
+	struct device_busy_event_desc *desc = (void *)(buf + 4);
+	struct scsi_sense_hdr sshdr;
+	int result;
+
+	result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE, buf,
+			sizeof(buf), &sshdr, SR_TIMEOUT, MAX_RETRIES, NULL);
+
+	if (result || be16_to_cpu(eh->data_len) < sizeof(*desc))
+		return 0;
+
+	if (eh->nea || eh->notification_class != 0x6)
+		return 0;
+
+	if (desc->device_busy_event == 2 && desc->device_busy_status == 0)
+		return 1;
+	else
+		return 0;
+}
+
 /*
  * This function checks to see if the media has been changed or eject
  * button has been pressed.  It is possible that we have already
@@ -215,12 +303,21 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi,
 	bool last_present;
 	struct scsi_sense_hdr sshdr;
 	unsigned int events;
-	int ret;
+	int ret, poweroff;
 
 	/* no changer support */
 	if (CDSL_CURRENT != slot)
 		return 0;
 
+	if (pm_runtime_suspended(&cd->device->sdev_gendev))
+		return 0;
+
+	/* if the logical unit just finished loading/unloading, do a TUR */
+	if (cd->device->can_power_off && cd->dbml && sr_unit_load_done(cd)) {
+		events = 0;
+		goto do_tur;
+	}
+
 	events = sr_get_events(cd->device);
 	cd->get_event_changed |= events & DISK_EVENT_MEDIA_CHANGE;
 
@@ -270,6 +367,22 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi,
 		cd->tur_changed = true;
 	}
 
+	if (cd->device->can_power_off && !cd->media_present) {
+		if (cd->cdi.mask & CDC_CLOSE_TRAY)
+			poweroff = 1;
+		else
+			poweroff = sshdr.ascq == 0x01;
+		/*
+		 * This function might be called concurrently by a kernel
+		 * thread (in-kernel polling) and old versions of udisks,
+		 * to avoid put the device twice, an atomic operation is used.
+		 */
+		if (poweroff && atomic_add_unless(&cd->suspend_count, -1, 0)) {
+			pm_runtime_mark_last_busy(&cd->device->sdev_gendev);
+			pm_runtime_put_autosuspend(&cd->device->sdev_gendev);
+		}
+	}
+
 	if (cd->ignore_get_event)
 		return events;
 
@@ -704,6 +817,15 @@ static int sr_probe(struct device *dev)
 	blk_queue_prep_rq(sdev->request_queue, sr_prep_fn);
 	sr_vendor_init(cd);
 
+	/* zero power support */
+	if (sdev->can_power_off) {
+		check_dbml(cd);
+		/* default delay time is 3 minutes */
+		pm_runtime_set_autosuspend_delay(dev, 180 * 1000);
+		pm_runtime_use_autosuspend(dev);
+		atomic_set(&cd->suspend_count, 1);
+	}
+
 	disk->driverfs_dev = &sdev->sdev_gendev;
 	set_capacity(disk, cd->capacity);
 	disk->private_data = &cd->driver;
@@ -988,6 +1110,10 @@ static int sr_remove(struct device *dev)
 {
 	struct scsi_cd *cd = dev_get_drvdata(dev);
 
+	/* disable runtime pm and possibly resume the device */
+	if (!atomic_dec_and_test(&cd->suspend_count))
+		pm_runtime_get_sync(dev);
+
 	blk_queue_prep_rq(cd->device->request_queue, scsi_prep_fn);
 	del_gendisk(cd->disk);
 
diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h
index 7cc40ad..fd5c550 100644
--- a/drivers/scsi/sr.h
+++ b/drivers/scsi/sr.h
@@ -49,6 +49,8 @@ typedef struct scsi_cd {
 	bool get_event_changed:1;	/* changed according to GET_EVENT */
 	bool ignore_get_event:1;	/* GET_EVENT is unreliable, use TUR */
 
+	atomic_t suspend_count;	/* we should request autosuspend only once */
+
 	struct cdrom_device_info cdi;
 	/* We hold gendisk and scsi_device references on probe and use
 	 * the refs on this kref to decide when to release them */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 1237fac..65b9732 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -153,6 +153,7 @@ struct scsi_device {
 	unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
 	unsigned is_visible:1;	/* is the device visible in sysfs */
 	unsigned can_power_off:1; /* Device supports runtime power off */
+	unsigned wakeup_by_user:1;	/* user wakes up the ODD */
 
 	DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
 	struct list_head event_list;	/* asserted events */
-- 
1.7.10

^ permalink raw reply related

* [PATCH v6 09/11] [SCSI] sr: check support for device busy class events
From: Lin Ming @ 2012-06-25  8:13 UTC (permalink / raw)
  To: Jeff Garzik, Aaron Lu, Holger Macht, Matthew Garrett, Alan Cox,
	David Woodhouse, Dan Williams
  Cc: linux-kernel, linux-pm, linux-scsi, linux-ide, linux-acpi
In-Reply-To: <1340611992-41457-1-git-send-email-ming.m.lin@intel.com>

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

Signed-off-by: Aaron Lu <aaron.lu@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
@@ -101,6 +101,7 @@ 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 *);
 
@@ -728,6 +729,28 @@ 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;
+
+	init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ);
+	cgc.cmd[0] = GPCMD_GET_CONFIGURATION;
+	cgc.cmd[3] = CDF_RM;
+	cgc.cmd[8] = sizeof(buffer);
+	cgc.quiet = 1;
+
+	if (cd->cdi.ops->generic_packet(&cd->cdi, &cgc))
+		return;
+
+	rfd = (struct rm_feature_desc *)&buffer[sizeof(struct feature_header)];
+	if (be16_to_cpu(rfd->feature_code) != CDF_RM)
+		return;
+
+	if (rfd->dbml)
+		cd->dbml = 1;
+}
 
 static void get_sectorsize(struct scsi_cd *cd)
 {
diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h
index 37c8f6b..7cc40ad 100644
--- a/drivers/scsi/sr.h
+++ b/drivers/scsi/sr.h
@@ -41,6 +41,7 @@ typedef struct scsi_cd {
 	unsigned readcd_known:1;	/* drive supports READ_CD (0xbe) */
 	unsigned readcd_cdda:1;	/* reading audio data using READ_CD */
 	unsigned media_present:1;	/* media is present */
+	unsigned dbml:1;	/* generates device busy class events */
 
 	/* GET_EVENT spurious event handling, blk layer guarantees exclusion */
 	int tur_mismatch;		/* nr of get_event TUR mismatches */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index dfd7f18..25f305c 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -727,6 +727,7 @@ struct request_sense {
 /*
  * feature profile
  */
+#define CDF_RM		0x0003	/* "Removeable Medium" */
 #define CDF_RWRT	0x0020	/* "Random Writable" */
 #define CDF_HWDM	0x0024	/* "Hardware Defect Management" */
 #define CDF_MRW 	0x0028
@@ -739,6 +740,48 @@ struct request_sense {
 #define CDM_MRW_BGFORMAT_ACTIVE		2
 #define CDM_MRW_BGFORMAT_COMPLETE	3
 
+/* Removable medium feature descriptor */
+struct rm_feature_desc {
+	__be16 feature_code;
+#if defined(__BIG_ENDIAN_BITFIELD)
+	__u8 reserved1		: 2;
+	__u8 feature_version	: 4;
+	__u8 persistent		: 1;
+	__u8 curr		: 1;
+#elif defined(__LITTLE_ENDIAN_BITFIELD)
+	__u8 curr		: 1;
+	__u8 persistent		: 1;
+	__u8 feature_version	: 4;
+	__u8 reserved1		: 2;
+#endif
+	__u8 add_len;
+#if defined(__BIG_ENDIAN_BITFIELD)
+	__u8 mech_type		: 3;
+	__u8 load		: 1;
+	__u8 eject		: 1;
+	__u8 pvnt_jmpr		: 1;
+	__u8 dbml		: 1;
+	__u8 lock		: 1;
+#elif defined(__LITTLE_ENDIAN_BITFIELD)
+	__u8 lock		: 1;
+	__u8 dbml		: 1;
+	__u8 pvnt_jmpr		: 1;
+	__u8 eject		: 1;
+	__u8 load		: 1;
+	__u8 mech_type		: 3;
+#endif
+	__u8 reserved2;
+	__u8 reserved3;
+	__u8 reserved4;
+};
+
+struct device_busy_event_desc {
+	__u8 device_busy_event	: 4;
+	__u8 reserved1		: 4;
+	__u8 device_busy_status;
+	__u8 time;
+};
+
 /*
  * mrw address spaces
  */
-- 
1.7.10

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox