diff options
Diffstat (limited to 'board-js2x/slof/pci-bridge_1022_7460.fs')
-rw-r--r-- | board-js2x/slof/pci-bridge_1022_7460.fs | 153 |
1 files changed, 58 insertions, 95 deletions
diff --git a/board-js2x/slof/pci-bridge_1022_7460.fs b/board-js2x/slof/pci-bridge_1022_7460.fs index a570419..3e4a9d1 100644 --- a/board-js2x/slof/pci-bridge_1022_7460.fs +++ b/board-js2x/slof/pci-bridge_1022_7460.fs @@ -1,114 +1,77 @@ -\ ============================================================================= -\ * Copyright (c) 2004, 2005 IBM Corporation -\ * All rights reserved. -\ * This program and the accompanying materials -\ * are made available under the terms of the BSD License -\ * which accompanies this distribution, and is available at -\ * http://www.opensource.org/licenses/bsd-license.php -\ * -\ * Contributors: -\ * IBM Corporation - initial implementation -\ ============================================================================= - +\ ***************************************************************************** +\ * Copyright (c) 2004, 2007 IBM Corporation +\ * All rights reserved. +\ * This program and the accompanying materials +\ * are made available under the terms of the BSD License +\ * which accompanies this distribution, and is available at +\ * http://www.opensource.org/licenses/bsd-license.php +\ * +\ * Contributors: +\ * IBM Corporation - initial implementation +\ ****************************************************************************/ \ AMD 8111 I/O hub. \ See the documentation at http://www.amd.com ; the datasheet for this chip is \ document #24674. - \ First, some master config. Not all of this logically belongs to just \ one function, and certainly not to the LPC bridge; also, we'll \ initialize all functions in "downstream" order, and this code has to be \ run first. So do it now. -00 2042 config-b! -03 2048 config-b! \ Enable LPC, IDE; disable I2C, SMM, AC'97 functions. -00 2049 config-b! \ Disable everything on second bus (USB, 100Mb enet). - -01 204b config-b! \ Enable IO-APIC. -30 fec00000 rb! 0000a010 fec00010 rl!-le -31 fec00000 rb! ff000000 fec00010 rl!-le -32 fec00000 rb! 0000a011 fec00010 rl!-le -33 fec00000 rb! ff000000 fec00010 rl!-le -34 fec00000 rb! 0000a012 fec00010 rl!-le -35 fec00000 rb! ff000000 fec00010 rl!-le -36 fec00000 rb! 0000a013 fec00010 rl!-le -37 fec00000 rb! ff000000 fec00010 rl!-le \ Set PCI IRQs as 10..13. - \ Leave ISA IRQs disabled. - - -\ Device A, function 0: PCI bridge. - -\ We show this bridge in the device-tree, for completeness, as it is -\ impossible to completely disable this device; we don't assign any -\ address space to it though, or enable any transactions through it. -\ Maybe later we want to support the USB functions on its secondary -\ side; but not now. - -new-device s" /ht/pci@3" full-name - -s" pci" 2dup device-name device-type - -: open true ; -: close ; - -finish-device - - -\ Device B, function 0: LPC bridge. - -new-device s" /ht/isa@4" full-name - -\ See the "ISA/EISA/ISA-PnP" OF binding document. - -s" isa" 2dup device-name device-type -\ We have to say it's ISA i.s.o. LPC, as otherwise Linux can't find -\ the serial port for its console. Linux uses the name instead of the -\ device type (and it completely ignores any "compatible" property). - -\ 64kB of ISA I/O space, at PCI devfn 4:0. -1 encode-int 0 encode-int+ -01002000 encode-int+ 0 encode-int+ 0 encode-int+ -10000 encode-int+ s" ranges" property - -: open true ; -: close ; - -\ There's a SIO chip on the LPC bus. -INCLUDE hw/sio.fs - -finish-device - - -\ Device B, function 1: ATA controller. - -new-device s" /ht/ata@4,1" full-name - -s" ata" 2dup device-name device-type -s" ide" compatible - -2108 dup config-l@ 500 or swap config-l! \ Enable native PCI mode. -2104 dup config-l@ 5 or swap config-l! \ Enable I/O, bus master. -2140 dup config-l@ 03 or swap config-l! \ Enable both ports. -10 213c config-b! \ Set IRQ#. - -: open true ; -: close ; - -\ Just assume there is always one disk. -INCLUDE hw/disk.fs - -\ Enable HPET at address fe000000. -fe000001 20a0 config-l! +00 842 config-b! \ Disable 8237 & 8254 & 8259's. We're not a PC. +80 847 config-b! \ Disable EHCI, as it is terminally broken. +03 848 config-b! \ Enable LPC, IDE; disable I2C, SMM, AC'97 functions. +01 849 config-b! \ Enable USB, disable 100Mb enet. +01 84b config-b! \ Enable IO-APIC. + +fec00000 s" ioapic.fs" included +00 init-ioapic + +\ Program PNPIRQ[0,1,2] as IRQ #D,E,F; switch those GPIOs to low-active. + 0b 848 config-b! \ enable devB:3 +7000 b58 config-l! \ map PMxx at pci i/o 7000 + d1 b41 config-b! \ enable access to PMxx space + +\ on JS20 the planar id is encoded in GPIO 29, 30 and 31 +\ >=5 is GA2 else it is GA1 +: (planar-id) ( -- planar-id) + [ 70dd io-c@ 5 rshift 1 and ] LITERAL + [ 70de io-c@ 5 rshift 2 and ] LITERAL + [ 70df io-c@ 5 rshift 4 and ] LITERAL + + + 7 xor +; + +u3? IF ['] (planar-id) to planar-id THEN + +8 70d3 io-c! 8 70d4 io-c! 8 70d5 io-c! \ set the pins to low-active + bimini? IF 5 70c4 io-c! THEN \ on bimini set gpio4 as output and high to power up USB + fec b44 config-w! \ set PNPIRQ pnpirq2 -> f , pnpirq1 -> e pnpirq0 -> c + 51 b41 config-b! \ disable access to PMxx space + 03 848 config-b! \ disable devB:3 + +\ The function of the PCI controller BARs change depending on the mode the +\ controller is in. +\ And the default is legacy mode. Gross. +05 909 config-b! \ Enable native PCI mode. +03 940 config-b! \ Enable both ports. + +\ Enable HPET on 8111, at address fe000000. +fe000001 8a0 config-l! : >hpet fe000000 + ; : hpet@ >hpet rl@-le ; : hpet! >hpet rl!-le ; -INCLUDE hw/freq.fs +INCLUDE freq.fs \ Disable HPET. -0 20a0 config-l! +0 8a0 config-l! + +\ 8111 has only 16 bits of PCI I/O space. Get the address in range. +8000 next-pci-io ! -finish-device +my-space pci-class-name type cr +my-space pci-bridge-generic-setup +s" pci" device-name |