summaryrefslogtreecommitdiff
path: root/libre/kernel26-libre-lts/libata-alignment.patch
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-03-11 23:13:44 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-03-11 23:13:44 -0300
commit6b53bd25965ed6835729ad138e63373102c464d0 (patch)
tree4afe75b23532d0094776f6199289b0ba473b49b1 /libre/kernel26-libre-lts/libata-alignment.patch
parent1217867fd1dde6985a5570a1506b0491a7c48bb1 (diff)
parent8a4b20277c75c32997797e122bd5237de20dd3e4 (diff)
downloadabslibre-6b53bd25965ed6835729ad138e63373102c464d0.tar.gz
abslibre-6b53bd25965ed6835729ad138e63373102c464d0.tar.bz2
abslibre-6b53bd25965ed6835729ad138e63373102c464d0.zip
Merge branch 'master' of ssh://vparabola/srv/git/projects/abslibre
Diffstat (limited to 'libre/kernel26-libre-lts/libata-alignment.patch')
-rw-r--r--libre/kernel26-libre-lts/libata-alignment.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/libre/kernel26-libre-lts/libata-alignment.patch b/libre/kernel26-libre-lts/libata-alignment.patch
new file mode 100644
index 000000000..edd96f3b1
--- /dev/null
+++ b/libre/kernel26-libre-lts/libata-alignment.patch
@@ -0,0 +1,48 @@
+diff -Nur linux-2.6.32.orig/drivers/ata/libata-scsi.c linux-2.6.32/drivers/ata/libata-scsi.c
+--- linux-2.6.32.orig/drivers/ata/libata-scsi.c 2009-12-03 14:51:21.000000000 +1100
++++ linux-2.6.32/drivers/ata/libata-scsi.c 2011-01-22 20:32:53.353775375 +1100
+@@ -1099,13 +1099,13 @@
+ /* configure max sectors */
+ blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
+
++ sdev->sector_size = ATA_SECT_SIZE;
++
+ if (dev->class == ATA_DEV_ATAPI) {
+ struct request_queue *q = sdev->request_queue;
+ void *buf;
+
+- /* set the min alignment and padding */
+- blk_queue_update_dma_alignment(sdev->request_queue,
+- ATA_DMA_PAD_SZ - 1);
++ /* set DMA padding */
+ blk_queue_update_dma_pad(sdev->request_queue,
+ ATA_DMA_PAD_SZ - 1);
+
+@@ -1119,12 +1119,24 @@
+
+ blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
+ } else {
+- /* ATA devices must be sector aligned */
+- blk_queue_update_dma_alignment(sdev->request_queue,
+- ATA_SECT_SIZE - 1);
+ sdev->manage_start_stop = 1;
+ }
+
++ /*
++ * ata_pio_sectors() expects buffer for each sector to not cross
++ * page boundary. Enforce it by requiring buffers to be sector
++ * aligned, which works iff sector_size is not larger than
++ * PAGE_SIZE. ATAPI devices also need the alignment as
++ * IDENTIFY_PACKET is executed as ATA_PROT_PIO.
++ */
++ if (sdev->sector_size > PAGE_SIZE)
++ ata_dev_printk(dev, KERN_WARNING,
++ "sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
++ sdev->sector_size);
++
++ blk_queue_update_dma_alignment(sdev->request_queue,
++ sdev->sector_size - 1);
++
+ if (dev->flags & ATA_DFLAG_AN)
+ set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
+