X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=include%2Flinux%2Fata.h;h=72ab80801ef61d3f82c3a3cb7e980a2ca6c0f275;hb=4486c5f510463673d2ea57b46137086f5b21ef36;hp=e21c002c3a4a4f2dded103f76d44d612e642f0bd;hpb=00cda56d39f013cce60f44f1e3da19b87eba5d85;p=cascardo%2Flinux.git diff --git a/include/linux/ata.h b/include/linux/ata.h index e21c002c3a4a..72ab80801ef6 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -43,6 +43,7 @@ enum { ATA_MAX_SECTORS_128 = 128, ATA_MAX_SECTORS = 256, ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ + ATA_MAX_SECTORS_TAPE = 65535, ATA_ID_WORDS = 256, ATA_ID_SERNO = 10, @@ -189,6 +190,8 @@ enum { ATA_CMD_READ_LOG_EXT = 0x2f, ATA_CMD_PMP_READ = 0xE4, ATA_CMD_PMP_WRITE = 0xE8, + ATA_CMD_CONF_OVERLAY = 0xB1, + ATA_CMD_SEC_FREEZE_LOCK = 0xF5, /* READ_LOG_EXT pages */ ATA_LOG_SATA_NCQ = 0x10, @@ -236,6 +239,20 @@ enum { /* SETFEATURE Sector counts for SATA features */ SATA_AN = 0x05, /* Asynchronous Notification */ + SATA_DIPM = 0x03, /* Device Initiated Power Management */ + + /* feature values for SET_MAX */ + ATA_SET_MAX_ADDR = 0x00, + ATA_SET_MAX_PASSWD = 0x01, + ATA_SET_MAX_LOCK = 0x02, + ATA_SET_MAX_UNLOCK = 0x03, + ATA_SET_MAX_FREEZE_LOCK = 0x04, + + /* feature values for DEVICE CONFIGURATION OVERLAY */ + ATA_DCO_RESTORE = 0xC0, + ATA_DCO_FREEZE_LOCK = 0xC1, + ATA_DCO_IDENTIFY = 0xC2, + ATA_DCO_SET = 0xC3, /* ATAPI stuff */ ATAPI_PKT_DMA = (1 << 0), @@ -378,6 +395,26 @@ struct ata_taskfile { #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) +static inline bool ata_id_has_hipm(const u16 *id) +{ + u16 val = id[76]; + + if (val == 0 || val == 0xffff) + return false; + + return val & (1 << 9); +} + +static inline bool ata_id_has_dipm(const u16 *id) +{ + u16 val = id[78]; + + if (val == 0 || val == 0xffff) + return false; + + return val & (1 << 3); +} + static inline int ata_id_has_fua(const u16 *id) { if ((id[84] & 0xC000) != 0x4000) @@ -403,6 +440,8 @@ static inline int ata_id_has_lba48(const u16 *id) { if ((id[83] & 0xC000) != 0x4000) return 0; + if (!ata_id_u64(id, 100)) + return 0; return id[83] & (1 << 10); } @@ -513,6 +552,15 @@ static inline int ata_drive_40wire(const u16 *dev_id) return 1; } +static inline int ata_drive_40wire_relaxed(const u16 *dev_id) +{ + if (ata_id_is_sata(dev_id)) + return 0; /* SATA */ + if ((dev_id[93] & 0x2000) == 0x2000) + return 0; /* 80 wire */ + return 1; +} + static inline int atapi_cdb_len(const u16 *dev_id) { u16 tmp = dev_id[0] & 0x3; @@ -523,6 +571,11 @@ static inline int atapi_cdb_len(const u16 *dev_id) } } +static inline int atapi_command_packet_set(const u16 *dev_id) +{ + return (dev_id[0] >> 8) & 0x1f; +} + static inline int is_atapi_taskfile(const struct ata_taskfile *tf) { return (tf->protocol == ATA_PROT_ATAPI) ||