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:45] rpjdaysata_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/ata] ===== ===== Build files [drivers/ata] =====
Line 111: Line 112:
 </code> </code>
  
-===== Structures =====+<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> 
 + 
 +===== Structures [libata.h] =====
  
 ==== struct ata_device ==== ==== struct ata_device ====
 +
 +''ata_device'' %%->%% ''ata_link'':
  
 <code> <code>
Line 136: 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 142: Line 192:
 ==== struct ata_link ==== ==== struct ata_link ====
  
-===== libata-pmp.c =====+''ata_link'' %%->%% ''ata_port'': 
 + 
 +<code> 
 +struct ata_link { 
 +        struct ata_port         *ap; 
 +        int                     pmp;            /* port multiplier port # */ 
 +        ... 
 +        struct ata_device       device[ATA_MAX_DEVICES]; 
 +</code> 
 + 
 +==== struct ata_port ==== 
 + 
 +<code> 
 +struct ata_port { 
 +        struct Scsi_Host        *scsi_host; /* our co-allocated scsi host */ 
 +        struct ata_port_operations *ops; 
 +        spinlock_t              *lock; 
 +        /* Flags owned by the EH context. Only EH should touch these once the 
 +           port is active */ 
 +        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 */ 
 +        struct ata_link         *pmp_link;      /* array of PMP links */ 
 +        ... 
 +        struct ata_host         *host; 
 +        struct device           *dev; 
 +        ... 
 +</code> 
 + 
 +===== 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.1556102748.txt.gz
  • Last modified: 2019/04/24 10:45
  • by rpjday