0001 =====================================
0002 Amiga Buddha and Catweasel IDE Driver
0003 =====================================
0004
0005 The Amiga Buddha and Catweasel IDE Driver (part of ide.c) was written by
0006 Geert Uytterhoeven based on the following specifications:
0007
0008 ------------------------------------------------------------------------
0009
0010 Register map of the Buddha IDE controller and the
0011 Buddha-part of the Catweasel Zorro-II version
0012
0013 The Autoconfiguration has been implemented just as Commodore
0014 described in their manuals, no tricks have been used (for
0015 example leaving some address lines out of the equations...).
0016 If you want to configure the board yourself (for example let
0017 a Linux kernel configure the card), look at the Commodore
0018 Docs. Reading the nibbles should give this information::
0019
0020 Vendor number: 4626 ($1212)
0021 product number: 0 (42 for Catweasel Z-II)
0022 Serial number: 0
0023 Rom-vector: $1000
0024
0025 The card should be a Z-II board, size 64K, not for freemem
0026 list, Rom-Vektor is valid, no second Autoconfig-board on the
0027 same card, no space preference, supports "Shutup_forever".
0028
0029 Setting the base address should be done in two steps, just
0030 as the Amiga Kickstart does: The lower nibble of the 8-Bit
0031 address is written to $4a, then the whole Byte is written to
0032 $48, while it doesn't matter how often you're writing to $4a
0033 as long as $48 is not touched. After $48 has been written,
0034 the whole card disappears from $e8 and is mapped to the new
0035 address just written. Make sure $4a is written before $48,
0036 otherwise your chance is only 1:16 to find the board :-).
0037
0038 The local memory-map is even active when mapped to $e8:
0039
0040 ============== ===========================================
0041 $0-$7e Autokonfig-space, see Z-II docs.
0042
0043 $80-$7fd reserved
0044
0045 $7fe Speed-select Register: Read & Write
0046 (description see further down)
0047
0048 $800-$8ff IDE-Select 0 (Port 0, Register set 0)
0049
0050 $900-$9ff IDE-Select 1 (Port 0, Register set 1)
0051
0052 $a00-$aff IDE-Select 2 (Port 1, Register set 0)
0053
0054 $b00-$bff IDE-Select 3 (Port 1, Register set 1)
0055
0056 $c00-$cff IDE-Select 4 (Port 2, Register set 0,
0057 Catweasel only!)
0058
0059 $d00-$dff IDE-Select 5 (Port 3, Register set 1,
0060 Catweasel only!)
0061
0062 $e00-$eff local expansion port, on Catweasel Z-II the
0063 Catweasel registers are also mapped here.
0064 Never touch, use multidisk.device!
0065
0066 $f00 read only, Byte-access: Bit 7 shows the
0067 level of the IRQ-line of IDE port 0.
0068
0069 $f01-$f3f mirror of $f00
0070
0071 $f40 read only, Byte-access: Bit 7 shows the
0072 level of the IRQ-line of IDE port 1.
0073
0074 $f41-$f7f mirror of $f40
0075
0076 $f80 read only, Byte-access: Bit 7 shows the
0077 level of the IRQ-line of IDE port 2.
0078 (Catweasel only!)
0079
0080 $f81-$fbf mirror of $f80
0081
0082 $fc0 write-only: Writing any value to this
0083 register enables IRQs to be passed from the
0084 IDE ports to the Zorro bus. This mechanism
0085 has been implemented to be compatible with
0086 harddisks that are either defective or have
0087 a buggy firmware and pull the IRQ line up
0088 while starting up. If interrupts would
0089 always be passed to the bus, the computer
0090 might not start up. Once enabled, this flag
0091 can not be disabled again. The level of the
0092 flag can not be determined by software
0093 (what for? Write to me if it's necessary!).
0094
0095 $fc1-$fff mirror of $fc0
0096
0097 $1000-$ffff Buddha-Rom with offset $1000 in the rom
0098 chip. The addresses $0 to $fff of the rom
0099 chip cannot be read. Rom is Byte-wide and
0100 mapped to even addresses.
0101 ============== ===========================================
0102
0103 The IDE ports issue an INT2. You can read the level of the
0104 IRQ-lines of the IDE-ports by reading from the three (two
0105 for Buddha-only) registers $f00, $f40 and $f80. This way
0106 more than one I/O request can be handled and you can easily
0107 determine what driver has to serve the INT2. Buddha and
0108 Catweasel expansion boards can issue an INT6. A separate
0109 memory map is available for the I/O module and the sysop's
0110 I/O module.
0111
0112 The IDE ports are fed by the address lines A2 to A4, just as
0113 the Amiga 1200 and Amiga 4000 IDE ports are. This way
0114 existing drivers can be easily ported to Buddha. A move.l
0115 polls two words out of the same address of IDE port since
0116 every word is mirrored once. movem is not possible, but
0117 it's not necessary either, because you can only speedup
0118 68000 systems with this technique. A 68020 system with
0119 fastmem is faster with move.l.
0120
0121 If you're using the mirrored registers of the IDE-ports with
0122 A6=1, the Buddha doesn't care about the speed that you have
0123 selected in the speed register (see further down). With
0124 A6=1 (for example $840 for port 0, register set 0), a 780ns
0125 access is being made. These registers should be used for a
0126 command access to the harddisk/CD-Rom, since command
0127 accesses are Byte-wide and have to be made slower according
0128 to the ATA-X3T9 manual.
0129
0130 Now for the speed-register: The register is byte-wide, and
0131 only the upper three bits are used (Bits 7 to 5). Bit 4
0132 must always be set to 1 to be compatible with later Buddha
0133 versions (if I'll ever update this one). I presume that
0134 I'll never use the lower four bits, but they have to be set
0135 to 1 by definition.
0136
0137 The values in this table have to be shifted 5 bits to the
0138 left and or'd with $1f (this sets the lower 5 bits).
0139
0140 All the timings have in common: Select and IOR/IOW rise at
0141 the same time. IOR and IOW have a propagation delay of
0142 about 30ns to the clocks on the Zorro bus, that's why the
0143 values are no multiple of 71. One clock-cycle is 71ns long
0144 (exactly 70,5 at 14,18 Mhz on PAL systems).
0145
0146 value 0 (Default after reset)
0147 497ns Select (7 clock cycles) , IOR/IOW after 172ns (2 clock cycles)
0148 (same timing as the Amiga 1200 does on it's IDE port without
0149 accelerator card)
0150
0151 value 1
0152 639ns Select (9 clock cycles), IOR/IOW after 243ns (3 clock cycles)
0153
0154 value 2
0155 781ns Select (11 clock cycles), IOR/IOW after 314ns (4 clock cycles)
0156
0157 value 3
0158 355ns Select (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)
0159
0160 value 4
0161 355ns Select (5 clock cycles), IOR/IOW after 172ns (2 clock cycles)
0162
0163 value 5
0164 355ns Select (5 clock cycles), IOR/IOW after 243ns (3 clock cycles)
0165
0166 value 6
0167 1065ns Select (15 clock cycles), IOR/IOW after 314ns (4 clock cycles)
0168
0169 value 7
0170 355ns Select, (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)
0171
0172 When accessing IDE registers with A6=1 (for example $84x),
0173 the timing will always be mode 0 8-bit compatible, no matter
0174 what you have selected in the speed register:
0175
0176 781ns select, IOR/IOW after 4 clock cycles (=314ns) aktive.
0177
0178 All the timings with a very short select-signal (the 355ns
0179 fast accesses) depend on the accelerator card used in the
0180 system: Sometimes two more clock cycles are inserted by the
0181 bus interface, making the whole access 497ns long. This
0182 doesn't affect the reliability of the controller nor the
0183 performance of the card, since this doesn't happen very
0184 often.
0185
0186 All the timings are calculated and only confirmed by
0187 measurements that allowed me to count the clock cycles. If
0188 the system is clocked by an oscillator other than 28,37516
0189 Mhz (for example the NTSC-frequency 28,63636 Mhz), each
0190 clock cycle is shortened to a bit less than 70ns (not worth
0191 mentioning). You could think of a small performance boost
0192 by overclocking the system, but you would either need a
0193 multisync monitor, or a graphics card, and your internal
0194 diskdrive would go crazy, that's why you shouldn't tune your
0195 Amiga this way.
0196
0197 Giving you the possibility to write software that is
0198 compatible with both the Buddha and the Catweasel Z-II, The
0199 Buddha acts just like a Catweasel Z-II with no device
0200 connected to the third IDE-port. The IRQ-register $f80
0201 always shows a "no IRQ here" on the Buddha, and accesses to
0202 the third IDE port are going into data's Nirwana on the
0203 Buddha.
0204
0205 Jens Schönfeld february 19th, 1997
0206
0207 updated may 27th, 1997
0208
0209 eMail: sysop@nostlgic.tng.oche.de