From 7f594e47663f5121d34ffdf43eba8a8109bd1be7 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sun, 16 May 2004 13:33:18 -0400 Subject: [libata] SCSI->ATA simulator hacking: INQUIRY command The SCSI T10 committee is working on a document describing a standard method for translating ATA<->SCSI, since it being done quite often these days. Some of the recommendations are reasonable, and we implement two here: * Mirror that ATA 'removeable media' bit into INQUIRY output. * Change behavior of INQUIRY output field 'product revision' from the libata software version number to the first 4 bytes of the ATA device's firmware revision number. Rather than cache the firmware revision in struct ata_device, as was/is done with two other strings, I took the opportunity to eliminate the caching of the two other strings, 'vendor' and 'product'. These strings are now retrieved as needed from the IDENTIFY [PACKET] DEVICE info page, since we cache its entire contents. Retrieving a string from the identify-device page is done via the helper function ata_dev_id_string(), which is now exported. This patch winds up making struct ata_device 40 bytes smaller, and the libata core gets a bit smaller as well. --- include/linux/ata.h | 2 ++ include/linux/libata.h | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/linux/ata.h b/include/linux/ata.h index 053fd4b64da6..4459a429ba0a 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -38,6 +38,7 @@ enum { ATA_ID_WORDS = 256, ATA_ID_PROD_OFS = 27, + ATA_ID_FW_REV_OFS = 23, ATA_ID_SERNO_OFS = 10, ATA_ID_MAJOR_VER = 80, ATA_ID_PIO_MODES = 64, @@ -205,6 +206,7 @@ struct ata_taskfile { #define ata_id_has_wcache(dev) ((dev)->id[82] & (1 << 5)) #define ata_id_has_lba(dev) ((dev)->id[49] & (1 << 8)) #define ata_id_has_dma(dev) ((dev)->id[49] & (1 << 9)) +#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) \ diff --git a/include/linux/libata.h b/include/linux/libata.h index 077f6461ab2a..388d149cf202 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -260,12 +260,6 @@ struct ata_device { unsigned int pio_mode; unsigned int udma_mode; - unsigned char vendor[8]; /* space-padded, not ASCIIZ */ - unsigned char product[32]; /* WARNING: shorter than - * ATAPI7 spec size, 40 ASCII - * characters - */ - /* cache info about current transfer mode */ u8 xfer_protocol; /* taskfile xfer protocol */ u8 read_cmd; /* opcode to use on read */ @@ -398,6 +392,8 @@ extern int ata_port_start (struct ata_port *ap); extern void ata_port_stop (struct ata_port *ap); extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); extern void ata_fill_sg(struct ata_queued_cmd *qc); +extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s, + unsigned int ofs, unsigned int len); extern void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc); extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc); extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc); -- cgit v1.2.3