Subject: Re: personal impression of issues on netbsd/macppc
To: Michael <macallan18@earthlink.net>
From: Tim Kelly <hockey@dialectronics.com>
List: port-macppc
Date: 11/19/2004 20:13:21
Hi Michael,

> > Having to _get_ a video card with I/O space to run X strikes me as
> > not true support for the hardware. 
> Well, that's not the case - we don't have to /get/  video hardware
> into IO space. It's already there and sometimes that's the only way to
> talk to it.

Ok, perhaps this is a lack of understanding on my part. Here are the
three registers and two assigned addresses (configuration registers
don't get assigned an address) for the video device on my 7300:

ff83f9d8: /chaos@f0000000/control@15800,0,0

reg          
          00015800 00000000 00000000 00000000 00000000 
          02015818 00000000 00000000 00000000 04000000 
          02015814 00000000 00000000 00000000 00001000

assigned-addresses      
          82015814 00000000 94000000 00000000 00001000 
          82015818 00000000 90000000 00000000 04000000

Which is the I/O register?

Earlier you referenced the iot. Using the code from bandit.c as an
example, 

        struct ranges {
                u_int32_t pci_hi, pci_mid, pci_lo;
                u_int32_t host;
                u_int32_t size_hi, size_lo;
        } ranges[6], *rp = ranges;

        /* find i/o tag */
        len = OF_getprop(node, "ranges", ranges, sizeof(ranges));
        if (len == -1)
                return;
        while (len >= sizeof(ranges[0])) {
                if ((rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) ==
                     OFW_PCI_PHYS_HI_SPACE_IO)
                        pc->iot = (bus_space_tag_t)rp->host;
                len -= sizeof(ranges[0]);
                rp++;
        }

indicates that the iot on a PCI-Host device comes from the host cell. In
the case of /chaos, this is

ff83dcd0: /chaos@f0000000

name                    6368616f 7300.... ........ ........   "chaos"
<snip>
ranges            
              02000000 00000000 f1000000 f1000000   00000000 01000000 
              01000000 00000000 00000000 f0000000  00000000 00800000
              02000000 00000000 90000000 90000000 00000000 10000000

or 0xf0000000. 

When you are writing to the I/O space on this type of model, where are
you writing to? I haven't had the chance to translate in my head how
OpenBSD does memory mapping to how NetBSD does it, but if you could tell
me where in memory you're writing to when you say you write to I/O
space, I can probably work it through so that I can tie it back to the
device.

thanks,
tim