1*4882a593Smuzhiyun===================================== 2*4882a593SmuzhiyunAmiga Buddha and Catweasel IDE Driver 3*4882a593Smuzhiyun===================================== 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunThe Amiga Buddha and Catweasel IDE Driver (part of ide.c) was written by 6*4882a593SmuzhiyunGeert Uytterhoeven based on the following specifications: 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun------------------------------------------------------------------------ 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunRegister map of the Buddha IDE controller and the 11*4882a593SmuzhiyunBuddha-part of the Catweasel Zorro-II version 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunThe Autoconfiguration has been implemented just as Commodore 14*4882a593Smuzhiyundescribed in their manuals, no tricks have been used (for 15*4882a593Smuzhiyunexample leaving some address lines out of the equations...). 16*4882a593SmuzhiyunIf you want to configure the board yourself (for example let 17*4882a593Smuzhiyuna Linux kernel configure the card), look at the Commodore 18*4882a593SmuzhiyunDocs. Reading the nibbles should give this information:: 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun Vendor number: 4626 ($1212) 21*4882a593Smuzhiyun product number: 0 (42 for Catweasel Z-II) 22*4882a593Smuzhiyun Serial number: 0 23*4882a593Smuzhiyun Rom-vector: $1000 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunThe card should be a Z-II board, size 64K, not for freemem 26*4882a593Smuzhiyunlist, Rom-Vektor is valid, no second Autoconfig-board on the 27*4882a593Smuzhiyunsame card, no space preference, supports "Shutup_forever". 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunSetting the base address should be done in two steps, just 30*4882a593Smuzhiyunas the Amiga Kickstart does: The lower nibble of the 8-Bit 31*4882a593Smuzhiyunaddress is written to $4a, then the whole Byte is written to 32*4882a593Smuzhiyun$48, while it doesn't matter how often you're writing to $4a 33*4882a593Smuzhiyunas long as $48 is not touched. After $48 has been written, 34*4882a593Smuzhiyunthe whole card disappears from $e8 and is mapped to the new 35*4882a593Smuzhiyunaddress just written. Make sure $4a is written before $48, 36*4882a593Smuzhiyunotherwise your chance is only 1:16 to find the board :-). 37*4882a593Smuzhiyun 38*4882a593SmuzhiyunThe local memory-map is even active when mapped to $e8: 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun============== =========================================== 41*4882a593Smuzhiyun$0-$7e Autokonfig-space, see Z-II docs. 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun$80-$7fd reserved 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun$7fe Speed-select Register: Read & Write 46*4882a593Smuzhiyun (description see further down) 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun$800-$8ff IDE-Select 0 (Port 0, Register set 0) 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun$900-$9ff IDE-Select 1 (Port 0, Register set 1) 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun$a00-$aff IDE-Select 2 (Port 1, Register set 0) 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun$b00-$bff IDE-Select 3 (Port 1, Register set 1) 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun$c00-$cff IDE-Select 4 (Port 2, Register set 0, 57*4882a593Smuzhiyun Catweasel only!) 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun$d00-$dff IDE-Select 5 (Port 3, Register set 1, 60*4882a593Smuzhiyun Catweasel only!) 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun$e00-$eff local expansion port, on Catweasel Z-II the 63*4882a593Smuzhiyun Catweasel registers are also mapped here. 64*4882a593Smuzhiyun Never touch, use multidisk.device! 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun$f00 read only, Byte-access: Bit 7 shows the 67*4882a593Smuzhiyun level of the IRQ-line of IDE port 0. 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun$f01-$f3f mirror of $f00 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun$f40 read only, Byte-access: Bit 7 shows the 72*4882a593Smuzhiyun level of the IRQ-line of IDE port 1. 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun$f41-$f7f mirror of $f40 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun$f80 read only, Byte-access: Bit 7 shows the 77*4882a593Smuzhiyun level of the IRQ-line of IDE port 2. 78*4882a593Smuzhiyun (Catweasel only!) 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun$f81-$fbf mirror of $f80 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun$fc0 write-only: Writing any value to this 83*4882a593Smuzhiyun register enables IRQs to be passed from the 84*4882a593Smuzhiyun IDE ports to the Zorro bus. This mechanism 85*4882a593Smuzhiyun has been implemented to be compatible with 86*4882a593Smuzhiyun harddisks that are either defective or have 87*4882a593Smuzhiyun a buggy firmware and pull the IRQ line up 88*4882a593Smuzhiyun while starting up. If interrupts would 89*4882a593Smuzhiyun always be passed to the bus, the computer 90*4882a593Smuzhiyun might not start up. Once enabled, this flag 91*4882a593Smuzhiyun can not be disabled again. The level of the 92*4882a593Smuzhiyun flag can not be determined by software 93*4882a593Smuzhiyun (what for? Write to me if it's necessary!). 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun$fc1-$fff mirror of $fc0 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun$1000-$ffff Buddha-Rom with offset $1000 in the rom 98*4882a593Smuzhiyun chip. The addresses $0 to $fff of the rom 99*4882a593Smuzhiyun chip cannot be read. Rom is Byte-wide and 100*4882a593Smuzhiyun mapped to even addresses. 101*4882a593Smuzhiyun============== =========================================== 102*4882a593Smuzhiyun 103*4882a593SmuzhiyunThe IDE ports issue an INT2. You can read the level of the 104*4882a593SmuzhiyunIRQ-lines of the IDE-ports by reading from the three (two 105*4882a593Smuzhiyunfor Buddha-only) registers $f00, $f40 and $f80. This way 106*4882a593Smuzhiyunmore than one I/O request can be handled and you can easily 107*4882a593Smuzhiyundetermine what driver has to serve the INT2. Buddha and 108*4882a593SmuzhiyunCatweasel expansion boards can issue an INT6. A separate 109*4882a593Smuzhiyunmemory map is available for the I/O module and the sysop's 110*4882a593SmuzhiyunI/O module. 111*4882a593Smuzhiyun 112*4882a593SmuzhiyunThe IDE ports are fed by the address lines A2 to A4, just as 113*4882a593Smuzhiyunthe Amiga 1200 and Amiga 4000 IDE ports are. This way 114*4882a593Smuzhiyunexisting drivers can be easily ported to Buddha. A move.l 115*4882a593Smuzhiyunpolls two words out of the same address of IDE port since 116*4882a593Smuzhiyunevery word is mirrored once. movem is not possible, but 117*4882a593Smuzhiyunit's not necessary either, because you can only speedup 118*4882a593Smuzhiyun68000 systems with this technique. A 68020 system with 119*4882a593Smuzhiyunfastmem is faster with move.l. 120*4882a593Smuzhiyun 121*4882a593SmuzhiyunIf you're using the mirrored registers of the IDE-ports with 122*4882a593SmuzhiyunA6=1, the Buddha doesn't care about the speed that you have 123*4882a593Smuzhiyunselected in the speed register (see further down). With 124*4882a593SmuzhiyunA6=1 (for example $840 for port 0, register set 0), a 780ns 125*4882a593Smuzhiyunaccess is being made. These registers should be used for a 126*4882a593Smuzhiyuncommand access to the harddisk/CD-Rom, since command 127*4882a593Smuzhiyunaccesses are Byte-wide and have to be made slower according 128*4882a593Smuzhiyunto the ATA-X3T9 manual. 129*4882a593Smuzhiyun 130*4882a593SmuzhiyunNow for the speed-register: The register is byte-wide, and 131*4882a593Smuzhiyunonly the upper three bits are used (Bits 7 to 5). Bit 4 132*4882a593Smuzhiyunmust always be set to 1 to be compatible with later Buddha 133*4882a593Smuzhiyunversions (if I'll ever update this one). I presume that 134*4882a593SmuzhiyunI'll never use the lower four bits, but they have to be set 135*4882a593Smuzhiyunto 1 by definition. 136*4882a593Smuzhiyun 137*4882a593SmuzhiyunThe values in this table have to be shifted 5 bits to the 138*4882a593Smuzhiyunleft and or'd with $1f (this sets the lower 5 bits). 139*4882a593Smuzhiyun 140*4882a593SmuzhiyunAll the timings have in common: Select and IOR/IOW rise at 141*4882a593Smuzhiyunthe same time. IOR and IOW have a propagation delay of 142*4882a593Smuzhiyunabout 30ns to the clocks on the Zorro bus, that's why the 143*4882a593Smuzhiyunvalues are no multiple of 71. One clock-cycle is 71ns long 144*4882a593Smuzhiyun(exactly 70,5 at 14,18 Mhz on PAL systems). 145*4882a593Smuzhiyun 146*4882a593Smuzhiyunvalue 0 (Default after reset) 147*4882a593Smuzhiyun 497ns Select (7 clock cycles) , IOR/IOW after 172ns (2 clock cycles) 148*4882a593Smuzhiyun (same timing as the Amiga 1200 does on it's IDE port without 149*4882a593Smuzhiyun accelerator card) 150*4882a593Smuzhiyun 151*4882a593Smuzhiyunvalue 1 152*4882a593Smuzhiyun 639ns Select (9 clock cycles), IOR/IOW after 243ns (3 clock cycles) 153*4882a593Smuzhiyun 154*4882a593Smuzhiyunvalue 2 155*4882a593Smuzhiyun 781ns Select (11 clock cycles), IOR/IOW after 314ns (4 clock cycles) 156*4882a593Smuzhiyun 157*4882a593Smuzhiyunvalue 3 158*4882a593Smuzhiyun 355ns Select (5 clock cycles), IOR/IOW after 101ns (1 clock cycle) 159*4882a593Smuzhiyun 160*4882a593Smuzhiyunvalue 4 161*4882a593Smuzhiyun 355ns Select (5 clock cycles), IOR/IOW after 172ns (2 clock cycles) 162*4882a593Smuzhiyun 163*4882a593Smuzhiyunvalue 5 164*4882a593Smuzhiyun 355ns Select (5 clock cycles), IOR/IOW after 243ns (3 clock cycles) 165*4882a593Smuzhiyun 166*4882a593Smuzhiyunvalue 6 167*4882a593Smuzhiyun 1065ns Select (15 clock cycles), IOR/IOW after 314ns (4 clock cycles) 168*4882a593Smuzhiyun 169*4882a593Smuzhiyunvalue 7 170*4882a593Smuzhiyun 355ns Select, (5 clock cycles), IOR/IOW after 101ns (1 clock cycle) 171*4882a593Smuzhiyun 172*4882a593SmuzhiyunWhen accessing IDE registers with A6=1 (for example $84x), 173*4882a593Smuzhiyunthe timing will always be mode 0 8-bit compatible, no matter 174*4882a593Smuzhiyunwhat you have selected in the speed register: 175*4882a593Smuzhiyun 176*4882a593Smuzhiyun781ns select, IOR/IOW after 4 clock cycles (=314ns) aktive. 177*4882a593Smuzhiyun 178*4882a593SmuzhiyunAll the timings with a very short select-signal (the 355ns 179*4882a593Smuzhiyunfast accesses) depend on the accelerator card used in the 180*4882a593Smuzhiyunsystem: Sometimes two more clock cycles are inserted by the 181*4882a593Smuzhiyunbus interface, making the whole access 497ns long. This 182*4882a593Smuzhiyundoesn't affect the reliability of the controller nor the 183*4882a593Smuzhiyunperformance of the card, since this doesn't happen very 184*4882a593Smuzhiyunoften. 185*4882a593Smuzhiyun 186*4882a593SmuzhiyunAll the timings are calculated and only confirmed by 187*4882a593Smuzhiyunmeasurements that allowed me to count the clock cycles. If 188*4882a593Smuzhiyunthe system is clocked by an oscillator other than 28,37516 189*4882a593SmuzhiyunMhz (for example the NTSC-frequency 28,63636 Mhz), each 190*4882a593Smuzhiyunclock cycle is shortened to a bit less than 70ns (not worth 191*4882a593Smuzhiyunmentioning). You could think of a small performance boost 192*4882a593Smuzhiyunby overclocking the system, but you would either need a 193*4882a593Smuzhiyunmultisync monitor, or a graphics card, and your internal 194*4882a593Smuzhiyundiskdrive would go crazy, that's why you shouldn't tune your 195*4882a593SmuzhiyunAmiga this way. 196*4882a593Smuzhiyun 197*4882a593SmuzhiyunGiving you the possibility to write software that is 198*4882a593Smuzhiyuncompatible with both the Buddha and the Catweasel Z-II, The 199*4882a593SmuzhiyunBuddha acts just like a Catweasel Z-II with no device 200*4882a593Smuzhiyunconnected to the third IDE-port. The IRQ-register $f80 201*4882a593Smuzhiyunalways shows a "no IRQ here" on the Buddha, and accesses to 202*4882a593Smuzhiyunthe third IDE port are going into data's Nirwana on the 203*4882a593SmuzhiyunBuddha. 204*4882a593Smuzhiyun 205*4882a593SmuzhiyunJens Schönfeld february 19th, 1997 206*4882a593Smuzhiyun 207*4882a593Smuzhiyunupdated may 27th, 1997 208*4882a593Smuzhiyun 209*4882a593SmuzhiyuneMail: sysop@nostlgic.tng.oche.de 210