mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 11:44:01 +08:00
ata: start separating SATA specific code from libata-eh.c
Start separating SATA specific code from libata-eh.c: * move sata_async_notification() to libata-sata.c: Code size savings on m68k arch using (modified) atari_defconfig: text data bss dec hex filename before: 16243 18 0 16261 3f85 drivers/ata/libata-eh.o after: 16164 18 0 16182 3f36 drivers/ata/libata-eh.o Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
15964ff728
commit
a695de27fc
@ -1092,80 +1092,6 @@ int ata_port_freeze(struct ata_port *ap)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ata_port_freeze);
|
||||
|
||||
/**
|
||||
* sata_async_notification - SATA async notification handler
|
||||
* @ap: ATA port where async notification is received
|
||||
*
|
||||
* Handler to be called when async notification via SDB FIS is
|
||||
* received. This function schedules EH if necessary.
|
||||
*
|
||||
* LOCKING:
|
||||
* spin_lock_irqsave(host lock)
|
||||
*
|
||||
* RETURNS:
|
||||
* 1 if EH is scheduled, 0 otherwise.
|
||||
*/
|
||||
int sata_async_notification(struct ata_port *ap)
|
||||
{
|
||||
u32 sntf;
|
||||
int rc;
|
||||
|
||||
if (!(ap->flags & ATA_FLAG_AN))
|
||||
return 0;
|
||||
|
||||
rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf);
|
||||
if (rc == 0)
|
||||
sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf);
|
||||
|
||||
if (!sata_pmp_attached(ap) || rc) {
|
||||
/* PMP is not attached or SNTF is not available */
|
||||
if (!sata_pmp_attached(ap)) {
|
||||
/* PMP is not attached. Check whether ATAPI
|
||||
* AN is configured. If so, notify media
|
||||
* change.
|
||||
*/
|
||||
struct ata_device *dev = ap->link.device;
|
||||
|
||||
if ((dev->class == ATA_DEV_ATAPI) &&
|
||||
(dev->flags & ATA_DFLAG_AN))
|
||||
ata_scsi_media_change_notify(dev);
|
||||
return 0;
|
||||
} else {
|
||||
/* PMP is attached but SNTF is not available.
|
||||
* ATAPI async media change notification is
|
||||
* not used. The PMP must be reporting PHY
|
||||
* status change, schedule EH.
|
||||
*/
|
||||
ata_port_schedule_eh(ap);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
/* PMP is attached and SNTF is available */
|
||||
struct ata_link *link;
|
||||
|
||||
/* check and notify ATAPI AN */
|
||||
ata_for_each_link(link, ap, EDGE) {
|
||||
if (!(sntf & (1 << link->pmp)))
|
||||
continue;
|
||||
|
||||
if ((link->device->class == ATA_DEV_ATAPI) &&
|
||||
(link->device->flags & ATA_DFLAG_AN))
|
||||
ata_scsi_media_change_notify(link->device);
|
||||
}
|
||||
|
||||
/* If PMP is reporting that PHY status of some
|
||||
* downstream ports has changed, schedule EH.
|
||||
*/
|
||||
if (sntf & (1 << SATA_PMP_CTRL_PORT)) {
|
||||
ata_port_schedule_eh(ap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sata_async_notification);
|
||||
|
||||
/**
|
||||
* ata_eh_freeze_port - EH helper to freeze port
|
||||
* @ap: ATA port to freeze
|
||||
|
@ -4,6 +4,7 @@
|
||||
*
|
||||
* Copyright 2003-2004 Red Hat, Inc. All rights reserved.
|
||||
* Copyright 2003-2004 Jeff Garzik
|
||||
* Copyright 2006 Tejun Heo <htejun@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@ -1275,3 +1276,77 @@ void ata_sas_free_tag(unsigned int tag, struct ata_port *ap)
|
||||
{
|
||||
clear_bit(tag, &ap->sas_tag_allocated);
|
||||
}
|
||||
|
||||
/**
|
||||
* sata_async_notification - SATA async notification handler
|
||||
* @ap: ATA port where async notification is received
|
||||
*
|
||||
* Handler to be called when async notification via SDB FIS is
|
||||
* received. This function schedules EH if necessary.
|
||||
*
|
||||
* LOCKING:
|
||||
* spin_lock_irqsave(host lock)
|
||||
*
|
||||
* RETURNS:
|
||||
* 1 if EH is scheduled, 0 otherwise.
|
||||
*/
|
||||
int sata_async_notification(struct ata_port *ap)
|
||||
{
|
||||
u32 sntf;
|
||||
int rc;
|
||||
|
||||
if (!(ap->flags & ATA_FLAG_AN))
|
||||
return 0;
|
||||
|
||||
rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf);
|
||||
if (rc == 0)
|
||||
sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf);
|
||||
|
||||
if (!sata_pmp_attached(ap) || rc) {
|
||||
/* PMP is not attached or SNTF is not available */
|
||||
if (!sata_pmp_attached(ap)) {
|
||||
/* PMP is not attached. Check whether ATAPI
|
||||
* AN is configured. If so, notify media
|
||||
* change.
|
||||
*/
|
||||
struct ata_device *dev = ap->link.device;
|
||||
|
||||
if ((dev->class == ATA_DEV_ATAPI) &&
|
||||
(dev->flags & ATA_DFLAG_AN))
|
||||
ata_scsi_media_change_notify(dev);
|
||||
return 0;
|
||||
} else {
|
||||
/* PMP is attached but SNTF is not available.
|
||||
* ATAPI async media change notification is
|
||||
* not used. The PMP must be reporting PHY
|
||||
* status change, schedule EH.
|
||||
*/
|
||||
ata_port_schedule_eh(ap);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
/* PMP is attached and SNTF is available */
|
||||
struct ata_link *link;
|
||||
|
||||
/* check and notify ATAPI AN */
|
||||
ata_for_each_link(link, ap, EDGE) {
|
||||
if (!(sntf & (1 << link->pmp)))
|
||||
continue;
|
||||
|
||||
if ((link->device->class == ATA_DEV_ATAPI) &&
|
||||
(link->device->flags & ATA_DFLAG_AN))
|
||||
ata_scsi_media_change_notify(link->device);
|
||||
}
|
||||
|
||||
/* If PMP is reporting that PHY status of some
|
||||
* downstream ports has changed, schedule EH.
|
||||
*/
|
||||
if (sntf & (1 << SATA_PMP_CTRL_PORT)) {
|
||||
ata_port_schedule_eh(ap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sata_async_notification);
|
||||
|
@ -1240,6 +1240,7 @@ extern void ata_tf_to_fis(const struct ata_taskfile *tf,
|
||||
extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
|
||||
extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
|
||||
extern bool sata_lpm_ignore_phy_events(struct ata_link *link);
|
||||
extern int sata_async_notification(struct ata_port *ap);
|
||||
|
||||
extern int ata_cable_40wire(struct ata_port *ap);
|
||||
extern int ata_cable_80wire(struct ata_port *ap);
|
||||
@ -1332,7 +1333,6 @@ extern void ata_port_wait_eh(struct ata_port *ap);
|
||||
extern int ata_link_abort(struct ata_link *link);
|
||||
extern int ata_port_abort(struct ata_port *ap);
|
||||
extern int ata_port_freeze(struct ata_port *ap);
|
||||
extern int sata_async_notification(struct ata_port *ap);
|
||||
|
||||
extern void ata_eh_freeze_port(struct ata_port *ap);
|
||||
extern void ata_eh_thaw_port(struct ata_port *ap);
|
||||
|
Loading…
Reference in New Issue
Block a user