Subject: Re: asc_vsbus.c: the 64K DMA problem
To: Anders Magnusson <ragge@ludd.luth.se>
From: Chuck Cranor <chuck@research.att.com>
List: port-vax
Date: 09/11/2002 09:35:28
--h31gzZEtNLTqOjlF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Sep 11, 2002 at 11:16:27AM +0200, Anders Magnusson wrote:
> it to 64k some year ago, but obviously the asc driver have it hardcoded:
> 
>         sc->sc_maxxfer = 63 * 1024;
> 
> You should try to change that to MAXPHYS instead and see if it works,
> Please tell how it worked.
> -- Ragge

hi-

    i changed it to 64KB and it seems to work ok, at least for
my simple test program which compares the results of a 64K read
with 2 32K reads.


chuck

--h31gzZEtNLTqOjlF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="64ktest.c"

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>

#define s64K    (64*1024)
#define s32K    (32*1024)

char buf64[s64K];
char buf32[s64K];
char *b32a, *b32b;

main(int argc, char **argv) 

{
  off_t off;
  char *dsk;
  int fd, rv;

  b32a = buf32;
  b32b = b32a + s32K;

  if (argc != 2) errx(1, "usage: 64ktest /dev-file");
  dsk = argv[1];

  if ((fd = open(dsk, O_RDONLY)) < 0) err(1, "open %s", dsk);

  srandom(getpid());
  while (1) {
    off = (random() % 1024) * 512;

    if (lseek(fd, off, SEEK_SET) == -1) err(1, "lseek1");
    rv = read(fd, b32a, s32K);
    if (rv != s32K) err(1, "read b32a");
    rv = read(fd, b32b, s32K);
    if (rv != s32K) err(1, "read b32b");

    if (lseek(fd, off, SEEK_SET) == -1) err(1, "lseek2");
    rv = read(fd, buf64, s64K);
    if (rv != s64K) err(1, "read b64");

    if (bcmp(buf64, buf32, s64K) != 0) errx(1, "bcmp failed");
    printf(".");
    fflush(stdout);
  }
}


--h31gzZEtNLTqOjlF--