210 lines · plain
1=====================================2Amiga Buddha and Catweasel IDE Driver3=====================================4 5The Amiga Buddha and Catweasel IDE Driver (part of ide.c) was written by6Geert Uytterhoeven based on the following specifications:7 8------------------------------------------------------------------------9 10Register map of the Buddha IDE controller and the11Buddha-part of the Catweasel Zorro-II version12 13The Autoconfiguration has been implemented just as Commodore14described in their manuals, no tricks have been used (for15example leaving some address lines out of the equations...).16If you want to configure the board yourself (for example let17a Linux kernel configure the card), look at the Commodore18Docs. Reading the nibbles should give this information::19 20 Vendor number: 4626 ($1212)21 product number: 0 (42 for Catweasel Z-II)22 Serial number: 023 Rom-vector: $100024 25The card should be a Z-II board, size 64K, not for freemem26list, Rom-Vektor is valid, no second Autoconfig-board on the27same card, no space preference, supports "Shutup_forever".28 29Setting the base address should be done in two steps, just30as the Amiga Kickstart does: The lower nibble of the 8-Bit31address is written to $4a, then the whole Byte is written to32$48, while it doesn't matter how often you're writing to $4a33as long as $48 is not touched. After $48 has been written,34the whole card disappears from $e8 and is mapped to the new35address just written. Make sure $4a is written before $48,36otherwise your chance is only 1:16 to find the board :-).37 38The local memory-map is even active when mapped to $e8:39 40============== ===========================================41$0-$7e Autokonfig-space, see Z-II docs.42 43$80-$7fd reserved44 45$7fe Speed-select Register: Read & Write46 (description see further down)47 48$800-$8ff IDE-Select 0 (Port 0, Register set 0)49 50$900-$9ff IDE-Select 1 (Port 0, Register set 1)51 52$a00-$aff IDE-Select 2 (Port 1, Register set 0)53 54$b00-$bff IDE-Select 3 (Port 1, Register set 1)55 56$c00-$cff IDE-Select 4 (Port 2, Register set 0,57 Catweasel only!)58 59$d00-$dff IDE-Select 5 (Port 3, Register set 1,60 Catweasel only!)61 62$e00-$eff local expansion port, on Catweasel Z-II the63 Catweasel registers are also mapped here.64 Never touch, use multidisk.device!65 66$f00 read only, Byte-access: Bit 7 shows the67 level of the IRQ-line of IDE port 0.68 69$f01-$f3f mirror of $f0070 71$f40 read only, Byte-access: Bit 7 shows the72 level of the IRQ-line of IDE port 1.73 74$f41-$f7f mirror of $f4075 76$f80 read only, Byte-access: Bit 7 shows the77 level of the IRQ-line of IDE port 2.78 (Catweasel only!)79 80$f81-$fbf mirror of $f8081 82$fc0 write-only: Writing any value to this83 register enables IRQs to be passed from the84 IDE ports to the Zorro bus. This mechanism85 has been implemented to be compatible with86 harddisks that are either defective or have87 a buggy firmware and pull the IRQ line up88 while starting up. If interrupts would89 always be passed to the bus, the computer90 might not start up. Once enabled, this flag91 can not be disabled again. The level of the92 flag can not be determined by software93 (what for? Write to me if it's necessary!).94 95$fc1-$fff mirror of $fc096 97$1000-$ffff Buddha-Rom with offset $1000 in the rom98 chip. The addresses $0 to $fff of the rom99 chip cannot be read. Rom is Byte-wide and100 mapped to even addresses.101============== ===========================================102 103The IDE ports issue an INT2. You can read the level of the104IRQ-lines of the IDE-ports by reading from the three (two105for Buddha-only) registers $f00, $f40 and $f80. This way106more than one I/O request can be handled and you can easily107determine what driver has to serve the INT2. Buddha and108Catweasel expansion boards can issue an INT6. A separate109memory map is available for the I/O module and the sysop's110I/O module.111 112The IDE ports are fed by the address lines A2 to A4, just as113the Amiga 1200 and Amiga 4000 IDE ports are. This way114existing drivers can be easily ported to Buddha. A move.l115polls two words out of the same address of IDE port since116every word is mirrored once. movem is not possible, but117it's not necessary either, because you can only speedup11868000 systems with this technique. A 68020 system with119fastmem is faster with move.l.120 121If you're using the mirrored registers of the IDE-ports with122A6=1, the Buddha doesn't care about the speed that you have123selected in the speed register (see further down). With124A6=1 (for example $840 for port 0, register set 0), a 780ns125access is being made. These registers should be used for a126command access to the harddisk/CD-Rom, since command127accesses are Byte-wide and have to be made slower according128to the ATA-X3T9 manual.129 130Now for the speed-register: The register is byte-wide, and131only the upper three bits are used (Bits 7 to 5). Bit 4132must always be set to 1 to be compatible with later Buddha133versions (if I'll ever update this one). I presume that134I'll never use the lower four bits, but they have to be set135to 1 by definition.136 137The values in this table have to be shifted 5 bits to the138left and or'd with $1f (this sets the lower 5 bits).139 140All the timings have in common: Select and IOR/IOW rise at141the same time. IOR and IOW have a propagation delay of142about 30ns to the clocks on the Zorro bus, that's why the143values are no multiple of 71. One clock-cycle is 71ns long144(exactly 70,5 at 14,18 Mhz on PAL systems).145 146value 0 (Default after reset)147 497ns Select (7 clock cycles) , IOR/IOW after 172ns (2 clock cycles)148 (same timing as the Amiga 1200 does on it's IDE port without149 accelerator card)150 151value 1152 639ns Select (9 clock cycles), IOR/IOW after 243ns (3 clock cycles)153 154value 2155 781ns Select (11 clock cycles), IOR/IOW after 314ns (4 clock cycles)156 157value 3158 355ns Select (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)159 160value 4161 355ns Select (5 clock cycles), IOR/IOW after 172ns (2 clock cycles)162 163value 5164 355ns Select (5 clock cycles), IOR/IOW after 243ns (3 clock cycles)165 166value 6167 1065ns Select (15 clock cycles), IOR/IOW after 314ns (4 clock cycles)168 169value 7170 355ns Select, (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)171 172When accessing IDE registers with A6=1 (for example $84x),173the timing will always be mode 0 8-bit compatible, no matter174what you have selected in the speed register:175 176781ns select, IOR/IOW after 4 clock cycles (=314ns) active.177 178All the timings with a very short select-signal (the 355ns179fast accesses) depend on the accelerator card used in the180system: Sometimes two more clock cycles are inserted by the181bus interface, making the whole access 497ns long. This182doesn't affect the reliability of the controller nor the183performance of the card, since this doesn't happen very184often.185 186All the timings are calculated and only confirmed by187measurements that allowed me to count the clock cycles. If188the system is clocked by an oscillator other than 28,37516189Mhz (for example the NTSC-frequency 28,63636 Mhz), each190clock cycle is shortened to a bit less than 70ns (not worth191mentioning). You could think of a small performance boost192by overclocking the system, but you would either need a193multisync monitor, or a graphics card, and your internal194diskdrive would go crazy, that's why you shouldn't tune your195Amiga this way.196 197Giving you the possibility to write software that is198compatible with both the Buddha and the Catweasel Z-II, The199Buddha acts just like a Catweasel Z-II with no device200connected to the third IDE-port. The IRQ-register $f80201always shows a "no IRQ here" on the Buddha, and accesses to202the third IDE port are going into data's Nirwana on the203Buddha.204 205Jens Schönfeld february 19th, 1997206 207updated may 27th, 1997208 209eMail: sysop@nostlgic.tng.oche.de210