aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:49:07 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:49:07 -0400
commitb98adfccdf5f8dd34ae56a2d5adbe2c030bd4674 (patch)
tree1807a029520f550dd4f90c95ad0063bceb00d645 /Documentation
parentba21fe71725f94792330ebc3034ef2b35a36276f (diff)
parent33573c0e3243aaa38b6ad96942de85a1b713c2ff (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6: (108 commits) sh: Fix occasional flush_cache_4096() stack corruption. sh: Calculate shm alignment at runtime. sh: dma-mapping compile fixes. sh: Initial vsyscall page support. sh: Clean up PAGE_SIZE definition for assembly use. sh: Selective flush_cache_mm() flushing. sh: More intelligent entry_mask/way_size calculation. sh: Support for L2 cache on newer SH-4A CPUs. sh: Update kexec support for API changes. sh: Optimized readsl()/writesl() support. sh: Report movli.l/movco.l capabilities. sh: CPU flags in AT_HWCAP in ELF auxvt. sh: Add support for 4K stacks. sh: Enable /proc/kcore support. sh: stack debugging support. sh: select CONFIG_EMBEDDED. sh: machvec rework. sh: Solution Engine SH7343 board support. sh: SH7710VoIPGW board support. sh: Enable verbose BUG() support. ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/sh/new-machine.txt128
-rw-r--r--Documentation/sh/register-banks.txt33
2 files changed, 84 insertions, 77 deletions
diff --git a/Documentation/sh/new-machine.txt b/Documentation/sh/new-machine.txt
index eb2dd2e6993b..73988e0d112b 100644
--- a/Documentation/sh/new-machine.txt
+++ b/Documentation/sh/new-machine.txt
@@ -41,11 +41,6 @@ Board-specific code:
41 | 41 |
42 .. more boards here ... 42 .. more boards here ...
43 43
44It should also be noted that each board is required to have some certain
45headers. At the time of this writing, io.h is the only thing that needs
46to be provided for each board, and can generally just reference generic
47functions (with the exception of isa_port2addr).
48
49Next, for companion chips: 44Next, for companion chips:
50. 45.
51`-- arch 46`-- arch
@@ -104,12 +99,13 @@ and then populate that with sub-directories for each member of the family.
104Both the Solution Engine and the hp6xx boards are an example of this. 99Both the Solution Engine and the hp6xx boards are an example of this.
105 100
106After you have setup your new arch/sh/boards/ directory, remember that you 101After you have setup your new arch/sh/boards/ directory, remember that you
107also must add a directory in include/asm-sh for headers localized to this 102should also add a directory in include/asm-sh for headers localized to this
108board. In order to interoperate seamlessly with the build system, it's best 103board (if there are going to be more than one). In order to interoperate
109to have this directory the same as the arch/sh/boards/ directory name, 104seamlessly with the build system, it's best to have this directory the same
110though if your board is again part of a family, the build system has ways 105as the arch/sh/boards/ directory name, though if your board is again part of
111of dealing with this, and you can feel free to name the directory after 106a family, the build system has ways of dealing with this (via incdir-y
112the family member itself. 107overloading), and you can feel free to name the directory after the family
108member itself.
113 109
114There are a few things that each board is required to have, both in the 110There are a few things that each board is required to have, both in the
115arch/sh/boards and the include/asm-sh/ heirarchy. In order to better 111arch/sh/boards and the include/asm-sh/ heirarchy. In order to better
@@ -122,6 +118,7 @@ might look something like:
122 * arch/sh/boards/vapor/setup.c - Setup code for imaginary board 118 * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
123 */ 119 */
124#include <linux/init.h> 120#include <linux/init.h>
121#include <asm/rtc.h> /* for board_time_init() */
125 122
126const char *get_system_type(void) 123const char *get_system_type(void)
127{ 124{
@@ -152,79 +149,57 @@ int __init platform_setup(void)
152} 149}
153 150
154Our new imaginary board will also have to tie into the machvec in order for it 151Our new imaginary board will also have to tie into the machvec in order for it
155to be of any use. Currently the machvec is slowly on its way out, but is still 152to be of any use.
156required for the time being. As such, let us take a look at what needs to be
157done for the machvec assignment.
158 153
159machvec functions fall into a number of categories: 154machvec functions fall into a number of categories:
160 155
161 - I/O functions to IO memory (inb etc) and PCI/main memory (readb etc). 156 - I/O functions to IO memory (inb etc) and PCI/main memory (readb etc).
162 - I/O remapping functions (ioremap etc) 157 - I/O mapping functions (ioport_map, ioport_unmap, etc).
163 - some initialisation functions 158 - a 'heartbeat' function.
164 - a 'heartbeat' function 159 - PCI and IRQ initialization routines.
165 - some miscellaneous flags 160 - Consistent allocators (for boards that need special allocators,
166 161 particularly for allocating out of some board-specific SRAM for DMA
167The tree can be built in two ways: 162 handles).
168 - as a fully generic build. All drivers are linked in, and all functions 163
169 go through the machvec 164There are machvec functions added and removed over time, so always be sure to
170 - as a machine specific build. In this case only the required drivers 165consult include/asm-sh/machvec.h for the current state of the machvec.
171 will be linked in, and some macros may be redefined to not go through 166
172 the machvec where performance is important (in particular IO functions). 167The kernel will automatically wrap in generic routines for undefined function
173 168pointers in the machvec at boot time, as machvec functions are referenced
174There are three ways in which IO can be performed: 169unconditionally throughout most of the tree. Some boards have incredibly
175 - none at all. This is really only useful for the 'unknown' machine type, 170sparse machvecs (such as the dreamcast and sh03), whereas others must define
176 which us designed to run on a machine about which we know nothing, and 171virtually everything (rts7751r2d).
177 so all all IO instructions do nothing. 172
178 - fully custom. In this case all IO functions go to a machine specific 173Adding a new machine is relatively trivial (using vapor as an example):
179 set of functions which can do what they like 174
180 - a generic set of functions. These will cope with most situations, 175If the board-specific definitions are quite minimalistic, as is the case for
181 and rely on a single function, mv_port2addr, which is called through the 176the vast majority of boards, simply having a single board-specific header is
182 machine vector, and converts an IO address into a memory address, which 177sufficient.
183 can be read from/written to directly. 178
184 179 - add a new file include/asm-sh/vapor.h which contains prototypes for
185Thus adding a new machine involves the following steps (I will assume I am
186adding a machine called vapor):
187
188 - add a new file include/asm-sh/vapor/io.h which contains prototypes for
189 any machine specific IO functions prefixed with the machine name, for 180 any machine specific IO functions prefixed with the machine name, for
190 example vapor_inb. These will be needed when filling out the machine 181 example vapor_inb. These will be needed when filling out the machine
191 vector. 182 vector.
192 183
193 This is the minimum that is required, however there are ample 184 Note that these prototypes are generated automatically by setting
194 opportunities to optimise this. In particular, by making the prototypes 185 __IO_PREFIX to something sensible. A typical example would be:
195 inline function definitions, it is possible to inline the function when 186
196 building machine specific versions. Note that the machine vector 187 #define __IO_PREFIX vapor
197 functions will still be needed, so that a module built for a generic 188 #include <asm/io_generic.h>
198 setup can be loaded. 189
199 190 somewhere in the board-specific header. Any boards being ported that still
200 - add a new file arch/sh/boards/vapor/mach.c. This contains the definition 191 have a legacy io.h should remove it entirely and switch to the new model.
201 of the machine vector. When building the machine specific version, this 192
202 will be the real machine vector (via an alias), while in the generic 193 - Add machine vector definitions to the board's setup.c. At a bare minimum,
203 version is used to initialise the machine vector, and then freed, by 194 this must be defined as something like:
204 making it initdata. This should be defined as: 195
205 196 struct sh_machine_vector mv_vapor __initmv = {
206 struct sh_machine_vector mv_vapor __initmv = { 197 .mv_name = "vapor",
207 .mv_name = "vapor", 198 };
208 } 199 ALIAS_MV(vapor)
209 ALIAS_MV(vapor) 200
210 201 - finally add a file arch/sh/boards/vapor/io.c, which contains definitions of
211 - finally add a file arch/sh/boards/vapor/io.c, which contains 202 the machine specific io functions (if there are enough to warrant it).
212 definitions of the machine specific io functions.
213
214A note about initialisation functions. Three initialisation functions are
215provided in the machine vector:
216 - mv_arch_init - called very early on from setup_arch
217 - mv_init_irq - called from init_IRQ, after the generic SH interrupt
218 initialisation
219 - mv_init_pci - currently not used
220
221Any other remaining functions which need to be called at start up can be
222added to the list using the __initcalls macro (or module_init if the code
223can be built as a module). Many generic drivers probe to see if the device
224they are targeting is present, however this may not always be appropriate,
225so a flag can be added to the machine vector which will be set on those
226machines which have the hardware in question, reducing the probe to a
227single conditional.
228 203
2293. Hooking into the Build System 2043. Hooking into the Build System
230================================ 205================================
@@ -303,4 +278,3 @@ which will in turn copy the defconfig for this board, run it through
303oldconfig (prompting you for any new options since the time of creation), 278oldconfig (prompting you for any new options since the time of creation),
304and start you on your way to having a functional kernel for your new 279and start you on your way to having a functional kernel for your new
305board. 280board.
306
diff --git a/Documentation/sh/register-banks.txt b/Documentation/sh/register-banks.txt
new file mode 100644
index 000000000000..a6719f2f6594
--- /dev/null
+++ b/Documentation/sh/register-banks.txt
@@ -0,0 +1,33 @@
1 Notes on register bank usage in the kernel
2 ==========================================
3
4Introduction
5------------
6
7The SH-3 and SH-4 CPU families traditionally include a single partial register
8bank (selected by SR.RB, only r0 ... r7 are banked), whereas other families
9may have more full-featured banking or simply no such capabilities at all.
10
11SR.RB banking
12-------------
13
14In the case of this type of banking, banked registers are mapped directly to
15r0 ... r7 if SR.RB is set to the bank we are interested in, otherwise ldc/stc
16can still be used to reference the banked registers (as r0_bank ... r7_bank)
17when in the context of another bank. The developer must keep the SR.RB value
18in mind when writing code that utilizes these banked registers, for obvious
19reasons. Userspace is also not able to poke at the bank1 values, so these can
20be used rather effectively as scratch registers by the kernel.
21
22Presently the kernel uses several of these registers.
23
24 - r0_bank, r1_bank (referenced as k0 and k1, used for scratch
25 registers when doing exception handling).
26 - r2_bank (used to track the EXPEVT/INTEVT code)
27 - Used by do_IRQ() and friends for doing irq mapping based off
28 of the interrupt exception vector jump table offset
29 - r6_bank (global interrupt mask)
30 - The SR.IMASK interrupt handler makes use of this to set the
31 interrupt priority level (used by local_irq_enable())
32 - r7_bank (current)
33