xref: /OK3568_Linux_fs/kernel/Documentation/arm/porting.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=======
2*4882a593SmuzhiyunPorting
3*4882a593Smuzhiyun=======
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunTaken from list archive at http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2001-July/004064.html
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunInitial definitions
8*4882a593Smuzhiyun-------------------
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunThe following symbol definitions rely on you knowing the translation that
11*4882a593Smuzhiyun__virt_to_phys() does for your machine.  This macro converts the passed
12*4882a593Smuzhiyunvirtual address to a physical address.  Normally, it is simply:
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun		phys = virt - PAGE_OFFSET + PHYS_OFFSET
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunDecompressor Symbols
18*4882a593Smuzhiyun--------------------
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunZTEXTADDR
21*4882a593Smuzhiyun	Start address of decompressor.  There's no point in talking about
22*4882a593Smuzhiyun	virtual or physical addresses here, since the MMU will be off at
23*4882a593Smuzhiyun	the time when you call the decompressor code.  You normally call
24*4882a593Smuzhiyun	the kernel at this address to start it booting.  This doesn't have
25*4882a593Smuzhiyun	to be located in RAM, it can be in flash or other read-only or
26*4882a593Smuzhiyun	read-write addressable medium.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunZBSSADDR
29*4882a593Smuzhiyun	Start address of zero-initialised work area for the decompressor.
30*4882a593Smuzhiyun	This must be pointing at RAM.  The decompressor will zero initialise
31*4882a593Smuzhiyun	this for you.  Again, the MMU will be off.
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunZRELADDR
34*4882a593Smuzhiyun	This is the address where the decompressed kernel will be written,
35*4882a593Smuzhiyun	and eventually executed.  The following constraint must be valid:
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun		__virt_to_phys(TEXTADDR) == ZRELADDR
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun	The initial part of the kernel is carefully coded to be position
40*4882a593Smuzhiyun	independent.
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunINITRD_PHYS
43*4882a593Smuzhiyun	Physical address to place the initial RAM disk.  Only relevant if
44*4882a593Smuzhiyun	you are using the bootpImage stuff (which only works on the old
45*4882a593Smuzhiyun	struct param_struct).
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunINITRD_VIRT
48*4882a593Smuzhiyun	Virtual address of the initial RAM disk.  The following  constraint
49*4882a593Smuzhiyun	must be valid:
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun		__virt_to_phys(INITRD_VIRT) == INITRD_PHYS
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunPARAMS_PHYS
54*4882a593Smuzhiyun	Physical address of the struct param_struct or tag list, giving the
55*4882a593Smuzhiyun	kernel various parameters about its execution environment.
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunKernel Symbols
59*4882a593Smuzhiyun--------------
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunPHYS_OFFSET
62*4882a593Smuzhiyun	Physical start address of the first bank of RAM.
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunPAGE_OFFSET
65*4882a593Smuzhiyun	Virtual start address of the first bank of RAM.  During the kernel
66*4882a593Smuzhiyun	boot phase, virtual address PAGE_OFFSET will be mapped to physical
67*4882a593Smuzhiyun	address PHYS_OFFSET, along with any other mappings you supply.
68*4882a593Smuzhiyun	This should be the same value as TASK_SIZE.
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunTASK_SIZE
71*4882a593Smuzhiyun	The maximum size of a user process in bytes.  Since user space
72*4882a593Smuzhiyun	always starts at zero, this is the maximum address that a user
73*4882a593Smuzhiyun	process can access+1.  The user space stack grows down from this
74*4882a593Smuzhiyun	address.
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun	Any virtual address below TASK_SIZE is deemed to be user process
77*4882a593Smuzhiyun	area, and therefore managed dynamically on a process by process
78*4882a593Smuzhiyun	basis by the kernel.  I'll call this the user segment.
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun	Anything above TASK_SIZE is common to all processes.  I'll call
81*4882a593Smuzhiyun	this the kernel segment.
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun	(In other words, you can't put IO mappings below TASK_SIZE, and
84*4882a593Smuzhiyun	hence PAGE_OFFSET).
85*4882a593Smuzhiyun
86*4882a593SmuzhiyunTEXTADDR
87*4882a593Smuzhiyun	Virtual start address of kernel, normally PAGE_OFFSET + 0x8000.
88*4882a593Smuzhiyun	This is where the kernel image ends up.  With the latest kernels,
89*4882a593Smuzhiyun	it must be located at 32768 bytes into a 128MB region.  Previous
90*4882a593Smuzhiyun	kernels placed a restriction of 256MB here.
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunDATAADDR
93*4882a593Smuzhiyun	Virtual address for the kernel data segment.  Must not be defined
94*4882a593Smuzhiyun	when using the decompressor.
95*4882a593Smuzhiyun
96*4882a593SmuzhiyunVMALLOC_START / VMALLOC_END
97*4882a593Smuzhiyun	Virtual addresses bounding the vmalloc() area.  There must not be
98*4882a593Smuzhiyun	any static mappings in this area; vmalloc will overwrite them.
99*4882a593Smuzhiyun	The addresses must also be in the kernel segment (see above).
100*4882a593Smuzhiyun	Normally, the vmalloc() area starts VMALLOC_OFFSET bytes above the
101*4882a593Smuzhiyun	last virtual RAM address (found using variable high_memory).
102*4882a593Smuzhiyun
103*4882a593SmuzhiyunVMALLOC_OFFSET
104*4882a593Smuzhiyun	Offset normally incorporated into VMALLOC_START to provide a hole
105*4882a593Smuzhiyun	between virtual RAM and the vmalloc area.  We do this to allow
106*4882a593Smuzhiyun	out of bounds memory accesses (eg, something writing off the end
107*4882a593Smuzhiyun	of the mapped memory map) to be caught.  Normally set to 8MB.
108*4882a593Smuzhiyun
109*4882a593SmuzhiyunArchitecture Specific Macros
110*4882a593Smuzhiyun----------------------------
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunBOOT_MEM(pram,pio,vio)
113*4882a593Smuzhiyun	`pram` specifies the physical start address of RAM.  Must always
114*4882a593Smuzhiyun	be present, and should be the same as PHYS_OFFSET.
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun	`pio` is the physical address of an 8MB region containing IO for
117*4882a593Smuzhiyun	use with the debugging macros in arch/arm/kernel/debug-armv.S.
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun	`vio` is the virtual address of the 8MB debugging region.
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun	It is expected that the debugging region will be re-initialised
122*4882a593Smuzhiyun	by the architecture specific code later in the code (via the
123*4882a593Smuzhiyun	MAPIO function).
124*4882a593Smuzhiyun
125*4882a593SmuzhiyunBOOT_PARAMS
126*4882a593Smuzhiyun	Same as, and see PARAMS_PHYS.
127*4882a593Smuzhiyun
128*4882a593SmuzhiyunFIXUP(func)
129*4882a593Smuzhiyun	Machine specific fixups, run before memory subsystems have been
130*4882a593Smuzhiyun	initialised.
131*4882a593Smuzhiyun
132*4882a593SmuzhiyunMAPIO(func)
133*4882a593Smuzhiyun	Machine specific function to map IO areas (including the debug
134*4882a593Smuzhiyun	region above).
135*4882a593Smuzhiyun
136*4882a593SmuzhiyunINITIRQ(func)
137*4882a593Smuzhiyun	Machine specific function to initialise interrupts.
138