Subject: Re: SCSI driver
To: None <mirian@xensei.com>
From: Kazuki Sakamoto <sakamoto@cec.co.jp>
List: port-bebox
Date: 10/16/1998 19:06:02
In <m37ly1f9ns.fsf@trantor.cosmic.com>,
mirian@xensei.com wrote:

 > > I'm testing ncr.c of OpenBSD at NetBSD/bebox.
 > 
 > Is this a different ncr.c from what is on netbsd-current, in
 > /usr/src/sys/dev/pci?

OpenBSD's ncr.c supports big-endian CPU.
OpenBSD/powerpc has configuration for ncr.

 > > There are some problems. First, endian.
 > 
 > I assume because the code originally came from an i386, correct?

Yes. And, it is a problem to work in different endian with CPU(big)
and 53C810(little).

 > > Second, the address of main memory which saw from PCI master.
 > > 
 > > PCI/ISA view         +------------+ 0x00000000
 > >                      | PCI/ISA    |
 > >                      |  memory(2G)|
 > >                      +------------+ 0x80000000
 > >               =====> | main       |
 > >                      |  memory(2G)| script for 53C810.
 > >                      +------------+
 > 
 > Okay, I must confess to some ignorance here.  I'm not sure in your
 > diagram what is supposed to be happening with the memory, versus what
 > is actually happening.  Would you mind explaining it a bit more in
 > depth?

CPU puts SCRIPT on the main memory for 53C810. 53C810 runs SCRIPT
in the main memory. Therefore, SCRIPT must be little-endian.
And, address must be changed in SCRIPT, because memory map of PCI master
is different from memory map of CPU.

See MPC105 PCI Bridge/Memory Controller User's manual, 3.1 Address Maps.
Table 3-1 versus Figure 3-4.
http://www.mot.com/SPS/PowerPC/products/semiconductor/support_chips/105.html
http://www.netbsd.org/Ports/bebox/hardware.html

I am sorry that I can't explain well.

Kazuki Sakamoto
sakamoto@cec.co.jp