Commit de466adf authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/home/davem/BK/sparc-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents ee2b6d37 7048ea4d
......@@ -271,10 +271,10 @@ init_e100_ide (void)
printk("ide: ETRAX 100LX built-in ATA DMA controller\n");
/* first fill in some stuff in the ide_hwifs fields */
/* first initialize the channel interface data */
for(h = 0; h < MAX_HWIFS; h++) {
ide_hwif_t *hwif = &ide_hwifs[h];
struct ata_channel *hwif = &ide_hwifs[h];
hwif->chipset = ide_etrax100;
hwif->tuneproc = &tune_e100_ide;
hwif->dmaproc = &e100_dmaproc;
......@@ -717,7 +717,7 @@ static ide_startstop_t etrax_dma_intr (ide_drive_t *drive)
LED_DISK_READ(0);
LED_DISK_WRITE(0);
dma_stat = HWIF(drive)->dmaproc(ide_dma_end, drive);
dma_stat = drive->channel->dmaproc(ide_dma_end, drive);
stat = GET_STAT(); /* get drive status */
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) {
......@@ -798,7 +798,7 @@ static int e100_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
* not a diskdrive.
*/
if (drive->media != ide_disk)
if (drive->type != ATA_DISK)
return 0;
dma_begin:
......@@ -902,7 +902,7 @@ static int e100_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
* --- Marcin Dalecki
*/
void ide_release_dma (ide_hwif_t *hwif)
void ide_release_dma(struct ata_channel *hwif)
{
/* empty */
}
......@@ -27,7 +27,7 @@ volatile struct baboon *baboon;
void baboon_irq(int, void *, struct pt_regs *);
extern int macide_ack_intr(ide_hwif_t *);
extern int macide_ack_intr(struct ata_channel *);
/*
* Baboon initialization.
......
......@@ -220,7 +220,7 @@ static byte pci_bus_clock_list_ultra (byte speed, struct chipset_bus_clock_list_
static int aec6210_tune_chipset (ide_drive_t *drive, byte speed)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
int err = 0;
unsigned short d_conf = 0x0000;
......@@ -256,10 +256,10 @@ static int aec6210_tune_chipset (ide_drive_t *drive, byte speed)
static int aec6260_tune_chipset (ide_drive_t *drive, byte speed)
{
ide_hwif_t *hwif = HWIF(drive);
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;
......@@ -293,7 +293,7 @@ static int aec6260_tune_chipset (ide_drive_t *drive, byte speed)
static int aec62xx_tune_chipset (ide_drive_t *drive, byte speed)
{
if (HWIF(drive)->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
if (drive->channel->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
return ((int) aec6210_tune_chipset(drive, speed));
} else {
return ((int) aec6260_tune_chipset(drive, speed));
......@@ -304,7 +304,7 @@ static int aec62xx_tune_chipset (ide_drive_t *drive, byte speed)
static int config_aec6210_chipset_for_dma (ide_drive_t *drive, byte ultra)
{
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
byte unit = (drive->select.b.unit & 0x01);
unsigned long dma_base = hwif->dma_base;
byte speed = -1;
......@@ -349,7 +349,7 @@ static int config_aec6210_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_aec6260_chipset_for_dma (ide_drive_t *drive, byte ultra)
{
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
byte unit = (drive->select.b.unit & 0x01);
unsigned long dma_base = hwif->dma_base;
byte speed = -1;
......@@ -396,7 +396,7 @@ static int config_aec6260_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
{
switch(HWIF(drive)->pci_dev->device) {
switch(drive->channel->pci_dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP850UF:
return config_aec6210_chipset_for_dma(drive, ultra);
case PCI_DEVICE_ID_ARTOP_ATP860:
......@@ -418,7 +418,7 @@ static void aec62xx_tune_drive (ide_drive_t *drive, byte pio)
else
speed = XFER_PIO_0 + min_t(byte, pio, 4);
switch(HWIF(drive)->pci_dev->device) {
switch(drive->channel->pci_dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP850UF:
(void) aec6210_tune_chipset(drive, speed);
case PCI_DEVICE_ID_ARTOP_ATP860:
......@@ -435,7 +435,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
struct hd_driveid *id = drive->id;
ide_dma_action_t dma_func = ide_dma_on;
if (id && (id->capability & 1) && HWIF(drive)->autodma) {
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
if (ide_dmaproc(ide_dma_bad_drive, drive)) {
dma_func = ide_dma_off;
......@@ -476,7 +476,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
no_dma_set:
aec62xx_tune_drive(drive, 5);
}
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
/*
......@@ -489,16 +489,16 @@ int aec62xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
return config_drive_xfer_rate(drive);
case ide_dma_lostirq:
case ide_dma_timeout:
switch(HWIF(drive)->pci_dev->device) {
switch(drive->channel->pci_dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP860:
case PCI_DEVICE_ID_ARTOP_ATP860R:
// {
// int i = 0;
// byte reg49h = 0;
// pci_read_config_byte(HWIF(drive)->pci_dev, 0x49, &reg49h);
// pci_read_config_byte(drive->channel->pci_dev, 0x49, &reg49h);
// for (i=0;i<256;i++)
// pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h|0x10);
// pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h & ~0x10);
// pci_write_config_byte(drive->channel->pci_dev, 0x49, reg49h|0x10);
// pci_write_config_byte(drive->channel->pci_dev, 0x49, reg49h & ~0x10);
// }
// return 0;
default:
......@@ -530,16 +530,16 @@ unsigned int __init pci_init_aec62xx (struct pci_dev *dev)
return dev->irq;
}
unsigned int __init ata66_aec62xx (ide_hwif_t *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;
pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
return ((ata66 & mask) ? 0 : 1);
}
void __init ide_init_aec62xx (ide_hwif_t *hwif)
void __init ide_init_aec62xx(struct ata_channel *hwif)
{
#ifdef CONFIG_AEC62XX_TUNING
hwif->tuneproc = &aec62xx_tune_drive;
......@@ -555,7 +555,7 @@ void __init ide_init_aec62xx (ide_hwif_t *hwif)
#endif /* CONFIG_AEC62XX_TUNING */
}
void __init ide_dmacapable_aec62xx (ide_hwif_t *hwif, unsigned long dmabase)
void __init ide_dmacapable_aec62xx(struct ata_channel *hwif, unsigned long dmabase)
{
#ifdef CONFIG_AEC62XX_TUNING
unsigned long flags;
......@@ -565,7 +565,7 @@ void __init ide_dmacapable_aec62xx (ide_hwif_t *hwif, unsigned long dmabase)
__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 */
......
......@@ -134,7 +134,7 @@ static void ali14xx_tune_drive (ide_drive_t *drive, byte pio)
drive->name, pio - XFER_PIO_0, time1, time2, param1, param2, param3, param4);
/* stuff timing parameters into controller registers */
driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit;
driveNum = (drive->channel->index << 1) + drive->select.b.unit;
save_flags(flags); /* all CPUs */
cli(); /* all CPUs */
outb_p(regOn, basePort);
......@@ -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()) {
......
......@@ -242,13 +242,13 @@ static struct pci_dev *isa_dev;
static void ali15x3_tune_drive (ide_drive_t *drive, byte pio)
{
struct ata_timing *t;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
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)
......@@ -305,11 +305,11 @@ static void ali15x3_tune_drive (ide_drive_t *drive, byte pio)
static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
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) {
......@@ -432,7 +432,7 @@ static byte ali15x3_can_ultra (ide_drive_t *drive)
static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
ide_dma_action_t dma_func = ide_dma_on;
byte can_ultra_dma = ali15x3_can_ultra(drive);
......@@ -537,7 +537,7 @@ unsigned int __init pci_init_ali15x3(struct pci_dev *dev)
* of UDMA66 transfers. It doesn't check the drives.
* But see note 2 below!
*/
unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif)
unsigned int __init ata66_ali15x3(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ata66 = 0;
......@@ -597,7 +597,7 @@ unsigned int __init ata66_ali15x3 (ide_hwif_t *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)
......@@ -632,14 +632,14 @@ unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif)
return(ata66);
}
void __init ide_init_ali15x3 (ide_hwif_t *hwif)
void __init ide_init_ali15x3(struct ata_channel *hwif)
{
#ifndef CONFIG_SPARC64
byte ideic, inmir;
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 (ide_hwif_t *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
*/
......@@ -690,7 +690,7 @@ void __init ide_init_ali15x3 (ide_hwif_t *hwif)
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
void __init ide_dmacapable_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase)
void __init ide_dmacapable_ali15x3(struct ata_channel *hwif, unsigned long dmabase)
{
if ((dmabase) && (m5229_revision < 0x20)) {
return;
......
......@@ -226,7 +226,7 @@ static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_timi
static int amd_set_drive(ide_drive_t *drive, unsigned char speed)
{
ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1);
ide_drive_t *peer = drive->channel->drives + (~drive->dn & 1);
struct ata_timing t, p;
int T, UT;
......@@ -247,7 +247,7 @@ static int amd_set_drive(ide_drive_t *drive, unsigned char speed)
if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1;
amd_set_speed(HWIF(drive)->pci_dev, drive->dn, &t);
amd_set_speed(drive->channel->pci_dev, drive->dn, &t);
if (!drive->init_speed)
drive->init_speed = 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)
{
if (!((amd_enabled >> HWIF(drive)->channel) & 1))
if (!((amd_enabled >> drive->channel->unit) & 1))
return;
if (pio == 255) {
......@@ -287,7 +287,7 @@ int amd74xx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
if (func == ide_dma_check) {
short w80 = HWIF(drive)->udma_four;
short w80 = drive->channel->udma_four;
short speed = ata_timing_mode(drive,
XFER_PIO | XFER_EPIO | XFER_MWDMA | XFER_UDMA |
......@@ -297,7 +297,7 @@ int amd74xx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
amd_set_drive(drive, speed);
func = (HWIF(drive)->autodma && (speed & XFER_MODE) != XFER_PIO)
func = (drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO)
? ide_dma_on : ide_dma_off_quietly;
}
......@@ -409,12 +409,12 @@ unsigned int __init pci_init_amd74xx(struct pci_dev *dev, const char *name)
return 0;
}
unsigned int __init ata66_amd74xx(ide_hwif_t *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(ide_hwif_t *hwif)
void __init ide_init_amd74xx(struct ata_channel *hwif)
{
int i;
......@@ -426,7 +426,7 @@ void __init ide_init_amd74xx(ide_hwif_t *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
......@@ -445,8 +445,8 @@ void __init ide_init_amd74xx(ide_hwif_t *hwif)
* We allow the BM-DMA driver only work on enabled interfaces.
*/
void __init ide_dmacapable_amd74xx(ide_hwif_t *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);
}
......@@ -116,7 +116,7 @@ typedef enum BuddhaType_Enum BuddhaType;
* Check and acknowledge the interrupt status
*/
static int buddha_ack_intr(ide_hwif_t *hwif)
static int buddha_ack_intr(struct ata_channel *hwif)
{
unsigned char ch;
......@@ -126,7 +126,7 @@ static int buddha_ack_intr(ide_hwif_t *hwif)
return 1;
}
static int xsurf_ack_intr(ide_hwif_t *hwif)
static int xsurf_ack_intr(struct ata_channel *hwif)
{
unsigned char ch;
......
......@@ -187,7 +187,7 @@ static byte recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) *
/*
* These are initialized to point at the devices we control
*/
static ide_hwif_t *cmd_hwif0, *cmd_hwif1;
static struct ata_channel *cmd_hwif0, *cmd_hwif1;
static ide_drive_t *cmd_drives[4];
/*
......@@ -429,7 +429,7 @@ static void __init setup_device_ptrs (void)
cmd_hwif0 = &ide_hwifs[0]; /* default, if not found below */
cmd_hwif1 = &ide_hwifs[1]; /* default, if not found below */
for (i = 0; i < MAX_HWIFS; i++) {
ide_hwif_t *hwif = &ide_hwifs[i];
struct ata_channel *hwif = &ide_hwifs[i];
if (hwif->chipset == ide_unknown || hwif->chipset == ide_generic) {
if (hwif->io_ports[IDE_DATA_OFFSET] == 0x1f0)
cmd_hwif0 = hwif;
......@@ -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 */
......
......@@ -211,7 +211,7 @@ static byte prefetch_masks[4] = {CNTRL_DIS_RA0, CNTRL_DIS_RA1, ARTTIM23_DIS_RA2,
static void program_drive_counts (ide_drive_t *drive, int setup_count, int active_count, int recovery_count)
{
unsigned long flags;
ide_drive_t *drives = HWIF(drive)->drives;
ide_drive_t *drives = drive->channel->drives;
byte temp_b;
static const byte setup_counts[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0};
static const byte recovery_counts[] =
......@@ -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) HWIF(drive)->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,
......@@ -260,10 +260,10 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ
* Program the address_setup clocks into ARTTIM reg,
* and then the active/recovery counts into the DRWTIM reg
*/
(void) pci_read_config_byte(HWIF(drive)->pci_dev, arttim_regs[channel][slave], &temp_b);
(void) pci_write_config_byte(HWIF(drive)->pci_dev, arttim_regs[channel][slave],
(void) pci_read_config_byte(drive->channel->pci_dev, arttim_regs[channel][slave], &temp_b);
(void) pci_write_config_byte(drive->channel->pci_dev, arttim_regs[channel][slave],
((byte) setup_count) | (temp_b & 0x3f));
(void) pci_write_config_byte(HWIF(drive)->pci_dev, drwtim_regs[channel][slave],
(void) pci_write_config_byte(drive->channel->pci_dev, drwtim_regs[channel][slave],
(byte) ((active_count << 4) | recovery_count));
cmdprintk ("Write %x to %x\n", ((byte) setup_count) | (temp_b & 0x3f), arttim_regs[channel][slave]);
cmdprintk ("Write %x to %x\n", (byte) ((active_count << 4) | recovery_count), drwtim_regs[channel][slave]);
......@@ -333,10 +333,10 @@ static void cmd64x_tuneproc (ide_drive_t *drive, byte mode_wanted)
setup_count, active_count, recovery_count);
}
static byte cmd680_taskfile_timing (ide_hwif_t *hwif)
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);
......@@ -353,7 +353,7 @@ static byte cmd680_taskfile_timing (ide_hwif_t *hwif)
static void cmd680_tuneproc (ide_drive_t *drive, byte mode_wanted)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
byte drive_pci;
unsigned short speedt;
......@@ -394,10 +394,10 @@ static void config_cmd64x_chipset_for_pio (ide_drive_t *drive, byte set_speed)
static void config_cmd680_chipset_for_pio (ide_drive_t *drive, byte set_speed)
{
ide_hwif_t *hwif = HWIF(drive);
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);
......@@ -420,7 +420,7 @@ static void config_cmd680_chipset_for_pio (ide_drive_t *drive, byte set_speed)
static void config_chipset_for_pio (ide_drive_t *drive, byte set_speed)
{
if (HWIF(drive)->pci_dev->device == PCI_DEVICE_ID_CMD_680) {
if (drive->channel->pci_dev->device == PCI_DEVICE_ID_CMD_680) {
config_cmd680_chipset_for_pio(drive, set_speed);
} else {
config_cmd64x_chipset_for_pio(drive, set_speed);
......@@ -430,13 +430,13 @@ static void config_chipset_for_pio (ide_drive_t *drive, byte set_speed)
static int cmd64x_tune_chipset (ide_drive_t *drive, byte speed)
{
#ifdef CONFIG_BLK_DEV_IDEDMA
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
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;
......@@ -498,9 +498,9 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, byte speed)
static int cmd680_tune_chipset (ide_drive_t *drive, byte speed)
{
ide_hwif_t *hwif = HWIF(drive);
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;
......@@ -615,7 +615,7 @@ speed_break :
static int config_cmd64x_chipset_for_dma (ide_drive_t *drive, unsigned int rev, byte ultra_66)
{
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
byte speed = 0x00;
......@@ -741,7 +741,7 @@ static int config_cmd680_chipset_for_dma (ide_drive_t *drive)
static int config_chipset_for_dma (ide_drive_t *drive, unsigned int rev, byte ultra_66)
{
if (HWIF(drive)->pci_dev->device == PCI_DEVICE_ID_CMD_680)
if (drive->channel->pci_dev->device == PCI_DEVICE_ID_CMD_680)
return (config_cmd680_chipset_for_dma(drive));
return (config_cmd64x_chipset_for_dma(drive, rev, ultra_66));
}
......@@ -749,7 +749,7 @@ static int config_chipset_for_dma (ide_drive_t *drive, unsigned int rev, byte ul
static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
unsigned int class_rev = 0;
byte can_ultra_33 = 0;
......@@ -822,7 +822,7 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
no_dma_set:
config_chipset_for_pio(drive, 1);
}
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
static int cmd680_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
......@@ -841,9 +841,9 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
byte dma_stat = 0;
byte dma_alt_stat = 0;
byte mask = (HWIF(drive)->channel) ? MRDMODE_INTR_CH1 : MRDMODE_INTR_CH0;
unsigned long dma_base = HWIF(drive)->dma_base;
struct pci_dev *dev = HWIF(drive)->pci_dev;
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;
switch (func) {
......@@ -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 = (HWIF(drive)->channel) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
byte dma_reg = (HWIF(drive)->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!
......@@ -891,7 +891,7 @@ static int cmd64x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
*/
static int cmd646_1_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
byte dma_stat;
......@@ -917,8 +917,8 @@ static int cmd646_1_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
static int cmd680_busproc (ide_drive_t * drive, int state)
{
#if 0
ide_hwif_t *hwif = HWIF(drive);
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0;
struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
u32 stat_config = 0;
pci_read_config_dword(hwif->pci_dev, addr_mask, &stat_config);
......@@ -950,8 +950,8 @@ static int cmd680_busproc (ide_drive_t * drive, int state)
static void cmd680_reset (ide_drive_t *drive)
{
#if 0
ide_hwif_t *hwif = HWIF(drive);
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0;
struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->unit) ? 0xB0 : 0xA0;
byte reset = 0;
pci_read_config_byte(hwif->pci_dev, addr_mask, &reset);
......@@ -1081,25 +1081,25 @@ unsigned int __init pci_init_cmd64x(struct pci_dev *dev)
return cmd64x_pci_init (dev);
}
unsigned int cmd680_ata66 (ide_hwif_t *hwif)
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;
}
unsigned int cmd64x_ata66 (ide_hwif_t *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;
}
unsigned int __init ata66_cmd64x (ide_hwif_t *hwif)
unsigned int __init ata66_cmd64x(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
if (dev->device == PCI_DEVICE_ID_CMD_680)
......@@ -1107,7 +1107,7 @@ unsigned int __init ata66_cmd64x (ide_hwif_t *hwif)
return cmd64x_ata66(hwif);
}
void __init ide_init_cmd64x (ide_hwif_t *hwif)
void __init ide_init_cmd64x(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int class_rev;
......
......@@ -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
......@@ -112,7 +112,7 @@ static unsigned int cs5530_pio_timings[2][5] =
*/
static void cs5530_tuneproc (ide_drive_t *drive, byte pio) /* pio=255 means "autotune" */
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned int format, basereg = CS5530_BASEREG(hwif);
if (pio == 255)
......@@ -134,7 +134,7 @@ static void cs5530_tuneproc (ide_drive_t *drive, byte pio) /* pio=255 means "aut
static int cs5530_config_dma (ide_drive_t *drive)
{
int udma_ok = 1, mode = 0;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
int unit = drive->select.b.unit;
ide_drive_t *mate = &hwif->drives[unit^1];
struct hd_driveid *id = drive->id;
......@@ -344,7 +344,7 @@ unsigned int __init pci_init_cs5530(struct pci_dev *dev)
* This gets invoked by the IDE driver once for each channel,
* and performs channel-specific pre-initialization before drive probing.
*/
void __init ide_init_cs5530 (ide_hwif_t *hwif)
void __init ide_init_cs5530(struct ata_channel *hwif)
{
if (hwif->mate)
hwif->serialized = hwif->mate->serialized = 1;
......
......@@ -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 = (HWIF(drive)->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, HWIF(drive)->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, HWIF(drive)->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 */
/*
......@@ -271,7 +271,7 @@ static int cy82c693_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
*/
static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
pio_clocks_t pclk;
unsigned int addrCtrl;
......@@ -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 */
}
......@@ -431,7 +431,7 @@ unsigned int __init pci_init_cy82c693(struct pci_dev *dev)
/*
* the init function - called for each ide channel once
*/
void __init ide_init_cy82c693(ide_hwif_t *hwif)
void __init ide_init_cy82c693(struct ata_channel *hwif)
{
hwif->chipset = ide_cy82c693;
hwif->tuneproc = cy82c693_tune_drive;
......
......@@ -89,7 +89,7 @@ static void tune_dtc2278 (ide_drive_t *drive, byte pio)
* 32bit I/O has to be enabled for *both* drives at the same time.
*/
drive->io_32bit = 1;
HWIF(drive)->drives[!drive->select.b.unit].io_32bit = 1;
drive->channel->drives[!drive->select.b.unit].io_32bit = 1;
}
void __init init_dtc2278 (void)
......@@ -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;
}
......@@ -84,7 +84,7 @@ int ide_doubler = 0; /* support IDE doublers? */
* Check and acknowledge the interrupt status
*/
static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
static int gayle_ack_intr_a4000(struct ata_channel *hwif)
{
unsigned char ch;
......@@ -94,7 +94,7 @@ static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
return 1;
}
static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
static int gayle_ack_intr_a1200(struct ata_channel *hwif)
{
unsigned char ch;
......
......@@ -98,12 +98,12 @@ static void hpt34x_clear_chipset (ide_drive_t *drive)
unsigned int reg1 = 0, tmp1 = 0;
unsigned int reg2 = 0, tmp2 = 0;
pci_read_config_dword(HWIF(drive)->pci_dev, 0x44, &reg1);
pci_read_config_dword(HWIF(drive)->pci_dev, 0x48, &reg2);
tmp1 = ((0x00 << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn))));
pci_read_config_dword(drive->channel->pci_dev, 0x44, &reg1);
pci_read_config_dword(drive->channel->pci_dev, 0x48, &reg2);
tmp1 = ((0x00 << (3 * drive->dn)) | (reg1 & ~(7 << (3 * drive->dn))));
tmp2 = (reg2 & ~(0x11 << drive->dn));
pci_write_config_dword(HWIF(drive)->pci_dev, 0x44, tmp1);
pci_write_config_dword(HWIF(drive)->pci_dev, 0x48, tmp2);
pci_write_config_dword(drive->channel->pci_dev, 0x44, tmp1);
pci_write_config_dword(drive->channel->pci_dev, 0x48, tmp2);
}
static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
......@@ -122,13 +122,13 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed)
lo_speed >>= 5;
}
pci_read_config_dword(HWIF(drive)->pci_dev, 0x44, &reg1);
pci_read_config_dword(HWIF(drive)->pci_dev, 0x48, &reg2);
pci_read_config_dword(drive->channel->pci_dev, 0x44, &reg1);
pci_read_config_dword(drive->channel->pci_dev, 0x48, &reg2);
tmp1 = ((lo_speed << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn))));
tmp2 = ((hi_speed << drive->dn) | reg2);
err = ide_config_drive_speed(drive, speed);
pci_write_config_dword(HWIF(drive)->pci_dev, 0x44, tmp1);
pci_write_config_dword(HWIF(drive)->pci_dev, 0x48, tmp2);
pci_write_config_dword(drive->channel->pci_dev, 0x44, tmp1);
pci_write_config_dword(drive->channel->pci_dev, 0x48, tmp2);
if (!drive->init_speed)
drive->init_speed = speed;
......@@ -254,7 +254,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
struct hd_driveid *id = drive->id;
ide_dma_action_t dma_func = ide_dma_on;
if (id && (id->capability & 1) && HWIF(drive)->autodma) {
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
if (ide_dmaproc(ide_dma_bad_drive, drive)) {
dma_func = ide_dma_off;
......@@ -301,7 +301,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
dma_func = ide_dma_off;
#endif /* CONFIG_HPT34X_AUTODMA */
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
/*
......@@ -314,7 +314,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
unsigned int count, reading = 0;
byte dma_stat;
......@@ -334,6 +334,7 @@ int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
drive->waiting_for_dma = 1;
if (drive->type != ATA_DISK)
return 0;
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); /* issue cmd to drive */
OUT_BYTE((reading == 9) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0;
......@@ -408,7 +409,7 @@ unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
return dev->irq;
}
void __init ide_init_hpt34x (ide_hwif_t *hwif)
void __init ide_init_hpt34x(struct ata_channel *hwif)
{
hwif->tuneproc = &hpt34x_tune_drive;
hwif->speedproc = &hpt34x_tune_chipset;
......
......@@ -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 = (HWIF(drive)->channel) ? 0x55 : 0x51;
byte regfast = (drive->channel->unit) ? 0x55 : 0x51;
/*
* since the channel is always 0 it does not matter.
*/
......@@ -497,11 +497,11 @@ static void hpt366_tune_chipset (ide_drive_t *drive, byte speed)
/*
* Disable the "fast interrupt" prediction.
*/
pci_read_config_byte(HWIF(drive)->pci_dev, regfast, &drive_fast);
pci_read_config_byte(drive->channel->pci_dev, regfast, &drive_fast);
if (drive_fast & 0x02)
pci_write_config_byte(HWIF(drive)->pci_dev, regfast, drive_fast & ~0x20);
pci_write_config_byte(drive->channel->pci_dev, regfast, drive_fast & ~0x20);
pci_read_config_dword(HWIF(drive)->pci_dev, regtime, &reg1);
pci_read_config_dword(drive->channel->pci_dev, regtime, &reg1);
/* detect bus speed by looking at control reg timing: */
switch((reg1 >> 8) & 7) {
case 5:
......@@ -531,18 +531,18 @@ static void hpt366_tune_chipset (ide_drive_t *drive, byte speed)
}
reg2 &= ~0x80000000;
pci_write_config_dword(HWIF(drive)->pci_dev, regtime, reg2);
pci_write_config_dword(drive->channel->pci_dev, regtime, reg2);
}
static void hpt370_tune_chipset (ide_drive_t *drive, byte speed)
{
byte regfast = (HWIF(drive)->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;
byte drive_pci = 0x40 + (drive->dn * 4);
byte new_fast, drive_fast = 0;
struct pci_dev *dev = HWIF(drive)->pci_dev;
struct pci_dev *dev = drive->channel->pci_dev;
/*
* Disable the "fast interrupt" prediction.
......@@ -561,7 +561,7 @@ static void hpt370_tune_chipset (ide_drive_t *drive, byte speed)
new_fast |= 0x01;
#endif
if (new_fast != drive_fast)
pci_write_config_byte(HWIF(drive)->pci_dev, regfast, new_fast);
pci_write_config_byte(drive->channel->pci_dev, regfast, new_fast);
list_conf = pci_bus_clock_list(speed,
(struct chipset_bus_clock_list_entry *)
......@@ -585,7 +585,7 @@ static int hpt3xx_tune_chipset (ide_drive_t *drive, byte speed)
if (!drive->init_speed)
drive->init_speed = speed;
if (pci_rev_check_hpt3xx(HWIF(drive)->pci_dev)) {
if (pci_rev_check_hpt3xx(drive->channel->pci_dev)) {
hpt370_tune_chipset(drive, speed);
} else {
hpt366_tune_chipset(drive, speed);
......@@ -670,7 +670,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
if ((id->dma_ultra & 0x0020) &&
(!check_in_drive_lists(drive, bad_ata100_5)) &&
(HPT370_ALLOW_ATA100_5) &&
(pci_rev_check_hpt3xx(HWIF(drive)->pci_dev)) &&
(pci_rev_check_hpt3xx(drive->channel->pci_dev)) &&
(ultra66)) {
speed = XFER_UDMA_5;
} else if ((id->dma_ultra & 0x0010) &&
......@@ -720,23 +720,23 @@ void hpt3xx_intrproc (ide_drive_t *drive)
if (drive->quirk_list) {
/* drives in the quirk_list may not like intr setups/cleanups */
} else {
OUT_BYTE((drive)->ctl|2, HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]);
OUT_BYTE((drive)->ctl|2, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
}
}
void hpt3xx_maskproc (ide_drive_t *drive, int mask)
{
if (drive->quirk_list) {
if (pci_rev_check_hpt3xx(HWIF(drive)->pci_dev)) {
if (pci_rev_check_hpt3xx(drive->channel->pci_dev)) {
byte reg5a = 0;
pci_read_config_byte(HWIF(drive)->pci_dev, 0x5a, &reg5a);
pci_read_config_byte(drive->channel->pci_dev, 0x5a, &reg5a);
if (((reg5a & 0x10) >> 4) != mask)
pci_write_config_byte(HWIF(drive)->pci_dev, 0x5a, mask ? (reg5a | 0x10) : (reg5a & ~0x10));
pci_write_config_byte(drive->channel->pci_dev, 0x5a, mask ? (reg5a | 0x10) : (reg5a & ~0x10));
} else {
if (mask) {
disable_irq(HWIF(drive)->irq);
disable_irq(drive->channel->irq);
} else {
enable_irq(HWIF(drive)->irq);
enable_irq(drive->channel->irq);
}
}
} else {
......@@ -750,7 +750,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
struct hd_driveid *id = drive->id;
ide_dma_action_t dma_func = ide_dma_on;
if (id && (id->capability & 1) && HWIF(drive)->autodma) {
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
if (ide_dmaproc(ide_dma_bad_drive, drive)) {
dma_func = ide_dma_off;
......@@ -791,7 +791,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
config_chipset_for_pio(drive);
}
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
/*
......@@ -803,7 +803,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
int hpt366_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
byte reg50h = 0, reg52h = 0, reg5ah = 0, dma_stat = 0;
unsigned long dma_base = HWIF(drive)->dma_base;
unsigned long dma_base = drive->channel->dma_base;
switch (func) {
case ide_dma_check:
......@@ -812,21 +812,21 @@ int hpt366_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
dma_stat = inb(dma_base+2);
return (dma_stat & 4) == 4; /* return 1 if INTR asserted */
case ide_dma_lostirq:
pci_read_config_byte(HWIF(drive)->pci_dev, 0x50, &reg50h);
pci_read_config_byte(HWIF(drive)->pci_dev, 0x52, &reg52h);
pci_read_config_byte(HWIF(drive)->pci_dev, 0x5a, &reg5ah);
pci_read_config_byte(drive->channel->pci_dev, 0x50, &reg50h);
pci_read_config_byte(drive->channel->pci_dev, 0x52, &reg52h);
pci_read_config_byte(drive->channel->pci_dev, 0x5a, &reg5ah);
printk("%s: (%s) reg50h=0x%02x, reg52h=0x%02x, reg5ah=0x%02x\n",
drive->name,
ide_dmafunc_verbose(func),
reg50h, reg52h, reg5ah);
if (reg5ah & 0x10)
pci_write_config_byte(HWIF(drive)->pci_dev, 0x5a, reg5ah & ~0x10);
pci_write_config_byte(drive->channel->pci_dev, 0x5a, reg5ah & ~0x10);
/* fall through to a reset */
#if 0
case ide_dma_begin:
case ide_dma_end:
/* reset the chips state over and over.. */
pci_write_config_byte(HWIF(drive)->pci_dev, 0x51, 0x13);
pci_write_config_byte(drive->channel->pci_dev, 0x51, 0x13);
#endif
break;
case ide_dma_timeout:
......@@ -838,10 +838,10 @@ int hpt366_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
int hpt370_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(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) {
......@@ -899,23 +899,23 @@ int hpt370_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
void hpt3xx_reset (ide_drive_t *drive)
{
#if 0
unsigned long high_16 = pci_resource_start(HWIF(drive)->pci_dev, 4);
byte reset = (HWIF(drive)->channel) ? 0x80 : 0x40;
unsigned long high_16 = pci_resource_start(drive->channel->pci_dev, 4);
byte reset = (drive->channel->unit) ? 0x80 : 0x40;
byte reg59h = 0;
pci_read_config_byte(HWIF(drive)->pci_dev, 0x59, &reg59h);
pci_write_config_byte(HWIF(drive)->pci_dev, 0x59, reg59h|reset);
pci_write_config_byte(HWIF(drive)->pci_dev, 0x59, reg59h);
pci_read_config_byte(drive->channel->pci_dev, 0x59, &reg59h);
pci_write_config_byte(drive->channel->pci_dev, 0x59, reg59h|reset);
pci_write_config_byte(drive->channel->pci_dev, 0x59, reg59h);
#endif
}
#if 0
static int hpt3xx_tristate (ide_drive_t * drive, int state)
{
ide_hwif_t *hwif = HWIF(drive);
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;
......@@ -951,7 +951,7 @@ static int hpt3xx_tristate (ide_drive_t * drive, int state)
#define TRISTATE_BIT 0x8000
static int hpt370_busproc(ide_drive_t * drive, int state)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
byte tristate, resetmask, bus_reg;
u16 tri_reg;
......@@ -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;
......@@ -1136,10 +1136,10 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev)
return dev->irq;
}
unsigned int __init ata66_hpt366 (ide_hwif_t *hwif)
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
......@@ -1150,7 +1150,7 @@ unsigned int __init ata66_hpt366 (ide_hwif_t *hwif)
return ((ata66 & regmask) ? 0 : 1);
}
void __init ide_init_hpt366 (ide_hwif_t *hwif)
void __init ide_init_hpt366(struct ata_channel *hwif)
{
int hpt_rev;
......@@ -1210,12 +1210,12 @@ void __init ide_init_hpt366 (ide_hwif_t *hwif)
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
void __init ide_dmacapable_hpt366 (ide_hwif_t *hwif, unsigned long dmabase)
void __init ide_dmacapable_hpt366(struct ata_channel *hwif, unsigned long dmabase)
{
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
......
......@@ -224,7 +224,7 @@ static iftype_t __init icside_identifyif (struct expansion_card *ec)
#define NR_ENTRIES 256
#define TABLE_SIZE (NR_ENTRIES * 8)
static int ide_build_sglist(ide_hwif_t *hwif, struct request *rq)
static int ide_build_sglist(struct ata_channel *hwif, struct request *rq)
{
request_queue_t *q = &hwif->drives[DEVICE_NR(rq->rq_dev) & 1].queue;
struct scatterlist *sg = hwif->sg_table;
......@@ -245,16 +245,16 @@ static int ide_build_sglist(ide_hwif_t *hwif, struct request *rq)
static int
icside_build_dmatable(ide_drive_t *drive, int reading)
{
return HWIF(drive)->sg_nents = ide_build_sglist(HWIF(drive), HWGROUP(drive)->rq);
return drive->channel->sg_nents = ide_build_sglist(drive->channel, HWGROUP(drive)->rq);
}
/* Teardown mappings after DMA has completed. */
static void icside_destroy_dmatable(ide_drive_t *drive)
{
struct scatterlist *sg = HWIF(drive)->sg_table;
int nents = HWIF(drive)->sg_nents;
struct scatterlist *sg = drive->channel->sg_table;
int nents = drive->channel->sg_nents;
pci_unmap_sg(NULL, sg, nents, HWIF(drive)->sg_dma_direction);
pci_unmap_sg(NULL, sg, nents, drive->channel->sg_dma_direction);
}
/*
......@@ -333,7 +333,7 @@ static ide_startstop_t icside_dmaintr(ide_drive_t *drive)
int i;
byte stat, dma_stat;
dma_stat = HWIF(drive)->dmaproc(ide_dma_end, drive);
dma_stat = drive->channel->dmaproc(ide_dma_end, drive);
stat = GET_STAT(); /* get drive status */
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) {
......@@ -356,7 +356,7 @@ static int
icside_dma_check(ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
int autodma = hwif->autodma;
int xfer_mode = XFER_PIO_2;
int func = ide_dma_off_quietly;
......@@ -397,7 +397,7 @@ icside_dma_verbose(ide_drive_t *drive)
static int
icside_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
int count, reading = 0;
switch (func) {
......@@ -436,14 +436,15 @@ icside_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
*/
set_dma_speed(hwif->hw.dma, drive->drive_data);
set_dma_sg(hwif->hw.dma, HWIF(drive)->sg_table, count);
set_dma_sg(hwif->hw.dma, drive->channel->sg_table, count);
set_dma_mode(hwif->hw.dma, reading ? DMA_MODE_READ
: DMA_MODE_WRITE);
drive->waiting_for_dma = 1;
if (drive->media != ide_disk)
if (drive->type != ATA_DISK)
return 0;
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &icside_dmaintr, WAIT_CMD, NULL);
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA,
IDE_COMMAND_REG);
......@@ -473,7 +474,7 @@ icside_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
}
static int
icside_setup_dma(ide_hwif_t *hwif, int autodma)
icside_setup_dma(struct ata_channel *hwif, int autodma)
{
printk(" %s: SG-DMA", hwif->name);
......@@ -498,7 +499,7 @@ icside_setup_dma(ide_hwif_t *hwif, int autodma)
return 0;
}
void ide_release_dma(ide_hwif_t *hwif)
void ide_release_dma(struct ata_channel *hwif)
{
if (hwif->sg_table) {
kfree(hwif->sg_table);
......@@ -507,10 +508,10 @@ void ide_release_dma(ide_hwif_t *hwif)
}
#endif
static ide_hwif_t *
static struct ata_channel *
icside_find_hwif(unsigned long dataport)
{
ide_hwif_t *hwif;
struct ata_channel *hwif;
int index;
for (index = 0; index < MAX_HWIFS; ++index) {
......@@ -530,11 +531,11 @@ icside_find_hwif(unsigned long dataport)
return hwif;
}
static ide_hwif_t *
static struct ata_channel *
icside_setup(unsigned long base, struct cardinfo *info, int irq)
{
unsigned long port = base + info->dataoffset;
ide_hwif_t *hwif;
struct ata_channel *hwif;
hwif = icside_find_hwif(base);
if (hwif) {
......@@ -562,7 +563,7 @@ icside_setup(unsigned long base, struct cardinfo *info, int irq)
static int __init icside_register_v5(struct expansion_card *ec, int autodma)
{
unsigned long slot_port;
ide_hwif_t *hwif;
struct ata_channel *hwif;
slot_port = ecard_address(ec, ECARD_MEMC, 0);
......@@ -584,7 +585,8 @@ static int __init icside_register_v5(struct expansion_card *ec, int autodma)
static int __init icside_register_v6(struct expansion_card *ec, int autodma)
{
unsigned long slot_port, port;
ide_hwif_t *hwif, *mate;
struct ata_channel *hwif;
struct ata_channel *mate;
int sel = 0;
slot_port = ecard_address(ec, ECARD_IOC, ECARD_FAST);
......@@ -620,7 +622,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) {
......@@ -629,7 +631,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);
}
}
......
......@@ -723,9 +723,9 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
if (info->dma) {
if (info->cmd == READ) {
info->dma = !HWIF(drive)->dmaproc(ide_dma_read, drive);
info->dma = !drive->channel->dmaproc(ide_dma_read, drive);
} else if (info->cmd == WRITE) {
info->dma = !HWIF(drive)->dmaproc(ide_dma_write, drive);
info->dma = !drive->channel->dmaproc(ide_dma_write, drive);
} else {
printk("ide-cd: DMA set, but not allowed\n");
}
......@@ -742,9 +742,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
if (info->dma)
(void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
(void) drive->channel->dmaproc(ide_dma_begin, drive);
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, handler, WAIT_CMD, cdrom_timer_expiry);
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
return ide_started;
......@@ -787,6 +788,7 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
}
/* Arm the interrupt handler. */
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, handler, timeout, cdrom_timer_expiry);
/* Send the command to the device. */
......@@ -899,8 +901,8 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
/* Check for errors. */
if (dma) {
info->dma = 0;
if ((dma_error = HWIF(drive)->dmaproc(ide_dma_end, drive)))
HWIF(drive)->dmaproc(ide_dma_off, drive);
if ((dma_error = drive->channel->dmaproc(ide_dma_end, drive)))
drive->channel->dmaproc(ide_dma_off, drive);
}
if (cdrom_decode_status (&startstop, drive, 0, &stat))
......@@ -1005,7 +1007,9 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
/* Done moving data!
Wait for another interrupt. */
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &cdrom_read_intr, WAIT_CMD, NULL);
return ide_started;
}
......@@ -1335,6 +1339,8 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
}
/* Now we wait for another interrupt. */
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, &cdrom_pc_intr, WAIT_CMD, cdrom_timer_expiry);
return ide_started;
}
......@@ -1476,9 +1482,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
/* Check for errors. */
if (dma) {
info->dma = 0;
if ((dma_error = HWIF(drive)->dmaproc(ide_dma_end, drive))) {
if ((dma_error = drive->channel->dmaproc(ide_dma_end, drive))) {
printk("ide-cd: write dma error\n");
HWIF(drive)->dmaproc(ide_dma_off, drive);
drive->channel->dmaproc(ide_dma_off, drive);
}
}
......@@ -1559,6 +1565,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
}
/* re-arm handler */
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &cdrom_write_intr, 5 * WAIT_CMD, NULL);
return ide_started;
}
......@@ -2021,14 +2028,14 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
/* Now try to get the total cdrom capacity. */
minor = (drive->select.b.unit) << PARTN_BITS;
dev = mk_kdev(HWIF(drive)->major, minor);
dev = mk_kdev(drive->channel->major, minor);
stat = cdrom_get_last_written(dev, &toc->capacity);
if (stat)
stat = cdrom_read_capacity(drive, &toc->capacity, sense);
if (stat)
toc->capacity = 0x1fffff;
HWIF(drive)->gd->sizes[drive->select.b.unit << PARTN_BITS] = (toc->capacity * SECTORS_PER_FRAME) >> (BLOCK_SIZE_BITS - 9);
drive->channel->gd->sizes[drive->select.b.unit << PARTN_BITS] = (toc->capacity * SECTORS_PER_FRAME) >> (BLOCK_SIZE_BITS - 9);
drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
/* Remember that we've read this stuff. */
......@@ -2487,7 +2494,7 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
struct cdrom_device_info *devinfo = &info->devinfo;
int minor = (drive->select.b.unit) << PARTN_BITS;
devinfo->dev = mk_kdev(HWIF(drive)->major, minor);
devinfo->dev = mk_kdev(drive->channel->major, minor);
devinfo->ops = &ide_cdrom_dops;
devinfo->mask = 0;
*(int *)&devinfo->speed = CDROM_STATE_FLAGS (drive)->current_speed;
......@@ -2519,7 +2526,7 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
*/
devinfo->de = devfs_register(drive->de, "cd", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor,
drive->channel->major, minor,
S_IFBLK | S_IRUGO | S_IWUGO,
ide_fops, NULL);
......@@ -2661,7 +2668,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (drive->using_dma)
(void) HWIF(drive)->dmaproc(ide_dma_verbose, drive);
(void) drive->channel->dmaproc(ide_dma_verbose, drive);
#endif /* CONFIG_BLK_DEV_IDEDMA */
printk("\n");
......@@ -2684,8 +2691,8 @@ int ide_cdrom_setup (ide_drive_t *drive)
/*
* default to read-only always and fix latter at the bottom
*/
set_device_ro(mk_kdev(HWIF(drive)->major, minor), 1);
set_blocksize(mk_kdev(HWIF(drive)->major, minor), CD_FRAMESIZE);
set_device_ro(mk_kdev(drive->channel->major, minor), 1);
set_blocksize(mk_kdev(drive->channel->major, minor), CD_FRAMESIZE);
blk_queue_hardsect_size(&drive->queue, CD_FRAMESIZE);
blk_queue_prep_rq(&drive->queue, ll_10byte_cmd_build);
......@@ -2807,7 +2814,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
nslots = ide_cdrom_probe_capabilities (drive);
if (CDROM_CONFIG_FLAGS(drive)->dvd_ram)
set_device_ro(mk_kdev(HWIF(drive)->major, minor), 0);
set_device_ro(mk_kdev(drive->channel->major, minor), 0);
if (ide_cdrom_register (drive, nslots)) {
printk ("%s: ide_cdrom_setup failed to register device with the cdrom driver.\n", drive->name);
......@@ -2854,7 +2861,7 @@ void ide_cdrom_release (struct inode *inode, struct file *file,
static
int ide_cdrom_check_media_change (ide_drive_t *drive)
{
return cdrom_media_changed(mk_kdev (HWIF (drive)->major,
return cdrom_media_changed(mk_kdev (drive->channel->major,
(drive->select.b.unit) << PARTN_BITS));
}
......@@ -2875,14 +2882,14 @@ void ide_cdrom_revalidate (ide_drive_t *drive)
/* for general /dev/cdrom like mounting, one big disc */
drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
HWIF(drive)->gd->sizes[minor] = toc->capacity * BLOCKS_PER_FRAME;
drive->channel->gd->sizes[minor] = toc->capacity * BLOCKS_PER_FRAME;
/*
* reset block size, ide_revalidate_disk incorrectly sets it to
* 1024 even for CDROM's
*/
blk_size[HWIF(drive)->major] = HWIF(drive)->gd->sizes;
set_blocksize(mk_kdev(HWIF(drive)->major, minor), CD_FRAMESIZE);
blk_size[drive->channel->major] = drive->channel->gd->sizes;
set_blocksize(mk_kdev(drive->channel->major, minor), CD_FRAMESIZE);
}
static
......@@ -2984,15 +2991,14 @@ int ide_cdrom_init(void)
memset (info, 0, sizeof (struct cdrom_info));
drive->driver_data = info;
/* ATA-PATTERN */
ata_ops(drive)->busy++;
MOD_INC_USE_COUNT;
if (ide_cdrom_setup (drive)) {
ata_ops(drive)->busy--;
MOD_DEC_USE_COUNT;
if (ide_cdrom_cleanup (drive))
printk ("%s: ide_cdrom_cleanup failed in ide_cdrom_init\n", drive->name);
continue;
}
ata_ops(drive)->busy--;
MOD_DEC_USE_COUNT;
failed--;
}
......
This diff is collapsed.
......@@ -204,7 +204,7 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive)
{
byte stat, dma_stat;
dma_stat = HWIF(drive)->dmaproc(ide_dma_end, drive);
dma_stat = drive->channel->dmaproc(ide_dma_end, drive);
stat = GET_STAT(); /* get drive status */
if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) {
......@@ -219,7 +219,7 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive)
return ide_error(drive, "dma_intr", stat);
}
static int ide_build_sglist (ide_hwif_t *hwif, struct request *rq)
static int ide_build_sglist(struct ata_channel *hwif, struct request *rq)
{
request_queue_t *q = &hwif->drives[DEVICE_NR(rq->rq_dev) & 1].queue;
struct scatterlist *sg = hwif->sg_table;
......@@ -238,7 +238,7 @@ static int ide_build_sglist (ide_hwif_t *hwif, struct request *rq)
return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
}
static int ide_raw_build_sglist (ide_hwif_t *hwif, struct request *rq)
static int ide_raw_build_sglist(struct ata_channel *hwif, struct request *rq)
{
struct scatterlist *sg = hwif->sg_table;
int nents = 0;
......@@ -285,7 +285,7 @@ static int ide_raw_build_sglist (ide_hwif_t *hwif, struct request *rq)
*/
int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned int *table = hwif->dmatable_cpu;
#ifdef CONFIG_BLK_DEV_TRM290
unsigned int is_trm290_chipset = (hwif->chipset == ide_trm290);
......@@ -371,11 +371,11 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func)
/* Teardown mappings after DMA has completed. */
void ide_destroy_dmatable (ide_drive_t *drive)
{
struct pci_dev *dev = HWIF(drive)->pci_dev;
struct scatterlist *sg = HWIF(drive)->sg_table;
int nents = HWIF(drive)->sg_nents;
struct pci_dev *dev = drive->channel->pci_dev;
struct scatterlist *sg = drive->channel->sg_table;
int nents = drive->channel->sg_nents;
pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction);
pci_unmap_sg(dev, sg, nents, drive->channel->sg_dma_direction);
}
/*
......@@ -462,7 +462,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
{
int config_allows_dma = 1;
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
#ifdef CONFIG_IDEDMA_ONLYDISK
if (drive->type != ATA_DISK)
......@@ -502,7 +502,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
*/
static int dma_timer_expiry(ide_drive_t *drive)
{
byte dma_stat = inb(HWIF(drive)->dma_base+2);
byte dma_stat = inb(drive->channel->dma_base+2);
#ifdef DEBUG
printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat);
......@@ -525,11 +525,11 @@ static void ide_toggle_bounce(ide_drive_t *drive, int on)
{
u64 addr = BLK_BOUNCE_HIGH;
if (on && drive->type == ATA_DISK && HWIF(drive)->highmem) {
if (on && drive->type == ATA_DISK && drive->channel->highmem) {
if (!PCI_DMA_BUS_IS_PHYS)
addr = BLK_BOUNCE_ANY;
else
addr = HWIF(drive)->pci_dev->dma_mask;
addr = drive->channel->pci_dev->dma_mask;
}
blk_queue_bounce_limit(&drive->queue, addr);
......@@ -553,7 +553,7 @@ static void ide_toggle_bounce(ide_drive_t *drive, int on)
*/
int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
byte unit = (drive->select.b.unit & 0x01);
unsigned int count, reading = 0, set_high = 1;
......@@ -588,17 +588,19 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
drive->waiting_for_dma = 1;
if (drive->type != ATA_DISK)
return 0;
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
(drive->addressing == 1)) {
ide_task_t *args = HWGROUP(drive)->rq->special;
OUT_BYTE(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
} else if (drive->addressing) {
OUT_BYTE(reading ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
} else {
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
}
return HWIF(drive)->dmaproc(ide_dma_begin, drive);
return drive->channel->dmaproc(ide_dma_begin, drive);
case ide_dma_begin:
/* Note that this is done *after* the cmd has
* been issued to the drive, as per the BM-IDE spec.
......@@ -644,7 +646,7 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
/*
* Needed for allowing full modular support of ide-driver
*/
void ide_release_dma(ide_hwif_t *hwif)
void ide_release_dma(struct ata_channel *hwif)
{
if (!hwif->dma_base)
return;
......@@ -660,7 +662,7 @@ void ide_release_dma(ide_hwif_t *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;
......@@ -669,7 +671,7 @@ void ide_release_dma(ide_hwif_t *hwif)
/*
* This can be called for a dynamically installed interface. Don't __init it
*/
void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports)
void ide_setup_dma(struct ata_channel *hwif, unsigned long dma_base, unsigned int num_ports)
{
printk(" %s: BM-DMA at 0x%04lx-0x%04lx", hwif->name, dma_base, dma_base + num_ports - 1);
if (check_region(dma_base, num_ports)) {
......
......@@ -134,7 +134,7 @@ int ide_driveid_update (ide_drive_t *drive)
struct hd_driveid *id;
unsigned long timeout, flags;
SELECT_MASK(HWIF(drive), drive, 1);
SELECT_MASK(drive->channel, drive, 1);
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl,IDE_CONTROL_REG);
ide_delay_50ms();
......@@ -142,20 +142,20 @@ int ide_driveid_update (ide_drive_t *drive)
timeout = jiffies + WAIT_WORSTCASE;
do {
if (0 < (signed long)(jiffies - timeout)) {
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_MASK(drive->channel, drive, 0);
return 0; /* drive timed-out */
}
ide_delay_50ms(); /* give drive a breather */
} while (IN_BYTE(IDE_ALTSTATUS_REG) & BUSY_STAT);
ide_delay_50ms(); /* wait for IRQ and DRQ_STAT */
if (!OK_STAT(GET_STAT(),DRQ_STAT,BAD_R_STAT)) {
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_MASK(drive->channel, drive, 0);
printk("%s: CHECK for good STATUS\n", drive->name);
return 0;
}
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only; some systems need this */
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_MASK(drive->channel, drive, 0);
id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC);
if (!id) {
__restore_flags(flags); /* local CPU only */
......@@ -186,11 +186,11 @@ int ide_driveid_update (ide_drive_t *drive)
*/
int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
{
if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
(args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) {
if (!HWIF(drive)->udma_four) {
printk("%s: Speed warnings UDMA 3/4/5 is not functional.\n", HWIF(drive)->name);
if ((args->taskfile.command == WIN_SETFEATURES) &&
(args->taskfile.sector_number > XFER_UDMA_2) &&
(args->taskfile.feature == SETFEATURES_XFER)) {
if (!drive->channel->udma_four) {
printk("%s: Speed warnings UDMA 3/4/5 is not functional.\n", drive->channel->name);
return 1;
}
#ifndef CONFIG_IDEDMA_IVB
......@@ -213,9 +213,9 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
*/
int set_transfer (ide_drive_t *drive, ide_task_t *args)
{
if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
(args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) &&
if ((args->taskfile.command == WIN_SETFEATURES) &&
(args->taskfile.sector_number >= XFER_SW_DMA_0) &&
(args->taskfile.feature == SETFEATURES_XFER) &&
(drive->id->dma_ultra ||
drive->id->dma_mword ||
drive->id->dma_1word))
......@@ -229,7 +229,7 @@ int set_transfer (ide_drive_t *drive, ide_task_t *args)
*/
byte eighty_ninty_three (ide_drive_t *drive)
{
return ((byte) ((HWIF(drive)->udma_four) &&
return ((byte) ((drive->channel->udma_four) &&
#ifndef CONFIG_IDEDMA_IVB
(drive->id->hw_config & 0x4000) &&
#endif /* CONFIG_IDEDMA_IVB */
......@@ -249,8 +249,9 @@ byte eighty_ninty_three (ide_drive_t *drive)
*/
int ide_config_drive_speed (ide_drive_t *drive, byte speed)
{
ide_hwif_t *hwif = HWIF(drive);
int i, error = 1;
struct ata_channel *hwif = drive->channel;
int i;
int error = 1;
byte stat;
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
......@@ -269,8 +270,8 @@ int ide_config_drive_speed (ide_drive_t *drive, byte speed)
*/
disable_irq(hwif->irq); /* disable_irq_nosync ?? */
udelay(1);
SELECT_DRIVE(HWIF(drive), drive);
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_DRIVE(drive->channel, drive);
SELECT_MASK(drive->channel, drive, 0);
udelay(1);
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
......@@ -310,7 +311,7 @@ int ide_config_drive_speed (ide_drive_t *drive, byte speed)
}
}
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_MASK(drive->channel, drive, 0);
enable_irq(hwif->irq);
......
......@@ -902,7 +902,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
if (HWIF(drive)->dmaproc(ide_dma_end, drive)) {
if (drive->channel->dmaproc(ide_dma_end, drive)) {
set_bit (PC_DMA_ERROR, &pc->flags);
} else {
pc->actually_transferred=pc->request_transfer;
......@@ -945,7 +945,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
printk (KERN_ERR "ide-floppy: The floppy wants to issue more interrupts in DMA mode\n");
HWIF(drive)->dmaproc(ide_dma_off, drive);
drive->channel->dmaproc(ide_dma_off, drive);
return ide_stopped;
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
......@@ -968,6 +968,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
if (temp > pc->buffer_size) {
printk (KERN_ERR "ide-floppy: The floppy wants to send us more data than expected - discarding data\n");
idefloppy_discard_data (drive,bcount.all);
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL);
return ide_started;
}
......@@ -990,7 +991,9 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
pc->actually_transferred+=bcount.all; /* Update the current position */
pc->current_position+=bcount.all;
ide_set_handler (drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
return ide_started;
}
......@@ -1014,8 +1017,11 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
printk (KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while issuing a packet command\n");
return ide_stopped;
}
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
atapi_output_bytes (drive, floppy->pc->c, 12); /* Send the actual packet */
return ide_started;
}
......@@ -1062,10 +1068,12 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
* 25msec is too short, 40 and 50msec work well. idefloppy_pc_intr will
* not be actually used until after the packet is moved in about 50 msec.
*/
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive,
&idefloppy_pc_intr, /* service routine for packet command */
floppy->ticks, /* wait this long before "failing" */
&idefloppy_transfer_pc2); /* fail == transfer_pc2 */
return ide_started;
}
......@@ -1117,10 +1125,10 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
(void) HWIF(drive)->dmaproc(ide_dma_off, drive);
(void) drive->channel->dmaproc(ide_dma_off, drive);
}
if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
dma_ok=!HWIF(drive)->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
dma_ok=!drive->channel->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (IDE_CONTROL_REG)
......@@ -1133,7 +1141,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
#ifdef CONFIG_BLK_DEV_IDEDMA
if (dma_ok) { /* Begin DMA, if necessary */
set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
(void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
(void) drive->channel->dmaproc(ide_dma_begin, drive);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
......@@ -1145,6 +1153,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
}
if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) {
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler (drive, pkt_xfer_routine, IDEFLOPPY_WAIT_CMD, NULL);
OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */
return ide_started;
......@@ -2004,7 +2013,7 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy)
(void) idefloppy_get_capacity (drive);
idefloppy_add_settings(drive);
for (i = 0; i < MAX_DRIVES; ++i) {
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
if (drive != &hwif->drives[i]) continue;
hwif->gd->de_arr[i] = drive->de;
......@@ -2109,10 +2118,9 @@ int idefloppy_init (void)
kfree (floppy);
continue;
}
/* ATA-PATTERN */
ata_ops(drive)->busy++;
MOD_INC_USE_COUNT;
idefloppy_setup (drive, floppy);
ata_ops(drive)->busy--;
MOD_DEC_USE_COUNT;
failed--;
}
......
......@@ -7,6 +7,7 @@
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/ide.h>
#include <linux/mc146818rtc.h>
#include <asm/io.h>
......
This diff is collapsed.
......@@ -71,6 +71,9 @@ enum {
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
# define BAD_DMA_DRIVE 0
# define GOOD_DMA_DRIVE 1
typedef struct {
int accessTime;
int cycleTime;
......@@ -124,7 +127,7 @@ struct pmu_sleep_notifier idepmac_sleep_notifier = {
static int
pmac_ide_find(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
ide_ioreg_t base;
int i;
......@@ -258,8 +261,8 @@ pmac_ide_do_setfeature(ide_drive_t *drive, byte command)
save_flags(flags);
cli();
udelay(1);
SELECT_DRIVE(HWIF(drive), drive);
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_DRIVE(drive->channel, drive);
SELECT_MASK(drive->channel, drive, 0);
udelay(1);
if(wait_for_ready(drive)) {
printk(KERN_ERR "pmac_ide_do_setfeature disk not ready before SET_FEATURE!\n");
......@@ -507,7 +510,7 @@ pmac_ide_probe(void)
struct device_node *p, **pp, *removables, **rp;
unsigned long base;
int irq, big_delay;
ide_hwif_t *hwif;
struct ata_channel *hwif;
if (_machine != _MACH_Pmac)
return;
......@@ -933,7 +936,7 @@ pmac_ide_check_dma(ide_drive_t *drive)
if (idx < 0)
return 0;
if (drive->media == ide_floppy)
if (drive->type == ATA_FLOPPY)
enable = 0;
if (((id->capability & 1) == 0) && !check_drive_lists(drive, GOOD_DMA_DRIVE))
enable = 0;
......@@ -944,7 +947,7 @@ pmac_ide_check_dma(ide_drive_t *drive)
ata4 = (pmac_ide[idx].kind == controller_kl_ata4);
if(enable) {
if (ata4 && (drive->media == ide_disk) &&
if (ata4 && (drive->type == ATA_DISK) &&
(id->field_valid & 0x0004) && (id->dma_ultra & 0x17)) {
/* UltraDMA modes. */
drive->using_dma = pmac_ide_udma_enable(drive, idx);
......@@ -991,8 +994,9 @@ int pmac_ide_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
if (!pmac_ide_build_dmatable(drive, ix, func==ide_dma_write))
return 1;
drive->waiting_for_dma = 1;
if (drive->media != ide_disk)
if (drive->type != ATA_DISK)
return 0;
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
OUT_BYTE(func==ide_dma_write? WIN_WRITEDMA: WIN_READDMA,
IDE_COMMAND_REG);
......@@ -1055,8 +1059,8 @@ static void idepmac_sleep_device(ide_drive_t *drive, int i, unsigned base)
/* FIXME: We only handle the master IDE disk, we shoud
* try to fix CD-ROMs here
*/
switch (drive->media) {
case ide_disk:
switch (drive->type) {
case ATA_DISK:
/* Spin down the drive */
outb(0xa0, base+0x60);
outb(0x0, base+0x30);
......@@ -1073,10 +1077,10 @@ static void idepmac_sleep_device(ide_drive_t *drive, int i, unsigned base)
break;
}
break;
case ide_cdrom:
case ATA_ROM:
// todo
break;
case ide_floppy:
case ATA_FLOPPY:
// todo
break;
}
......@@ -1094,7 +1098,7 @@ static void idepmac_wake_device(ide_drive_t *drive, int used_dma)
DRIVER(drive)->media_change(drive);
/* We kick the VFS too (see fix in ide.c revalidate) */
check_disk_change(MKDEV(HWIF(drive)->major, (drive->select.b.unit) << PARTN_BITS));
check_disk_change(MKDEV(drive->channel->major, (drive->select.b.unit) << PARTN_BITS));
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
/* We re-enable DMA on the drive if it was active. */
......@@ -1198,7 +1202,7 @@ static int idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when)
break;
case PBOOK_SLEEP_NOW:
for (i = 0; i < pmac_ide_count; ++i) {
ide_hwif_t *hwif;
struct ata_channel *hwif;
ide_drive_t *drive;
int unlock = 0;
......@@ -1258,7 +1262,7 @@ static int idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when)
mdelay(IDE_WAKEUP_DELAY_MS);
for (i = 0; i < pmac_ide_count; ++i) {
ide_hwif_t *hwif;
struct ata_channel *hwif;
ide_drive_t *drive;
int j, used_dma;
......
......@@ -57,7 +57,7 @@ struct pnp_dev_t {
static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
{
hw_regs_t hw;
ide_hwif_t *hwif;
struct ata_channel *hwif;
int index;
if (!enable)
......
......@@ -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 (HWIF(drive)->channel == 1 && HWIF(drive)->chipset == ide_pdc4030) {
if (drive->channel->unit == 1 && drive->channel->chipset == ide_pdc4030) {
printk(" -- not supported on 2nd Promise port\n");
goto err_misc;
}
......@@ -167,12 +167,16 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
*/
if (id->config & (1<<7))
drive->removable = 1;
/*
* Prevent long system lockup probing later for non-existant
* slave drive if the hwif is actually a flash memory card of some variety:
* FIXME: This is just plain ugly or plain unnecessary.
*
* Prevent long system lockup probing later for non-existant slave
* drive if the hwif is actually a flash memory card of some variety:
*/
if (drive_is_flashcard(drive)) {
ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
ide_drive_t *mate = &drive->channel->drives[1 ^ drive->select.b.unit];
if (!mate->ata_flash) {
mate->present = 0;
mate->noprobe = 1;
......@@ -182,8 +186,8 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
printk("ATA DISK drive\n");
/* Initialize our quirk list. */
if (HWIF(drive)->quirkproc)
drive->quirk_list = HWIF(drive)->quirkproc(drive);
if (drive->channel->quirkproc)
drive->quirk_list = drive->channel->quirkproc(drive);
return;
......@@ -232,7 +236,7 @@ static int actual_try_to_identify (ide_drive_t *drive, byte cmd)
OUT_BYTE(0,IDE_FEATURE_REG); /* disable dma & overlap */
#if CONFIG_BLK_DEV_PDC4030
if (HWIF(drive)->chipset == ide_pdc4030) {
if (drive->channel->chipset == ide_pdc4030) {
/* DC4030 hosted drives need their own identify... */
extern int pdc4030_identify(ide_drive_t *);
if (pdc4030_identify(drive)) {
......@@ -270,7 +274,7 @@ static int try_to_identify (ide_drive_t *drive, byte cmd)
int autoprobe = 0;
unsigned long cookie = 0;
if (IDE_CONTROL_REG && !HWIF(drive)->irq) {
if (IDE_CONTROL_REG && !drive->channel->irq) {
autoprobe = 1;
cookie = probe_irq_on();
OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* enable device irq */
......@@ -284,9 +288,9 @@ static int try_to_identify (ide_drive_t *drive, byte cmd)
GET_STAT(); /* clear drive IRQ */
udelay(5);
irq = probe_irq_off(cookie);
if (!HWIF(drive)->irq) {
if (!drive->channel->irq) {
if (irq > 0)
HWIF(drive)->irq = irq;
drive->channel->irq = irq;
else /* Mmmm.. multiple IRQs.. don't know which was ours */
printk("%s: IRQ probe failed (0x%lx)\n", drive->name, cookie);
}
......@@ -314,7 +318,7 @@ static int try_to_identify (ide_drive_t *drive, byte cmd)
static int do_probe (ide_drive_t *drive, byte cmd)
{
int rc;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
if (drive->present) { /* avoid waiting for inappropriate probes */
if ((drive->type != ATA_DISK) && (cmd == WIN_IDENTIFY))
return 4;
......@@ -369,12 +373,12 @@ static int do_probe (ide_drive_t *drive, byte cmd)
/*
*
*/
static void enable_nest (ide_drive_t *drive)
static void enable_nest(ide_drive_t *drive)
{
unsigned long timeout;
printk("%s: enabling %s -- ", HWIF(drive)->name, drive->id->model);
SELECT_DRIVE(HWIF(drive), drive);
printk("%s: enabling %s -- ", drive->channel->name, drive->id->model);
SELECT_DRIVE(drive->channel, drive);
ide_delay_50ms();
OUT_BYTE(EXABYTE_ENABLE_NEST, IDE_COMMAND_REG);
timeout = jiffies + WAIT_WORSTCASE;
......@@ -427,7 +431,7 @@ static inline void probe_for_drive (ide_drive_t *drive)
* ordered sanely. We deal with the CONTROL register
* separately.
*/
static int hwif_check_regions (ide_hwif_t *hwif)
static int hwif_check_regions(struct ata_channel *hwif)
{
int region_errors = 0;
......@@ -453,20 +457,20 @@ static int hwif_check_regions (ide_hwif_t *hwif)
return(region_errors);
}
static void hwif_register (ide_hwif_t *hwif)
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])) {
......@@ -503,7 +507,7 @@ static void hwif_register (ide_hwif_t *hwif)
* This routine only knows how to look for drive units 0 and 1
* on an interface, so any setting of MAX_DRIVES > 2 won't work here.
*/
static void probe_hwif (ide_hwif_t *hwif)
static void probe_hwif(struct ata_channel *hwif)
{
unsigned int unit;
unsigned long flags;
......@@ -513,7 +517,7 @@ static void probe_hwif (ide_hwif_t *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;
......@@ -562,7 +566,7 @@ static void probe_hwif (ide_hwif_t *hwif)
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
if (drive->present) {
ide_tuneproc_t *tuneproc = HWIF(drive)->tuneproc;
ide_tuneproc_t *tuneproc = drive->channel->tuneproc;
if (tuneproc != NULL && drive->autotune == 1)
tuneproc(drive, 255); /* auto-tune PIO mode */
}
......@@ -583,7 +587,7 @@ static void ide_init_queue(ide_drive_t *drive)
/* IDE can do up to 128K per request, pdc4030 needs smaller limit */
#ifdef CONFIG_BLK_DEV_PDC4030
if (HWIF(drive)->chipset == ide_pdc4030)
if (drive->channel->chipset == ide_pdc4030)
max_sectors = 127;
#endif
blk_queue_max_sectors(q, max_sectors);
......@@ -608,9 +612,10 @@ static void ide_init_queue(ide_drive_t *drive)
*
* This routine detects and reports such situations, but does not fix them.
*/
static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
static void save_match(struct ata_channel *hwif, struct ata_channel *new,
struct ata_channel **match)
{
ide_hwif_t *m = *match;
struct ata_channel *m = *match;
if (m && m->hwgroup && m->hwgroup != new->hwgroup) {
if (!new->hwgroup)
......@@ -635,12 +640,12 @@ static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
* but anything else has led to problems on some machines. We re-enable
* interrupts as much as we can safely do in most places.
*/
static int init_irq (ide_hwif_t *hwif)
static int init_irq(struct ata_channel *hwif)
{
unsigned long flags;
unsigned int index;
ide_hwgroup_t *hwgroup, *new_hwgroup;
ide_hwif_t *match = NULL;
struct ata_channel *match = NULL;
/* Allocate the buffer and potentially sleep first */
......@@ -655,7 +660,7 @@ static int init_irq (ide_hwif_t *hwif)
* Group up with any other hwifs that share our irq(s).
*/
for (index = 0; index < MAX_HWIFS; index++) {
ide_hwif_t *h = &ide_hwifs[index];
struct ata_channel *h = &ide_hwifs[index];
if (h->hwgroup) { /* scan only initialized hwif's */
if (hwif->irq == h->irq) {
hwif->sharing_irq = h->sharing_irq = 1;
......@@ -736,7 +741,7 @@ static int init_irq (ide_hwif_t *hwif)
ide_init_queue(drive);
}
if (!hwgroup->hwif) {
hwgroup->hwif = HWIF(hwgroup->drive);
hwgroup->hwif = hwgroup->drive->channel;
#ifdef DEBUG
printk("%s : Adding missed hwif to hwgroup!!\n", hwif->name);
#endif
......@@ -770,7 +775,7 @@ static int init_irq (ide_hwif_t *hwif)
* structures needed for the routines in genhd.c. ide_geninit() gets called
* somewhat later, during the partition check.
*/
static void init_gendisk (ide_hwif_t *hwif)
static void init_gendisk(struct ata_channel *hwif)
{
struct gendisk *gd;
unsigned int unit, minors, i;
......@@ -819,11 +824,11 @@ static void init_gendisk (ide_hwif_t *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);
}
......@@ -840,7 +845,7 @@ static void init_gendisk (ide_hwif_t *hwif)
return;
}
static int hwif_init (ide_hwif_t *hwif)
static int hwif_init(struct ata_channel *hwif)
{
if (!hwif->present)
return 0;
......
......@@ -138,7 +138,7 @@ static int ide_getdigit(char c)
static int proc_ide_read_imodel
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
ide_hwif_t *hwif = data;
struct ata_channel *hwif = data;
int len;
const char *name;
......@@ -167,7 +167,7 @@ static int proc_ide_read_imodel
static int proc_ide_read_mate
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
ide_hwif_t *hwif = data;
struct ata_channel *hwif = data;
int len;
if (hwif && hwif->mate && hwif->mate->present)
......@@ -180,10 +180,10 @@ static int proc_ide_read_mate
static int proc_ide_read_channel
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
ide_hwif_t *hwif = data;
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);
......@@ -435,7 +435,7 @@ void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p)
}
}
static void create_proc_ide_drives(ide_hwif_t *hwif)
static void create_proc_ide_drives(struct ata_channel *hwif)
{
int d;
struct proc_dir_entry *ent;
......@@ -465,7 +465,7 @@ static void create_proc_ide_drives(ide_hwif_t *hwif)
}
}
static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive)
static void destroy_proc_ide_device(struct ata_channel *hwif, ide_drive_t *drive)
{
struct ata_operations *driver = drive->driver;
......@@ -479,7 +479,7 @@ static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive)
}
}
void destroy_proc_ide_drives(ide_hwif_t *hwif)
void destroy_proc_ide_drives(struct ata_channel *hwif)
{
int d;
......@@ -503,7 +503,7 @@ void create_proc_ide_interfaces(void)
int h;
for (h = 0; h < MAX_HWIFS; h++) {
ide_hwif_t *hwif = &ide_hwifs[h];
struct ata_channel *hwif = &ide_hwifs[h];
if (!hwif->present)
continue;
......@@ -522,7 +522,7 @@ static void destroy_proc_ide_interfaces(void)
int h;
for (h = 0; h < MAX_HWIFS; h++) {
ide_hwif_t *hwif = &ide_hwifs[h];
struct ata_channel *hwif = &ide_hwifs[h];
int exist = (hwif->proc != NULL);
#if 0
if (!hwif->present)
......
......@@ -2058,7 +2058,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
if (HWIF(drive)->dmaproc(ide_dma_end, drive)) {
if (drive->channel->dmaproc(ide_dma_end, drive)) {
/*
* A DMA error is sometimes expected. For example,
* if the tape is crossing a filemark during a
......@@ -2132,7 +2132,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
printk (KERN_ERR "ide-tape: The tape wants to issue more interrupts in DMA mode\n");
printk (KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n");
HWIF(drive)->dmaproc(ide_dma_off, drive);
drive->channel->dmaproc(ide_dma_off, drive);
return ide_stopped;
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
......@@ -2155,7 +2155,8 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
if (temp > pc->buffer_size) {
printk (KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n");
idetape_discard_data (drive, bcount.all);
ide_set_handler (drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
return ide_started;
}
#if IDETAPE_DEBUG_LOG
......@@ -2181,7 +2182,8 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
if (tape->debug_level >= 2)
printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes on that interrupt\n", pc->c[0], bcount.all);
#endif
ide_set_handler (drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* And set the interrupt handler again */
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* And set the interrupt handler again */
return ide_started;
}
......@@ -2255,6 +2257,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
return ide_stopped;
}
tape->cmd_start_time = jiffies;
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */
atapi_output_bytes (drive,pc->c,12); /* Send the actual packet */
return ide_started;
......@@ -2309,10 +2312,10 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
printk (KERN_WARNING "ide-tape: DMA disabled, reverting to PIO\n");
(void) HWIF(drive)->dmaproc(ide_dma_off, drive);
(void) drive->channel->dmaproc(ide_dma_off, drive);
}
if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
dma_ok = !HWIF(drive)->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
dma_ok = !drive->channel->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (IDE_CONTROL_REG)
......@@ -2324,10 +2327,11 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
#ifdef CONFIG_BLK_DEV_IDEDMA
if (dma_ok) { /* Begin DMA, if necessary */
set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
(void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
(void) drive->channel->dmaproc(ide_dma_begin, drive);
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL);
OUT_BYTE(WIN_PACKETCMD, IDE_COMMAND_REG);
return ide_started;
......@@ -3103,10 +3107,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 +3284,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);
......@@ -5997,13 +6001,13 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
tape->onstream = 1;
drive->dsc_overlap = 1;
#ifdef CONFIG_BLK_DEV_IDEPCI
if (!tape->onstream && HWIF(drive)->pci_dev != NULL) {
if (!tape->onstream && drive->channel->pci_dev != NULL) {
/*
* These two ide-pci host adapters appear to need DSC overlap disabled.
* This probably needs further analysis.
*/
if ((HWIF(drive)->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) ||
(HWIF(drive)->pci_dev->device == PCI_DEVICE_ID_TTI_HPT343)) {
if ((drive->channel->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) ||
(drive->channel->pci_dev->device == PCI_DEVICE_ID_TTI_HPT343)) {
printk(KERN_INFO "ide-tape: %s: disabling DSC overlap\n", tape->name);
drive->dsc_overlap = 0;
}
......@@ -6099,8 +6103,7 @@ static int idetape_cleanup (ide_drive_t *drive)
idetape_chrdevs[minor].drive = NULL;
restore_flags (flags); /* all CPUs (overkill?) */
/* FIXME: this appears to be totally wrong! */
ata_ops(drive)->busy = 0;
MOD_DEC_USE_COUNT;
ide_unregister_subdriver (drive);
drive->driver_data = NULL;
......@@ -6255,12 +6258,12 @@ int idetape_init (void)
idetape_chrdevs[minor].drive = drive;
tape->de_r =
devfs_register (drive->de, "mt", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor,
drive->channel->major, minor,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
tape->de_n =
devfs_register (drive->de, "mtn", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor + 128,
drive->channel->major, minor + 128,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
devfs_register_tape (tape->de_r);
......
This diff is collapsed.
This diff is collapsed.
......@@ -53,7 +53,7 @@ static int it8172_tune_chipset (ide_drive_t *drive, byte speed);
static int it8172_config_drive_for_dma (ide_drive_t *drive);
static int it8172_dmaproc(ide_dma_action_t func, ide_drive_t *drive);
#endif
void __init ide_init_it8172 (ide_hwif_t *hwif);
void __init ide_init_it8172(struct ata_channel *channel);
static void it8172_tune_drive (ide_drive_t *drive, byte pio)
......@@ -61,7 +61,7 @@ static void it8172_tune_drive (ide_drive_t *drive, byte pio)
unsigned long flags;
u16 master_data;
u32 slave_data;
int is_slave = (&HWIF(drive)->drives[1] == drive);
int is_slave = (&drive->channel->drives[1] == drive);
int master_port = 0x40;
int slave_port = 0x44;
......@@ -70,8 +70,8 @@ static void it8172_tune_drive (ide_drive_t *drive, byte pio)
else
pio = min_t(byte, pio, 4);
pci_read_config_word(HWIF(drive)->pci_dev, master_port, &master_data);
pci_read_config_dword(HWIF(drive)->pci_dev, slave_port, &slave_data);
pci_read_config_word(drive->channel->pci_dev, master_port, &master_data);
pci_read_config_dword(drive->channel->pci_dev, slave_port, &slave_data);
/*
* FIX! The DIOR/DIOW pulse width and recovery times in port 0x44
......@@ -94,7 +94,7 @@ static void it8172_tune_drive (ide_drive_t *drive, byte pio)
save_flags(flags);
cli();
pci_write_config_word(HWIF(drive)->pci_dev, master_port, master_data);
pci_write_config_word(drive->channel->pci_dev, master_port, master_data);
restore_flags(flags);
}
......@@ -133,7 +133,7 @@ static byte it8172_dma_2_pio (byte xfer_rate)
static int it8172_tune_chipset (ide_drive_t *drive, byte speed)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
int a_speed = 3 << (drive->dn * 4);
int u_flag = 1 << drive->dn;
......@@ -231,7 +231,7 @@ unsigned int __init pci_init_it8172 (struct pci_dev *dev)
}
void __init ide_init_it8172 (ide_hwif_t *hwif)
void __init ide_init_it8172(struct ata_channel *hwif)
{
struct pci_dev* dev = hwif->pci_dev;
unsigned long cmdBase, ctrlBase;
......
......@@ -69,7 +69,7 @@ static int macide_offsets[IDE_NR_PORTS] = {
IDE_HCYL, IDE_SELECT, IDE_STATUS, IDE_CONTROL
};
int macide_ack_intr(ide_hwif_t* hwif)
int macide_ack_intr(struct ata_channel *hwif)
{
if (*ide_ifr & 0x20) {
*ide_ifr &= ~0x20;
......
......@@ -28,12 +28,12 @@ static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
/*
* This routine either enables/disables (according to drive->present)
* the IRQ associated with the port (HWIF(drive)),
* the IRQ associated with the port (drive->channel),
* and selects either PIO or DMA handshaking for the next I/O operation.
*/
static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data;
struct pci_dev *dev = hwif->pci_dev;
unsigned long flags;
......@@ -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) {
......@@ -84,7 +84,7 @@ static void ns87415_selectproc (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA
static int ns87415_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
byte dma_stat;
switch (func) {
......@@ -112,7 +112,7 @@ static int ns87415_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
void __init ide_init_ns87415 (ide_hwif_t *hwif)
void __init ide_init_ns87415(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ctrl, using_inta;
......@@ -138,9 +138,9 @@ void __init ide_init_ns87415 (ide_hwif_t *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 (ide_hwif_t *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 */
......
......@@ -142,7 +142,7 @@ static void compute_pios(ide_drive_t *drive, byte pio)
*/
{
int d;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
if (pio == PIO_DONT_KNOW)
drive->drive_data = min(ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0, OPTI621_MAX_PIO);
......@@ -252,7 +252,7 @@ static void opti621_tune_drive (ide_drive_t *drive, byte pio)
pio_clocks_t first, second;
int ax, drdy;
byte cycle1, cycle2, misc;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
/* sets drive->drive_data for both drives */
compute_pios(drive, pio);
......@@ -310,7 +310,7 @@ static void opti621_tune_drive (ide_drive_t *drive, byte pio)
/*
* ide_init_opti621() is called once for each hwif found at boot.
*/
void __init ide_init_opti621 (ide_hwif_t *hwif)
void __init ide_init_opti621(struct ata_channel *hwif)
{
hwif->drives[0].drive_data = PIO_DONT_KNOW;
hwif->drives[1].drive_data = PIO_DONT_KNOW;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -111,7 +111,7 @@ static void umc_set_speeds (byte speeds[])
static void tune_umc (ide_drive_t *drive, byte pio)
{
unsigned long flags;
ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup;
ide_hwgroup_t *hwgroup = ide_hwifs[drive->channel->index ^ 1].hwgroup;
if (pio == 255)
pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
......@@ -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;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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