aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_sis.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-05-04 06:43:58 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-11 18:09:18 -0400
commit1626aeb881236c8cb022b5e4ca594146a951d669 (patch)
tree30f3457e4b5d76e62ee192fcc0d52b0ee8a829df /drivers/ata/pata_sis.c
parent920a4b1038e442700a1cfac77ea7e20bd615a2c3 (diff)
libata: clean up SFF init mess
The intention of using port_mask in SFF init helpers was to eventually support exoctic configurations such as combination of legacy and native port on the same controller. This never became actually necessary and the related code always has been subtly broken one way or the other. Now that new init model is in place, there is no reason to make common helpers capable of handling all corner cases. Exotic cases can simply dealt within LLDs as necessary. This patch removes port_mask handling in SFF init helpers. SFF init helpers don't take n_ports argument and interpret it into port_mask anymore. All information is carried via port_info. n_ports argument is dropped and always two ports are allocated. LLD can tell SFF to skip certain port by marking it dummy. Note that SFF code has been treating unuvailable ports this way for a long time until recent breakage fix from Linus and is consistent with how other drivers handle with unavailable ports. This fixes 1-port legacy host handling still broken after the recent native mode fix and simplifies SFF init logic. The following changes are made... * ata_pci_init_native_host() and ata_init_legacy_host() both now try to initialized whatever they can and mark failed ports dummy. They return 0 if any port is successfully initialized. * ata_pci_prepare_native_host() and ata_pci_init_one() now doesn't take n_ports argument. All info should be specified via port_info array. Always two ports are allocated. * ata_pci_init_bmdma() exported to be used by LLDs in exotic cases. * port_info handling in all LLDs are standardized - all port_info arrays are const stack variable named ppi. Unless the second port is different from the first, its port_info is specified as NULL (tells libata that it's identical to the last non-NULL port_info). * pata_hpt37x/hpt3x2n: don't modify static variable directly. Make an on-stack copy instead as ata_piix does. * pata_uli: It has 4 ports instead of 2. Don't use ata_pci_prepare_native_host(). Allocate the host explicitly and use init helpers. It's simple enough. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_sis.c')
-rw-r--r--drivers/ata/pata_sis.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 9b3774a4775..f2231267e01 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -38,8 +38,8 @@
38#define DRV_VERSION "0.5.1" 38#define DRV_VERSION "0.5.1"
39 39
40struct sis_chipset { 40struct sis_chipset {
41 u16 device; /* PCI host ID */ 41 u16 device; /* PCI host ID */
42 struct ata_port_info *info; /* Info block */ 42 const struct ata_port_info *info; /* Info block */
43 /* Probably add family, cable detect type etc here to clean 43 /* Probably add family, cable detect type etc here to clean
44 up code later */ 44 up code later */
45}; 45};
@@ -696,7 +696,7 @@ static const struct ata_port_operations sis_old_ops = {
696 .port_start = ata_port_start, 696 .port_start = ata_port_start,
697}; 697};
698 698
699static struct ata_port_info sis_info = { 699static const struct ata_port_info sis_info = {
700 .sht = &sis_sht, 700 .sht = &sis_sht,
701 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 701 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
702 .pio_mask = 0x1f, /* pio0-4 */ 702 .pio_mask = 0x1f, /* pio0-4 */
@@ -704,7 +704,7 @@ static struct ata_port_info sis_info = {
704 .udma_mask = 0, 704 .udma_mask = 0,
705 .port_ops = &sis_old_ops, 705 .port_ops = &sis_old_ops,
706}; 706};
707static struct ata_port_info sis_info33 = { 707static const struct ata_port_info sis_info33 = {
708 .sht = &sis_sht, 708 .sht = &sis_sht,
709 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 709 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
710 .pio_mask = 0x1f, /* pio0-4 */ 710 .pio_mask = 0x1f, /* pio0-4 */
@@ -712,35 +712,35 @@ static struct ata_port_info sis_info33 = {
712 .udma_mask = ATA_UDMA2, /* UDMA 33 */ 712 .udma_mask = ATA_UDMA2, /* UDMA 33 */
713 .port_ops = &sis_old_ops, 713 .port_ops = &sis_old_ops,
714}; 714};
715static struct ata_port_info sis_info66 = { 715static const struct ata_port_info sis_info66 = {
716 .sht = &sis_sht, 716 .sht = &sis_sht,
717 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 717 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
718 .pio_mask = 0x1f, /* pio0-4 */ 718 .pio_mask = 0x1f, /* pio0-4 */
719 .udma_mask = ATA_UDMA4, /* UDMA 66 */ 719 .udma_mask = ATA_UDMA4, /* UDMA 66 */
720 .port_ops = &sis_66_ops, 720 .port_ops = &sis_66_ops,
721}; 721};
722static struct ata_port_info sis_info100 = { 722static const struct ata_port_info sis_info100 = {
723 .sht = &sis_sht, 723 .sht = &sis_sht,
724 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 724 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
725 .pio_mask = 0x1f, /* pio0-4 */ 725 .pio_mask = 0x1f, /* pio0-4 */
726 .udma_mask = ATA_UDMA5, 726 .udma_mask = ATA_UDMA5,
727 .port_ops = &sis_100_ops, 727 .port_ops = &sis_100_ops,
728}; 728};
729static struct ata_port_info sis_info100_early = { 729static const struct ata_port_info sis_info100_early = {
730 .sht = &sis_sht, 730 .sht = &sis_sht,
731 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 731 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
732 .udma_mask = ATA_UDMA5, 732 .udma_mask = ATA_UDMA5,
733 .pio_mask = 0x1f, /* pio0-4 */ 733 .pio_mask = 0x1f, /* pio0-4 */
734 .port_ops = &sis_66_ops, 734 .port_ops = &sis_66_ops,
735}; 735};
736struct ata_port_info sis_info133 = { 736const struct ata_port_info sis_info133 = {
737 .sht = &sis_sht, 737 .sht = &sis_sht,
738 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 738 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
739 .pio_mask = 0x1f, /* pio0-4 */ 739 .pio_mask = 0x1f, /* pio0-4 */
740 .udma_mask = ATA_UDMA6, 740 .udma_mask = ATA_UDMA6,
741 .port_ops = &sis_133_ops, 741 .port_ops = &sis_133_ops,
742}; 742};
743static struct ata_port_info sis_info133_early = { 743static const struct ata_port_info sis_info133_early = {
744 .sht = &sis_sht, 744 .sht = &sis_sht,
745 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 745 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
746 .pio_mask = 0x1f, /* pio0-4 */ 746 .pio_mask = 0x1f, /* pio0-4 */
@@ -823,8 +823,8 @@ static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
823static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 823static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
824{ 824{
825 static int printed_version; 825 static int printed_version;
826 static struct ata_port_info *port_info[2]; 826 struct ata_port_info port;
827 struct ata_port_info *port; 827 const struct ata_port_info *ppi[] = { &port, NULL };
828 struct pci_dev *host = NULL; 828 struct pci_dev *host = NULL;
829 struct sis_chipset *chipset = NULL; 829 struct sis_chipset *chipset = NULL;
830 struct sis_chipset *sets; 830 struct sis_chipset *sets;
@@ -964,13 +964,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
964 if (chipset == NULL) 964 if (chipset == NULL)
965 return -ENODEV; 965 return -ENODEV;
966 966
967 port = chipset->info; 967 port = *chipset->info;
968 port->private_data = chipset; 968 port.private_data = chipset;
969 969
970 sis_fixup(pdev, chipset); 970 sis_fixup(pdev, chipset);
971 971
972 port_info[0] = port_info[1] = port; 972 return ata_pci_init_one(pdev, ppi);
973 return ata_pci_init_one(pdev, port_info, 2);
974} 973}
975 974
976static const struct pci_device_id sis_pci_tbl[] = { 975static const struct pci_device_id sis_pci_tbl[] = {