diff options
author | Tejun Heo <htejun@gmail.com> | 2006-05-15 08:03:48 -0400 |
---|---|---|
committer | Tejun Heo <htejun@gmail.com> | 2006-05-15 08:03:48 -0400 |
commit | a6e6ce8e8dc907a2cf2b994b0ea4099423f046bf (patch) | |
tree | cc308c45c0d2df9e52be69959b9fd189371ad5d7 /drivers/scsi/libata-core.c | |
parent | e8ee84518c159a663c07bf691ace187527380f61 (diff) |
[PATCH] libata-ncq: implement NCQ device configuration
Now that all NCQ related stuff are in place, implement NCQ device
configuration and bump ATA_MAX_QUEUE to 32 thus activating NCQ
support.
Original implementation is from Jens Axboe.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 14ffb5264b6..9051b6821c1 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1251,6 +1251,28 @@ static inline u8 ata_dev_knobble(struct ata_device *dev) | |||
1251 | return ((dev->ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); | 1251 | return ((dev->ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | static void ata_dev_config_ncq(struct ata_device *dev, | ||
1255 | char *desc, size_t desc_sz) | ||
1256 | { | ||
1257 | struct ata_port *ap = dev->ap; | ||
1258 | int hdepth = 0, ddepth = ata_id_queue_depth(dev->id); | ||
1259 | |||
1260 | if (!ata_id_has_ncq(dev->id)) { | ||
1261 | desc[0] = '\0'; | ||
1262 | return; | ||
1263 | } | ||
1264 | |||
1265 | if (ap->flags & ATA_FLAG_NCQ) { | ||
1266 | hdepth = min(ap->host->can_queue, ATA_MAX_QUEUE - 1); | ||
1267 | dev->flags |= ATA_DFLAG_NCQ; | ||
1268 | } | ||
1269 | |||
1270 | if (hdepth >= ddepth) | ||
1271 | snprintf(desc, desc_sz, "NCQ (depth %d)", ddepth); | ||
1272 | else | ||
1273 | snprintf(desc, desc_sz, "NCQ (depth %d/%d)", hdepth, ddepth); | ||
1274 | } | ||
1275 | |||
1254 | /** | 1276 | /** |
1255 | * ata_dev_configure - Configure the specified ATA/ATAPI device | 1277 | * ata_dev_configure - Configure the specified ATA/ATAPI device |
1256 | * @dev: Target device to configure | 1278 | * @dev: Target device to configure |
@@ -1311,6 +1333,7 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1311 | 1333 | ||
1312 | if (ata_id_has_lba(id)) { | 1334 | if (ata_id_has_lba(id)) { |
1313 | const char *lba_desc; | 1335 | const char *lba_desc; |
1336 | char ncq_desc[20]; | ||
1314 | 1337 | ||
1315 | lba_desc = "LBA"; | 1338 | lba_desc = "LBA"; |
1316 | dev->flags |= ATA_DFLAG_LBA; | 1339 | dev->flags |= ATA_DFLAG_LBA; |
@@ -1319,14 +1342,17 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1319 | lba_desc = "LBA48"; | 1342 | lba_desc = "LBA48"; |
1320 | } | 1343 | } |
1321 | 1344 | ||
1345 | /* config NCQ */ | ||
1346 | ata_dev_config_ncq(dev, ncq_desc, sizeof(ncq_desc)); | ||
1347 | |||
1322 | /* print device info to dmesg */ | 1348 | /* print device info to dmesg */ |
1323 | if (print_info) | 1349 | if (print_info) |
1324 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " | 1350 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " |
1325 | "max %s, %Lu sectors: %s\n", | 1351 | "max %s, %Lu sectors: %s %s\n", |
1326 | ata_id_major_version(id), | 1352 | ata_id_major_version(id), |
1327 | ata_mode_string(xfer_mask), | 1353 | ata_mode_string(xfer_mask), |
1328 | (unsigned long long)dev->n_sectors, | 1354 | (unsigned long long)dev->n_sectors, |
1329 | lba_desc); | 1355 | lba_desc, ncq_desc); |
1330 | } else { | 1356 | } else { |
1331 | /* CHS */ | 1357 | /* CHS */ |
1332 | 1358 | ||
@@ -5675,6 +5701,7 @@ EXPORT_SYMBOL_GPL(ata_port_queue_task); | |||
5675 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); | 5701 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); |
5676 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); | 5702 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); |
5677 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); | 5703 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); |
5704 | EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth); | ||
5678 | EXPORT_SYMBOL_GPL(ata_scsi_release); | 5705 | EXPORT_SYMBOL_GPL(ata_scsi_release); |
5679 | EXPORT_SYMBOL_GPL(ata_host_intr); | 5706 | EXPORT_SYMBOL_GPL(ata_host_intr); |
5680 | EXPORT_SYMBOL_GPL(sata_scr_valid); | 5707 | EXPORT_SYMBOL_GPL(sata_scr_valid); |