/* * pata_ali.c - ALI 15x3 PATA for new ATA layer * (C) 2005 Red Hat Inc * * based in part upon * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 * * Copyright (C) 1998-2000 Michel Aubry, Maintainer * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer * Copyright (C) 1999-2000 CJ, [email protected], Maintainer * * Copyright (C) 1998-2000 Andre Hedrick ([email protected]) * May be copied or modified under the terms of the GNU General Public License * Copyright (C) 2002 Alan Cox <[email protected]> * ALi (now ULi M5228) support by Clear Zhang <[email protected]> * * Documentation * Chipset documentation available under NDA only * * TODO/CHECK * Cannot have ATAPI on both master & slave for rev < c2 (???) but * otherwise should do atapi DMA (For now for old we do PIO only for * ATAPI) * Review Sunblade workaround. */ #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> #include <linux/dmi.h> #define DRV_NAME … #define DRV_VERSION … static int ali_atapi_dma; module_param_named(atapi_dma, ali_atapi_dma, int, 0644); MODULE_PARM_DESC(…) …; static struct pci_dev *ali_isa_bridge; /* * Cable special cases */ static const struct dmi_system_id cable_dmi_table[] = …; static int ali_cable_override(struct pci_dev *pdev) { … } /** * ali_c2_cable_detect - cable detection * @ap: ATA port * * Perform cable detection for C2 and later revisions */ static int ali_c2_cable_detect(struct ata_port *ap) { … } /** * ali_20_filter - filter for earlier ALI DMA * @adev: ATA device * @mask: received mask to manipulate and pass back * * Ensure that we do not do DMA on CD devices. We may be able to * fix that later on. Also ensure we do not do UDMA on WDC drives */ static unsigned int ali_20_filter(struct ata_device *adev, unsigned int mask) { … } /** * ali_fifo_control - FIFO manager * @ap: ALi channel to control * @adev: device for FIFO control * @on: 0 for off 1 for on * * Enable or disable the FIFO on a given device. Because of the way the * ALi FIFO works it provides a boost on ATA disk but can be confused by * ATAPI and we must therefore manage it. */ static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int on) { … } /** * ali_program_modes - load mode registers * @ap: ALi channel to load * @adev: Device the timing is for * @t: timing data * @ultra: UDMA timing or zero for off * * Loads the timing registers for cmd/data and disable UDMA if * ultra is zero. If ultra is set then load and enable the UDMA * timing but do not touch the command/data timing. */ static void ali_program_modes(struct ata_port *ap, struct ata_device *adev, struct ata_timing *t, u8 ultra) { … } /** * ali_set_piomode - set initial PIO mode data * @ap: ATA interface * @adev: ATA device * * Program the ALi registers for PIO mode. */ static void ali_set_piomode(struct ata_port *ap, struct ata_device *adev) { … } /** * ali_set_dmamode - set initial DMA mode data * @ap: ATA interface * @adev: ATA device * * Program the ALi registers for DMA mode. */ static void ali_set_dmamode(struct ata_port *ap, struct ata_device *adev) { … } /** * ali_warn_atapi_dma - Warn about ATAPI DMA disablement * @adev: Device * * Whine about ATAPI DMA disablement if @adev is an ATAPI device. * Can be used as ->dev_config. */ static void ali_warn_atapi_dma(struct ata_device *adev) { … } /** * ali_lock_sectors - Keep older devices to 255 sector mode * @adev: Device * * Called during the bus probe for each device that is found. We use * this call to lock the sector count of the device to 255 or less on * older ALi controllers. If we didn't do this then large I/O's would * require LBA48 commands which the older ALi requires are issued by * slower PIO methods */ static void ali_lock_sectors(struct ata_device *adev) { … } /** * ali_check_atapi_dma - DMA check for most ALi controllers * @qc: Command to complete * * Called to decide whether commands should be sent by DMA or PIO */ static int ali_check_atapi_dma(struct ata_queued_cmd *qc) { … } static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes) { … } static const struct scsi_host_template ali_sht = …; /* * Port operations for PIO only ALi */ static struct ata_port_operations ali_early_port_ops = …; static const struct ata_port_operations ali_dma_base_ops = …; /* * Port operations for DMA capable ALi without cable * detect */ static struct ata_port_operations ali_20_port_ops = …; /* * Port operations for DMA capable ALi with cable detect */ static struct ata_port_operations ali_c2_port_ops = …; /* * Port operations for DMA capable ALi with cable detect */ static struct ata_port_operations ali_c4_port_ops = …; /* * Port operations for DMA capable ALi with cable detect and LBA48 */ static struct ata_port_operations ali_c5_port_ops = …; /** * ali_init_chipset - chip setup function * @pdev: PCI device of ATA controller * * Perform the setup on the device that must be done both at boot * and at resume time. */ static void ali_init_chipset(struct pci_dev *pdev) { … } /** * ali_init_one - discovery callback * @pdev: PCI device ID * @id: PCI table info * * An ALi IDE interface has been discovered. Figure out what revision * and perform configuration work before handing it to the ATA layer */ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) { … } #ifdef CONFIG_PM_SLEEP static int ali_reinit_one(struct pci_dev *pdev) { … } #endif static const struct pci_device_id ali[] = …; static struct pci_driver ali_pci_driver = …; static int __init ali_init(void) { … } static void __exit ali_exit(void) { … } MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, ali); MODULE_VERSION(…); module_init(…) …; module_exit(ali_exit);