lkml.org 
[lkml]   [2001]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH: ps2esdi another one
All,

Here is my second patch for ps2esdi.
This patch corrects/updates DMA access.
In case my mailer mangles it, it is available at
http://www.sound.net/projects/ps2esdi/ps2esdi-2.4.3.patch1

Thanks, and not on the list,
Hal Duston
hald@sound.net
Bring DMA up to date with current MCA_DMA architecture.

Use mca_dma functions and macros.
Replace cli/sti with the DMA spinlock.

--- linux-2.4.3-hdd0/drivers/block/ps2esdi.c Tue Apr 10 00:50:26 2001
+++ linux-2.4.3-hdd1/drivers/block/ps2esdi.c Tue Apr 10 00:51:05 2001
@@ -52,6 +52,7 @@
#include <asm/io.h>
#include <asm/segment.h>
#include <asm/dma.h>
+#include <asm/mca_dma.h>
#include <asm/uaccess.h>

#define PS2ESDI_IRQ 14
@@ -657,33 +658,23 @@
/* prepare for dma - do all the necessary setup */
static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode)
{
- u_int tc;
-
- buffer=(char *)virt_to_bus(buffer);
-
+ unsigned long flags;
#if 0
printk("ps2esdi: b_wait: %p\n", &CURRENT->bh->b_wait);
#endif
- cli();
+ flags = claim_dma_lock();

- outb(dma_arb_level | DMA_MASK_CHAN, PORT_DMA_FN);
+ mca_disable_dma(dma_arb_level);

- outb(dma_arb_level | DMA_WRITE_ADDR, PORT_DMA_FN);
- outb((u_int) buffer & (u_int) 0xff, PORT_DMA_EX);
- outb(((u_int) buffer >> 8) & (u_int) 0xff, PORT_DMA_EX);
- outb(((u_int) buffer >> 16) & (u_int) 0xff, PORT_DMA_EX);
+ mca_set_dma_addr(dma_arb_level, virt_to_bus(buffer));

- outb(dma_arb_level | DMA_WRITE_TC, PORT_DMA_FN);
- tc = (length * SECT_SIZE / 2) - 1;
- outb(tc & 0xff, PORT_DMA_EX);
- outb((tc >> 8) & 0xff, PORT_DMA_EX);
+ mca_set_dma_count(dma_arb_level, length * 512 / 2);

- outb(dma_arb_level | DMA_WRITE_MODE, PORT_DMA_FN);
- outb(dma_xmode, PORT_DMA_EX);
+ mca_set_dma_mode(dma_arb_level, dma_xmode);

- outb(dma_arb_level | DMA_UNMASK_CHAN, PORT_DMA_FN);
+ mca_enable_dma(dma_arb_level);

- sti();
+ release_dma_lock(flags);

} /* prepare for dma */

@@ -861,7 +852,9 @@
switch (int_ret_code & 0x0f) {
case INT_TRANSFER_REQ:
ps2esdi_prep_dma(CURRENT->buffer, CURRENT->current_nr_sectors,
- (CURRENT->cmd == READ) ? DMA_READ_16 : DMA_WRITE_16);
+ (CURRENT->cmd == READ)
+ ? MCA_DMA_MODE_16 | MCA_DMA_MODE_WRITE | MCA_DMA_MODE_XFER
+ : MCA_DMA_MODE_16 | MCA_DMA_MODE_READ);
outb(CTRL_ENABLE_DMA | CTRL_ENABLE_INTR, ESDI_CONTROL);
ending = -1;
break;
\
 
 \ /
  Last update: 2005-03-22 13:25    [W:0.020 / U:1.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site