Commit cbb48783 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.14 IDE 59

Basically PCI driver handling reorganization. This is one step further
ahead toward the goal of fully modularized host chip drivers.

 - Adjust ide-scsi to the new error handling. Just don't try any device
   resets there.

 - Add unmasking of IRQ per default to the PMac PCI code.

 - Split up the crap table from ide-pci. Let the corresponding drivers do
   registration of the functions they provide. This small change makes
   this patch rather big.

 - Hard-code the number of ports requested for DMA engines. They are always
   precisely 8 on PCs. If you hove something different to deal with,
   well then please just provide your own init_dma method.

 - Remove the HDIO_GETGEO_BIG ioctl. Patch by Andries Brouwer. Applies
   unmodified.

 - Make ON_BOARD be equal 0, so we can spare ourself some typing in structure
   initialization.

 - Normalize the terminology in the host chip drivers. It will make spotting
   the tons of common code found there later easier.
parent 62a62049
......@@ -436,25 +436,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
return -EFAULT;
return(0);
}
case HDIO_GETGEO_BIG:
{
struct hd_big_geometry driver_geo;
if (hba[ctlr]->drv[dsk].cylinders) {
driver_geo.heads = hba[ctlr]->drv[dsk].heads;
driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
} else {
driver_geo.heads = 0xff;
driver_geo.sectors = 0x3f;
driver_geo.cylinders = hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
}
driver_geo.start=
hba[ctlr]->hd[minor(inode->i_rdev)].start_sect;
if (copy_to_user((void *) arg, &driver_geo,
sizeof( struct hd_big_geometry)))
return -EFAULT;
return(0);
}
case BLKRRPART:
return revalidate_logvol(inode->i_rdev, 1);
case BLKGETSIZE:
......
/*
* linux/drivers/ide/aec62xx.c Version 0.09 June. 9, 2000
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* Version 0.09 June. 9, 2000
*
* Copyright (C) 1999-2000 Andre Hedrick (andre@linux-ide.org)
* May be copied or modified under the terms of the GNU General Public License
......@@ -25,6 +26,7 @@
#include <asm/irq.h>
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_AEC62XX_TIMINGS
......@@ -218,7 +220,7 @@ static byte pci_bus_clock_list_ultra (byte speed, struct chipset_bus_clock_list_
return 0x00;
}
static int aec6210_tune_chipset (ide_drive_t *drive, byte speed)
static int aec6210_tune_chipset(struct ata_device *drive, byte speed)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......@@ -254,7 +256,7 @@ static int aec6210_tune_chipset (ide_drive_t *drive, byte speed)
return(err);
}
static int aec6260_tune_chipset (ide_drive_t *drive, byte speed)
static int aec6260_tune_chipset(struct ata_device *drive, byte speed)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......@@ -291,7 +293,7 @@ static int aec6260_tune_chipset (ide_drive_t *drive, byte speed)
}
static int aec62xx_tune_chipset (ide_drive_t *drive, byte speed)
static int aec62xx_tune_chipset(struct ata_device *drive, byte speed)
{
if (drive->channel->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
return ((int) aec6210_tune_chipset(drive, speed));
......@@ -301,7 +303,7 @@ static int aec62xx_tune_chipset (ide_drive_t *drive, byte speed)
}
#ifdef CONFIG_BLK_DEV_IDEDMA
static int config_aec6210_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_aec6210_chipset_for_dma(struct ata_device *drive, byte ultra)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
......@@ -346,7 +348,7 @@ static int config_aec6210_chipset_for_dma (ide_drive_t *drive, byte ultra)
0);
}
static int config_aec6260_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_aec6260_chipset_for_dma(struct ata_device *drive, byte ultra)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
......@@ -394,7 +396,7 @@ static int config_aec6260_chipset_for_dma (ide_drive_t *drive, byte ultra)
0);
}
static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_chipset_for_dma(struct ata_device *drive, byte ultra)
{
switch(drive->channel->pci_dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP850UF:
......@@ -409,7 +411,7 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
#endif /* CONFIG_BLK_DEV_IDEDMA */
static void aec62xx_tune_drive (ide_drive_t *drive, byte pio)
static void aec62xx_tune_drive(struct ata_device *drive, byte pio)
{
byte speed;
......@@ -430,7 +432,7 @@ static void aec62xx_tune_drive (ide_drive_t *drive, byte pio)
}
#ifdef CONFIG_BLK_DEV_IDEDMA
static int config_drive_xfer_rate (ide_drive_t *drive)
static int config_drive_xfer_rate(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
int on = 1;
......@@ -490,7 +492,7 @@ int aec62xx_dmaproc(struct ata_device *drive)
#endif
#endif
unsigned int __init pci_init_aec62xx (struct pci_dev *dev)
static unsigned int __init aec62xx_init_chipset(struct pci_dev *dev)
{
if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
......@@ -508,16 +510,17 @@ unsigned int __init pci_init_aec62xx (struct pci_dev *dev)
return dev->irq;
}
unsigned int __init ata66_aec62xx(struct ata_channel *hwif)
static unsigned int __init aec62xx_ata66_check(struct ata_channel *ch)
{
byte mask = hwif->unit ? 0x02 : 0x01;
byte ata66 = 0;
u8 mask = ch->unit ? 0x02 : 0x01;
u8 ata66 = 0;
pci_read_config_byte(ch->pci_dev, 0x49, &ata66);
pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
return ((ata66 & mask) ? 0 : 1);
}
void __init ide_init_aec62xx(struct ata_channel *hwif)
static void __init aec62xx_init_channel(struct ata_channel *hwif)
{
#ifdef CONFIG_AEC62XX_TUNING
hwif->tuneproc = aec62xx_tune_drive;
......@@ -533,19 +536,58 @@ void __init ide_init_aec62xx(struct ata_channel *hwif)
#endif
}
void __init ide_dmacapable_aec62xx(struct ata_channel *hwif, unsigned long dmabase)
static void __init aec62xx_init_dma(struct ata_channel *hwif, unsigned long dmabase)
{
#ifdef CONFIG_AEC62XX_TUNING
unsigned long flags;
byte reg54h = 0;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
u8 reg54h = 0;
pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h);
pci_write_config_byte(hwif->pci_dev, 0x54, reg54h & ~(hwif->unit ? 0xF0 : 0x0F));
#endif
ata_init_dma(hwif, dmabase);
}
__restore_flags(flags); /* local CPU only */
#endif /* CONFIG_AEC62XX_TUNING */
ide_setup_dma(hwif, dmabase, 8);
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP850UF,
init_chipset: aec62xx_init_chipset,
init_channel: aec62xx_init_channel,
init_dma: aec62xx_init_dma,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: OFF_BOARD,
flags: ATA_F_SER | ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP860,
init_chipset: aec62xx_init_chipset,
ata66_check: aec62xx_ata66_check,
init_channel: aec62xx_init_channel,
enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
bootable: NEVER_BOARD,
flags: ATA_F_IRQ | ATA_F_NOADMA | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP860R,
init_chipset: aec62xx_init_chipset,
ata66_check: aec62xx_ata66_check,
init_channel: aec62xx_init_channel,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
};
int __init init_aec62xx(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -20,13 +20,14 @@
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_ALI_TIMINGS
......@@ -239,7 +240,7 @@ static byte chip_is_1543c_e;
byte ali_proc = 0;
static struct pci_dev *isa_dev;
static void ali15x3_tune_drive (ide_drive_t *drive, byte pio)
static void ali15x3_tune_drive(struct ata_device *drive, byte pio)
{
struct ata_timing *t;
struct ata_channel *hwif = drive->channel;
......@@ -303,7 +304,7 @@ static void ali15x3_tune_drive (ide_drive_t *drive, byte pio)
__restore_flags(flags);
}
static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed)
static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......@@ -352,13 +353,13 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed)
return (err);
}
static void config_chipset_for_pio (ide_drive_t *drive)
static void config_chipset_for_pio(struct ata_device *drive)
{
ali15x3_tune_drive(drive, 5);
}
#ifdef CONFIG_BLK_DEV_IDEDMA
static int config_chipset_for_dma (ide_drive_t *drive, byte ultra33)
static int config_chipset_for_dma(struct ata_device *drive, byte ultra33)
{
struct hd_driveid *id = drive->id;
byte speed = 0x00;
......@@ -408,7 +409,7 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra33)
return rval;
}
static byte ali15x3_can_ultra (ide_drive_t *drive)
static byte ali15x3_can_ultra(struct ata_device *drive)
{
#ifndef CONFIG_WDC_ALI15X3
struct hd_driveid *id = drive->id;
......@@ -429,7 +430,7 @@ static byte ali15x3_can_ultra (ide_drive_t *drive)
}
}
static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
static int ali15x3_config_drive_for_dma(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
......@@ -505,7 +506,7 @@ static int ali15x3_dmaproc(struct ata_device *drive)
}
#endif
unsigned int __init pci_init_ali15x3(struct pci_dev *dev)
static unsigned int __init ali15x3_init_chipset(struct pci_dev *dev)
{
unsigned long fixdma_base = pci_resource_start(dev, 4);
......@@ -543,7 +544,7 @@ unsigned int __init pci_init_ali15x3(struct pci_dev *dev)
* of UDMA66 transfers. It doesn't check the drives.
* But see note 2 below!
*/
unsigned int __init ata66_ali15x3(struct ata_channel *hwif)
static unsigned int __init ali15x3_ata66_check(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ata66 = 0;
......@@ -638,7 +639,7 @@ unsigned int __init ata66_ali15x3(struct ata_channel *hwif)
return(ata66);
}
void __init ide_init_ali15x3(struct ata_channel *hwif)
static void __init ali15x3_init_channel(struct ata_channel *hwif)
{
#ifndef CONFIG_SPARC64
byte ideic, inmir;
......@@ -694,13 +695,33 @@ void __init ide_init_ali15x3(struct ata_channel *hwif)
hwif->autodma = 0;
#else
hwif->autodma = 0;
#endif /* CONFIG_BLK_DEV_IDEDMA */
#endif
}
void __init ide_dmacapable_ali15x3(struct ata_channel *hwif, unsigned long dmabase)
static void __init ali15x3_init_dma(struct ata_channel *ch, unsigned long dmabase)
{
if ((dmabase) && (m5229_revision < 0x20)) {
if ((dmabase) && (m5229_revision < 0x20))
return;
}
ide_setup_dma(hwif, dmabase, 8);
ata_init_dma(ch, dmabase);
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_AL,
device: PCI_DEVICE_ID_AL_M5229,
init_chipset: ali15x3_init_chipset,
ata66_check: ali15x3_ata66_check,
init_channel: ali15x3_init_channel,
init_dma: ali15x3_init_dma,
enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
bootable: ON_BOARD
};
int __init init_ali15x3(void)
{
ata_register_chipset(&chipset);
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* $Id: amd74xx.c,v 2.8 2002/03/14 11:52:20 vojtech Exp $
*
* Copyright (c) 2000-2002 Vojtech Pavlik
......@@ -42,9 +43,11 @@
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
#define AMD_IDE_ENABLE (0x00 + amd_config->base)
#define AMD_IDE_CONFIG (0x01 + amd_config->base)
......@@ -298,7 +301,7 @@ int amd74xx_dmaproc(struct ata_device *drive)
* and initialize its drive independent registers.
*/
unsigned int __init pci_init_amd74xx(struct pci_dev *dev, const char *name)
static unsigned int __init amd74xx_init_chipset(struct pci_dev *dev)
{
unsigned char t;
unsigned int u;
......@@ -396,12 +399,12 @@ unsigned int __init pci_init_amd74xx(struct pci_dev *dev, const char *name)
return 0;
}
unsigned int __init ata66_amd74xx(struct ata_channel *hwif)
static unsigned int __init amd74xx_ata66_check(struct ata_channel *hwif)
{
return ((amd_enabled & amd_80w) >> hwif->unit) & 1;
}
void __init ide_init_amd74xx(struct ata_channel *hwif)
static void __init amd74xx_init_channel(struct ata_channel *hwif)
{
int i;
......@@ -432,9 +435,84 @@ void __init ide_init_amd74xx(struct ata_channel *hwif)
/*
* We allow the BM-DMA driver only work on enabled interfaces.
*/
static void __init amd74xx_init_dma(struct ata_channel *ch, unsigned long dmabase)
{
if ((amd_enabled >> ch->unit) & 1)
ata_init_dma(ch, dmabase);
}
void __init ide_dmacapable_amd74xx(struct ata_channel *hwif, unsigned long dmabase)
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_COBRA_7401,
init_chipset: amd74xx_init_chipset,
ata66_check: amd74xx_ata66_check,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_VIPER_7409,
init_chipset: amd74xx_init_chipset,
ata66_check: amd74xx_ata66_check,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_VIPER_7411,
init_chipset: amd74xx_init_chipset,
ata66_check: amd74xx_ata66_check,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_OPUS_7441,
init_chipset: amd74xx_init_chipset,
ata66_check: amd74xx_ata66_check,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_8111_IDE,
init_chipset: amd74xx_init_chipset,
ata66_check: amd74xx_ata66_check,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_NVIDIA,
device: PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,
init_chipset: amd74xx_init_chipset,
ata66_check: amd74xx_ata66_check,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x50,0x01,0x01}, {0x50,0x02,0x02}},
bootable: ON_BOARD
},
};
int __init init_amd74xx(void)
{
if ((amd_enabled >> hwif->unit) & 1)
ide_setup_dma(hwif, dmabase, 8);
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
/* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16
*
* linux/drivers/ide/cmd64x.c Version 1.22 June 9, 2000
*
......@@ -18,12 +20,13 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
#ifndef SPLIT_BYTE
#define SPLIT_BYTE(B,H,L) ((H)=(B>>4), (L)=(B-((B>>4)<<4)))
......@@ -1070,19 +1073,19 @@ static unsigned int cmd64x_pci_init(struct pci_dev *dev)
bmide_dev = dev;
cmd64x_display_info = &cmd64x_get_info;
}
#endif /* DISPLAY_CMD64X_TIMINGS && CONFIG_PROC_FS */
#endif
return 0;
}
unsigned int __init pci_init_cmd64x(struct pci_dev *dev)
static unsigned int __init cmd64x_init_chipset(struct pci_dev *dev)
{
if (dev->device == PCI_DEVICE_ID_CMD_680)
return cmd680_pci_init (dev);
return cmd64x_pci_init (dev);
}
unsigned int cmd680_ata66(struct ata_channel *hwif)
static unsigned int cmd680_ata66(struct ata_channel *hwif)
{
byte ata66 = 0;
byte addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
......@@ -1091,7 +1094,7 @@ unsigned int cmd680_ata66(struct ata_channel *hwif)
return (ata66 & 0x01) ? 1 : 0;
}
unsigned int cmd64x_ata66(struct ata_channel *hwif)
static unsigned int cmd64x_ata66(struct ata_channel *hwif)
{
byte ata66 = 0;
byte mask = (hwif->unit) ? 0x02 : 0x01;
......@@ -1100,7 +1103,7 @@ unsigned int cmd64x_ata66(struct ata_channel *hwif)
return (ata66 & mask) ? 1 : 0;
}
unsigned int __init ata66_cmd64x(struct ata_channel *hwif)
static unsigned int __init cmd64x_ata66_check(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
if (dev->device == PCI_DEVICE_ID_CMD_680)
......@@ -1108,7 +1111,7 @@ unsigned int __init ata66_cmd64x(struct ata_channel *hwif)
return cmd64x_ata66(hwif);
}
void __init ide_init_cmd64x(struct ata_channel *hwif)
static void __init cmd64x_init_channel(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int class_rev;
......@@ -1158,5 +1161,64 @@ void __init ide_init_cmd64x(struct ata_channel *hwif)
}
hwif->highmem = 1;
#endif /* CONFIG_BLK_DEV_IDEDMA */
#endif
}
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_643,
init_chipset: cmd64x_init_chipset,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_646,
init_chipset: cmd64x_init_chipset,
init_channel: cmd64x_init_channel,
enablebits: {{0x00,0x00,0x00}, {0x51,0x80,0x80}},
bootable: ON_BOARD,
flags: ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_648,
init_chipset: cmd64x_init_chipset,
ata66_check: cmd64x_ata66_check,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
flags: ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_649,
init_chipset: cmd64x_init_chipset,
ata66_check: cmd64x_ata66_check,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
flags: ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_680,
init_chipset: cmd64x_init_chipset,
ata66_check: cmd64x_ata66_check,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
flags: ATA_F_DMA
},
};
int __init init_cmd64x(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* linux/drivers/ide/cs5530.c Version 0.6 Mar. 18, 2000
*
* Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
......@@ -24,10 +25,12 @@
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include <asm/irq.h>
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_CS5530_TIMINGS
......@@ -243,7 +246,7 @@ int cs5530_dmaproc(struct ata_device *drive)
/*
* Initialize the cs5530 bridge for reliable IDE DMA operation.
*/
unsigned int __init pci_init_cs5530(struct pci_dev *dev)
static unsigned int __init pci_init_cs5530(struct pci_dev *dev)
{
struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
unsigned short pcicmd = 0;
......@@ -334,7 +337,7 @@ unsigned int __init pci_init_cs5530(struct pci_dev *dev)
* This gets invoked by the IDE driver once for each channel,
* and performs channel-specific pre-initialization before drive probing.
*/
void __init ide_init_cs5530(struct ata_channel *hwif)
static void __init ide_init_cs5530(struct ata_channel *hwif)
{
hwif->serialized = 1;
if (!hwif->dma_base) {
......@@ -364,3 +367,21 @@ void __init ide_init_cs5530(struct ata_channel *hwif)
}
}
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_CYRIX,
device: PCI_DEVICE_ID_CYRIX_5530_IDE,
init_chipset: pci_init_cs5530,
init_channel: ide_init_cs5530,
bootable: ON_BOARD,
flags: ATA_F_DMA
};
int __init init_cs5530(void)
{
ata_register_chipset(&chipset);
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* linux/drivers/ide/cy82c693.c Version 0.34 Dec. 13, 1999
*
* Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer
......@@ -48,12 +49,13 @@
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
/* the current version */
#define CY82_VERSION "CY82C693U driver v0.34 99-13-12 Andreas S. Krebs (akrebs@altavista.net)"
......@@ -383,7 +385,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
* the device prior to INIT.
*/
unsigned int __init pci_init_cy82c693(struct pci_dev *dev)
static unsigned int __init pci_init_cy82c693(struct pci_dev *dev)
{
#ifdef CY82C693_SETDMA_CLOCK
byte data;
......@@ -419,18 +421,18 @@ unsigned int __init pci_init_cy82c693(struct pci_dev *dev)
OUT_BYTE(CY82_INDEX_CTRLREG1, CY82_INDEX_PORT);
OUT_BYTE(data, CY82_DATA_PORT);
#if CY82C693_DEBUG_INFO
# if CY82C693_DEBUG_INFO
printk (KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n", dev->name, data);
#endif /* CY82C693_DEBUG_INFO */
# endif
#endif /* CY82C693_SETDMA_CLOCK */
#endif
return 0;
}
/*
* the init function - called for each ide channel once
*/
void __init ide_init_cy82c693(struct ata_channel *hwif)
static void __init ide_init_cy82c693(struct ata_channel *hwif)
{
hwif->chipset = ide_cy82c693;
hwif->tuneproc = cy82c693_tune_drive;
......@@ -445,5 +447,23 @@ void __init ide_init_cy82c693(struct ata_channel *hwif)
if (!noautodma)
hwif->autodma = 1;
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
#endif
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_CONTAQ,
device: PCI_DEVICE_ID_CONTAQ_82C693,
init_chipset: pci_init_cy82c693,
init_channel: ide_init_cy82c693,
bootable: ON_BOARD,
flags: ATA_F_DMA
};
int __init init_cy82c693(void)
{
ata_register_chipset(&chipset);
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* linux/drivers/ide/hpt34x.c Version 0.31 June. 9, 2000
*
* Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
......@@ -40,10 +41,12 @@
#include <asm/io.h>
#include <asm/irq.h>
#include "ata-timing.h"
#include "pcihost.h"
#ifndef SPLIT_BYTE
#define SPLIT_BYTE(B,H,L) ((H)=(B>>4), (L)=(B-((B>>4)<<4)))
# define SPLIT_BYTE(B,H,L) ((H)=(B>>4), (L)=(B-((B>>4)<<4)))
#endif
#define HPT343_DEBUG_DRIVE_INFO 0
......@@ -373,7 +376,7 @@ static int hpt34x_dmaproc(struct ata_device *drive)
*/
#define HPT34X_PCI_INIT_REG 0x80
unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
static unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
{
int i = 0;
unsigned long hpt34xIoBase = pci_resource_start(dev, 4);
......@@ -420,15 +423,15 @@ unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
bmide_dev = dev;
hpt34x_display_info = &hpt34x_get_info;
}
#endif /* DISPLAY_HPT34X_TIMINGS && CONFIG_PROC_FS */
#endif
return dev->irq;
}
void __init ide_init_hpt34x(struct ata_channel *hwif)
static void __init ide_init_hpt34x(struct ata_channel *hwif)
{
hwif->tuneproc = &hpt34x_tune_drive;
hwif->speedproc = &hpt34x_tune_chipset;
hwif->tuneproc = hpt34x_tune_drive;
hwif->speedproc = hpt34x_tune_chipset;
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
......@@ -449,9 +452,28 @@ void __init ide_init_hpt34x(struct ata_channel *hwif)
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
}
#else /* !CONFIG_BLK_DEV_IDEDMA */
#else
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
hwif->autodma = 0;
#endif /* CONFIG_BLK_DEV_IDEDMA */
#endif
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_TTI,
device: PCI_DEVICE_ID_TTI_HPT343,
init_chipset: pci_init_hpt34x,
init_channel: ide_init_hpt34x,
bootable: NEVER_BOARD,
extra: 16,
flags: ATA_F_NOADMA | ATA_F_DMA
};
int __init init_hpt34x(void)
{
ata_register_chipset(&chipset);
return 0;
}
This diff is collapsed.
......@@ -107,22 +107,6 @@ static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
return 0;
}
case HDIO_GETGEO_BIG:
{
struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
unsigned int bios_cyl;
if (!loc) return -EINVAL;
val = 255;
if (put_user(val, (byte *) &loc->heads)) return -EFAULT;
val = 63;
if (put_user(val, (byte *) &loc->sectors)) return -EFAULT;
bios_cyl = raid[minor].sectors/63/255;
if (put_user(bios_cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
case BLKROSET:
case BLKROGET:
case BLKSSZGET:
......
/***** vi:set ts=8 sts=8 sw=8:************************************************
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* Copyright (C) 1994-1998,2002 Linus Torvalds and authors:
*
......
......@@ -466,14 +466,14 @@ void ide_release_dma(struct ata_channel *ch)
/*
* This can be called for a dynamically installed interface. Don't __init it
*/
void ide_setup_dma(struct ata_channel *ch, unsigned long dma_base, unsigned int num_ports)
void ata_init_dma(struct ata_channel *ch, unsigned long dma_base)
{
printk(" %s: BM-DMA at 0x%04lx-0x%04lx", ch->name, dma_base, dma_base + num_ports - 1);
if (check_region(dma_base, num_ports)) {
printk(" -- ERROR, PORT ADDRESSES ALREADY IN USE\n");
if (!request_region(dma_base, 8, ch->name)) {
printk(KERN_ERR "ATA: ERROR: BM DMA portst already in use!\n");
return;
}
request_region(dma_base, num_ports, ch->name);
printk(KERN_INFO" %s: BM-DMA at 0x%04lx-0x%04lx", ch->name, dma_base, dma_base + 7);
ch->dma_base = dma_base;
ch->dmatable_cpu = pci_alloc_consistent(ch->pci_dev,
PRD_ENTRIES * PRD_BYTES,
......
......@@ -2,7 +2,7 @@
* linux/drivers/ide/ide-geometry.c
*
* Sun Feb 24 23:13:03 CET 2002: Patch by Andries Brouwer to remove the
* confused CMOS probe applied. This is solving more problems then it my
* confused CMOS probe applied. This is solving more problems than it may
* (unexpectedly) introduce.
*/
......
This diff is collapsed.
......@@ -342,6 +342,7 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw,
if (!noautodma)
ide_hwifs[ix].autodma = 1;
#endif
ide_hwifs[ix].unmask = 1;
}
}
......
......@@ -67,13 +67,11 @@
#include <asm/bitops.h>
#include "ata-timing.h"
#include "pcihost.h"
/*
* Those will be moved into separate header files eventually.
*/
#ifdef CONFIG_BLK_DEV_RZ1000
extern void ide_probe_for_rz100x(void);
#endif
#ifdef CONFIG_ETRAX_IDE
extern void init_e100_ide(void);
#endif
......@@ -438,7 +436,7 @@ static ide_startstop_t atapi_reset_pollfunc(struct ata_device *drive, struct req
return ide_started; /* continue polling */
}
ch->poll_timeout = 0; /* end of polling */
printk("%s: ATAPI reset timed-out, status=0x%02x\n", drive->name, stat);
printk("%s: ATAPI reset timed out, status=0x%02x\n", drive->name, stat);
return do_reset1 (drive, 1); /* do it the old fashioned way */
}
ch->poll_timeout = 0; /* done polling */
......@@ -461,7 +459,7 @@ static ide_startstop_t reset_pollfunc(struct ata_device *drive, struct request *
ide_set_handler(drive, reset_pollfunc, HZ/20, NULL);
return ide_started; /* continue polling */
}
printk("%s: reset timed-out, status=0x%02x\n", ch->name, stat);
printk("%s: reset timed out, status=0x%02x\n", ch->name, stat);
drive->failures++;
} else {
printk("%s: reset: ", ch->name);
......@@ -2486,28 +2484,13 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
return 0;
}
case HDIO_GETGEO_BIG:
{
struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
if (!loc || (drive->type != ATA_DISK && drive->type != ATA_FLOPPY))
return -EINVAL;
if (put_user(drive->bios_head, (byte *) &loc->heads)) return -EFAULT;
if (put_user(drive->bios_sect, (byte *) &loc->sectors)) return -EFAULT;
if (put_user(drive->bios_cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)drive->part[minor(inode->i_rdev)&PARTN_MASK].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
case HDIO_GETGEO_BIG_RAW:
{
struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
if (!loc || (drive->type != ATA_DISK && drive->type != ATA_FLOPPY))
return -EINVAL;
if (put_user(drive->head, (byte *) &loc->heads)) return -EFAULT;
if (put_user(drive->sect, (byte *) &loc->sectors)) return -EFAULT;
if (put_user(drive->head, (u8 *) &loc->heads)) return -EFAULT;
if (put_user(drive->sect, (u8 *) &loc->sectors)) return -EFAULT;
if (put_user(drive->cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)drive->part[minor(inode->i_rdev)&PARTN_MASK].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
......@@ -2971,7 +2954,7 @@ int __init ide_setup (char *s)
init_pdc4030();
goto done;
}
#endif /* CONFIG_BLK_DEV_PDC4030 */
#endif
#ifdef CONFIG_BLK_DEV_ALI14XX
case -17: /* "ali14xx" */
{
......@@ -3389,10 +3372,76 @@ static int __init ata_module_init(void)
initializing = 1;
#ifdef CONFIG_PCI
/*
* Register the host chip drivers.
*/
# ifdef CONFIG_BLK_DEV_PIIX
init_piix();
# endif
# ifdef CONFIG_BLK_DEV_VIA82CXXX
init_via82cxxx();
# endif
# ifdef CONFIG_BLK_DEV_PDC202XX
init_pdc202xx();
# endif
# ifdef CONFIG_BLK_DEV_RZ1000
init_rz1000();
# endif
# ifdef CONFIG_BLK_DEV_SIS5513
init_sis5513();
# endif
# ifdef CONFIG_BLK_DEV_CMD64X
init_cmd64x();
# endif
# ifdef CONFIG_BLK_DEV_OPTI621
init_opti621();
# endif
# ifdef CONFIG_BLK_DEV_TRM290
init_trm290();
# endif
# ifdef CONFIG_BLK_DEV_NS87415
init_ns87415();
# endif
# ifdef CONFIG_BLK_DEV_AEC62XX
init_aec62xx();
# endif
# ifdef CONFIG_BLK_DEV_SL82C105
init_sl82c105();
# endif
# ifdef CONFIG_BLK_DEV_HPT34X
init_hpt34x();
# endif
# ifdef CONFIG_BLK_DEV_HPT366
init_hpt366();
# endif
# ifdef CONFIG_BLK_DEV_ALI15X3
init_ali15x3();
# endif
# ifdef CONFIG_BLK_DEV_CY82C693
init_cy82c693();
# endif
# ifdef CONFIG_BLK_DEV_CS5530
init_cs5530();
# endif
# ifdef CONFIG_BLK_DEV_AMD74XX
init_amd74xx();
# endif
# ifdef CONFIG_BLK_DEV_PDC_ADMA
init_pdcadma();
# endif
# ifdef CONFIG_BLK_DEV_SVWKS
init_svwks();
# endif
# ifdef CONFIG_BLK_DEV_IT8172
init_it8172();
# endif
init_ata_pci_misc();
/*
* Detect and initialize "known" IDE host chip types.
*/
#ifdef CONFIG_PCI
if (pci_present()) {
# ifdef CONFIG_PCI
ide_scan_pcibus(ide_scan_direction);
......
......@@ -37,11 +37,13 @@
#include <linux/ide.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include <asm/it8172/it8172_int.h>
#include "ata-timing.h"
#include "pcihost.h"
/*
* Prototypes
......@@ -224,7 +226,7 @@ static int it8172_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
#endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_IT8172_TUNING) */
unsigned int __init pci_init_it8172 (struct pci_dev *dev)
static unsigned int __init pci_init_it8172 (struct pci_dev *dev)
{
unsigned char progif;
......@@ -238,7 +240,7 @@ unsigned int __init pci_init_it8172 (struct pci_dev *dev)
}
void __init ide_init_it8172(struct ata_channel *hwif)
static void __init ide_init_it8172(struct ata_channel *hwif)
{
struct pci_dev* dev = hwif->pci_dev;
unsigned long cmdBase, ctrlBase;
......@@ -253,12 +255,12 @@ void __init ide_init_it8172(struct ata_channel *hwif)
#ifndef CONFIG_BLK_DEV_IDEDMA
hwif->autodma = 0;
#else /* CONFIG_BLK_DEV_IDEDMA */
#ifdef CONFIG_IT8172_TUNING
# ifdef CONFIG_IT8172_TUNING
hwif->autodma = 1;
hwif->dmaproc = &it8172_dmaproc;
hwif->speedproc = &it8172_tune_chipset;
#endif /* CONFIG_IT8172_TUNING */
#endif /* !CONFIG_BLK_DEV_IDEDMA */
# endif
#endif
cmdBase = dev->resource[0].start;
ctrlBase = dev->resource[1].start;
......@@ -267,3 +269,21 @@ void __init ide_init_it8172(struct ata_channel *hwif)
memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
hwif->noprobe = 0;
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_ITE,
device: PCI_DEVICE_ID_ITE_IT8172G,
init_chipset: pci_init_it8172,
init_channel: ide_init_it8172,
exnablebits: {{0x00,0x00,0x00}, {0x40,0x00,0x01} },
bootable: ON_BOARD
};
int __init init_it8172(void)
{
ata_register_chipset(&chipset);
return 0;
}
......@@ -19,11 +19,13 @@
#include <linux/hdreg.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "pcihost.h"
static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
/*
......@@ -134,7 +136,7 @@ static int ns87415_dmaproc(struct ata_device *drive)
}
#endif
void __init ide_init_ns87415(struct ata_channel *hwif)
static void __init ide_init_ns87415(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ctrl, using_inta;
......@@ -237,3 +239,18 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
hwif->selectproc = &ns87415_selectproc;
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_NS,
device: PCI_DEVICE_ID_NS_87415,
init_channel: ide_init_ns87415,
bootable: ON_BOARD,
};
int __init init_ns87415(void)
{
ata_register_chipset(&chipset);
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* Copyright (C) 1996-1998 Linus Torvalds & authors (see below)
*
* Authors:
......@@ -92,12 +93,14 @@
#include <linux/mm.h>
#include <linux/ioport.h>
#include <linux/blkdev.h>
#include <linux/pci.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
#define OPTI621_MAX_PIO 3
/* In fact, I do not have any PIO 4 drive
......@@ -310,9 +313,38 @@ static void opti621_tune_drive (ide_drive_t *drive, byte pio)
/*
* ide_init_opti621() is called once for each hwif found at boot.
*/
void __init ide_init_opti621(struct ata_channel *hwif)
static void __init ide_init_opti621(struct ata_channel *hwif)
{
hwif->drives[0].drive_data = PIO_DONT_KNOW;
hwif->drives[1].drive_data = PIO_DONT_KNOW;
hwif->tuneproc = &opti621_tune_drive;
}
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_OPTI,
device: PCI_DEVICE_ID_OPTI_82C621,
init_channel: ide_init_opti621,
enablebits: {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_OPTI,
device: PCI_DEVICE_ID_OPTI_82C825,
init_channel: ide_init_opti621,
enablebits: {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
bootable: ON_BOARD
},
};
int __init init_opti621(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* Copyright (C) 2002 Marcin Dalecki <martin@dalecki.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Declarations needed for the handling of PCI (mostly) based host chip set
* interfaces.
*/
#ifdef CONFIG_BLK_DEV_PIIX
extern int init_piix(void);
#endif
#ifdef CONFIG_BLK_DEV_VIA82CXXX
extern int init_via82cxxx(void);
#endif
#ifdef CONFIG_BLK_DEV_PDC202XX
extern int init_pdc202xx(void);
#endif
#ifdef CONFIG_BLK_DEV_RZ1000
extern int init_rz1000(void);
#endif
#ifdef CONFIG_BLK_DEV_SIS5513
extern int init_sis5513(void);
#endif
#ifdef CONFIG_BLK_DEV_CMD64X
extern int init_cmd64x(void);
#endif
#ifdef CONFIG_BLK_DEV_OPTI621
extern int init_opti621(void);
#endif
#ifdef CONFIG_BLK_DEV_TRM290
extern int init_trm290(void);
#endif
#ifdef CONFIG_BLK_DEV_NS87415
extern int init_ns87415(void);
#endif
#ifdef CONFIG_BLK_DEV_AEC62XX
extern int init_aec62xx(void);
#endif
#ifdef CONFIG_BLK_DEV_SL82C105
extern int init_sl82c105(void);
#endif
#ifdef CONFIG_BLK_DEV_HPT34X
extern int init_hpt34x(void);
#endif
#ifdef CONFIG_BLK_DEV_HPT366
extern int init_hpt366(void);
#endif
#ifdef CONFIG_BLK_DEV_ALI15X3
extern int init_ali15x3(void);
#endif
#ifdef CONFIG_BLK_DEV_CY82C693
extern int init_cy82c693(void);
#endif
#ifdef CONFIG_BLK_DEV_CS5530
extern int init_cs5530(void);
#endif
#ifdef CONFIG_BLK_DEV_AMD74XX
extern int init_amd74xx(void);
#endif
#ifdef CONFIG_BLK_DEV_PDC_ADMA
extern int init_pdcadma(void);
#endif
#ifdef CONFIG_BLK_DEV_SVWKS
extern int init_svwks(void);
#endif
#ifdef CONFIG_BLK_DEV_IT8172
extern int init_it8172(void);
#endif
extern int init_ata_pci_misc(void);
/*
* Some combi chips, which can be used on the PCI bus or the VL bus can be in
* some systems acessed either through the PCI config space or through the
* hosts IO bus. If the corresponding initialization driver is using the host
* IO space to deal with them please define the following.
*/
#define ATA_PCI_IGNORE ((void *)-1)
/*
* Just to prevent us from having too many tinny headers we have consolidated
* all those declarations here.
*/
#ifdef CONFIG_BLK_DEV_RZ1000
extern void ide_probe_for_rz100x(void);
#endif
typedef struct ide_pci_enablebit_s {
u8 reg; /* pci configuration register holding the enable-bit */
u8 mask; /* mask used to isolate the enable-bit */
u8 val; /* expected value of masked register when "enabled" */
} ide_pci_enablebit_t;
/* Flags used to untangle quirk handling.
*/
#define ATA_F_DMA 0x01
#define ATA_F_NODMA 0x02 /* no DMA mode supported at all */
#define ATA_F_NOADMA 0x04 /* DMA has to be enabled explicitely */
#define ATA_F_FIXIRQ 0x08 /* fixed irq wiring */
#define ATA_F_SER 0x10 /* serialize on first and second channel interrupts */
#define ATA_F_IRQ 0x20 /* trust IRQ information from config */
#define ATA_F_PHACK 0x40 /* apply PROMISE hacks */
#define ATA_F_HPTHACK 0x80 /* apply HPT366 hacks */
struct ata_pci_device {
unsigned short vendor;
unsigned short device;
unsigned int (*init_chipset)(struct pci_dev *);
unsigned int (*ata66_check)(struct ata_channel *);
void (*init_channel)(struct ata_channel *);
void (*init_dma)(struct ata_channel *, unsigned long);
ide_pci_enablebit_t enablebits[2];
unsigned int bootable;
unsigned int extra;
unsigned int flags;
struct ata_pci_device *next; /* beware we link the netries in pleace */
};
extern void ata_register_chipset(struct ata_pci_device *d);
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* linux/drivers/ide/pdc202xx.c Version 0.30 Mar. 18, 2000
*
* Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
......@@ -47,6 +48,7 @@
#include <asm/irq.h>
#include "ata-timing.h"
#include "pcihost.h"
#define PDC202XX_DEBUG_DRIVE_INFO 0
#define PDC202XX_DECODE_REGISTER_INFO 0
......@@ -377,7 +379,7 @@ static void decode_registers (byte registers, byte value)
#endif /* PDC202XX_DECODE_REGISTER_INFO */
static int check_in_drive_lists (ide_drive_t *drive, const char **list)
static int check_in_drive_lists(struct ata_device *drive, const char **list)
{
struct hd_driveid *id = drive->id;
......@@ -397,7 +399,7 @@ static int check_in_drive_lists (ide_drive_t *drive, const char **list)
return 0;
}
static int pdc202xx_tune_chipset (ide_drive_t *drive, byte speed)
static int pdc202xx_tune_chipset(struct ata_device *drive, byte speed)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
......@@ -521,7 +523,7 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, byte speed)
return err;
}
static int pdc202xx_new_tune_chipset (ide_drive_t *drive, byte speed)
static int pdc202xx_new_tune_chipset(struct ata_device *drive, byte speed)
{
struct ata_channel *hwif = drive->channel;
#ifdef CONFIG_BLK_DEV_IDEDMA
......@@ -682,7 +684,7 @@ static int pdc202xx_new_tune_chipset (ide_drive_t *drive, byte speed)
* 180, 120, 90, 90, 90, 60, 30
* 11, 5, 4, 3, 2, 1, 0
*/
static int config_chipset_for_pio (ide_drive_t *drive, byte pio)
static int config_chipset_for_pio(struct ata_device *drive, byte pio)
{
byte speed = 0x00;
......@@ -694,13 +696,13 @@ static int config_chipset_for_pio (ide_drive_t *drive, byte pio)
return ((int) pdc202xx_tune_chipset(drive, speed));
}
static void pdc202xx_tune_drive (ide_drive_t *drive, byte pio)
static void pdc202xx_tune_drive(struct ata_device *drive, byte pio)
{
(void) config_chipset_for_pio(drive, pio);
}
#ifdef CONFIG_BLK_DEV_IDEDMA
static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_chipset_for_dma(struct ata_device *drive, byte ultra)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
......@@ -921,7 +923,7 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
0);
}
static int config_drive_xfer_rate (ide_drive_t *drive)
static int config_drive_xfer_rate(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
......@@ -977,7 +979,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
return 0;
}
int pdc202xx_quirkproc (ide_drive_t *drive)
int pdc202xx_quirkproc(struct ata_device *drive)
{
return ((int) check_in_drive_lists(drive, pdc_quirk_drives));
}
......@@ -1139,7 +1141,7 @@ static int pdc202xx_dmaproc(struct ata_device *drive)
}
#endif
void pdc202xx_new_reset (ide_drive_t *drive)
void pdc202xx_new_reset(struct ata_device *drive)
{
OUT_BYTE(0x04,IDE_CONTROL_REG);
mdelay(1000);
......@@ -1149,7 +1151,7 @@ void pdc202xx_new_reset (ide_drive_t *drive)
drive->channel->unit ? "Secondary" : "Primary");
}
void pdc202xx_reset (ide_drive_t *drive)
void pdc202xx_reset(struct ata_device *drive)
{
unsigned long high_16 = pci_resource_start(drive->channel->pci_dev, 4);
byte udma_speed_flag = IN_BYTE(high_16 + 0x001f);
......@@ -1167,7 +1169,7 @@ void pdc202xx_reset (ide_drive_t *drive)
* this has been a long time ago Thu Jul 27 16:40:57 2000 was the patch date
* HOTSWAP ATA Infrastructure.
*/
static int pdc202xx_tristate (ide_drive_t * drive, int state)
static int pdc202xx_tristate(struct ata_device * drive, int state)
{
#if 0
struct ata_channel *hwif = drive->channel;
......@@ -1188,7 +1190,7 @@ static int pdc202xx_tristate (ide_drive_t * drive, int state)
return 0;
}
unsigned int __init pci_init_pdc202xx(struct pci_dev *dev)
static unsigned int __init pdc202xx_init_chipset(struct pci_dev *dev)
{
unsigned long high_16 = pci_resource_start(dev, 4);
byte udma_speed_flag = IN_BYTE(high_16 + 0x001f);
......@@ -1277,7 +1279,7 @@ unsigned int __init pci_init_pdc202xx(struct pci_dev *dev)
OUT_BYTE(secondary_mode|1, high_16 + 0x001b);
printk("%s\n", (IN_BYTE(high_16 + 0x001b) & 1) ? "MASTER" : "PCI");
}
#endif /* CONFIG_PDC202XX_MASTER */
#endif
fttk_tx_series:
......@@ -1287,11 +1289,11 @@ unsigned int __init pci_init_pdc202xx(struct pci_dev *dev)
bmide_dev = dev;
pdc202xx_display_info = &pdc202xx_get_info;
}
#endif /* DISPLAY_PDC202XX_TIMINGS && CONFIG_PROC_FS */
#endif
return dev->irq;
}
unsigned int __init ata66_pdc202xx(struct ata_channel *hwif)
static unsigned int __init ata66_pdc202xx(struct ata_channel *hwif)
{
unsigned short mask = (hwif->unit) ? (1<<11) : (1<<10);
unsigned short CIS;
......@@ -1310,7 +1312,7 @@ unsigned int __init ata66_pdc202xx(struct ata_channel *hwif)
}
}
void __init ide_init_pdc202xx(struct ata_channel *hwif)
static void __init ide_init_pdc202xx(struct ata_channel *hwif)
{
hwif->tuneproc = &pdc202xx_tune_drive;
hwif->quirkproc = &pdc202xx_quirkproc;
......@@ -1363,3 +1365,155 @@ void __init ide_init_pdc202xx(struct ata_channel *hwif)
hwif->autodma = 0;
#endif
}
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
#ifdef CONFIG_PDC202XX_FORCE
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20246,
init_chipset: pdc202xx_init_chipset,
ata66_check: NULL,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
extra: 16,
flags: ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20262,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20265,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: ON_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20267,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_DMA
},
#else
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20246,
init_chipset: pdc202xx_init_chipset,
ata66_check: NULL,
init_channel: ide_init_pdc202xx,
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
bootable: OFF_BOARD,
extra: 16,
flags: ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20262,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20265,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20267,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
exnablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_DMA
},
#endif
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20268,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
/* Promise used a different PCI identification for the raid card
* apparently to try and prevent Linux detecting it and using our own
* raid code. We want to detect it for the ataraid drivers, so we have
* to list both here.. */
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20268R,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20269,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20275,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20276,
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
};
int __init init_pdc202xx(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -477,7 +477,7 @@ static ide_startstop_t promise_write_pollfunc(struct ata_device *drive, struct r
return ide_started; /* continue polling... */
}
ch->poll_timeout = 0;
printk(KERN_ERR "%s: write timed-out!\n",drive->name);
printk(KERN_ERR "%s: write timed out!\n",drive->name);
return ide_error(drive, "write timeout", GET_STAT());
}
......
......@@ -25,6 +25,7 @@
#include <asm/irq.h>
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_PDCADMA_TIMINGS
......@@ -66,7 +67,7 @@ static int pdcadma_dmaproc(struct ata_device *drive)
}
#endif
unsigned int __init pci_init_pdcadma(struct pci_dev *dev)
static unsigned int __init pci_init_pdcadma(struct pci_dev *dev)
{
#if defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS)
if (!pdcadma_proc) {
......@@ -78,12 +79,12 @@ unsigned int __init pci_init_pdcadma(struct pci_dev *dev)
return 0;
}
unsigned int __init ata66_pdcadma(struct ata_channel *channel)
static unsigned int __init ata66_pdcadma(struct ata_channel *channel)
{
return 1;
}
void __init ide_init_pdcadma(struct ata_channel *hwif)
static void __init ide_init_pdcadma(struct ata_channel *hwif)
{
hwif->autodma = 0;
hwif->dma_base = 0;
......@@ -97,8 +98,31 @@ void __init ide_init_pdcadma(struct ata_channel *hwif)
// }
}
void __init ide_dmacapable_pdcadma(struct ata_channel *hwif, unsigned long dmabase)
static void __init ide_dmacapable_pdcadma(struct ata_channel *hwif, unsigned long dmabase)
{
// ide_setup_dma(hwif, dmabase, 8);
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
PCI_VENDOR_ID_PDC, PCI_DEVICE_ID_PDC_1841,
pci_init_pdcadma,
ata66_pdcadma,
ide_init_pdcadma,
ide_dmacapable_pdcadma,
{
{0x00,0x00,0x00},
{0x00,0x00,0x00}
},
OFF_BOARD,
0,
ATA_F_NODMA
};
int __init init_pdcadma(void)
{
ata_register_chipset(&chipset);
return 0;
}
......@@ -132,19 +132,6 @@ static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
return 0;
}
case HDIO_GETGEO_BIG:
{
struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
if (!loc) return -EINVAL;
if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;
if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;
if (put_user(raid[minor].geom.cylinders, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
case BLKROSET:
case BLKROGET:
case BLKSSZGET:
......
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* $Id: piix.c,v 1.3 2002/03/29 16:06:06 vojtech Exp $
*
* Copyright (c) 2000-2002 Vojtech Pavlik
......@@ -45,9 +46,11 @@
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
#define PIIX_IDETIM0 0x40
#define PIIX_IDETIM1 0x42
......@@ -401,8 +404,7 @@ int piix_dmaproc(struct ata_device *drive)
* The initialization callback. Here we determine the IDE chip type
* and initialize its drive independent registers.
*/
unsigned int __init pci_init_piix(struct pci_dev *dev, const char *name)
static unsigned int __init piix_init_chipset(struct pci_dev *dev)
{
unsigned int u;
unsigned short w;
......@@ -532,12 +534,12 @@ unsigned int __init pci_init_piix(struct pci_dev *dev, const char *name)
return 0;
}
unsigned int __init ata66_piix(struct ata_channel *hwif)
static unsigned int __init piix_ata66_check(struct ata_channel *hwif)
{
return ((piix_enabled & piix_80w) >> hwif->unit) & 1;
}
void __init ide_init_piix(struct ata_channel *hwif)
static void __init piix_init_channel(struct ata_channel *hwif)
{
int i;
......@@ -567,10 +569,166 @@ void __init ide_init_piix(struct ata_channel *hwif)
* We allow the BM-DMA driver only work on enabled interfaces,
* and only if DMA is safe with the chip and bridge.
*/
void __init ide_dmacapable_piix(struct ata_channel *hwif, unsigned long dmabase)
static void __init piix_init_dma(struct ata_channel *hwif, unsigned long dmabase)
{
if (((piix_enabled >> hwif->unit) & 1)
&& !(piix_config->flags & PIIX_NODMA))
ide_setup_dma(hwif, dmabase, 8);
ata_init_dma(hwif, dmabase);
}
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371FB_1,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371SB_1,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371AB,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82443MX_1,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82372FB_1,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801AA_1,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801AB_1,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801BA_9,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801BA_8,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801E_9,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801CA_10,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801CA_11,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801DB_9,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_EFAR,
device: PCI_DEVICE_ID_EFAR_SLC90E66_1,
init_chipset: piix_init_chipset,
ata66_check: piix_ata66_check,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
},
};
int __init init_piix(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* Copyright (C) 1995-1998 Linus Torvalds & author (see below)
*
* Principal Author: mlord@pobox.com (Mark Lord)
......@@ -21,14 +22,16 @@
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/pci.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#ifdef CONFIG_PCI
void __init ide_init_rz1000(struct ata_channel *hwif) /* called from ide-pci.c */
#include "pcihost.h"
static void __init rz1000_init_channel(struct ata_channel *hwif)
{
unsigned short reg;
struct pci_dev *dev = hwif->pci_dev;
......@@ -45,6 +48,33 @@ void __init ide_init_rz1000(struct ata_channel *hwif) /* called from ide-pci.c *
}
}
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_PCTECH,
device: PCI_DEVICE_ID_PCTECH_RZ1000,
init_channel: rz1000_init_channel,
bootable: ON_BOARD
},
{
vendor: PCI_VENDOR_ID_PCTECH,
device: PCI_DEVICE_ID_PCTECH_RZ1001,
init_channel: rz1000_init_channel,
bootable: ON_BOARD
},
};
int __init init_rz1000(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
#else
static void __init init_rz1000 (struct pci_dev *dev, const char *name)
......@@ -82,9 +112,9 @@ void __init ide_probe_for_rz100x (void) /* called from ide.c */
struct pci_dev *dev = NULL;
while ((dev = pci_find_device(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000, dev))!=NULL)
init_rz1000 (dev, "RZ1000");
rz1000_init (dev, "RZ1000");
while ((dev = pci_find_device(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, dev))!=NULL)
init_rz1000 (dev, "RZ1001");
rz1000_init (dev, "RZ1001");
}
#endif
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* linux/drivers/ide/serverworks.c Version 0.3 26 Oct 2001
*
* May be copied or modified under the terms of the GNU General Public License
......@@ -85,13 +86,14 @@
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
#undef DISPLAY_SVWKS_TIMINGS
#undef SVWKS_DEBUG_DRIVE_INFO
......@@ -238,7 +240,7 @@ extern char *ide_xfer_verbose (byte xfer_rate);
static struct pci_dev *isa_dev;
static int svwks_tune_chipset (ide_drive_t *drive, byte speed)
static int svwks_tune_chipset(struct ata_device *drive, byte speed)
{
byte udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
byte dma_modes[] = { 0x77, 0x21, 0x20 };
......@@ -359,7 +361,7 @@ static int svwks_tune_chipset (ide_drive_t *drive, byte speed)
return err;
}
static void config_chipset_for_pio (ide_drive_t *drive)
static void config_chipset_for_pio(struct ata_device *drive)
{
unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
unsigned short xfer_pio = drive->id->eide_pio_modes;
......@@ -397,7 +399,7 @@ static void config_chipset_for_pio (ide_drive_t *drive)
drive->current_speed = speed;
}
static void svwks_tune_drive (ide_drive_t *drive, byte pio)
static void svwks_tune_drive(struct ata_device *drive, byte pio)
{
byte speed;
switch(pio) {
......@@ -411,7 +413,7 @@ static void svwks_tune_drive (ide_drive_t *drive, byte pio)
}
#ifdef CONFIG_BLK_DEV_IDEDMA
static int config_chipset_for_dma (ide_drive_t *drive)
static int config_chipset_for_dma(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
struct pci_dev *dev = drive->channel->pci_dev;
......@@ -536,7 +538,7 @@ static int svwks_dmaproc(struct ata_device *drive)
}
#endif
unsigned int __init pci_init_svwks(struct pci_dev *dev)
static unsigned int __init svwks_init_chipset(struct pci_dev *dev)
{
unsigned int reg;
byte btr;
......@@ -621,7 +623,7 @@ static unsigned int __init ata66_svwks_cobalt(struct ata_channel *hwif)
return 0;
}
unsigned int __init ata66_svwks(struct ata_channel *hwif)
static unsigned int __init svwks_ata66_check(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
......@@ -636,7 +638,7 @@ unsigned int __init ata66_svwks(struct ata_channel *hwif)
return 0;
}
void __init ide_init_svwks(struct ata_channel *hwif)
static void __init ide_init_svwks(struct ata_channel *hwif)
{
if (!hwif->irq)
hwif->irq = hwif->unit ? 15 : 14;
......@@ -648,7 +650,7 @@ void __init ide_init_svwks(struct ata_channel *hwif)
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
hwif->autodma = 0;
#else /* CONFIG_BLK_DEV_IDEDMA */
#else
if (hwif->dma_base) {
#ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
......@@ -662,5 +664,38 @@ void __init ide_init_svwks(struct ata_channel *hwif)
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
}
#endif /* !CONFIG_BLK_DEV_IDEDMA */
#endif
}
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_SERVERWORKS,
device: PCI_DEVICE_ID_SERVERWORKS_OSB4IDE,
init_chipset: svwks_init_chipset,
ata66_check: svwks_ata66_check,
init_channel: ide_init_svwks,
bootable: ON_BOARD,
flags: ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_SERVERWORKS,
device: PCI_DEVICE_ID_SERVERWORKS_CSB5IDE,
init_chipset: svwks_init_chipset,
ata66_check: svwks_ata66_check,
init_channel: ide_init_svwks,
bootable: ON_BOARD
},
};
int __init init_svwks(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -40,17 +40,18 @@
#include <linux/mm.h>
#include <linux/ioport.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <linux/hdreg.h>
#include <asm/io.h>
#include <asm/irq.h>
#include "ata-timing.h"
#include "pcihost.h"
/* When DEBUG is defined it outputs initial PCI config register
values and changes made to them by the driver */
......@@ -741,7 +742,7 @@ static int sis5513_dmaproc(struct ata_device *drive)
#endif
/* Chip detection and general config */
unsigned int __init pci_init_sis5513(struct pci_dev *dev)
static unsigned int __init pci_init_sis5513(struct pci_dev *dev)
{
struct pci_dev *host;
int i = 0;
......@@ -823,7 +824,7 @@ unsigned int __init pci_init_sis5513(struct pci_dev *dev)
return 0;
}
unsigned int __init ata66_sis5513(struct ata_channel *hwif)
static unsigned int __init ata66_sis5513(struct ata_channel *hwif)
{
byte reg48h = 0, ata66 = 0;
byte mask = hwif->unit ? 0x20 : 0x10;
......@@ -835,7 +836,7 @@ unsigned int __init ata66_sis5513(struct ata_channel *hwif)
return ata66;
}
void __init ide_init_sis5513(struct ata_channel *hwif)
static void __init ide_init_sis5513(struct ata_channel *hwif)
{
hwif->irq = hwif->unit ? 15 : 14;
......@@ -861,3 +862,23 @@ void __init ide_init_sis5513(struct ata_channel *hwif)
}
return;
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_SI,
device: PCI_DEVICE_ID_SI_5513,
init_chipset: pci_init_sis5513,
ata66_check: ata66_sis5513,
init_channel: ide_init_sis5513,
enablebits: {{0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: ON_BOARD,
flags: ATA_F_NOADMA
};
int __init init_sis5513(void)
{
ata_register_chipset(&chipset);
return 0;
}
......@@ -23,6 +23,7 @@
#include <asm/dma.h>
#include "ata-timing.h"
#include "pcihost.h"
extern char *ide_xfer_verbose (byte xfer_rate);
......@@ -212,7 +213,7 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev)
/*
* Enable the PCI device
*/
unsigned int __init pci_init_sl82c105(struct pci_dev *dev)
static unsigned int __init sl82c105_init_chipset(struct pci_dev *dev)
{
unsigned char ctrl_stat;
......@@ -225,7 +226,7 @@ unsigned int __init pci_init_sl82c105(struct pci_dev *dev)
return dev->irq;
}
void __init dma_init_sl82c105(struct ata_channel *hwif, unsigned long dma_base)
static void __init sl82c105_init_dma(struct ata_channel *hwif, unsigned long dma_base)
{
unsigned int rev;
byte dma_state;
......@@ -246,7 +247,7 @@ void __init dma_init_sl82c105(struct ata_channel *hwif, unsigned long dma_base)
outb(dma_state, dma_base + 2);
hwif->XXX_udma = NULL;
ide_setup_dma(hwif, dma_base, 8);
ata_init_dma(hwif, dma_base);
if (hwif->XXX_udma)
hwif->XXX_udma = sl82c105_dmaproc;
}
......@@ -254,8 +255,26 @@ void __init dma_init_sl82c105(struct ata_channel *hwif, unsigned long dma_base)
/*
* Initialise the chip
*/
void __init ide_init_sl82c105(struct ata_channel *hwif)
static void __init sl82c105_init_channel(struct ata_channel *hwif)
{
hwif->tuneproc = tune_sl82c105;
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_WINBOND,
device: PCI_DEVICE_ID_WINBOND_82C105,
init_chipset: sl82c105_init_chipset,
init_channel: sl82c105_init_channel,
init_dma: sl82c105_init_dma,
enablebits: { {0x40,0x01,0x01}, {0x40,0x10,0x10} },
bootable: ON_BOARD
};
int __init init_sl82c105(void)
{
ata_register_chipset(&chipset);
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* linux/drivers/ide/trm290.c Version 1.02 Mar. 18, 2000
*
* Copyright (c) 1997-1998 Mark Lord
......@@ -139,6 +140,8 @@
#include <asm/io.h>
#include "pcihost.h"
static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
{
struct ata_channel *hwif = drive->channel;
......@@ -249,7 +252,7 @@ static int trm290_dmaproc(struct ata_device *drive)
/*
* Invoked from ide-dma.c at boot time.
*/
void __init ide_init_trm290(struct ata_channel *hwif)
static void __init trm290_init_channel(struct ata_channel *hwif)
{
unsigned int cfgbase = 0;
unsigned long flags;
......@@ -293,7 +296,7 @@ void __init ide_init_trm290(struct ata_channel *hwif)
hwif->irq = primary_irq;
}
ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->unit ? 0x0080 : 0x0000), 3);
ata_init_dma(hwif, (hwif->config_data + 4) ^ (hwif->unit ? 0x0080 : 0x0000));
#ifdef CONFIG_BLK_DEV_IDEDMA
hwif->udma_start = trm290_udma_start;
......@@ -327,3 +330,18 @@ void __init ide_init_trm290(struct ata_channel *hwif)
}
#endif
}
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_TEKRAM,
device: PCI_DEVICE_ID_TEKRAM_DC290,
init_channel: trm290_init_channel,
bootable: ON_BOARD
};
int __init init_trm290(void)
{
ata_register_chipset(&chipset);
return 0;
}
/*
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* $Id: via82cxxx.c,v 3.34 2002/02/12 11:26:11 vojtech Exp $
*
* Copyright (c) 2000-2001 Vojtech Pavlik
......@@ -65,9 +66,11 @@
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
#include "pcihost.h"
#define VIA_IDE_ENABLE 0x40
#define VIA_IDE_CONFIG 0x41
......@@ -380,7 +383,7 @@ static int via82cxxx_dmaproc(struct ata_device *drive)
* and initialize its drive independent registers.
*/
unsigned int __init pci_init_via82cxxx(struct pci_dev *dev)
static unsigned int __init via82cxxx_init_chipset(struct pci_dev *dev)
{
struct pci_dev *isa = NULL;
unsigned char t, v;
......@@ -510,12 +513,12 @@ unsigned int __init pci_init_via82cxxx(struct pci_dev *dev)
return 0;
}
unsigned int __init ata66_via82cxxx(struct ata_channel *hwif)
static unsigned int __init via82cxxx_ata66_check(struct ata_channel *hwif)
{
return ((via_enabled & via_80w) >> hwif->unit) & 1;
}
void __init ide_init_via82cxxx(struct ata_channel *hwif)
static void __init via82cxxx_init_channel(struct ata_channel *hwif)
{
int i;
......@@ -546,8 +549,45 @@ void __init ide_init_via82cxxx(struct ata_channel *hwif)
* We allow the BM-DMA driver to only work on enabled interfaces.
*/
void __init ide_dmacapable_via82cxxx(struct ata_channel *hwif, unsigned long dmabase)
static void __init via82cxxx_init_dma(struct ata_channel *hwif, unsigned long dmabase)
{
if ((via_enabled >> hwif->unit) & 1)
ide_setup_dma(hwif, dmabase, 8);
ata_init_dma(hwif, dmabase);
}
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_VIA,
device: PCI_DEVICE_ID_VIA_82C576_1,
init_chipset: via82cxxx_init_chipset,
ata66_check: via82cxxx_ata66_check,
init_channel: via82cxxx_init_channel,
init_dma: via82cxxx_init_dma,
enablebits: {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
bootable: ON_BOARD,
flags: ATA_F_NOADMA
},
{
vendor: PCI_VENDOR_ID_VIA,
device: PCI_DEVICE_ID_VIA_82C586_1,
init_chipset: via82cxxx_init_chipset,
ata66_check: via82cxxx_ata66_check,
init_channel: via82cxxx_init_channel,
init_dma: via82cxxx_init_dma,
enablebits: {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
bootable: ON_BOARD,
flags: ATA_F_NOADMA
},
};
int __init init_via82cxxx(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -799,17 +799,27 @@ int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
if (rq) kfree (rq);
cmd->result = DID_ERROR << 16;
done(cmd);
return 0;
}
int idescsi_abort (Scsi_Cmnd *cmd)
/* FIXME: This needs further investigation.
*/
int idescsi_device_reset (Scsi_Cmnd *cmd)
{
return SCSI_ABORT_SNOOZE;
}
#if 0
ide_drive_t *drive = idescsi_drives[cmd->target];
struct request req;
int idescsi_reset (Scsi_Cmnd *cmd, unsigned int resetflags)
{
return SCSI_RESET_SUCCESS;
ide_init_drive_cmd(&req);
req.flags = REQ_SPECIAL;
/* FIX ME, the next executable line causes on oops in lk 2.5.10-dj1
* [code copied from ide-cd's ide_cdrom_reset(), does it work?]
*/
ide_do_drive_cmd(drive, &req, ide_wait);
#endif
return SUCCESS;
}
int idescsi_bios (Disk *disk, kdev_t dev, int *parm)
......@@ -832,8 +842,8 @@ static Scsi_Host_Template idescsi_template = {
info: idescsi_info,
ioctl: idescsi_ioctl,
queuecommand: idescsi_queue,
abort: idescsi_abort,
reset: idescsi_reset,
eh_device_reset_handler:
idescsi_device_reset,
bios_param: idescsi_bios,
can_queue: 10,
this_id: -1,
......
......@@ -242,38 +242,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
return -EFAULT;
return 0;
}
case HDIO_GETGEO_BIG:
{
struct hd_big_geometry *loc =
(struct hd_big_geometry *) arg;
if(!loc)
return -EINVAL;
host = sdp->host;
/* default to most commonly used values */
diskinfo[0] = 0x40;
diskinfo[1] = 0x20;
diskinfo[2] = sdkp->capacity >> 11;
/* override with calculated, extended default,
or driver values */
if(host->hostt->bios_param != NULL)
host->hostt->bios_param(sdkp, dev,
&diskinfo[0]);
else
scsicam_bios_param(sdkp, dev, &diskinfo[0]);
if (put_user(diskinfo[0], &loc->heads) ||
put_user(diskinfo[1], &loc->sectors) ||
put_user(diskinfo[2],
(unsigned int *) &loc->cylinders) ||
put_user((unsigned)
get_start_sect(inode->i_rdev),
(unsigned long *)&loc->start))
return -EFAULT;
return 0;
}
case BLKGETSIZE:
case BLKGETSIZE64:
case BLKROSET:
......
......@@ -280,7 +280,7 @@ struct hd_geometry {
unsigned long start;
};
/* BIG GEOMETRY */
/* BIG GEOMETRY - dying, used only by HDIO_GETGEO_BIG_RAW */
struct hd_big_geometry {
unsigned char heads;
unsigned char sectors;
......@@ -327,7 +327,7 @@ enum {
};
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
#define HDIO_GETGEO_BIG 0x0330 /* */
/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */
#define HDIO_GETGEO_BIG_RAW 0x0331 /* */
#define __NEW_HD_DRIVE_ID
......
......@@ -853,8 +853,8 @@ extern int ide_register_subdriver(struct ata_device *, struct ata_operations *);
extern int ide_unregister_subdriver(struct ata_device *drive);
#ifdef CONFIG_PCI
# define ON_BOARD 1
# define NEVER_BOARD 0
# define ON_BOARD 0
# define NEVER_BOARD 1
# ifdef CONFIG_BLK_DEV_OFFBOARD
# define OFF_BOARD ON_BOARD
# else
......@@ -889,8 +889,9 @@ extern ide_startstop_t ide_dma_intr(struct ata_device *, struct request *);
extern int check_drive_lists(struct ata_device *, int good_bad);
extern int XXX_ide_dmaproc(struct ata_device *);
extern void ide_release_dma(struct ata_channel *);
extern void ide_setup_dma(struct ata_channel *, unsigned long, unsigned int) __init;
extern int ata_start_dma(struct ata_device *, struct request *rq);
extern void ata_init_dma(struct ata_channel *, unsigned long) __init;
#endif
extern spinlock_t ide_lock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment