diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-06 05:36:22 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:30 -0400 |
commit | 9af5c9c97dc9d599281778864c72b385f0c63341 (patch) | |
tree | 8359986bd42c4a9a5b1993078aa9ee4c7971ac3d /include/linux/libata.h | |
parent | 640fdb504941fa2b9f6f274716fc9f97f2bf6bff (diff) |
libata-link: introduce ata_link
Introduce ata_link. It abstracts PHY and sits between ata_port and
ata_device. This new level of abstraction is necessary to support
SATA Port Multiplier, which basically adds a bunch of links (PHYs) to
a ATA host port. Fields related to command execution, spd_limit and
EH are per-link and thus moved to ata_link.
This patch only defines the host link. Multiple link handling will be
added later. Also, a lot of ap->link derefences are added but many of
them will be removed as each part is converted to deal directly with
ata_link instead of ata_port.
This patch introduces no behavior change.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index a67bb9075e9b..ca4493125fa0 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -436,7 +436,7 @@ struct ata_ering { | |||
436 | }; | 436 | }; |
437 | 437 | ||
438 | struct ata_device { | 438 | struct ata_device { |
439 | struct ata_port *ap; | 439 | struct ata_link *link; |
440 | unsigned int devno; /* 0 or 1 */ | 440 | unsigned int devno; /* 0 or 1 */ |
441 | unsigned long flags; /* ATA_DFLAG_xxx */ | 441 | unsigned long flags; /* ATA_DFLAG_xxx */ |
442 | unsigned int horkage; /* List of broken features */ | 442 | unsigned int horkage; /* List of broken features */ |
@@ -510,6 +510,24 @@ struct ata_acpi_gtm { | |||
510 | u32 flags; | 510 | u32 flags; |
511 | } __packed; | 511 | } __packed; |
512 | 512 | ||
513 | struct ata_link { | ||
514 | struct ata_port *ap; | ||
515 | |||
516 | unsigned int active_tag; /* active tag on this link */ | ||
517 | u32 sactive; /* active NCQ commands */ | ||
518 | |||
519 | unsigned int hw_sata_spd_limit; | ||
520 | unsigned int sata_spd_limit; | ||
521 | unsigned int sata_spd; /* current SATA PHY speed */ | ||
522 | |||
523 | /* record runtime error info, protected by host_set lock */ | ||
524 | struct ata_eh_info eh_info; | ||
525 | /* EH context */ | ||
526 | struct ata_eh_context eh_context; | ||
527 | |||
528 | struct ata_device device[ATA_MAX_DEVICES]; | ||
529 | }; | ||
530 | |||
513 | struct ata_port { | 531 | struct ata_port { |
514 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ | 532 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ |
515 | const struct ata_port_operations *ops; | 533 | const struct ata_port_operations *ops; |
@@ -533,23 +551,12 @@ struct ata_port { | |||
533 | unsigned int mwdma_mask; | 551 | unsigned int mwdma_mask; |
534 | unsigned int udma_mask; | 552 | unsigned int udma_mask; |
535 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ | 553 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ |
536 | unsigned int hw_sata_spd_limit; | ||
537 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ | ||
538 | unsigned int sata_spd; /* current SATA PHY speed */ | ||
539 | |||
540 | /* record runtime error info, protected by host lock */ | ||
541 | struct ata_eh_info eh_info; | ||
542 | /* EH context owned by EH */ | ||
543 | struct ata_eh_context eh_context; | ||
544 | |||
545 | struct ata_device device[ATA_MAX_DEVICES]; | ||
546 | 554 | ||
547 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; | 555 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; |
548 | unsigned long qc_allocated; | 556 | unsigned long qc_allocated; |
549 | unsigned int qc_active; | 557 | unsigned int qc_active; |
550 | 558 | ||
551 | unsigned int active_tag; | 559 | struct ata_link link; /* host default link */ |
552 | u32 sactive; | ||
553 | 560 | ||
554 | struct ata_port_stats stats; | 561 | struct ata_port_stats stats; |
555 | struct ata_host *host; | 562 | struct ata_host *host; |
@@ -912,8 +919,11 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
912 | #define ata_port_printk(ap, lv, fmt, args...) \ | 919 | #define ata_port_printk(ap, lv, fmt, args...) \ |
913 | printk(lv"ata%u: "fmt, (ap)->print_id , ##args) | 920 | printk(lv"ata%u: "fmt, (ap)->print_id , ##args) |
914 | 921 | ||
922 | #define ata_link_printk(link, lv, fmt, args...) \ | ||
923 | printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args) | ||
924 | |||
915 | #define ata_dev_printk(dev, lv, fmt, args...) \ | 925 | #define ata_dev_printk(dev, lv, fmt, args...) \ |
916 | printk(lv"ata%u.%02u: "fmt, (dev)->ap->print_id, (dev)->devno , ##args) | 926 | printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, (dev)->devno , ##args) |
917 | 927 | ||
918 | /* | 928 | /* |
919 | * ata_eh_info helpers | 929 | * ata_eh_info helpers |
@@ -1149,7 +1159,7 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf) | |||
1149 | { | 1159 | { |
1150 | memset(tf, 0, sizeof(*tf)); | 1160 | memset(tf, 0, sizeof(*tf)); |
1151 | 1161 | ||
1152 | tf->ctl = dev->ap->ctl; | 1162 | tf->ctl = dev->link->ap->ctl; |
1153 | if (dev->devno == 0) | 1163 | if (dev->devno == 0) |
1154 | tf->device = ATA_DEVICE_OBS; | 1164 | tf->device = ATA_DEVICE_OBS; |
1155 | else | 1165 | else |