View | Details | Raw Unified | Return to bug 25055
Collapse All | Expand All

(-)a/drivers/ata/libata-scsi.c (-6 / +19 lines)
Lines 1104-1112 static int ata_scsi_dev_config(struct scsi_device *sdev, Link Here
1104
		struct request_queue *q = sdev->request_queue;
1104
		struct request_queue *q = sdev->request_queue;
1105
		void *buf;
1105
		void *buf;
1106
1106
1107
		/* set the min alignment and padding */
1107
		sdev->sector_size = ATA_SECT_SIZE;
1108
		blk_queue_update_dma_alignment(sdev->request_queue,
1108
1109
					       ATA_DMA_PAD_SZ - 1);
1109
		/* set DMA padding */
1110
		blk_queue_update_dma_pad(sdev->request_queue,
1110
		blk_queue_update_dma_pad(sdev->request_queue,
1111
					 ATA_DMA_PAD_SZ - 1);
1111
					 ATA_DMA_PAD_SZ - 1);
1112
1112
Lines 1120-1131 static int ata_scsi_dev_config(struct scsi_device *sdev, Link Here
1120
1120
1121
		blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
1121
		blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
1122
	} else {
1122
	} else {
1123
		/* ATA devices must be sector aligned */
1123
		sdev->sector_size = ata_id_logical_sector_size(dev->id);
1124
		blk_queue_update_dma_alignment(sdev->request_queue,
1125
					       ATA_SECT_SIZE - 1);
1126
		sdev->manage_start_stop = 1;
1124
		sdev->manage_start_stop = 1;
1127
	}
1125
	}
1128
1126
1127
	/*
1128
	 * ata_pio_sectors() expects buffer for each sector to not cross
1129
	 * page boundary.  Enforce it by requiring buffers to be sector
1130
	 * aligned, which works iff sector_size is not larger than
1131
	 * PAGE_SIZE.  ATAPI devices also need the alignment as
1132
	 * IDENTIFY_PACKET is executed as ATA_PROT_PIO.
1133
	 */
1134
	if (sdev->sector_size > PAGE_SIZE)
1135
		ata_dev_printk(dev, KERN_WARNING,
1136
			"sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
1137
			sdev->sector_size);
1138
1139
	blk_queue_update_dma_alignment(sdev->request_queue,
1140
				       sdev->sector_size - 1);
1141
1129
	if (dev->flags & ATA_DFLAG_AN)
1142
	if (dev->flags & ATA_DFLAG_AN)
1130
		set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
1143
		set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
1131
1144
(-)a/include/linux/ata.h (+13 lines)
Lines 89-94 enum { Link Here
89
	ATA_ID_SPG		= 98,
89
	ATA_ID_SPG		= 98,
90
	ATA_ID_LBA_CAPACITY_2	= 100,
90
	ATA_ID_LBA_CAPACITY_2	= 100,
91
	ATA_ID_SECTOR_SIZE	= 106,
91
	ATA_ID_SECTOR_SIZE	= 106,
92
	ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
92
	ATA_ID_LAST_LUN		= 126,
93
	ATA_ID_LAST_LUN		= 126,
93
	ATA_ID_DLF		= 128,
94
	ATA_ID_DLF		= 128,
94
	ATA_ID_CSFO		= 129,
95
	ATA_ID_CSFO		= 129,
Lines 640-645 static inline int ata_id_flush_ext_enabled(const u16 *id) Link Here
640
	return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400;
641
	return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400;
641
}
642
}
642
643
644
static inline u32 ata_id_logical_sector_size(const u16 *id)
645
{
646
	/* T13/1699-D Revision 6a, Sep 6, 2008. Page 128.
647
	 * IDENTIFY DEVICE data, word 117-118.
648
	 * 0xd000 ignores bit 13 (logical:physical > 1)
649
	 */
650
	if ((id[ATA_ID_SECTOR_SIZE] & 0xd000) == 0x5000)
651
		return (((id[ATA_ID_LOGICAL_SECTOR_SIZE+1] << 16)
652
					+ id[ATA_ID_LOGICAL_SECTOR_SIZE]) * sizeof(u16)) ;
653
	return ATA_SECT_SIZE;
654
}
655
643
static inline int ata_id_has_large_logical_sectors(const u16 *id)
656
static inline int ata_id_has_large_logical_sectors(const u16 *id)
644
{
657
{
645
	if ((id[ATA_ID_SECTOR_SIZE] & 0xc000) != 0x4000)
658
	if ((id[ATA_ID_SECTOR_SIZE] & 0xc000) != 0x4000)

Return to bug 25055