Subject: RE: NetBSD/ofppc boots multiuser on Pegasos
To: Matt Sealey <matt@genesi-usa.com>
From: Eduardo Horvath <eeh@NetBSD.org>
List: port-ofppc
Date: 07/28/2006 17:29:38
On Fri, 28 Jul 2006, Matt Sealey wrote:

> Problems here; the ISA bus in the Pegasos is not really an ISA bus.
> There is no ISA bus, no ISA slots and no ISA memory. It's actually
> a bunch of PCI-connected LPC devices inside the southbridge, and it
> is offset from the PCI bus (and handled by the PCI controller in
> the northbridge as a PCI IO space, there is no memory there)
> 
> Read the spec, and the above, and realise that the "isa" bus address
> space is NOT mapped through the bridge.

We've been doing this sort of thing on SPARCs for years.  Here's the
layout from the Taco in my office:

    Node 0xf005f8f8
        available:  
81000000.00000000.00000a30.00000000.0000f5d0.
82000000.00000000.00102000.00000000.00efe000.
82000000.00000000.03100000.00000000.bcf00000.
82000000.00000000.e0000000.00000000.10000000
        reg:  
00000400.0f600000.00000000.0000b000.
00000400.0f410000.00000000.00007020.
000007fe.00000000.00000000.00000100.
00000400.0f780000.00000000.00010000
        ranges:  
00000000.00000000.00000000.000007fe.00000000.00000000.01000000.
01000000.00000000.00000000.000007fe.01000000.00000000.01000000.
02000000.00000000.00000000.000007ff.00000000.00000001.00000000.
03000000.00000000.00000000.000007ff.00000000.00000001.00000000
        virtual-dma:  c0000000.20000000
        #virtual-dma-size-cells:  00000001
        #virtual-dma-addr-cells:  00000001
        no-streaming-cache:  
        clock-frequency:  01f78a40
        bus-range:  00000000.00000001
        bus-parity-generated:  
        no-probe-list:  '0'
        compatible: 'pci108e,a801' + 'pci108e,8001'
        name:  'pci'
        device_type:  'pci'
        #address-cells:  00000003
        #size-cells:  00000002
        implementation#:  00000023
        version#:  00000004
        portid:  0000001e
        interrupt-map:  
00001000.00000000.00000000.00000001.f005f8f8.00000010.
00001000.00000000.00000000.00000002.f005f8f8.00000011.
00001000.00000000.00000000.00000003.f005f8f8.00000012.
00001000.00000000.00000000.00000004.f005f8f8.00000013.
00001800.00000000.00000000.00000001.f005f8f8.0000000c.
00001800.00000000.00000000.00000002.f005f8f8.0000000d.
00001800.00000000.00000000.00000003.f005f8f8.0000000e.
00001800.00000000.00000000.00000004.f005f8f8.0000000f.
00002000.00000000.00000000.00000001.f005f8f8.00000008.
00002000.00000000.00000000.00000002.f005f8f8.00000009.
00002000.00000000.00000000.00000003.f005f8f8.0000000a.
00002000.00000000.00000000.00000004.f005f8f8.0000000b.
00002800.00000000.00000000.00000001.f005f8f8.00000004.
00002800.00000000.00000000.00000002.f005f8f8.00000005.
00002800.00000000.00000000.00000003.f005f8f8.00000006.
00002800.00000000.00000000.00000004.f005f8f8.00000007.
00003000.00000000.00000000.00000001.f005f8f8.0000001b.
00004000.00000000.00000000.00000001.f005f8f8.00000024.
00005000.00000000.00000000.00000001.f005f8f8.00000027.
00005800.00000000.00000000.00000001.f005f8f8.00000026.
00006800.00000000.00000000.00000001.f005f8f8.00000018
        ino-bitmap:  090ffff0.0004fcd7
        interrupt-map-mask:  00fff800.00000000.00000000.00000007
        #interrupt-cells:  00000001
        slot-names:  0000003c.50434930.00504349.31005043.49320050.43493300
        interrupts:  00000032.00000030.00000031.00000034.00000021

        Node 0xf0079554
            assigned-addresses:  
81003810.00000000.00000000.00000000.00010000.
82003814.00000000.00000000.00000000.00100000.
82003818.00000000.00000000.00000000.00100000
            interrupt-map:  
00000000.00000320.00000001.f005f8f8.0000002e.
00000000.00000800.00000001.f005f8f8.00000020.
00000000.000003f8.00000001.f005f8f8.0000002c.
00000000.000002e8.00000001.f005f8f8.0000002c
            interrupt-map-mask:  00000003.00ffffff.0000000f
            #interrupt-cells:  00000001
            ranges:  
00000000.00000000.81003810.00000000.00000000.00010000.
00000001.00000000.82003814.00000000.00000000.00100000.
00000002.00000000.82003818.00000000.f0000000.00100000
            reg:  
00003800.00000000.00000000.00000000.00000000.
81003810.00000000.00000000.00000000.00010000.
82003814.00000000.00000000.00000000.00100000.
82003818.00000000.f0000000.00000000.00100000
            #size-cells:  00000001
            #address-cells:  00000002
            name:  'isa'
            devsel-speed:  00000001
            class-code:  00060100
            latency-timer:  00000000
            cache-line-size:  00000000
            max-latency:  00000000
            min-grant:  00000000
            revision-id:  00000000
            device-id:  00001533
            vendor-id:  000010b9


> In theory you should see that ranges is not present, or empty property,
> and back up the tree to the parent bus for the I/O space. In this case
> it's the PCI0 controller on the Discovery II (/pci@4000000/isa@C). And
> in the output you'll see, the PCI IO range is set as 0xFE000000.

How are you supposed to do that?  PCI has:

        #address-cells:  00000003
        #size-cells:  00000002

The ISA bindings are:

            #size-cells:  00000001
            #address-cells:  00000002

The formats are completely different.  How are you supposed to map "isa" 
bus addresses to PCI addresses without a properly defined "ranges" 
property?

Here's a child device on that machine:

            Node 0xf007b938
                interrupt-map:  
00000000.0000005c.00000001.f005f8f8.0000002f
                interrupts:  00000001
                #interrupt-cells:  00000001
                interrupt-map-mask:  00000000.000000ff.00000003
                reg:  00000000.00000320.00000002
                device_type:  'i2c'
                compatible: 'pcf8584'
                #size-cells:  00000000
                #address-cells:  00000002
                name:  'i2c'

What does one on your machine look like?

> 
> The Linux guys are having a hard time with this, I think we did it
> per the specification and definitely what our hardware engineer tells
> me is perfectly reasonable reasoning for it. But nobody has ever used
> an LPC bus under Open Firmware before, the same way we seem to be the
> only people who have a /display node of type "serial" (if the framebuffer
> is disabled)
> 
> The only reason it's in /pci/isa is because nobody looks for an "lpc"
> node for example. Legacy ports go in the legacy ISA bus the same way
> they misnamed it a PCI to ISA bridge when it doesn't implement ISA
> at all.

If you're not going to follow the ISA bindings you should be using a 
different name.  Trying to claim to be an ISA bus but not following the 
bindings will cause any OS code that expects standard behavior to break 
badly.  No wonder the Lunux guys aren't happy.

Eduardo