Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 669a5db4 authored by Jeff Garzik's avatar Jeff Garzik
Browse files

[libata] Add a bunch of PATA drivers.



The vast majority of drivers and changes are from Alan Cox.  Albert Lee
contributed and maintains pata_pdc2027x.  Adrian Bunk, Andrew Morton,
and Tejun Heo contributed various minor fixes and updates.

Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent b01e86fe
Loading
Loading
Loading
Loading
+334 −0
Original line number Diff line number Diff line
@@ -145,6 +145,340 @@ config SATA_INTEL_COMBINED
	depends on IDE=y && !BLK_DEV_IDE_SATA && (SATA_AHCI || ATA_PIIX)
	default y

config PATA_ALI
	tristate "ALi PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the ALi ATA interfaces
	  found on the many ALi chipsets.

	  If unsure, say N.

config PATA_AMD
	tristate "AMD/NVidia PATA support (Experimental)"
	depends on PCI
	help
	  This option enables support for the AMD and NVidia PATA
	  interfaces found on the chipsets for Athlon/Athlon64.

	  If unsure, say N.

config PATA_ARTOP
	tristate "ARTOP 6210/6260 PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for ARTOP PATA controllers.

	  If unsure, say N.

config PATA_ATIIXP
	tristate "ATI PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the ATI ATA interfaces
	  found on the many ATI chipsets.

	  If unsure, say N.

config PATA_CMD64X
	tristate "CMD64x PATA support (Very Experimental)"
	depends on PCI&& EXPERIMENTAL
	help
	  This option enables support for the CMD64x series chips
	  except for the CMD640.

	  If unsure, say N.

config PATA_CS5520
	tristate "CS5510/5520 PATA support"
	depends on PCI
	help
	  This option enables support for the Cyrix 5510/5520
	  companion chip used with the MediaGX/Geode processor family.

	  If unsure, say N.

config PATA_CS5530
	tristate "CS5530 PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the Cyrix/NatSemi/AMD CS5530
	  companion chip used with the MediaGX/Geode processor family.

	  If unsure, say N.

config PATA_CS5535
	tristate "CS5535 PATA support (Experimental)"
	depends on PCI && X86 && !X86_64 && EXPERIMENTAL
	help
	  This option enables support for the NatSemi/AMD CS5535
	  companion chip used with the Geode processor family.

	  If unsure, say N.

config PATA_CYPRESS
	tristate "Cypress CY82C693 PATA support (Very Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the Cypress/Contaq CY82C693
	  chipset found in some Alpha systems

	  If unsure, say N.

config PATA_EFAR
	tristate "EFAR SLC90E66 support"
	depends on PCI
	help
	  This option enables support for the EFAR SLC90E66
	  IDE controller found on some older machines.

	  If unsure, say N.

config ATA_GENERIC
	tristate "Generic ATA support"
	depends on PCI
	help
	  This option enables support for generic BIOS configured
	  ATA controllers via the new ATA layer

	  If unsure, say N.

config PATA_HPT366
	tristate "HPT 366/368 PATA support (Very Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the HPT 366 and 368
	  PATA controllers via the new ATA layer.

	  If unsure, say N.

config PATA_HPT37X
	tristate "HPT 370/370A/371/372/374/302 PATA support (Very Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the majority of the later HPT
	  PATA controllers via the new ATA layer.

	  If unsure, say N.

config PATA_HPT3X2N
	tristate "HPT 372N/302N PATA support (Very Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the N variant HPT PATA
	  controllers via the new ATA layer

	  If unsure, say N.

config PATA_HPT3X3
	tristate "HPT 343/363 PATA support (Experimental)"
	depends on PCI
	help
	  This option enables support for the HPT 343/363
	  PATA controllers via the new ATA layer

	  If unsure, say N.

config PATA_ISAPNP
	tristate "ISA Plug and Play PATA support (Very Experimental)"
	depends on EXPERIMENTAL && ISAPNP
	help
	  This option enables support for ISA plug & play ATA
	  controllers such as those found on old soundcards.

	  If unsure, say N.

config PATA_IT8172
	tristate "IT8172 PATA support (Very Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the ITE 8172 PATA controller
	  via the new ATA layer.

	  If unsure, say N.

config PATA_IT821X
	tristate "IT821x PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the ITE 8211 and 8212
	  PATA controllers via the new ATA layer, including RAID
	  mode.

	  If unsure, say N.

config PATA_LEGACY
	tristate "Legacy ISA PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for ISA/VLB bus legacy PATA
	  ports and allows them to be accessed via the new ATA layer.

	  If unsure, say N.

config PATA_TRIFLEX
	tristate "Compaq Triflex PATA support"
	depends on PCI
	help
	  Enable support for the Compaq 'Triflex' IDE controller as found
	  on many Compaq Pentium-Pro systems, via the new ATA layer.

	  If unsure, say N.

config PATA_MPIIX
	tristate "Intel PATA MPIIX support"
	depends on PCI
	help
	  This option enables support for MPIIX PATA support.

	  If unsure, say N.

config PATA_OLDPIIX
	tristate "Intel PATA old PIIX support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for old(?) PIIX PATA support.

	  If unsure, say N.

config PATA_NETCELL
	tristate "NETCELL Revolution RAID support"
	depends on PCI
	help
	  This option enables support for the Netcell Revolution RAID
	  PATA controller.

	  If unsure, say N.

config PATA_NS87410
	tristate "Nat Semi NS87410 PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the National Semiconductor
	  NS87410 PCI-IDE controller.

	  If unsure, say N.

config PATA_OPTI
	tristate "OPTI621/6215 PATA support (Very Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables full PIO support for the early Opti ATA
	  controllers found on some old motherboards.

	  If unsure, say N.

config PATA_OPTIDMA
	tristate "OPTI FireStar PATA support (Veyr Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables DMA/PIO support for the later OPTi
	  controllers found on some old motherboards and in some
	  latops

	  If unsure, say N.

config PATA_PCMCIA
	tristate "PCMCIA PATA support"
	depends on PCMCIA
	help
	  This option enables support for PCMCIA ATA interfaces, including
	  compact flash card adapters via the new ATA layer.

	  If unsure, say N.

config PATA_PDC_OLD
	tristate "Older Promise PATA controller support (Very Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the Promise 20246, 20262, 20263,
	  20265 and 20267 adapters.

	  If unsure, say N.

config PATA_QDI
	tristate "QDI VLB PATA support"
	help
	  Support for QDI 6500 and 6580 PATA controllers on VESA local bus.

config PATA_RADISYS
	tristate "RADISYS 82600 PATA support (Very experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the RADISYS 82600
	  PATA controllers via the new ATA layer

	  If unsure, say N.

config PATA_RZ1000
	tristate "PC Tech RZ1000 PATA support"
	depends on PCI
	help
	  This option enables basic support for the PC Tech RZ1000/1
	  PATA controllers via the new ATA layer

	  If unsure, say N.

config PATA_SC1200
	tristate "SC1200 PATA support (Raving Lunatic)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the NatSemi/AMD SC1200 SoC
	  companion chip used with the Geode processor family.

	  If unsure, say N.

config PATA_SERVERWORKS
	tristate "SERVERWORKS OSB4/CSB5/CSB6/HT1000 PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for the Serverworks OSB4/CSB5/CSB6 and
	  HT1000 PATA controllers, via the new ATA layer.

	  If unsure, say N.

config PATA_PDC2027X
	tristate "Promise PATA 2027x support"
	depends on PCI
	help
	  This option enables support for Promise PATA pdc20268 to pdc20277 host adapters.

	  If unsure, say N.

config PATA_SIL680
	tristate "CMD / Silicon Image 680 PATA support"
	depends on PCI
	help
	  This option enables support for CMD / Silicon Image 680 PATA.

	  If unsure, say N.

config PATA_SIS
	tristate "SiS PATA support (Experimental)"
	depends on PCI && EXPERIMENTAL
	help
	  This option enables support for SiS PATA controllers

	  If unsure, say N.

config PATA_VIA
	tristate "VIA PATA support"
	depends on PCI
	help
	  This option enables support for the VIA PATA interfaces
	  found on the many VIA chipsets.

	  If unsure, say N.

config PATA_WINBOND
	tristate "Winbond SL82C105 PATA support"
	depends on PCI
	help
	  This option enables support for SL82C105 PATA devices found in the
	  Netwinder and some other systems

	  If unsure, say N.

endif
endmenu
+41 −0
Original line number Diff line number Diff line
@@ -17,5 +17,46 @@ obj-$(CONFIG_SATA_ULI) += sata_uli.o
obj-$(CONFIG_SATA_MV)		+= sata_mv.o
obj-$(CONFIG_PDC_ADMA)		+= pdc_adma.o

obj-$(CONFIG_PATA_ALI)		+= pata_ali.o
obj-$(CONFIG_PATA_AMD)		+= pata_amd.o
obj-$(CONFIG_PATA_ARTOP)	+= pata_artop.o
obj-$(CONFIG_PATA_ATIIXP)	+= pata_atiixp.o
obj-$(CONFIG_PATA_CMD64X)	+= pata_cmd64x.o
obj-$(CONFIG_PATA_CS5520)	+= pata_cs5520.o
obj-$(CONFIG_PATA_CS5530)	+= pata_cs5530.o
obj-$(CONFIG_PATA_CS5535)	+= pata_cs5535.o
obj-$(CONFIG_PATA_CYPRESS)	+= pata_cypress.o
obj-$(CONFIG_PATA_EFAR)		+= pata_efar.o
obj-$(CONFIG_PATA_HPT366)	+= pata_hpt366.o
obj-$(CONFIG_PATA_HPT37X)	+= pata_hpt37x.o
obj-$(CONFIG_PATA_HPT3X2N)	+= pata_hpt3x2n.o
obj-$(CONFIG_PATA_HPT3X3)	+= pata_hpt3x3.o
obj-$(CONFIG_PATA_ISAPNP)	+= pata_isapnp.o
obj-$(CONFIG_PATA_IT8172)	+= pata_it8172.o
obj-$(CONFIG_PATA_IT821X)	+= pata_it821x.o
obj-$(CONFIG_PATA_NETCELL)	+= pata_netcell.o
obj-$(CONFIG_PATA_NS87410)	+= pata_ns87410.o
obj-$(CONFIG_PATA_OPTI)		+= pata_opti.o
obj-$(CONFIG_PATA_OPTIDMA)	+= pata_optidma.o
obj-$(CONFIG_PATA_MPIIX)	+= pata_mpiix.o
obj-$(CONFIG_PATA_OLDPIIX)	+= pata_oldpiix.o
obj-$(CONFIG_PATA_PCMCIA)	+= pata_pcmcia.o
obj-$(CONFIG_PATA_PDC2027X)	+= pata_pdc2027x.o
obj-$(CONFIG_PATA_PDC_OLD)	+= pata_pdc202xx_old.o
obj-$(CONFIG_PATA_QDI)		+= pata_qdi.o
obj-$(CONFIG_PATA_RADISYS)	+= pata_radisys.o
obj-$(CONFIG_PATA_RZ1000)	+= pata_rz1000.o
obj-$(CONFIG_PATA_SC1200)	+= pata_sc1200.o
obj-$(CONFIG_PATA_SERVERWORKS)	+= pata_serverworks.o
obj-$(CONFIG_PATA_SIL680)	+= pata_sil680.o
obj-$(CONFIG_PATA_VIA)		+= pata_via.o
obj-$(CONFIG_PATA_WINBOND)	+= pata_sl82c105.o
obj-$(CONFIG_PATA_SIS)		+= pata_sis.o
obj-$(CONFIG_PATA_TRIFLEX)	+= pata_triflex.o
# Should be last but one libata driver
obj-$(CONFIG_ATA_GENERIC)	+= ata_generic.o
# Should be last libata driver
obj-$(CONFIG_PATA_LEGACY)	+= pata_legacy.o

libata-objs	:= libata-core.o libata-scsi.o libata-sff.o libata-eh.o
+252 −0
Original line number Diff line number Diff line
/*
 *  ata_generic.c - Generic PATA/SATA controller driver.
 *  Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved.
 *
 *  Elements from ide/pci/generic.c 
 *	    Copyright (C) 2001-2002	Andre Hedrick <andre@linux-ide.org>
 *	    Portions (C) Copyright 2002  Red Hat Inc <alan@redhat.com>
 *
 *  May be copied or modified under the terms of the GNU General Public License
 *  
 *  Driver for PCI IDE interfaces implementing the standard bus mastering
 *  interface functionality. This assumes the BIOS did the drive set up and
 *  tuning for us. By default we do not grab all IDE class devices as they
 *  may have other drivers or need fixups to avoid problems. Instead we keep
 *  a default list of stuff without documentation/driver that appears to
 *  work.  
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <scsi/scsi_host.h>
#include <linux/libata.h>

#define DRV_NAME "ata_generic"
#define DRV_VERSION "0.2.6"

/*
 *	A generic parallel ATA driver using libata
 */

/**
 *	generic_pre_reset		-	probe begin
 *	@ap: ATA port
 *
 *	Set up cable type and use generic probe init
 */
 
static int generic_pre_reset(struct ata_port *ap)
{
	ap->cbl = ATA_CBL_PATA80;
	return ata_std_prereset(ap);
}


/**
 *	generic_error_handler - Probe specified port on PATA host controller
 *	@ap: Port to probe
 *	@classes:
 *
 *	LOCKING:
 *	None (inherited from caller).
 */

 
static void generic_error_handler(struct ata_port *ap)
{
	ata_bmdma_drive_eh(ap, generic_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
}

/**
 *	generic_set_mode	-	mode setting
 *	@ap: interface to set up
 *
 *	Use a non standard set_mode function. We don't want to be tuned.
 *	The BIOS configured everything. Our job is not to fiddle. We
 *	read the dma enabled bits from the PCI configuration of the device
 *	and respect them. 
 */
 
static void generic_set_mode(struct ata_port *ap)
{
	int dma_enabled = 0;
	int i;

	/* Bits 5 and 6 indicate if DMA is active on master/slave */
	if (ap->ioaddr.bmdma_addr)
		dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
	
	for (i = 0; i < ATA_MAX_DEVICES; i++) {
		struct ata_device *dev = &ap->device[i];
		if (ata_dev_enabled(dev)) {
			/* We don't really care */
			dev->pio_mode = XFER_PIO_0;
			dev->dma_mode = XFER_MW_DMA_0;
			/* We do need the right mode information for DMA or PIO 
			   and this comes from the current configuration flags */
			if (dma_enabled & (1 << (5 + i))) {
				dev->xfer_mode = XFER_MW_DMA_0;
				dev->xfer_shift = ATA_SHIFT_MWDMA;
				dev->flags &= ~ATA_DFLAG_PIO;
			} else {
				dev->xfer_mode = XFER_PIO_0;
				dev->xfer_shift = ATA_SHIFT_PIO;
				dev->flags |= ATA_DFLAG_PIO;
			}
		}
	}
}

static struct scsi_host_template generic_sht = {
	.module			= THIS_MODULE,
	.name			= DRV_NAME,
	.ioctl			= ata_scsi_ioctl,
	.queuecommand		= ata_scsi_queuecmd,
	.can_queue		= ATA_DEF_QUEUE,
	.this_id		= ATA_SHT_THIS_ID,
	.sg_tablesize		= LIBATA_MAX_PRD,
	.max_sectors		= ATA_MAX_SECTORS,
	.cmd_per_lun		= ATA_SHT_CMD_PER_LUN,
	.emulated		= ATA_SHT_EMULATED,
	.use_clustering		= ATA_SHT_USE_CLUSTERING,
	.proc_name		= DRV_NAME,
	.dma_boundary		= ATA_DMA_BOUNDARY,
	.slave_configure	= ata_scsi_slave_config,
	.bios_param		= ata_std_bios_param,
};

static struct ata_port_operations generic_port_ops = {
	.set_mode	= generic_set_mode,
	
	.port_disable	= ata_port_disable,
	.tf_load	= ata_tf_load,
	.tf_read	= ata_tf_read,
	.check_status 	= ata_check_status,
	.exec_command	= ata_exec_command,
	.dev_select 	= ata_std_dev_select,

	.bmdma_setup 	= ata_bmdma_setup,
	.bmdma_start 	= ata_bmdma_start,
	.bmdma_stop	= ata_bmdma_stop,
	.bmdma_status 	= ata_bmdma_status,
	
	.data_xfer	= ata_pio_data_xfer,

	.freeze		= ata_bmdma_freeze,
	.thaw		= ata_bmdma_thaw,
	.error_handler	= generic_error_handler,
	.post_internal_cmd = ata_bmdma_post_internal_cmd,

	.qc_prep 	= ata_qc_prep,
	.qc_issue	= ata_qc_issue_prot,
	.eng_timeout	= ata_eng_timeout,
	.irq_handler	= ata_interrupt,
	.irq_clear	= ata_bmdma_irq_clear,

	.port_start	= ata_port_start,
	.port_stop	= ata_port_stop,
	.host_stop	= ata_host_stop
};	
	
static int all_generic_ide;		/* Set to claim all devices */

/**
 *	ata_generic_init		-	attach generic IDE
 *	@dev: PCI device found
 *	@id: match entry
 *
 *	Called each time a matching IDE interface is found. We check if the
 *	interface is one we wish to claim and if so we perform any chip 
 *	specific hacks then let the ATA layer do the heavy lifting.
 */
 
static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
	u16 command;
	static struct ata_port_info info = {
		.sht = &generic_sht,
		.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
		.pio_mask = 0x1f,
		.mwdma_mask = 0x07,
		.udma_mask = 0x3f,
		.port_ops = &generic_port_ops
	};
	static struct ata_port_info *port_info[2] = { &info, &info };
		
	/* Don't use the generic entry unless instructed to do so */
	if (id->driver_data == 1 && all_generic_ide == 0)
		return -ENODEV;

	/* Devices that need care */
	if (dev->vendor == PCI_VENDOR_ID_UMC &&
	    dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
	    (!(PCI_FUNC(dev->devfn) & 1)))
		return -ENODEV;

	if (dev->vendor == PCI_VENDOR_ID_OPTI &&
	    dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
	    (!(PCI_FUNC(dev->devfn) & 1)))
		return -ENODEV;

	/* Don't re-enable devices in generic mode or we will break some
	   motherboards with disabled and unused IDE controllers */
	pci_read_config_word(dev, PCI_COMMAND, &command);
	if (!(command & PCI_COMMAND_IO))
		return -ENODEV;
		
	if (dev->vendor == PCI_VENDOR_ID_AL)
	    	ata_pci_clear_simplex(dev);

	return ata_pci_init_one(dev, port_info, 2);
}

static struct pci_device_id ata_generic[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), },
	{ PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), },
	{ PCI_DEVICE(PCI_VENDOR_ID_UMC,    PCI_DEVICE_ID_UMC_UM8673F), }, 
	{ PCI_DEVICE(PCI_VENDOR_ID_UMC,    PCI_DEVICE_ID_UMC_UM8886A), },
	{ PCI_DEVICE(PCI_VENDOR_ID_UMC,    PCI_DEVICE_ID_UMC_UM8886BF), },
	{ PCI_DEVICE(PCI_VENDOR_ID_HINT,   PCI_DEVICE_ID_HINT_VXPROII_IDE), },
	{ PCI_DEVICE(PCI_VENDOR_ID_VIA,    PCI_DEVICE_ID_VIA_82C561), },
	{ PCI_DEVICE(PCI_VENDOR_ID_OPTI,   PCI_DEVICE_ID_OPTI_82C558), },
	{ PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), },
	{ PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
	{ PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2),  },
	/* Must come last. If you add entries adjust this table appropriately */
	{ PCI_ANY_ID,		PCI_ANY_ID,			   PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 1},
	{ 0, },
};

static struct pci_driver ata_generic_pci_driver = {
	.name 		= DRV_NAME,
	.id_table	= ata_generic,
	.probe 		= ata_generic_init_one,
	.remove		= ata_pci_remove_one
};

static int __init ata_generic_init(void)
{
	return pci_module_init(&ata_generic_pci_driver);
}


static void __exit ata_generic_exit(void)
{
	pci_unregister_driver(&ata_generic_pci_driver);
}


MODULE_AUTHOR("Alan Cox");
MODULE_DESCRIPTION("low-level driver for generic ATA");
MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(pci, ata_generic);
MODULE_VERSION(DRV_VERSION);

module_init(ata_generic_init);
module_exit(ata_generic_exit);

module_param(all_generic_ide, int, 0);
+326 −110

File changed.

Preview size limit exceeded, changes collapsed.

drivers/ata/pata_ali.c

0 → 100644
+679 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading