// SPDX-License-Identifier: GPL-2.0-only /* * pata_serverworks.c - Serverworks PATA for new ATA layer * (C) 2005 Red Hat Inc * (C) 2010 Bartlomiej Zolnierkiewicz * * based upon * * serverworks.c * * Copyright (C) 1998-2000 Michel Aubry * Copyright (C) 1998-2000 Andrzej Krzysztofowicz * Copyright (C) 1998-2000 Andre Hedrick <[email protected]> * Portions copyright (c) 2001 Sun Microsystems * * * RCC/ServerWorks IDE driver for Linux * * OSB4: `Open South Bridge' IDE Interface (fn 1) * supports UDMA mode 2 (33 MB/s) * * CSB5: `Champion South Bridge' IDE Interface (fn 1) * all revisions support UDMA mode 4 (66 MB/s) * revision A2.0 and up support UDMA mode 5 (100 MB/s) * * *** The CSB5 does not provide ANY register *** * *** to detect 80-conductor cable presence. *** * * CSB6: `Champion South Bridge' IDE Interface (optional: third channel) * * Documentation: * Available under NDA only. Errata info very hard to get. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/blkdev.h> #include <linux/delay.h> #include <scsi/scsi_host.h> #include <linux/libata.h> #define DRV_NAME … #define DRV_VERSION … #define SVWKS_CSB5_REVISION_NEW … #define SVWKS_CSB6_REVISION … /* Seagate Barracuda ATA IV Family drives in UDMA mode 5 * can overrun their FIFOs when used with the CSB5 */ static const char *csb_bad_ata100[] = …; /** * oem_cable - Dell/Sun serverworks cable detection * @ap: ATA port to do cable detect * * Dell PowerEdge and Sun Cobalt 'Alpine' hide the 40/80 pin select * for their interfaces in the top two bits of the subsystem ID. */ static int oem_cable(struct ata_port *ap) { … } struct sv_cable_table { … }; static struct sv_cable_table cable_detect[] = …; /** * serverworks_cable_detect - cable detection * @ap: ATA port * * Perform cable detection according to the device and subvendor * identifications */ static int serverworks_cable_detect(struct ata_port *ap) { … } /** * serverworks_is_csb - Check for CSB or OSB * @pdev: PCI device to check * * Returns true if the device being checked is known to be a CSB * series device. */ static u8 serverworks_is_csb(struct pci_dev *pdev) { … } /** * serverworks_osb4_filter - mode selection filter * @adev: ATA device * @mask: Mask of proposed modes * * Filter the offered modes for the device to apply controller * specific rules. OSB4 requires no UDMA for disks due to a FIFO * bug we hit. */ static unsigned int serverworks_osb4_filter(struct ata_device *adev, unsigned int mask) { … } /** * serverworks_csb_filter - mode selection filter * @adev: ATA device * @mask: Mask of proposed modes * * Check the blacklist and disable UDMA5 if matched */ static unsigned int serverworks_csb_filter(struct ata_device *adev, unsigned int mask) { … } /** * serverworks_set_piomode - set initial PIO mode data * @ap: ATA interface * @adev: ATA device * * Program the OSB4/CSB5 timing registers for PIO. The PIO register * load is done as a simple lookup. */ static void serverworks_set_piomode(struct ata_port *ap, struct ata_device *adev) { … } /** * serverworks_set_dmamode - set initial DMA mode data * @ap: ATA interface * @adev: ATA device * * Program the MWDMA/UDMA modes for the serverworks OSB4/CSB5 * chipset. The MWDMA mode values are pulled from a lookup table * while the chipset uses mode number for UDMA. */ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev) { … } static const struct scsi_host_template serverworks_osb4_sht = …; static const struct scsi_host_template serverworks_csb_sht = …; static struct ata_port_operations serverworks_osb4_port_ops = …; static struct ata_port_operations serverworks_csb_port_ops = …; static int serverworks_fixup_osb4(struct pci_dev *pdev) { … } static int serverworks_fixup_csb(struct pci_dev *pdev) { … } static void serverworks_fixup_ht1000(struct pci_dev *pdev) { … } static int serverworks_fixup(struct pci_dev *pdev) { … } static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) { … } #ifdef CONFIG_PM_SLEEP static int serverworks_reinit_one(struct pci_dev *pdev) { … } #endif static const struct pci_device_id serverworks[] = …; static struct pci_driver serverworks_pci_driver = …; module_pci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, serverworks); MODULE_VERSION(…);