Subject: Re: bus_space_* with CATS super I/O stuff
To: David Forbes <david@flossy.u-net.com>
From: Chris G. Demetriou <cgd@netbsd.org>
List: port-arm32
Date: 07/04/1999 12:30:00
David Forbes <david@flossy.u-net.com> writes:
> Summary:  Under what circumstances does a bus_space_read_1() return 0xff
> 	rather than the real value?

i can't tell you "does," but I can tell you "should."  8-)

* when the device being read says "0xff," obviously.

* when there is no device responding to the read cycles, and the bus
(hardware, usually, or software for weird implementations where it's
normally done in hardware) arranges for an all-1s result.

ISA I/O accesses (and maybe memory accesses) _do_ fall into that
category, i.e. a read of a non-existant device is supposed to return
all-bits-set.


I dnnno what kinda chip your working on, or how its registers are
layed out, but it sounds to me like they don't necessarily end up
where you think they're going to end up.


Reading your code, a few things pop into mind:

> I can read and write the standard parallel port registers without any
> trouble at all.  The difference, apparently, is that CNFGA, CNFGB and ECR
> are at offsets 0x400, 0x401 and 0x402 whilst the basic registers are at
> 0x00, 0x01 and 0x02. 
> [ ... ]
> The code that give this is:
> 
> 	ppc->ppc_sc = malloc(sizeof(struct ppc_softc),M_DEVBUF,M_NOWAIT);

I'm not sure i want to understand what you're doing here....  (it
seems ... unlikely to be the right thing.)


> 	ppc->ppc_sc->iot = ia->ia_iot;
> 	if (bus_space_map(ppc->ppc_sc->iot, ia->ia_iobase, 0x404, 0,
> 		&ppc->ppc_sc->ioh)) {
> 	  printf("%s: can't map i/o space\n", "GODDAMNED ppc£$%^$%%");
> 	  return (0);
> 	}

FWIW, you probably want two separate mappings for the two
non-contiguous register sets.  on ports which do (proper, hell, ANY!)
bus space accounting, this code will fall over fairly well.

Are you sure that the extended registers are:
	* enabled by the hardware (i.e. the port's not running in
	  'stupid' mode or something), and

	* the system places them in the place you're expecting?


cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.