2.6.x libata update
PATCH 1/1 2.6.x libata update
Today's libata update.
NOTE: bkbits.net and openlogging.org seem to be down, so I list my alternate location in the BK URL below. If you tried to pull net-drivers-2.6 and failed (submitted earlier today), you can pull that with 'bk pull bk://kernel.bkbits.net/jgarzik/net-drivers-2.6'
Anyway, please do a
bk pull bk://kernel.bkbits.net/jgarzik/libata-2.6
This will update the following files:
drivers/scsi/libata-core.c | 19 ++++++------ drivers/scsi/libata-scsi.c | 66 +++++++++++++++++++++------------------------ drivers/scsi/libata.h | 5 +-- drivers/scsi/sata_sil.c | 2 - include/linux/ata.h | 36 ++++++++++++------------ include/linux/libata.h | 12 ++++---- 6 files changed, 69 insertions(+), 71 deletions(-)
through these ChangeSets:
<[email protected]> (04/10/15 1.1988.89.2)
[PATCH] Export ata_scsi_simulate() for use by non-libata drivers
This patch modifies libata-scsi for easier sharing of the various ata_id_* functions and the ata_scsi_simulate() function with non-libata drivers.
Signed-off-by Mark Lord <[email protected]>
drivers/scsi/libata-core.c +10 -9
@@ -831,17 +831,17 @@* caller. */ -void ata_dev_id_string (struct ata_device *dev,unsigned char *s, +void ata_dev_id_string (u16 *id,unsigned char *s,unsigned int ofs,unsigned int len) {unsigned int c;while (len >0 ) { - c = dev->id[ofs] >>8 ; + c = id[ofs] >>8 ; *s = c; s++; - c = dev->id[ofs] &0xff ; + c = id[ofs] &0xff ; *s = c; s++;
@@ -1084,7 +1084,7 @@*/ /* we require LBA and DMA support (bits 8 & 9 of word 49) */ -if (!ata_id_has_dma (dev) || !ata_id_has_lba (dev)) { +if (!ata_id_has_dma (dev->id) || !ata_id_has_lba (dev->id)) {printk (KERN_DEBUG "ata%u: no dma/lba\n" , ap->id); goto err_out_nosup; }
@@ -1102,7 +1102,7 @@/* ATA-specific feature tests */ if (dev->class ==ATA_DEV_ATA ) { -if (!ata_id_is_ata (dev))/* sanity check */ +if (!ata_id_is_ata (dev->id))/* sanity check */ goto err_out_nosup; tmp = dev->id[ATA_ID_MAJOR_VER ];
@@ -1116,11 +1116,11 @@ goto err_out_nosup; } -if (ata_id_has_lba48 (dev)) { +if (ata_id_has_lba48 (dev->id)) { dev->flags |=ATA_DFLAG_LBA48 ; - dev->n_sectors =ata_id_u64 (dev,100 ); + dev->n_sectors =ata_id_u64 (dev->id,100 ); }else { - dev->n_sectors =ata_id_u32 (dev,60 ); + dev->n_sectors =ata_id_u32 (dev->id,60 ); } ap->host->max_cmd_len =16 ;
@@ -1135,7 +1135,7 @@/* ATAPI-specific feature tests */ else { -if (ata_id_is_ata (dev))/* sanity check */ +if (ata_id_is_ata (dev->id))/* sanity check */ goto err_out_nosup; rc =atapi_cdb_len (dev->id);
@@ -3785,3 +3785,4 @@EXPORT_SYMBOL_GPL (ata_host_intr);EXPORT_SYMBOL_GPL (ata_dev_classify);EXPORT_SYMBOL_GPL (ata_dev_id_string); +EXPORT_SYMBOL_GPL (ata_scsi_simulate);
drivers/scsi/libata-scsi.c +31 -35
225 lines not on this page · raw message
drivers/scsi/libata.h +2 -3
@@ -29,9 +29,8 @@#define DRV_VERSION "1.02"/* must be exactly four chars */ struct ata_scsi_args { -struct ata_port *ap; -struct ata_device *dev; -struct scsi_cmnd *cmd; +u16 *id; +struct scsi_cmnd *cmd;void (*done)(struct scsi_cmnd *); };
drivers/scsi/sata_sil.c +1 -1
@@ -288,7 +288,7 @@const char *s;unsigned int len; -ata_dev_id_string (dev, model_num,ATA_ID_PROD_OFS , +ata_dev_id_string (dev->id, model_num,ATA_ID_PROD_OFS ,sizeof (model_num)); s = &model_num[0 ]; len =strnlen (s,sizeof (model_num));
include/linux/ata.h +18 -18
@@ -217,24 +217,24 @@u8 command;/* IO operation */ }; -#define ata_id_is_ata (dev) (((dev)->id[0] & (1 << 15)) == 0) -#define ata_id_rahead_enabled (dev) ((dev)->id[85] & (1 << 6)) -#define ata_id_wcache_enabled (dev) ((dev)->id[85] & (1 << 5)) -#define ata_id_has_flush (dev) ((dev)->id[83] & (1 << 12)) -#define ata_id_has_flush_ext (dev) ((dev)->id[83] & (1 << 13)) -#define ata_id_has_lba48 (dev) ((dev)->id[83] & (1 << 10)) -#define ata_id_has_wcache (dev) ((dev)->id[82] & (1 << 5)) -#define ata_id_has_pm (dev) ((dev)->id[82] & (1 << 3)) -#define ata_id_has_lba (dev) ((dev)->id[49] & (1 << 9)) -#define ata_id_has_dma (dev) ((dev)->id[49] & (1 << 8)) -#define ata_id_removeable (dev) ((dev)->id[0] & (1 << 7)) -#define ata_id_u32 (dev,n) \ - (((u32) (dev)->id[(n) + 1] << 16) | ((u32) (dev)->id[(n)])) -#define ata_id_u64 (dev,n) \ - ( ((u64) dev->id[(n) + 3] << 48) | \ - ((u64) dev->id[(n) + 2] << 32) | \ - ((u64) dev->id[(n) + 1] << 16) | \ - ((u64) dev->id[(n) + 0]) ) +#define ata_id_is_ata (id) (((id)[0] & (1 << 15)) == 0) +#define ata_id_rahead_enabled (id) ((id)[85] & (1 << 6)) +#define ata_id_wcache_enabled (id) ((id)[85] & (1 << 5)) +#define ata_id_has_flush (id) ((id)[83] & (1 << 12)) +#define ata_id_has_flush_ext (id) ((id)[83] & (1 << 13)) +#define ata_id_has_lba48 (id) ((id)[83] & (1 << 10)) +#define ata_id_has_wcache (id) ((id)[82] & (1 << 5)) +#define ata_id_has_pm (id) ((id)[82] & (1 << 3)) +#define ata_id_has_lba (id) ((id)[49] & (1 << 9)) +#define ata_id_has_dma (id) ((id)[49] & (1 << 8)) +#define ata_id_removeable (id) ((id)[0] & (1 << 7)) +#define ata_id_u32 (id,n) \ + (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) +#define ata_id_u64 (id,n) \ + ( ((u64) (id)[(n) + 3] << 48) | \ + ((u64) (id)[(n) + 2] << 32) | \ + ((u64) (id)[(n) + 1] << 16) | \ + ((u64) (id)[(n) + 0]) )static inline int atapi_cdb_len (u16 *dev_id) {
include/linux/libata.h +7 -5
@@ -409,7 +409,7 @@extern void ata_sg_init (struct ata_queued_cmd *qc,struct scatterlist *sg,unsigned int n_elem);extern unsigned int ata_dev_classify (struct ata_taskfile *tf); -extern void ata_dev_id_string (struct ata_device *dev,unsigned char *s, +extern void ata_dev_id_string (u16 *id,unsigned char *s,unsigned int ofs,unsigned int len);extern void ata_bmdma_setup (struct ata_queued_cmd *qc);extern void ata_bmdma_start (struct ata_queued_cmd *qc);
@@ -421,7 +421,9 @@struct block_device *bdev, sector_t capacity, int geom[]);extern int ata_scsi_slave_config (struct scsi_device *sdev); - +extern void ata_scsi_simulate (u16 *id, +struct scsi_cmnd *cmd, +void (*done)(struct scsi_cmnd *));static inline unsigned int ata_tag_valid (unsigned int tag) {
@@ -619,9 +621,9 @@static inline int ata_try_flush_cache (struct ata_device *dev) { -return ata_id_wcache_enabled (dev) || -ata_id_has_flush (dev) || -ata_id_has_flush_ext (dev); +return ata_id_wcache_enabled (dev->id) || +ata_id_has_flush (dev->id) || +ata_id_has_flush_ext (dev->id); }#endif /* __LINUX_LIBATA_H__ */