Make this work on a PowerPC system:

- Load the DMA address a byte at a time, and
 - Use bus_space_read_stream_2() instead of bus_space_read_2() when reading
   the byte-stream of configuration data from the card.

Sanity-checked on both i386 and sandpoint.  Reviewed by ad.
This commit is contained in:
briggs 2001-03-10 13:30:55 +00:00
parent a62d9f6fa0
commit 0828a1bcd0
1 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dpt.c,v 1.26 2001/03/07 23:07:15 thorpej Exp $ */ /* $NetBSD: dpt.c,v 1.27 2001/03/10 13:30:55 briggs Exp $ */
/*- /*-
* Copyright (c) 1997, 1998, 1999, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -55,7 +55,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.26 2001/03/07 23:07:15 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.27 2001/03/10 13:30:55 briggs Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -387,7 +387,10 @@ dpt_cmd(sc, cp, addr, eatacmd, icmd)
if (cp == NULL) if (cp == NULL)
addr = 0; addr = 0;
dpt_outl(sc, HA_DMA_BASE, (u_int32_t)addr); dpt_outb(sc, HA_DMA_BASE+0, (addr ) & 0xff);
dpt_outb(sc, HA_DMA_BASE+1, (addr>>8 ) & 0xff);
dpt_outb(sc, HA_DMA_BASE+2, (addr>>16) & 0xff);
dpt_outb(sc, HA_DMA_BASE+3, (addr>>24) & 0xff);
if (eatacmd == CP_IMMEDIATE) { if (eatacmd == CP_IMMEDIATE) {
if (cp == NULL) { if (cp == NULL) {
@ -516,7 +519,7 @@ dpt_readcfg(sc)
/* Begin reading */ /* Begin reading */
while (i--) while (i--)
*p++ = dpt_inw(sc, HA_DATA); *p++ = bus_space_read_stream_2(sc->sc_iot, sc->sc_ioh, HA_DATA);
if ((i = ec->ec_cfglen) > (sizeof(struct eata_cfg) if ((i = ec->ec_cfglen) > (sizeof(struct eata_cfg)
- (int)(&(((struct eata_cfg *)0L)->ec_cfglen)) - (int)(&(((struct eata_cfg *)0L)->ec_cfglen))
@ -530,7 +533,7 @@ dpt_readcfg(sc)
i >>= 1; i >>= 1;
while (i--) while (i--)
*p++ = dpt_inw(sc, HA_DATA); *p++ = bus_space_read_stream_2(sc->sc_iot, sc->sc_ioh, HA_DATA);
/* Flush until we have read 512 bytes. */ /* Flush until we have read 512 bytes. */
i = (512 - j + 1) >> 1; i = (512 - j + 1) >> 1;