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

[PATCH] 2.5.7 IDE 27

- Make for less terse error messages in ide-tape.c.

- Replaced all timecomparisions done by hand with all the proper timer_after()
   commands.

- Remove the drive niec1 mechanisms alltogether. There are several reasons for
   this:

   1. The code implementing it is nonintelliglible and therefore propably
   broken.

   2. If we have to invent somethig about sceduling drive IO, it should be done
   on the BIO level.

   3. We may in fact interleave with the IO sceduling on the upper layers and
   the results of two overlapping signal filters overlapped with each other can
   be disasterous to the overall throughput. (In fact they *are* most of the
   time.)

   4. It was not working if you had intermixed modes on different drives
   DMA versus PIO.

   5. Our goal is to have a driver which is able to share the badwidth
   properly and shouldn't needing this kind of "tuning".

- Remove unused nice2 from disk struct.

- Rename channel member of ata_channel to unit and device to dev to
   just prevent wrong interpretations. This prevents constructs like
   channel->channel...
parent d1372f76
......@@ -259,7 +259,7 @@ static int aec6260_tune_chipset (ide_drive_t *drive, byte speed)
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
byte unit = (drive->select.b.unit & 0x01);
byte ultra_pci = hwif->channel ? 0x45 : 0x44;
byte ultra_pci = hwif->unit ? 0x45 : 0x44;
int err = 0;
byte drive_conf = 0x00;
byte ultra_conf = 0x00;
......@@ -532,7 +532,7 @@ unsigned int __init pci_init_aec62xx (struct pci_dev *dev)
unsigned int __init ata66_aec62xx(struct ata_channel *hwif)
{
byte mask = hwif->channel ? 0x02 : 0x01;
byte mask = hwif->unit ? 0x02 : 0x01;
byte ata66 = 0;
pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
......@@ -565,7 +565,7 @@ void __init ide_dmacapable_aec62xx(struct ata_channel *hwif, unsigned long dmaba
__cli(); /* local CPU only */
pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h);
pci_write_config_byte(hwif->pci_dev, 0x54, reg54h & ~(hwif->channel ? 0xF0 : 0x0F));
pci_write_config_byte(hwif->pci_dev, 0x54, reg54h & ~(hwif->unit ? 0xF0 : 0x0F));
__restore_flags(flags); /* local CPU only */
#endif /* CONFIG_AEC62XX_TUNING */
......
......@@ -214,7 +214,7 @@ void __init init_ali14xx (void)
ide_hwifs[1].tuneproc = &ali14xx_tune_drive;
ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1;
ide_hwifs[1].unit = 1;
/* initialize controller registers */
if (!initRegisters()) {
......
......@@ -247,8 +247,8 @@ static void ali15x3_tune_drive (ide_drive_t *drive, byte pio)
int s_time, a_time, c_time;
byte s_clc, a_clc, r_clc;
unsigned long flags;
int port = hwif->index ? 0x5c : 0x58;
int portFIFO = hwif->channel ? 0x55 : 0x54;
int port = hwif->unit ? 0x5c : 0x58;
int portFIFO = hwif->unit ? 0x55 : 0x54;
byte cd_dma_fifo = 0;
if (pio == 255)
......@@ -309,7 +309,7 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed)
struct pci_dev *dev = hwif->pci_dev;
byte unit = (drive->select.b.unit & 0x01);
byte tmpbyte = 0x00;
int m5229_udma = hwif->channel? 0x57 : 0x56;
int m5229_udma = hwif->unit ? 0x57 : 0x56;
int err = 0;
if (speed < XFER_UDMA_0) {
......@@ -597,7 +597,7 @@ unsigned int __init ata66_ali15x3(struct ata_channel *hwif)
/*
* Allow ata66 if cable of current channel has 80 pins
*/
ata66 = (hwif->channel)?cable_80_pin[1]:cable_80_pin[0];
ata66 = (hwif->unit)?cable_80_pin[1]:cable_80_pin[0];
} else {
/*
* revision 0x20 (1543-E, 1543-F)
......@@ -639,7 +639,7 @@ void __init ide_init_ali15x3(struct ata_channel *hwif)
byte irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
1, 11, 0, 12, 0, 14, 0, 15 };
hwif->irq = hwif->channel ? 15 : 14;
hwif->irq = hwif->unit ? 15 : 14;
if (isa_dev) {
/*
......@@ -651,14 +651,14 @@ void __init ide_init_ali15x3(struct ata_channel *hwif)
ideic = ideic & 0x03;
/* get IRQ for IDE Controller */
if ((hwif->channel && ideic == 0x03) || (!hwif->channel && !ideic)) {
if ((hwif->unit && ideic == 0x03) || (!hwif->unit && !ideic)) {
/*
* get SIRQ1 routing table
*/
pci_read_config_byte(isa_dev, 0x44, &inmir);
inmir = inmir & 0x0f;
hwif->irq = irq_routing_table[inmir];
} else if (hwif->channel && !(ideic & 0x01)) {
} else if (hwif->unit && !(ideic & 0x01)) {
/*
* get SIRQ2 routing table
*/
......
......@@ -263,7 +263,7 @@ static int amd_set_drive(ide_drive_t *drive, unsigned char speed)
static void amd74xx_tune_drive(ide_drive_t *drive, unsigned char pio)
{
if (!((amd_enabled >> drive->channel->channel) & 1))
if (!((amd_enabled >> drive->channel->unit) & 1))
return;
if (pio == 255) {
......@@ -411,7 +411,7 @@ unsigned int __init pci_init_amd74xx(struct pci_dev *dev, const char *name)
unsigned int __init ata66_amd74xx(struct ata_channel *hwif)
{
return ((amd_enabled & amd_80w) >> hwif->channel) & 1;
return ((amd_enabled & amd_80w) >> hwif->unit) & 1;
}
void __init ide_init_amd74xx(struct ata_channel *hwif)
......@@ -426,7 +426,7 @@ void __init ide_init_amd74xx(struct ata_channel *hwif)
hwif->drives[i].io_32bit = 1;
hwif->drives[i].unmask = 1;
hwif->drives[i].autotune = 1;
hwif->drives[i].dn = hwif->channel * 2 + i;
hwif->drives[i].dn = hwif->unit * 2 + i;
}
#ifdef CONFIG_BLK_DEV_IDEDMA
......@@ -447,6 +447,6 @@ void __init ide_init_amd74xx(struct ata_channel *hwif)
void __init ide_dmacapable_amd74xx(struct ata_channel *hwif, unsigned long dmabase)
{
if ((amd_enabled >> hwif->channel) & 1)
if ((amd_enabled >> hwif->unit) & 1)
ide_setup_dma(hwif, dmabase, 8);
}
......@@ -795,7 +795,7 @@ int __init ide_probe_for_cmd640x (void)
cmd_hwif1->chipset = ide_cmd640;
cmd_hwif0->mate = cmd_hwif1;
cmd_hwif1->mate = cmd_hwif0;
cmd_hwif1->channel = 1;
cmd_hwif1->unit = 1;
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
cmd_hwif1->tuneproc = &cmd640_tune_drive;
#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
......
......@@ -224,7 +224,7 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ
{ DRWTIM0, DRWTIM1 },
{ DRWTIM2, DRWTIM3 }
};
int channel = (int) drive->channel->channel;
int channel = drive->channel->unit;
int slave = (drives != drive); /* Is this really the best way to determine this?? */
cmdprintk("program_drive_count parameters = s(%d),a(%d),r(%d),p(%d)\n", setup_count,
......@@ -336,7 +336,7 @@ static void cmd64x_tuneproc (ide_drive_t *drive, byte mode_wanted)
static byte cmd680_taskfile_timing(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
byte addr_mask = (hwif->channel) ? 0xB2 : 0xA2;
byte addr_mask = (hwif->unit) ? 0xB2 : 0xA2;
unsigned short timing;
pci_read_config_word(dev, addr_mask, &timing);
......@@ -397,7 +397,7 @@ static void config_cmd680_chipset_for_pio (ide_drive_t *drive, byte set_speed)
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
u8 unit = (drive->select.b.unit & 0x01);
u8 addr_mask = (hwif->channel) ? 0x84 : 0x80;
u8 addr_mask = (hwif->unit) ? 0x84 : 0x80;
u8 speed = 0x00;
u8 mode_pci = 0x00;
u8 channel_timings = cmd680_taskfile_timing(hwif);
......@@ -435,8 +435,8 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, byte speed)
int err = 0;
u8 unit = (drive->select.b.unit & 0x01);
u8 pciU = (hwif->channel) ? UDIDETCR1 : UDIDETCR0;
u8 pciD = (hwif->channel) ? BMIDESR1 : BMIDESR0;
u8 pciU = (hwif->unit) ? UDIDETCR1 : UDIDETCR0;
u8 pciD = (hwif->unit) ? BMIDESR1 : BMIDESR0;
u8 regU = 0;
u8 regD = 0;
......@@ -500,7 +500,7 @@ static int cmd680_tune_chipset (ide_drive_t *drive, byte speed)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
u8 addr_mask = (hwif->channel) ? 0x84 : 0x80;
u8 addr_mask = (hwif->unit) ? 0x84 : 0x80;
u8 unit = (drive->select.b.unit & 0x01);
u8 dma_pci = 0;
u8 udma_pci = 0;
......@@ -841,7 +841,7 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
byte dma_stat = 0;
byte dma_alt_stat = 0;
byte mask = (drive->channel->channel) ? MRDMODE_INTR_CH1 : MRDMODE_INTR_CH0;
byte mask = (drive->channel->unit) ? MRDMODE_INTR_CH1 : MRDMODE_INTR_CH0;
unsigned long dma_base = drive->channel->dma_base;
struct pci_dev *dev = drive->channel->pci_dev;
byte jack_slap = ((dev->device == PCI_DEVICE_ID_CMD_648) || (dev->device == PCI_DEVICE_ID_CMD_649)) ? 1 : 0;
......@@ -856,8 +856,8 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
outb(dma_stat|6, dma_base+2); /* clear the INTR & ERROR bits */
if (jack_slap) {
byte dma_intr = 0;
byte dma_mask = (drive->channel->channel) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
byte dma_reg = (drive->channel->channel) ? ARTTIM2 : CFR;
byte dma_mask = (drive->channel->unit) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
byte dma_reg = (drive->channel->unit) ? ARTTIM2 : CFR;
(void) pci_read_config_byte(dev, dma_reg, &dma_intr);
/*
* DAMN BMIDE is not connected to PCI space!
......@@ -918,7 +918,7 @@ static int cmd680_busproc (ide_drive_t * drive, int state)
{
#if 0
struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0;
u8 addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
u32 stat_config = 0;
pci_read_config_dword(hwif->pci_dev, addr_mask, &stat_config);
......@@ -951,7 +951,7 @@ static void cmd680_reset (ide_drive_t *drive)
{
#if 0
struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0;
u8 addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
byte reset = 0;
pci_read_config_byte(hwif->pci_dev, addr_mask, &reset);
......@@ -1084,7 +1084,7 @@ unsigned int __init pci_init_cmd64x(struct pci_dev *dev)
unsigned int cmd680_ata66(struct ata_channel *hwif)
{
byte ata66 = 0;
byte addr_mask = (hwif->channel) ? 0xB0 : 0xA0;
byte addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
pci_read_config_byte(hwif->pci_dev, addr_mask, &ata66);
return (ata66 & 0x01) ? 1 : 0;
......@@ -1093,7 +1093,7 @@ unsigned int cmd680_ata66(struct ata_channel *hwif)
unsigned int cmd64x_ata66(struct ata_channel *hwif)
{
byte ata66 = 0;
byte mask = (hwif->channel) ? 0x02 : 0x01;
byte mask = (hwif->unit) ? 0x02 : 0x01;
pci_read_config_byte(hwif->pci_dev, BMIDECSR, &ata66);
return (ata66 & mask) ? 1 : 0;
......
......@@ -101,7 +101,7 @@ static unsigned int cs5530_pio_timings[2][5] =
* After chip reset, the PIO timings are set to 0x0000e132, which is not valid.
*/
#define CS5530_BAD_PIO(timings) (((timings)&~0x80000000)==0x0000e132)
#define CS5530_BASEREG(hwif) (((hwif)->dma_base & ~0xf) + ((hwif)->channel ? 0x30 : 0x20))
#define CS5530_BASEREG(hwif) (((hwif)->dma_base & ~0xf) + ((hwif)->unit ? 0x30 : 0x20))
/*
* cs5530_tuneproc() handles selection/setting of PIO modes
......
......@@ -192,7 +192,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
if (mode > drive->id->tDMA) /* to be absolutly sure we have a valid mode */
mode = drive->id->tDMA;
index = (drive->channel->channel==0) ? CY82_INDEX_CHANNEL0 : CY82_INDEX_CHANNEL1;
index = (drive->channel->unit == 0) ? CY82_INDEX_CHANNEL0 : CY82_INDEX_CHANNEL1;
#if CY82C693_DEBUG_LOGS
/* for debug let's show the previous values */
......@@ -200,7 +200,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
OUT_BYTE(index, CY82_INDEX_PORT);
data = IN_BYTE(CY82_DATA_PORT);
printk (KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n", drive->name, drive->channel->channel, drive->select.b.unit, (data&0x3), ((data>>2)&1));
printk (KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n", drive->name, drive->channel->unit, drive->select.b.unit, (data&0x3), ((data>>2)&1));
#endif /* CY82C693_DEBUG_LOGS */
data = (byte)mode|(byte)(single<<2);
......@@ -209,7 +209,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
OUT_BYTE(data, CY82_DATA_PORT);
#if CY82C693_DEBUG_INFO
printk (KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n", drive->name, drive->channel->channel, drive->select.b.unit, mode, single);
printk (KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n", drive->name, drive->channel->unit, drive->select.b.unit, mode, single);
#endif /* CY82C693_DEBUG_INFO */
/*
......@@ -318,7 +318,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
pci_read_config_byte(dev, CY82_IDE_SLAVE_8BIT, &pclk.time_8);
}
printk (KERN_INFO "%s (ch=%d, dev=%d): PIO timing is (addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n", drive->name, hwif->channel, drive->select.b.unit, addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);
printk (KERN_INFO "%s (ch=%d, dev=%d): PIO timing is (addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n", drive->name, hwif->unit, drive->select.b.unit, addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);
#endif /* CY82C693_DEBUG_LOGS */
/* first let's calc the pio modes */
......@@ -371,7 +371,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
}
#if CY82C693_DEBUG_INFO
printk (KERN_INFO "%s (ch=%d, dev=%d): set PIO timing to (addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n", drive->name, hwif->channel, drive->select.b.unit, addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);
printk (KERN_INFO "%s (ch=%d, dev=%d): set PIO timing to (addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n", drive->name, hwif->unit, drive->select.b.unit, addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);
#endif /* CY82C693_DEBUG_INFO */
}
......
......@@ -126,5 +126,5 @@ void __init init_dtc2278 (void)
ide_hwifs[1].drives[1].no_unmask = 1;
ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1;
ide_hwifs[1].unit = 1;
}
......@@ -485,7 +485,7 @@ static unsigned int pci_bus_clock_list (byte speed, struct chipset_bus_clock_lis
static void hpt366_tune_chipset (ide_drive_t *drive, byte speed)
{
byte regtime = (drive->select.b.unit & 0x01) ? 0x44 : 0x40;
byte regfast = (drive->channel->channel) ? 0x55 : 0x51;
byte regfast = (drive->channel->unit) ? 0x55 : 0x51;
/*
* since the channel is always 0 it does not matter.
*/
......@@ -536,7 +536,7 @@ static void hpt366_tune_chipset (ide_drive_t *drive, byte speed)
static void hpt370_tune_chipset (ide_drive_t *drive, byte speed)
{
byte regfast = (drive->channel->channel) ? 0x55 : 0x51;
byte regfast = (drive->channel->unit) ? 0x55 : 0x51;
unsigned int list_conf = 0;
unsigned int drive_conf = 0;
unsigned int conf_mask = (speed >= XFER_MW_DMA_0) ? 0xc0000000 : 0x30070000;
......@@ -840,8 +840,8 @@ int hpt370_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
byte regstate = hwif->channel ? 0x54 : 0x50;
byte reginfo = hwif->channel ? 0x56 : 0x52;
byte regstate = hwif->unit ? 0x54 : 0x50;
byte reginfo = hwif->unit ? 0x56 : 0x52;
byte dma_stat;
switch (func) {
......@@ -900,7 +900,7 @@ void hpt3xx_reset (ide_drive_t *drive)
{
#if 0
unsigned long high_16 = pci_resource_start(drive->channel->pci_dev, 4);
byte reset = (drive->channel->channel) ? 0x80 : 0x40;
byte reset = (drive->channel->unit) ? 0x80 : 0x40;
byte reg59h = 0;
pci_read_config_byte(drive->channel->pci_dev, 0x59, &reg59h);
......@@ -914,8 +914,8 @@ static int hpt3xx_tristate (ide_drive_t * drive, int state)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
byte reset = (hwif->channel) ? 0x80 : 0x40;
byte state_reg = (hwif->channel) ? 0x57 : 0x53;
byte reset = (hwif->unit) ? 0x80 : 0x40;
byte state_reg = (hwif->unit) ? 0x57 : 0x53;
byte reg59h = 0;
byte regXXh = 0;
......@@ -960,7 +960,7 @@ static int hpt370_busproc(ide_drive_t * drive, int state)
hwif->bus_state = state;
if (hwif->channel) {
if (hwif->unit) {
/* secondary channel */
tristate = 0x56;
resetmask = 0x80;
......@@ -1139,7 +1139,7 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev)
unsigned int __init ata66_hpt366(struct ata_channel *hwif)
{
byte ata66 = 0;
byte regmask = (hwif->channel) ? 0x01 : 0x02;
byte regmask = (hwif->unit) ? 0x01 : 0x02;
pci_read_config_byte(hwif->pci_dev, 0x5a, &ata66);
#ifdef DEBUG
......@@ -1214,8 +1214,8 @@ void __init ide_dmacapable_hpt366(struct ata_channel *hwif, unsigned long dmabas
{
byte masterdma = 0, slavedma = 0;
byte dma_new = 0, dma_old = inb(dmabase+2);
byte primary = hwif->channel ? 0x4b : 0x43;
byte secondary = hwif->channel ? 0x4f : 0x47;
byte primary = hwif->unit ? 0x4b : 0x43;
byte secondary = hwif->unit ? 0x4f : 0x47;
unsigned long flags;
__save_flags(flags); /* local CPU only */
......
......@@ -321,7 +321,7 @@ void __init init_ht6560b (void)
ide_hwifs[1].serialized = 1; /* is this needed? */
ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1;
ide_hwifs[1].unit = 1;
/*
* Setting default configurations for drives
......
......@@ -621,7 +621,7 @@ static int __init icside_register_v6(struct expansion_card *ec, int autodma)
hwif->hw.dma = ec->dma;
hwif->hw.priv = (void *)
(port + ICS_ARCIN_V6_INTRSTAT_1);
hwif->channel = 0;
hwif->unit = 0;
icside_setup_dma(hwif, autodma);
}
if (mate) {
......@@ -630,7 +630,7 @@ static int __init icside_register_v6(struct expansion_card *ec, int autodma)
mate->hw.dma = ec->dma;
mate->hw.priv = (void *)
(port + ICS_ARCIN_V6_INTRSTAT_2);
mate->channel = 1;
mate->unit = 1;
icside_setup_dma(mate, autodma);
}
}
......
......@@ -1036,7 +1036,7 @@ static void idedisk_setup(ide_drive_t *drive)
sprintf(drive->device.bus_id, "%d", drvid);
sprintf(drive->device.name, "ide-disk");
drive->device.driver = &idedisk_devdrv;
drive->device.parent = &drive->channel->device;
drive->device.parent = &drive->channel->dev;
drive->device.driver_data = drive;
device_register(&drive->device);
}
......
......@@ -660,7 +660,7 @@ void ide_release_dma(struct ata_channel *hwif)
kfree(hwif->sg_table);
hwif->sg_table = NULL;
}
if ((hwif->dma_extra) && (hwif->channel == 0))
if ((hwif->dma_extra) && (hwif->unit == 0))
release_region((hwif->dma_base + 16), hwif->dma_extra);
release_region(hwif->dma_base, 8);
hwif->dma_base = 0;
......
......@@ -442,7 +442,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
*/
if (hwif->mate && hwif->mate->dma_base)
dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8);
dma_base = hwif->mate->dma_base - (hwif->unit ? 0 : 8);
else
dma_base = pci_resource_start(dev, 4);
......@@ -452,7 +452,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
if (extra) /* PDC20246, PDC20262, HPT343, & HPT366 */
request_region(dma_base + 16, extra, name);
dma_base += hwif->channel ? 8 : 0;
dma_base += hwif->unit ? 8 : 0;
hwif->dma_extra = extra;
if ((dev->vendor == PCI_VENDOR_ID_AL && dev->device == PCI_DEVICE_ID_AL_M5219) ||
......@@ -610,7 +610,7 @@ static int __init setup_host_channel(struct pci_dev *dev,
hwif->chipset = ide_pci;
hwif->pci_dev = dev;
hwif->channel = port;
hwif->unit = port;
if (!hwif->irq)
hwif->irq = pciirq;
......
......@@ -118,7 +118,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
byte type = (id->config >> 8) & 0x1f;
printk("ATAPI ");
#ifdef CONFIG_BLK_DEV_PDC4030
if (drive->channel->channel == 1 && drive->channel->chipset == ide_pdc4030) {
if (drive->channel->unit == 1 && drive->channel->chipset == ide_pdc4030) {
printk(" -- not supported on 2nd Promise port\n");
goto err_misc;
}
......@@ -461,16 +461,16 @@ static void hwif_register(struct ata_channel *hwif)
{
/* Register this hardware interface within the global device tree.
*/
sprintf(hwif->device.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
sprintf(hwif->device.name, "ide");
hwif->device.driver_data = hwif;
sprintf(hwif->dev.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
sprintf(hwif->dev.name, "ide");
hwif->dev.driver_data = hwif;
#ifdef CONFIG_BLK_DEV_IDEPCI
if (hwif->pci_dev)
hwif->device.parent = &hwif->pci_dev->dev;
hwif->dev.parent = &hwif->pci_dev->dev;
else
#endif
hwif->device.parent = NULL; /* Would like to do = &device_legacy */
device_register(&hwif->device);
hwif->dev.parent = NULL; /* Would like to do = &device_legacy */
device_register(&hwif->dev);
if (((unsigned long)hwif->io_ports[IDE_DATA_OFFSET] | 7) ==
((unsigned long)hwif->io_ports[IDE_STATUS_OFFSET])) {
......@@ -517,7 +517,7 @@ static void probe_hwif(struct ata_channel *hwif)
if (
#if CONFIG_BLK_DEV_PDC4030
(hwif->chipset != ide_pdc4030 || hwif->channel == 0) &&
(hwif->chipset != ide_pdc4030 || hwif->unit == 0) &&
#endif
hwif_check_regions(hwif)) {
int msgout = 0;
......@@ -824,11 +824,11 @@ static void init_gendisk(struct ata_channel *hwif)
for (unit = 0; unit < MAX_DRIVES; ++unit) {
char name[80];
ide_add_generic_settings(hwif->drives + unit);
hwif->drives[unit].dn = ((hwif->channel ? 2 : 0) + unit);
hwif->drives[unit].dn = ((hwif->unit ? 2 : 0) + unit);
sprintf (name, "host%d/bus%d/target%d/lun%d",
(hwif->channel && hwif->mate) ?
(hwif->unit && hwif->mate) ?
hwif->mate->index : hwif->index,
hwif->channel, unit, hwif->drives[unit].lun);
hwif->unit, unit, hwif->drives[unit].lun);
if (hwif->drives[unit].present)
hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL);
}
......
......@@ -183,7 +183,7 @@ static int proc_ide_read_channel
struct ata_channel *hwif = data;
int len;
page[0] = hwif->channel ? '1' : '0';
page[0] = hwif->unit ? '1' : '0';
page[1] = '\n';
len = 2;
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
......
......@@ -3103,10 +3103,10 @@ static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive)
idetape_tape_t *tape = drive->driver_data;
idetape_read_position_result_t *result;
//#if IDETAPE_DEBUG_LOG
// if (tape->debug_level >= 4)
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_read_position_callback\n");
//#endif /* IDETAPE_DEBUG_LOG */
#endif /* IDETAPE_DEBUG_LOG */
if (!tape->pc->error) {
result = (idetape_read_position_result_t *) tape->pc->buffer;
......@@ -3280,10 +3280,10 @@ static int idetape_read_position (ide_drive_t *drive)
idetape_pc_t pc;
int position;
//#if IDETAPE_DEBUG_LOG
// if (tape->debug_level >= 4)
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_read_position\n");
//#endif /* IDETAPE_DEBUG_LOG */
#endif /* IDETAPE_DEBUG_LOG */
#ifdef NO_LONGER_REQUIRED
idetape_flush_tape_buffers(drive);
......
......@@ -1213,40 +1213,20 @@ static inline ide_drive_t *choose_drive(ide_hwgroup_t *hwgroup)
{
ide_drive_t *drive, *best;
repeat:
best = NULL;
drive = hwgroup->drive;
do {
if (!list_empty(&drive->queue.queue_head) && (!drive->PADAM_sleep || 0 <= (signed long)(jiffies - drive->PADAM_sleep))) {
if (!list_empty(&drive->queue.queue_head)
&& (!drive->PADAM_sleep || time_after_eq(drive->PADAM_sleep, jiffies))) {
if (!best
|| (drive->PADAM_sleep && (!best->PADAM_sleep || 0 < (signed long)(best->PADAM_sleep - drive->PADAM_sleep)))
|| (!best->PADAM_sleep && 0 < (signed long)((best->PADAM_service_start + 2 * best->PADAM_service_time)
- (drive->PADAM_service_start + 2 * drive->PADAM_service_time))))
|| (drive->PADAM_sleep && (!best->PADAM_sleep || time_after(best->PADAM_sleep, drive->PADAM_sleep)))
|| (!best->PADAM_sleep && time_after(best->PADAM_service_start + 2 * best->PADAM_service_time, drive->PADAM_service_start + 2 * drive->PADAM_service_time)))
{
if (!blk_queue_plugged(&drive->queue))
best = drive;
}
}
} while ((drive = drive->next) != hwgroup->drive);
if (best && best->nice1 && !best->PADAM_sleep && best != hwgroup->drive && best->PADAM_service_time > WAIT_MIN_SLEEP) {
long t = (signed long)((best->PADAM_service_start + 2 * best->PADAM_service_time) - jiffies);
if (t >= WAIT_MIN_SLEEP) {
/*
* We *may* have some time to spare, but first let's see if
* someone can potentially benefit from our nice mood today..
*/
drive = best->next;
do {
if (!drive->PADAM_sleep
&& 0 < (signed long)((drive->PADAM_service_start + 2 * drive->PADAM_service_time) - (jiffies - best->PADAM_service_time))
&& 0 < (signed long)((jiffies + t) - (drive->PADAM_service_start + 2 * drive->PADAM_service_time)))
{
ide_stall_queue(best, min(t, 10L * WAIT_MIN_SLEEP));
goto repeat;
}
} while ((drive = drive->next) != best);
}
}
return best;
}
......@@ -1298,7 +1278,7 @@ static void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq)
hwgroup->rq = NULL;
drive = hwgroup->drive;
do {
if (drive->PADAM_sleep && (!sleep || 0 < (signed long)(sleep - drive->PADAM_sleep)))
if (drive->PADAM_sleep && (!sleep || time_after(sleep, drive->PADAM_sleep)))
sleep = drive->PADAM_sleep;
} while ((drive = drive->next) != hwgroup->drive);
if (sleep) {
......@@ -1968,23 +1948,22 @@ static void hwif_unregister(struct ata_channel *hwif)
#endif
}
void ide_unregister(struct ata_channel *hwif)
void ide_unregister(struct ata_channel *channel)
{
struct gendisk *gd;
ide_drive_t *drive, *d;
struct ata_channel *g;
ide_hwgroup_t *hwgroup;
int irq_count = 0, unit, i;
int unit, i;
unsigned long flags;
unsigned int p, minor;
struct ata_channel old_hwif;
spin_lock_irqsave(&ide_lock, flags);
if (!hwif->present)
if (!channel->present)
goto abort;
put_device(&hwif->device);
put_device(&channel->dev);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &hwif->drives[unit];
drive = &channel->drives[unit];
if (!drive->present)
continue;
if (drive->busy || drive->usage)
......@@ -1997,43 +1976,47 @@ void ide_unregister(struct ata_channel *hwif)
ide_unregister_subdriver(drive);
}
}
hwif->present = 0;
channel->present = 0;
/*
* All clear? Then blow away the buffer cache
*/
spin_unlock_irqrestore(&ide_lock, flags);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &hwif->drives[unit];
drive = &channel->drives[unit];
if (!drive->present)
continue;
minor = drive->select.b.unit << PARTN_BITS;
for (p = 0; p < (1<<PARTN_BITS); ++p) {
if (drive->part[p].nr_sects > 0) {
kdev_t devp = mk_kdev(hwif->major, minor+p);
kdev_t devp = mk_kdev(channel->major, minor+p);
invalidate_device(devp, 0);
}
}
}
#ifdef CONFIG_PROC_FS
destroy_proc_ide_drives(hwif);
destroy_proc_ide_drives(channel);
#endif
spin_lock_irqsave(&ide_lock, flags);
hwgroup = hwif->hwgroup;
hwgroup = channel->hwgroup;
/*
* free the irq if we were the only hwif using it
*/
{
struct ata_channel *g;
int irq_count = 0;
g = hwgroup->hwif;
do {
if (g->irq == hwif->irq)
if (g->irq == channel->irq)
++irq_count;
g = g->next;
} while (g != hwgroup->hwif);
if (irq_count == 1)
free_irq(hwif->irq, hwgroup);
hwif_unregister(hwif);
free_irq(channel->irq, hwgroup);
}
hwif_unregister(channel);
/*
* Remove us from the hwgroup, and free
......@@ -2041,7 +2024,7 @@ void ide_unregister(struct ata_channel *hwif)
*/
d = hwgroup->drive;
for (i = 0; i < MAX_DRIVES; ++i) {
drive = &hwif->drives[i];
drive = &channel->drives[i];
if (drive->de) {
devfs_unregister (drive->de);
drive->de = NULL;
......@@ -2062,27 +2045,27 @@ void ide_unregister(struct ata_channel *hwif)
}
if (d->present)
hwgroup->drive = d;
while (hwgroup->hwif->next != hwif)
while (hwgroup->hwif->next != channel)
hwgroup->hwif = hwgroup->hwif->next;
hwgroup->hwif->next = hwif->next;
if (hwgroup->hwif == hwif)
hwgroup->hwif->next = channel->next;
if (hwgroup->hwif == channel)
kfree(hwgroup);
else
hwgroup->hwif = hwgroup->drive->channel;
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
ide_release_dma(hwif);
ide_release_dma(channel);
#endif
/*
* Remove us from the kernel's knowledge
*/
unregister_blkdev(hwif->major, hwif->name);
kfree(blksize_size[hwif->major]);
blk_dev[hwif->major].data = NULL;
blk_dev[hwif->major].queue = NULL;
blk_clear(hwif->major);
gd = hwif->gd;
unregister_blkdev(channel->major, channel->name);
kfree(blksize_size[channel->major]);
blk_dev[channel->major].data = NULL;
blk_dev[channel->major].queue = NULL;
blk_clear(channel->major);
gd = channel->gd;
if (gd) {
del_gendisk(gd);
kfree(gd->sizes);
......@@ -2092,45 +2075,45 @@ void ide_unregister(struct ata_channel *hwif)
if (gd->flags)
kfree (gd->flags);
kfree(gd);
hwif->gd = NULL;
channel->gd = NULL;
}
/*
* Reinitialize the hwif handler, but preserve any special methods for
* Reinitialize the channel handler, but preserve any special methods for
* it.
*/
old_hwif = *hwif;
init_hwif_data(hwif, hwif->index);
hwif->hwgroup = old_hwif.hwgroup;
hwif->tuneproc = old_hwif.tuneproc;
hwif->speedproc = old_hwif.speedproc;
hwif->selectproc = old_hwif.selectproc;
hwif->resetproc = old_hwif.resetproc;
hwif->intrproc = old_hwif.intrproc;
hwif->maskproc = old_hwif.maskproc;
hwif->quirkproc = old_hwif.quirkproc;
hwif->rwproc = old_hwif.rwproc;
hwif->ideproc = old_hwif.ideproc;
hwif->dmaproc = old_hwif.dmaproc;
hwif->busproc = old_hwif.busproc;
hwif->bus_state = old_hwif.bus_state;
hwif->dma_base = old_hwif.dma_base;
hwif->dma_extra = old_hwif.dma_extra;
hwif->config_data = old_hwif.config_data;
hwif->select_data = old_hwif.select_data;
hwif->proc = old_hwif.proc;
old_hwif = *channel;
init_hwif_data(channel, channel->index);
channel->hwgroup = old_hwif.hwgroup;
channel->tuneproc = old_hwif.tuneproc;
channel->speedproc = old_hwif.speedproc;
channel->selectproc = old_hwif.selectproc;
channel->resetproc = old_hwif.resetproc;
channel->intrproc = old_hwif.intrproc;
channel->maskproc = old_hwif.maskproc;
channel->quirkproc = old_hwif.quirkproc;
channel->rwproc = old_hwif.rwproc;
channel->ideproc = old_hwif.ideproc;
channel->dmaproc = old_hwif.dmaproc;
channel->busproc = old_hwif.busproc;
channel->bus_state = old_hwif.bus_state;
channel->dma_base = old_hwif.dma_base;
channel->dma_extra = old_hwif.dma_extra;
channel->config_data = old_hwif.config_data;
channel->select_data = old_hwif.select_data;
channel->proc = old_hwif.proc;
#ifndef CONFIG_BLK_DEV_IDECS
hwif->irq = old_hwif.irq;
channel->irq = old_hwif.irq;
#endif
hwif->major = old_hwif.major;
hwif->chipset = old_hwif.chipset;
hwif->autodma = old_hwif.autodma;
hwif->udma_four = old_hwif.udma_four;
channel->major = old_hwif.major;
channel->chipset = old_hwif.chipset;
channel->autodma = old_hwif.autodma;
channel->udma_four = old_hwif.udma_four;
#ifdef CONFIG_BLK_DEV_IDEPCI
hwif->pci_dev = old_hwif.pci_dev;
channel->pci_dev = old_hwif.pci_dev;
#endif
hwif->straight8 = old_hwif.straight8;
channel->straight8 = old_hwif.straight8;
abort:
spin_unlock_irqrestore(&ide_lock, flags);
}
......@@ -2419,7 +2402,6 @@ void ide_add_generic_settings (ide_drive_t *drive)
*/
ide_add_setting(drive, "io_32bit", drive->no_io_32bit ? SETTING_READ : SETTING_RW, HDIO_GET_32BIT, HDIO_SET_32BIT, TYPE_BYTE, 0, 1 + (SUPPORT_VLB_SYNC << 1), 1, 1, &drive->io_32bit, set_io_32bit);
ide_add_setting(drive, "keepsettings", SETTING_RW, HDIO_GET_KEEPSETTINGS, HDIO_SET_KEEPSETTINGS, TYPE_BYTE, 0, 1, 1, 1, &drive->keep_settings, NULL);
ide_add_setting(drive, "nice1", SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->nice1, NULL);
ide_add_setting(drive, "pio_mode", SETTING_WRITE, -1, HDIO_SET_PIO_MODE, TYPE_BYTE, 0, 255, 1, 1, NULL, set_pio_mode);
ide_add_setting(drive, "slow", SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->slow, NULL);
ide_add_setting(drive, "unmaskirq", drive->no_unmask ? SETTING_READ : SETTING_RW, HDIO_GET_UNMASKINTR, HDIO_SET_UNMASKINTR, TYPE_BYTE, 0, 1, 1, 1, &drive->unmask, NULL);
......@@ -2545,10 +2527,7 @@ static int ide_ioctl (struct inode *inode, struct file *file,
case HDIO_GET_NICE:
return put_user(drive->dsc_overlap << IDE_NICE_DSC_OVERLAP |
drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP |
drive->nice0 << IDE_NICE_0 |
drive->nice1 << IDE_NICE_1 |
drive->nice2 << IDE_NICE_2,
drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP,
(long *) arg);
case HDIO_DRIVE_CMD:
......@@ -2563,7 +2542,7 @@ static int ide_ioctl (struct inode *inode, struct file *file,
case HDIO_SET_NICE:
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP) | (1 << IDE_NICE_1))))
if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP))))
return -EPERM;
drive->dsc_overlap = (arg >> IDE_NICE_DSC_OVERLAP) & 1;
/* Only CD-ROM's and tapes support DSC overlap. */
......@@ -2571,7 +2550,6 @@ static int ide_ioctl (struct inode *inode, struct file *file,
drive->dsc_overlap = 0;
return -EPERM;
}
drive->nice1 = (arg >> IDE_NICE_1) & 1;
return 0;
case BLKGETSIZE:
case BLKGETSIZE64:
......@@ -3151,7 +3129,7 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver)
}
/* FIXME: This will be pushed to the drivers! Thus allowing us to
* save one parameter here eparate this out.
* save one parameter here separate this out.
*/
drive->driver = driver;
......@@ -3175,7 +3153,6 @@ int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *driver)
/* Only CD-ROMs and tape drives support DSC overlap. */
drive->dsc_overlap = (drive->next != drive
&& (drive->type == ATA_ROM || drive->type == ATA_TAPE));
drive->nice1 = 1;
}
drive->revalidate = 1;
drive->suspend_reset = 0;
......
......@@ -43,12 +43,12 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
new = *old;
/* Adjust IRQ enable bit */
bit = 1 << (8 + hwif->channel);
bit = 1 << (8 + hwif->unit);
new = drive->present ? (new & ~bit) : (new | bit);
/* Select PIO or DMA, DMA may only be selected for one drive/channel. */
bit = 1 << (20 + drive->select.b.unit + (hwif->channel << 1));
other = 1 << (20 + (1 - drive->select.b.unit) + (hwif->channel << 1));
bit = 1 << (20 + drive->select.b.unit + (hwif->unit << 1));
other = 1 << (20 + (1 - drive->select.b.unit) + (hwif->unit << 1));
new = use_dma ? ((new & ~other) | bit) : (new & ~bit);
if (new != *old) {
......@@ -138,9 +138,9 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
(void) pci_read_config_dword(dev, 0x40, &ctrl);
(void) pci_read_config_byte(dev, 0x09, &progif);
/* is irq in "native" mode? */
using_inta = progif & (1 << (hwif->channel << 1));
using_inta = progif & (1 << (hwif->unit << 1));
if (!using_inta)
using_inta = ctrl & (1 << (4 + hwif->channel));
using_inta = ctrl & (1 << (4 + hwif->unit));
if (hwif->mate) {
hwif->select_data = hwif->mate->select_data;
} else {
......@@ -180,7 +180,7 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
outb(0x60, hwif->dma_base + 2);
if (!using_inta)
hwif->irq = hwif->channel ? 15 : 14; /* legacy mode */
hwif->irq = hwif->unit ? 15 : 14; /* legacy mode */
else if (!hwif->irq && hwif->mate && hwif->mate->irq)
hwif->irq = hwif->mate->irq; /* share IRQ with mate */
......
......@@ -530,7 +530,7 @@ static int pdc202xx_new_tune_chipset (ide_drive_t *drive, byte speed)
#else
struct pci_dev *dev = hwif->pci_dev;
unsigned long high_16 = pci_resource_start(dev, 4);
unsigned long indexreg = high_16 + (hwif->channel ? 0x09 : 0x01);
unsigned long indexreg = high_16 + (hwif->unit ? 0x09 : 0x01);
unsigned long datareg = (indexreg + 2);
#endif /* CONFIG_BLK_DEV_IDEDMA */
byte thold = 0x10;
......@@ -725,8 +725,8 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
byte udma_66 = ((eighty_ninty_three(drive)) && udma_33) ? 1 : 0;
byte udma_100 = 0;
byte udma_133 = 0;
byte mask = hwif->channel ? 0x08 : 0x02;
unsigned short c_mask = hwif->channel ? (1<<11) : (1<<10);
byte mask = hwif->unit ? 0x08 : 0x02;
unsigned short c_mask = hwif->unit ? (1<<11) : (1<<10);
byte ultra_66 = ((id->dma_ultra & 0x0010) ||
(id->dma_ultra & 0x0008)) ? 1 : 0;
......@@ -792,14 +792,14 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
if (((ultra_66) || (ultra_100) || (ultra_133)) && (cable)) {
#ifdef DEBUG
printk("ULTRA66: %s channel of Ultra 66 requires an 80-pin cable for Ultra66 operation.\n", hwif->channel ? "Secondary" : "Primary");
printk("ULTRA66: %s channel of Ultra 66 requires an 80-pin cable for Ultra66 operation.\n", hwif->unit ? "Secondary" : "Primary");
printk(" Switching to Ultra33 mode.\n");
#endif /* DEBUG */
/* Primary : zero out second bit */
/* Secondary : zero out fourth bit */
if (!jumpbit)
OUT_BYTE(CLKSPD & ~mask, (high_16 + 0x11));
printk("Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary");
printk("Warning: %s channel requires an 80-pin cable for operation.\n", hwif->unit ? "Secondary":"Primary");
printk("%s reduced to Ultra33 mode.\n", drive->name);
udma_66 = 0; udma_100 = 0; udma_133 = 0;
} else {
......@@ -990,7 +990,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
unsigned long high_16 = pci_resource_start(dev, 4);
unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x00);
unsigned long atapi_reg = high_16 + (hwif->unit ? 0x24 : 0x00);
unsigned long dma_base = hwif->dma_base;
switch (dev->device) {
......@@ -1023,7 +1023,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
struct request *rq = HWGROUP(drive)->rq;
unsigned long word_count = 0;
outb(clock|(hwif->channel ? 0x08 : 0x02), high_16 + 0x11);
outb(clock|(hwif->unit ? 0x08 : 0x02), high_16 + 0x11);
word_count = (rq->nr_sectors << 8);
word_count = (rq_data_dir(rq) == READ) ? word_count | 0x05000000 : word_count | 0x06000000;
outl(word_count, atapi_reg);
......@@ -1033,7 +1033,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
if ((drive->addressing) && (hardware48hack)) {
outl(0, atapi_reg); /* zero out extra */
clock = IN_BYTE(high_16 + 0x11);
OUT_BYTE(clock & ~(hwif->channel ? 0x08:0x02), high_16 + 0x11);
OUT_BYTE(clock & ~(hwif->unit ? 0x08:0x02), high_16 + 0x11);
}
break;
case ide_dma_test_irq: /* returns 1 if dma irq issued, 0 otherwise */
......@@ -1042,7 +1042,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
return (dma_stat & 4) == 4;
sc1d = IN_BYTE(high_16 + 0x001d);
if (drive->channel->channel) {
if (drive->channel->unit) {
if ((sc1d & 0x50) == 0x50) goto somebody_else;
else if ((sc1d & 0x40) == 0x40)
return (dma_stat & 4) == 4;
......@@ -1071,7 +1071,7 @@ void pdc202xx_new_reset (ide_drive_t *drive)
OUT_BYTE(0x00,IDE_CONTROL_REG);
mdelay(1000);
printk("PDC202XX: %s channel reset.\n",
drive->channel->channel ? "Secondary" : "Primary");
drive->channel->unit ? "Secondary" : "Primary");
}
void pdc202xx_reset (ide_drive_t *drive)
......@@ -1084,7 +1084,7 @@ void pdc202xx_reset (ide_drive_t *drive)
OUT_BYTE(udma_speed_flag & ~0x10, high_16 + 0x001f);
mdelay(2000); /* 2 seconds ?! */
printk("PDC202XX: %s channel reset.\n",
drive->channel->channel ? "Secondary" : "Primary");
drive->channel->unit ? "Secondary" : "Primary");
}
/*
......@@ -1218,7 +1218,7 @@ unsigned int __init pci_init_pdc202xx(struct pci_dev *dev)
unsigned int __init ata66_pdc202xx(struct ata_channel *hwif)
{
unsigned short mask = (hwif->channel) ? (1<<11) : (1<<10);
unsigned short mask = (hwif->unit) ? (1<<11) : (1<<10);
unsigned short CIS;
switch(hwif->pci_dev->device) {
......
......@@ -99,7 +99,7 @@ static void promise_selectproc (ide_drive_t *drive)
{
unsigned int number;
number = (drive->channel->channel << 1) + drive->select.b.unit;
number = (drive->channel->unit << 1) + drive->select.b.unit;
OUT_BYTE(number,IDE_FEATURE_REG);
}
......@@ -226,7 +226,7 @@ int __init setup_pdc4030(struct ata_channel *hwif)
hwif->chipset = hwif2->chipset = ide_pdc4030;
hwif->mate = hwif2;
hwif2->mate = hwif;
hwif2->channel = 1;
hwif2->unit = 1;
hwif->selectproc = hwif2->selectproc = &promise_selectproc;
hwif->serialized = hwif2->serialized = 1;
......
......@@ -357,7 +357,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
static void piix_tune_drive(ide_drive_t *drive, unsigned char pio)
{
if (!((piix_enabled >> drive->channel->channel) & 1))
if (!((piix_enabled >> drive->channel->unit) & 1))
return;
if (pio == 255) {
......@@ -535,7 +535,7 @@ unsigned int __init pci_init_piix(struct pci_dev *dev, const char *name)
unsigned int __init ata66_piix(struct ata_channel *hwif)
{
return ((piix_enabled & piix_80w) >> hwif->channel) & 1;
return ((piix_enabled & piix_80w) >> hwif->unit) & 1;
}
void __init ide_init_piix(struct ata_channel *hwif)
......@@ -550,7 +550,7 @@ void __init ide_init_piix(struct ata_channel *hwif)
hwif->drives[i].io_32bit = 1;
hwif->drives[i].unmask = 1;
hwif->drives[i].autotune = 1;
hwif->drives[i].dn = hwif->channel * 2 + i;
hwif->drives[i].dn = hwif->unit * 2 + i;
}
#ifdef CONFIG_BLK_DEV_IDEDMA
......@@ -572,7 +572,7 @@ void __init ide_init_piix(struct ata_channel *hwif)
void __init ide_dmacapable_piix(struct ata_channel *hwif, unsigned long dmabase)
{
if (((piix_enabled >> hwif->channel) & 1)
if (((piix_enabled >> hwif->unit) & 1)
&& !(piix_config->flags & PIIX_NODMA))
ide_setup_dma(hwif, dmabase, 8);
}
......@@ -291,7 +291,7 @@ static void qd6580_tune_drive (ide_drive_t *drive, byte pio)
printk(KERN_INFO "%s: PIO mode%d\n", drive->name, pio - XFER_PIO_0);
}
if (!drive->channel->channel && drive->type != ATA_DISK) {
if (!drive->channel->unit && drive->type != ATA_DISK) {
qd_write_reg(0x5f,QD_CONTROL_PORT);
printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO and post-write buffer on %s.\n",drive->name, drive->channel->name);
}
......@@ -420,7 +420,7 @@ int __init probe (int base)
ide_hwifs[i].chipset = ide_qd65xx;
ide_hwifs[i].mate = &ide_hwifs[i^1];
ide_hwifs[i].channel = i;
ide_hwifs[i].unit = i;
ide_hwifs[i].select_data = base;
ide_hwifs[i].config_data = config | (control <<8);
......
......@@ -71,7 +71,7 @@ static void __init init_rz1000 (struct pci_dev *dev, const char *name)
hwif->drives[0].no_unmask = 1;
hwif->drives[1].no_unmask = 1;
if (hwif->io_ports[IDE_DATA_OFFSET] == 0x170)
hwif->channel = 1;
hwif->unit = 1;
printk("%s: serialized, disabled unmasking (buggy %s)\n", hwif->name, name);
}
}
......
......@@ -255,7 +255,7 @@ static int svwks_tune_chipset (ide_drive_t *drive, byte speed)
byte drive_pci = 0x00;
byte drive_pci2 = 0x00;
byte drive_pci3 = hwif->channel ? 0x57 : 0x56;
byte drive_pci3 = hwif->unit ? 0x57 : 0x56;
byte ultra_enable = 0x00;
byte ultra_timing = 0x00;
......@@ -590,7 +590,7 @@ static unsigned int __init ata66_svwks_dell(struct ata_channel *hwif)
if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
return ((1 << (hwif->channel + 14)) &
return ((1 << (hwif->unit + 14)) &
dev->subsystem_device) ? 1 : 0;
return 0;
}
......@@ -607,7 +607,7 @@ static unsigned int __init ata66_svwks_cobalt(struct ata_channel *hwif)
if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN &&
dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
return ((1 << (hwif->channel + 14)) &
return ((1 << (hwif->unit + 14)) &
dev->subsystem_device) ? 1 : 0;
return 0;
}
......@@ -630,7 +630,7 @@ unsigned int __init ata66_svwks(struct ata_channel *hwif)
void __init ide_init_svwks(struct ata_channel *hwif)
{
if (!hwif->irq)
hwif->irq = hwif->channel ? 15 : 14;
hwif->irq = hwif->unit ? 15 : 14;
hwif->tuneproc = &svwks_tune_drive;
hwif->speedproc = &svwks_tune_chipset;
......
......@@ -844,7 +844,7 @@ unsigned int __init pci_init_sis5513(struct pci_dev *dev)
unsigned int __init ata66_sis5513(struct ata_channel *hwif)
{
byte reg48h = 0, ata66 = 0;
byte mask = hwif->channel ? 0x20 : 0x10;
byte mask = hwif->unit ? 0x20 : 0x10;
pci_read_config_byte(hwif->pci_dev, 0x48, &reg48h);
if (dma_capability >= ATA_66) {
......@@ -856,7 +856,7 @@ unsigned int __init ata66_sis5513(struct ata_channel *hwif)
void __init ide_init_sis5513(struct ata_channel *hwif)
{
hwif->irq = hwif->channel ? 15 : 14;
hwif->irq = hwif->unit ? 15 : 14;
hwif->tuneproc = &sis5513_tune_drive;
hwif->speedproc = &sis5513_tune_chipset;
......
......@@ -63,7 +63,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report)
unsigned short drv_ctrl = 0x909;
unsigned int xfer_mode, reg;
reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
reg = (hwif->unit ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
if (pio == 255)
xfer_mode = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
......@@ -100,7 +100,7 @@ static int config_for_dma(ide_drive_t *drive)
unsigned short drv_ctrl = 0x909;
unsigned int reg;
reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
reg = (hwif->unit ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
if (ide_config_drive_speed(drive, XFER_MW_DMA_2) == 0)
drv_ctrl = 0x0240;
......
......@@ -153,14 +153,14 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
if (reg != hwif->select_data) {
hwif->select_data = reg;
outb(0x51|(hwif->channel<<3), hwif->config_data+1); /* set PIO/DMA */
outb(0x51|(hwif->unit<<3), hwif->config_data+1); /* set PIO/DMA */
outw(reg & 0xff, hwif->config_data);
}
/* enable IRQ if not probing */
if (drive->present) {
reg = inw(hwif->config_data+3) & 0x13;
reg &= ~(1 << hwif->channel);
reg &= ~(1 << hwif->unit);
outw(reg, hwif->config_data+3);
}
......@@ -237,7 +237,7 @@ void __init ide_init_trm290(struct ata_channel *hwif)
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
/* put config reg into first byte of hwif->select_data */
outb(0x51|(hwif->channel<<3), hwif->config_data+1);
outb(0x51|(hwif->unit<<3), hwif->config_data+1);
hwif->select_data = 0x21; /* select PIO as default */
outb(hwif->select_data, hwif->config_data);
reg = inb(hwif->config_data+3); /* get IRQ info */
......@@ -246,10 +246,10 @@ void __init ide_init_trm290(struct ata_channel *hwif)
__restore_flags(flags); /* local CPU only */
if ((reg & 0x10))
hwif->irq = hwif->channel ? 15 : 14; /* legacy mode */
hwif->irq = hwif->unit ? 15 : 14; /* legacy mode */
else if (!hwif->irq && hwif->mate && hwif->mate->irq)
hwif->irq = hwif->mate->irq; /* sharing IRQ with mate */
ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->unit ? 0x0080 : 0x0000), 3);
#ifdef CONFIG_BLK_DEV_IDEDMA
hwif->dmaproc = &trm290_dmaproc;
......@@ -264,10 +264,10 @@ void __init ide_init_trm290(struct ata_channel *hwif)
* for the control basereg, so this kludge ensures that we use only
* values that are known to work. Ugh. -ml
*/
unsigned short old, compat = hwif->channel ? 0x374 : 0x3f4;
unsigned short old, compat = hwif->unit ? 0x374 : 0x3f4;
static unsigned short next_offset = 0;
outb(0x54|(hwif->channel<<3), hwif->config_data+1);
outb(0x54|(hwif->unit<<3), hwif->config_data+1);
old = inw(hwif->config_data) & ~1;
if (old != compat && inb(old+2) == 0xff) {
compat += (next_offset += 0x400); /* leave lower 10 bits untouched */
......
......@@ -160,5 +160,5 @@ void __init init_umc8672 (void) /* called from ide.c */
ide_hwifs[1].tuneproc = &tune_umc;
ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1;
ide_hwifs[1].unit = 1;
}
......@@ -344,7 +344,7 @@ static int via_set_drive(ide_drive_t *drive, unsigned char speed)
static void via82cxxx_tune_drive(ide_drive_t *drive, unsigned char pio)
{
if (!((via_enabled >> drive->channel->channel) & 1))
if (!((via_enabled >> drive->channel->unit) & 1))
return;
if (pio == 255) {
......@@ -525,7 +525,7 @@ unsigned int __init pci_init_via82cxxx(struct pci_dev *dev)
unsigned int __init ata66_via82cxxx(struct ata_channel *hwif)
{
return ((via_enabled & via_80w) >> hwif->channel) & 1;
return ((via_enabled & via_80w) >> hwif->unit) & 1;
}
void __init ide_init_via82cxxx(struct ata_channel *hwif)
......@@ -540,7 +540,7 @@ void __init ide_init_via82cxxx(struct ata_channel *hwif)
hwif->drives[i].io_32bit = 1;
hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
hwif->drives[i].autotune = 1;
hwif->drives[i].dn = hwif->channel * 2 + i;
hwif->drives[i].dn = hwif->unit * 2 + i;
}
#ifdef CONFIG_BLK_DEV_IDEDMA
......@@ -561,6 +561,6 @@ void __init ide_init_via82cxxx(struct ata_channel *hwif)
void __init ide_dmacapable_via82cxxx(struct ata_channel *hwif, unsigned long dmabase)
{
if ((via_enabled >> hwif->channel) & 1)
if ((via_enabled >> hwif->unit) & 1)
ide_setup_dma(hwif, dmabase, 8);
}
......@@ -584,8 +584,5 @@ struct hd_driveid {
*/
#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
#define IDE_NICE_0 (2) /* when sure that it won't affect us */
#define IDE_NICE_1 (3) /* when probably won't affect us much */
#define IDE_NICE_2 (4) /* when we know it's on our expense */
#endif /* _LINUX_HDREG_H */
......@@ -300,7 +300,6 @@ typedef struct ide_drive_s {
byte slow; /* flag: slow data port */
byte bswap; /* flag: byte swap data */
byte dsc_overlap; /* flag: DSC overlap */
byte nice1; /* flag: give potential excess bandwidth */
unsigned waiting_for_dma: 1; /* dma currently in progress */
unsigned present : 1; /* drive is physically present */
unsigned noprobe : 1; /* from: hdx=noprobe */
......@@ -312,8 +311,6 @@ typedef struct ide_drive_s {
unsigned nobios : 1; /* flag: do not probe bios for drive */
unsigned revalidate : 1; /* request revalidation */
unsigned atapi_overlap : 1; /* flag: ATAPI overlap (not supported) */
unsigned nice0 : 1; /* flag: give obvious excess bandwidth */
unsigned nice2 : 1; /* flag: give a share in our own bandwidth */
unsigned doorlocking : 1; /* flag: for removable only: door lock/unlock works */
unsigned autotune : 2; /* 1=autotune, 2=noautotune, 0=default */
unsigned remap_0_to_1 : 2; /* 0=remap if ezdrive, 1=remap, 2=noremap */
......@@ -440,10 +437,17 @@ typedef void (ide_rw_proc_t) (ide_drive_t *, ide_dma_action_t);
typedef int (ide_busproc_t) (ide_drive_t *, int);
struct ata_channel {
struct device dev; /* device handle */
int unit; /* channel number */
struct ata_channel *next; /* for linked-list in ide_hwgroup_t */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
hw_regs_t hw; /* Hardware info */
#ifdef CONFIG_BLK_DEV_IDEPCI
struct pci_dev *pci_dev; /* for pci chipsets */
#endif
ide_drive_t drives[MAX_DRIVES]; /* drive info */
struct gendisk *gd; /* gendisk structure */
ide_tuneproc_t *tuneproc; /* routine to tune PIO mode for drives */
......@@ -480,17 +484,12 @@ struct ata_channel {
unsigned autodma : 1; /* automatically try to enable DMA at boot */
unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */
unsigned highmem : 1; /* can do full 32-bit dma */
byte channel; /* for dual-port chips: 0=primary, 1=secondary */
#ifdef CONFIG_BLK_DEV_IDEPCI
struct pci_dev *pci_dev; /* for pci chipsets */
#endif
#if (DISK_RECOVERY_TIME > 0)
unsigned long last_time; /* time when previous rq was done */
#endif
byte straight8; /* Alan's straight 8 check */
ide_busproc_t *busproc; /* driver soft-power interface */
byte bus_state; /* power state of the IDE bus */
struct device device; /* global device tree handle */
};
/*
......
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