Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| sata_port_multipliers [2019/04/24 10:41] – [Build files] rpjday | sata_port_multipliers [2019/04/24 12:30] (current) – [struct ata_device] rpjday | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| * Makefile | * Makefile | ||
| * libata-pmp.c | * libata-pmp.c | ||
| + | * libata-eh.c | ||
| ===== Build files [drivers/ | ===== Build files [drivers/ | ||
| Line 111: | Line 112: | ||
| </ | </ | ||
| - | ===== libata-pmp.c ===== | + | < |
| + | struct ata_port_operations { | ||
| + | ... | ||
| + | void (*pmp_attach)(struct ata_port *ap); | ||
| + | void (*pmp_detach)(struct ata_port *ap); | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | #ifdef CONFIG_SATA_PMP | ||
| + | static inline bool sata_pmp_supported(struct ata_port *ap) | ||
| + | { | ||
| + | return ap-> | ||
| + | } | ||
| + | |||
| + | static inline bool sata_pmp_attached(struct ata_port *ap) | ||
| + | { | ||
| + | return ap-> | ||
| + | } | ||
| + | |||
| + | static inline bool ata_is_host_link(const struct ata_link *link) | ||
| + | { | ||
| + | return link == & | ||
| + | } | ||
| + | #else /* CONFIG_SATA_PMP */ | ||
| + | static inline bool sata_pmp_supported(struct ata_port *ap) | ||
| + | { | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | static inline bool sata_pmp_attached(struct ata_port *ap) | ||
| + | { | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | static inline bool ata_is_host_link(const struct ata_link *link) | ||
| + | { | ||
| + | return 1; | ||
| + | } | ||
| + | #endif /* CONFIG_SATA_PMP */ | ||
| + | </ | ||
| + | |||
| + | ===== Structures [libata.h] ===== | ||
| + | |||
| + | ==== struct ata_device ==== | ||
| + | |||
| + | '' | ||
| + | |||
| + | < | ||
| + | struct ata_device { | ||
| + | struct ata_link | ||
| + | unsigned int devno; | ||
| + | unsigned int horkage; | ||
| + | unsigned long | ||
| + | struct scsi_device | ||
| + | void *private_data; | ||
| + | #ifdef CONFIG_ATA_ACPI | ||
| + | union acpi_object | ||
| + | unsigned int gtf_filter; | ||
| + | #endif | ||
| + | #ifdef CONFIG_SATA_ZPODD | ||
| + | void *zpodd; | ||
| + | #endif | ||
| + | struct device | ||
| + | /* n_sector is CLEAR_BEGIN, | ||
| + | u64 | ||
| + | u64 | ||
| + | unsigned int class; | ||
| + | ... | ||
| + | union { | ||
| + | u16 | ||
| + | u32 | ||
| + | } ____cacheline_aligned; | ||
| + | |||
| + | </ | ||
| + | |||
| + | '' | ||
| + | |||
| + | ==== struct ata_link ==== | ||
| + | |||
| + | '' | ||
| + | |||
| + | < | ||
| + | struct ata_link { | ||
| + | struct ata_port | ||
| + | int pmp; /* port multiplier port # */ | ||
| + | ... | ||
| + | struct ata_device | ||
| + | </ | ||
| + | |||
| + | ==== struct ata_port ==== | ||
| + | |||
| + | < | ||
| + | struct ata_port { | ||
| + | struct Scsi_Host | ||
| + | struct ata_port_operations *ops; | ||
| + | spinlock_t | ||
| + | /* Flags owned by the EH context. Only EH should touch these once the | ||
| + | port is active */ | ||
| + | unsigned long | ||
| + | ... | ||
| + | struct ata_link | ||
| + | struct ata_link | ||
| + | |||
| + | int | ||
| + | struct ata_link | ||
| + | ... | ||
| + | struct ata_host | ||
| + | struct device | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | ===== drivers/ | ||
| + | |||
| + | ==== libata-eh.c ==== | ||
| + | |||
| + | < | ||
| + | static int ata_eh_revalidate_and_attach(struct ata_link *link, | ||
| + | struct ata_device **r_failed_dev) | ||
| + | { | ||
| + | struct ata_port *ap = link-> | ||
| + | struct ata_eh_context *ehc = & | ||
| + | struct ata_device *dev; | ||
| + | ... | ||
| + | ata_for_each_dev(dev, | ||
| + | ... | ||
| + | dev-> | ||
| + | |||
| + | if (dev-> | ||
| + | rc = sata_pmp_attach(dev); | ||
| + | else | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | ==== libata-pmp.c ==== | ||
| + | |||
| + | === sata_pmp_configure() | ||