diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-07-24 12:16:06 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-31 02:04:50 -0400 |
commit | 963e4975c6f93c148ca809d986d412201df9af89 (patch) | |
tree | 41cb6ec55e48a2186dbe4c13531fd05439efbade /drivers/ata/libata-core.c | |
parent | 1f938d060a7bc01b5f82d46db3e38cd501b445a6 (diff) |
pata_it821x: Driver updates and reworking
- Add support for the RDC 1010 variant
- Rework the core library to have a read_id method. This allows the hacky
bits of it821x to go and prepares us for pata_hd
- Switch from WARN to BUG in ata_id_string as it will reboot if you get
it wrong so WARN won't be seen
- Allow the issue of command 0xFC on the 821x. This is needed to query
rebuild status.
- Tidy up printk formatting
- Do more ident rewriting on RAID volumes to handle firmware provided
ident data which is rather wonky
- Report the firmware revision and device layout in RAID mode
- Don't try and disable raid on the 8211 or RDC - they don't have the
relevant bits
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index f69d1548b562..5ba96c5052c8 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1132,6 +1132,8 @@ void ata_id_string(const u16 *id, unsigned char *s, | |||
1132 | { | 1132 | { |
1133 | unsigned int c; | 1133 | unsigned int c; |
1134 | 1134 | ||
1135 | BUG_ON(len & 1); | ||
1136 | |||
1135 | while (len > 0) { | 1137 | while (len > 0) { |
1136 | c = id[ofs] >> 8; | 1138 | c = id[ofs] >> 8; |
1137 | *s = c; | 1139 | *s = c; |
@@ -1165,8 +1167,6 @@ void ata_id_c_string(const u16 *id, unsigned char *s, | |||
1165 | { | 1167 | { |
1166 | unsigned char *p; | 1168 | unsigned char *p; |
1167 | 1169 | ||
1168 | WARN_ON(!(len & 1)); | ||
1169 | |||
1170 | ata_id_string(id, s, ofs, len - 1); | 1170 | ata_id_string(id, s, ofs, len - 1); |
1171 | 1171 | ||
1172 | p = s + strnlen(s, len - 1); | 1172 | p = s + strnlen(s, len - 1); |
@@ -1886,6 +1886,23 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev) | |||
1886 | } | 1886 | } |
1887 | 1887 | ||
1888 | /** | 1888 | /** |
1889 | * ata_do_dev_read_id - default ID read method | ||
1890 | * @dev: device | ||
1891 | * @tf: proposed taskfile | ||
1892 | * @id: data buffer | ||
1893 | * | ||
1894 | * Issue the identify taskfile and hand back the buffer containing | ||
1895 | * identify data. For some RAID controllers and for pre ATA devices | ||
1896 | * this function is wrapped or replaced by the driver | ||
1897 | */ | ||
1898 | unsigned int ata_do_dev_read_id(struct ata_device *dev, | ||
1899 | struct ata_taskfile *tf, u16 *id) | ||
1900 | { | ||
1901 | return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE, | ||
1902 | id, sizeof(id[0]) * ATA_ID_WORDS, 0); | ||
1903 | } | ||
1904 | |||
1905 | /** | ||
1889 | * ata_dev_read_id - Read ID data from the specified device | 1906 | * ata_dev_read_id - Read ID data from the specified device |
1890 | * @dev: target device | 1907 | * @dev: target device |
1891 | * @p_class: pointer to class of the target device (may be changed) | 1908 | * @p_class: pointer to class of the target device (may be changed) |
@@ -1920,7 +1937,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1920 | if (ata_msg_ctl(ap)) | 1937 | if (ata_msg_ctl(ap)) |
1921 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); | 1938 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); |
1922 | 1939 | ||
1923 | retry: | 1940 | retry: |
1924 | ata_tf_init(dev, &tf); | 1941 | ata_tf_init(dev, &tf); |
1925 | 1942 | ||
1926 | switch (class) { | 1943 | switch (class) { |
@@ -1948,8 +1965,11 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1948 | */ | 1965 | */ |
1949 | tf.flags |= ATA_TFLAG_POLLING; | 1966 | tf.flags |= ATA_TFLAG_POLLING; |
1950 | 1967 | ||
1951 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, | 1968 | if (ap->ops->read_id) |
1952 | id, sizeof(id[0]) * ATA_ID_WORDS, 0); | 1969 | err_mask = ap->ops->read_id(dev, &tf, id); |
1970 | else | ||
1971 | err_mask = ata_do_dev_read_id(dev, &tf, id); | ||
1972 | |||
1953 | if (err_mask) { | 1973 | if (err_mask) { |
1954 | if (err_mask & AC_ERR_NODEV_HINT) { | 1974 | if (err_mask & AC_ERR_NODEV_HINT) { |
1955 | ata_dev_printk(dev, KERN_DEBUG, | 1975 | ata_dev_printk(dev, KERN_DEBUG, |
@@ -6283,6 +6303,7 @@ EXPORT_SYMBOL_GPL(ata_host_resume); | |||
6283 | #endif /* CONFIG_PM */ | 6303 | #endif /* CONFIG_PM */ |
6284 | EXPORT_SYMBOL_GPL(ata_id_string); | 6304 | EXPORT_SYMBOL_GPL(ata_id_string); |
6285 | EXPORT_SYMBOL_GPL(ata_id_c_string); | 6305 | EXPORT_SYMBOL_GPL(ata_id_c_string); |
6306 | EXPORT_SYMBOL_GPL(ata_do_dev_read_id); | ||
6286 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 6307 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
6287 | 6308 | ||
6288 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); | 6309 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); |