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

[PATCH] 2.5.7 IDE 26

- Mark all members of structures, which get jiffies assigned or involved in
   ugly timeout calculations with the prefix PADAM_  for easy spotting. This is
   Polish for "I'm falling down" or "This brings me to the knees" or slag
   comment for "What a sh..". Please be assured that it doesn't sound vulgar.

   Please grep for it to see immediately why this nomenclature is justified.

- Rename hwifs_s to ata_channel and eliminate ide_hwifs_t as well as the HWIF
   macro. OK this step makes this patch rather big.
parent e07a6a66
......@@ -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) {
......@@ -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,7 +256,7 @@ 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;
......@@ -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,7 +530,7 @@ 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 ata66 = 0;
......@@ -539,7 +539,7 @@ unsigned int __init ata66_aec62xx (ide_hwif_t *hwif)
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;
......
......@@ -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);
......
......@@ -242,7 +242,7 @@ 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;
......@@ -305,7 +305,7 @@ 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;
......@@ -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;
......@@ -632,7 +632,7 @@ 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;
......@@ -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->channel) & 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;
}
void __init ide_init_amd74xx(ide_hwif_t *hwif)
void __init ide_init_amd74xx(struct ata_channel *hwif)
{
int i;
......@@ -445,7 +445,7 @@ 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)
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;
......
......@@ -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 = (int) drive->channel->channel;
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,7 +333,7 @@ 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;
......@@ -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,7 +394,7 @@ 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;
......@@ -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,7 +430,7 @@ 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;
......@@ -498,7 +498,7 @@ 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 unit = (drive->select.b.unit & 0x01);
......@@ -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->channel) ? 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->channel) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
byte dma_reg = (drive->channel->channel) ? 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,7 +917,7 @@ 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);
struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0;
u32 stat_config = 0;
......@@ -950,7 +950,7 @@ 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);
struct ata_channel *hwif = drive->channel;
u8 addr_mask = (hwif->channel) ? 0xB0 : 0xA0;
byte reset = 0;
......@@ -1081,7 +1081,7 @@ 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;
......@@ -1090,7 +1090,7 @@ unsigned int cmd680_ata66 (ide_hwif_t *hwif)
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;
......@@ -1099,7 +1099,7 @@ unsigned int cmd64x_ata66 (ide_hwif_t *hwif)
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;
......
......@@ -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->channel==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->channel, 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->channel, 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;
......@@ -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)
......
......@@ -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;
......@@ -408,7 +408,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->channel) ? 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->channel) ? 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,7 +838,7 @@ 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;
......@@ -899,20 +899,20 @@ 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->channel) ? 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;
......@@ -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;
......@@ -1136,7 +1136,7 @@ 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;
......@@ -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,7 +1210,7 @@ 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);
......
......@@ -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,7 +436,7 @@ 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);
......@@ -473,7 +473,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 +498,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 +507,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 +530,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 +562,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 +584,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);
......
......@@ -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,7 +742,7 @@ 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) {
ide_set_handler (drive, handler, WAIT_CMD, cdrom_timer_expiry);
......@@ -899,8 +899,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))
......@@ -1476,9 +1476,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);
}
}
......@@ -2021,14 +2021,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 +2487,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 +2519,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 +2661,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 +2684,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 +2807,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 +2854,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 +2875,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
......
......@@ -51,7 +51,7 @@
#include <asm/io.h>
#ifdef CONFIG_BLK_DEV_PDC4030
#define IS_PDC4030_DRIVE (HWIF(drive)->chipset == ide_pdc4030)
#define IS_PDC4030_DRIVE (drive->channel->chipset == ide_pdc4030)
#else
#define IS_PDC4030_DRIVE (0) /* auto-NULLs out pdc4030 code */
#endif
......@@ -1018,7 +1018,7 @@ static void idedisk_setup(ide_drive_t *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;
......@@ -1036,7 +1036,7 @@ static void idedisk_setup(ide_drive_t *drive)
sprintf(drive->device.bus_id, "%d", drvid);
sprintf(drive->device.name, "ide-disk");
drive->device.driver = &idedisk_devdrv;
drive->device.parent = &HWIF(drive)->device;
drive->device.parent = &drive->channel->device;
drive->device.driver_data = drive;
device_register(&drive->device);
}
......@@ -1088,7 +1088,7 @@ static void idedisk_setup(ide_drive_t *drive)
drive->bios_cyl, drive->bios_head, drive->bios_sect);
#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");
......
......@@ -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;
......@@ -598,7 +598,7 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
} 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 +644,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;
......@@ -669,7 +669,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 */
......@@ -189,8 +189,8 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
if ((args->taskfile.command == WIN_SETFEATURES) &&
(args->taskfile.sector_number > XFER_UDMA_2) &&
(args->taskfile.feature == SETFEATURES_XFER)) {
if (!HWIF(drive)->udma_four) {
printk("%s: Speed warnings UDMA 3/4/5 is not functional.\n", HWIF(drive)->name);
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
......@@ -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 */
......@@ -1117,10 +1117,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 +1133,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 */
......@@ -2004,7 +2004,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;
......
......@@ -39,45 +39,45 @@
#ifdef CONFIG_BLK_DEV_AEC62XX
extern unsigned int pci_init_aec62xx(struct pci_dev *);
extern unsigned int ata66_aec62xx(ide_hwif_t *);
extern void ide_init_aec62xx(ide_hwif_t *);
extern void ide_dmacapable_aec62xx(ide_hwif_t *, unsigned long);
extern unsigned int ata66_aec62xx(struct ata_channel *);
extern void ide_init_aec62xx(struct ata_channel *);
extern void ide_dmacapable_aec62xx(struct ata_channel *, unsigned long);
#endif
#ifdef CONFIG_BLK_DEV_ALI15X3
extern unsigned int pci_init_ali15x3(struct pci_dev *);
extern unsigned int ata66_ali15x3(ide_hwif_t *);
extern void ide_init_ali15x3(ide_hwif_t *);
extern void ide_dmacapable_ali15x3(ide_hwif_t *, unsigned long);
extern unsigned int ata66_ali15x3(struct ata_channel *);
extern void ide_init_ali15x3(struct ata_channel *);
extern void ide_dmacapable_ali15x3(struct ata_channel *, unsigned long);
#endif
#ifdef CONFIG_BLK_DEV_AMD74XX
extern unsigned int pci_init_amd74xx(struct pci_dev *);
extern unsigned int ata66_amd74xx(ide_hwif_t *);
extern void ide_init_amd74xx(ide_hwif_t *);
extern void ide_dmacapable_amd74xx(ide_hwif_t *, unsigned long);
extern unsigned int ata66_amd74xx(struct ata_channel *);
extern void ide_init_amd74xx(struct ata_channel *);
extern void ide_dmacapable_amd74xx(struct ata_channel *, unsigned long);
#endif
#ifdef CONFIG_BLK_DEV_CMD64X
extern unsigned int pci_init_cmd64x(struct pci_dev *);
extern unsigned int ata66_cmd64x(ide_hwif_t *);
extern void ide_init_cmd64x(ide_hwif_t *);
extern void ide_dmacapable_cmd64x(ide_hwif_t *, unsigned long);
extern unsigned int ata66_cmd64x(struct ata_channel *);
extern void ide_init_cmd64x(struct ata_channel *);
extern void ide_dmacapable_cmd64x(struct ata_channel *, unsigned long);
#endif
#ifdef CONFIG_BLK_DEV_CY82C693
extern unsigned int pci_init_cy82c693(struct pci_dev *);
extern void ide_init_cy82c693(ide_hwif_t *);
extern void ide_init_cy82c693(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_CS5530
extern unsigned int pci_init_cs5530(struct pci_dev *);
extern void ide_init_cs5530(ide_hwif_t *);
extern void ide_init_cs5530(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_HPT34X
extern unsigned int pci_init_hpt34x(struct pci_dev *);
extern void ide_init_hpt34x(ide_hwif_t *);
extern void ide_init_hpt34x(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_HPT366
......@@ -85,9 +85,9 @@ extern byte hpt363_shared_irq;
extern byte hpt363_shared_pin;
extern unsigned int pci_init_hpt366(struct pci_dev *);
extern unsigned int ata66_hpt366(ide_hwif_t *);
extern void ide_init_hpt366(ide_hwif_t *);
extern void ide_dmacapable_hpt366(ide_hwif_t *, unsigned long);
extern unsigned int ata66_hpt366(struct ata_channel *);
extern void ide_init_hpt366(struct ata_channel *);
extern void ide_dmacapable_hpt366(struct ata_channel *, unsigned long);
#else
/* FIXME: those have to be killed */
static byte hpt363_shared_irq;
......@@ -95,69 +95,69 @@ static byte hpt363_shared_pin;
#endif
#ifdef CONFIG_BLK_DEV_NS87415
extern void ide_init_ns87415(ide_hwif_t *);
extern void ide_init_ns87415(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_OPTI621
extern void ide_init_opti621(ide_hwif_t *);
extern void ide_init_opti621(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_PDC_ADMA
extern unsigned int pci_init_pdcadma(struct pci_dev *);
extern unsigned int ata66_pdcadma(ide_hwif_t *);
extern void ide_init_pdcadma(ide_hwif_t *);
extern void ide_dmacapable_pdcadma(ide_hwif_t *, unsigned long);
extern unsigned int ata66_pdcadma(struct ata_channel *);
extern void ide_init_pdcadma(struct ata_channel *);
extern void ide_dmacapable_pdcadma(struct ata_channel *, unsigned long);
#endif
#ifdef CONFIG_BLK_DEV_PDC202XX
extern unsigned int pci_init_pdc202xx(struct pci_dev *);
extern unsigned int ata66_pdc202xx(ide_hwif_t *);
extern void ide_init_pdc202xx(ide_hwif_t *);
extern unsigned int ata66_pdc202xx(struct ata_channel *);
extern void ide_init_pdc202xx(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_PIIX
extern unsigned int pci_init_piix(struct pci_dev *);
extern unsigned int ata66_piix(ide_hwif_t *);
extern void ide_init_piix(ide_hwif_t *);
extern void ide_dmacapable_piix(ide_hwif_t *, unsigned long);
extern unsigned int ata66_piix(struct ata_channel *);
extern void ide_init_piix(struct ata_channel *);
extern void ide_dmacapable_piix(struct ata_channel *, unsigned long);
#endif
#ifdef CONFIG_BLK_DEV_IT8172
extern unsigned int pci_init_it8172(struct pci_dev *);
extern void ide_init_it8172(ide_hwif_t *);
extern void ide_init_it8172(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_RZ1000
extern void ide_init_rz1000(ide_hwif_t *);
extern void ide_init_rz1000(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_SVWKS
extern unsigned int pci_init_svwks(struct pci_dev *);
extern unsigned int ata66_svwks(ide_hwif_t *);
extern void ide_init_svwks(ide_hwif_t *);
extern unsigned int ata66_svwks(struct ata_channel *);
extern void ide_init_svwks(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_SIS5513
extern unsigned int pci_init_sis5513(struct pci_dev *);
extern unsigned int ata66_sis5513(ide_hwif_t *);
extern void ide_init_sis5513(ide_hwif_t *);
extern unsigned int ata66_sis5513(struct ata_channel *);
extern void ide_init_sis5513(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_SL82C105
extern unsigned int pci_init_sl82c105(struct pci_dev *);
extern void dma_init_sl82c105(ide_hwif_t *, unsigned long);
extern void ide_init_sl82c105(ide_hwif_t *);
extern void dma_init_sl82c105(struct ata_channel *, unsigned long);
extern void ide_init_sl82c105(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_TRM290
extern void ide_init_trm290(ide_hwif_t *);
extern void ide_init_trm290(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_VIA82CXXX
extern unsigned int pci_init_via82cxxx(struct pci_dev *);
extern unsigned int ata66_via82cxxx(ide_hwif_t *);
extern void ide_init_via82cxxx(ide_hwif_t *);
extern void ide_dmacapable_via82cxxx(ide_hwif_t *, unsigned long);
extern unsigned int ata66_via82cxxx(struct ata_channel *);
extern void ide_init_via82cxxx(struct ata_channel *);
extern void ide_dmacapable_via82cxxx(struct ata_channel *, unsigned long);
#endif
typedef struct ide_pci_enablebit_s {
......@@ -181,9 +181,9 @@ typedef struct ide_pci_device_s {
unsigned short vendor;
unsigned short device;
unsigned int (*init_chipset)(struct pci_dev *dev);
unsigned int (*ata66_check)(ide_hwif_t *hwif);
void (*init_hwif)(ide_hwif_t *hwif);
void (*dma_init)(ide_hwif_t *hwif, unsigned long dmabase);
unsigned int (*ata66_check)(struct ata_channel *hwif);
void (*init_hwif)(struct ata_channel *hwif);
void (*dma_init)(struct ata_channel *hwif, unsigned long dmabase);
ide_pci_enablebit_t enablebits[2];
unsigned int bootable;
unsigned int extra;
......@@ -329,10 +329,10 @@ static unsigned int __init trust_pci_irq(ide_pci_device_t *d, struct pci_dev *de
* Match a PCI IDE port against an entry in ide_hwifs[],
* based on io_base port if possible.
*/
static ide_hwif_t __init *lookup_hwif (unsigned long io_base, int bootable, const char *name)
static struct ata_channel __init *lookup_hwif (unsigned long io_base, int bootable, const char *name)
{
int h;
ide_hwif_t *hwif;
struct ata_channel *hwif;
/*
* Look for a hwif with matching io_base specified using
......@@ -431,7 +431,7 @@ static int __init setup_pci_baseregs (struct pci_dev *dev, const char *name)
/*
* Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space:
*/
static unsigned long __init get_dma_base(ide_hwif_t *hwif, int extra, const char *name)
static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, const char *name)
{
unsigned long dma_base = 0;
struct pci_dev *dev = hwif->pci_dev;
......@@ -485,11 +485,11 @@ static unsigned long __init get_dma_base(ide_hwif_t *hwif, int extra, const char
/*
* Setup DMA transfers on a channel.
*/
static void __init setup_channel_dma(ide_hwif_t *hwif, struct pci_dev *dev,
static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *dev,
ide_pci_device_t *d,
int port,
u8 class_rev,
int pciirq, ide_hwif_t **mate,
int pciirq, struct ata_channel **mate,
int autodma, unsigned short *pcicmd)
{
unsigned long dma_base;
......@@ -536,14 +536,15 @@ static int __init setup_host_channel(struct pci_dev *dev,
ide_pci_device_t *d,
int port,
u8 class_rev,
int pciirq, ide_hwif_t **mate,
int pciirq,
struct ata_channel **mate,
int autodma,
unsigned short *pcicmd)
{
unsigned long base = 0;
unsigned long ctl = 0;
ide_pci_enablebit_t *e = &(d->enablebits[port]);
ide_hwif_t *hwif;
struct ata_channel *hwif;
u8 tmp;
if (port == 1) {
......@@ -670,7 +671,7 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
int pciirq = 0;
unsigned short pcicmd = 0;
unsigned short tried_config = 0;
ide_hwif_t *mate = NULL;
struct ata_channel *mate = NULL;
unsigned int class_rev;
#ifdef CONFIG_IDEDMA_AUTO
......
......@@ -127,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;
......@@ -261,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");
......@@ -510,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;
......@@ -1097,7 +1097,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. */
......@@ -1201,7 +1201,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;
......@@ -1261,7 +1261,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->channel == 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,7 +457,7 @@ 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.
*/
......@@ -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;
......@@ -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;
......@@ -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,7 +180,7 @@ 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';
......@@ -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 */
......@@ -2309,10 +2309,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,7 +2324,7 @@ 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)) {
......@@ -5997,13 +5997,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;
}
......@@ -6255,12 +6255,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);
......
......@@ -98,8 +98,8 @@ void ata_input_data(ide_drive_t *drive, void *buffer, unsigned int wcount)
* for handling polled ide transfers
*/
if (HWIF(drive)->ideproc) {
HWIF(drive)->ideproc(ideproc_ide_input_data, drive, buffer, wcount);
if (drive->channel->ideproc) {
drive->channel->ideproc(ideproc_ide_input_data, drive, buffer, wcount);
return;
}
......@@ -138,8 +138,8 @@ void ata_output_data(ide_drive_t *drive, void *buffer, unsigned int wcount)
{
byte io_32bit;
if (HWIF(drive)->ideproc) {
HWIF(drive)->ideproc(ideproc_ide_output_data, drive, buffer, wcount);
if (drive->channel->ideproc) {
drive->channel->ideproc(ideproc_ide_output_data, drive, buffer, wcount);
return;
}
......@@ -180,8 +180,8 @@ void ata_output_data(ide_drive_t *drive, void *buffer, unsigned int wcount)
*/
void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
{
if (HWIF(drive)->ideproc) {
HWIF(drive)->ideproc(ideproc_atapi_input_bytes, drive, buffer, bytecount);
if (drive->channel->ideproc) {
drive->channel->ideproc(ideproc_atapi_input_bytes, drive, buffer, bytecount);
return;
}
......@@ -200,8 +200,8 @@ void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount
void atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
{
if (HWIF(drive)->ideproc) {
HWIF(drive)->ideproc(ideproc_atapi_output_bytes, drive, buffer, bytecount);
if (drive->channel->ideproc) {
drive->channel->ideproc(ideproc_atapi_output_bytes, drive, buffer, bytecount);
return;
}
......@@ -243,7 +243,7 @@ int drive_is_ready(ide_drive_t *drive)
{
byte stat = 0;
if (drive->waiting_for_dma)
return HWIF(drive)->dmaproc(ide_dma_test_irq, drive);
return drive->channel->dmaproc(ide_dma_test_irq, drive);
#if 0
/* need to guarantee 400ns since last command was issued */
udelay(1);
......@@ -374,7 +374,7 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive,
if (handler != task_mulout_intr && handler != bio_mulout_intr) {
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_MASK(drive->channel, drive, 0);
}
if ((id->command_set_2 & 0x0400) &&
......@@ -408,7 +408,7 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive,
return prehandler(drive, rq);
} else {
/* for dma commands we down set the handler */
if (drive->using_dma && !(HWIF(drive)->dmaproc(((taskfile->command == WIN_WRITEDMA) || (taskfile->command == WIN_WRITEDMA_EXT)) ? ide_dma_write : ide_dma_read, drive)));
if (drive->using_dma && !(drive->channel->dmaproc(((taskfile->command == WIN_WRITEDMA) || (taskfile->command == WIN_WRITEDMA_EXT)) ? ide_dma_write : ide_dma_read, drive)));
}
return ide_started;
......@@ -1047,8 +1047,8 @@ int ide_cmd_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, un
if (!err && xfer_rate) {
/* active-retuning-calls future */
if ((HWIF(drive)->speedproc) != NULL)
HWIF(drive)->speedproc(drive, xfer_rate);
if ((drive->channel->speedproc) != NULL)
drive->channel->speedproc(drive, xfer_rate);
ide_driveid_update(drive);
}
abort:
......
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;
......@@ -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;
......
......@@ -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;
......
......@@ -399,7 +399,7 @@ static int check_in_drive_lists (ide_drive_t *drive, const char **list)
static int pdc202xx_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;
unsigned int drive_conf;
......@@ -523,7 +523,7 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, byte speed)
static int pdc202xx_new_tune_chipset (ide_drive_t *drive, byte speed)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
#ifdef CONFIG_BLK_DEV_IDEDMA
unsigned long indexreg = (hwif->dma_base + 1);
unsigned long datareg = (hwif->dma_base + 3);
......@@ -703,7 +703,7 @@ static void pdc202xx_tune_drive (ide_drive_t *drive, byte pio)
static int config_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;
struct pci_dev *dev = hwif->pci_dev;
unsigned long high_16 = pci_resource_start(dev, 4);
unsigned long dma_base = hwif->dma_base;
......@@ -924,7 +924,7 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
static int config_drive_xfer_rate (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_off_quietly;
if (id && (id->capability & 1) && hwif->autodma) {
......@@ -969,7 +969,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
(void) config_chipset_for_pio(drive, 5);
}
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
int pdc202xx_quirkproc (ide_drive_t *drive)
......@@ -987,7 +987,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
byte newchip = 0;
byte clock = 0;
byte hardware48hack = 0;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
unsigned long high_16 = pci_resource_start(dev, 4);
unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x00);
......@@ -1042,7 +1042,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
return (dma_stat & 4) == 4;
sc1d = IN_BYTE(high_16 + 0x001d);
if (HWIF(drive)->channel) {
if (drive->channel->channel) {
if ((sc1d & 0x50) == 0x50) goto somebody_else;
else if ((sc1d & 0x40) == 0x40)
return (dma_stat & 4) == 4;
......@@ -1055,8 +1055,8 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
return (dma_stat & 4) == 4; /* return 1 if INTR asserted */
case ide_dma_lostirq:
case ide_dma_timeout:
if (HWIF(drive)->resetproc != NULL)
HWIF(drive)->resetproc(drive);
if (drive->channel->resetproc != NULL)
drive->channel->resetproc(drive);
default:
break;
}
......@@ -1071,12 +1071,12 @@ void pdc202xx_new_reset (ide_drive_t *drive)
OUT_BYTE(0x00,IDE_CONTROL_REG);
mdelay(1000);
printk("PDC202XX: %s channel reset.\n",
HWIF(drive)->channel ? "Secondary" : "Primary");
drive->channel->channel ? "Secondary" : "Primary");
}
void pdc202xx_reset (ide_drive_t *drive)
{
unsigned long high_16 = pci_resource_start(HWIF(drive)->pci_dev, 4);
unsigned long high_16 = pci_resource_start(drive->channel->pci_dev, 4);
byte udma_speed_flag = IN_BYTE(high_16 + 0x001f);
OUT_BYTE(udma_speed_flag | 0x10, high_16 + 0x001f);
......@@ -1084,7 +1084,7 @@ void pdc202xx_reset (ide_drive_t *drive)
OUT_BYTE(udma_speed_flag & ~0x10, high_16 + 0x001f);
mdelay(2000); /* 2 seconds ?! */
printk("PDC202XX: %s channel reset.\n",
HWIF(drive)->channel ? "Secondary" : "Primary");
drive->channel->channel ? "Secondary" : "Primary");
}
/*
......@@ -1095,7 +1095,7 @@ void pdc202xx_reset (ide_drive_t *drive)
static int pdc202xx_tristate (ide_drive_t * drive, int state)
{
#if 0
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned long high_16 = pci_resource_start(hwif->pci_dev, 4);
byte sc1f = inb(high_16 + 0x001f);
......@@ -1216,7 +1216,7 @@ unsigned int __init pci_init_pdc202xx(struct pci_dev *dev)
return dev->irq;
}
unsigned int __init ata66_pdc202xx (ide_hwif_t *hwif)
unsigned int __init ata66_pdc202xx(struct ata_channel *hwif)
{
unsigned short mask = (hwif->channel) ? (1<<11) : (1<<10);
unsigned short CIS;
......@@ -1235,7 +1235,7 @@ unsigned int __init ata66_pdc202xx (ide_hwif_t *hwif)
}
}
void __init ide_init_pdc202xx (ide_hwif_t *hwif)
void __init ide_init_pdc202xx(struct ata_channel *hwif)
{
hwif->tuneproc = &pdc202xx_tune_drive;
hwif->quirkproc = &pdc202xx_quirkproc;
......
......@@ -99,7 +99,7 @@ static void promise_selectproc (ide_drive_t *drive)
{
unsigned int number;
number = (HWIF(drive)->channel << 1) + drive->select.b.unit;
number = (drive->channel->channel << 1) + drive->select.b.unit;
OUT_BYTE(number,IDE_FEATURE_REG);
}
......@@ -155,10 +155,10 @@ void __init init_pdc4030 (void)
* setup_pdc4030()
* Completes the setup of a Promise DC4030 controller card, once found.
*/
int __init setup_pdc4030 (ide_hwif_t *hwif)
int __init setup_pdc4030(struct ata_channel *hwif)
{
ide_drive_t *drive;
ide_hwif_t *hwif2;
struct ata_channel *hwif2;
struct dc_ident ident;
int i;
ide_startstop_t startstop;
......@@ -232,7 +232,7 @@ int __init setup_pdc4030 (ide_hwif_t *hwif)
/* Shift the remaining interfaces down by one */
for (i=MAX_HWIFS-1 ; i > hwif->index+1 ; i--) {
ide_hwif_t *h = &ide_hwifs[i];
struct ata_channel *h = &ide_hwifs[i];
#ifdef DEBUG
printk(KERN_DEBUG "Shifting i/f %d values to i/f %d\n",i-1,i);
......@@ -263,7 +263,7 @@ int __init setup_pdc4030 (ide_hwif_t *hwif)
* Tests for the presence of a DC4030 Promise card on this interface
* Returns: 1 if found, 0 if not found
*/
int __init detect_pdc4030(ide_hwif_t *hwif)
int __init detect_pdc4030(struct ata_channel *hwif)
{
ide_drive_t *drive = &hwif->drives[0];
......@@ -288,7 +288,7 @@ int __init detect_pdc4030(ide_hwif_t *hwif)
void __init ide_probe_for_pdc4030(void)
{
unsigned int index;
ide_hwif_t *hwif;
struct ata_channel *hwif;
if (enable_promise_support == 0)
return;
......@@ -556,7 +556,7 @@ ide_startstop_t do_pdc4030_io (ide_drive_t *drive, ide_task_t *task)
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
SELECT_MASK(HWIF(drive), drive, 0);
SELECT_MASK(drive->channel, drive, 0);
OUT_BYTE(taskfile->feature, IDE_FEATURE_REG);
OUT_BYTE(taskfile->sector_count, IDE_NSECTOR_REG);
......
......@@ -82,12 +82,12 @@ unsigned int __init pci_init_pdcadma(struct pci_dev *dev)
return 0;
}
unsigned int __init ata66_pdcadma (ide_hwif_t *hwif)
unsigned int __init ata66_pdcadma(struct ata_channel *channel)
{
return 1;
}
void __init ide_init_pdcadma (ide_hwif_t *hwif)
void __init ide_init_pdcadma(struct ata_channel *hwif)
{
hwif->autodma = 0;
hwif->dma_base = 0;
......@@ -101,7 +101,7 @@ void __init ide_init_pdcadma (ide_hwif_t *hwif)
// }
}
void __init ide_dmacapable_pdcadma (ide_hwif_t *hwif, unsigned long dmabase)
void __init ide_dmacapable_pdcadma(struct ata_channel *hwif, unsigned long dmabase)
{
// ide_setup_dma(hwif, dmabase, 8);
}
......
......@@ -316,7 +316,7 @@ static void piix_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_tim
static int piix_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 err, T, UT, umul;
......@@ -341,7 +341,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
ata_timing_merge(&p, &t, &t, IDE_TIMING_ALL);
}
piix_set_speed(HWIF(drive)->pci_dev, drive->dn, &t, umul);
piix_set_speed(drive->channel->pci_dev, drive->dn, &t, umul);
if (!drive->init_speed)
drive->init_speed = speed;
......@@ -357,7 +357,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
static void piix_tune_drive(ide_drive_t *drive, unsigned char pio)
{
if (!((piix_enabled >> HWIF(drive)->channel) & 1))
if (!((piix_enabled >> drive->channel->channel) & 1))
return;
if (pio == 255) {
......@@ -381,7 +381,7 @@ int piix_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 |
......@@ -392,7 +392,7 @@ int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
piix_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;
}
......@@ -533,12 +533,12 @@ unsigned int __init pci_init_piix(struct pci_dev *dev, const char *name)
return 0;
}
unsigned int __init ata66_piix(ide_hwif_t *hwif)
unsigned int __init ata66_piix(struct ata_channel *hwif)
{
return ((piix_enabled & piix_80w) >> hwif->channel) & 1;
}
void __init ide_init_piix(ide_hwif_t *hwif)
void __init ide_init_piix(struct ata_channel *hwif)
{
int i;
......@@ -570,7 +570,7 @@ void __init ide_init_piix(ide_hwif_t *hwif)
* and only if DMA is safe with the chip and bridge.
*/
void __init ide_dmacapable_piix(ide_hwif_t *hwif, unsigned long dmabase)
void __init ide_dmacapable_piix(struct ata_channel *hwif, unsigned long dmabase)
{
if (((piix_enabled >> hwif->channel) & 1)
&& !(piix_config->flags & PIIX_NODMA))
......
......@@ -129,7 +129,7 @@ static void qd_select (ide_drive_t *drive)
* upper nibble represents recovery time, in count of VLB clocks
*/
static byte qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery_time)
static byte qd6500_compute_timing(struct ata_channel *hwif, int active_time, int recovery_time)
{
byte active_cycle,recovery_cycle;
......@@ -208,7 +208,7 @@ static int qd_timing_ok (ide_drive_t drives[])
static void qd_set_timing (ide_drive_t *drive, byte timing)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
drive->drive_data &= 0xff00;
drive->drive_data |= timing;
......@@ -240,7 +240,7 @@ static void qd6500_tune_drive (ide_drive_t *drive, byte pio)
recovery_time = drive->id->eide_pio - 120;
}
qd_set_timing(drive,qd6500_compute_timing(HWIF(drive),active_time,recovery_time));
qd_set_timing(drive,qd6500_compute_timing(drive->channel, active_time,recovery_time));
}
/*
......@@ -250,7 +250,7 @@ static void qd6500_tune_drive (ide_drive_t *drive, byte pio)
static void qd6580_tune_drive (ide_drive_t *drive, byte pio)
{
struct ata_timing *t;
int base = HWIF(drive)->select_data;
int base = drive->channel->select_data;
int active_time = 175;
int recovery_time = 415; /* worst case values from the dos driver */
......@@ -291,9 +291,9 @@ static void qd6580_tune_drive (ide_drive_t *drive, byte pio)
printk(KERN_INFO "%s: PIO mode%d\n", drive->name, pio - XFER_PIO_0);
}
if (!HWIF(drive)->channel && drive->type != ATA_DISK) {
if (!drive->channel->channel && drive->type != ATA_DISK) {
qd_write_reg(0x5f,QD_CONTROL_PORT);
printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO and post-write buffer on %s.\n",drive->name,HWIF(drive)->name);
printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO and post-write buffer on %s.\n",drive->name, drive->channel->name);
}
qd_set_timing(drive,qd6580_compute_timing(active_time,recovery_time));
......@@ -348,7 +348,7 @@ int __init probe (int base)
index = ! (config & QD_CONFIG_IDE_BASEPORT);
if ((config & 0xf0) == QD_CONFIG_QD6500) {
ide_hwif_t *hwif = &ide_hwifs[index];
struct ata_channel *hwif = &ide_hwifs[index];
if (qd_testreg(base)) return 1; /* bad register */
......@@ -392,7 +392,7 @@ int __init probe (int base)
config, control, QD_ID3);
if (control & QD_CONTR_SEC_DISABLED) {
ide_hwif_t *hwif = &ide_hwifs[index];
struct ata_channel *hwif = &ide_hwifs[index];
/* secondary disabled */
printk(KERN_INFO "%s: qd6580: single IDE board\n",
......
......@@ -28,7 +28,7 @@
#ifdef CONFIG_BLK_DEV_IDEPCI
void __init ide_init_rz1000 (ide_hwif_t *hwif) /* called from ide-pci.c */
void __init ide_init_rz1000(struct ata_channel *hwif) /* called from ide-pci.c */
{
unsigned short reg;
struct pci_dev *dev = hwif->pci_dev;
......@@ -62,7 +62,7 @@ static void __init init_rz1000 (struct pci_dev *dev, const char *name)
printk("IDE: disabled chipset read-ahead (buggy %s)\n", name);
} else {
for (h = 0; h < MAX_HWIFS; ++h) {
ide_hwif_t *hwif = &ide_hwifs[h];
struct ata_channel *hwif = &ide_hwifs[h];
if ((hwif->io_ports[IDE_DATA_OFFSET] == 0x1f0 || hwif->io_ports[IDE_DATA_OFFSET] == 0x170)
&& (hwif->chipset == ide_unknown || hwif->chipset == ide_generic))
{
......
......@@ -243,7 +243,7 @@ static int svwks_tune_chipset (ide_drive_t *drive, byte speed)
byte dma_modes[] = { 0x77, 0x21, 0x20 };
byte pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
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 csb5 = (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ? 1 : 0;
......@@ -413,7 +413,7 @@ static void svwks_tune_drive (ide_drive_t *drive, byte pio)
static int config_chipset_for_dma (ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;
struct pci_dev *dev = HWIF(drive)->pci_dev;
struct pci_dev *dev = drive->channel->pci_dev;
byte udma_66 = eighty_ninty_three(drive);
int ultra66 = (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ? 1 : 0;
int ultra100 = (ultra66 && svwks_revision >= SVWKS_CSB5_REVISION_NEW) ? 1 : 0;
......@@ -436,7 +436,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;
......@@ -477,7 +477,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
no_dma_set:
config_chipset_for_pio(drive);
}
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
......@@ -487,7 +487,7 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
return config_drive_xfer_rate(drive);
case ide_dma_end:
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
if(inb(dma_base+0x02)&1)
......@@ -584,7 +584,7 @@ unsigned int __init pci_init_svwks(struct pci_dev *dev)
* Bit 14 clear = primary IDE channel does not have 80-pin cable.
* Bit 14 set = primary IDE channel has 80-pin cable.
*/
static unsigned int __init ata66_svwks_dell (ide_hwif_t *hwif)
static unsigned int __init ata66_svwks_dell(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
......@@ -601,7 +601,7 @@ static unsigned int __init ata66_svwks_dell (ide_hwif_t *hwif)
*
* WARNING: this only works on Alpine hardware!
*/
static unsigned int __init ata66_svwks_cobalt (ide_hwif_t *hwif)
static unsigned int __init ata66_svwks_cobalt(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN &&
......@@ -612,7 +612,7 @@ static unsigned int __init ata66_svwks_cobalt (ide_hwif_t *hwif)
return 0;
}
unsigned int __init ata66_svwks (ide_hwif_t *hwif)
unsigned int __init ata66_svwks(struct ata_channel *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
......@@ -627,7 +627,7 @@ unsigned int __init ata66_svwks (ide_hwif_t *hwif)
return 0;
}
void __init ide_init_svwks (ide_hwif_t *hwif)
void __init ide_init_svwks(struct ata_channel *hwif)
{
if (!hwif->irq)
hwif->irq = hwif->channel ? 15 : 14;
......
......@@ -434,7 +434,7 @@ extern char *ide_xfer_verbose (byte xfer_rate);
/* Enables per-drive prefetch and postwrite */
static void config_drive_art_rwp (ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
byte reg4bh = 0;
......@@ -460,7 +460,7 @@ static void config_drive_art_rwp (ide_drive_t *drive)
/* Set per-drive active and recovery time */
static void config_art_rwp_pio (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;
byte timing, drive_pci, test1, test2;
......@@ -560,7 +560,7 @@ static int config_chipset_for_pio (ide_drive_t *drive, byte pio)
static int sis5513_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 drive_pci, reg;
......@@ -640,12 +640,12 @@ static void sis5513_tune_drive (ide_drive_t *drive, byte pio)
#ifdef CONFIG_BLK_DEV_IDEDMA
/*
* ((id->hw_config & 0x4000|0x2000) && (HWIF(drive)->udma_four))
* ((id->hw_config & 0x4000|0x2000) && (drive->channel->udma_four))
*/
static int config_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 speed = 0;
......@@ -700,7 +700,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_off_quietly;
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;
......@@ -740,7 +740,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
(void) config_chipset_for_pio(drive, 5);
}
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
/* initiates/aborts (U)DMA read/write operations on a drive. */
......@@ -841,7 +841,7 @@ unsigned int __init pci_init_sis5513(struct pci_dev *dev)
return 0;
}
unsigned int __init ata66_sis5513 (ide_hwif_t *hwif)
unsigned int __init ata66_sis5513(struct ata_channel *hwif)
{
byte reg48h = 0, ata66 = 0;
byte mask = hwif->channel ? 0x20 : 0x10;
......@@ -853,7 +853,7 @@ unsigned int __init ata66_sis5513 (ide_hwif_t *hwif)
return ata66;
}
void __init ide_init_sis5513 (ide_hwif_t *hwif)
void __init ide_init_sis5513(struct ata_channel *hwif)
{
hwif->irq = hwif->channel ? 15 : 14;
......
......@@ -57,7 +57,7 @@ static unsigned int get_timing_sl82c105(struct ata_timing *t)
*/
static void config_for_pio(ide_drive_t *drive, int pio, int report)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
struct ata_timing *t;
unsigned short drv_ctrl = 0x909;
......@@ -95,7 +95,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report)
*/
static int config_for_dma(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
unsigned short drv_ctrl = 0x909;
unsigned int reg;
......@@ -120,7 +120,7 @@ static int sl82c105_check_drive(ide_drive_t *drive)
do {
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
if (!hwif->autodma)
break;
......@@ -146,7 +146,7 @@ static int sl82c105_check_drive(ide_drive_t *drive)
}
} while (0);
return HWIF(drive)->dmaproc(dma_func, drive);
return drive->channel->dmaproc(dma_func, drive);
}
/*
......@@ -232,7 +232,7 @@ unsigned int __init pci_init_sl82c105(struct pci_dev *dev)
return dev->irq;
}
void __init dma_init_sl82c105(ide_hwif_t *hwif, unsigned long dma_base)
void __init dma_init_sl82c105(struct ata_channel *hwif, unsigned long dma_base)
{
unsigned int rev;
byte dma_state;
......@@ -261,7 +261,7 @@ void __init dma_init_sl82c105(ide_hwif_t *hwif, unsigned long dma_base)
/*
* Initialise the chip
*/
void __init ide_init_sl82c105(ide_hwif_t *hwif)
void __init ide_init_sl82c105(struct ata_channel *hwif)
{
hwif->tuneproc = tune_sl82c105;
}
......
......@@ -141,7 +141,7 @@
static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned int reg;
unsigned long flags;
......@@ -175,7 +175,7 @@ static void trm290_selectproc (ide_drive_t *drive)
#ifdef CONFIG_BLK_DEV_IDEDMA
static int trm290_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct ata_channel *hwif = drive->channel;
unsigned int count, reading = 2, writing = 0;
switch (func) {
......@@ -216,7 +216,7 @@ static int trm290_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
/*
* Invoked from ide-dma.c at boot time.
*/
void __init ide_init_trm290 (ide_hwif_t *hwif)
void __init ide_init_trm290(struct ata_channel *hwif)
{
unsigned int cfgbase = 0;
unsigned long flags;
......
......@@ -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;
......
......@@ -302,7 +302,7 @@ static void via_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_timi
static int via_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;
unsigned int T, UT;
......@@ -328,7 +328,7 @@ static int via_set_drive(ide_drive_t *drive, unsigned char speed)
ata_timing_merge(&p, &t, &t, IDE_TIMING_8BIT);
}
via_set_speed(HWIF(drive)->pci_dev, drive->dn, &t);
via_set_speed(drive->channel->pci_dev, drive->dn, &t);
if (!drive->init_speed)
drive->init_speed = speed;
......@@ -344,7 +344,7 @@ static int via_set_drive(ide_drive_t *drive, unsigned char speed)
static void via82cxxx_tune_drive(ide_drive_t *drive, unsigned char pio)
{
if (!((via_enabled >> HWIF(drive)->channel) & 1))
if (!((via_enabled >> drive->channel->channel) & 1))
return;
if (pio == 255) {
......@@ -368,7 +368,7 @@ int via82cxxx_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_SWDMA | XFER_MWDMA |
......@@ -379,7 +379,7 @@ int via82cxxx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
via_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;
}
......@@ -523,12 +523,12 @@ unsigned int __init pci_init_via82cxxx(struct pci_dev *dev)
return 0;
}
unsigned int __init ata66_via82cxxx(ide_hwif_t *hwif)
unsigned int __init ata66_via82cxxx(struct ata_channel *hwif)
{
return ((via_enabled & via_80w) >> hwif->channel) & 1;
}
void __init ide_init_via82cxxx(ide_hwif_t *hwif)
void __init ide_init_via82cxxx(struct ata_channel *hwif)
{
int i;
......@@ -559,7 +559,7 @@ void __init ide_init_via82cxxx(ide_hwif_t *hwif)
* We allow the BM-DMA driver to only work on enabled interfaces.
*/
void __init ide_dmacapable_via82cxxx(ide_hwif_t *hwif, unsigned long dmabase)
void __init ide_dmacapable_via82cxxx(struct ata_channel *hwif, unsigned long dmabase)
{
if ((via_enabled >> hwif->channel) & 1)
ide_setup_dma(hwif, dmabase, 8);
......
......@@ -331,7 +331,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
printk ("ide-scsi: %s: DMA complete\n", drive->name);
#endif /* IDESCSI_DEBUG_LOG */
pc->actually_transferred=pc->request_transfer;
(void) (HWIF(drive)->dmaproc(ide_dma_end, drive));
(void) drive->channel->dmaproc(ide_dma_end, drive);
}
status = GET_STAT(); /* Clear the interrupt */
......@@ -434,9 +434,9 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
bcount = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
if (drive->using_dma && rq->bio)
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);
SELECT_DRIVE(HWIF(drive), drive);
SELECT_DRIVE(drive->channel, drive);
if (IDE_CONTROL_REG)
OUT_BYTE (drive->ctl,IDE_CONTROL_REG);
OUT_BYTE (dma_ok,IDE_FEATURE_REG);
......@@ -444,8 +444,8 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
OUT_BYTE (bcount & 0xff,IDE_BCOUNTL_REG);
if (dma_ok) {
set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
(void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
(void) drive->channel->dmaproc(ide_dma_begin, drive);
}
if (test_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
ide_set_handler (drive, &idescsi_transfer_pc, get_timeout(pc), NULL);
......
......@@ -69,7 +69,7 @@ typedef unsigned char byte; /* used everywhere */
#define DMA_PIO_RETRY 1 /* retrying in PIO */
#define HWIF(drive) ((drive)->channel)
#define HWGROUP(drive) (HWIF(drive)->hwgroup)
#define HWGROUP(drive) (drive->channel->hwgroup)
/*
* Definitions for accessing IDE controller registers
......@@ -90,16 +90,16 @@ typedef unsigned char byte; /* used everywhere */
#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET])
#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET])
#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET])
#define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_OFFSET])
#define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET])
#define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_OFFSET])
#define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET])
#define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_OFFSET])
#define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET])
#define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET])
#define IDE_DATA_REG (drive->channel->io_ports[IDE_DATA_OFFSET])
#define IDE_ERROR_REG (drive->channel->io_ports[IDE_ERROR_OFFSET])
#define IDE_NSECTOR_REG (drive->channel->io_ports[IDE_NSECTOR_OFFSET])
#define IDE_SECTOR_REG (drive->channel->io_ports[IDE_SECTOR_OFFSET])
#define IDE_LCYL_REG (drive->channel->io_ports[IDE_LCYL_OFFSET])
#define IDE_HCYL_REG (drive->channel->io_ports[IDE_HCYL_OFFSET])
#define IDE_SELECT_REG (drive->channel->io_ports[IDE_SELECT_OFFSET])
#define IDE_STATUS_REG (drive->channel->io_ports[IDE_STATUS_OFFSET])
#define IDE_CONTROL_REG (drive->channel->io_ports[IDE_CONTROL_OFFSET])
#define IDE_IRQ_REG (drive->channel->io_ports[IDE_IRQ_OFFSET])
#define IDE_FEATURE_REG IDE_ERROR_REG
#define IDE_COMMAND_REG IDE_STATUS_REG
......@@ -170,8 +170,8 @@ typedef unsigned char byte; /* used everywhere */
/*
* Check for an interrupt and acknowledge the interrupt status
*/
struct hwif_s;
typedef int (ide_ack_intr_t)(struct hwif_s *);
struct ata_channel;
typedef int (ide_ack_intr_t)(struct ata_channel *);
#ifndef NO_DMA
# define NO_DMA 255
......@@ -269,7 +269,7 @@ typedef union {
struct ide_settings_s;
typedef struct ide_drive_s {
struct hwif_s *channel; /* parent pointer to the channel we are attached to */
struct ata_channel *channel; /* parent pointer to the channel we are attached to */
unsigned int usage; /* current "open()" count for drive */
char type; /* distingiush different devices: disk, cdrom, tape, floppy, ... */
......@@ -281,10 +281,16 @@ typedef struct ide_drive_s {
request_queue_t queue; /* per device request queue */
struct ide_drive_s *next; /* circular list of hwgroup drives */
unsigned long sleep; /* sleep until this time */
unsigned long service_start; /* time we started last request */
unsigned long service_time; /* service time of last request */
unsigned long timeout; /* max time to wait for irq */
/* Those are directly injected jiffie values. They should go away and
* we should use generic timers instead!!!
*/
unsigned long PADAM_sleep; /* sleep until this time */
unsigned long PADAM_service_start; /* time we started last request */
unsigned long PADAM_service_time; /* service time of last request */
unsigned long PADAM_timeout; /* max time to wait for irq */
special_t special; /* special action flags */
byte keep_settings; /* restore settings after drive reset */
byte using_dma; /* disk is using dma for read/write */
......@@ -433,8 +439,8 @@ typedef void (ide_rw_proc_t) (ide_drive_t *, ide_dma_action_t);
*/
typedef int (ide_busproc_t) (ide_drive_t *, int);
typedef struct hwif_s {
struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
struct ata_channel {
struct ata_channel *next; /* for linked-list in ide_hwgroup_t */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
hw_regs_t hw; /* Hardware info */
......@@ -455,7 +461,7 @@ typedef struct hwif_s {
struct scatterlist *sg_table; /* Scatter-gather list used to build the above */
int sg_nents; /* Current number of entries in it */
int sg_dma_direction; /* dma transfer direction */
struct hwif_s *mate; /* other hwif from same PCI chip */
struct ata_channel *mate; /* other hwif from same PCI chip */
unsigned long dma_base; /* base addr for dma ports */
unsigned dma_extra; /* extra addr for dma ports */
unsigned long config_data; /* for use by chipset-specific code */
......@@ -485,13 +491,13 @@ typedef struct hwif_s {
ide_busproc_t *busproc; /* driver soft-power interface */
byte bus_state; /* power state of the IDE bus */
struct device device; /* global device tree handle */
} ide_hwif_t;
};
/*
* Register new hardware with ide
*/
extern int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp);
extern void ide_unregister(ide_hwif_t *hwif);
extern int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp);
extern void ide_unregister(struct ata_channel *hwif);
/*
* Status returned from various ide_ functions
......@@ -521,7 +527,7 @@ typedef struct hwgroup_s {
ide_handler_t *handler;/* irq handler, if active */
unsigned long flags; /* BUSY, SLEEPING */
ide_drive_t *drive; /* current drive */
ide_hwif_t *hwif; /* ptr to current hwif in linked-list */
struct ata_channel *hwif; /* ptr to current hwif in linked-list */
struct request *rq; /* current request */
struct timer_list timer; /* failsafe timer */
struct request wrq; /* local copy of current write rq */
......@@ -580,7 +586,7 @@ typedef struct {
#ifdef CONFIG_PROC_FS
void proc_ide_create(void);
void proc_ide_destroy(void);
void destroy_proc_ide_drives(ide_hwif_t *);
void destroy_proc_ide_drives(struct ata_channel *);
void create_proc_ide_interfaces(void);
void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data);
void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p);
......@@ -655,15 +661,7 @@ extern int register_ata_driver(unsigned int type, struct ata_operations *driver)
#define ata_ops(drive) ((drive)->driver)
/*
* ide_hwifs[] is the master data structure used to keep track
* of just about everything in ide.c. Whenever possible, routines
* should be using pointers to a drive (ide_drive_t *) or
* pointers to a hwif (ide_hwif_t *), rather than indexing this
* structure directly (the allocation/layout may change!).
*
*/
extern struct hwif_s ide_hwifs[]; /* master data repository */
extern struct ata_channel ide_hwifs[]; /* master data repository */
extern int noautodma;
/*
......@@ -892,8 +890,9 @@ void ide_destroy_dmatable (ide_drive_t *drive);
ide_startstop_t ide_dma_intr (ide_drive_t *drive);
int check_drive_lists (ide_drive_t *drive, int good_bad);
int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive);
extern void ide_release_dma(ide_hwif_t *hwif);
void ide_setup_dma (ide_hwif_t *hwif, unsigned long dmabase, unsigned int num_ports) __init;
extern void ide_release_dma(struct ata_channel *hwif);
extern void ide_setup_dma(struct ata_channel *hwif,
unsigned long dmabase, unsigned int num_ports) __init;
#endif
extern spinlock_t ide_lock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment