summaryrefslogtreecommitdiffstats
path: root/sys/boot/ofw/common
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-06-17 00:17:15 +0000
committermarius <marius@FreeBSD.org>2007-06-17 00:17:15 +0000
commitd6e67283673c6e103b52b6ac2f51d6737750e55b (patch)
tree35e6798ab5035a837c333704e3613ca0fc7a5410 /sys/boot/ofw/common
parent8b5aa76c01588f5c3b349e4331a101de4e53a3d1 (diff)
downloadFreeBSD-src-d6e67283673c6e103b52b6ac2f51d6737750e55b.zip
FreeBSD-src-d6e67283673c6e103b52b6ac2f51d6737750e55b.tar.gz
- Make better use of the global chosen, memory and mmu handles instead
of obtaining them over and over again and pretending we could do anything useful without them (for chosen this includes adding a declaration and initializing it in OF_init()). - In OF_init() if obtaining the memory or mmu handle fails just call OF_exit() instead of panic() as the loader hasn't initialized the console at these early stages yet and trying to print out something causes a hang. With OF_exit() one at least has a change to get back to the OFW boot monitor and debug the problem. - Fix OF_call_method() on 64-bit machines (this is a merge of sys/dev/ofw/openfirm.c rev 1.6). - Replace OF_alloc_phys(), OF_claim_virt(), OF_map_phys() and OF_release_phys() in the MI part of the loader with wrappers around OF_call_method() in the sparc64. Beside the fact that they duplicate OF_call_method() the formers should never have been in the MI part of the loader as contrary to the OFW spec they use two-cell physical addresses. - Remove unused functions which are also MD dupes of OF_call_method(). - In sys/boot/sparc64/loader/main.c add __func__ to panic strings as different functions use otherwise identical panic strings and make some of the panic strings a tad more user-friendly instead of just mentioning the name of the function that returned an unexpected result.
Diffstat (limited to 'sys/boot/ofw/common')
-rw-r--r--sys/boot/ofw/common/main.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/boot/ofw/common/main.c b/sys/boot/ofw/common/main.c
index 2a6dd1c..1a03e9b 100644
--- a/sys/boot/ofw/common/main.c
+++ b/sys/boot/ofw/common/main.c
@@ -41,7 +41,6 @@ extern char bootprog_rev[];
extern char bootprog_date[];
extern char bootprog_maker[];
-phandle_t chosen;
u_int32_t acells;
static char bootargs[128];
@@ -64,24 +63,22 @@ init_heap(void)
uint64_t
memsize(void)
{
- ihandle_t meminstance;
- phandle_t memory;
+ phandle_t memoryp;
struct ofw_reg reg[4];
struct ofw_reg2 reg2[8];
int i;
u_int64_t sz, memsz;
- OF_getprop(chosen, "memory", &meminstance, sizeof(meminstance));
- memory = OF_instance_to_package(meminstance);
+ memoryp = OF_instance_to_package(memory);
if (acells == 1) {
- sz = OF_getprop(memory, "reg", &reg, sizeof(reg));
+ sz = OF_getprop(memoryp, "reg", &reg, sizeof(reg));
sz /= sizeof(struct ofw_reg);
for (i = 0, memsz = 0; i < sz; i++)
memsz += reg[i].size;
} else if (acells == 2) {
- sz = OF_getprop(memory, "reg", &reg2, sizeof(reg2));
+ sz = OF_getprop(memoryp, "reg", &reg2, sizeof(reg2));
sz /= sizeof(struct ofw_reg2);
for (i = 0, memsz = 0; i < sz; i++)
@@ -107,7 +104,6 @@ main(int (*openfirm)(void *))
OF_init(openfirm);
root = OF_finddevice("/");
- chosen = OF_finddevice("/chosen");
acells = 1;
OF_getprop(root, "#address-cells", &acells, sizeof(acells));
OpenPOWER on IntegriCloud