← Documents Documentation/arch/m68k/buddha-driver.rst GitHub 원문 ↗

Linux 6.18.37 · Architecture

Amiga Buddha and Catweasel IDE Driver

Buddha/Catweasel Zorro-II IDE controller의 autoconfiguration, memory map, IRQ와 bus timing을 설명합니다.

Source pathDocumentation/arch/m68k/buddha-driver.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

buddha-driver.rst:1-209

이 specification의 핵심은 card mapping 순서와 IRQ gate, command용 slow mirror access를 구분하는 데 있습니다. Driver는 Zorro-II autoconfiguration 뒤 세 IDE select 영역과 IRQ level register를 사용하고, speed register로 data access timing을 조절합니다.

Buddha IDE access 경로
Zorro-II `$e8``$4a` low nibble`$48` full byte64 KiB local mapIDE select`$f00/$f40/$f80` IRQ`INT2`

Card mapping에서 command/data access와 interrupt 전달까지의 흐름입니다.

Access mode 선택
AccessAddress 특징Timing
Command`A6=1`, 예: `$840`고정 781 ns, 8-bit compatible
Data`A6=0``$7fe` value 0..7
IRQ enable`$fc0` one-way write한 번 enable하면 disable 불가

Command access는 항상 느린 mirror timing을 사용하고 data access는 speed register 값을 따릅니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 =====================================
2 Amiga Buddha and Catweasel IDE Driver
3 =====================================
4
5 The Amiga Buddha and Catweasel IDE Driver (part of ide.c) was written by
6 Geert Uytterhoeven based on the following specifications:
7
8 ------------------------------------------------------------------------
9
10 Register map of the Buddha IDE controller and the
11 Buddha-part of the Catweasel Zorro-II version
12
13 The Autoconfiguration has been implemented just as Commodore
14 described in their manuals, no tricks have been used (for
15 example leaving some address lines out of the equations...).
16 If you want to configure the board yourself (for example let
17 a Linux kernel configure the card), look at the Commodore
18 Docs. 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: 0
23 Rom-vector: $1000
24
25 The card should be a Z-II board, size 64K, not for freemem
26 list, Rom-Vektor is valid, no second Autoconfig-board on the
27 same card, no space preference, supports "Shutup_forever".
28
29 Setting the base address should be done in two steps, just
30 as the Amiga Kickstart does: The lower nibble of the 8-Bit
31 address is written to $4a, then the whole Byte is written to
32 $48, while it doesn't matter how often you're writing to $4a
33 as long as $48 is not touched. After $48 has been written,
34 the whole card disappears from $e8 and is mapped to the new
35 address just written. Make sure $4a is written before $48,
36 otherwise your chance is only 1:16 to find the board :-).
37
38 The 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 reserved
44
45 $7fe Speed-select Register: Read & Write
46 (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 the
63 Catweasel registers are also mapped here.
64 Never touch, use multidisk.device!
65
66 $f00 read only, Byte-access: Bit 7 shows the
67 level of the IRQ-line of IDE port 0.
68
69 $f01-$f3f mirror of $f00
70
71 $f40 read only, Byte-access: Bit 7 shows the
72 level of the IRQ-line of IDE port 1.
73
74 $f41-$f7f mirror of $f40
75
76 $f80 read only, Byte-access: Bit 7 shows the
77 level of the IRQ-line of IDE port 2.
78 (Catweasel only!)
79
80 $f81-$fbf mirror of $f80
81
82 $fc0 write-only: Writing any value to this
83 register enables IRQs to be passed from the
84 IDE ports to the Zorro bus. This mechanism
85 has been implemented to be compatible with
86 harddisks that are either defective or have
87 a buggy firmware and pull the IRQ line up
88 while starting up. If interrupts would
89 always be passed to the bus, the computer
90 might not start up. Once enabled, this flag
91 can not be disabled again. The level of the
92 flag can not be determined by software
93 (what for? Write to me if it's necessary!).
94
95 $fc1-$fff mirror of $fc0
96
97 $1000-$ffff Buddha-Rom with offset $1000 in the rom
98 chip. The addresses $0 to $fff of the rom
99 chip cannot be read. Rom is Byte-wide and
100 mapped to even addresses.
101 ============== ===========================================
102
103 The IDE ports issue an INT2. You can read the level of the
104 IRQ-lines of the IDE-ports by reading from the three (two
105 for Buddha-only) registers $f00, $f40 and $f80. This way
106 more than one I/O request can be handled and you can easily
107 determine what driver has to serve the INT2. Buddha and
108 Catweasel expansion boards can issue an INT6. A separate
109 memory map is available for the I/O module and the sysop's
110 I/O module.
111
112 The IDE ports are fed by the address lines A2 to A4, just as
113 the Amiga 1200 and Amiga 4000 IDE ports are. This way
114 existing drivers can be easily ported to Buddha. A move.l
115 polls two words out of the same address of IDE port since
116 every word is mirrored once. movem is not possible, but
117 it's not necessary either, because you can only speedup
118 68000 systems with this technique. A 68020 system with
119 fastmem is faster with move.l.
120
121 If you're using the mirrored registers of the IDE-ports with
122 A6=1, the Buddha doesn't care about the speed that you have
123 selected in the speed register (see further down). With
124 A6=1 (for example $840 for port 0, register set 0), a 780ns
125 access is being made. These registers should be used for a
126 command access to the harddisk/CD-Rom, since command
127 accesses are Byte-wide and have to be made slower according
128 to the ATA-X3T9 manual.
129
130 Now for the speed-register: The register is byte-wide, and
131 only the upper three bits are used (Bits 7 to 5). Bit 4
132 must always be set to 1 to be compatible with later Buddha
133 versions (if I'll ever update this one). I presume that
134 I'll never use the lower four bits, but they have to be set
135 to 1 by definition.
136
137 The values in this table have to be shifted 5 bits to the
138 left and or'd with $1f (this sets the lower 5 bits).
139
140 All the timings have in common: Select and IOR/IOW rise at
141 the same time. IOR and IOW have a propagation delay of
142 about 30ns to the clocks on the Zorro bus, that's why the
143 values are no multiple of 71. One clock-cycle is 71ns long
144 (exactly 70,5 at 14,18 Mhz on PAL systems).
145
146 value 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 without
149 accelerator card)
150
151 value 1
152 639ns Select (9 clock cycles), IOR/IOW after 243ns (3 clock cycles)
153
154 value 2
155 781ns Select (11 clock cycles), IOR/IOW after 314ns (4 clock cycles)
156
157 value 3
158 355ns Select (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)
159
160 value 4
161 355ns Select (5 clock cycles), IOR/IOW after 172ns (2 clock cycles)
162
163 value 5
164 355ns Select (5 clock cycles), IOR/IOW after 243ns (3 clock cycles)
165
166 value 6
167 1065ns Select (15 clock cycles), IOR/IOW after 314ns (4 clock cycles)
168
169 value 7
170 355ns Select, (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)
171
172 When accessing IDE registers with A6=1 (for example $84x),
173 the timing will always be mode 0 8-bit compatible, no matter
174 what you have selected in the speed register:
175
176 781ns select, IOR/IOW after 4 clock cycles (=314ns) active.
177
178 All the timings with a very short select-signal (the 355ns
179 fast accesses) depend on the accelerator card used in the
180 system: Sometimes two more clock cycles are inserted by the
181 bus interface, making the whole access 497ns long. This
182 doesn't affect the reliability of the controller nor the
183 performance of the card, since this doesn't happen very
184 often.
185
186 All the timings are calculated and only confirmed by
187 measurements that allowed me to count the clock cycles. If
188 the system is clocked by an oscillator other than 28,37516
189 Mhz (for example the NTSC-frequency 28,63636 Mhz), each
190 clock cycle is shortened to a bit less than 70ns (not worth
191 mentioning). You could think of a small performance boost
192 by overclocking the system, but you would either need a
193 multisync monitor, or a graphics card, and your internal
194 diskdrive would go crazy, that's why you shouldn't tune your
195 Amiga this way.
196
197 Giving you the possibility to write software that is
198 compatible with both the Buddha and the Catweasel Z-II, The
199 Buddha acts just like a Catweasel Z-II with no device
200 connected to the third IDE-port. The IRQ-register $f80
201 always shows a "no IRQ here" on the Buddha, and accesses to
202 the third IDE port are going into data's Nirwana on the
203 Buddha.
204
205 Jens Schönfeld february 19th, 1997
206
207 updated may 27th, 1997
208
210

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

문서와 controller 범위

1-18

Amiga Buddha 및 Catweasel IDE driver는 `ide.c`의 일부로 Geert Uytterhoeven이 작성했으며, 이 문서는 그 구현의 근거가 된 Buddha IDE controller와 Catweasel Zorro-II의 Buddha 부분 register specification을 보존합니다.

Autoconfiguration은 Commodore manual의 Zorro-II 규칙을 그대로 구현하며 address line을 고의로 생략하는 식의 우회 기법을 쓰지 않습니다. Linux kernel처럼 board를 직접 configure하려면 Commodore 문서와 아래 nibble 정보를 함께 사용해야 합니다.

Zorro-II autoconfiguration

19-38
Vendor number: 4626 ($1212)
product number: 0 (42 for Catweasel Z-II)
Serial number: 0
Rom-vector: $1000
항목의미
Vendor number`4626` (`$1212`)Individual Computers
Product number`0`Catweasel Z-II는 `42`
Serial number`0`고정값
ROM vector`$1000`유효한 ROM vector

Card는 64 KiB Zorro-II board이며 free-memory list용이 아닙니다. ROM vector는 유효하고 같은 card의 두 번째 Autoconfig board나 address-space preference는 없으며 `Shutup_forever`를 지원합니다.

Base address 설정은 Kickstart와 같은 두 단계입니다. 8-bit address의 하위 nibble을 `$4a`에 먼저 쓰고 전체 byte를 `$48`에 씁니다. `$48`이 쓰이기 전에는 `$4a`를 여러 번 써도 되지만, `$48`을 쓰면 card가 `$e8`에서 사라지고 새 address로 mapping됩니다. 순서를 어기면 board를 찾을 확률이 1/16에 불과합니다.

Local memory map

39-101

Local memory map은 card가 `$e8`에 mapping된 동안에도 활성입니다. 아래 표는 source의 모든 range와 access 특성을 그대로 구조화한 것입니다.

OffsetAccess와 기능
`$0-$7e`Zorro-II 문서에 정의된 Autoconfig space
`$80-$7fd`Reserved
`$7fe`Read/write speed-select register
`$800-$8ff`IDE Select 0: port 0, register set 0
`$900-$9ff`IDE Select 1: port 0, register set 1
`$a00-$aff`IDE Select 2: port 1, register set 0
`$b00-$bff`IDE Select 3: port 1, register set 1
`$c00-$cff`IDE Select 4: port 2, register set 0, Catweasel 전용
`$d00-$dff`IDE Select 5: port 3, register set 1, Catweasel 전용
`$e00-$eff`Local expansion port. Catweasel Z-II register도 여기에 mapping되므로 직접 접근하지 말고 `multidisk.device` 사용
`$f00`Read-only byte. Bit 7은 IDE port 0 IRQ line level
`$f01-$f3f``$f00` mirror
`$f40`Read-only byte. Bit 7은 IDE port 1 IRQ line level
`$f41-$f7f``$f40` mirror
`$f80`Read-only byte. Bit 7은 IDE port 2 IRQ line level, Catweasel 전용
`$f81-$fbf``$f80` mirror
`$fc0`Write-only IRQ enable. 임의 값을 한 번 쓰면 IDE IRQ가 Zorro bus로 전달되며 다시 disable할 수 없고 software로 flag level을 읽을 수 없음
`$fc1-$fff``$fc0` mirror
`$1000-$ffff`Buddha ROM. ROM chip offset `$1000`; chip의 `$0-$fff`는 읽을 수 없고 byte-wide ROM이 even address에 mapping

`$fc0` gate는 부팅 중 IRQ line을 계속 assert하는 결함 disk나 firmware 때문에 system이 시작하지 못하는 상황을 피하기 위한 호환 장치입니다.

IRQ와 IDE register access

102-129

IDE port는 `INT2`를 발생시킵니다. Buddha에는 `$f00`, `$f40`, Catweasel에는 여기에 `$f80`까지 있어 각 IDE port의 IRQ line을 읽고 여러 I/O request 중 어느 driver가 `INT2`를 처리해야 하는지 판별할 수 있습니다. Buddha/Catweasel expansion board는 `INT6`도 발생시킬 수 있으며 일반 I/O module과 sysop I/O module에는 별도 memory map이 있습니다.

IDE port는 Amiga 1200/4000처럼 address line `A2`부터 `A4`를 사용하므로 기존 driver를 쉽게 port할 수 있습니다. 각 word가 한 번 mirror되므로 `move.l`은 같은 IDE address에서 두 word를 읽습니다. `movem`은 불가능하지만 이 기법은 68000에서만 이점이 있고 fast memory를 가진 68020은 `move.l`이 더 빠릅니다.

`A6=1`인 mirror register, 예를 들어 port 0/register set 0의 `$840`을 사용하면 speed register 선택과 무관하게 780 ns access가 적용됩니다. ATA-X3T9가 byte-wide command access를 더 느리게 요구하므로 hard disk/CD-ROM command에는 이 register를 사용해야 합니다.

Speed-select register와 timing

130-176

Speed register는 byte-wide이며 bit 7:5만 timing 값을 담습니다. 향후 Buddha version과의 호환을 위해 bit 4는 항상 1이어야 하고 하위 네 bit도 정의상 1로 설정합니다. 따라서 table의 value를 5 bit 왼쪽으로 shift한 뒤 `$1f`와 OR합니다.

모든 mode에서 Select와 `IOR/IOW`는 함께 상승합니다. `IOR/IOW`에는 Zorro bus clock 대비 약 30 ns propagation delay가 있습니다. PAL 14.18 MHz에서 한 cycle은 정확히 약 70.5 ns이므로 timing이 71의 정수배로만 보이지 않습니다.

ValueSelect`IOR/IOW` active 시점비고
`0`497 ns, 7 cycles172 ns, 2 cyclesReset 기본값, accelerator 없는 A1200 IDE와 동일
`1`639 ns, 9 cycles243 ns, 3 cycles
`2`781 ns, 11 cycles314 ns, 4 cycles
`3`355 ns, 5 cycles101 ns, 1 cycleFast access
`4`355 ns, 5 cycles172 ns, 2 cyclesFast access
`5`355 ns, 5 cycles243 ns, 3 cyclesFast access
`6`1065 ns, 15 cycles314 ns, 4 cycles
`7`355 ns, 5 cycles101 ns, 1 cycleFast access

`A6=1`인 `$84x` 계열 IDE register는 선택값과 무관하게 mode 0 8-bit compatible timing, 즉 Select 781 ns와 4 cycles(314 ns) 뒤 활성 `IOR/IOW`를 사용합니다.

Timing 한계와 board 호환성

177-209

355 ns의 짧은 Select timing은 accelerator card의 bus interface에 따라 두 cycle이 추가되어 전체 497 ns가 되기도 합니다. 이는 드물고 controller 신뢰성이나 card 성능을 해치지 않습니다.

Timing은 cycle을 셀 수 있는 측정으로 확인한 계산값입니다. 28.37516 MHz 대신 NTSC 28.63636 MHz oscillator를 쓰면 cycle이 70 ns보다 조금 짧아지지만 영향은 미미합니다. Overclock은 multisync monitor나 graphics card가 필요하고 internal disk drive를 오동작시키므로 권장하지 않습니다.

Buddha와 Catweasel Z-II를 함께 지원하는 software를 위해 Buddha는 세 번째 IDE port에 device가 없는 Catweasel처럼 동작합니다. Buddha에서 `$f80`은 항상 IRQ 없음으로 보이고 세 번째 port access는 버려집니다.

Specification: Jens Schönfeld, 1997-02-19. Update: 1997-05-27. 연락처: `[email protected]`.