From be2bb06e6d31e67259b43d6a6cda8082505e9a28 Mon Sep 17 00:00:00 2001 From: Mark Lord Date: Thu, 19 Mar 2009 13:32:21 -0400 Subject: [PATCH] --- yaml --- r: 133598 b: refs/heads/master c: e18086d69cb5bb864749a0637f6ac573aa89d5ea h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/ata/libata-core.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index baf6a7f00da9..65edbdb0c39f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 000b344f4ca7828ee43940255c8bbb32e2c7dbec +refs/heads/master: e18086d69cb5bb864749a0637f6ac573aa89d5ea diff --git a/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index d4a7b8a96ecd..e7ea77cf6069 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -2389,6 +2390,7 @@ int ata_dev_configure(struct ata_device *dev) dev->cylinders = 0; dev->heads = 0; dev->sectors = 0; + dev->multi_count = 0; /* * common ATA, ATAPI feature tests @@ -2426,8 +2428,15 @@ int ata_dev_configure(struct ata_device *dev) dev->n_sectors = ata_id_n_sectors(id); - if (dev->id[59] & 0x100) - dev->multi_count = dev->id[59] & 0xff; + /* get current R/W Multiple count setting */ + if ((dev->id[47] >> 8) == 0x80 && (dev->id[59] & 0x100)) { + unsigned int max = dev->id[47] & 0xff; + unsigned int cnt = dev->id[59] & 0xff; + /* only recognize/allow powers of two here */ + if (is_power_of_2(max) && is_power_of_2(cnt)) + if (cnt <= max) + dev->multi_count = cnt; + } if (ata_id_has_lba(id)) { const char *lba_desc;