// SPDX-License-Identifier: GPL-2.0-only /* * pata_oldpiix.c - Intel PATA/SATA controllers * * (C) 2005 Red Hat * * Some parts based on ata_piix.c by Jeff Garzik and others. * * Early PIIX differs significantly from the later PIIX as it lacks * SITRE and the slave timing registers. This means that you have to * set timing per channel, or be clever. Libata tells us whenever it * does drive selection and we use this to reload the timings. * * Because of these behaviour differences PIIX gets its own driver module. */ #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> #define DRV_NAME … #define DRV_VERSION … /** * oldpiix_pre_reset - probe begin * @link: ATA link * @deadline: deadline jiffies for the operation * * Set up cable type and use generic probe init */ static int oldpiix_pre_reset(struct ata_link *link, unsigned long deadline) { … } /** * oldpiix_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device whose timings we are configuring * * Set PIO mode for device, in host controller PCI config space. * * LOCKING: * None (inherited from caller). */ static void oldpiix_set_piomode (struct ata_port *ap, struct ata_device *adev) { … } /** * oldpiix_set_dmamode - Initialize host controller PATA DMA timings * @ap: Port whose timings we are configuring * @adev: Device to program * * Set MWDMA mode for device, in host controller PCI config space. * * LOCKING: * None (inherited from caller). */ static void oldpiix_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * oldpiix_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap * this interface so that we can load the correct ATA timings if * necessary. Our logic also clears TIME0/TIME1 for the other device so * that, even if we get this wrong, cycles to the other device will * be made PIO0. */ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc) { … } static const struct scsi_host_template oldpiix_sht = …; static struct ata_port_operations oldpiix_pata_ops = …; /** * oldpiix_init_one - Register PIIX ATA PCI device with kernel services * @pdev: PCI device to register * @ent: Entry in oldpiix_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 oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) { … } static const struct pci_device_id oldpiix_pci_tbl[] = …; static struct pci_driver oldpiix_pci_driver = …; module_pci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, oldpiix_pci_tbl); MODULE_VERSION(…);