]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/libata-core.c
pata_it821x: Driver updates and reworking
[linux-2.6-omap-h63xx.git] / drivers / ata / libata-core.c
index f69d1548b562a15111e1bffb1ab5f9e51f2a31ef..5ba96c5052c8c737bf8e07d8968affb334636ccd 100644 (file)
@@ -1132,6 +1132,8 @@ void ata_id_string(const u16 *id, unsigned char *s,
 {
        unsigned int c;
 
+       BUG_ON(len & 1);
+
        while (len > 0) {
                c = id[ofs] >> 8;
                *s = c;
@@ -1165,8 +1167,6 @@ void ata_id_c_string(const u16 *id, unsigned char *s,
 {
        unsigned char *p;
 
-       WARN_ON(!(len & 1));
-
        ata_id_string(id, s, ofs, len - 1);
 
        p = s + strnlen(s, len - 1);
@@ -1885,6 +1885,23 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
        return 3 << ATA_SHIFT_PIO;
 }
 
+/**
+ *     ata_do_dev_read_id              -       default ID read method
+ *     @dev: device
+ *     @tf: proposed taskfile
+ *     @id: data buffer
+ *
+ *     Issue the identify taskfile and hand back the buffer containing
+ *     identify data. For some RAID controllers and for pre ATA devices
+ *     this function is wrapped or replaced by the driver
+ */
+unsigned int ata_do_dev_read_id(struct ata_device *dev,
+                                       struct ata_taskfile *tf, u16 *id)
+{
+       return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
+                                    id, sizeof(id[0]) * ATA_ID_WORDS, 0);
+}
+
 /**
  *     ata_dev_read_id - Read ID data from the specified device
  *     @dev: target device
@@ -1920,7 +1937,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
        if (ata_msg_ctl(ap))
                ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__);
 
- retry:
+retry:
        ata_tf_init(dev, &tf);
 
        switch (class) {
@@ -1948,8 +1965,11 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
         */
        tf.flags |= ATA_TFLAG_POLLING;
 
-       err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
-                                    id, sizeof(id[0]) * ATA_ID_WORDS, 0);
+       if (ap->ops->read_id)
+               err_mask = ap->ops->read_id(dev, &tf, id);
+       else
+               err_mask = ata_do_dev_read_id(dev, &tf, id);
+
        if (err_mask) {
                if (err_mask & AC_ERR_NODEV_HINT) {
                        ata_dev_printk(dev, KERN_DEBUG,
@@ -6283,6 +6303,7 @@ EXPORT_SYMBOL_GPL(ata_host_resume);
 #endif /* CONFIG_PM */
 EXPORT_SYMBOL_GPL(ata_id_string);
 EXPORT_SYMBOL_GPL(ata_id_c_string);
+EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
 EXPORT_SYMBOL_GPL(ata_scsi_simulate);
 
 EXPORT_SYMBOL_GPL(ata_pio_need_iordy);