User Tools

Site Tools


sata_port_multipliers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sata_port_multipliers [2019/04/24 10:56]
rpjday [struct ata_link]
sata_port_multipliers [2019/04/24 12:30] (current)
rpjday [struct ata_device]
Line 14: Line 14:
       * Makefile       * Makefile
       * libata-pmp.c       * libata-pmp.c
 +      * libata-eh.c
  
 ===== Build files [drivers/​ata] ===== ===== Build files [drivers/​ata] =====
Line 109: Line 110:
         ATA_FLAG_PMP ​           = (1 << 19), /* controller supports PMP */         ATA_FLAG_PMP ​           = (1 << 19), /* controller supports PMP */
         ...         ...
 +</​code>​
 +
 +<​code>​
 +struct ata_port_operations {
 +        ...
 +        void (*pmp_attach)(struct ata_port *ap);
 +        void (*pmp_detach)(struct ata_port *ap);
 +        ...
 +</​code>​
 +
 +<​code>​
 +#ifdef CONFIG_SATA_PMP
 +static inline bool sata_pmp_supported(struct ata_port *ap)
 +{
 +        return ap->​flags & ATA_FLAG_PMP;​
 +}
 +
 +static inline bool sata_pmp_attached(struct ata_port *ap)
 +{
 +        return ap->​nr_pmp_links != 0;
 +}
 +
 +static inline bool ata_is_host_link(const struct ata_link *link)
 +{
 +        return link == &​link->​ap->​link || link == link->​ap->​slave_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 */
 </​code>​ </​code>​
  
Line 138: Line 181:
         unsigned int            class; ​         /* ATA_DEV_xxx */         unsigned int            class; ​         /* ATA_DEV_xxx */
         ...         ...
 +        union {
 +                u16             ​id[ATA_ID_WORDS];​ /* IDENTIFY xxx DEVICE data */
 +                u32             ​gscr[SATA_PMP_GSCR_DWORDS];​ /* PMP GSCR block */
 +        } ____cacheline_aligned;​
 +
 </​code>​ </​code>​
  
Line 151: Line 199:
         int                     ​pmp; ​           /* port multiplier port # */         int                     ​pmp; ​           /* port multiplier port # */
         ...         ...
 +        struct ata_device ​      ​device[ATA_MAX_DEVICES];​
 </​code>​ </​code>​
  
Line 164: Line 213:
         unsigned long           ​flags; ​ /* ATA_FLAG_xxx */         unsigned long           ​flags; ​ /* ATA_FLAG_xxx */
         ...         ...
 +        struct ata_link ​        ​link; ​          /* host default link */
 +        struct ata_link ​        ​*slave_link; ​   /* see ata_slave_link_init() */
 +
         int                     ​nr_pmp_links; ​  /* nr of available PMP links */         int                     ​nr_pmp_links; ​  /* nr of available PMP links */
         struct ata_link ​        ​*pmp_link; ​     /* array of PMP links */         struct ata_link ​        ​*pmp_link; ​     /* array of PMP links */
Line 172: Line 224:
 </​code>​ </​code>​
  
-===== libata-pmp.c =====+===== drivers/​ata/​ ===== 
 + 
 +==== libata-eh.c ==== 
 + 
 +<​code>​ 
 +static int ata_eh_revalidate_and_attach(struct ata_link *link, 
 + struct ata_device **r_failed_dev) 
 +
 + struct ata_port *ap = link->​ap;​ 
 + struct ata_eh_context *ehc = &​link->​eh_context;​ 
 + struct ata_device *dev; 
 +        ... 
 +        ata_for_each_dev(dev,​ link, ALL_REVERSE) { 
 +                ... 
 +                dev->​class = ehc->​classes[dev->​devno];​ 
 + 
 +                if (dev->​class == ATA_DEV_PMP) 
 +                        rc = sata_pmp_attach(dev);​ 
 +                else 
 +                        ...    
 +</​code>​ 
 + 
 +==== libata-pmp.c ==== 
 + 
 +=== sata_pmp_configure() ​===
sata_port_multipliers.1556103402.txt.gz · Last modified: 2019/04/24 10:56 by rpjday