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