is there a simple graphic of SATA port multiplier structures?

Robert P. J. Day rpjday at crashcourse.ca
Tue Apr 23 13:00:18 EDT 2019


  was just asked to take a look at how SATA II port multipliers are
supported in the linux kernel and, in the midst of all the code and
header files, what seems to be missing is a simple graphic of the main
structures and how many of them there are. let me elucidate.

  imagine, say, a 1-to-4 PMP -- single port multiplexing to four SATA
HDDs. from include/linux/libata.h, i can see the ATA-related
structures that will be involved, but it would be just ducky if there
was a short description as to *how* *many* of each would be involved
in this scenario; that is, a simple counting demonstration would be
massively informative.

  first, it appears that there would be a single ata_port structure:

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 */
        ... snip ...

where one of the possible "flags" settings is:

        ATA_FLAG_PMP            = (1 << 19), /* controller supports PMP */

so, having only glanced at all of this so far, i assume i would have
one "struct ata_port" with that flag set.

  on the other hand, it would appear i would have four "struct
ata_link"s:

struct ata_link {
        struct ata_port         *ap;
        int                     pmp;            /* port multiplier port # */
        ... snip ...

finally, what about "struct ata_device":

struct ata_device {
        struct ata_link         *link;
        unsigned int            devno;          /* 0 or 1 */
        ... snip ...

not having read any further just yet, it's not clear whether there
would be one or four of those, depending on how libata views the
storage devices themselves, but i'm sure i'll figure it out as i keep
reading.

  in the end, it would be terrifically useful if there was a simple
example of how all these structures connected to support a basic
scenario. is that written down anywhere? it doesn't need to be crazy
comprehensive, just the enumeration of the structures involved.

  thoughts?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



More information about the Kernelnewbies mailing list