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) ...@@ -259,7 +259,7 @@ static int aec6260_tune_chipset (ide_drive_t *drive, byte speed)
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
byte unit = (drive->select.b.unit & 0x01); byte unit = (drive->select.b.unit & 0x01);
byte ultra_pci = hwif->channel ? 0x45 : 0x44; byte ultra_pci = hwif->unit ? 0x45 : 0x44;
int err = 0; int err = 0;
byte drive_conf = 0x00; byte drive_conf = 0x00;
byte ultra_conf = 0x00; byte ultra_conf = 0x00;
...@@ -532,7 +532,7 @@ unsigned int __init pci_init_aec62xx (struct pci_dev *dev) ...@@ -532,7 +532,7 @@ unsigned int __init pci_init_aec62xx (struct pci_dev *dev)
unsigned int __init ata66_aec62xx(struct ata_channel *hwif) unsigned int __init ata66_aec62xx(struct ata_channel *hwif)
{ {
byte mask = hwif->channel ? 0x02 : 0x01; byte mask = hwif->unit ? 0x02 : 0x01;
byte ata66 = 0; byte ata66 = 0;
pci_read_config_byte(hwif->pci_dev, 0x49, &ata66); 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 ...@@ -565,7 +565,7 @@ void __init ide_dmacapable_aec62xx(struct ata_channel *hwif, unsigned long dmaba
__cli(); /* local CPU only */ __cli(); /* local CPU only */
pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h); 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 */ __restore_flags(flags); /* local CPU only */
#endif /* CONFIG_AEC62XX_TUNING */ #endif /* CONFIG_AEC62XX_TUNING */
......
...@@ -214,7 +214,7 @@ void __init init_ali14xx (void) ...@@ -214,7 +214,7 @@ void __init init_ali14xx (void)
ide_hwifs[1].tuneproc = &ali14xx_tune_drive; ide_hwifs[1].tuneproc = &ali14xx_tune_drive;
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0]; ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1; ide_hwifs[1].unit = 1;
/* initialize controller registers */ /* initialize controller registers */
if (!initRegisters()) { if (!initRegisters()) {
......
...@@ -247,8 +247,8 @@ static void ali15x3_tune_drive (ide_drive_t *drive, byte pio) ...@@ -247,8 +247,8 @@ static void ali15x3_tune_drive (ide_drive_t *drive, byte pio)
int s_time, a_time, c_time; int s_time, a_time, c_time;
byte s_clc, a_clc, r_clc; byte s_clc, a_clc, r_clc;
unsigned long flags; unsigned long flags;
int port = hwif->index ? 0x5c : 0x58; int port = hwif->unit ? 0x5c : 0x58;
int portFIFO = hwif->channel ? 0x55 : 0x54; int portFIFO = hwif->unit ? 0x55 : 0x54;
byte cd_dma_fifo = 0; byte cd_dma_fifo = 0;
if (pio == 255) if (pio == 255)
...@@ -309,7 +309,7 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed) ...@@ -309,7 +309,7 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed)
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
byte unit = (drive->select.b.unit & 0x01); byte unit = (drive->select.b.unit & 0x01);
byte tmpbyte = 0x00; byte tmpbyte = 0x00;
int m5229_udma = hwif->channel? 0x57 : 0x56; int m5229_udma = hwif->unit ? 0x57 : 0x56;
int err = 0; int err = 0;
if (speed < XFER_UDMA_0) { if (speed < XFER_UDMA_0) {
...@@ -597,7 +597,7 @@ unsigned int __init ata66_ali15x3(struct ata_channel *hwif) ...@@ -597,7 +597,7 @@ unsigned int __init ata66_ali15x3(struct ata_channel *hwif)
/* /*
* Allow ata66 if cable of current channel has 80 pins * 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 { } else {
/* /*
* revision 0x20 (1543-E, 1543-F) * revision 0x20 (1543-E, 1543-F)
...@@ -639,7 +639,7 @@ void __init ide_init_ali15x3(struct ata_channel *hwif) ...@@ -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, byte irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
1, 11, 0, 12, 0, 14, 0, 15 }; 1, 11, 0, 12, 0, 14, 0, 15 };
hwif->irq = hwif->channel ? 15 : 14; hwif->irq = hwif->unit ? 15 : 14;
if (isa_dev) { if (isa_dev) {
/* /*
...@@ -651,14 +651,14 @@ void __init ide_init_ali15x3(struct ata_channel *hwif) ...@@ -651,14 +651,14 @@ void __init ide_init_ali15x3(struct ata_channel *hwif)
ideic = ideic & 0x03; ideic = ideic & 0x03;
/* get IRQ for IDE Controller */ /* 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 * get SIRQ1 routing table
*/ */
pci_read_config_byte(isa_dev, 0x44, &inmir); pci_read_config_byte(isa_dev, 0x44, &inmir);
inmir = inmir & 0x0f; inmir = inmir & 0x0f;
hwif->irq = irq_routing_table[inmir]; hwif->irq = irq_routing_table[inmir];
} else if (hwif->channel && !(ideic & 0x01)) { } else if (hwif->unit && !(ideic & 0x01)) {
/* /*
* get SIRQ2 routing table * get SIRQ2 routing table
*/ */
......
...@@ -263,7 +263,7 @@ static int amd_set_drive(ide_drive_t *drive, unsigned char speed) ...@@ -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) 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; return;
if (pio == 255) { if (pio == 255) {
...@@ -411,7 +411,7 @@ unsigned int __init pci_init_amd74xx(struct pci_dev *dev, const char *name) ...@@ -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) 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) void __init ide_init_amd74xx(struct ata_channel *hwif)
...@@ -426,7 +426,7 @@ 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].io_32bit = 1;
hwif->drives[i].unmask = 1; hwif->drives[i].unmask = 1;
hwif->drives[i].autotune = 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 #ifdef CONFIG_BLK_DEV_IDEDMA
...@@ -447,6 +447,6 @@ void __init ide_init_amd74xx(struct ata_channel *hwif) ...@@ -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) 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); ide_setup_dma(hwif, dmabase, 8);
} }
...@@ -795,7 +795,7 @@ int __init ide_probe_for_cmd640x (void) ...@@ -795,7 +795,7 @@ int __init ide_probe_for_cmd640x (void)
cmd_hwif1->chipset = ide_cmd640; cmd_hwif1->chipset = ide_cmd640;
cmd_hwif0->mate = cmd_hwif1; cmd_hwif0->mate = cmd_hwif1;
cmd_hwif1->mate = cmd_hwif0; cmd_hwif1->mate = cmd_hwif0;
cmd_hwif1->channel = 1; cmd_hwif1->unit = 1;
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
cmd_hwif1->tuneproc = &cmd640_tune_drive; cmd_hwif1->tuneproc = &cmd640_tune_drive;
#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
......
...@@ -224,7 +224,7 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ ...@@ -224,7 +224,7 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ
{ DRWTIM0, DRWTIM1 }, { DRWTIM0, DRWTIM1 },
{ DRWTIM2, DRWTIM3 } { 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?? */ 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, 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) ...@@ -336,7 +336,7 @@ static void cmd64x_tuneproc (ide_drive_t *drive, byte mode_wanted)
static byte cmd680_taskfile_timing(struct ata_channel *hwif) static byte cmd680_taskfile_timing(struct ata_channel *hwif)
{ {
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
byte addr_mask = (hwif->channel) ? 0xB2 : 0xA2; byte addr_mask = (hwif->unit) ? 0xB2 : 0xA2;
unsigned short timing; unsigned short timing;
pci_read_config_word(dev, addr_mask, &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) ...@@ -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 ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
u8 unit = (drive->select.b.unit & 0x01); 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 speed = 0x00;
u8 mode_pci = 0x00; u8 mode_pci = 0x00;
u8 channel_timings = cmd680_taskfile_timing(hwif); u8 channel_timings = cmd680_taskfile_timing(hwif);
...@@ -435,8 +435,8 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, byte speed) ...@@ -435,8 +435,8 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, byte speed)
int err = 0; int err = 0;
u8 unit = (drive->select.b.unit & 0x01); u8 unit = (drive->select.b.unit & 0x01);
u8 pciU = (hwif->channel) ? UDIDETCR1 : UDIDETCR0; u8 pciU = (hwif->unit) ? UDIDETCR1 : UDIDETCR0;
u8 pciD = (hwif->channel) ? BMIDESR1 : BMIDESR0; u8 pciD = (hwif->unit) ? BMIDESR1 : BMIDESR0;
u8 regU = 0; u8 regU = 0;
u8 regD = 0; u8 regD = 0;
...@@ -500,7 +500,7 @@ static int cmd680_tune_chipset (ide_drive_t *drive, byte speed) ...@@ -500,7 +500,7 @@ static int cmd680_tune_chipset (ide_drive_t *drive, byte speed)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; 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 unit = (drive->select.b.unit & 0x01);
u8 dma_pci = 0; u8 dma_pci = 0;
u8 udma_pci = 0; u8 udma_pci = 0;
...@@ -841,7 +841,7 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -841,7 +841,7 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{ {
byte dma_stat = 0; byte dma_stat = 0;
byte dma_alt_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; unsigned long dma_base = drive->channel->dma_base;
struct pci_dev *dev = drive->channel->pci_dev; 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; 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) ...@@ -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 */ outb(dma_stat|6, dma_base+2); /* clear the INTR & ERROR bits */
if (jack_slap) { if (jack_slap) {
byte dma_intr = 0; byte dma_intr = 0;
byte dma_mask = (drive->channel->channel) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; byte dma_mask = (drive->channel->unit) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
byte dma_reg = (drive->channel->channel) ? ARTTIM2 : CFR; byte dma_reg = (drive->channel->unit) ? ARTTIM2 : CFR;
(void) pci_read_config_byte(dev, dma_reg, &dma_intr); (void) pci_read_config_byte(dev, dma_reg, &dma_intr);
/* /*
* DAMN BMIDE is not connected to PCI space! * DAMN BMIDE is not connected to PCI space!
...@@ -918,7 +918,7 @@ static int cmd680_busproc (ide_drive_t * drive, int state) ...@@ -918,7 +918,7 @@ static int cmd680_busproc (ide_drive_t * drive, int state)
{ {
#if 0 #if 0
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0; u8 addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
u32 stat_config = 0; u32 stat_config = 0;
pci_read_config_dword(hwif->pci_dev, addr_mask, &stat_config); pci_read_config_dword(hwif->pci_dev, addr_mask, &stat_config);
...@@ -951,7 +951,7 @@ static void cmd680_reset (ide_drive_t *drive) ...@@ -951,7 +951,7 @@ static void cmd680_reset (ide_drive_t *drive)
{ {
#if 0 #if 0
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0; u8 addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
byte reset = 0; byte reset = 0;
pci_read_config_byte(hwif->pci_dev, addr_mask, &reset); pci_read_config_byte(hwif->pci_dev, addr_mask, &reset);
...@@ -1084,7 +1084,7 @@ unsigned int __init pci_init_cmd64x(struct pci_dev *dev) ...@@ -1084,7 +1084,7 @@ unsigned int __init pci_init_cmd64x(struct pci_dev *dev)
unsigned int cmd680_ata66(struct ata_channel *hwif) unsigned int cmd680_ata66(struct ata_channel *hwif)
{ {
byte ata66 = 0; 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); pci_read_config_byte(hwif->pci_dev, addr_mask, &ata66);
return (ata66 & 0x01) ? 1 : 0; return (ata66 & 0x01) ? 1 : 0;
...@@ -1093,7 +1093,7 @@ unsigned int cmd680_ata66(struct ata_channel *hwif) ...@@ -1093,7 +1093,7 @@ unsigned int cmd680_ata66(struct ata_channel *hwif)
unsigned int cmd64x_ata66(struct ata_channel *hwif) unsigned int cmd64x_ata66(struct ata_channel *hwif)
{ {
byte ata66 = 0; byte ata66 = 0;
byte mask = (hwif->channel) ? 0x02 : 0x01; byte mask = (hwif->unit) ? 0x02 : 0x01;
pci_read_config_byte(hwif->pci_dev, BMIDECSR, &ata66); pci_read_config_byte(hwif->pci_dev, BMIDECSR, &ata66);
return (ata66 & mask) ? 1 : 0; return (ata66 & mask) ? 1 : 0;
......
...@@ -101,7 +101,7 @@ static unsigned int cs5530_pio_timings[2][5] = ...@@ -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. * After chip reset, the PIO timings are set to 0x0000e132, which is not valid.
*/ */
#define CS5530_BAD_PIO(timings) (((timings)&~0x80000000)==0x0000e132) #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 * 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) ...@@ -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 */ if (mode > drive->id->tDMA) /* to be absolutly sure we have a valid mode */
mode = drive->id->tDMA; 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 #if CY82C693_DEBUG_LOGS
/* for debug let's show the previous values */ /* 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) ...@@ -200,7 +200,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
OUT_BYTE(index, CY82_INDEX_PORT); OUT_BYTE(index, CY82_INDEX_PORT);
data = IN_BYTE(CY82_DATA_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 */ #endif /* CY82C693_DEBUG_LOGS */
data = (byte)mode|(byte)(single<<2); data = (byte)mode|(byte)(single<<2);
...@@ -209,7 +209,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single) ...@@ -209,7 +209,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
OUT_BYTE(data, CY82_DATA_PORT); OUT_BYTE(data, CY82_DATA_PORT);
#if CY82C693_DEBUG_INFO #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 */ #endif /* CY82C693_DEBUG_INFO */
/* /*
...@@ -318,7 +318,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio) ...@@ -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); 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 */ #endif /* CY82C693_DEBUG_LOGS */
/* first let's calc the pio modes */ /* first let's calc the pio modes */
...@@ -371,7 +371,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio) ...@@ -371,7 +371,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
} }
#if CY82C693_DEBUG_INFO #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 */ #endif /* CY82C693_DEBUG_INFO */
} }
......
...@@ -126,5 +126,5 @@ void __init init_dtc2278 (void) ...@@ -126,5 +126,5 @@ void __init init_dtc2278 (void)
ide_hwifs[1].drives[1].no_unmask = 1; ide_hwifs[1].drives[1].no_unmask = 1;
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0]; 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 ...@@ -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) static void hpt366_tune_chipset (ide_drive_t *drive, byte speed)
{ {
byte regtime = (drive->select.b.unit & 0x01) ? 0x44 : 0x40; 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. * 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) ...@@ -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) 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 list_conf = 0;
unsigned int drive_conf = 0; unsigned int drive_conf = 0;
unsigned int conf_mask = (speed >= XFER_MW_DMA_0) ? 0xc0000000 : 0x30070000; 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) ...@@ -840,8 +840,8 @@ int hpt370_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base; unsigned long dma_base = hwif->dma_base;
byte regstate = hwif->channel ? 0x54 : 0x50; byte regstate = hwif->unit ? 0x54 : 0x50;
byte reginfo = hwif->channel ? 0x56 : 0x52; byte reginfo = hwif->unit ? 0x56 : 0x52;
byte dma_stat; byte dma_stat;
switch (func) { switch (func) {
...@@ -900,7 +900,7 @@ void hpt3xx_reset (ide_drive_t *drive) ...@@ -900,7 +900,7 @@ void hpt3xx_reset (ide_drive_t *drive)
{ {
#if 0 #if 0
unsigned long high_16 = pci_resource_start(drive->channel->pci_dev, 4); 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; byte reg59h = 0;
pci_read_config_byte(drive->channel->pci_dev, 0x59, &reg59h); pci_read_config_byte(drive->channel->pci_dev, 0x59, &reg59h);
...@@ -914,8 +914,8 @@ static int hpt3xx_tristate (ide_drive_t * drive, int state) ...@@ -914,8 +914,8 @@ static int hpt3xx_tristate (ide_drive_t * drive, int state)
{ {
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
byte reset = (hwif->channel) ? 0x80 : 0x40; byte reset = (hwif->unit) ? 0x80 : 0x40;
byte state_reg = (hwif->channel) ? 0x57 : 0x53; byte state_reg = (hwif->unit) ? 0x57 : 0x53;
byte reg59h = 0; byte reg59h = 0;
byte regXXh = 0; byte regXXh = 0;
...@@ -960,7 +960,7 @@ static int hpt370_busproc(ide_drive_t * drive, int state) ...@@ -960,7 +960,7 @@ static int hpt370_busproc(ide_drive_t * drive, int state)
hwif->bus_state = state; hwif->bus_state = state;
if (hwif->channel) { if (hwif->unit) {
/* secondary channel */ /* secondary channel */
tristate = 0x56; tristate = 0x56;
resetmask = 0x80; resetmask = 0x80;
...@@ -1139,7 +1139,7 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev) ...@@ -1139,7 +1139,7 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev)
unsigned int __init ata66_hpt366(struct ata_channel *hwif) unsigned int __init ata66_hpt366(struct ata_channel *hwif)
{ {
byte ata66 = 0; byte ata66 = 0;
byte regmask = (hwif->channel) ? 0x01 : 0x02; byte regmask = (hwif->unit) ? 0x01 : 0x02;
pci_read_config_byte(hwif->pci_dev, 0x5a, &ata66); pci_read_config_byte(hwif->pci_dev, 0x5a, &ata66);
#ifdef DEBUG #ifdef DEBUG
...@@ -1214,8 +1214,8 @@ void __init ide_dmacapable_hpt366(struct ata_channel *hwif, unsigned long dmabas ...@@ -1214,8 +1214,8 @@ void __init ide_dmacapable_hpt366(struct ata_channel *hwif, unsigned long dmabas
{ {
byte masterdma = 0, slavedma = 0; byte masterdma = 0, slavedma = 0;
byte dma_new = 0, dma_old = inb(dmabase+2); byte dma_new = 0, dma_old = inb(dmabase+2);
byte primary = hwif->channel ? 0x4b : 0x43; byte primary = hwif->unit ? 0x4b : 0x43;
byte secondary = hwif->channel ? 0x4f : 0x47; byte secondary = hwif->unit ? 0x4f : 0x47;
unsigned long flags; unsigned long flags;
__save_flags(flags); /* local CPU only */ __save_flags(flags); /* local CPU only */
......
...@@ -321,7 +321,7 @@ void __init init_ht6560b (void) ...@@ -321,7 +321,7 @@ void __init init_ht6560b (void)
ide_hwifs[1].serialized = 1; /* is this needed? */ ide_hwifs[1].serialized = 1; /* is this needed? */
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0]; ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1; ide_hwifs[1].unit = 1;
/* /*
* Setting default configurations for drives * Setting default configurations for drives
......
...@@ -621,7 +621,7 @@ static int __init icside_register_v6(struct expansion_card *ec, int autodma) ...@@ -621,7 +621,7 @@ static int __init icside_register_v6(struct expansion_card *ec, int autodma)
hwif->hw.dma = ec->dma; hwif->hw.dma = ec->dma;
hwif->hw.priv = (void *) hwif->hw.priv = (void *)
(port + ICS_ARCIN_V6_INTRSTAT_1); (port + ICS_ARCIN_V6_INTRSTAT_1);
hwif->channel = 0; hwif->unit = 0;
icside_setup_dma(hwif, autodma); icside_setup_dma(hwif, autodma);
} }
if (mate) { if (mate) {
...@@ -630,7 +630,7 @@ static int __init icside_register_v6(struct expansion_card *ec, int autodma) ...@@ -630,7 +630,7 @@ static int __init icside_register_v6(struct expansion_card *ec, int autodma)
mate->hw.dma = ec->dma; mate->hw.dma = ec->dma;
mate->hw.priv = (void *) mate->hw.priv = (void *)
(port + ICS_ARCIN_V6_INTRSTAT_2); (port + ICS_ARCIN_V6_INTRSTAT_2);
mate->channel = 1; mate->unit = 1;
icside_setup_dma(mate, autodma); icside_setup_dma(mate, autodma);
} }
} }
......
...@@ -1036,7 +1036,7 @@ static void idedisk_setup(ide_drive_t *drive) ...@@ -1036,7 +1036,7 @@ static void idedisk_setup(ide_drive_t *drive)
sprintf(drive->device.bus_id, "%d", drvid); sprintf(drive->device.bus_id, "%d", drvid);
sprintf(drive->device.name, "ide-disk"); sprintf(drive->device.name, "ide-disk");
drive->device.driver = &idedisk_devdrv; drive->device.driver = &idedisk_devdrv;
drive->device.parent = &drive->channel->device; drive->device.parent = &drive->channel->dev;
drive->device.driver_data = drive; drive->device.driver_data = drive;
device_register(&drive->device); device_register(&drive->device);
} }
......
...@@ -660,7 +660,7 @@ void ide_release_dma(struct ata_channel *hwif) ...@@ -660,7 +660,7 @@ void ide_release_dma(struct ata_channel *hwif)
kfree(hwif->sg_table); kfree(hwif->sg_table);
hwif->sg_table = NULL; 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 + 16), hwif->dma_extra);
release_region(hwif->dma_base, 8); release_region(hwif->dma_base, 8);
hwif->dma_base = 0; hwif->dma_base = 0;
......
...@@ -442,7 +442,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co ...@@ -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) 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 else
dma_base = pci_resource_start(dev, 4); 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 ...@@ -452,7 +452,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
if (extra) /* PDC20246, PDC20262, HPT343, & HPT366 */ if (extra) /* PDC20246, PDC20262, HPT343, & HPT366 */
request_region(dma_base + 16, extra, name); request_region(dma_base + 16, extra, name);
dma_base += hwif->channel ? 8 : 0; dma_base += hwif->unit ? 8 : 0;
hwif->dma_extra = extra; hwif->dma_extra = extra;
if ((dev->vendor == PCI_VENDOR_ID_AL && dev->device == PCI_DEVICE_ID_AL_M5219) || 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, ...@@ -610,7 +610,7 @@ static int __init setup_host_channel(struct pci_dev *dev,
hwif->chipset = ide_pci; hwif->chipset = ide_pci;
hwif->pci_dev = dev; hwif->pci_dev = dev;
hwif->channel = port; hwif->unit = port;
if (!hwif->irq) if (!hwif->irq)
hwif->irq = pciirq; hwif->irq = pciirq;
......
...@@ -118,7 +118,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd) ...@@ -118,7 +118,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
byte type = (id->config >> 8) & 0x1f; byte type = (id->config >> 8) & 0x1f;
printk("ATAPI "); printk("ATAPI ");
#ifdef CONFIG_BLK_DEV_PDC4030 #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"); printk(" -- not supported on 2nd Promise port\n");
goto err_misc; goto err_misc;
} }
...@@ -461,16 +461,16 @@ static void hwif_register(struct ata_channel *hwif) ...@@ -461,16 +461,16 @@ static void hwif_register(struct ata_channel *hwif)
{ {
/* Register this hardware interface within the global device tree. /* Register this hardware interface within the global device tree.
*/ */
sprintf(hwif->device.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]); sprintf(hwif->dev.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
sprintf(hwif->device.name, "ide"); sprintf(hwif->dev.name, "ide");
hwif->device.driver_data = hwif; hwif->dev.driver_data = hwif;
#ifdef CONFIG_BLK_DEV_IDEPCI #ifdef CONFIG_BLK_DEV_IDEPCI
if (hwif->pci_dev) if (hwif->pci_dev)
hwif->device.parent = &hwif->pci_dev->dev; hwif->dev.parent = &hwif->pci_dev->dev;
else else
#endif #endif
hwif->device.parent = NULL; /* Would like to do = &device_legacy */ hwif->dev.parent = NULL; /* Would like to do = &device_legacy */
device_register(&hwif->device); device_register(&hwif->dev);
if (((unsigned long)hwif->io_ports[IDE_DATA_OFFSET] | 7) == if (((unsigned long)hwif->io_ports[IDE_DATA_OFFSET] | 7) ==
((unsigned long)hwif->io_ports[IDE_STATUS_OFFSET])) { ((unsigned long)hwif->io_ports[IDE_STATUS_OFFSET])) {
...@@ -517,7 +517,7 @@ static void probe_hwif(struct ata_channel *hwif) ...@@ -517,7 +517,7 @@ static void probe_hwif(struct ata_channel *hwif)
if ( if (
#if CONFIG_BLK_DEV_PDC4030 #if CONFIG_BLK_DEV_PDC4030
(hwif->chipset != ide_pdc4030 || hwif->channel == 0) && (hwif->chipset != ide_pdc4030 || hwif->unit == 0) &&
#endif #endif
hwif_check_regions(hwif)) { hwif_check_regions(hwif)) {
int msgout = 0; int msgout = 0;
...@@ -824,11 +824,11 @@ static void init_gendisk(struct ata_channel *hwif) ...@@ -824,11 +824,11 @@ static void init_gendisk(struct ata_channel *hwif)
for (unit = 0; unit < MAX_DRIVES; ++unit) { for (unit = 0; unit < MAX_DRIVES; ++unit) {
char name[80]; char name[80];
ide_add_generic_settings(hwif->drives + unit); 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", sprintf (name, "host%d/bus%d/target%d/lun%d",
(hwif->channel && hwif->mate) ? (hwif->unit && hwif->mate) ?
hwif->mate->index : hwif->index, hwif->mate->index : hwif->index,
hwif->channel, unit, hwif->drives[unit].lun); hwif->unit, unit, hwif->drives[unit].lun);
if (hwif->drives[unit].present) if (hwif->drives[unit].present)
hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL); hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL);
} }
......
...@@ -183,7 +183,7 @@ static int proc_ide_read_channel ...@@ -183,7 +183,7 @@ static int proc_ide_read_channel
struct ata_channel *hwif = data; struct ata_channel *hwif = data;
int len; int len;
page[0] = hwif->channel ? '1' : '0'; page[0] = hwif->unit ? '1' : '0';
page[1] = '\n'; page[1] = '\n';
len = 2; len = 2;
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); 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) ...@@ -3103,10 +3103,10 @@ static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive)
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
idetape_read_position_result_t *result; idetape_read_position_result_t *result;
//#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
// if (tape->debug_level >= 4) if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_read_position_callback\n"); printk (KERN_INFO "ide-tape: Reached idetape_read_position_callback\n");
//#endif /* IDETAPE_DEBUG_LOG */ #endif /* IDETAPE_DEBUG_LOG */
if (!tape->pc->error) { if (!tape->pc->error) {
result = (idetape_read_position_result_t *) tape->pc->buffer; result = (idetape_read_position_result_t *) tape->pc->buffer;
...@@ -3280,10 +3280,10 @@ static int idetape_read_position (ide_drive_t *drive) ...@@ -3280,10 +3280,10 @@ static int idetape_read_position (ide_drive_t *drive)
idetape_pc_t pc; idetape_pc_t pc;
int position; int position;
//#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
// if (tape->debug_level >= 4) if (tape->debug_level >= 4)
printk (KERN_INFO "ide-tape: Reached idetape_read_position\n"); printk (KERN_INFO "ide-tape: Reached idetape_read_position\n");
//#endif /* IDETAPE_DEBUG_LOG */ #endif /* IDETAPE_DEBUG_LOG */
#ifdef NO_LONGER_REQUIRED #ifdef NO_LONGER_REQUIRED
idetape_flush_tape_buffers(drive); idetape_flush_tape_buffers(drive);
......
This diff is collapsed.
...@@ -43,12 +43,12 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) ...@@ -43,12 +43,12 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
new = *old; new = *old;
/* Adjust IRQ enable bit */ /* Adjust IRQ enable bit */
bit = 1 << (8 + hwif->channel); bit = 1 << (8 + hwif->unit);
new = drive->present ? (new & ~bit) : (new | bit); new = drive->present ? (new & ~bit) : (new | bit);
/* Select PIO or DMA, DMA may only be selected for one drive/channel. */ /* Select PIO or DMA, DMA may only be selected for one drive/channel. */
bit = 1 << (20 + 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->channel << 1)); other = 1 << (20 + (1 - drive->select.b.unit) + (hwif->unit << 1));
new = use_dma ? ((new & ~other) | bit) : (new & ~bit); new = use_dma ? ((new & ~other) | bit) : (new & ~bit);
if (new != *old) { if (new != *old) {
...@@ -138,9 +138,9 @@ void __init ide_init_ns87415(struct ata_channel *hwif) ...@@ -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_dword(dev, 0x40, &ctrl);
(void) pci_read_config_byte(dev, 0x09, &progif); (void) pci_read_config_byte(dev, 0x09, &progif);
/* is irq in "native" mode? */ /* is irq in "native" mode? */
using_inta = progif & (1 << (hwif->channel << 1)); using_inta = progif & (1 << (hwif->unit << 1));
if (!using_inta) if (!using_inta)
using_inta = ctrl & (1 << (4 + hwif->channel)); using_inta = ctrl & (1 << (4 + hwif->unit));
if (hwif->mate) { if (hwif->mate) {
hwif->select_data = hwif->mate->select_data; hwif->select_data = hwif->mate->select_data;
} else { } else {
...@@ -180,7 +180,7 @@ void __init ide_init_ns87415(struct ata_channel *hwif) ...@@ -180,7 +180,7 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
outb(0x60, hwif->dma_base + 2); outb(0x60, hwif->dma_base + 2);
if (!using_inta) 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) else if (!hwif->irq && hwif->mate && hwif->mate->irq)
hwif->irq = hwif->mate->irq; /* share IRQ with mate */ 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) ...@@ -530,7 +530,7 @@ static int pdc202xx_new_tune_chipset (ide_drive_t *drive, byte speed)
#else #else
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
unsigned long high_16 = pci_resource_start(dev, 4); 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); unsigned long datareg = (indexreg + 2);
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_BLK_DEV_IDEDMA */
byte thold = 0x10; byte thold = 0x10;
...@@ -725,8 +725,8 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra) ...@@ -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_66 = ((eighty_ninty_three(drive)) && udma_33) ? 1 : 0;
byte udma_100 = 0; byte udma_100 = 0;
byte udma_133 = 0; byte udma_133 = 0;
byte mask = hwif->channel ? 0x08 : 0x02; byte mask = hwif->unit ? 0x08 : 0x02;
unsigned short c_mask = hwif->channel ? (1<<11) : (1<<10); unsigned short c_mask = hwif->unit ? (1<<11) : (1<<10);
byte ultra_66 = ((id->dma_ultra & 0x0010) || byte ultra_66 = ((id->dma_ultra & 0x0010) ||
(id->dma_ultra & 0x0008)) ? 1 : 0; (id->dma_ultra & 0x0008)) ? 1 : 0;
...@@ -792,14 +792,14 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra) ...@@ -792,14 +792,14 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
if (((ultra_66) || (ultra_100) || (ultra_133)) && (cable)) { if (((ultra_66) || (ultra_100) || (ultra_133)) && (cable)) {
#ifdef DEBUG #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"); printk(" Switching to Ultra33 mode.\n");
#endif /* DEBUG */ #endif /* DEBUG */
/* Primary : zero out second bit */ /* Primary : zero out second bit */
/* Secondary : zero out fourth bit */ /* Secondary : zero out fourth bit */
if (!jumpbit) if (!jumpbit)
OUT_BYTE(CLKSPD & ~mask, (high_16 + 0x11)); 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); printk("%s reduced to Ultra33 mode.\n", drive->name);
udma_66 = 0; udma_100 = 0; udma_133 = 0; udma_66 = 0; udma_100 = 0; udma_133 = 0;
} else { } else {
...@@ -990,7 +990,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -990,7 +990,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
struct ata_channel *hwif = drive->channel; struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
unsigned long high_16 = pci_resource_start(dev, 4); 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; unsigned long dma_base = hwif->dma_base;
switch (dev->device) { switch (dev->device) {
...@@ -1023,7 +1023,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -1023,7 +1023,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
struct request *rq = HWGROUP(drive)->rq; struct request *rq = HWGROUP(drive)->rq;
unsigned long word_count = 0; 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->nr_sectors << 8);
word_count = (rq_data_dir(rq) == READ) ? word_count | 0x05000000 : word_count | 0x06000000; word_count = (rq_data_dir(rq) == READ) ? word_count | 0x05000000 : word_count | 0x06000000;
outl(word_count, atapi_reg); outl(word_count, atapi_reg);
...@@ -1033,7 +1033,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -1033,7 +1033,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
if ((drive->addressing) && (hardware48hack)) { if ((drive->addressing) && (hardware48hack)) {
outl(0, atapi_reg); /* zero out extra */ outl(0, atapi_reg); /* zero out extra */
clock = IN_BYTE(high_16 + 0x11); 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; break;
case ide_dma_test_irq: /* returns 1 if dma irq issued, 0 otherwise */ 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) ...@@ -1042,7 +1042,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
return (dma_stat & 4) == 4; return (dma_stat & 4) == 4;
sc1d = IN_BYTE(high_16 + 0x001d); sc1d = IN_BYTE(high_16 + 0x001d);
if (drive->channel->channel) { if (drive->channel->unit) {
if ((sc1d & 0x50) == 0x50) goto somebody_else; if ((sc1d & 0x50) == 0x50) goto somebody_else;
else if ((sc1d & 0x40) == 0x40) else if ((sc1d & 0x40) == 0x40)
return (dma_stat & 4) == 4; return (dma_stat & 4) == 4;
...@@ -1071,7 +1071,7 @@ void pdc202xx_new_reset (ide_drive_t *drive) ...@@ -1071,7 +1071,7 @@ void pdc202xx_new_reset (ide_drive_t *drive)
OUT_BYTE(0x00,IDE_CONTROL_REG); OUT_BYTE(0x00,IDE_CONTROL_REG);
mdelay(1000); mdelay(1000);
printk("PDC202XX: %s channel reset.\n", printk("PDC202XX: %s channel reset.\n",
drive->channel->channel ? "Secondary" : "Primary"); drive->channel->unit ? "Secondary" : "Primary");
} }
void pdc202xx_reset (ide_drive_t *drive) void pdc202xx_reset (ide_drive_t *drive)
...@@ -1084,7 +1084,7 @@ 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); OUT_BYTE(udma_speed_flag & ~0x10, high_16 + 0x001f);
mdelay(2000); /* 2 seconds ?! */ mdelay(2000); /* 2 seconds ?! */
printk("PDC202XX: %s channel reset.\n", 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) ...@@ -1218,7 +1218,7 @@ unsigned int __init pci_init_pdc202xx(struct pci_dev *dev)
unsigned int __init ata66_pdc202xx(struct ata_channel *hwif) 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; unsigned short CIS;
switch(hwif->pci_dev->device) { switch(hwif->pci_dev->device) {
......
...@@ -99,7 +99,7 @@ static void promise_selectproc (ide_drive_t *drive) ...@@ -99,7 +99,7 @@ static void promise_selectproc (ide_drive_t *drive)
{ {
unsigned int number; 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); OUT_BYTE(number,IDE_FEATURE_REG);
} }
...@@ -226,7 +226,7 @@ int __init setup_pdc4030(struct ata_channel *hwif) ...@@ -226,7 +226,7 @@ int __init setup_pdc4030(struct ata_channel *hwif)
hwif->chipset = hwif2->chipset = ide_pdc4030; hwif->chipset = hwif2->chipset = ide_pdc4030;
hwif->mate = hwif2; hwif->mate = hwif2;
hwif2->mate = hwif; hwif2->mate = hwif;
hwif2->channel = 1; hwif2->unit = 1;
hwif->selectproc = hwif2->selectproc = &promise_selectproc; hwif->selectproc = hwif2->selectproc = &promise_selectproc;
hwif->serialized = hwif2->serialized = 1; hwif->serialized = hwif2->serialized = 1;
......
...@@ -357,7 +357,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed) ...@@ -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) 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; return;
if (pio == 255) { if (pio == 255) {
...@@ -535,7 +535,7 @@ unsigned int __init pci_init_piix(struct pci_dev *dev, const char *name) ...@@ -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) 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) void __init ide_init_piix(struct ata_channel *hwif)
...@@ -550,7 +550,7 @@ 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].io_32bit = 1;
hwif->drives[i].unmask = 1; hwif->drives[i].unmask = 1;
hwif->drives[i].autotune = 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 #ifdef CONFIG_BLK_DEV_IDEDMA
...@@ -572,7 +572,7 @@ void __init ide_init_piix(struct ata_channel *hwif) ...@@ -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) 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)) && !(piix_config->flags & PIIX_NODMA))
ide_setup_dma(hwif, dmabase, 8); ide_setup_dma(hwif, dmabase, 8);
} }
...@@ -291,7 +291,7 @@ static void qd6580_tune_drive (ide_drive_t *drive, byte pio) ...@@ -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); 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); 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); 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) ...@@ -420,7 +420,7 @@ int __init probe (int base)
ide_hwifs[i].chipset = ide_qd65xx; ide_hwifs[i].chipset = ide_qd65xx;
ide_hwifs[i].mate = &ide_hwifs[i^1]; 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].select_data = base;
ide_hwifs[i].config_data = config | (control <<8); ide_hwifs[i].config_data = config | (control <<8);
......
...@@ -71,7 +71,7 @@ static void __init init_rz1000 (struct pci_dev *dev, const char *name) ...@@ -71,7 +71,7 @@ static void __init init_rz1000 (struct pci_dev *dev, const char *name)
hwif->drives[0].no_unmask = 1; hwif->drives[0].no_unmask = 1;
hwif->drives[1].no_unmask = 1; hwif->drives[1].no_unmask = 1;
if (hwif->io_ports[IDE_DATA_OFFSET] == 0x170) 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); 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) ...@@ -255,7 +255,7 @@ static int svwks_tune_chipset (ide_drive_t *drive, byte speed)
byte drive_pci = 0x00; byte drive_pci = 0x00;
byte drive_pci2 = 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_enable = 0x00;
byte ultra_timing = 0x00; byte ultra_timing = 0x00;
...@@ -590,7 +590,7 @@ static unsigned int __init ata66_svwks_dell(struct ata_channel *hwif) ...@@ -590,7 +590,7 @@ static unsigned int __init ata66_svwks_dell(struct ata_channel *hwif)
if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
dev->vendor == PCI_VENDOR_ID_SERVERWORKS && dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
return ((1 << (hwif->channel + 14)) & return ((1 << (hwif->unit + 14)) &
dev->subsystem_device) ? 1 : 0; dev->subsystem_device) ? 1 : 0;
return 0; return 0;
} }
...@@ -607,7 +607,7 @@ static unsigned int __init ata66_svwks_cobalt(struct ata_channel *hwif) ...@@ -607,7 +607,7 @@ static unsigned int __init ata66_svwks_cobalt(struct ata_channel *hwif)
if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN &&
dev->vendor == PCI_VENDOR_ID_SERVERWORKS && dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
return ((1 << (hwif->channel + 14)) & return ((1 << (hwif->unit + 14)) &
dev->subsystem_device) ? 1 : 0; dev->subsystem_device) ? 1 : 0;
return 0; return 0;
} }
...@@ -630,7 +630,7 @@ unsigned int __init ata66_svwks(struct ata_channel *hwif) ...@@ -630,7 +630,7 @@ unsigned int __init ata66_svwks(struct ata_channel *hwif)
void __init ide_init_svwks(struct ata_channel *hwif) void __init ide_init_svwks(struct ata_channel *hwif)
{ {
if (!hwif->irq) if (!hwif->irq)
hwif->irq = hwif->channel ? 15 : 14; hwif->irq = hwif->unit ? 15 : 14;
hwif->tuneproc = &svwks_tune_drive; hwif->tuneproc = &svwks_tune_drive;
hwif->speedproc = &svwks_tune_chipset; hwif->speedproc = &svwks_tune_chipset;
......
...@@ -844,7 +844,7 @@ unsigned int __init pci_init_sis5513(struct pci_dev *dev) ...@@ -844,7 +844,7 @@ unsigned int __init pci_init_sis5513(struct pci_dev *dev)
unsigned int __init ata66_sis5513(struct ata_channel *hwif) unsigned int __init ata66_sis5513(struct ata_channel *hwif)
{ {
byte reg48h = 0, ata66 = 0; 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); pci_read_config_byte(hwif->pci_dev, 0x48, &reg48h);
if (dma_capability >= ATA_66) { if (dma_capability >= ATA_66) {
...@@ -856,7 +856,7 @@ unsigned int __init ata66_sis5513(struct ata_channel *hwif) ...@@ -856,7 +856,7 @@ unsigned int __init ata66_sis5513(struct ata_channel *hwif)
void __init ide_init_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->tuneproc = &sis5513_tune_drive;
hwif->speedproc = &sis5513_tune_chipset; hwif->speedproc = &sis5513_tune_chipset;
......
...@@ -63,7 +63,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report) ...@@ -63,7 +63,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report)
unsigned short drv_ctrl = 0x909; unsigned short drv_ctrl = 0x909;
unsigned int xfer_mode, reg; 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) if (pio == 255)
xfer_mode = ata_timing_mode(drive, XFER_PIO | XFER_EPIO); xfer_mode = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
...@@ -100,7 +100,7 @@ static int config_for_dma(ide_drive_t *drive) ...@@ -100,7 +100,7 @@ static int config_for_dma(ide_drive_t *drive)
unsigned short drv_ctrl = 0x909; unsigned short drv_ctrl = 0x909;
unsigned int reg; 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) if (ide_config_drive_speed(drive, XFER_MW_DMA_2) == 0)
drv_ctrl = 0x0240; drv_ctrl = 0x0240;
......
...@@ -153,14 +153,14 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) ...@@ -153,14 +153,14 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
if (reg != hwif->select_data) { if (reg != hwif->select_data) {
hwif->select_data = reg; 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); outw(reg & 0xff, hwif->config_data);
} }
/* enable IRQ if not probing */ /* enable IRQ if not probing */
if (drive->present) { if (drive->present) {
reg = inw(hwif->config_data+3) & 0x13; reg = inw(hwif->config_data+3) & 0x13;
reg &= ~(1 << hwif->channel); reg &= ~(1 << hwif->unit);
outw(reg, hwif->config_data+3); outw(reg, hwif->config_data+3);
} }
...@@ -237,7 +237,7 @@ void __init ide_init_trm290(struct ata_channel *hwif) ...@@ -237,7 +237,7 @@ void __init ide_init_trm290(struct ata_channel *hwif)
__save_flags(flags); /* local CPU only */ __save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */ __cli(); /* local CPU only */
/* put config reg into first byte of hwif->select_data */ /* 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 */ hwif->select_data = 0x21; /* select PIO as default */
outb(hwif->select_data, hwif->config_data); outb(hwif->select_data, hwif->config_data);
reg = inb(hwif->config_data+3); /* get IRQ info */ reg = inb(hwif->config_data+3); /* get IRQ info */
...@@ -246,10 +246,10 @@ void __init ide_init_trm290(struct ata_channel *hwif) ...@@ -246,10 +246,10 @@ void __init ide_init_trm290(struct ata_channel *hwif)
__restore_flags(flags); /* local CPU only */ __restore_flags(flags); /* local CPU only */
if ((reg & 0x10)) 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) else if (!hwif->irq && hwif->mate && hwif->mate->irq)
hwif->irq = hwif->mate->irq; /* sharing IRQ with mate */ 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 #ifdef CONFIG_BLK_DEV_IDEDMA
hwif->dmaproc = &trm290_dmaproc; hwif->dmaproc = &trm290_dmaproc;
...@@ -264,10 +264,10 @@ void __init ide_init_trm290(struct ata_channel *hwif) ...@@ -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 * for the control basereg, so this kludge ensures that we use only
* values that are known to work. Ugh. -ml * 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; 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; old = inw(hwif->config_data) & ~1;
if (old != compat && inb(old+2) == 0xff) { if (old != compat && inb(old+2) == 0xff) {
compat += (next_offset += 0x400); /* leave lower 10 bits untouched */ compat += (next_offset += 0x400); /* leave lower 10 bits untouched */
......
...@@ -160,5 +160,5 @@ void __init init_umc8672 (void) /* called from ide.c */ ...@@ -160,5 +160,5 @@ void __init init_umc8672 (void) /* called from ide.c */
ide_hwifs[1].tuneproc = &tune_umc; ide_hwifs[1].tuneproc = &tune_umc;
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0]; 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) ...@@ -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) 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; return;
if (pio == 255) { if (pio == 255) {
...@@ -525,7 +525,7 @@ unsigned int __init pci_init_via82cxxx(struct pci_dev *dev) ...@@ -525,7 +525,7 @@ unsigned int __init pci_init_via82cxxx(struct pci_dev *dev)
unsigned int __init ata66_via82cxxx(struct ata_channel *hwif) 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) void __init ide_init_via82cxxx(struct ata_channel *hwif)
...@@ -540,7 +540,7 @@ 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].io_32bit = 1;
hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1; hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
hwif->drives[i].autotune = 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 #ifdef CONFIG_BLK_DEV_IDEDMA
...@@ -561,6 +561,6 @@ void __init ide_init_via82cxxx(struct ata_channel *hwif) ...@@ -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) 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); ide_setup_dma(hwif, dmabase, 8);
} }
...@@ -584,8 +584,5 @@ struct hd_driveid { ...@@ -584,8 +584,5 @@ struct hd_driveid {
*/ */
#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ #define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ #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 */ #endif /* _LINUX_HDREG_H */
...@@ -300,7 +300,6 @@ typedef struct ide_drive_s { ...@@ -300,7 +300,6 @@ typedef struct ide_drive_s {
byte slow; /* flag: slow data port */ byte slow; /* flag: slow data port */
byte bswap; /* flag: byte swap data */ byte bswap; /* flag: byte swap data */
byte dsc_overlap; /* flag: DSC overlap */ byte dsc_overlap; /* flag: DSC overlap */
byte nice1; /* flag: give potential excess bandwidth */
unsigned waiting_for_dma: 1; /* dma currently in progress */ unsigned waiting_for_dma: 1; /* dma currently in progress */
unsigned present : 1; /* drive is physically present */ unsigned present : 1; /* drive is physically present */
unsigned noprobe : 1; /* from: hdx=noprobe */ unsigned noprobe : 1; /* from: hdx=noprobe */
...@@ -312,8 +311,6 @@ typedef struct ide_drive_s { ...@@ -312,8 +311,6 @@ typedef struct ide_drive_s {
unsigned nobios : 1; /* flag: do not probe bios for drive */ unsigned nobios : 1; /* flag: do not probe bios for drive */
unsigned revalidate : 1; /* request revalidation */ unsigned revalidate : 1; /* request revalidation */
unsigned atapi_overlap : 1; /* flag: ATAPI overlap (not supported) */ 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 doorlocking : 1; /* flag: for removable only: door lock/unlock works */
unsigned autotune : 2; /* 1=autotune, 2=noautotune, 0=default */ unsigned autotune : 2; /* 1=autotune, 2=noautotune, 0=default */
unsigned remap_0_to_1 : 2; /* 0=remap if ezdrive, 1=remap, 2=noremap */ 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); ...@@ -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); typedef int (ide_busproc_t) (ide_drive_t *, int);
struct ata_channel { struct ata_channel {
struct device dev; /* device handle */
int unit; /* channel number */
struct ata_channel *next; /* for linked-list in ide_hwgroup_t */ struct ata_channel *next; /* for linked-list in ide_hwgroup_t */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */ ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
hw_regs_t hw; /* Hardware info */ 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 */ ide_drive_t drives[MAX_DRIVES]; /* drive info */
struct gendisk *gd; /* gendisk structure */ struct gendisk *gd; /* gendisk structure */
ide_tuneproc_t *tuneproc; /* routine to tune PIO mode for drives */ ide_tuneproc_t *tuneproc; /* routine to tune PIO mode for drives */
...@@ -480,17 +484,12 @@ struct ata_channel { ...@@ -480,17 +484,12 @@ struct ata_channel {
unsigned autodma : 1; /* automatically try to enable DMA at boot */ unsigned autodma : 1; /* automatically try to enable DMA at boot */
unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */ unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */
unsigned highmem : 1; /* can do full 32-bit dma */ 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) #if (DISK_RECOVERY_TIME > 0)
unsigned long last_time; /* time when previous rq was done */ unsigned long last_time; /* time when previous rq was done */
#endif #endif
byte straight8; /* Alan's straight 8 check */ byte straight8; /* Alan's straight 8 check */
ide_busproc_t *busproc; /* driver soft-power interface */ ide_busproc_t *busproc; /* driver soft-power interface */
byte bus_state; /* power state of the IDE bus */ 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