system.cc (8997:f07639e4b676) system.cc (9261:f795ce1feb5b)
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 108 unchanged lines hidden (view full) ---

117 // to do this permanently, for but early bootup work
118 // it is helpful.
119 if (params()->early_kernel_symbols) {
120 kernel->loadGlobalSymbols(kernelSymtab, loadAddrMask);
121 kernel->loadGlobalSymbols(debugSymbolTable, loadAddrMask);
122 }
123
124 // Setup boot data structure
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 108 unchanged lines hidden (view full) ---

117 // to do this permanently, for but early bootup work
118 // it is helpful.
119 if (params()->early_kernel_symbols) {
120 kernel->loadGlobalSymbols(kernelSymtab, loadAddrMask);
121 kernel->loadGlobalSymbols(debugSymbolTable, loadAddrMask);
122 }
123
124 // Setup boot data structure
125 AtagCore *ac = new AtagCore;
126 ac->flags(1); // read-only
127 ac->pagesize(8192);
128 ac->rootdev(0);
125 Addr addr = 0;
126 // Check if the kernel image has a symbol that tells us it supports
127 // device trees.
128 bool kernel_has_fdt_support =
129 kernelSymtab->findAddress("unflatten_device_tree", addr);
130 bool dtb_file_specified = params()->dtb_filename != "";
129
131
130 AddrRangeList atagRanges = physmem.getConfAddrRanges();
131 if (atagRanges.size() != 1) {
132 fatal("Expected a single ATAG memory entry but got %d\n",
133 atagRanges.size());
134 }
135 AtagMem *am = new AtagMem;
136 am->memSize(atagRanges.begin()->size());
137 am->memStart(atagRanges.begin()->start);
132 if (kernel_has_fdt_support && dtb_file_specified) {
133 // Kernel supports flattened device tree and dtb file specified.
134 // Using Device Tree Blob to describe system configuration.
135 inform("Loading DTB file: %s\n", params()->dtb_filename);
138
136
139 AtagCmdline *ad = new AtagCmdline;
140 ad->cmdline(params()->boot_osflags);
137 ObjectFile *dtb_file = createObjectFile(params()->dtb_filename, true);
138 if (!dtb_file) {
139 fatal("couldn't load DTB file: %s\n", params()->dtb_filename);
140 }
141 dtb_file->setTextBase(params()->atags_addr);
142 dtb_file->loadSections(physProxy);
143 delete dtb_file;
144 } else {
145 // Using ATAGS
146 // Warn if the kernel supports FDT and we haven't specified one
147 if (kernel_has_fdt_support) {
148 assert(!dtb_file_specified);
149 warn("Kernel supports device tree, but no DTB file specified\n");
150 }
151 // Warn if the kernel doesn't support FDT and we have specified one
152 if (dtb_file_specified) {
153 assert(!kernel_has_fdt_support);
154 warn("DTB file specified, but no device tree support in kernel\n");
155 }
141
156
142 DPRINTF(Loader, "boot command line %d bytes: %s\n", ad->size() <<2, params()->boot_osflags.c_str());
157 AtagCore *ac = new AtagCore;
158 ac->flags(1); // read-only
159 ac->pagesize(8192);
160 ac->rootdev(0);
143
161
144 AtagNone *an = new AtagNone;
162 AddrRangeList atagRanges = physmem.getConfAddrRanges();
163 if (atagRanges.size() != 1) {
164 fatal("Expected a single ATAG memory entry but got %d\n",
165 atagRanges.size());
166 }
167 AtagMem *am = new AtagMem;
168 am->memSize(atagRanges.begin()->size());
169 am->memStart(atagRanges.begin()->start);
145
170
146 uint32_t size = ac->size() + am->size() + ad->size() + an->size();
147 uint32_t offset = 0;
148 uint8_t *boot_data = new uint8_t[size << 2];
171 AtagCmdline *ad = new AtagCmdline;
172 ad->cmdline(params()->boot_osflags);
149
173
150 offset += ac->copyOut(boot_data + offset);
151 offset += am->copyOut(boot_data + offset);
152 offset += ad->copyOut(boot_data + offset);
153 offset += an->copyOut(boot_data + offset);
174 DPRINTF(Loader, "boot command line %d bytes: %s\n", ad->size() <<2, params()->boot_osflags.c_str());
154
175
155 DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2);
156 DDUMP(Loader, boot_data, size << 2);
176 AtagNone *an = new AtagNone;
157
177
158 physProxy.writeBlob(params()->atags_addr, boot_data, size << 2);
178 uint32_t size = ac->size() + am->size() + ad->size() + an->size();
179 uint32_t offset = 0;
180 uint8_t *boot_data = new uint8_t[size << 2];
159
181
182 offset += ac->copyOut(boot_data + offset);
183 offset += am->copyOut(boot_data + offset);
184 offset += ad->copyOut(boot_data + offset);
185 offset += an->copyOut(boot_data + offset);
186
187 DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2);
188 DDUMP(Loader, boot_data, size << 2);
189
190 physProxy.writeBlob(params()->atags_addr, boot_data, size << 2);
191 }
192
160 for (int i = 0; i < threadContexts.size(); i++) {
161 threadContexts[i]->setIntReg(0, 0);
162 threadContexts[i]->setIntReg(1, params()->machine_type);
163 threadContexts[i]->setIntReg(2, params()->atags_addr);
164 }
165}
166
167LinuxArmSystem::~LinuxArmSystem()

--- 12 unchanged lines hidden ---
193 for (int i = 0; i < threadContexts.size(); i++) {
194 threadContexts[i]->setIntReg(0, 0);
195 threadContexts[i]->setIntReg(1, params()->machine_type);
196 threadContexts[i]->setIntReg(2, params()->atags_addr);
197 }
198}
199
200LinuxArmSystem::~LinuxArmSystem()

--- 12 unchanged lines hidden ---