Commit f31c3386 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (67 commits)
  ide: remove redundant DMA blacklist check from __ide_dma_on()
  ide: cleanup ide_set_dma()
  ide: remove redundant ->ide_dma_on call from set_using_dma()
  sc1200: move DMA timings to timing tables
  ide: add IDE_HFLAG_ABUSE_SET_DMA_MODE host flag
  sis5513: factor out UDMA programming code
  pdc202xx_new: move PIO programming code to pdcnew_set_pio_mode()
  ide: make 'extra' field in struct ide_port_info u8
  ide: kill duplicate code in ide_dump_{ata,atapi}_status()
  ide-disk: use ide_get_lba_addr()
  ide: printk fix
  ide: add ide_tf_read() helper
  ide: fix registers loading order in ide_dump_ata_status()
  ide-disk: use do_rw_taskfile() (take 2)
  ide-disk: add ide_tf_set_cmd() helper
  ide-disk: extend timeout for PIO-in commands
  ide: remove 'handler' field from ide_task_t (take 2)
  ide: use ->data_phase to set ->handler in do_rw_taskfile()
  ide: convert do_rw_taskfile() to use ->data_phase
  ide: merge flagged_taskfile() into do_rw_taskfile()
  ...
parents 0008bf54 61a368c2
...@@ -374,17 +374,6 @@ comment "PCI IDE chipsets support" ...@@ -374,17 +374,6 @@ comment "PCI IDE chipsets support"
config BLK_DEV_IDEPCI config BLK_DEV_IDEPCI
bool bool
config IDEPCI_SHARE_IRQ
bool "Sharing PCI IDE interrupts support"
depends on BLK_DEV_IDEPCI
help
Some ATA/IDE chipsets have hardware support which allows for
sharing a single IRQ with other cards. To enable support for
this in the ATA/IDE driver, say Y here.
It is safe to say Y to this question, in most cases.
If unsure, say N.
config IDEPCI_PCIBUS_ORDER config IDEPCI_PCIBUS_ORDER
def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI
...@@ -707,7 +696,6 @@ config BLK_DEV_SVWKS ...@@ -707,7 +696,6 @@ config BLK_DEV_SVWKS
config BLK_DEV_SGIIOC4 config BLK_DEV_SGIIOC4
tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support" tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support"
depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4 depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4
select IDEPCI_SHARE_IRQ
select BLK_DEV_IDEDMA_PCI select BLK_DEV_IDEDMA_PCI
help help
This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4
......
...@@ -272,8 +272,6 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode) ...@@ -272,8 +272,6 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode)
case XFER_SW_DMA_0: case XFER_SW_DMA_0:
cycle_time = 480; cycle_time = 480;
break; break;
default:
return;
} }
/* /*
......
...@@ -747,8 +747,6 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -747,8 +747,6 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
strobe = ATA_DMA2_STROBE; strobe = ATA_DMA2_STROBE;
hold = ATA_DMA2_HOLD; hold = ATA_DMA2_HOLD;
break; break;
default:
return;
} }
if (speed >= XFER_UDMA_0) if (speed >= XFER_UDMA_0)
......
...@@ -383,27 +383,19 @@ static int taskfile_load_raw(ide_drive_t *drive, ...@@ -383,27 +383,19 @@ static int taskfile_load_raw(ide_drive_t *drive,
gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]); gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]);
memset(&args, 0, sizeof(ide_task_t)); memset(&args, 0, sizeof(ide_task_t));
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.data_phase = TASKFILE_NO_DATA;
args.handler = &task_no_data_intr;
/* convert gtf to IDE Taskfile */ /* convert gtf to IDE Taskfile */
args.tfRegister[1] = gtf->tfa[0]; /* 0x1f1 */ memcpy(&args.tf_array[7], &gtf->tfa, 7);
args.tfRegister[2] = gtf->tfa[1]; /* 0x1f2 */ args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
args.tfRegister[3] = gtf->tfa[2]; /* 0x1f3 */
args.tfRegister[4] = gtf->tfa[3]; /* 0x1f4 */
args.tfRegister[5] = gtf->tfa[4]; /* 0x1f5 */
args.tfRegister[6] = gtf->tfa[5]; /* 0x1f6 */
args.tfRegister[7] = gtf->tfa[6]; /* 0x1f7 */
if (ide_noacpitfs) { if (ide_noacpitfs) {
DEBPRINT("_GTF execution disabled\n"); DEBPRINT("_GTF execution disabled\n");
return err; return err;
} }
err = ide_raw_taskfile(drive, &args, NULL); err = ide_no_data_taskfile(drive, &args);
if (err) if (err)
printk(KERN_ERR "%s: ide_raw_taskfile failed: %u\n", printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n",
__FUNCTION__, err); __FUNCTION__, err);
return err; return err;
......
...@@ -917,19 +917,13 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, ...@@ -917,19 +917,13 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
if (ide_wait_stat(&startstop, drive, 0, BUSY_STAT, WAIT_READY)) if (ide_wait_stat(&startstop, drive, 0, BUSY_STAT, WAIT_READY))
return startstop; return startstop;
/* FIXME: for Virtual DMA we must check harder */
if (info->dma) if (info->dma)
info->dma = !hwif->dma_setup(drive); info->dma = !hwif->dma_setup(drive);
/* Set up the controller registers. */ /* Set up the controller registers. */
/* FIXME: for Virtual DMA we must check harder */ ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL |
HWIF(drive)->OUTB(info->dma, IDE_FEATURE_REG); IDE_TFLAG_NO_SELECT_MASK, xferlen, info->dma);
HWIF(drive)->OUTB(0, IDE_IREASON_REG);
HWIF(drive)->OUTB(0, IDE_SECTOR_REG);
HWIF(drive)->OUTB(xferlen & 0xff, IDE_BCOUNTL_REG);
HWIF(drive)->OUTB(xferlen >> 8 , IDE_BCOUNTH_REG);
if (IDE_CONTROL_REG)
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
/* waiting for CDB interrupt, not DMA yet. */ /* waiting for CDB interrupt, not DMA yet. */
......
This diff is collapsed.
...@@ -491,10 +491,6 @@ EXPORT_SYMBOL(ide_dma_host_on); ...@@ -491,10 +491,6 @@ EXPORT_SYMBOL(ide_dma_host_on);
int __ide_dma_on (ide_drive_t *drive) int __ide_dma_on (ide_drive_t *drive)
{ {
/* consult the list of known "bad" drives */
if (__ide_dma_bad_drive(drive))
return 1;
drive->using_dma = 1; drive->using_dma = 1;
ide_toggle_bounce(drive, 1); ide_toggle_bounce(drive, 1);
...@@ -827,22 +823,19 @@ int ide_set_dma(ide_drive_t *drive) ...@@ -827,22 +823,19 @@ int ide_set_dma(ide_drive_t *drive)
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
int rc; int rc;
rc = ide_dma_check(drive); /*
* Force DMAing for the beginning of the check.
switch(rc) { * Some chipsets appear to do interesting
case -1: /* DMA needs to be disabled */ * things, if not checked and cleared.
* PARANOIA!!!
*/
hwif->dma_off_quietly(drive); hwif->dma_off_quietly(drive);
return -1;
case 0: /* DMA needs to be enabled */
return hwif->ide_dma_on(drive);
case 1: /* DMA setting cannot be changed */
break;
default:
BUG();
break;
}
rc = ide_dma_check(drive);
if (rc)
return rc; return rc;
return hwif->ide_dma_on(drive);
} }
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
...@@ -968,11 +961,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports) ...@@ -968,11 +961,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
hwif->dma_base = base; hwif->dma_base = base;
if (hwif->mate)
hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base;
else
hwif->dma_master = base;
if (!(hwif->dma_command)) if (!(hwif->dma_command))
hwif->dma_command = hwif->dma_base; hwif->dma_command = hwif->dma_base;
if (!(hwif->dma_vendor1)) if (!(hwif->dma_vendor1))
...@@ -1014,8 +1002,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports) ...@@ -1014,8 +1002,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
hwif->drives[1].name, (dma_stat & 0x40) ? "DMA" : "pio"); hwif->drives[1].name, (dma_stat & 0x40) ? "DMA" : "pio");
} }
printk("\n"); printk("\n");
BUG_ON(!hwif->dma_master);
} }
EXPORT_SYMBOL_GPL(ide_setup_dma); EXPORT_SYMBOL_GPL(ide_setup_dma);
......
...@@ -369,27 +369,6 @@ typedef struct ide_floppy_obj { ...@@ -369,27 +369,6 @@ typedef struct ide_floppy_obj {
#define IDEFLOPPY_IOCTL_FORMAT_START 0x4602 #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602
#define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603 #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603
#if 0
/*
* Special requests for our block device strategy routine.
*/
#define IDEFLOPPY_FIRST_RQ 90
/*
* IDEFLOPPY_PC_RQ is used to queue a packet command in the request queue.
*/
#define IDEFLOPPY_PC_RQ 90
#define IDEFLOPPY_LAST_RQ 90
/*
* A macro which can be used to check if a given request command
* originated in the driver or in the buffer cache layer.
*/
#define IDEFLOPPY_RQ_CMD(cmd) ((cmd >= IDEFLOPPY_FIRST_RQ) && (cmd <= IDEFLOPPY_LAST_RQ))
#endif
/* /*
* Error codes which are returned in rq->errors to the higher part * Error codes which are returned in rq->errors to the higher part
* of the driver. * of the driver.
...@@ -793,9 +772,8 @@ static void idefloppy_retry_pc (ide_drive_t *drive) ...@@ -793,9 +772,8 @@ static void idefloppy_retry_pc (ide_drive_t *drive)
{ {
idefloppy_pc_t *pc; idefloppy_pc_t *pc;
struct request *rq; struct request *rq;
atapi_error_t error;
error.all = HWIF(drive)->INB(IDE_ERROR_REG); (void)drive->hwif->INB(IDE_ERROR_REG);
pc = idefloppy_next_pc_storage(drive); pc = idefloppy_next_pc_storage(drive);
rq = idefloppy_next_rq_storage(drive); rq = idefloppy_next_rq_storage(drive);
idefloppy_create_request_sense_cmd(pc); idefloppy_create_request_sense_cmd(pc);
...@@ -809,12 +787,12 @@ static void idefloppy_retry_pc (ide_drive_t *drive) ...@@ -809,12 +787,12 @@ static void idefloppy_retry_pc (ide_drive_t *drive)
static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
atapi_status_t status; ide_hwif_t *hwif = drive->hwif;
atapi_bcount_t bcount;
atapi_ireason_t ireason;
idefloppy_pc_t *pc = floppy->pc; idefloppy_pc_t *pc = floppy->pc;
struct request *rq = pc->rq; struct request *rq = pc->rq;
unsigned int temp; unsigned int temp;
u16 bcount;
u8 stat, ireason;
debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n",
__FUNCTION__); __FUNCTION__);
...@@ -830,16 +808,16 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -830,16 +808,16 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
} }
/* Clear the interrupt */ /* Clear the interrupt */
status.all = HWIF(drive)->INB(IDE_STATUS_REG); stat = drive->hwif->INB(IDE_STATUS_REG);
if (!status.b.drq) { /* No more interrupts */ if ((stat & DRQ_STAT) == 0) { /* No more interrupts */
debug_log(KERN_INFO "Packet command completed, %d bytes " debug_log(KERN_INFO "Packet command completed, %d bytes "
"transferred\n", pc->actually_transferred); "transferred\n", pc->actually_transferred);
clear_bit(PC_DMA_IN_PROGRESS, &pc->flags); clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
local_irq_enable_in_hardirq(); local_irq_enable_in_hardirq();
if (status.b.check || test_bit(PC_DMA_ERROR, &pc->flags)) { if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) {
/* Error detected */ /* Error detected */
debug_log(KERN_INFO "ide-floppy: %s: I/O error\n", debug_log(KERN_INFO "ide-floppy: %s: I/O error\n",
drive->name); drive->name);
...@@ -870,32 +848,32 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -870,32 +848,32 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
} }
/* Get the number of bytes to transfer */ /* Get the number of bytes to transfer */
bcount.b.high = HWIF(drive)->INB(IDE_BCOUNTH_REG); bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
bcount.b.low = HWIF(drive)->INB(IDE_BCOUNTL_REG); hwif->INB(IDE_BCOUNTL_REG);
/* on this interrupt */ /* on this interrupt */
ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); ireason = hwif->INB(IDE_IREASON_REG);
if (ireason.b.cod) { if (ireason & CD) {
printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n"); printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n");
return ide_do_reset(drive); return ide_do_reset(drive);
} }
if (ireason.b.io == test_bit(PC_WRITING, &pc->flags)) { if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) {
/* Hopefully, we will never get here */ /* Hopefully, we will never get here */
printk(KERN_ERR "ide-floppy: We wanted to %s, ", printk(KERN_ERR "ide-floppy: We wanted to %s, ",
ireason.b.io ? "Write":"Read"); (ireason & IO) ? "Write" : "Read");
printk(KERN_ERR "but the floppy wants us to %s !\n", printk(KERN_ERR "but the floppy wants us to %s !\n",
ireason.b.io ? "Read":"Write"); (ireason & IO) ? "Read" : "Write");
return ide_do_reset(drive); return ide_do_reset(drive);
} }
if (!test_bit(PC_WRITING, &pc->flags)) { if (!test_bit(PC_WRITING, &pc->flags)) {
/* Reading - Check that we have enough space */ /* Reading - Check that we have enough space */
temp = pc->actually_transferred + bcount.all; temp = pc->actually_transferred + bcount;
if (temp > pc->request_transfer) { if (temp > pc->request_transfer) {
if (temp > pc->buffer_size) { if (temp > pc->buffer_size) {
printk(KERN_ERR "ide-floppy: The floppy wants " printk(KERN_ERR "ide-floppy: The floppy wants "
"to send us more data than expected " "to send us more data than expected "
"- discarding data\n"); "- discarding data\n");
idefloppy_discard_data(drive,bcount.all); idefloppy_discard_data(drive, bcount);
BUG_ON(HWGROUP(drive)->handler != NULL); BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, ide_set_handler(drive,
&idefloppy_pc_intr, &idefloppy_pc_intr,
...@@ -911,23 +889,21 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -911,23 +889,21 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
if (test_bit(PC_WRITING, &pc->flags)) { if (test_bit(PC_WRITING, &pc->flags)) {
if (pc->buffer != NULL) if (pc->buffer != NULL)
/* Write the current buffer */ /* Write the current buffer */
HWIF(drive)->atapi_output_bytes(drive, hwif->atapi_output_bytes(drive, pc->current_position,
pc->current_position, bcount);
bcount.all);
else else
idefloppy_output_buffers(drive, pc, bcount.all); idefloppy_output_buffers(drive, pc, bcount);
} else { } else {
if (pc->buffer != NULL) if (pc->buffer != NULL)
/* Read the current buffer */ /* Read the current buffer */
HWIF(drive)->atapi_input_bytes(drive, hwif->atapi_input_bytes(drive, pc->current_position,
pc->current_position, bcount);
bcount.all);
else else
idefloppy_input_buffers(drive, pc, bcount.all); idefloppy_input_buffers(drive, pc, bcount);
} }
/* Update the current position */ /* Update the current position */
pc->actually_transferred += bcount.all; pc->actually_transferred += bcount;
pc->current_position += bcount.all; pc->current_position += bcount;
BUG_ON(HWGROUP(drive)->handler != NULL); BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */ ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
...@@ -943,15 +919,15 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive) ...@@ -943,15 +919,15 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
{ {
ide_startstop_t startstop; ide_startstop_t startstop;
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
atapi_ireason_t ireason; u8 ireason;
if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) { if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
printk(KERN_ERR "ide-floppy: Strange, packet command " printk(KERN_ERR "ide-floppy: Strange, packet command "
"initiated yet DRQ isn't asserted\n"); "initiated yet DRQ isn't asserted\n");
return startstop; return startstop;
} }
ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); ireason = drive->hwif->INB(IDE_IREASON_REG);
if (!ireason.b.cod || ireason.b.io) { if ((ireason & CD) == 0 || (ireason & IO)) {
printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while " printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while "
"issuing a packet command\n"); "issuing a packet command\n");
return ide_do_reset(drive); return ide_do_reset(drive);
...@@ -991,15 +967,15 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive) ...@@ -991,15 +967,15 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
ide_startstop_t startstop; ide_startstop_t startstop;
atapi_ireason_t ireason; u8 ireason;
if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) { if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
printk(KERN_ERR "ide-floppy: Strange, packet command " printk(KERN_ERR "ide-floppy: Strange, packet command "
"initiated yet DRQ isn't asserted\n"); "initiated yet DRQ isn't asserted\n");
return startstop; return startstop;
} }
ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); ireason = drive->hwif->INB(IDE_IREASON_REG);
if (!ireason.b.cod || ireason.b.io) { if ((ireason & CD) == 0 || (ireason & IO)) {
printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) " printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) "
"while issuing a packet command\n"); "while issuing a packet command\n");
return ide_do_reset(drive); return ide_do_reset(drive);
...@@ -1041,21 +1017,9 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1041,21 +1017,9 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
atapi_feature_t feature;
atapi_bcount_t bcount;
ide_handler_t *pkt_xfer_routine; ide_handler_t *pkt_xfer_routine;
u16 bcount;
#if 0 /* Accessing floppy->pc is not valid here, the previous pc may be gone u8 dma;
and have lived on another thread's stack; that stack may have become
unmapped meanwhile (CONFIG_DEBUG_PAGEALLOC). */
#if IDEFLOPPY_DEBUG_BUGS
if (floppy->pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD &&
pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) {
printk(KERN_ERR "ide-floppy: possible ide-floppy.c bug - "
"Two request sense in serial were issued\n");
}
#endif /* IDEFLOPPY_DEBUG_BUGS */
#endif
if (floppy->failed_pc == NULL && if (floppy->failed_pc == NULL &&
pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD) pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD)
...@@ -1093,25 +1057,20 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1093,25 +1057,20 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
/* We haven't transferred any data yet */ /* We haven't transferred any data yet */
pc->actually_transferred = 0; pc->actually_transferred = 0;
pc->current_position = pc->buffer; pc->current_position = pc->buffer;
bcount.all = min(pc->request_transfer, 63 * 1024); bcount = min(pc->request_transfer, 63 * 1024);
if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags))
ide_dma_off(drive); ide_dma_off(drive);
feature.all = 0; dma = 0;
if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
feature.b.dma = !hwif->dma_setup(drive); dma = !hwif->dma_setup(drive);
if (IDE_CONTROL_REG) ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK |
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); IDE_TFLAG_OUT_DEVICE, bcount, dma);
/* Use PIO/DMA */
HWIF(drive)->OUTB(feature.all, IDE_FEATURE_REG);
HWIF(drive)->OUTB(bcount.b.high, IDE_BCOUNTH_REG);
HWIF(drive)->OUTB(bcount.b.low, IDE_BCOUNTL_REG);
HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG);
if (feature.b.dma) { /* Begin DMA, if necessary */ if (dma) { /* Begin DMA, if necessary */
set_bit(PC_DMA_IN_PROGRESS, &pc->flags); set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
hwif->dma_start(drive); hwif->dma_start(drive);
} }
...@@ -1665,14 +1624,14 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) ...@@ -1665,14 +1624,14 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg)
/* Else assume format_unit has finished, and we're /* Else assume format_unit has finished, and we're
** at 0x10000 */ ** at 0x10000 */
} else { } else {
atapi_status_t status;
unsigned long flags; unsigned long flags;
u8 stat;
local_irq_save(flags); local_irq_save(flags);
status.all = HWIF(drive)->INB(IDE_STATUS_REG); stat = drive->hwif->INB(IDE_STATUS_REG);
local_irq_restore(flags); local_irq_restore(flags);
progress_indication = !status.b.dsc ? 0 : 0x10000; progress_indication = ((stat & SEEK_STAT) == 0) ? 0 : 0x10000;
} }
if (put_user(progress_indication, arg)) if (put_user(progress_indication, arg))
return (-EFAULT); return (-EFAULT);
......
This diff is collapsed.
...@@ -158,14 +158,6 @@ void default_hwif_mmiops (ide_hwif_t *hwif) ...@@ -158,14 +158,6 @@ void default_hwif_mmiops (ide_hwif_t *hwif)
EXPORT_SYMBOL(default_hwif_mmiops); EXPORT_SYMBOL(default_hwif_mmiops);
u32 ide_read_24 (ide_drive_t *drive)
{
u8 hcyl = HWIF(drive)->INB(IDE_HCYL_REG);
u8 lcyl = HWIF(drive)->INB(IDE_LCYL_REG);
u8 sect = HWIF(drive)->INB(IDE_SECTOR_REG);
return (hcyl<<16)|(lcyl<<8)|sect;
}
void SELECT_DRIVE (ide_drive_t *drive) void SELECT_DRIVE (ide_drive_t *drive)
{ {
if (HWIF(drive)->selectproc) if (HWIF(drive)->selectproc)
...@@ -175,26 +167,12 @@ void SELECT_DRIVE (ide_drive_t *drive) ...@@ -175,26 +167,12 @@ void SELECT_DRIVE (ide_drive_t *drive)
EXPORT_SYMBOL(SELECT_DRIVE); EXPORT_SYMBOL(SELECT_DRIVE);
void SELECT_INTERRUPT (ide_drive_t *drive)
{
if (HWIF(drive)->intrproc)
HWIF(drive)->intrproc(drive);
else
HWIF(drive)->OUTB(drive->ctl|2, IDE_CONTROL_REG);
}
void SELECT_MASK (ide_drive_t *drive, int mask) void SELECT_MASK (ide_drive_t *drive, int mask)
{ {
if (HWIF(drive)->maskproc) if (HWIF(drive)->maskproc)
HWIF(drive)->maskproc(drive, mask); HWIF(drive)->maskproc(drive, mask);
} }
void QUIRK_LIST (ide_drive_t *drive)
{
if (HWIF(drive)->quirkproc)
drive->quirk_list = HWIF(drive)->quirkproc(drive);
}
/* /*
* Some localbus EIDE interfaces require a special access sequence * Some localbus EIDE interfaces require a special access sequence
* when using 32-bit I/O instructions to transfer data. We call this * when using 32-bit I/O instructions to transfer data. We call this
...@@ -449,7 +427,6 @@ int drive_is_ready (ide_drive_t *drive) ...@@ -449,7 +427,6 @@ int drive_is_ready (ide_drive_t *drive)
udelay(1); udelay(1);
#endif #endif
#ifdef CONFIG_IDEPCI_SHARE_IRQ
/* /*
* We do a passive status test under shared PCI interrupts on * We do a passive status test under shared PCI interrupts on
* cards that truly share the ATA side interrupt, but may also share * cards that truly share the ATA side interrupt, but may also share
...@@ -459,7 +436,6 @@ int drive_is_ready (ide_drive_t *drive) ...@@ -459,7 +436,6 @@ int drive_is_ready (ide_drive_t *drive)
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
stat = hwif->INB(IDE_ALTSTATUS_REG); stat = hwif->INB(IDE_ALTSTATUS_REG);
else else
#endif /* CONFIG_IDEPCI_SHARE_IRQ */
/* Note: this may clear a pending IRQ!! */ /* Note: this may clear a pending IRQ!! */
stat = hwif->INB(IDE_STATUS_REG); stat = hwif->INB(IDE_STATUS_REG);
...@@ -642,9 +618,9 @@ u8 eighty_ninty_three (ide_drive_t *drive) ...@@ -642,9 +618,9 @@ u8 eighty_ninty_three (ide_drive_t *drive)
int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
{ {
if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && if (args->tf.command == WIN_SETFEATURES &&
(args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && args->tf.lbal > XFER_UDMA_2 &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) { args->tf.feature == SETFEATURES_XFER) {
if (eighty_ninty_three(drive) == 0) { if (eighty_ninty_three(drive) == 0) {
printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot "
"be set\n", drive->name); "be set\n", drive->name);
...@@ -662,9 +638,9 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) ...@@ -662,9 +638,9 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
*/ */
int set_transfer (ide_drive_t *drive, ide_task_t *args) int set_transfer (ide_drive_t *drive, ide_task_t *args)
{ {
if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && if (args->tf.command == WIN_SETFEATURES &&
(args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && args->tf.lbal >= XFER_SW_DMA_0 &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) && args->tf.feature == SETFEATURES_XFER &&
(drive->id->dma_ultra || (drive->id->dma_ultra ||
drive->id->dma_mword || drive->id->dma_mword ||
drive->id->dma_1word)) drive->id->dma_1word))
...@@ -903,7 +879,8 @@ EXPORT_SYMBOL(ide_set_handler); ...@@ -903,7 +879,8 @@ EXPORT_SYMBOL(ide_set_handler);
* should go via this function or do equivalent locking. * should go via this function or do equivalent locking.
*/ */
void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *handler, unsigned timeout, ide_expiry_t *expiry) void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
unsigned timeout, ide_expiry_t *expiry)
{ {
unsigned long flags; unsigned long flags;
ide_hwgroup_t *hwgroup = HWGROUP(drive); ide_hwgroup_t *hwgroup = HWGROUP(drive);
...@@ -1051,7 +1028,6 @@ static void ide_disk_pre_reset(ide_drive_t *drive) ...@@ -1051,7 +1028,6 @@ static void ide_disk_pre_reset(ide_drive_t *drive)
drive->special.all = 0; drive->special.all = 0;
drive->special.b.set_geometry = legacy; drive->special.b.set_geometry = legacy;
drive->special.b.recalibrate = legacy; drive->special.b.recalibrate = legacy;
if (OK_TO_RESET_CONTROLLER)
drive->mult_count = 0; drive->mult_count = 0;
if (!drive->keep_settings && !drive->using_dma) if (!drive->keep_settings && !drive->using_dma)
drive->mult_req = 0; drive->mult_req = 0;
...@@ -1137,7 +1113,6 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) ...@@ -1137,7 +1113,6 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
for (unit = 0; unit < MAX_DRIVES; ++unit) for (unit = 0; unit < MAX_DRIVES; ++unit)
pre_reset(&hwif->drives[unit]); pre_reset(&hwif->drives[unit]);
#if OK_TO_RESET_CONTROLLER
if (!IDE_CONTROL_REG) { if (!IDE_CONTROL_REG) {
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return ide_stopped; return ide_stopped;
...@@ -1174,11 +1149,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) ...@@ -1174,11 +1149,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
* state when the disks are reset this way. At least, the Winbond * state when the disks are reset this way. At least, the Winbond
* 553 documentation says that * 553 documentation says that
*/ */
if (hwif->resetproc != NULL) { if (hwif->resetproc)
hwif->resetproc(drive); hwif->resetproc(drive);
}
#endif /* OK_TO_RESET_CONTROLLER */
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return ide_started; return ide_started;
......
...@@ -441,6 +441,12 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) ...@@ -441,6 +441,12 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
* case could happen iff the transfer mode has already been set on * case could happen iff the transfer mode has already been set on
* the device by ide-proc.c::set_xfer_rate()). * the device by ide-proc.c::set_xfer_rate()).
*/ */
if (rate < XFER_PIO_0) {
if (hwif->host_flags & IDE_HFLAG_ABUSE_SET_DMA_MODE)
return ide_set_dma_mode(drive, rate);
else
return ide_config_drive_speed(drive, rate);
}
return ide_set_dma_mode(drive, rate); return ide_set_dma_mode(drive, rate);
} }
...@@ -458,8 +464,7 @@ static void ide_dump_opcode(ide_drive_t *drive) ...@@ -458,8 +464,7 @@ static void ide_dump_opcode(ide_drive_t *drive)
spin_unlock(&ide_lock); spin_unlock(&ide_lock);
if (!rq) if (!rq)
return; return;
if (rq->cmd_type == REQ_TYPE_ATA_CMD || if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
rq->cmd_type == REQ_TYPE_ATA_TASK) {
char *args = rq->buffer; char *args = rq->buffer;
if (args) { if (args) {
opcode = args[0]; opcode = args[0];
...@@ -468,8 +473,7 @@ static void ide_dump_opcode(ide_drive_t *drive) ...@@ -468,8 +473,7 @@ static void ide_dump_opcode(ide_drive_t *drive)
} else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
ide_task_t *args = rq->special; ide_task_t *args = rq->special;
if (args) { if (args) {
task_struct_t *tf = (task_struct_t *) args->tfRegister; opcode = args->tf.command;
opcode = tf->command;
found = 1; found = 1;
} }
} }
...@@ -481,29 +485,47 @@ static void ide_dump_opcode(ide_drive_t *drive) ...@@ -481,29 +485,47 @@ static void ide_dump_opcode(ide_drive_t *drive)
printk("0x%02x\n", opcode); printk("0x%02x\n", opcode);
} }
static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48)
{ {
ide_hwif_t *hwif = HWIF(drive); u32 high, low;
unsigned long flags;
u8 err = 0;
local_irq_save(flags); if (lba48)
printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) |
if (stat & BUSY_STAT) tf->hob_lbal;
printk("Busy "); else
else { high = tf->device & 0xf;
if (stat & READY_STAT) printk("DriveReady "); low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
if (stat & WRERR_STAT) printk("DeviceFault ");
if (stat & SEEK_STAT) printk("SeekComplete "); return ((u64)high << 24) | low;
if (stat & DRQ_STAT) printk("DataRequest "); }
if (stat & ECC_STAT) printk("CorrectedError "); EXPORT_SYMBOL_GPL(ide_get_lba_addr);
if (stat & INDEX_STAT) printk("Index ");
if (stat & ERR_STAT) printk("Error "); static void ide_dump_sector(ide_drive_t *drive)
} {
printk("}\n"); ide_task_t task;
if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { struct ide_taskfile *tf = &task.tf;
err = hwif->INB(IDE_ERROR_REG); int lba48 = (drive->addressing == 1) ? 1 : 0;
printk("%s: %s: error=0x%02x { ", drive->name, msg, err);
memset(&task, 0, sizeof(task));
if (lba48)
task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA |
IDE_TFLAG_LBA48;
else
task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE;
ide_tf_read(drive, &task);
if (lba48 || (tf->device & ATA_LBA))
printk(", LBAsect=%llu",
(unsigned long long)ide_get_lba_addr(tf, lba48));
else
printk(", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam,
tf->device & 0xf, tf->lbal);
}
static void ide_dump_ata_error(ide_drive_t *drive, u8 err)
{
printk("{ ");
if (err & ABRT_ERR) printk("DriveStatusError "); if (err & ABRT_ERR) printk("DriveStatusError ");
if (err & ICRC_ERR) if (err & ICRC_ERR)
printk((err & ABRT_ERR) ? "BadCRC " : "BadSector "); printk((err & ABRT_ERR) ? "BadCRC " : "BadSector ");
...@@ -514,108 +536,67 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) ...@@ -514,108 +536,67 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
printk("}"); printk("}");
if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR || if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR ||
(err & (ECC_ERR|ID_ERR|MARK_ERR))) { (err & (ECC_ERR|ID_ERR|MARK_ERR))) {
if (drive->addressing == 1) { ide_dump_sector(drive);
__u64 sectors = 0;
u32 low = 0, high = 0;
hwif->OUTB(drive->ctl&~0x80, IDE_CONTROL_REG);
low = ide_read_24(drive);
hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
high = ide_read_24(drive);
sectors = ((__u64)high << 24) | low;
printk(", LBAsect=%llu, high=%d, low=%d",
(unsigned long long) sectors,
high, low);
} else {
u8 cur = hwif->INB(IDE_SELECT_REG);
if (cur & 0x40) { /* using LBA? */
printk(", LBAsect=%ld", (unsigned long)
((cur&0xf)<<24)
|(hwif->INB(IDE_HCYL_REG)<<16)
|(hwif->INB(IDE_LCYL_REG)<<8)
| hwif->INB(IDE_SECTOR_REG));
} else {
printk(", CHS=%d/%d/%d",
(hwif->INB(IDE_HCYL_REG)<<8) +
hwif->INB(IDE_LCYL_REG),
cur & 0xf,
hwif->INB(IDE_SECTOR_REG));
}
}
if (HWGROUP(drive) && HWGROUP(drive)->rq) if (HWGROUP(drive) && HWGROUP(drive)->rq)
printk(", sector=%llu", printk(", sector=%llu",
(unsigned long long)HWGROUP(drive)->rq->sector); (unsigned long long)HWGROUP(drive)->rq->sector);
} }
printk("\n"); printk("\n");
} }
ide_dump_opcode(drive);
local_irq_restore(flags); static void ide_dump_atapi_error(ide_drive_t *drive, u8 err)
return err; {
printk("{ ");
if (err & ILI_ERR) printk("IllegalLengthIndication ");
if (err & EOM_ERR) printk("EndOfMedia ");
if (err & ABRT_ERR) printk("AbortedCommand ");
if (err & MCR_ERR) printk("MediaChangeRequested ");
if (err & LFS_ERR) printk("LastFailedSense=0x%02x ",
(err & LFS_ERR) >> 4);
printk("}\n");
} }
/** /**
* ide_dump_atapi_status - print human readable atapi status * ide_dump_status - translate ATA/ATAPI error
* @drive: drive that status applies to * @drive: drive that status applies to
* @msg: text message to print * @msg: text message to print
* @stat: status byte to decode * @stat: status byte to decode
* *
* Error reporting, in human readable form (luxurious, but a memory hog). * Error reporting, in human readable form (luxurious, but a memory hog).
* Combines the drive name, message and status byte to provide a
* user understandable explanation of the device error.
*/ */
static u8 ide_dump_atapi_status(ide_drive_t *drive, const char *msg, u8 stat) u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat)
{ {
unsigned long flags; unsigned long flags;
u8 err = 0;
atapi_status_t status;
atapi_error_t error;
status.all = stat;
error.all = 0;
local_irq_save(flags); local_irq_save(flags);
printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); printk("%s: %s: status=0x%02x { ", drive->name, msg, stat);
if (status.b.bsy) if (stat & BUSY_STAT)
printk("Busy "); printk("Busy ");
else { else {
if (status.b.drdy) printk("DriveReady "); if (stat & READY_STAT) printk("DriveReady ");
if (status.b.df) printk("DeviceFault "); if (stat & WRERR_STAT) printk("DeviceFault ");
if (status.b.dsc) printk("SeekComplete "); if (stat & SEEK_STAT) printk("SeekComplete ");
if (status.b.drq) printk("DataRequest "); if (stat & DRQ_STAT) printk("DataRequest ");
if (status.b.corr) printk("CorrectedError "); if (stat & ECC_STAT) printk("CorrectedError ");
if (status.b.idx) printk("Index "); if (stat & INDEX_STAT) printk("Index ");
if (status.b.check) printk("Error "); if (stat & ERR_STAT) printk("Error ");
} }
printk("}\n"); printk("}\n");
if (status.b.check && !status.b.bsy) { if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
error.all = HWIF(drive)->INB(IDE_ERROR_REG); err = drive->hwif->INB(IDE_ERROR_REG);
printk("%s: %s: error=0x%02x { ", drive->name, msg, error.all); printk("%s: %s: error=0x%02x ", drive->name, msg, err);
if (error.b.ili) printk("IllegalLengthIndication "); if (drive->media == ide_disk)
if (error.b.eom) printk("EndOfMedia "); ide_dump_ata_error(drive, err);
if (error.b.abrt) printk("AbortedCommand "); else
if (error.b.mcr) printk("MediaChangeRequested "); ide_dump_atapi_error(drive, err);
if (error.b.sense_key) printk("LastFailedSense=0x%02x ",
error.b.sense_key);
printk("}\n");
} }
ide_dump_opcode(drive); ide_dump_opcode(drive);
local_irq_restore(flags); local_irq_restore(flags);
return error.all; return err;
}
/**
* ide_dump_status - translate ATA/ATAPI error
* @drive: drive the error occured on
* @msg: information string
* @stat: status byte
*
* Error reporting, in human readable form (luxurious, but a memory hog).
* Combines the drive name, message and status byte to provide a
* user understandable explanation of the device error.
*/
u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat)
{
if (drive->media == ide_disk)
return ide_dump_ata_status(drive, msg, stat);
return ide_dump_atapi_status(drive, msg, stat);
} }
EXPORT_SYMBOL(ide_dump_status); EXPORT_SYMBOL(ide_dump_status);
...@@ -95,10 +95,10 @@ static void ide_disk_init_mult_count(ide_drive_t *drive) ...@@ -95,10 +95,10 @@ static void ide_disk_init_mult_count(ide_drive_t *drive)
#ifdef CONFIG_IDEDISK_MULTI_MODE #ifdef CONFIG_IDEDISK_MULTI_MODE
id->multsect = ((id->max_multsect/2) > 1) ? id->max_multsect : 0; id->multsect = ((id->max_multsect/2) > 1) ? id->max_multsect : 0;
id->multsect_valid = id->multsect ? 1 : 0; id->multsect_valid = id->multsect ? 1 : 0;
drive->mult_req = id->multsect_valid ? id->max_multsect : INITIAL_MULT_COUNT; drive->mult_req = id->multsect_valid ? id->max_multsect : 0;
drive->special.b.set_multmode = drive->mult_req ? 1 : 0; drive->special.b.set_multmode = drive->mult_req ? 1 : 0;
#else /* original, pre IDE-NFG, per request of AC */ #else /* original, pre IDE-NFG, per request of AC */
drive->mult_req = INITIAL_MULT_COUNT; drive->mult_req = 0;
if (drive->mult_req > id->max_multsect) if (drive->mult_req > id->max_multsect)
drive->mult_req = id->max_multsect; drive->mult_req = id->max_multsect;
if (drive->mult_req || ((id->multsect_valid & 1) && id->multsect)) if (drive->mult_req || ((id->multsect_valid & 1) && id->multsect))
...@@ -234,7 +234,10 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) ...@@ -234,7 +234,10 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
drive->media = ide_disk; drive->media = ide_disk;
printk("%s DISK drive\n", (id->config == 0x848a) ? "CFA" : "ATA" ); printk("%s DISK drive\n", (id->config == 0x848a) ? "CFA" : "ATA" );
QUIRK_LIST(drive);
if (hwif->quirkproc)
drive->quirk_list = hwif->quirkproc(drive);
return; return;
err_misc: err_misc:
...@@ -830,18 +833,10 @@ static void probe_hwif(ide_hwif_t *hwif) ...@@ -830,18 +833,10 @@ static void probe_hwif(ide_hwif_t *hwif)
drive->nice1 = 1; drive->nice1 = 1;
if (hwif->ide_dma_on) { if (hwif->ide_dma_on)
/*
* Force DMAing for the beginning of the check.
* Some chipsets appear to do interesting
* things, if not checked and cleared.
* PARANOIA!!!
*/
hwif->dma_off_quietly(drive);
ide_set_dma(drive); ide_set_dma(drive);
} }
} }
}
for (unit = 0; unit < MAX_DRIVES; ++unit) { for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit]; ide_drive_t *drive = &hwif->drives[unit];
...@@ -968,11 +963,6 @@ static int ide_init_queue(ide_drive_t *drive) ...@@ -968,11 +963,6 @@ static int ide_init_queue(ide_drive_t *drive)
* Much of the code is for correctly detecting/handling irq sharing * Much of the code is for correctly detecting/handling irq sharing
* and irq serialization situations. This is somewhat complex because * and irq serialization situations. This is somewhat complex because
* it handles static as well as dynamic (PCMCIA) IDE interfaces. * it handles static as well as dynamic (PCMCIA) IDE interfaces.
*
* The IRQF_DISABLED in sa_flags means ide_intr() is always entered with
* interrupts completely disabled. This can be bad for interrupt latency,
* 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 (ide_hwif_t *hwif)
{ {
...@@ -1055,17 +1045,13 @@ static int init_irq (ide_hwif_t *hwif) ...@@ -1055,17 +1045,13 @@ static int init_irq (ide_hwif_t *hwif)
* Allocate the irq, if not already obtained for another hwif * Allocate the irq, if not already obtained for another hwif
*/ */
if (!match || match->irq != hwif->irq) { if (!match || match->irq != hwif->irq) {
int sa = IRQF_DISABLED; int sa = 0;
#if defined(__mc68000__) || defined(CONFIG_APUS) #if defined(__mc68000__) || defined(CONFIG_APUS)
sa = IRQF_SHARED; sa = IRQF_SHARED;
#endif /* __mc68000__ || CONFIG_APUS */ #endif /* __mc68000__ || CONFIG_APUS */
if (IDE_CHIPSET_IS_PCI(hwif->chipset)) { if (IDE_CHIPSET_IS_PCI(hwif->chipset))
sa = IRQF_SHARED; sa = IRQF_SHARED;
#ifndef CONFIG_IDEPCI_SHARE_IRQ
sa |= IRQF_DISABLED;
#endif /* CONFIG_IDEPCI_SHARE_IRQ */
}
if (hwif->io_ports[IDE_CONTROL_OFFSET]) if (hwif->io_ports[IDE_CONTROL_OFFSET])
/* clear nIEN */ /* clear nIEN */
......
This diff is collapsed.
This diff is collapsed.
...@@ -424,7 +424,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) ...@@ -424,7 +424,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
hwif->reset_poll = tmp_hwif->reset_poll; hwif->reset_poll = tmp_hwif->reset_poll;
hwif->pre_reset = tmp_hwif->pre_reset; hwif->pre_reset = tmp_hwif->pre_reset;
hwif->resetproc = tmp_hwif->resetproc; hwif->resetproc = tmp_hwif->resetproc;
hwif->intrproc = tmp_hwif->intrproc;
hwif->maskproc = tmp_hwif->maskproc; hwif->maskproc = tmp_hwif->maskproc;
hwif->quirkproc = tmp_hwif->quirkproc; hwif->quirkproc = tmp_hwif->quirkproc;
hwif->busproc = tmp_hwif->busproc; hwif->busproc = tmp_hwif->busproc;
...@@ -468,7 +467,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) ...@@ -468,7 +467,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
#endif #endif
hwif->dma_base = tmp_hwif->dma_base; hwif->dma_base = tmp_hwif->dma_base;
hwif->dma_master = tmp_hwif->dma_master;
hwif->dma_command = tmp_hwif->dma_command; hwif->dma_command = tmp_hwif->dma_command;
hwif->dma_vendor1 = tmp_hwif->dma_vendor1; hwif->dma_vendor1 = tmp_hwif->dma_vendor1;
hwif->dma_status = tmp_hwif->dma_status; hwif->dma_status = tmp_hwif->dma_status;
...@@ -602,7 +600,6 @@ void ide_unregister(unsigned int index) ...@@ -602,7 +600,6 @@ void ide_unregister(unsigned int index)
(void) ide_release_dma(hwif); (void) ide_release_dma(hwif);
hwif->dma_base = 0; hwif->dma_base = 0;
hwif->dma_master = 0;
hwif->dma_command = 0; hwif->dma_command = 0;
hwif->dma_vendor1 = 0; hwif->dma_vendor1 = 0;
hwif->dma_status = 0; hwif->dma_status = 0;
...@@ -854,8 +851,7 @@ int set_using_dma(ide_drive_t *drive, int arg) ...@@ -854,8 +851,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
err = 0; err = 0;
if (arg) { if (arg) {
hwif->dma_off_quietly(drive); if (ide_set_dma(drive))
if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
err = -EIO; err = -EIO;
} else } else
ide_dma_off(drive); ide_dma_off(drive);
......
...@@ -198,8 +198,6 @@ static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -198,8 +198,6 @@ static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed)
break; break;
#endif #endif
default:
return;
} }
au_writel(mem_sttime,MEM_STTIME2); au_writel(mem_sttime,MEM_STTIME2);
......
...@@ -202,6 +202,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -202,6 +202,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.host_flags = IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_SERIALIZE |
IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD, IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
...@@ -211,6 +212,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -211,6 +212,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.init_chipset = init_chipset_aec62xx, .init_chipset = init_chipset_aec62xx,
.init_hwif = init_hwif_aec62xx, .init_hwif = init_hwif_aec62xx,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD, IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
...@@ -220,7 +222,8 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -220,7 +222,8 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.init_chipset = init_chipset_aec62xx, .init_chipset = init_chipset_aec62xx,
.init_hwif = init_hwif_aec62xx, .init_hwif = init_hwif_aec62xx,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.host_flags = IDE_HFLAG_NO_ATAPI_DMA, .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
...@@ -228,7 +231,9 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -228,7 +231,9 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.name = "AEC6280", .name = "AEC6280",
.init_chipset = init_chipset_aec62xx, .init_chipset = init_chipset_aec62xx,
.init_hwif = init_hwif_aec62xx, .init_hwif = init_hwif_aec62xx,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
...@@ -237,7 +242,9 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { ...@@ -237,7 +242,9 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
.init_chipset = init_chipset_aec62xx, .init_chipset = init_chipset_aec62xx,
.init_hwif = init_hwif_aec62xx, .init_hwif = init_hwif_aec62xx,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
......
...@@ -402,9 +402,6 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -402,9 +402,6 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed)
u8 tmpbyte = 0x00; u8 tmpbyte = 0x00;
int m5229_udma = (hwif->channel) ? 0x57 : 0x56; int m5229_udma = (hwif->channel) ? 0x57 : 0x56;
if (speed < XFER_PIO_0)
return;
if (speed == XFER_UDMA_6) if (speed == XFER_UDMA_6)
speed1 = 0x47; speed1 = 0x47;
......
...@@ -266,6 +266,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) ...@@ -266,6 +266,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
#define IDE_HFLAGS_AMD \ #define IDE_HFLAGS_AMD \
(IDE_HFLAG_PIO_NO_BLACKLIST | \ (IDE_HFLAG_PIO_NO_BLACKLIST | \
IDE_HFLAG_PIO_NO_DOWNGRADE | \ IDE_HFLAG_PIO_NO_DOWNGRADE | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_POST_SET_MODE | \ IDE_HFLAG_POST_SET_MODE | \
IDE_HFLAG_IO_32BIT | \ IDE_HFLAG_IO_32BIT | \
IDE_HFLAG_UNMASK_IRQS | \ IDE_HFLAG_UNMASK_IRQS | \
......
...@@ -133,9 +133,6 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -133,9 +133,6 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
u32 tmp32; u32 tmp32;
u16 tmp16; u16 tmp16;
if (speed < XFER_MW_DMA_0)
return;
spin_lock_irqsave(&atiixp_lock, flags); spin_lock_irqsave(&atiixp_lock, flags);
save_mdma_mode[drive->dn] = 0; save_mdma_mode[drive->dn] = 0;
......
...@@ -322,8 +322,6 @@ static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -322,8 +322,6 @@ static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed)
case XFER_MW_DMA_0: case XFER_MW_DMA_0:
program_cycle_times(drive, 480, 215); program_cycle_times(drive, 480, 215);
break; break;
default:
return;
} }
if (speed >= XFER_SW_DMA_0) if (speed >= XFER_SW_DMA_0)
...@@ -333,14 +331,15 @@ static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -333,14 +331,15 @@ static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed)
static int cmd648_ide_dma_end (ide_drive_t *drive) static int cmd648_ide_dma_end (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned long base = hwif->dma_base - (hwif->channel * 8);
int err = __ide_dma_end(drive); int err = __ide_dma_end(drive);
u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 : u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
MRDMODE_INTR_CH0; MRDMODE_INTR_CH0;
u8 mrdmode = inb(hwif->dma_master + 0x01); u8 mrdmode = inb(base + 1);
/* clear the interrupt bit */ /* clear the interrupt bit */
outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask, outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask,
hwif->dma_master + 0x01); base + 1);
return err; return err;
} }
...@@ -365,10 +364,11 @@ static int cmd64x_ide_dma_end (ide_drive_t *drive) ...@@ -365,10 +364,11 @@ static int cmd64x_ide_dma_end (ide_drive_t *drive)
static int cmd648_ide_dma_test_irq (ide_drive_t *drive) static int cmd648_ide_dma_test_irq (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned long base = hwif->dma_base - (hwif->channel * 8);
u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 : u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
MRDMODE_INTR_CH0; MRDMODE_INTR_CH0;
u8 dma_stat = inb(hwif->dma_status); u8 dma_stat = inb(hwif->dma_status);
u8 mrdmode = inb(hwif->dma_master + 0x01); u8 mrdmode = inb(base + 1);
#ifdef DEBUG #ifdef DEBUG
printk("%s: dma_stat: 0x%02x mrdmode: 0x%02x irq_mask: 0x%02x\n", printk("%s: dma_stat: 0x%02x mrdmode: 0x%02x irq_mask: 0x%02x\n",
......
...@@ -137,6 +137,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) ...@@ -137,6 +137,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
IDE_HFLAG_CS5520 | \ IDE_HFLAG_CS5520 | \
IDE_HFLAG_VDMA | \ IDE_HFLAG_VDMA | \
IDE_HFLAG_NO_ATAPI_DMA | \ IDE_HFLAG_NO_ATAPI_DMA | \
IDE_HFLAG_ABUSE_SET_DMA_MODE |\
IDE_HFLAG_BOOTABLE, \ IDE_HFLAG_BOOTABLE, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
} }
......
...@@ -116,8 +116,6 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) ...@@ -116,8 +116,6 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
case XFER_MW_DMA_0: timings = 0x00077771; break; case XFER_MW_DMA_0: timings = 0x00077771; break;
case XFER_MW_DMA_1: timings = 0x00012121; break; case XFER_MW_DMA_1: timings = 0x00012121; break;
case XFER_MW_DMA_2: timings = 0x00002020; break; case XFER_MW_DMA_2: timings = 0x00002020; break;
default:
return;
} }
basereg = CS5530_BASEREG(drive->hwif); basereg = CS5530_BASEREG(drive->hwif);
reg = inl(basereg + 4); /* get drive0 config register */ reg = inl(basereg + 4); /* get drive0 config register */
......
...@@ -190,7 +190,7 @@ static const struct ide_port_info cs5535_chipset __devinitdata = { ...@@ -190,7 +190,7 @@ static const struct ide_port_info cs5535_chipset __devinitdata = {
.name = "CS5535", .name = "CS5535",
.init_hwif = init_hwif_cs5535, .init_hwif = init_hwif_cs5535,
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE |
IDE_HFLAG_BOOTABLE, IDE_HFLAG_ABUSE_SET_DMA_MODE | IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
......
...@@ -129,14 +129,18 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) ...@@ -129,14 +129,18 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
hwif->set_dma_mode = &hpt34x_set_mode; hwif->set_dma_mode = &hpt34x_set_mode;
} }
#define IDE_HFLAGS_HPT34X \
(IDE_HFLAG_NO_ATAPI_DMA | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_NO_AUTODMA)
static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { static const struct ide_port_info hpt34x_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
.name = "HPT343", .name = "HPT343",
.init_chipset = init_chipset_hpt34x, .init_chipset = init_chipset_hpt34x,
.init_hwif = init_hwif_hpt34x, .init_hwif = init_hwif_hpt34x,
.extra = 16, .extra = 16,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | .host_flags = IDE_HFLAGS_HPT34X,
IDE_HFLAG_NO_AUTODMA,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
}, },
{ /* 1 */ { /* 1 */
...@@ -144,9 +148,7 @@ static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { ...@@ -144,9 +148,7 @@ static const struct ide_port_info hpt34x_chipsets[] __devinitdata = {
.init_chipset = init_chipset_hpt34x, .init_chipset = init_chipset_hpt34x,
.init_hwif = init_hwif_hpt34x, .init_hwif = init_hwif_hpt34x,
.extra = 16, .extra = 16,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA | .host_flags = IDE_HFLAGS_HPT34X | IDE_HFLAG_OFF_BOARD,
IDE_HFLAG_NO_AUTODMA |
IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO5, .pio_mask = ATA_PIO5,
#ifdef CONFIG_HPT34X_AUTODMA #ifdef CONFIG_HPT34X_AUTODMA
.swdma_mask = ATA_SWDMA2, .swdma_mask = ATA_SWDMA2,
......
This diff is collapsed.
...@@ -101,24 +101,11 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -101,24 +101,11 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
pci_read_config_byte(dev, 0x54, &reg54); pci_read_config_byte(dev, 0x54, &reg54);
pci_read_config_byte(dev, 0x55, &reg55); pci_read_config_byte(dev, 0x55, &reg55);
switch(speed) {
case XFER_UDMA_6:
case XFER_UDMA_4:
case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break;
case XFER_UDMA_5:
case XFER_UDMA_3:
case XFER_UDMA_1: u_speed = 1 << (drive->dn * 4); break;
case XFER_UDMA_0: u_speed = 0 << (drive->dn * 4); break;
break;
case XFER_MW_DMA_2:
case XFER_MW_DMA_1:
case XFER_SW_DMA_2:
break;
default:
return;
}
if (speed >= XFER_UDMA_0) { if (speed >= XFER_UDMA_0) {
u8 udma = speed - XFER_UDMA_0;
u_speed = min_t(u8, 2 - (udma & 1), udma) << (drive->dn * 4);
if (!(reg48 & u_flag)) if (!(reg48 & u_flag))
pci_write_config_byte(dev, 0x48, reg48 | u_flag); pci_write_config_byte(dev, 0x48, reg48 | u_flag);
if (speed >= XFER_UDMA_5) { if (speed >= XFER_UDMA_5) {
......
...@@ -146,7 +146,7 @@ static struct udma_timing { ...@@ -146,7 +146,7 @@ static struct udma_timing {
{ 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */
}; };
static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed) static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
u8 adj = (drive->dn & 1) ? 0x08 : 0x00; u8 adj = (drive->dn & 1) ? 0x08 : 0x00;
...@@ -162,45 +162,18 @@ static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed) ...@@ -162,45 +162,18 @@ static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed)
if (max_dma_rate(hwif->pci_dev) == 4) { if (max_dma_rate(hwif->pci_dev) == 4) {
u8 mode = speed & 0x07; u8 mode = speed & 0x07;
switch (speed) { if (speed >= XFER_UDMA_0) {
case XFER_UDMA_6:
case XFER_UDMA_5:
case XFER_UDMA_4:
case XFER_UDMA_3:
case XFER_UDMA_2:
case XFER_UDMA_1:
case XFER_UDMA_0:
set_indexed_reg(hwif, 0x10 + adj, set_indexed_reg(hwif, 0x10 + adj,
udma_timings[mode].reg10); udma_timings[mode].reg10);
set_indexed_reg(hwif, 0x11 + adj, set_indexed_reg(hwif, 0x11 + adj,
udma_timings[mode].reg11); udma_timings[mode].reg11);
set_indexed_reg(hwif, 0x12 + adj, set_indexed_reg(hwif, 0x12 + adj,
udma_timings[mode].reg12); udma_timings[mode].reg12);
break; } else {
case XFER_MW_DMA_2:
case XFER_MW_DMA_1:
case XFER_MW_DMA_0:
set_indexed_reg(hwif, 0x0e + adj, set_indexed_reg(hwif, 0x0e + adj,
mwdma_timings[mode].reg0e); mwdma_timings[mode].reg0e);
set_indexed_reg(hwif, 0x0f + adj, set_indexed_reg(hwif, 0x0f + adj,
mwdma_timings[mode].reg0f); mwdma_timings[mode].reg0f);
break;
case XFER_PIO_4:
case XFER_PIO_3:
case XFER_PIO_2:
case XFER_PIO_1:
case XFER_PIO_0:
set_indexed_reg(hwif, 0x0c + adj,
pio_timings[mode].reg0c);
set_indexed_reg(hwif, 0x0d + adj,
pio_timings[mode].reg0d);
set_indexed_reg(hwif, 0x13 + adj,
pio_timings[mode].reg13);
break;
default:
printk(KERN_ERR "pdc202xx_new: "
"Unknown speed %d ignored\n", speed);
} }
} else if (speed == XFER_UDMA_2) { } else if (speed == XFER_UDMA_2) {
/* Set tHOLD bit to 0 if using UDMA mode 2 */ /* Set tHOLD bit to 0 if using UDMA mode 2 */
...@@ -212,7 +185,14 @@ static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed) ...@@ -212,7 +185,14 @@ static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed)
static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio)
{ {
pdcnew_set_mode(drive, XFER_PIO_0 + pio); ide_hwif_t *hwif = drive->hwif;
u8 adj = (drive->dn & 1) ? 0x08 : 0x00;
if (max_dma_rate(hwif->pci_dev) == 4) {
set_indexed_reg(hwif, 0x0c + adj, pio_timings[pio].reg0c);
set_indexed_reg(hwif, 0x0d + adj, pio_timings[pio].reg0d);
set_indexed_reg(hwif, 0x13 + adj, pio_timings[pio].reg13);
}
} }
static u8 pdcnew_cable_detect(ide_hwif_t *hwif) static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
...@@ -466,7 +446,7 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha ...@@ -466,7 +446,7 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha
static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
{ {
hwif->set_pio_mode = &pdcnew_set_pio_mode; hwif->set_pio_mode = &pdcnew_set_pio_mode;
hwif->set_dma_mode = &pdcnew_set_mode; hwif->set_dma_mode = &pdcnew_set_dma_mode;
hwif->quirkproc = &pdcnew_quirkproc; hwif->quirkproc = &pdcnew_quirkproc;
hwif->resetproc = &pdcnew_reset; hwif->resetproc = &pdcnew_reset;
......
...@@ -162,7 +162,7 @@ static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif) ...@@ -162,7 +162,7 @@ static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif)
*/ */
static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif) static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
{ {
unsigned long clock_reg = hwif->dma_master + 0x11; unsigned long clock_reg = hwif->extra_base + 0x01;
u8 clock = inb(clock_reg); u8 clock = inb(clock_reg);
outb(clock | (hwif->channel ? 0x08 : 0x02), clock_reg); outb(clock | (hwif->channel ? 0x08 : 0x02), clock_reg);
...@@ -170,7 +170,7 @@ static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif) ...@@ -170,7 +170,7 @@ static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif) static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif)
{ {
unsigned long clock_reg = hwif->dma_master + 0x11; unsigned long clock_reg = hwif->extra_base + 0x01;
u8 clock = inb(clock_reg); u8 clock = inb(clock_reg);
outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg);
...@@ -193,7 +193,7 @@ static void pdc202xx_old_ide_dma_start(ide_drive_t *drive) ...@@ -193,7 +193,7 @@ static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
if (drive->media != ide_disk || drive->addressing == 1) { if (drive->media != ide_disk || drive->addressing == 1) {
struct request *rq = HWGROUP(drive)->rq; struct request *rq = HWGROUP(drive)->rq;
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->dma_master; unsigned long high_16 = hwif->extra_base - 16;
unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
u32 word_count = 0; u32 word_count = 0;
u8 clock = inb(high_16 + 0x11); u8 clock = inb(high_16 + 0x11);
...@@ -212,7 +212,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive) ...@@ -212,7 +212,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
{ {
if (drive->media != ide_disk || drive->addressing == 1) { if (drive->media != ide_disk || drive->addressing == 1) {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->dma_master; unsigned long high_16 = hwif->extra_base - 16;
unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
u8 clock = 0; u8 clock = 0;
...@@ -228,7 +228,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive) ...@@ -228,7 +228,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive) static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->dma_master; unsigned long high_16 = hwif->extra_base - 16;
u8 dma_stat = inb(hwif->dma_status); u8 dma_stat = inb(hwif->dma_status);
u8 sc1d = inb(high_16 + 0x001d); u8 sc1d = inb(high_16 + 0x001d);
...@@ -271,7 +271,7 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive) ...@@ -271,7 +271,7 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive)
static void pdc202xx_reset_host (ide_hwif_t *hwif) static void pdc202xx_reset_host (ide_hwif_t *hwif)
{ {
unsigned long high_16 = hwif->dma_master; unsigned long high_16 = hwif->extra_base - 16;
u8 udma_speed_flag = inb(high_16 | 0x001f); u8 udma_speed_flag = inb(high_16 | 0x001f);
outb(udma_speed_flag | 0x10, high_16 | 0x001f); outb(udma_speed_flag | 0x10, high_16 | 0x001f);
...@@ -375,6 +375,11 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, ...@@ -375,6 +375,11 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
} }
} }
#define IDE_HFLAGS_PDC202XX \
(IDE_HFLAG_ERROR_STOPS_FIFO | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_OFF_BOARD)
#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \ #define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \
{ \ { \
.name = name_str, \ .name = name_str, \
...@@ -382,9 +387,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, ...@@ -382,9 +387,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
.init_hwif = init_hwif_pdc202xx, \ .init_hwif = init_hwif_pdc202xx, \
.init_dma = init_dma_pdc202xx, \ .init_dma = init_dma_pdc202xx, \
.extra = 48, \ .extra = 48, \
.host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \ .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \
extra_flags | \
IDE_HFLAG_OFF_BOARD, \
.pio_mask = ATA_PIO4, \ .pio_mask = ATA_PIO4, \
.mwdma_mask = ATA_MWDMA2, \ .mwdma_mask = ATA_MWDMA2, \
.udma_mask = udma, \ .udma_mask = udma, \
...@@ -397,8 +400,7 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { ...@@ -397,8 +400,7 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = {
.init_hwif = init_hwif_pdc202xx, .init_hwif = init_hwif_pdc202xx,
.init_dma = init_dma_pdc202xx, .init_dma = init_dma_pdc202xx,
.extra = 16, .extra = 16,
.host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | .host_flags = IDE_HFLAGS_PDC202XX,
IDE_HFLAG_OFF_BOARD,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA2, .udma_mask = ATA_UDMA2,
......
...@@ -203,20 +203,11 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -203,20 +203,11 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed)
pci_read_config_byte(dev, 0x54, &reg54); pci_read_config_byte(dev, 0x54, &reg54);
pci_read_config_byte(dev, 0x55, &reg55); pci_read_config_byte(dev, 0x55, &reg55);
switch(speed) {
case XFER_UDMA_4:
case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break;
case XFER_UDMA_5:
case XFER_UDMA_3:
case XFER_UDMA_1: u_speed = 1 << (drive->dn * 4); break;
case XFER_UDMA_0: u_speed = 0 << (drive->dn * 4); break;
case XFER_MW_DMA_2:
case XFER_MW_DMA_1:
case XFER_SW_DMA_2: break;
default: return;
}
if (speed >= XFER_UDMA_0) { if (speed >= XFER_UDMA_0) {
u8 udma = speed - XFER_UDMA_0;
u_speed = min_t(u8, 2 - (udma & 1), udma) << (drive->dn * 4);
if (!(reg48 & u_flag)) if (!(reg48 & u_flag))
pci_write_config_byte(dev, 0x48, reg48 | u_flag); pci_write_config_byte(dev, 0x48, reg48 | u_flag);
if (speed == XFER_UDMA_5) { if (speed == XFER_UDMA_5) {
......
...@@ -135,59 +135,29 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) ...@@ -135,59 +135,29 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
unsigned short pci_clock; unsigned short pci_clock;
unsigned int basereg = hwif->channel ? 0x50 : 0x40; unsigned int basereg = hwif->channel ? 0x50 : 0x40;
static const u32 udma_timing[3][3] = {
{ 0x00921250, 0x00911140, 0x00911030 },
{ 0x00932470, 0x00922260, 0x00922140 },
{ 0x009436a1, 0x00933481, 0x00923261 },
};
static const u32 mwdma_timing[3][3] = {
{ 0x00077771, 0x00012121, 0x00002020 },
{ 0x000bbbb2, 0x00024241, 0x00013131 },
{ 0x000ffff3, 0x00035352, 0x00015151 },
};
pci_clock = sc1200_get_pci_clock(); pci_clock = sc1200_get_pci_clock();
/* /*
* Note that each DMA mode has several timings associated with it. * Note that each DMA mode has several timings associated with it.
* The correct timing depends on the fast PCI clock freq. * The correct timing depends on the fast PCI clock freq.
*/ */
timings = 0;
switch (mode) { if (mode >= XFER_UDMA_0)
case XFER_UDMA_0: timings = udma_timing[pci_clock][mode - XFER_UDMA_0];
switch (pci_clock) { else
case PCI_CLK_33: timings = 0x00921250; break; timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0];
case PCI_CLK_48: timings = 0x00932470; break;
case PCI_CLK_66: timings = 0x009436a1; break;
}
break;
case XFER_UDMA_1:
switch (pci_clock) {
case PCI_CLK_33: timings = 0x00911140; break;
case PCI_CLK_48: timings = 0x00922260; break;
case PCI_CLK_66: timings = 0x00933481; break;
}
break;
case XFER_UDMA_2:
switch (pci_clock) {
case PCI_CLK_33: timings = 0x00911030; break;
case PCI_CLK_48: timings = 0x00922140; break;
case PCI_CLK_66: timings = 0x00923261; break;
}
break;
case XFER_MW_DMA_0:
switch (pci_clock) {
case PCI_CLK_33: timings = 0x00077771; break;
case PCI_CLK_48: timings = 0x000bbbb2; break;
case PCI_CLK_66: timings = 0x000ffff3; break;
}
break;
case XFER_MW_DMA_1:
switch (pci_clock) {
case PCI_CLK_33: timings = 0x00012121; break;
case PCI_CLK_48: timings = 0x00024241; break;
case PCI_CLK_66: timings = 0x00035352; break;
}
break;
case XFER_MW_DMA_2:
switch (pci_clock) {
case PCI_CLK_33: timings = 0x00002020; break;
case PCI_CLK_48: timings = 0x00013131; break;
case PCI_CLK_66: timings = 0x00015151; break;
}
break;
default:
return;
}
if (unit == 0) { /* are we configuring drive0? */ if (unit == 0) { /* are we configuring drive0? */
pci_read_config_dword(hwif->pci_dev, basereg+4, &reg); pci_read_config_dword(hwif->pci_dev, basereg+4, &reg);
...@@ -260,66 +230,39 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -260,66 +230,39 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static ide_hwif_t *lookup_pci_dev (ide_hwif_t *prev, struct pci_dev *dev) struct sc1200_saved_state {
{ u32 regs[8];
int h; };
for (h = 0; h < MAX_HWIFS; h++) {
ide_hwif_t *hwif = &ide_hwifs[h];
if (prev) {
if (hwif == prev)
prev = NULL; // found previous, now look for next match
} else {
if (hwif && hwif->pci_dev == dev)
return hwif; // found next match
}
}
return NULL; // not found
}
typedef struct sc1200_saved_state_s {
__u32 regs[4];
} sc1200_saved_state_t;
static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
{ {
ide_hwif_t *hwif = NULL;
printk("SC1200: suspend(%u)\n", state.event); printk("SC1200: suspend(%u)\n", state.event);
/*
* we only save state when going from full power to less
*/
if (state.event == PM_EVENT_ON) { if (state.event == PM_EVENT_ON) {
// we only save state when going from full power to less struct sc1200_saved_state *ss;
unsigned int r;
//
// Loop over all interfaces that are part of this PCI device: /*
// * allocate a permanent save area, if not already allocated
while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { */
sc1200_saved_state_t *ss; ss = (struct sc1200_saved_state *)pci_get_drvdata(dev);
unsigned int basereg, r;
//
// allocate a permanent save area, if not already allocated
//
ss = (sc1200_saved_state_t *)hwif->config_data;
if (ss == NULL) { if (ss == NULL) {
ss = kmalloc(sizeof(sc1200_saved_state_t), GFP_KERNEL); ss = kmalloc(sizeof(*ss), GFP_KERNEL);
if (ss == NULL) if (ss == NULL)
return -ENOMEM; return -ENOMEM;
hwif->config_data = (unsigned long)ss; pci_set_drvdata(dev, ss);
}
ss = (sc1200_saved_state_t *)hwif->config_data;
//
// Save timing registers: this may be unnecessary if
// BIOS also does it
//
basereg = hwif->channel ? 0x50 : 0x40;
for (r = 0; r < 4; ++r) {
pci_read_config_dword (hwif->pci_dev, basereg + (r<<2), &ss->regs[r]);
}
}
} }
/* You don't need to iterate over disks -- sysfs should have done that for you already */ /*
* save timing registers
* (this may be unnecessary if BIOS also does it)
*/
for (r = 0; r < 8; r++)
pci_read_config_dword(dev, 0x40 + r * 4, &ss->regs[r]);
}
pci_disable_device(dev); pci_disable_device(dev);
pci_set_power_state(dev, pci_choose_state(dev, state)); pci_set_power_state(dev, pci_choose_state(dev, state));
...@@ -328,30 +271,25 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) ...@@ -328,30 +271,25 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
static int sc1200_resume (struct pci_dev *dev) static int sc1200_resume (struct pci_dev *dev)
{ {
ide_hwif_t *hwif = NULL; struct sc1200_saved_state *ss;
unsigned int r;
int i; int i;
i = pci_enable_device(dev); i = pci_enable_device(dev);
if (i) if (i)
return i; return i;
// ss = (struct sc1200_saved_state *)pci_get_drvdata(dev);
// loop over all interfaces that are part of this pci device:
// /*
while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { * restore timing registers
unsigned int basereg, r; * (this may be unnecessary if BIOS also does it)
sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; */
if (ss) {
// for (r = 0; r < 8; r++)
// Restore timing registers: this may be unnecessary if BIOS also does it pci_write_config_dword(dev, 0x40 + r * 4, ss->regs[r]);
//
basereg = hwif->channel ? 0x50 : 0x40;
if (ss != NULL) {
for (r = 0; r < 4; ++r) {
pci_write_config_dword(hwif->pci_dev, basereg + (r<<2), ss->regs[r]);
}
}
} }
return 0; return 0;
} }
#endif #endif
......
...@@ -254,19 +254,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -254,19 +254,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed)
offset = 0; /* 100MHz */ offset = 0; /* 100MHz */
} }
switch (speed) {
case XFER_UDMA_6:
case XFER_UDMA_5:
case XFER_UDMA_4:
case XFER_UDMA_3:
case XFER_UDMA_2:
case XFER_UDMA_1:
case XFER_UDMA_0:
idx = speed - XFER_UDMA_0; idx = speed - XFER_UDMA_0;
break;
default:
return;
}
jcactsel = JCACTSELtbl[offset][idx]; jcactsel = JCACTSELtbl[offset][idx];
if (is_slave) { if (is_slave) {
......
...@@ -366,12 +366,17 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) ...@@ -366,12 +366,17 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
} }
} }
#define IDE_HFLAGS_SVWKS \
(IDE_HFLAG_LEGACY_IRQS | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_BOOTABLE)
static const struct ide_port_info serverworks_chipsets[] __devinitdata = { static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
.name = "SvrWks OSB4", .name = "SvrWks OSB4",
.init_chipset = init_chipset_svwks, .init_chipset = init_chipset_svwks,
.init_hwif = init_hwif_svwks, .init_hwif = init_hwif_svwks,
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAGS_SVWKS,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = 0x00, /* UDMA is problematic on OSB4 */ .udma_mask = 0x00, /* UDMA is problematic on OSB4 */
...@@ -379,7 +384,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = { ...@@ -379,7 +384,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
.name = "SvrWks CSB5", .name = "SvrWks CSB5",
.init_chipset = init_chipset_svwks, .init_chipset = init_chipset_svwks,
.init_hwif = init_hwif_svwks, .init_hwif = init_hwif_svwks,
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAGS_SVWKS,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
...@@ -387,7 +392,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = { ...@@ -387,7 +392,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
.name = "SvrWks CSB6", .name = "SvrWks CSB6",
.init_chipset = init_chipset_svwks, .init_chipset = init_chipset_svwks,
.init_hwif = init_hwif_svwks, .init_hwif = init_hwif_svwks,
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE, .host_flags = IDE_HFLAGS_SVWKS,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
...@@ -395,8 +400,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = { ...@@ -395,8 +400,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
.name = "SvrWks CSB6", .name = "SvrWks CSB6",
.init_chipset = init_chipset_svwks, .init_chipset = init_chipset_svwks,
.init_hwif = init_hwif_svwks, .init_hwif = init_hwif_svwks,
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE | .host_flags = IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
...@@ -404,8 +408,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = { ...@@ -404,8 +408,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
.name = "SvrWks HT1000", .name = "SvrWks HT1000",
.init_chipset = init_chipset_svwks, .init_chipset = init_chipset_svwks,
.init_hwif = init_hwif_svwks, .init_hwif = init_hwif_svwks,
.host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE | .host_flags = IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE,
IDE_HFLAG_BOOTABLE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
......
...@@ -582,7 +582,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif) ...@@ -582,7 +582,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
hwif->pre_reset = NULL; /* No HBA specific pre_set needed */ hwif->pre_reset = NULL; /* No HBA specific pre_set needed */
hwif->resetproc = &sgiioc4_resetproc;/* Reset DMA engine, hwif->resetproc = &sgiioc4_resetproc;/* Reset DMA engine,
clear interrupts */ clear interrupts */
hwif->intrproc = NULL; /* Enable or Disable interrupt from drive */
hwif->maskproc = &sgiioc4_maskproc; /* Mask on/off NIEN register */ hwif->maskproc = &sgiioc4_maskproc; /* Mask on/off NIEN register */
hwif->quirkproc = NULL; hwif->quirkproc = NULL;
hwif->busproc = NULL; hwif->busproc = NULL;
......
...@@ -278,27 +278,14 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -278,27 +278,14 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
scsc = is_sata(hwif) ? 1 : scsc; scsc = is_sata(hwif) ? 1 : scsc;
switch(speed) { if (speed >= XFER_UDMA_0) {
case XFER_MW_DMA_2:
case XFER_MW_DMA_1:
case XFER_MW_DMA_0:
multi = dma[speed - XFER_MW_DMA_0];
mode |= ((unit) ? 0x20 : 0x02);
break;
case XFER_UDMA_6:
case XFER_UDMA_5:
case XFER_UDMA_4:
case XFER_UDMA_3:
case XFER_UDMA_2:
case XFER_UDMA_1:
case XFER_UDMA_0:
multi = dma[2]; multi = dma[2];
ultra |= ((scsc) ? (ultra6[speed - XFER_UDMA_0]) : ultra |= (scsc ? ultra6[speed - XFER_UDMA_0] :
(ultra5[speed - XFER_UDMA_0])); ultra5[speed - XFER_UDMA_0]);
mode |= ((unit) ? 0x30 : 0x03); mode |= (unit ? 0x30 : 0x03);
break; } else {
default: multi = dma[speed - XFER_MW_DMA_0];
return; mode |= (unit ? 0x20 : 0x02);
} }
if (hwif->mmio) { if (hwif->mmio) {
......
...@@ -305,59 +305,56 @@ static void sis_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -305,59 +305,56 @@ static void sis_set_pio_mode(ide_drive_t *drive, const u8 pio)
sis_program_timings(drive, XFER_PIO_0 + pio); sis_program_timings(drive, XFER_PIO_0 + pio);
} }
static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed) static void sis_ata133_program_udma_timings(ide_drive_t *drive, const u8 mode)
{ {
ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = drive->hwif->pci_dev;
struct pci_dev *dev = hwif->pci_dev;
/* Config chip for mode */
switch(speed) {
case XFER_UDMA_6:
case XFER_UDMA_5:
case XFER_UDMA_4:
case XFER_UDMA_3:
case XFER_UDMA_2:
case XFER_UDMA_1:
case XFER_UDMA_0:
if (chipset_family >= ATA_133) {
u32 regdw = 0; u32 regdw = 0;
u8 drive_pci = sis_ata133_get_base(drive); u8 drive_pci = sis_ata133_get_base(drive), clk, idx;
pci_read_config_dword(dev, drive_pci, &regdw); pci_read_config_dword(dev, drive_pci, &regdw);
regdw |= 0x04; regdw |= 0x04;
regdw &= 0xfffff00f; regdw &= 0xfffff00f;
/* check if ATA133 enable */ /* check if ATA133 enable */
if (regdw & 0x08) { clk = (regdw & 0x08) ? ATA_133 : ATA_100;
regdw |= (unsigned long)cycle_time_value[ATA_133][speed-XFER_UDMA_0] << 4; idx = mode - XFER_UDMA_0;
regdw |= (unsigned long)cvs_time_value[ATA_133][speed-XFER_UDMA_0] << 8; regdw |= cycle_time_value[clk][idx] << 4;
} else { regdw |= cvs_time_value[clk][idx] << 8;
regdw |= (unsigned long)cycle_time_value[ATA_100][speed-XFER_UDMA_0] << 4;
regdw |= (unsigned long)cvs_time_value[ATA_100][speed-XFER_UDMA_0] << 8;
}
pci_write_config_dword(dev, (unsigned long)drive_pci, regdw);
} else {
u8 drive_pci = 0x40 + drive->dn * 2, reg = 0;
pci_read_config_byte(dev, drive_pci+1, &reg); pci_write_config_dword(dev, drive_pci, regdw);
/* Force the UDMA bit on if we want to use UDMA */ }
static void sis_ata33_program_udma_timings(ide_drive_t *drive, const u8 mode)
{
struct pci_dev *dev = drive->hwif->pci_dev;
u8 drive_pci = 0x40 + drive->dn * 2, reg = 0, i = chipset_family;
pci_read_config_byte(dev, drive_pci + 1, &reg);
/* force the UDMA bit on if we want to use UDMA */
reg |= 0x80; reg |= 0x80;
/* clean reg cycle time bits */ /* clean reg cycle time bits */
reg &= ~((0xFF >> (8 - cycle_time_range[chipset_family])) reg &= ~((0xff >> (8 - cycle_time_range[i])) << cycle_time_offset[i]);
<< cycle_time_offset[chipset_family]);
/* set reg cycle time bits */ /* set reg cycle time bits */
reg |= cycle_time_value[chipset_family][speed-XFER_UDMA_0] reg |= cycle_time_value[i][mode - XFER_UDMA_0] << cycle_time_offset[i];
<< cycle_time_offset[chipset_family];
pci_write_config_byte(dev, drive_pci+1, reg); pci_write_config_byte(dev, drive_pci + 1, reg);
} }
break;
case XFER_MW_DMA_2: static void sis_program_udma_timings(ide_drive_t *drive, const u8 mode)
case XFER_MW_DMA_1: {
case XFER_MW_DMA_0: if (chipset_family >= ATA_133) /* ATA_133 */
sis_ata133_program_udma_timings(drive, mode);
else /* ATA_33/66/100a/100/133a */
sis_ata33_program_udma_timings(drive, mode);
}
static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed)
{
if (speed >= XFER_UDMA_0)
sis_program_udma_timings(drive, speed);
else
sis_program_timings(drive, speed); sis_program_timings(drive, speed);
break;
default:
break;
}
} }
static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) static u8 sis5513_ata133_udma_filter(ide_drive_t *drive)
......
...@@ -115,10 +115,6 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -115,10 +115,6 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n", DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n",
drive->name, ide_xfer_verbose(speed))); drive->name, ide_xfer_verbose(speed)));
switch (speed) {
case XFER_MW_DMA_2:
case XFER_MW_DMA_1:
case XFER_MW_DMA_0:
drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0]; drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0];
/* /*
...@@ -138,10 +134,6 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -138,10 +134,6 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
pci_write_config_word(dev, reg, drv_ctrl); pci_write_config_word(dev, reg, drv_ctrl);
} }
break;
default:
return;
}
} }
/* /*
......
...@@ -91,19 +91,9 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -91,19 +91,9 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
pci_read_config_word(dev, 0x48, &reg48); pci_read_config_word(dev, 0x48, &reg48);
pci_read_config_word(dev, 0x4a, &reg4a); pci_read_config_word(dev, 0x4a, &reg4a);
switch(speed) {
case XFER_UDMA_4: u_speed = 4 << (drive->dn * 4); break;
case XFER_UDMA_3: u_speed = 3 << (drive->dn * 4); break;
case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break;
case XFER_UDMA_1: u_speed = 1 << (drive->dn * 4); break;
case XFER_UDMA_0: u_speed = 0 << (drive->dn * 4); break;
case XFER_MW_DMA_2:
case XFER_MW_DMA_1:
case XFER_SW_DMA_2: break;
default: return;
}
if (speed >= XFER_UDMA_0) { if (speed >= XFER_UDMA_0) {
u_speed = (speed - XFER_UDMA_0) << (drive->dn * 4);
if (!(reg48 & u_flag)) if (!(reg48 & u_flag))
pci_write_config_word(dev, 0x48, reg48|u_flag); pci_write_config_word(dev, 0x48, reg48|u_flag);
/* FIXME: (reg4a & a_speed) ? */ /* FIXME: (reg4a & a_speed) ? */
......
...@@ -222,7 +222,8 @@ static const struct ide_port_info tc86c001_chipset __devinitdata = { ...@@ -222,7 +222,8 @@ static const struct ide_port_info tc86c001_chipset __devinitdata = {
.name = "TC86C001", .name = "TC86C001",
.init_chipset = init_chipset_tc86c001, .init_chipset = init_chipset_tc86c001,
.init_hwif = init_hwif_tc86c001, .init_hwif = init_hwif_tc86c001,
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_OFF_BOARD, .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_OFF_BOARD |
IDE_HFLAG_ABUSE_SET_DMA_MODE,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2, .mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
......
...@@ -81,8 +81,6 @@ static void triflex_set_mode(ide_drive_t *drive, const u8 speed) ...@@ -81,8 +81,6 @@ static void triflex_set_mode(ide_drive_t *drive, const u8 speed)
case XFER_PIO_0: case XFER_PIO_0:
timing = 0x0808; timing = 0x0808;
break; break;
default:
return;
} }
triflex_timings &= ~(0xFFFF << (16 * unit)); triflex_timings &= ~(0xFFFF << (16 * unit));
......
...@@ -439,6 +439,7 @@ static const struct ide_port_info via82cxxx_chipset __devinitdata = { ...@@ -439,6 +439,7 @@ static const struct ide_port_info via82cxxx_chipset __devinitdata = {
.enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST |
IDE_HFLAG_PIO_NO_DOWNGRADE | IDE_HFLAG_PIO_NO_DOWNGRADE |
IDE_HFLAG_ABUSE_SET_DMA_MODE |
IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_POST_SET_MODE |
IDE_HFLAG_IO_32BIT | IDE_HFLAG_IO_32BIT |
IDE_HFLAG_BOOTABLE, IDE_HFLAG_BOOTABLE,
......
...@@ -438,13 +438,8 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw, ...@@ -438,13 +438,8 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw,
if (data_port == pmac_ide[ix].regbase) if (data_port == pmac_ide[ix].regbase)
break; break;
if (ix >= MAX_HWIFS) { if (ix >= MAX_HWIFS)
/* Probably a PCI interface... */ return; /* not an IDE PMAC interface */
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i)
hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET;
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
return;
}
for (i = 0; i < 8; ++i) for (i = 0; i < 8; ++i)
hw->io_ports[i] = data_port + i * 0x10; hw->io_ports[i] = data_port + i * 0x10;
...@@ -833,15 +828,8 @@ static void pmac_ide_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -833,15 +828,8 @@ static void pmac_ide_set_dma_mode(ide_drive_t *drive, const u8 speed)
tl[0] = *timings; tl[0] = *timings;
tl[1] = *timings2; tl[1] = *timings2;
switch(speed) {
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
case XFER_UDMA_6: if (speed >= XFER_UDMA_0) {
case XFER_UDMA_5:
case XFER_UDMA_4:
case XFER_UDMA_3:
case XFER_UDMA_2:
case XFER_UDMA_1:
case XFER_UDMA_0:
if (pmif->kind == controller_kl_ata4) if (pmif->kind == controller_kl_ata4)
ret = set_timings_udma_ata4(&tl[0], speed); ret = set_timings_udma_ata4(&tl[0], speed);
else if (pmif->kind == controller_un_ata6 else if (pmif->kind == controller_un_ata6
...@@ -850,21 +838,10 @@ static void pmac_ide_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -850,21 +838,10 @@ static void pmac_ide_set_dma_mode(ide_drive_t *drive, const u8 speed)
else if (pmif->kind == controller_sh_ata6) else if (pmif->kind == controller_sh_ata6)
ret = set_timings_udma_shasta(&tl[0], &tl[1], speed); ret = set_timings_udma_shasta(&tl[0], &tl[1], speed);
else else
ret = 1; ret = -1;
break; } else
case XFER_MW_DMA_2:
case XFER_MW_DMA_1:
case XFER_MW_DMA_0:
set_timings_mdma(drive, pmif->kind, &tl[0], &tl[1], speed); set_timings_mdma(drive, pmif->kind, &tl[0], &tl[1], speed);
break;
case XFER_SW_DMA_2:
case XFER_SW_DMA_1:
case XFER_SW_DMA_0:
return;
#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
default:
ret = 1;
}
if (ret) if (ret)
return; return;
......
...@@ -395,14 +395,12 @@ static int idescsi_expiry(ide_drive_t *drive) ...@@ -395,14 +395,12 @@ static int idescsi_expiry(ide_drive_t *drive)
static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
{ {
idescsi_scsi_t *scsi = drive_to_idescsi(drive); idescsi_scsi_t *scsi = drive_to_idescsi(drive);
idescsi_pc_t *pc=scsi->pc; ide_hwif_t *hwif = drive->hwif;
idescsi_pc_t *pc = scsi->pc;
struct request *rq = pc->rq; struct request *rq = pc->rq;
atapi_bcount_t bcount;
atapi_status_t status;
atapi_ireason_t ireason;
atapi_feature_t feature;
unsigned int temp; unsigned int temp;
u16 bcount;
u8 stat, ireason;
#if IDESCSI_DEBUG_LOG #if IDESCSI_DEBUG_LOG
printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
...@@ -425,30 +423,29 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -425,30 +423,29 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
(void) HWIF(drive)->ide_dma_end(drive); (void) HWIF(drive)->ide_dma_end(drive);
} }
feature.all = 0;
/* Clear the interrupt */ /* Clear the interrupt */
status.all = HWIF(drive)->INB(IDE_STATUS_REG); stat = drive->hwif->INB(IDE_STATUS_REG);
if (!status.b.drq) { if ((stat & DRQ_STAT) == 0) {
/* No more interrupts */ /* No more interrupts */
if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred); printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred);
local_irq_enable_in_hardirq(); local_irq_enable_in_hardirq();
if (status.b.check) if (stat & ERR_STAT)
rq->errors++; rq->errors++;
idescsi_end_request (drive, 1, 0); idescsi_end_request (drive, 1, 0);
return ide_stopped; return ide_stopped;
} }
bcount.b.low = HWIF(drive)->INB(IDE_BCOUNTL_REG); bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
bcount.b.high = HWIF(drive)->INB(IDE_BCOUNTH_REG); hwif->INB(IDE_BCOUNTL_REG);
ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); ireason = hwif->INB(IDE_IREASON_REG);
if (ireason.b.cod) { if (ireason & CD) {
printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n"); printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n");
return ide_do_reset (drive); return ide_do_reset (drive);
} }
if (ireason.b.io) { if (ireason & IO) {
temp = pc->actually_transferred + bcount.all; temp = pc->actually_transferred + bcount;
if (temp > pc->request_transfer) { if (temp > pc->request_transfer) {
if (temp > pc->buffer_size) { if (temp > pc->buffer_size) {
printk(KERN_ERR "ide-scsi: The scsi wants to " printk(KERN_ERR "ide-scsi: The scsi wants to "
...@@ -461,11 +458,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -461,11 +458,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
idescsi_input_buffers(drive, pc, temp); idescsi_input_buffers(drive, pc, temp);
else else
drive->hwif->atapi_input_bytes(drive, pc->current_position, temp); drive->hwif->atapi_input_bytes(drive, pc->current_position, temp);
printk(KERN_ERR "ide-scsi: transferred %d of %d bytes\n", temp, bcount.all); printk(KERN_ERR "ide-scsi: transferred"
" %d of %d bytes\n",
temp, bcount);
} }
pc->actually_transferred += temp; pc->actually_transferred += temp;
pc->current_position += temp; pc->current_position += temp;
idescsi_discard_data(drive, bcount.all - temp); idescsi_discard_data(drive, bcount - temp);
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
return ide_started; return ide_started;
} }
...@@ -474,22 +473,24 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -474,22 +473,24 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
#endif /* IDESCSI_DEBUG_LOG */ #endif /* IDESCSI_DEBUG_LOG */
} }
} }
if (ireason.b.io) { if (ireason & IO) {
clear_bit(PC_WRITING, &pc->flags); clear_bit(PC_WRITING, &pc->flags);
if (pc->sg) if (pc->sg)
idescsi_input_buffers(drive, pc, bcount.all); idescsi_input_buffers(drive, pc, bcount);
else else
HWIF(drive)->atapi_input_bytes(drive, pc->current_position, bcount.all); hwif->atapi_input_bytes(drive, pc->current_position,
bcount);
} else { } else {
set_bit(PC_WRITING, &pc->flags); set_bit(PC_WRITING, &pc->flags);
if (pc->sg) if (pc->sg)
idescsi_output_buffers (drive, pc, bcount.all); idescsi_output_buffers(drive, pc, bcount);
else else
HWIF(drive)->atapi_output_bytes(drive, pc->current_position, bcount.all); hwif->atapi_output_bytes(drive, pc->current_position,
bcount);
} }
/* Update the current position */ /* Update the current position */
pc->actually_transferred += bcount.all; pc->actually_transferred += bcount;
pc->current_position += bcount.all; pc->current_position += bcount;
/* And set the interrupt handler again */ /* And set the interrupt handler again */
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
...@@ -501,16 +502,16 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) ...@@ -501,16 +502,16 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
idescsi_scsi_t *scsi = drive_to_idescsi(drive); idescsi_scsi_t *scsi = drive_to_idescsi(drive);
idescsi_pc_t *pc = scsi->pc; idescsi_pc_t *pc = scsi->pc;
atapi_ireason_t ireason;
ide_startstop_t startstop; ide_startstop_t startstop;
u8 ireason;
if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) { if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
printk(KERN_ERR "ide-scsi: Strange, packet command " printk(KERN_ERR "ide-scsi: Strange, packet command "
"initiated yet DRQ isn't asserted\n"); "initiated yet DRQ isn't asserted\n");
return startstop; return startstop;
} }
ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); ireason = hwif->INB(IDE_IREASON_REG);
if (!ireason.b.cod || ireason.b.io) { if ((ireason & CD) == 0 || (ireason & IO)) {
printk(KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while " printk(KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while "
"issuing a packet command\n"); "issuing a packet command\n");
return ide_do_reset (drive); return ide_do_reset (drive);
...@@ -573,30 +574,26 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) ...@@ -573,30 +574,26 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
{ {
idescsi_scsi_t *scsi = drive_to_idescsi(drive); idescsi_scsi_t *scsi = drive_to_idescsi(drive);
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
atapi_feature_t feature; u16 bcount;
atapi_bcount_t bcount; u8 dma = 0;
scsi->pc=pc; /* Set the current packet command */ scsi->pc=pc; /* Set the current packet command */
pc->actually_transferred=0; /* We haven't transferred any data yet */ pc->actually_transferred=0; /* We haven't transferred any data yet */
pc->current_position=pc->buffer; pc->current_position=pc->buffer;
bcount.all = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */ /* Request to transfer the entire buffer at once */
bcount = min(pc->request_transfer, 63 * 1024);
feature.all = 0;
if (drive->using_dma && !idescsi_map_sg(drive, pc)) { if (drive->using_dma && !idescsi_map_sg(drive, pc)) {
hwif->sg_mapped = 1; hwif->sg_mapped = 1;
feature.b.dma = !hwif->dma_setup(drive); dma = !hwif->dma_setup(drive);
hwif->sg_mapped = 0; hwif->sg_mapped = 0;
} }
SELECT_DRIVE(drive); SELECT_DRIVE(drive);
if (IDE_CONTROL_REG)
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
HWIF(drive)->OUTB(feature.all, IDE_FEATURE_REG); ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma);
HWIF(drive)->OUTB(bcount.b.high, IDE_BCOUNTH_REG);
HWIF(drive)->OUTB(bcount.b.low, IDE_BCOUNTL_REG);
if (feature.b.dma) if (dma)
set_bit(PC_DMA_OK, &pc->flags); set_bit(PC_DMA_OK, &pc->flags);
if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
......
...@@ -89,11 +89,6 @@ static inline void ide_init_default_hwifs(void) ...@@ -89,11 +89,6 @@ static inline void ide_init_default_hwifs(void)
} }
} }
/* some configuration options we don't need */
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASMCRIS_IDE_H */ #endif /* __ASMCRIS_IDE_H */
...@@ -48,11 +48,6 @@ static inline unsigned long ide_default_io_base(int index) ...@@ -48,11 +48,6 @@ static inline unsigned long ide_default_io_base(int index)
return REG_TYPE_CONV(unsigned long, reg_ata_rw_ctrl2, ctrl2); return REG_TYPE_CONV(unsigned long, reg_ata_rw_ctrl2, ctrl2);
} }
/* some configuration options we don't need */
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#define IDE_ARCH_ACK_INTR #define IDE_ARCH_ACK_INTR
#define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif)) #define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif))
......
...@@ -18,12 +18,6 @@ ...@@ -18,12 +18,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#ifndef MAX_HWIFS #ifndef MAX_HWIFS
#define MAX_HWIFS 8 #define MAX_HWIFS 8
#endif #endif
......
...@@ -42,9 +42,6 @@ struct ide_machdep_calls { ...@@ -42,9 +42,6 @@ struct ide_machdep_calls {
extern struct ide_machdep_calls ppc_ide_md; extern struct ide_machdep_calls ppc_ide_md;
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#define IDE_ARCH_OBSOLETE_DEFAULTS #define IDE_ARCH_OBSOLETE_DEFAULTS
static __inline__ int ide_default_irq(unsigned long base) static __inline__ int ide_default_irq(unsigned long base)
......
...@@ -144,7 +144,6 @@ enum rq_cmd_type_bits { ...@@ -144,7 +144,6 @@ enum rq_cmd_type_bits {
* private REQ_LB opcodes to differentiate what type of request this is * private REQ_LB opcodes to differentiate what type of request this is
*/ */
REQ_TYPE_ATA_CMD, REQ_TYPE_ATA_CMD,
REQ_TYPE_ATA_TASK,
REQ_TYPE_ATA_TASKFILE, REQ_TYPE_ATA_TASKFILE,
REQ_TYPE_ATA_PC, REQ_TYPE_ATA_PC,
}; };
......
...@@ -44,7 +44,9 @@ ...@@ -44,7 +44,9 @@
/* Bits for HD_ERROR */ /* Bits for HD_ERROR */
#define MARK_ERR 0x01 /* Bad address mark */ #define MARK_ERR 0x01 /* Bad address mark */
#define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
#define TRK0_ERR 0x02 /* couldn't find track 0 */ #define TRK0_ERR 0x02 /* couldn't find track 0 */
#define EOM_ERR 0x02 /* End Of Media (ATAPI) */
#define ABRT_ERR 0x04 /* Command aborted */ #define ABRT_ERR 0x04 /* Command aborted */
#define MCR_ERR 0x08 /* media change request */ #define MCR_ERR 0x08 /* media change request */
#define ID_ERR 0x10 /* ID field not found */ #define ID_ERR 0x10 /* ID field not found */
...@@ -52,6 +54,7 @@ ...@@ -52,6 +54,7 @@
#define ECC_ERR 0x40 /* Uncorrectable ECC error */ #define ECC_ERR 0x40 /* Uncorrectable ECC error */
#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */ #define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ #define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
#define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
/* Bits of HD_NSECTOR */ /* Bits of HD_NSECTOR */
#define CD 0x01 #define CD 0x01
...@@ -70,13 +73,13 @@ ...@@ -70,13 +73,13 @@
#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
#define IDE_DRIVE_TASK_INVALID -1
#define IDE_DRIVE_TASK_NO_DATA 0 #define IDE_DRIVE_TASK_NO_DATA 0
#ifndef __KERNEL__
#define IDE_DRIVE_TASK_INVALID -1
#define IDE_DRIVE_TASK_SET_XFER 1 #define IDE_DRIVE_TASK_SET_XFER 1
#define IDE_DRIVE_TASK_IN 2 #define IDE_DRIVE_TASK_IN 2
#define IDE_DRIVE_TASK_OUT 3 #define IDE_DRIVE_TASK_OUT 3
#endif
#define IDE_DRIVE_TASK_RAW_WRITE 4 #define IDE_DRIVE_TASK_RAW_WRITE 4
/* /*
...@@ -87,10 +90,10 @@ ...@@ -87,10 +90,10 @@
#ifndef __KERNEL__ #ifndef __KERNEL__
#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
#define IDE_HOB_STD_OUT_FLAGS 0x3C #define IDE_HOB_STD_OUT_FLAGS 0x3C
#endif
typedef unsigned char task_ioreg_t; typedef unsigned char task_ioreg_t;
typedef unsigned long sata_ioreg_t; typedef unsigned long sata_ioreg_t;
#endif
typedef union ide_reg_valid_s { typedef union ide_reg_valid_s {
unsigned all : 16; unsigned all : 16;
...@@ -116,8 +119,8 @@ typedef union ide_reg_valid_s { ...@@ -116,8 +119,8 @@ typedef union ide_reg_valid_s {
} ide_reg_valid_t; } ide_reg_valid_t;
typedef struct ide_task_request_s { typedef struct ide_task_request_s {
task_ioreg_t io_ports[8]; __u8 io_ports[8];
task_ioreg_t hob_ports[8]; __u8 hob_ports[8]; /* bytes 6 and 7 are unused */
ide_reg_valid_t out_flags; ide_reg_valid_t out_flags;
ide_reg_valid_t in_flags; ide_reg_valid_t in_flags;
int data_phase; int data_phase;
...@@ -133,36 +136,35 @@ typedef struct ide_ioctl_request_s { ...@@ -133,36 +136,35 @@ typedef struct ide_ioctl_request_s {
} ide_ioctl_request_t; } ide_ioctl_request_t;
struct hd_drive_cmd_hdr { struct hd_drive_cmd_hdr {
task_ioreg_t command; __u8 command;
task_ioreg_t sector_number; __u8 sector_number;
task_ioreg_t feature; __u8 feature;
task_ioreg_t sector_count; __u8 sector_count;
}; };
#ifndef __KERNEL__
typedef struct hd_drive_task_hdr { typedef struct hd_drive_task_hdr {
task_ioreg_t data; __u8 data;
task_ioreg_t feature; __u8 feature;
task_ioreg_t sector_count; __u8 sector_count;
task_ioreg_t sector_number; __u8 sector_number;
task_ioreg_t low_cylinder; __u8 low_cylinder;
task_ioreg_t high_cylinder; __u8 high_cylinder;
task_ioreg_t device_head; __u8 device_head;
task_ioreg_t command; __u8 command;
} task_struct_t; } task_struct_t;
typedef struct hd_drive_hob_hdr { typedef struct hd_drive_hob_hdr {
task_ioreg_t data; __u8 data;
task_ioreg_t feature; __u8 feature;
task_ioreg_t sector_count; __u8 sector_count;
task_ioreg_t sector_number; __u8 sector_number;
task_ioreg_t low_cylinder; __u8 low_cylinder;
task_ioreg_t high_cylinder; __u8 high_cylinder;
task_ioreg_t device_head; __u8 device_head;
task_ioreg_t control; __u8 control;
} hob_struct_t; } hob_struct_t;
#endif
#define TASKFILE_INVALID 0x7fff
#define TASKFILE_48 0x8000
#define TASKFILE_NO_DATA 0x0000 #define TASKFILE_NO_DATA 0x0000
...@@ -178,12 +180,16 @@ typedef struct hd_drive_hob_hdr { ...@@ -178,12 +180,16 @@ typedef struct hd_drive_hob_hdr {
#define TASKFILE_IN_DMAQ 0x0080 #define TASKFILE_IN_DMAQ 0x0080
#define TASKFILE_OUT_DMAQ 0x0100 #define TASKFILE_OUT_DMAQ 0x0100
#ifndef __KERNEL__
#define TASKFILE_P_IN 0x0200 #define TASKFILE_P_IN 0x0200
#define TASKFILE_P_OUT 0x0400 #define TASKFILE_P_OUT 0x0400
#define TASKFILE_P_IN_DMA 0x0800 #define TASKFILE_P_IN_DMA 0x0800
#define TASKFILE_P_OUT_DMA 0x1000 #define TASKFILE_P_OUT_DMA 0x1000
#define TASKFILE_P_IN_DMAQ 0x2000 #define TASKFILE_P_IN_DMAQ 0x2000
#define TASKFILE_P_OUT_DMAQ 0x4000 #define TASKFILE_P_OUT_DMAQ 0x4000
#define TASKFILE_48 0x8000
#define TASKFILE_INVALID 0x7fff
#endif
/* ATA/ATAPI Commands pre T13 Spec */ /* ATA/ATAPI Commands pre T13 Spec */
#define WIN_NOP 0x00 #define WIN_NOP 0x00
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment