README
1Linux for the Q40
2=================
3
4You may try http://www.geocities.com/SiliconValley/Bay/2602/ for
5some up to date information. Booter and other tools will be also
6available from this place or http://ftp.uni-erlangen.de/pub/unix/Linux/680x0/q40/
7and mirrors.
8
9Hints to documentation usually refer to the linux source tree in
10/usr/src/linux/Documentation unless URL given.
11
12It seems IRQ unmasking can't be safely done on a Q40. IRQ probing
13is not implemented - do not try it! (See below)
14
15For a list of kernel command-line options read the documentation for the
16particular device drivers.
17
18The floppy imposes a very high interrupt load on the CPU, approx 30K/s.
19When something blocks interrupts (HD) it will lose some of them, so far
20this is not known to have caused any data loss. On highly loaded systems
21it can make the floppy very slow or practically stop. Other Q40 OS' simply
22poll the floppy for this reason - something that can't be done in Linux.
23Only possible cure is getting a 82072 controller with fifo instead of
24the 8272A.
25
26drivers used by the Q40, apart from the very obvious (console etc.):
27 drivers/char/q40_keyb.c # use PC keymaps for national keyboards
28 serial.c # normal PC driver - any speed
29 lp.c # printer driver
30 genrtc.c # RTC
31 char/joystick/* # most of this should work, not
32 # in default config.in
33 block/q40ide.c # startup for ide
34 ide* # see Documentation/ide/ide.rst
35 floppy.c # normal PC driver, DMA emu in asm/floppy.h
36 # and arch/m68k/kernel/entry.S
37 # see drivers/block/README.fd
38 net/ne.c
39 video/q40fb.c
40 parport/*
41 sound/dmasound_core.c
42 dmasound_q40.c
43
44Various other PC drivers can be enabled simply by adding them to
45arch/m68k/config.in, especially 8 bit devices should be without any
46problems. For cards using 16bit io/mem more care is required, like
47checking byte order issues, hacking memcpy_*_io etc.
48
49
50Debugging
51=========
52
53Upon startup the kernel will usually output "ABCQGHIJ" into the SRAM,
54preceded by the booter signature. This is a trace just in case something
55went wrong during earliest setup stages of head.S.
56**Changed** to preserve SRAM contents by default, this is only done when
57requested - SRAM must start with '%LX$' signature to do this. '-d' option
58to 'lxx' loader enables this.
59
60SRAM can also be used as additional console device, use debug=mem.
61This will save kernel startup msgs into SRAM, the screen will display
62only the penguin - and shell prompt if it gets that far..
63Unfortunately only 2000 bytes are available.
64
65Serial console works and can also be used for debugging, see loader_txt
66
67Most problems seem to be caused by fawlty or badly configured io-cards or
68hard drives anyway.
69Make sure to configure the parallel port as SPP and remove IRQ/DMA jumpers
70for first testing. The Q40 does not support DMA and may have trouble with
71parallel ports version of interrupts.
72
73
74Q40 Hardware Description
75========================
76
77This is just an overview, see asm-m68k/* for details ask if you have any
78questions.
79
80The Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style
81keyboard interface, 1 Programmable LED, 2x8bit DACs and up to 1MB ROM, 1MB
82shadow ROM.
83The Q60 has any of 68060 or 68LC060 and up to 128 MB RAM.
84
85Most interfacing like floppy, IDE, serial and parallel ports is done via ISA
86slots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate
87regions of the memory.
88The main interrupt register IIRQ_REG will indicate whether an IRQ was internal
89or from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs.
90
91The Q40 custom chip is programmable to provide 2 periodic timers:
92 - 50 or 200 Hz - level 2, !!THIS CAN'T BE DISABLED!!
93 - 10 or 20 KHz - level 4, used for dma-sound
94
95Linux uses the 200 Hz interrupt for timer and beep by default.
96
97
98Interrupts
99==========
100
101q40 master chip handles only a subset of level triggered interrupts.
102
103Linux has some requirements wrt interrupt architecture, these are
104to my knowledge:
105 (a) interrupt handler must not be reentered even when sti() is called
106 from within handler
107 (b) working enable/disable_irq
108
109Luckily these requirements are only important for drivers shared
110with other architectures - ide,serial,parallel, ethernet.
111q40ints.c now contains a trivial hack for (a), (b) is more difficult
112because only irq's 4-15 can be disabled - and only all of them at once.
113Thus disable_irq() can effectively block the machine if the driver goes
114asleep.
115One thing to keep in mind when hacking around the interrupt code is
116that there is no way to find out which IRQ caused a request, [EI]IRQ_REG
117displays current state of the various IRQ lines.
118
119Keyboard
120========
121
122q40 receives AT make/break codes from the keyboard, these are translated to
123the PC scancodes x86 Linux uses. So by theory every national keyboard should
124work just by loading the appropriate x86 keytable - see any national-HOWTO.
125
126Unfortunately the AT->PC translation isn't quite trivial and even worse, my
127documentation of it is absolutely minimal - thus some exotic keys may not
128behave exactly as expected.
129
130There is still hope that it can be fixed completely though. If you encounter
131problems, email me ideally this:
132 - exact keypress/release sequence
133 - 'showkey -s' run on q40, non-X session
134 - 'showkey -s' run on a PC, non-X session
135 - AT codes as displayed by the q40 debugging ROM
136btw if the showkey output from PC and Q40 doesn't differ then you have some
137classic configuration problem - don't send me anything in this case
138
139