요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=====================================
Amiga Buddha and Catweasel IDE Driver
=====================================
The Amiga Buddha and Catweasel IDE Driver (part of ide.c) was written by
Geert Uytterhoeven based on the following specifications:
------------------------------------------------------------------------
Register map of the Buddha IDE controller and the
Buddha-part of the Catweasel Zorro-II version
The Autoconfiguration has been implemented just as Commodore
described in their manuals, no tricks have been used (for
example leaving some address lines out of the equations...).
If you want to configure the board yourself (for example let
a Linux kernel configure the card), look at the Commodore
Docs. Reading the nibbles should give this information::
Vendor number: 4626 ($1212)
product number: 0 (42 for Catweasel Z-II)
Serial number: 0
Rom-vector: $1000
The card should be a Z-II board, size 64K, not for freemem
list, Rom-Vektor is valid, no second Autoconfig-board on the
same card, no space preference, supports "Shutup_forever".
Setting the base address should be done in two steps, just
as the Amiga Kickstart does: The lower nibble of the 8-Bit
address is written to $4a, then the whole Byte is written to
$48, while it doesn't matter how often you're writing to $4a
as long as $48 is not touched. After $48 has been written,
the whole card disappears from $e8 and is mapped to the new
address just written. Make sure $4a is written before $48,
otherwise your chance is only 1:16 to find the board :-).
The local memory-map is even active when mapped to $e8:
============== ===========================================
$0-$7e Autokonfig-space, see Z-II docs.
$80-$7fd reserved
$7fe Speed-select Register: Read & Write
(description see further down)
$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 only!)
$d00-$dff IDE-Select 5 (Port 3, Register set 1,
Catweasel only!)
$e00-$eff local expansion port, on Catweasel Z-II the
Catweasel registers are also mapped here.
Never touch, use multidisk.device!
$f00 read only, Byte-access: Bit 7 shows the
level of the IRQ-line of IDE port 0.
$f01-$f3f mirror of $f00
$f40 read only, Byte-access: Bit 7 shows the
level of the IRQ-line of IDE port 1.
$f41-$f7f mirror of $f40
$f80 read only, Byte-access: Bit 7 shows the
level of the IRQ-line of IDE port 2.
(Catweasel only!)
$f81-$fbf mirror of $f80
$fc0 write-only: Writing any value to this
register enables IRQs to be passed from the
IDE ports to the Zorro bus. This mechanism
has been implemented to be compatible with
harddisks that are either defective or have
a buggy firmware and pull the IRQ line up
while starting up. If interrupts would
always be passed to the bus, the computer
might not start up. Once enabled, this flag
can not be disabled again. The level of the
flag can not be determined by software
(what for? Write to me if it's necessary!).
$fc1-$fff mirror of $fc0
$1000-$ffff Buddha-Rom with offset $1000 in the rom
chip. The addresses $0 to $fff of the rom
chip cannot be read. Rom is Byte-wide and
mapped to even addresses.
============== ===========================================
The IDE ports issue an INT2. You can read the level of the
IRQ-lines of the IDE-ports by reading from the three (two
for Buddha-only) registers $f00, $f40 and $f80. This way
more than one I/O request can be handled and you can easily
determine what driver has to serve the INT2. Buddha and
Catweasel expansion boards can issue an INT6. A separate
memory map is available for the I/O module and the sysop's
I/O module.
The IDE ports are fed by the address lines A2 to A4, just as
the Amiga 1200 and Amiga 4000 IDE ports are. This way
existing drivers can be easily ported to Buddha. A move.l
polls two words out of the same address of IDE port since
every word is mirrored once. movem is not possible, but
it's not necessary either, because you can only speedup
68000 systems with this technique. A 68020 system with
fastmem is faster with move.l.
If you're using the mirrored registers of the IDE-ports with
A6=1, the Buddha doesn't care about the speed that you have
selected in the speed register (see further down). With
A6=1 (for example $840 for port 0, register set 0), a 780ns
access is being made. These registers should be used for a
command access to the harddisk/CD-Rom, since command
accesses are Byte-wide and have to be made slower according
to the ATA-X3T9 manual.
Now for the speed-register: The register is byte-wide, and
only the upper three bits are used (Bits 7 to 5). Bit 4
must always be set to 1 to be compatible with later Buddha
versions (if I'll ever update this one). I presume that
I'll never use the lower four bits, but they have to be set
to 1 by definition.
The values in this table have to be shifted 5 bits to the
left and or'd with $1f (this sets the lower 5 bits).
All the timings have in common: Select and IOR/IOW rise at
the same time. IOR and IOW have a propagation delay of
about 30ns to the clocks on the Zorro bus, that's why the
values are no multiple of 71. One clock-cycle is 71ns long
(exactly 70,5 at 14,18 Mhz on PAL systems).
value 0 (Default after reset)
497ns Select (7 clock cycles) , IOR/IOW after 172ns (2 clock cycles)
(same timing as the Amiga 1200 does on it's IDE port without
accelerator card)
value 1
639ns Select (9 clock cycles), IOR/IOW after 243ns (3 clock cycles)
value 2
781ns Select (11 clock cycles), IOR/IOW after 314ns (4 clock cycles)
value 3
355ns Select (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)
value 4
355ns Select (5 clock cycles), IOR/IOW after 172ns (2 clock cycles)
value 5
355ns Select (5 clock cycles), IOR/IOW after 243ns (3 clock cycles)
value 6
1065ns Select (15 clock cycles), IOR/IOW after 314ns (4 clock cycles)
value 7
355ns Select, (5 clock cycles), IOR/IOW after 101ns (1 clock cycle)
When accessing IDE registers with A6=1 (for example $84x),
the timing will always be mode 0 8-bit compatible, no matter
what you have selected in the speed register:
781ns select, IOR/IOW after 4 clock cycles (=314ns) active.
All the timings with a very short select-signal (the 355ns
fast accesses) depend on the accelerator card used in the
system: Sometimes two more clock cycles are inserted by the
bus interface, making the whole access 497ns long. This
doesn't affect the reliability of the controller nor the
performance of the card, since this doesn't happen very
often.
All the timings are calculated and only confirmed by
measurements that allowed me to count the clock cycles. If
the system is clocked by an oscillator other than 28,37516
Mhz (for example the NTSC-frequency 28,63636 Mhz), each
clock cycle is shortened to a bit less than 70ns (not worth
mentioning). You could think of a small performance boost
by overclocking the system, but you would either need a
multisync monitor, or a graphics card, and your internal
diskdrive would go crazy, that's why you shouldn't tune your
Amiga this way.
Giving you the possibility to write software that is
compatible with both the Buddha and the Catweasel Z-II, The
Buddha acts just like a Catweasel Z-II with no device
connected to the third IDE-port. The IRQ-register $f80
always shows a "no IRQ here" on the Buddha, and accesses to
the third IDE port are going into data's Nirwana on the
Buddha.
Jens Schönfeld february 19th, 1997
updated may 27th, 1997
eMail: [email protected]
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
문서와 controller 범위
1-18Amiga 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-38Vendor 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-101Local memory map은 card가 `$e8`에 mapping된 동안에도 활성입니다. 아래 표는 source의 모든 range와 access 특성을 그대로 구조화한 것입니다.
| Offset | Access와 기능 |
|---|---|
| `$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-129IDE 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-176Speed 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의 정수배로만 보이지 않습니다.
| Value | Select | `IOR/IOW` active 시점 | 비고 |
|---|---|---|---|
| `0` | 497 ns, 7 cycles | 172 ns, 2 cycles | Reset 기본값, accelerator 없는 A1200 IDE와 동일 |
| `1` | 639 ns, 9 cycles | 243 ns, 3 cycles | |
| `2` | 781 ns, 11 cycles | 314 ns, 4 cycles | |
| `3` | 355 ns, 5 cycles | 101 ns, 1 cycle | Fast access |
| `4` | 355 ns, 5 cycles | 172 ns, 2 cycles | Fast access |
| `5` | 355 ns, 5 cycles | 243 ns, 3 cycles | Fast access |
| `6` | 1065 ns, 15 cycles | 314 ns, 4 cycles | |
| `7` | 355 ns, 5 cycles | 101 ns, 1 cycle | Fast access |
`A6=1`인 `$84x` 계열 IDE register는 선택값과 무관하게 mode 0 8-bit compatible timing, 즉 Select 781 ns와 4 cycles(314 ns) 뒤 활성 `IOR/IOW`를 사용합니다.
Timing 한계와 board 호환성
177-209355 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]`.
요약과 해설
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을 조절합니다.
Card mapping에서 command/data access와 interrupt 전달까지의 흐름입니다.
Command access는 항상 느린 mirror timing을 사용하고 data access는 speed register 값을 따릅니다.