1 --- drivers/ata/libata-scsi.c 2011-02-07 06:04:07.000000000 +1100
2 +++ drivers/ata/libata-scsi.c 2011-02-26 19:13:01.147238442 +1100
3 @@ -1129,13 +1129,13 @@
4 /* configure max sectors */
5 blk_queue_max_hw_sectors(sdev->request_queue, dev->max_sectors);
7 + sdev->sector_size = ATA_SECT_SIZE;
9 if (dev->class == ATA_DEV_ATAPI) {
10 struct request_queue *q = sdev->request_queue;
13 - /* set the min alignment and padding */
14 - blk_queue_update_dma_alignment(sdev->request_queue,
15 - ATA_DMA_PAD_SZ - 1);
16 + /* set DMA padding */
17 blk_queue_update_dma_pad(sdev->request_queue,
20 @@ -1149,12 +1149,24 @@
22 blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
24 - /* ATA devices must be sector aligned */
25 - blk_queue_update_dma_alignment(sdev->request_queue,
27 sdev->manage_start_stop = 1;
31 + * ata_pio_sectors() expects buffer for each sector to not cross
32 + * page boundary. Enforce it by requiring buffers to be sector
33 + * aligned, which works iff sector_size is not larger than
34 + * PAGE_SIZE. ATAPI devices also need the alignment as
35 + * IDENTIFY_PACKET is executed as ATA_PROT_PIO.
37 + if (sdev->sector_size > PAGE_SIZE)
38 + ata_dev_printk(dev, KERN_WARNING,
39 + "sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
42 + blk_queue_update_dma_alignment(sdev->request_queue,
43 + sdev->sector_size - 1);
45 if (dev->flags & ATA_DFLAG_AN)
46 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);