Commit 127102ae authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

libata: make SFF support optional

Now that SFF support is completely separated out from the core layer,
it can be made optional.  Add CONFIG_ATA_SFF and let SFF drivers
depend on it.  If CONFIG_ATA_SFF isn't set, all codes in libata-sff.c
and data structures for SFF support are disabled.  This saves good
number of bytes for small systems.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
parent 350756f6
...@@ -49,6 +49,32 @@ config SATA_AHCI ...@@ -49,6 +49,32 @@ config SATA_AHCI
If unsure, say N. If unsure, say N.
config SATA_SIL24
tristate "Silicon Image 3124/3132 SATA support"
depends on PCI
help
This option enables support for Silicon Image 3124/3132 Serial ATA.
If unsure, say N.
config SATA_FSL
tristate "Freescale 3.0Gbps SATA support"
depends on FSL_SOC
help
This option enables support for Freescale 3.0Gbps SATA controller.
It can be found on MPC837x and MPC8315.
If unsure, say N.
config ATA_SFF
bool "ATA SFF support"
default y
help
This option adds support for ATA controllers with SFF
compliant or similar programming interface.
if ATA_SFF
config SATA_SVW config SATA_SVW
tristate "ServerWorks Frodo / Apple K2 SATA support" tristate "ServerWorks Frodo / Apple K2 SATA support"
depends on PCI depends on PCI
...@@ -125,14 +151,6 @@ config SATA_SIL ...@@ -125,14 +151,6 @@ config SATA_SIL
If unsure, say N. If unsure, say N.
config SATA_SIL24
tristate "Silicon Image 3124/3132 SATA support"
depends on PCI
help
This option enables support for Silicon Image 3124/3132 Serial ATA.
If unsure, say N.
config SATA_SIS config SATA_SIS
tristate "SiS 964/965/966/180 SATA support" tristate "SiS 964/965/966/180 SATA support"
depends on PCI depends on PCI
...@@ -183,15 +201,6 @@ config PATA_ACPI ...@@ -183,15 +201,6 @@ config PATA_ACPI
firmware in the BIOS. This driver can sometimes handle firmware in the BIOS. This driver can sometimes handle
otherwise unsupported hardware. otherwise unsupported hardware.
config SATA_FSL
tristate "Freescale 3.0Gbps SATA support"
depends on FSL_SOC
help
This option enables support for Freescale 3.0Gbps SATA controller.
It can be found on MPC837x and MPC8315.
If unsure, say N.
config PATA_ALI config PATA_ALI
tristate "ALi PATA support (Experimental)" tristate "ALi PATA support (Experimental)"
depends on PCI && EXPERIMENTAL depends on PCI && EXPERIMENTAL
...@@ -679,4 +688,5 @@ config PATA_BF54X ...@@ -679,4 +688,5 @@ config PATA_BF54X
If unsure, say N. If unsure, say N.
endif # ATA_SFF
endif # ATA endif # ATA
...@@ -78,6 +78,6 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o ...@@ -78,6 +78,6 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o
# Should be last libata driver # Should be last libata driver
obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o
libata-objs := libata-core.o libata-scsi.o libata-sff.o libata-eh.o \ libata-objs := libata-core.o libata-scsi.o libata-eh.o libata-pmp.o
libata-pmp.o libata-$(CONFIG_ATA_SFF) += libata-sff.o
libata-$(CONFIG_ATA_ACPI) += libata-acpi.o libata-$(CONFIG_ATA_ACPI) += libata-acpi.o
...@@ -5195,7 +5195,9 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ...@@ -5195,7 +5195,9 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN; ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN;
#endif #endif
#ifdef CONFIG_ATA_SFF
INIT_DELAYED_WORK(&ap->port_task, ata_pio_task); INIT_DELAYED_WORK(&ap->port_task, ata_pio_task);
#endif
INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug); INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug);
INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan);
INIT_LIST_HEAD(&ap->eh_done_q); INIT_LIST_HEAD(&ap->eh_done_q);
......
...@@ -2393,7 +2393,9 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) ...@@ -2393,7 +2393,9 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
/* FIXME: is this needed? */ /* FIXME: is this needed? */
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
#ifdef CONFIG_ATA_SFF
ap->ops->sff_tf_read(ap, &qc->tf); ap->ops->sff_tf_read(ap, &qc->tf);
#endif
/* fill these in, for the case where they are -not- overwritten */ /* fill these in, for the case where they are -not- overwritten */
cmd->sense_buffer[0] = 0x70; cmd->sense_buffer[0] = 0x70;
......
...@@ -42,8 +42,10 @@ static inline int ata_is_builtin_hardreset(ata_reset_fn_t reset) ...@@ -42,8 +42,10 @@ static inline int ata_is_builtin_hardreset(ata_reset_fn_t reset)
{ {
if (reset == sata_std_hardreset) if (reset == sata_std_hardreset)
return 1; return 1;
#ifdef CONFIG_ATA_SFF
if (reset == sata_sff_hardreset) if (reset == sata_sff_hardreset)
return 1; return 1;
#endif
return 0; return 0;
} }
...@@ -206,9 +208,11 @@ extern int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, ...@@ -206,9 +208,11 @@ extern int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
extern void ata_eh_finish(struct ata_port *ap); extern void ata_eh_finish(struct ata_port *ap);
/* libata-sff.c */ /* libata-sff.c */
#ifdef CONFIG_ATA_SFF
extern void ata_dev_select(struct ata_port *ap, unsigned int device, extern void ata_dev_select(struct ata_port *ap, unsigned int device,
unsigned int wait, unsigned int can_sleep); unsigned int wait, unsigned int can_sleep);
extern u8 ata_irq_on(struct ata_port *ap); extern u8 ata_irq_on(struct ata_port *ap);
extern void ata_pio_task(struct work_struct *work); extern void ata_pio_task(struct work_struct *work);
#endif /* CONFIG_ATA_SFF */
#endif /* __LIBATA_H__ */ #endif /* __LIBATA_H__ */
...@@ -445,6 +445,7 @@ enum link_pm { ...@@ -445,6 +445,7 @@ enum link_pm {
}; };
extern struct class_device_attribute class_device_attr_link_power_management_policy; extern struct class_device_attribute class_device_attr_link_power_management_policy;
#ifdef CONFIG_ATA_SFF
struct ata_ioports { struct ata_ioports {
void __iomem *cmd_addr; void __iomem *cmd_addr;
void __iomem *data_addr; void __iomem *data_addr;
...@@ -462,6 +463,7 @@ struct ata_ioports { ...@@ -462,6 +463,7 @@ struct ata_ioports {
void __iomem *bmdma_addr; void __iomem *bmdma_addr;
void __iomem *scr_addr; void __iomem *scr_addr;
}; };
#endif /* CONFIG_ATA_SFF */
struct ata_host { struct ata_host {
spinlock_t lock; spinlock_t lock;
...@@ -648,7 +650,9 @@ struct ata_port { ...@@ -648,7 +650,9 @@ struct ata_port {
struct ata_prd *prd; /* our SG list */ struct ata_prd *prd; /* our SG list */
dma_addr_t prd_dma; /* and its DMA mapping */ dma_addr_t prd_dma; /* and its DMA mapping */
#ifdef CONFIG_ATA_SFF
struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
#endif /* CONFIG_ATA_SFF */
u8 ctl; /* cache of ATA control register */ u8 ctl; /* cache of ATA control register */
u8 last_ctl; /* Cache last written value */ u8 last_ctl; /* Cache last written value */
...@@ -760,6 +764,7 @@ struct ata_port_operations { ...@@ -760,6 +764,7 @@ struct ata_port_operations {
void (*port_stop)(struct ata_port *ap); void (*port_stop)(struct ata_port *ap);
void (*host_stop)(struct ata_host *host); void (*host_stop)(struct ata_host *host);
#ifdef CONFIG_ATA_SFF
/* /*
* SFF / taskfile oriented ops * SFF / taskfile oriented ops
*/ */
...@@ -779,6 +784,7 @@ struct ata_port_operations { ...@@ -779,6 +784,7 @@ struct ata_port_operations {
void (*bmdma_start)(struct ata_queued_cmd *qc); void (*bmdma_start)(struct ata_queued_cmd *qc);
void (*bmdma_stop)(struct ata_queued_cmd *qc); void (*bmdma_stop)(struct ata_queued_cmd *qc);
u8 (*bmdma_status)(struct ata_port *ap); u8 (*bmdma_status)(struct ata_port *ap);
#endif /* CONFIG_ATA_SFF */
/* /*
* Obsolete * Obsolete
...@@ -1349,6 +1355,8 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) ...@@ -1349,6 +1355,8 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
/************************************************************************** /**************************************************************************
* SFF - drivers/ata/libata-sff.c * SFF - drivers/ata/libata-sff.c
*/ */
#ifdef CONFIG_ATA_SFF
extern const struct ata_port_operations ata_sff_port_ops; extern const struct ata_port_operations ata_sff_port_ops;
extern const struct ata_port_operations ata_bmdma_port_ops; extern const struct ata_port_operations ata_bmdma_port_ops;
...@@ -1489,5 +1497,6 @@ static inline u8 ata_wait_idle(struct ata_port *ap) ...@@ -1489,5 +1497,6 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
return status; return status;
} }
#endif /* CONFIG_ATA_SFF */
#endif /* __LINUX_LIBATA_H__ */ #endif /* __LINUX_LIBATA_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment