* [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type()
@ 2008-04-02 8:28 Tejun Heo
2008-04-02 8:35 ` [PATCH #upstream-fixes 2/2] libata: ATA_12/16 doesn't fall into ATAPI_MISC Tejun Heo
2008-04-04 6:47 ` [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type() Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Tejun Heo @ 2008-04-02 8:28 UTC (permalink / raw)
To: Jeff Garzik, IDE/ATA development list
Uninline atapi_cmd_type(). It doesn't really have to be inline and
more case will be added which need to access unexported libata
variable.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/ata/libata-core.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/libata.h | 22 +---------------------
2 files changed, 35 insertions(+), 21 deletions(-)
Index: work1/drivers/ata/libata-core.c
===================================================================
--- work1.orig/drivers/ata/libata-core.c
+++ work1/drivers/ata/libata-core.c
@@ -385,6 +385,39 @@ static void ata_force_horkage(struct ata
}
/**
+ * atapi_cmd_type - Determine ATAPI command type from SCSI opcode
+ * @opcode: SCSI opcode
+ *
+ * Determine ATAPI command type from @opcode.
+ *
+ * LOCKING:
+ * None.
+ *
+ * RETURNS:
+ * ATAPI_{READ|WRITE|READ_CD|PASS_THRU|MISC}
+ */
+int atapi_cmd_type(u8 opcode)
+{
+ switch (opcode) {
+ case GPCMD_READ_10:
+ case GPCMD_READ_12:
+ return ATAPI_READ;
+
+ case GPCMD_WRITE_10:
+ case GPCMD_WRITE_12:
+ case GPCMD_WRITE_AND_VERIFY_10:
+ return ATAPI_WRITE;
+
+ case GPCMD_READ_CD:
+ case GPCMD_READ_CD_MSF:
+ return ATAPI_READ_CD;
+
+ default:
+ return ATAPI_MISC;
+ }
+}
+
+/**
* ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
* @tf: Taskfile to convert
* @pmp: Port multiplier port
@@ -7876,6 +7909,7 @@ EXPORT_SYMBOL_GPL(ata_tf_read);
EXPORT_SYMBOL_GPL(ata_noop_dev_select);
EXPORT_SYMBOL_GPL(ata_std_dev_select);
EXPORT_SYMBOL_GPL(sata_print_link_status);
+EXPORT_SYMBOL_GPL(atapi_cmd_type);
EXPORT_SYMBOL_GPL(ata_tf_to_fis);
EXPORT_SYMBOL_GPL(ata_tf_from_fis);
EXPORT_SYMBOL_GPL(ata_pack_xfermask);
Index: work1/include/linux/libata.h
===================================================================
--- work1.orig/include/linux/libata.h
+++ work1/include/linux/libata.h
@@ -869,6 +869,7 @@ extern unsigned int ata_dev_try_classify
*/
extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
+extern int atapi_cmd_type(u8 opcode);
extern void ata_tf_to_fis(const struct ata_taskfile *tf,
u8 pmp, int is_cmd, u8 *fis);
extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
@@ -1444,27 +1445,6 @@ static inline int ata_try_flush_cache(co
ata_id_has_flush_ext(dev->id);
}
-static inline int atapi_cmd_type(u8 opcode)
-{
- switch (opcode) {
- case GPCMD_READ_10:
- case GPCMD_READ_12:
- return ATAPI_READ;
-
- case GPCMD_WRITE_10:
- case GPCMD_WRITE_12:
- case GPCMD_WRITE_AND_VERIFY_10:
- return ATAPI_WRITE;
-
- case GPCMD_READ_CD:
- case GPCMD_READ_CD_MSF:
- return ATAPI_READ_CD;
-
- default:
- return ATAPI_MISC;
- }
-}
-
static inline unsigned int ac_err_mask(u8 status)
{
if (status & (ATA_BUSY | ATA_DRQ))
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH #upstream-fixes 2/2] libata: ATA_12/16 doesn't fall into ATAPI_MISC
2008-04-02 8:28 [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type() Tejun Heo
@ 2008-04-02 8:35 ` Tejun Heo
2008-04-04 6:47 ` [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type() Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2008-04-02 8:35 UTC (permalink / raw)
To: Jeff Garzik, IDE/ATA development list
SAT passthrus don't really fit into ATAPI_MISC class. SAT passthru
commands always transfer multiple of 512 bytes and variable length
response is not allowed. This patch creates a separate category -
ATAPI_PASS_THRU - for these.
This fixes HSM violation on "hdparm -I".
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/ata/libata-core.c | 5 +++++
include/linux/libata.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
Index: work1/drivers/ata/libata-core.c
===================================================================
--- work1.orig/drivers/ata/libata-core.c
+++ work1/drivers/ata/libata-core.c
@@ -412,6 +412,11 @@ int atapi_cmd_type(u8 opcode)
case GPCMD_READ_CD_MSF:
return ATAPI_READ_CD;
+ case ATA_16:
+ case ATA_12:
+ if (atapi_passthru16)
+ return ATAPI_PASS_THRU;
+ /* fall thru */
default:
return ATAPI_MISC;
}
Index: work1/include/linux/libata.h
===================================================================
--- work1.orig/include/linux/libata.h
+++ work1/include/linux/libata.h
@@ -347,7 +347,8 @@ enum {
ATAPI_READ = 0, /* READs */
ATAPI_WRITE = 1, /* WRITEs */
ATAPI_READ_CD = 2, /* READ CD [MSF] */
- ATAPI_MISC = 3, /* the rest */
+ ATAPI_PASS_THRU = 3, /* SAT pass-thru */
+ ATAPI_MISC = 4, /* the rest */
};
enum ata_xfer_mask {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type()
2008-04-02 8:28 [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type() Tejun Heo
2008-04-02 8:35 ` [PATCH #upstream-fixes 2/2] libata: ATA_12/16 doesn't fall into ATAPI_MISC Tejun Heo
@ 2008-04-04 6:47 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2008-04-04 6:47 UTC (permalink / raw)
To: Tejun Heo; +Cc: IDE/ATA development list
Tejun Heo wrote:
> Uninline atapi_cmd_type(). It doesn't really have to be inline and
> more case will be added which need to access unexported libata
> variable.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
applied 1-2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-04 6:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-02 8:28 [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type() Tejun Heo
2008-04-02 8:35 ` [PATCH #upstream-fixes 2/2] libata: ATA_12/16 doesn't fall into ATAPI_MISC Tejun Heo
2008-04-04 6:47 ` [PATCH #upstream-fixes 1/2] libata: uninline atapi_cmd_type() Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).