1: [[!meta title="G-REX"]]
3: Programming the G-REX PCI bridge
5: document version 0 - THIS IS A WORK IN PROGRESS!
7: # 0. Introduction
9: This document describes software/hardware interface of the G-REX PCI bridge for Amiga computers. What you're
10: reading is a result of reverse engineering, which was long and difficult process.
12: Next time when you're going to buy a hardware product for your Amiga, don't forget to ask the vendor to make the
13: programming documentation publicly available! Remeber that hardware without software is just a piece of junk...
14: and you can't write software without hardware documentation.
16: In case you've noticed an error in this document please let me know.
18: # 1. Theory of operation
20: G-REX is an evolution of PCI bridge used previously on CyberVisionPPC and BlizzardVisionPPC cards. These
21: products share a lot of similiarities.
23: Firmware does the dirty job of assigning PCI resources (BARs, interrupt lines, etc.) before the OS is running.
24: Therefore G-REX does not need any special initialization.
26: # 2. Memory map
28: G-REX is configured as multipie AutoConf boards. Confusingly, they all have the same vendor and product ID.
30: 0xFFFA0000 - PCI I/O register space, 64KB.
32: 0xFFFC0000 - PCI configuration space, 128KB.
34: 0xFFFE0000 - Bridge configuration registers, 4kB.
36: 0x80000000 - PCI memory space, variable size and number of boards, depending on cards installed.
38: # 2a. PCI configuration space
40: Access to configuration space is a bit tricky. Be warned that access to addresses not used by G-REX generates bus
41: error (esp. to configuration locations which are unused because there is no card in the slot). Depending on how these
42: errors are supported in your OS, it may be important to trap them and handle correctly.
44: Configuration data for first slot seems to be accessible at +0x1000.
46: [TO BE COMPLETED]
48: # 2b. PCI I/O registers space
50: This space offers access to I/O registers of all PCI cards.
52: BAR addresses in this space are treated as relative to 0xFFFA0000. Card with I/O BAR set to 0x100 will actually be
53: available at 0xFFFA0100.
55: # 2c. PCI memory space
57: This space offers access to memory (and memory-mapped registers) of PCI cards. Each PCI memory BAR is assigned a
58: separate AutoConf board during firmware initialization.
60: Addresses in this space are treated as absolute. Memory BAR register set to 0x80000000 means it is configured at this
63: # 2d. Bridge configuration registers
65: Offset - meaning
66: 0x0000 - Endianness swapper mode, write 0x02 to switch bridge into big endian mode
67: 0x0010 - Interrupt enable, write 0x01 to enable interrupts (INT2 on Amiga side)
69: No need to fiddle with these registers, as they've been already configured properly by the firmware.
71: # 3. Reconfiguring the bus.
73: If needed, it's possible to reconfigure bus just by writing new values into configuration space. Keep in mind that any
74: previously initialized chips will need to be reset and initialized again (for example 3Dfx Voodoo 3, which is
75: initialized by the firmware so it can display early startup menu).
77: # 4. Interrupts
79: All interrupts are converted into Amiga INT2 interrupt. There's no such thing as interrupt acknowledge register.
81: # 5. DMA
83: The bridge is certainly capable of DMA, but it needs further reverse engineering.
85: [TO BE COMPLETED]
87: There were at least two different revisions of G-REX 1200. Later revision probably does support DMA in all slots.
89: G-REX 4000D probably has busmaster DMA capability in all slots.
91: # 6. Sample PCI bridge driver implementation
93: The NetBSD p5pb driver serves as example driver implementation. It was written using the same knowledge that went
94: into this document.
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb