diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-11-23 01:58:13 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 22:49:58 -0500 |
commit | d7f3945420b5d8114f2d4d85e90abe5063cc196a (patch) | |
tree | ed09dbc5b91827c09d62af225ff826e2153e42af /include | |
parent | 51d3082fe6e55aecfa17113dbe98077c749f724c (diff) |
[PATCH] powerpc: Add back support for booting from BootX (#2)
ARCH=powerpc couldn't boot from BootX as it uses a "different" way of
getting in the kernel. This patch adds the necessary trampolines,
creating a flattened device-tree from the tree passed from MacOS, and
initializing the btext engine early for really-early debugging.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-powerpc/bootx.h | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/include/asm-powerpc/bootx.h b/include/asm-powerpc/bootx.h new file mode 100644 index 000000000000..ed626b7cbf22 --- /dev/null +++ b/include/asm-powerpc/bootx.h | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * This file describes the structure passed from the BootX application | ||
3 | * (for MacOS) when it is used to boot Linux. | ||
4 | * | ||
5 | * Written by Benjamin Herrenschmidt. | ||
6 | */ | ||
7 | |||
8 | |||
9 | #ifndef __ASM_BOOTX_H__ | ||
10 | #define __ASM_BOOTX_H__ | ||
11 | |||
12 | #ifdef macintosh | ||
13 | #include <Types.h> | ||
14 | #include "linux_type_defs.h" | ||
15 | #endif | ||
16 | |||
17 | #ifdef macintosh | ||
18 | /* All this requires PowerPC alignment */ | ||
19 | #pragma options align=power | ||
20 | #endif | ||
21 | |||
22 | /* On kernel entry: | ||
23 | * | ||
24 | * r3 = 0x426f6f58 ('BooX') | ||
25 | * r4 = pointer to boot_infos | ||
26 | * r5 = NULL | ||
27 | * | ||
28 | * Data and instruction translation disabled, interrupts | ||
29 | * disabled, kernel loaded at physical 0x00000000 on PCI | ||
30 | * machines (will be different on NuBus). | ||
31 | */ | ||
32 | |||
33 | #define BOOT_INFO_VERSION 5 | ||
34 | #define BOOT_INFO_COMPATIBLE_VERSION 1 | ||
35 | |||
36 | /* Bit in the architecture flag mask. More to be defined in | ||
37 | future versions. Note that either BOOT_ARCH_PCI or | ||
38 | BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are | ||
39 | set additionally when BOOT_ARCH_NUBUS is set. | ||
40 | */ | ||
41 | #define BOOT_ARCH_PCI 0x00000001UL | ||
42 | #define BOOT_ARCH_NUBUS 0x00000002UL | ||
43 | #define BOOT_ARCH_NUBUS_PDM 0x00000010UL | ||
44 | #define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL | ||
45 | #define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL | ||
46 | |||
47 | /* Maximum number of ranges in phys memory map */ | ||
48 | #define MAX_MEM_MAP_SIZE 26 | ||
49 | |||
50 | /* This is the format of an element in the physical memory map. Note that | ||
51 | the map is optional and current BootX will only build it for pre-PCI | ||
52 | machines */ | ||
53 | typedef struct boot_info_map_entry | ||
54 | { | ||
55 | __u32 physAddr; /* Physical starting address */ | ||
56 | __u32 size; /* Size in bytes */ | ||
57 | } boot_info_map_entry_t; | ||
58 | |||
59 | |||
60 | /* Here are the boot informations that are passed to the bootstrap | ||
61 | * Note that the kernel arguments and the device tree are appended | ||
62 | * at the end of this structure. */ | ||
63 | typedef struct boot_infos | ||
64 | { | ||
65 | /* Version of this structure */ | ||
66 | __u32 version; | ||
67 | /* backward compatible down to version: */ | ||
68 | __u32 compatible_version; | ||
69 | |||
70 | /* NEW (vers. 2) this holds the current _logical_ base addr of | ||
71 | the frame buffer (for use by early boot message) */ | ||
72 | __u8* logicalDisplayBase; | ||
73 | |||
74 | /* NEW (vers. 4) Apple's machine identification */ | ||
75 | __u32 machineID; | ||
76 | |||
77 | /* NEW (vers. 4) Detected hw architecture */ | ||
78 | __u32 architecture; | ||
79 | |||
80 | /* The device tree (internal addresses relative to the beginning of the tree, | ||
81 | * device tree offset relative to the beginning of this structure). | ||
82 | * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this | ||
83 | * field is 0. | ||
84 | */ | ||
85 | __u32 deviceTreeOffset; /* Device tree offset */ | ||
86 | __u32 deviceTreeSize; /* Size of the device tree */ | ||
87 | |||
88 | /* Some infos about the current MacOS display */ | ||
89 | __u32 dispDeviceRect[4]; /* left,top,right,bottom */ | ||
90 | __u32 dispDeviceDepth; /* (8, 16 or 32) */ | ||
91 | __u8* dispDeviceBase; /* base address (physical) */ | ||
92 | __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */ | ||
93 | __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ | ||
94 | /* Optional offset in the registry to the current | ||
95 | * MacOS display. (Can be 0 when not detected) */ | ||
96 | __u32 dispDeviceRegEntryOffset; | ||
97 | |||
98 | /* Optional pointer to boot ramdisk (offset from this structure) */ | ||
99 | __u32 ramDisk; | ||
100 | __u32 ramDiskSize; /* size of ramdisk image */ | ||
101 | |||
102 | /* Kernel command line arguments (offset from this structure) */ | ||
103 | __u32 kernelParamsOffset; | ||
104 | |||
105 | /* ALL BELOW NEW (vers. 4) */ | ||
106 | |||
107 | /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag | ||
108 | (non-PCI) only. On PCI, memory is contiguous and it's size is in the | ||
109 | device-tree. */ | ||
110 | boot_info_map_entry_t | ||
111 | physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */ | ||
112 | __u32 physMemoryMapSize; /* How many entries in map */ | ||
113 | |||
114 | |||
115 | /* The framebuffer size (optional, currently 0) */ | ||
116 | __u32 frameBufferSize; /* Represents a max size, can be 0. */ | ||
117 | |||
118 | /* NEW (vers. 5) */ | ||
119 | |||
120 | /* Total params size (args + colormap + device tree + ramdisk) */ | ||
121 | __u32 totalParamsSize; | ||
122 | |||
123 | } boot_infos_t; | ||
124 | |||
125 | /* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index | ||
126 | * is represented by 3 short words containing a 16 bits (unsigned) color | ||
127 | * component. Later versions may contain the gamma table for direct-color | ||
128 | * devices here. | ||
129 | */ | ||
130 | #define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL) | ||
131 | |||
132 | /* BootX passes the device-tree using a format that comes from earlier | ||
133 | * ppc32 kernels. This used to match what is in prom.h, but not anymore | ||
134 | * so we now define it here | ||
135 | */ | ||
136 | struct bootx_dt_prop { | ||
137 | u32 name; | ||
138 | int length; | ||
139 | u32 value; | ||
140 | u32 next; | ||
141 | }; | ||
142 | |||
143 | struct bootx_dt_node { | ||
144 | u32 unused0; | ||
145 | u32 unused1; | ||
146 | u32 phandle; /* not really available */ | ||
147 | u32 unused2; | ||
148 | u32 unused3; | ||
149 | u32 unused4; | ||
150 | u32 unused5; | ||
151 | u32 full_name; | ||
152 | u32 properties; | ||
153 | u32 parent; | ||
154 | u32 child; | ||
155 | u32 sibling; | ||
156 | u32 next; | ||
157 | u32 allnext; | ||
158 | }; | ||
159 | |||
160 | extern void bootx_init(unsigned long r4, unsigned long phys); | ||
161 | |||
162 | #ifdef macintosh | ||
163 | #pragma options align=reset | ||
164 | #endif | ||
165 | |||
166 | #endif | ||