mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
ata: make transfer mode masks *unsigned int*
The packed transfer mode masks and also the {pio|mwdma|udma}_mask fields
of *struct*s ata_device and ata_port_info are declared as *unsigned long*
(which is a 64-bit type on 64-bit architectures) but actually the packed
masks occupy only 20 bits (7 PIO modes, 5 MWDMA modes, and 8 UDMA modes)
and the PIO/MWDMA/UDMA masks easily fit into just 8 bits each, so we can
safely use (always 32-bit) *unsigned int* variables instead. This saves
745 bytes of object code in libata-core.o alone, not to mention LLDDs...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
This commit is contained in:
committed by
Damien Le Moal
parent
5eb8deb4af
commit
f0a6d77b35
@@ -275,7 +275,7 @@ enum {
|
||||
PORT_DISABLED = 2,
|
||||
|
||||
/* encoding various smaller bitmaps into a single
|
||||
* unsigned long bitmap
|
||||
* unsigned int bitmap
|
||||
*/
|
||||
ATA_NR_PIO_MODES = 7,
|
||||
ATA_NR_MWDMA_MODES = 5,
|
||||
@@ -426,12 +426,9 @@ enum {
|
||||
};
|
||||
|
||||
enum ata_xfer_mask {
|
||||
ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1)
|
||||
<< ATA_SHIFT_PIO,
|
||||
ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1)
|
||||
<< ATA_SHIFT_MWDMA,
|
||||
ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1)
|
||||
<< ATA_SHIFT_UDMA,
|
||||
ATA_MASK_PIO = ((1U << ATA_NR_PIO_MODES) - 1) << ATA_SHIFT_PIO,
|
||||
ATA_MASK_MWDMA = ((1U << ATA_NR_MWDMA_MODES) - 1) << ATA_SHIFT_MWDMA,
|
||||
ATA_MASK_UDMA = ((1U << ATA_NR_UDMA_MODES) - 1) << ATA_SHIFT_UDMA,
|
||||
};
|
||||
|
||||
enum hsm_task_states {
|
||||
@@ -680,9 +677,9 @@ struct ata_device {
|
||||
unsigned int cdb_len;
|
||||
|
||||
/* per-dev xfer mask */
|
||||
unsigned long pio_mask;
|
||||
unsigned long mwdma_mask;
|
||||
unsigned long udma_mask;
|
||||
unsigned int pio_mask;
|
||||
unsigned int mwdma_mask;
|
||||
unsigned int udma_mask;
|
||||
|
||||
/* for CHS addressing */
|
||||
u16 cylinders; /* Number of cylinders */
|
||||
@@ -885,7 +882,7 @@ struct ata_port_operations {
|
||||
* Configuration and exception handling
|
||||
*/
|
||||
int (*cable_detect)(struct ata_port *ap);
|
||||
unsigned long (*mode_filter)(struct ata_device *dev, unsigned long xfer_mask);
|
||||
unsigned int (*mode_filter)(struct ata_device *dev, unsigned int xfer_mask);
|
||||
void (*set_piomode)(struct ata_port *ap, struct ata_device *dev);
|
||||
void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev);
|
||||
int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev);
|
||||
@@ -981,9 +978,9 @@ struct ata_port_operations {
|
||||
struct ata_port_info {
|
||||
unsigned long flags;
|
||||
unsigned long link_flags;
|
||||
unsigned long pio_mask;
|
||||
unsigned long mwdma_mask;
|
||||
unsigned long udma_mask;
|
||||
unsigned int pio_mask;
|
||||
unsigned int mwdma_mask;
|
||||
unsigned int udma_mask;
|
||||
struct ata_port_operations *port_ops;
|
||||
void *private_data;
|
||||
};
|
||||
@@ -1102,16 +1099,18 @@ extern void ata_msleep(struct ata_port *ap, unsigned int msecs);
|
||||
extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask,
|
||||
u32 val, unsigned long interval, unsigned long timeout);
|
||||
extern int atapi_cmd_type(u8 opcode);
|
||||
extern unsigned long ata_pack_xfermask(unsigned long pio_mask,
|
||||
unsigned long mwdma_mask, unsigned long udma_mask);
|
||||
extern void ata_unpack_xfermask(unsigned long xfer_mask,
|
||||
unsigned long *pio_mask, unsigned long *mwdma_mask,
|
||||
unsigned long *udma_mask);
|
||||
extern u8 ata_xfer_mask2mode(unsigned long xfer_mask);
|
||||
extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
|
||||
extern unsigned int ata_pack_xfermask(unsigned int pio_mask,
|
||||
unsigned int mwdma_mask,
|
||||
unsigned int udma_mask);
|
||||
extern void ata_unpack_xfermask(unsigned int xfer_mask,
|
||||
unsigned int *pio_mask,
|
||||
unsigned int *mwdma_mask,
|
||||
unsigned int *udma_mask);
|
||||
extern u8 ata_xfer_mask2mode(unsigned int xfer_mask);
|
||||
extern unsigned int ata_xfer_mode2mask(u8 xfer_mode);
|
||||
extern int ata_xfer_mode2shift(u8 xfer_mode);
|
||||
extern const char *ata_mode_string(unsigned long xfer_mask);
|
||||
extern unsigned long ata_id_xfermask(const u16 *id);
|
||||
extern const char *ata_mode_string(unsigned int xfer_mask);
|
||||
extern unsigned int ata_id_xfermask(const u16 *id);
|
||||
extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
|
||||
extern enum ata_completion_errors ata_noop_qc_prep(struct ata_queued_cmd *qc);
|
||||
extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
|
||||
@@ -1283,8 +1282,8 @@ static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
|
||||
}
|
||||
int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
|
||||
int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
|
||||
unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
|
||||
const struct ata_acpi_gtm *gtm);
|
||||
unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev,
|
||||
const struct ata_acpi_gtm *gtm);
|
||||
int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
|
||||
#else
|
||||
static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
|
||||
|
||||
Reference in New Issue
Block a user