// SPDX-License-Identifier: GPL-2.0-only /* * pata_sis.c - SiS ATA driver * * (C) 2005 Red Hat * (C) 2007,2009 Bartlomiej Zolnierkiewicz * * Based upon linux/drivers/ide/pci/sis5513.c * Copyright (C) 1999-2000 Andre Hedrick <[email protected]> * Copyright (C) 2002 Lionel Bouton <[email protected]>, Maintainer * Copyright (C) 2003 Vojtech Pavlik <[email protected]> * SiS Taiwan : for direct support and hardware. * Daniela Engert : for initial ATA100 advices and numerous others. * John Fremlin, Manfred Spraul, Dave Morgan, Peter Kjellerstedt : * for checking code correctness, providing patches. * Original tests and design on the SiS620 chipset. * ATA100 tests and design on the SiS735 chipset. * ATA16/33 support from specs * ATA133 support for SiS961/962 by L.C. Chang <[email protected]> * * * TODO * Check MWDMA on drives that don't support MWDMA speed pio cycles ? * More Testing */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/blkdev.h> #include <linux/delay.h> #include <linux/device.h> #include <scsi/scsi_host.h> #include <linux/libata.h> #include <linux/ata.h> #include "sis.h" #define DRV_NAME … #define DRV_VERSION … struct sis_chipset { … }; struct sis_laptop { … }; static const struct sis_laptop sis_laptop[] = …; static int sis_short_ata40(struct pci_dev *dev) { … } /** * sis_old_port_base - return PCI configuration base for dev * @adev: device * * Returns the base of the PCI configuration registers for this port * number. */ static int sis_old_port_base(struct ata_device *adev) { … } /** * sis_port_base - return PCI configuration base for dev * @adev: device * * Returns the base of the PCI configuration registers for this port * number. */ static int sis_port_base(struct ata_device *adev) { … } /** * sis_133_cable_detect - check for 40/80 pin * @ap: Port * * Perform cable detection for the later UDMA133 capable * SiS chipset. */ static int sis_133_cable_detect(struct ata_port *ap) { … } /** * sis_66_cable_detect - check for 40/80 pin * @ap: Port * * Perform cable detection on the UDMA66, UDMA100 and early UDMA133 * SiS IDE controllers. */ static int sis_66_cable_detect(struct ata_port *ap) { … } /** * sis_pre_reset - probe begin * @link: ATA link * @deadline: deadline jiffies for the operation * * Set up cable type and use generic probe init */ static int sis_pre_reset(struct ata_link *link, unsigned long deadline) { … } /** * sis_set_fifo - Set RWP fifo bits for this device * @ap: Port * @adev: Device * * SIS chipsets implement prefetch/postwrite bits for each device * on both channels. This functionality is not ATAPI compatible and * must be configured according to the class of device present */ static void sis_set_fifo(struct ata_port *ap, struct ata_device *adev) { … } /** * sis_old_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring for. * * Set PIO mode for device, in host controller PCI config space. This * function handles PIO set up for all chips that are pre ATA100 and * also early ATA100 devices. * * LOCKING: * None (inherited from caller). */ static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_100_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring for. * * Set PIO mode for device, in host controller PCI config space. This * function handles PIO set up for ATA100 devices and early ATA133. * * LOCKING: * None (inherited from caller). */ static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_133_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring for. * * Set PIO mode for device, in host controller PCI config space. This * function handles PIO set up for the later ATA133 devices. * * LOCKING: * None (inherited from caller). */ static void sis_133_set_piomode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_old_set_dmamode - Initialize host controller PATA DMA timings * @ap: Port whose timings we are configuring * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. * Handles pre UDMA and UDMA33 devices. Supports MWDMA as well unlike * the old ide/pci driver. * * LOCKING: * None (inherited from caller). */ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_66_set_dmamode - Initialize host controller PATA DMA timings * @ap: Port whose timings we are configuring * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. * Handles UDMA66 and early UDMA100 devices. Supports MWDMA as well unlike * the old ide/pci driver. * * LOCKING: * None (inherited from caller). */ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_100_set_dmamode - Initialize host controller PATA DMA timings * @ap: Port whose timings we are configuring * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. * Handles UDMA66 and early UDMA100 devices. * * LOCKING: * None (inherited from caller). */ static void sis_100_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_133_early_set_dmamode - Initialize host controller PATA DMA timings * @ap: Port whose timings we are configuring * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. * Handles early SiS 961 bridges. * * LOCKING: * None (inherited from caller). */ static void sis_133_early_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_133_set_dmamode - Initialize host controller PATA DMA timings * @ap: Port whose timings we are configuring * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. * * LOCKING: * None (inherited from caller). */ static void sis_133_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * sis_133_mode_filter - mode selection filter * @adev: ATA device * @mask: received mask to manipulate and pass back * * Block UDMA6 on devices that do not support it. */ static unsigned int sis_133_mode_filter(struct ata_device *adev, unsigned int mask) { … } static const struct scsi_host_template sis_sht = …; static struct ata_port_operations sis_133_for_sata_ops = …; static struct ata_port_operations sis_base_ops = …; static struct ata_port_operations sis_133_ops = …; static struct ata_port_operations sis_133_early_ops = …; static struct ata_port_operations sis_100_ops = …; static struct ata_port_operations sis_66_ops = …; static struct ata_port_operations sis_old_ops = …; static const struct ata_port_info sis_info = …; static const struct ata_port_info sis_info33 = …; static const struct ata_port_info sis_info66 = …; static const struct ata_port_info sis_info100 = …; static const struct ata_port_info sis_info100_early = …; static const struct ata_port_info sis_info133 = …; const struct ata_port_info sis_info133_for_sata = …; static const struct ata_port_info sis_info133_early = …; /* Privately shared with the SiS180 SATA driver, not for use elsewhere */ EXPORT_SYMBOL_GPL(…); static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) { … } /** * sis_init_one - Register SiS ATA PCI device with kernel services * @pdev: PCI device to register * @ent: Entry in sis_pci_tbl matching with @pdev * * Called from kernel PCI layer. We probe for combined mode (sigh), * and then hand over control to libata, for it to do the rest. * * LOCKING: * Inherited from PCI layer (may sleep). * * RETURNS: * Zero on success, or -ERRNO value. */ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) { … } #ifdef CONFIG_PM_SLEEP static int sis_reinit_one(struct pci_dev *pdev) { … } #endif static const struct pci_device_id sis_pci_tbl[] = …; static struct pci_driver sis_pci_driver = …; module_pci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, sis_pci_tbl); MODULE_VERSION(…);